:root {
  color-scheme: light;
  --background: #f6f8fc;
  --white: #fff;
  --ink: #16223b;
  --muted: #566581;
  --subtle: #687895;
  --line: #e1e7f0;
  --blue: #254fdb;
  --blue-dark: #1c3db2;
  --pale: #ecf1ff;
  --radius: 17px;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  font-synthesis: none;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: var(--background); color: var(--ink); }
button, input, textarea, select { font: inherit; }
button, a, input, textarea, select { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
a { color: var(--blue); }
button:disabled { opacity: .53; cursor: default; }
button, a { touch-action: manipulation; }
:focus-visible { outline: 3px solid #809cff; outline-offset: 3px; }
h1, h2, h3, p { margin: 0; }
svg { flex-shrink: 0; vertical-align: middle; }
.skip { position: fixed; top: -60px; z-index: 10; padding: 12px; background: white; }
.skip:focus { top: 0; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: 229px; background: white; border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 24px 16px 20px; z-index: 5; }
.brand { display: flex; align-items: center; gap: 11px; margin: 0 0 47px 7px; color: var(--ink); font-weight: 730; font-size: 17px; letter-spacing: -.45px; text-decoration: none; white-space: nowrap; }
.brand-icon { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--blue); color: white; box-shadow: 0 2px 4px #1d47c52b; }
.nav-label { padding: 0 12px 9px; font-size: 10.5px; font-weight: 720; color: var(--subtle); letter-spacing: .10em; text-transform: uppercase; }
.nav-list { display: grid; gap: 4px; }
.nav-link { width: 100%; display: flex; align-items: center; gap: 11px; border: 0; background: transparent; color: var(--muted); padding: 11px 12px; min-height: 44px; border-radius: 9px; text-align: left; font-size: 13.5px; font-weight: 580; text-decoration: none; }
.nav-link:hover, .nav-link.active { color: var(--blue-dark); background: var(--pale); }
.sidebar-foot { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--line); }
.shell { margin-left: 229px; }
.topbar { height: 66px; border-bottom: 1px solid var(--line); background: white; display: flex; align-items: center; justify-content: space-between; padding: 0 33px; }
.breadcrumb { display: flex; align-items: center; gap: 9px; min-width: 0; font-size: 13px; color: var(--muted); }
.breadcrumb strong { color: var(--ink); font-weight: 660; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-right { display: flex; align-items: center; gap: 13px; }
.course-dot { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.course-dot::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #5475ed; }
.mobile-menu { display: none !important; }
.page { max-width: 1250px; margin: 0 auto; padding: 43px 34px 60px; }
.page-heading { margin-bottom: 30px; }
.page-heading h1 { font-size: clamp(34px, 4.05vw, 47px); letter-spacing: -.065em; font-weight: 750; line-height: 1.1; }
.page-heading p { color: var(--muted); margin-top: 12px; line-height: 1.55; font-size: 15px; }
.dashboard { display: grid; grid-template-columns: minmax(0, 1.9fr) minmax(260px, 1fr); gap: 22px; align-items: start; }
.card { background: white; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 2px 5px #192a5205; min-width: 0; }
.card-pad { padding: 23px; }
.section-heading { display: flex; align-items: center; gap: 11px; margin-bottom: 21px; }
.section-heading h2 { font-size: 19px; letter-spacing: -.035em; font-weight: 730; }
.section-icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: var(--pale); color: var(--blue); flex-shrink: 0; }
.section-icon.neutral { background: #f0f3f8; color: #566a92; }
label, legend, .field-label { display: block; font-size: 13px; font-weight: 690; }
.field { margin-bottom: 19px; }
.field label, .field .field-label { margin-bottom: 8px; }
textarea, select, .question-input { width: 100%; border: 1px solid #dce3ee; border-radius: 9px; background: #fbfcff; color: var(--ink); }
textarea, .question-input { padding: 11px 12px; line-height: 1.55; }
textarea { min-height: 86px; resize: vertical; }
textarea::placeholder, input::placeholder { color: #697891; opacity: 1; }
textarea:focus, select:focus, .question-input:focus { border-color: #819cf4; outline: 2px solid #e1eaff; outline-offset: 1px; }
fieldset { padding: 0; border: 0; margin: 0 0 20px; min-width: 0; }
legend { margin-bottom: 9px; }
.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip { position: relative; display: inline-flex; }
.chip input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.chip span { min-height: 34px; display: inline-flex; align-items: center; padding: 6px 10px; gap: 6px; border-radius: 7px; border: 1px solid var(--line); color: var(--muted); background: white; font-size: 12px; font-weight: 580; }
.chip i { width: 12px; height: 12px; display: grid; place-items: center; border: 1px solid #b4c1d7; border-radius: 3px; color: transparent; }
.chip input:checked + span { color: var(--blue-dark); background: var(--pale); border-color: #becbff; }
.chip input:checked + span i { color: white; background: var(--blue); border-color: var(--blue); }
.chip input:focus-visible + span { outline: 3px solid #809cff; outline-offset: 2px; }
.chip:hover span { border-color: #a9b9e1; }
.split { display: grid; grid-template-columns: 1fr 1.06fr; gap: 23px; align-items: start; }
.split .field { margin-bottom: 17px; min-width: 0; }
.select { position: relative; }
.select svg { pointer-events: none; position: absolute; right: 11px; top: 13px; color: var(--muted); }
select { appearance: none; min-height: 42px; padding: 8px 33px 8px 11px; font-size: 13px; }
.slider-top { display: flex; justify-content: space-between; align-items: center; min-height: 20px; margin-bottom: 5px; }
.slider-top label { margin: 0; }
.slider-top output { color: var(--blue-dark); font-size: 12px; font-weight: 720; background: var(--pale); border-radius: 6px; min-width: 24px; min-height: 22px; display: grid; place-items: center; }
input[type=range] { appearance: none; display: block; width: 100%; margin: 0; height: 22px; background: transparent; cursor: pointer; }
input[type=range]::-webkit-slider-runnable-track { height: 5px; border-radius: 5px; background: linear-gradient(to right, var(--blue) var(--progress), #e4e9f4 var(--progress)); }
input[type=range]::-moz-range-track { height: 5px; border-radius: 5px; background: #e4e9f4; }
input[type=range]::-moz-range-progress { height: 5px; border-radius: 5px; background: var(--blue); }
input[type=range]::-webkit-slider-thumb { appearance: none; width: 16px; height: 16px; border-radius: 50%; background: var(--blue); margin-top: -5.5px; border: 2px solid white; box-shadow: 0 0 0 1px var(--blue); }
input[type=range]::-moz-range-thumb { width: 12px; height: 12px; border-radius: 50%; background: var(--blue); border: 2px solid white; box-shadow: 0 0 0 1px var(--blue); }
.range-labels { display: flex; justify-content: space-between; font-size: 11px; color: var(--subtle); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 13px; min-height: 41px; border-radius: 8px; border: 1px solid var(--line); font-size: 13px; font-weight: 670; color: var(--ink); background: white; text-decoration: none; }
.btn:hover:not(:disabled) { background: #f4f7fe; border-color: #becbeb; }
.btn.primary { color: white; background: var(--blue); border-color: var(--blue); box-shadow: 0 1px 2px #203da933; }
.btn.primary:hover:not(:disabled) { background: var(--blue-dark); border-color: var(--blue-dark); }
.btn.full { width: 100%; }
.btn.icon { width: 36px; min-height: 36px; padding: 0; }
.btn.quiet { border-color: transparent; background: transparent; }
.btn.active { color: var(--blue-dark); border-color: #c9d6ff; background: var(--pale); }
.muted { color: var(--muted); }
.small { font-size: 13px; line-height: 1.55; }
.upload-zone { width: 100%; border: 1px dashed #b9c8e5; background: #f9fbff; border-radius: 11px; padding: 23px 9px; text-align: center; color: var(--ink); display: flex; align-items: center; flex-direction: column; gap: 7px; }
.upload-zone:hover, .upload-zone.dragging { border-color: var(--blue); background: var(--pale); }
.upload-icon { display: grid; place-items: center; width: 37px; height: 37px; color: var(--blue); background: var(--pale); border-radius: 9px; margin-bottom: 3px; }
.upload-zone strong { font-size: 13px; }
.upload-zone small { font-size: 11.5px; color: var(--muted); }
.library-note { margin: -8px 0 15px; }
.library-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 16px; gap: 10px; }
.text-link { display: inline-flex; align-items: center; gap: 5px; color: var(--blue-dark); border: 0; background: transparent; font-size: 12.5px; font-weight: 690; padding: 0; text-decoration: none; }
.text-link:hover { text-decoration: underline; }
.file-list { display: grid; margin-top: 12px; }
.file-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.file-row:last-child { border-bottom: 0; }
.file-name { flex: 1; min-width: 0; font-weight: 620; font-size: 13px; overflow-wrap: anywhere; }
.file-name small { display: block; color: var(--muted); font-size: 11px; font-weight: 450; margin-top: 3px; }
.recent { margin-top: 27px; }
.recent-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; gap: 15px; }
.recent-head h2 { font-size: 18px; letter-spacing: -.025em; }
.set-list { display: grid; gap: 8px; }
.set-row { display: flex; width: 100%; text-align: left; align-items: center; gap: 12px; padding: 12px 14px; background: white; color: var(--ink); border: 1px solid var(--line); border-radius: 11px; text-decoration: none; }
.set-row:hover { border-color: #adbfef; background: #fcfdff; }
.set-row strong { display: block; font-size: 13.5px; font-weight: 680; }
.set-row small { display: block; color: var(--muted); font-size: 12px; margin-top: 4px; }
.set-row > svg:last-child { margin-left: auto; color: var(--subtle); }
.library-page { max-width: 790px; }
.library-page .upload-zone { padding-block: 28px; }
.notice { display: flex; align-items: flex-start; gap: 8px; color: var(--muted); font-size: 12.5px; line-height: 1.5; margin: 14px 0 0; }
.notice svg { margin-top: 1px; }
.msg { color: #a1283e; font-size: 13px; line-height: 1.45; margin-top: 9px; }
.msg:empty { display: none; }
.workspace { padding-top: 25px; }
.workspace-header { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin-bottom: 17px; }
.workspace-header h1 { font-size: 25px; letter-spacing: -.045em; font-weight: 740; flex: 1; min-width: 180px; }
.workspace-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(255px, 325px); gap: 17px; align-items: start; }
.exercise-nav { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 17px; }
.exercise-nav button { min-height: 35px; min-width: 35px; padding: 5px 10px; }
.exercise-card { overflow: hidden; }
.problem { padding: 22px; }
.problem .position { color: var(--muted); font-size: 12px; font-weight: 630; margin-bottom: 7px; }
.problem h2 { font-size: 23px; letter-spacing: -.04em; margin-bottom: 12px; }
.prose { line-height: 1.65; font-size: 14px; overflow-wrap: anywhere; white-space: pre-wrap; }
.prose .katex-display { overflow-x: auto; overflow-y: hidden; padding-block: 3px; white-space: normal; }
.part-list { list-style: lower-alpha; margin: 10px 0 0; padding-left: 19px; }
.part-list li { padding-left: 4px; margin-top: 7px; }
.paper-head { padding: 10px 12px; background: #fcfdff; border-block: 1px solid var(--line); display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; align-items: center; }
.paper-tools { display: flex; gap: 4px; }
.paper-tools .btn { flex: none; width: 35px; min-height: 34px; }
.paper-title { font-weight: 680; font-size: 13px; }
.paper { display: block; width: 100%; background-color: white; touch-action: none; user-select: none; -webkit-user-select: none; cursor: crosshair; }
.paper-footer { border-top: 1px solid var(--line); padding: 9px 12px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 7px; }
.paper-footer .btn { min-height: 34px; }
.paper-footer .muted { font-size: 11px; }
.tutor { position: sticky; top: 13px; }
.tutor > header { border-bottom: 1px solid var(--line); padding: 14px; }
.tutor h2 { display: flex; align-items: center; gap: 8px; font-size: 16px; }
.tutor h2 svg { color: var(--blue); }
.tutor-actions { padding: 12px; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.tutor-actions select { grid-column: 1 / -1; margin: 0; min-height: 36px; border-radius: 7px; appearance: auto; padding: 7px; }
.tutor-actions .btn { font-size: 12px; min-height: 36px; }
.chat-scroll { min-height: 122px; max-height: 350px; overflow: auto; padding: 0 12px 12px; display: flex; flex-direction: column; gap: 8px; }
.chat-intro { padding: 13px 4px; }
.chat-bubble { padding: 8px 10px; border-radius: 9px; font-size: 13px; }
.chat-bubble.user { margin-left: 17px; background: var(--pale); }
.chat-bubble.assistant { margin-right: 12px; background: #f3f5f9; }
.chat-form { display: flex; gap: 7px; border-top: 1px solid var(--line); padding: 10px; }
.chat-form textarea { min-height: 41px; resize: vertical; font-size: 13px; padding: 8px; }
.chat-form .btn { align-self: flex-end; min-height: 41px; }
.chat-msg { padding: 0 13px 10px; margin-top: 0; }
#toast { position: fixed; z-index: 9; right: 16px; bottom: 16px; max-width: min(370px, calc(100vw - 32px)); border-radius: 9px; background: var(--ink); color: white; box-shadow: 0 5px 15px #16223b30; font-size: 13px; line-height: 1.45; padding: 12px 15px; }
#toast:empty { display: none; }
dialog { width: min(440px, calc(100vw - 24px)); color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: 0 16px 70px #15244530; }
dialog::backdrop { background: #14214268; }
.dialog-head { display: flex; gap: 10px; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.dialog-head h2 { font-size: 20px; }
.dialog-actions { margin-top: 17px; display: flex; justify-content: flex-end; gap: 8px; }
code { font-size: .93em; background: #edf1f8; padding: 1px 4px; border-radius: 4px; }
@media (max-width: 1100px) {
  .sidebar { width: 196px; }
  .shell { margin-left: 196px; }
  .topbar { padding-inline: 23px; }
  .page { padding-inline: 23px; }
  .dashboard { gap: 14px; }
  .card-pad { padding: 18px; }
}
@media (max-width: 900px) {
  .sidebar { width: 168px; padding-inline: 10px; }
  .shell { margin-left: 168px; }
  .brand { font-size: 15px; gap: 8px; }
  .dashboard, .workspace-grid { grid-template-columns: 1fr; }
  .tutor { position: static; }
}
@media (max-width: 650px) {
  .sidebar { inset: 53px auto 0 0; width: 215px; display: none; box-shadow: 12px 4px 30px #17264415; }
  .sidebar.open { display: flex; }
  .sidebar .brand { display: none; }
  .shell { margin-left: 0; }
  .topbar { height: 53px; padding-inline: 12px; gap: 10px; }
  .mobile-menu { display: inline-flex !important; }
  .breadcrumb { margin-right: auto; gap: 5px; }
  .breadcrumb > svg:first-child { display: none; }
  .page { padding: 24px 12px 36px; }
  .page-heading { margin-bottom: 19px; }
  .page-heading p { font-size: 14px; }
  .card-pad, .problem { padding: 15px; }
  .split { gap: 12px; }
  .workspace-header h1 { font-size: 20px; min-width: 110px; }
}
