/* Your Maths Tutor — colourful student studio.
   Loaded last. Layout rules belong to the public gate, dashboard and two new
   destinations; existing boards, written mathematics and study views keep theirs. */

/* Shared studio details, deliberately scoped away from lesson content. */
:is(#welcome, #home, #practice-hub) .studio-eyebrow {
  color: var(--studio-teal-ink); font: 700 .76rem/1.5 var(--sans);
  letter-spacing: .14em; text-transform: uppercase;
}
:is(#welcome, #home, #practice-hub) :is(.primary, .secondary) {
  gap: 10px; font-weight: 650; text-decoration: none;
  transition: background .16s ease, border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}
:is(#welcome, #home, #practice-hub) :is(.primary, .secondary) > svg { flex: none; }
:is(#welcome, #home, #practice-hub) :is(button, a, input):focus-visible {
  outline: 3px solid var(--focus); outline-offset: 4px;
}
:is(#welcome, #home, #practice-hub, #sidebar) .planned-badge {
  display: inline-flex; align-items: center; width: fit-content; max-width: 100%;
  padding: 4px 9px; border-radius: 999px; background: var(--accent-soft);
  color: var(--accent-ink); font: 650 .65rem/1.35 var(--sans); letter-spacing: .025em;
}
:is(#welcome, #sidebar .side-top, #workspace .topbar) .mark {
  width: 40px; height: 40px; border-radius: 12px;
  background: var(--primary); color: var(--on-primary);
  font: 700 31px/1 var(--sans); letter-spacing: -.06em; padding-right: 2px;
}

/* Public entry: an actual demonstration, then an always-visible auth form. */
#welcome {
  display: flex; flex-direction: column; align-items: stretch; gap: 0;
  width: 100%; max-width: 1440px; min-height: 100vh;
  padding: 0 clamp(20px, 5vw, 72px); margin: 0 auto;
}
#welcome .welcome-header {
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  width: 100%; padding: 24px 0; min-height: 94px;
}
#welcome .brand { gap: 12px; color: var(--ink); font-size: 20px; font-weight: 700; text-decoration: none; line-height: 1.25; }
#welcome .welcome-nav { display: flex; justify-content: center; align-items: center; gap: clamp(18px, 2.6vw, 38px); }
#welcome .welcome-nav a { padding: 9px 0; color: var(--ink-2); font-size: 14px; font-weight: 550; text-decoration: none; white-space: nowrap; }
#welcome .welcome-nav a:hover { color: var(--accent-ink); }
#welcome .welcome-account { display: flex; align-items: center; gap: 18px; flex: none; }
#welcome .welcome-account .text-button { color: var(--ink); font-size: 14px; }
#welcome .welcome-account .primary { min-height: 46px; padding: 0 20px; }
#welcome .welcome-account .primary > svg { display: none; }
#welcome .welcome-hero {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.04fr);
  align-items: center; gap: clamp(32px, 4.2vw, 60px); padding: 36px 0 52px;
}
#welcome .welcome-copy { min-width: 0; padding: 8px 0; }
#welcome .welcome-copy .studio-eyebrow { font-size: .8rem; letter-spacing: .08em; }
#welcome h1 {
  max-width: 650px; margin: 20px 0 22px; color: var(--ink);
  font: 700 clamp(2.75rem, 4.8vw, 4.25rem)/1.03 var(--sans); letter-spacing: -.052em;
}
#welcome .lede { max-width: 550px; color: var(--ink-2); font-size: clamp(1rem, 1.6vw, 1.2rem); line-height: 1.6; }
#welcome .welcome-actions { display: flex; flex-wrap: wrap; gap: 14px; margin: 28px 0 24px; }
#welcome .welcome-actions :is(.primary, .secondary) { min-height: 54px; padding: 0 25px; border-radius: var(--btn-radius); font-size: 16px; }
#welcome .welcome-actions .secondary { background: var(--surface); border-color: var(--line-3); }
#welcome .welcome-actions .primary { box-shadow: 0 5px 14px rgb(108 76 241 / 14%); }
#welcome .welcome-points { display: flex; flex-wrap: wrap; gap: 10px; margin: 0; font-size: 12px; }
#welcome .welcome-points li {
  align-items: center; gap: 8px; padding: 8px 11px; border: 1px solid var(--line);
  border-radius: 999px; background: var(--surface); color: var(--ink-2);
}
#welcome .welcome-points li::before { content: none; }
#welcome .welcome-points svg { flex: none; color: var(--studio-teal-ink); }

#practice-hub .math-preview {
  position: relative; min-width: 0; scroll-margin-top: 24px; isolation: isolate;
  border: 1px solid rgb(255 255 255 / 18%); border-radius: 28px; padding: 16px;
  background: linear-gradient(145deg, #7454f5 0%, #5d3fd7 65%, #4b36b3 100%);
  color: #fff; box-shadow: 0 16px 32px rgb(60 42 125 / 13%);
}
#practice-hub .math-preview::before {
  content: ""; position: absolute; z-index: -1; top: 48px; left: -30px;
  width: 115px; height: 115px; border-radius: 48% 52% 58% 42%;
  background: var(--studio-teal-wash); transform: rotate(-18deg);
}
#practice-hub .math-preview::after {
  content: ""; position: absolute; z-index: -1; right: -24px; bottom: 65px;
  width: 105px; height: 105px; border-radius: 50%; background: var(--studio-amber-wash);
}
#practice-hub .preview-caption { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 3px 11px 14px; font: 650 .7rem/1.5 var(--sans); letter-spacing: .2em; text-transform: uppercase; }
#practice-hub .preview-dots { display: flex; gap: 8px; }
#practice-hub .preview-dots i { display: block; width: 9px; height: 9px; border-radius: 50%; background: rgb(255 255 255 / 28%); }
#practice-hub .preview-board { position: relative; overflow: hidden; padding: 22px 23px 0; border-radius: 18px; background: #fff; color: #20204a; }
#practice-hub .preview-board h2 { max-width: 390px; font: 700 clamp(1rem, 1.5vw, 1.25rem)/1.3 var(--sans); letter-spacing: -.025em; }
#practice-hub .demo-equation { margin-top: 4px; font: 500 25px/1.4 var(--serif); }
#practice-hub .demo-nudge { position: absolute; top: 84px; right: 15px; padding: 6px 10px; border-radius: 9px; background: #ffeae5; color: #9d3c33; font-size: 10px; font-weight: 650; transform: rotate(-3deg); }
#practice-hub .demo-graph { display: block; overflow: hidden; width: 100%; height: auto; margin: 10px auto 0; aspect-ratio: 400 / 220; }
#practice-hub .demo-grid { color: #d8d5e3; }
#practice-hub .demo-axes { color: #b4afc4; }
#practice-hub .demo-ticks { color: #66617b; font-family: var(--sans); }
#practice-hub .demo-line { color: #6c4cf1; }
#practice-hub .demo-point { color: #15998d; stroke: #fff; }
#practice-hub .demo-controls { display: flex; align-items: center; gap: 16px; min-height: 66px; margin-top: 10px; padding: 10px 15px; border-radius: 15px; background: #302567; }
#practice-hub .demo-controls label { display: flex; align-items: center; gap: 8px; flex: none; font-size: 13px; font-weight: 550; }
#welcome #demo-slope-value { display: inline-grid; place-items: center; min-width: 29px; height: 26px; padding: 0 5px; border-radius: 7px; background: rgb(255 255 255 / 12%); font-weight: 700; font-variant-numeric: tabular-nums; }
#welcome #demo-slope { width: 100%; min-width: 0; height: 36px; margin: 0; background: transparent; cursor: pointer; accent-color: #48c7b9; }
#welcome #demo-slope::-webkit-slider-runnable-track { height: 7px; border-radius: 99px; background: #d9cef6; }
#welcome #demo-slope::-webkit-slider-thumb { appearance: none; width: 21px; height: 21px; margin-top: -7px; border: 3px solid #fff; border-radius: 50%; background: #15998d; box-shadow: 0 1px 5px rgb(0 0 0 / 22%); }
#welcome #demo-slope { appearance: none; }
#welcome #demo-slope::-moz-range-track { height: 7px; border-radius: 99px; background: #d9cef6; }
#welcome #demo-slope::-moz-range-thumb { width: 17px; height: 17px; border: 3px solid #fff; border-radius: 50%; background: #15998d; box-shadow: 0 1px 5px rgb(0 0 0 / 22%); }
#welcome #demo-slope:focus-visible { outline-color: #fff; outline-offset: 4px; border-radius: 6px; }
#practice-hub .demo-control-icon { display: grid; place-items: center; flex: none; width: 38px; height: 38px; border-radius: 10px; background: rgb(255 255 255 / 10%); color: #b2f1e8; }
#practice-hub .demo-explanation { min-height: 2.8em; margin: 11px 9px 2px; color: #f1eaff; font-size: 12px; line-height: 1.45; }

#welcome .learning-choices { padding: 4px 0 44px; scroll-margin-top: 24px; }
#welcome :is(.learning-choices, .welcome-how) h2 { font: 700 clamp(1.5rem, 2.4vw, 2rem)/1.2 var(--sans); letter-spacing: -.035em; }
#welcome .choice-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-top: 20px; }
#welcome .learning-choice {
  display: flex; align-items: center; gap: 15px; min-width: 0; width: 100%; min-height: 126px;
  padding: 20px; border: 1px solid var(--line); border-radius: 18px;
  background: var(--surface); color: var(--ink); text-align: left; text-decoration: none;
  box-shadow: var(--shadow); transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease;
}
#welcome .learning-choice:hover { transform: translateY(-3px); border-color: var(--line-3); box-shadow: 0 9px 24px rgb(32 32 74 / 9%); }
#welcome .choice-icon { display: grid; place-items: center; flex: none; width: 64px; height: 70px; border-radius: 15px; }
#welcome .choice-teal .choice-icon { color: var(--studio-teal-ink); background: var(--studio-teal-wash); }
#welcome .choice-violet .choice-icon { color: var(--accent-ink); background: var(--accent-soft); }
#welcome .choice-amber .choice-icon { color: var(--studio-amber-ink); background: var(--studio-amber-wash); }
#welcome .choice-words { display: grid; gap: 5px; min-width: 0; flex: 1; }
#welcome .choice-words strong { font-size: 16px; line-height: 1.25; letter-spacing: -.02em; }
#welcome .choice-words small { color: var(--muted); font-size: 12.5px; line-height: 1.45; }
#welcome .choice-words .planned-badge { font-size: 9px; padding: 3px 7px; }
#welcome .choice-arrow { flex: none; font-size: 23px; color: var(--accent-ink); }
#welcome .welcome-bottom {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 430px);
  align-items: start; gap: clamp(40px, 7vw, 100px); padding: 48px 0 64px; border-top: 1px solid var(--line);
}
#welcome .welcome-how { scroll-margin-top: 24px; padding-top: 6px; }
#welcome .welcome-how h2 { margin: 14px 0 25px; font-size: clamp(1.7rem, 2.9vw, 2.45rem); }
#welcome .how-steps { display: grid; gap: 22px; max-width: 510px; margin: 0; padding: 0; list-style: none; }
#welcome .how-steps li { display: flex; align-items: flex-start; gap: 16px; }
#welcome .how-number { display: grid; place-items: center; flex: none; width: 37px; height: 37px; border-radius: 12px; background: var(--accent-soft); color: var(--accent-ink); font-size: 12px; font-weight: 700; }
#welcome .how-steps strong { font-size: 15px; }
#welcome .how-steps p { margin-top: 4px; color: var(--muted); font-size: 13.5px; line-height: 1.65; }

/* Workspace chrome: keep the existing mobile menu behaviour and age looks. */
@media (min-width: 861px) {
  :root[data-theme="studio"] #workspace { grid-template-columns: 244px minmax(0, 1fr); }
}
#sidebar { gap: 20px; padding: 24px 16px 16px; border-right: 0; scrollbar-width: thin; scrollbar-color: var(--side-muted) transparent; }
#sidebar .side-top { padding: 0 6px; min-height: 48px; }
#sidebar .side-top .brand { gap: 11px; max-width: 195px; font-size: 16px; font-weight: 700; line-height: 1.2; }
#sidebar .side-top .mark { flex: none; background: #6c4cf1; color: #fff; }
#sidebar .new-question { min-height: 42px; margin: 0 2px; font-size: 13px; }
#sidebar .side-nav { gap: 7px; }
#sidebar .side-nav .nav-item { position: relative; min-height: 46px; padding: 10px 14px; gap: 12px; border-radius: 12px; color: var(--side-ink); }
#sidebar .side-nav .nav-text strong { font-size: 14px; font-weight: 550; }
#sidebar .side-nav .nav-item > svg { width: 19px; height: 19px; }
#sidebar .side-nav .nav-item[aria-current="page"] { background: var(--side-selected); color: var(--side-ink); box-shadow: inset 0 0 0 1px rgb(255 255 255 / 7%); }
#sidebar .side-nav .nav-item[aria-current="page"] :is(svg, strong) { color: inherit; font-weight: 700; }
#sidebar .side-nav .planned-badge { margin-left: auto; padding: 4px 6px; background: rgb(255 255 255 / 10%); color: var(--side-ink); font-size: 9px; letter-spacing: 0; }
:root[data-theme="explorer"] #sidebar .side-nav .planned-badge { background: var(--accent-soft); color: var(--accent-ink); }
:root[data-theme="explorer"] #sidebar .side-nav .nav-item { min-height: 48px; }
:root[data-theme="explorer"] #sidebar .side-nav .nav-text strong { font-size: 16px; }
#sidebar .nb-folder-section { margin: 0; padding: 0; }
#sidebar .side-heading { padding: 0 4px 5px 12px; }
#sidebar .side-heading h2 { color: var(--side-muted); font-size: 12px; font-weight: 600; }
#nb-library-link { background: transparent; color: inherit; border: 0; padding: 5px 0; font: inherit; }
#nb-library-link:hover { text-decoration: underline; }
#sidebar .nb-new-folder, .nb-folder button { border: none; background: transparent; color: var(--side-ink); border-radius: 8px; }
#sidebar .nb-new-folder { width: 34px; min-height: 34px; padding: 0; font: 500 1.1rem/1 var(--sans); }
.nb-folder { min-width: 0; }
.nb-folder-row { display: flex; align-items: center; gap: 2px; }
.nb-folder .nb-folder-toggle { display: grid; flex: none; place-items: center; width: 36px; min-height: 38px; padding: 0; color: var(--side-muted); }
.nb-folder-toggle::after { content: ''; width: 7px; height: 7px; border: solid currentColor; border-width: 0 1.5px 1.5px 0; transform: rotate(-45deg); }
.nb-folder-toggle[aria-expanded="true"]::after { transform: rotate(45deg); }
.nb-folder-name, .nb-folder-tool { min-width: 0; min-height: 38px; padding: 7px 10px; text-align: start; overflow-wrap: anywhere; font: 550 .91rem/1.35 var(--sans); }
.nb-folder-name { flex: 1; }
.nb-folder-tools { display: grid; gap: 2px; margin: 2px 0 6px 18px; padding-inline-start: 10px; border-inline-start: 1px solid var(--side-line); }
.nb-folder-tool { font-size: .84rem; font-weight: 450; }
.nb-folder button:hover, #sidebar .nb-new-folder:hover { background: var(--side-hover); }
.nb-folder [aria-current="page"] { background: var(--side-selected); font-weight: 650; }
.nb-folder.current-folder .nb-folder-name { font-weight: 650; }
#nb-nav-status:empty { display: none; }
#nb-nav-status.error { color: var(--side-ink); }
#home-composer .tutor-chooser { margin: 0 0 12px; }
.tutor-chooser > summary { display: flex; align-items: center; gap: 8px; min-height: 38px; color: var(--muted); cursor: pointer; list-style: none; }
.tutor-chooser > summary::-webkit-details-marker { display: none; }
.tutor-chooser[open] .chooser-chevron { transform: rotate(180deg); }
#history-panel { border-top: 1px solid var(--line); padding-top: 12px; }
#history-panel > summary { cursor: pointer; padding: .5rem 0; font-weight: 600; }
@media (max-width: 860px) {
  .nb-folder .nb-folder-toggle, .nb-folder-name, .nb-folder-tool, #sidebar .nb-new-folder { min-height: 44px; }
  .nb-folder .nb-folder-toggle, #sidebar .nb-new-folder { width: 44px; }
  #workspace[data-menu] #nb-new { visibility: hidden; }
}
#sidebar .account { padding-top: 15px; gap: 9px; }
#sidebar .account-initial { width: 33px; height: 33px; background: var(--side-selected); color: var(--side-ink); }
#sidebar #account-email { font-size: 11px; }
#workspace .topbar .brand { font-weight: 700; font-size: 14px; }
#workspace .topbar .mark { width: 29px; height: 29px; border-radius: 9px; font-size: 23px; }

/* Home: question first, a useful next action, then actual saved lessons. */
#home { max-width: 1320px; padding: clamp(28px, 3.2vw, 48px) clamp(20px, 3vw, 44px) 40px; gap: 0; }
#home .dashboard-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 27px; }
#home .dashboard-head > div { flex: 1; min-width: 0; }
#home .greeting { margin: 0 0 11px; color: var(--ink-2); font-size: 11px; font-weight: 650; letter-spacing: .16em; text-transform: uppercase; }
#home h1 { margin: 0; font: 700 clamp(2rem, 3.2vw, 3rem)/1.1 var(--sans); letter-spacing: -.043em; }
#home .learner-context { display: inline-flex; align-items: center; justify-content: center; flex: none; max-width: 230px; min-height: 36px; margin-top: 1px; padding: 7px 13px; border: 1px solid var(--line-2); border-radius: 999px; background: var(--surface); color: var(--ink-2); font-size: 12px; font-weight: 600; line-height: 1.4; }
#home .dashboard-grid { display: grid; grid-template-columns: minmax(0, 2.1fr) minmax(265px, 1fr); align-items: stretch; gap: 20px; }
#home #home-composer { min-width: 0; }
#home .composer-wrap { height: 100%; padding: 25px; border: var(--card-border); border-radius: var(--card-radius); background: var(--card-bg); box-shadow: var(--card-shadow); }
#home .composer-heading { margin-bottom: 17px; }
#home .composer-heading h2 { font: 700 clamp(1.15rem, 1.7vw, 1.5rem)/1.28 var(--sans); letter-spacing: -.035em; }
#home .composer { min-width: 0; padding: 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; }
#home .composer textarea { min-height: 122px; padding: 14px 16px; border: 1px solid var(--line-2); border-radius: 12px; background: var(--surface); color: var(--ink); font-size: 15px; line-height: 1.6; resize: vertical; }
#home .composer textarea::placeholder { opacity: 1; color: var(--muted); }
#home .composer textarea:focus { border-color: var(--accent); }
#home .composer textarea:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
#home .composer-row { gap: 10px; margin-top: 15px; }
#home #photo-button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; width: auto; height: 42px; padding: 0 12px; border-radius: 11px; border-color: var(--line-2); background: var(--surface); color: var(--ink); font-size: 12px; font-weight: 550; }
#home #photo-button:hover { border-color: var(--accent); background: var(--accent-wash); }
#home #go { display: inline-flex; align-items: center; justify-content: center; gap: 8px; width: auto; min-width: 131px; height: 42px; padding: 0 14px; border-radius: var(--btn-radius); background: var(--primary-bg); color: var(--on-primary); font-size: 12px; font-weight: 650; box-shadow: var(--btn-lift); }
#home #go:hover:not(:disabled) { filter: brightness(1.07); }
#home #go svg { width: 17px; height: 17px; }
#home .composer-preferences { display: flex; flex-wrap: wrap; align-items: center; gap: 5px 8px; margin-top: 11px; min-width: 0; color: var(--muted); }
#home .composer-preferences > svg { flex: none; }
#home .composer-preferences .chip-select { min-width: 0; }
#home .composer-preferences .chip-select select { height: 32px; max-width: 100%; padding-left: 0; border-color: transparent; background-color: transparent; font-size: 11px; }
#home #lesson-style { display: inline-block; height: 32px; max-width: 100%; padding: 0 5px; border: 0; border-radius: 6px; background: transparent; color: var(--accent-ink); font-size: 11px; text-decoration: underline; text-underline-offset: 3px; }
#home #lesson-style:hover { background: var(--accent-wash); }
#home .composer-note { margin: 8px 0 0; font-size: 10.5px; line-height: 1.55; }
#home .composer-status { margin: 8px 0 0; }
#home .tried { margin: 8px 0 0; font-size: 12px; }
#home .next-step {
  position: relative; isolation: isolate; overflow: hidden; display: flex; flex-direction: column; align-items: flex-start;
  min-width: 0; padding: 27px 26px; border-radius: var(--card-radius); color: var(--studio-on-teal);
  background: var(--studio-teal-panel); box-shadow: var(--shadow);
}
#home .next-step::before { content: ""; position: absolute; z-index: -1; right: -82px; top: 24px; width: 250px; height: 340px; border-radius: 48% 30% 42% 60%; transform: rotate(29deg); background: var(--studio-teal-deep); opacity: .56; }
#home .next-step::after { content: ""; position: absolute; z-index: -1; bottom: -100px; right: -100px; width: 310px; height: 210px; border-radius: 50%; background: rgb(255 255 255 / 5%); transform: rotate(-25deg); }
#home .next-step .studio-eyebrow { color: #d0f1ec; font-size: 10px; letter-spacing: .18em; }
#home .next-step h2 { max-width: 260px; margin-top: 18px; padding-right: 20px; font: 700 clamp(1.5rem, 2vw, 1.85rem)/1.12 var(--sans); letter-spacing: -.035em; overflow-wrap: anywhere; }
#home #next-step-reason { max-width: 280px; margin: 13px 0 24px; color: #e0f3f0; font-size: 12.5px; line-height: 1.65; }
#home .next-step-art { position: absolute; right: 17px; top: 69px; width: 65px; height: 56px; color: #b5e8e0; opacity: .22; pointer-events: none; }
#home #next-step-action { justify-content: space-between; min-height: 43px; max-width: 100%; margin-top: auto; padding: 10px 17px; border-radius: 10px; background: #fff; color: #20204a; font-size: 12.5px; font-weight: 700; line-height: 1.4; text-align: left; box-shadow: none; }
#home #next-step-action::after { content: "→"; margin-left: 8px; color: #6c4cf1; font-size: 21px; line-height: 1; }
#home #next-step-action > svg { display: none; }
#home #next-step-action:focus-visible { outline-color: #fff; }
#home #next-step-source { color: #fff; max-width: 100%; margin: -10px 0 16px; padding: 4px 0; text-align: left; text-decoration: underline; overflow-wrap: anywhere; }
#home #next-step-source:focus-visible { outline-color: #fff; }
#home #next-step-action:hover { background: #f1edff; filter: none; }
#home :is(.due-today, .school-now) { max-width: none; margin-top: 18px; }
#home .picked { margin-top: 25px; }
#home .picked .home-label { font-size: 16px; font-weight: 700; color: var(--ink); letter-spacing: -.02em; }
#home .picked-list { grid-template-columns: repeat(auto-fit, minmax(min(230px, 100%), 1fr)); }
#home .pick { padding: 19px; border-radius: 17px; }
#home .home-tutors { display: flex; align-items: center; gap: 10px 16px; flex-wrap: wrap; margin-top: 19px; }
#home .home-tutors .home-label { margin: 0; font-size: 11px; }
#home .tutor-chip { height: 32px; font-size: 11px; padding-right: 11px; }
#home .tutor-chip .tutor-face { width: 23px; height: 23px; font-size: 14px; }
#home .dashboard-lower { display: grid; grid-template-columns: minmax(0, 2.1fr) minmax(265px, 1fr); align-items: start; gap: 20px; margin-top: 28px; }
#home .continue-learning { min-width: 0; }
#home .continue-learning > h2 { margin: 0 0 14px; font: 700 23px/1.2 var(--sans); letter-spacing: -.035em; }
#home .continue-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
#home .continue-card { display: flex; align-items: center; gap: 15px; min-width: 0; padding: 18px; border: 1px solid var(--line); border-radius: 17px; background: var(--surface); box-shadow: var(--shadow); }
#home .topic-art { display: grid; place-items: center; flex: 0 0 85px; width: 85px; height: 108px; border-radius: 12px; background: var(--studio-teal-wash); color: var(--studio-teal-ink); }
#home .topic-art svg { display: block; width: 74px; height: 74px; }
#home .topic-art-geometry { background: var(--accent-soft); color: var(--accent-ink); }
#home .topic-art-statistics { background: var(--studio-amber-wash); color: var(--studio-amber-ink); }
#home .continue-words { flex: 1; min-width: 0; }
#home .continue-words h3 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin: 0 0 6px; font: 700 15px/1.3 var(--sans); letter-spacing: -.025em; overflow-wrap: anywhere; }
#home .continue-words p { font-size: 11px; line-height: 1.5; }
#home .continue-words .secondary { min-height: 35px; margin-top: 12px; padding: 0 13px; border-color: var(--accent); border-radius: 9px; background: var(--surface); color: var(--accent-ink); font-size: 11px; }
#home .continue-words .secondary::after { content: "→"; font-size: 17px; }
#home .continue-empty { grid-column: 1 / -1; min-width: 0; padding: 24px; border: 1px dashed var(--line-2); border-radius: 17px; background: var(--surface); color: var(--muted); font-size: 13px; line-height: 1.6; }
#home .continue-empty strong { display: block; margin-bottom: 5px; color: var(--ink); font-size: 16px; }
#home .continue-empty .text-button { margin-top: 6px; font-size: 12px; }
#home .progress-explainer { min-width: 0; padding: 23px; border: 1px solid var(--line); border-radius: 17px; background: var(--surface); box-shadow: var(--shadow); }
#home .progress-explainer h2 { margin-bottom: 16px; font: 700 18px/1.25 var(--sans); letter-spacing: -.03em; }
#home .evidence-legend { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; font-size: 12px; color: var(--ink-2); }
#home .evidence-legend li { display: flex; align-items: center; gap: 11px; }
#home .evidence-dot { flex: none; width: 12px; height: 12px; border-radius: 50%; }
#home .evidence-teal { background: var(--studio-teal-ink); }
#home .evidence-amber { background: var(--studio-amber); }
#home .evidence-coral { background: var(--studio-coral); }
#home .progress-explainer > p { margin-top: 15px; color: var(--muted); font-size: 10.5px; line-height: 1.65; }
#home .progress-explainer .text-button { margin-top: 4px; min-height: 34px; font-size: 11px; }

/* The existing composer is reparented into #dock during a lesson. Keep the
   established compact follow-up experience; do not restyle the lesson itself. */
#dock .composer-heading, #dock .photo-label, #dock .send-label { display: none; }
#dock .composer-preferences { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 8px; }
#dock .composer-preferences > svg { display: none; }

/* New destinations only: no blanket study-view or mathematical typography rules. */
#practice-hub { max-width: 1180px; gap: 28px; padding: 42px clamp(20px, 3vw, 44px) 56px; }
#practice-hub .studio-view-head { max-width: 700px; }
#practice-hub .studio-view-head h1 { margin: 11px 0 14px; font: 700 clamp(2.25rem, 4vw, 3.25rem)/1.05 var(--sans); letter-spacing: -.045em; }
#practice-hub .studio-view-head > p:last-child { max-width: 590px; color: var(--muted); font-size: 15px; line-height: 1.65; }
#practice-hub .practice-slope summary { cursor: pointer; padding: .75rem 0; font-weight: 600; }
#practice-hub .practice-slope .math-preview { max-width: 560px; margin: 1rem 0; }
#practice-hub .practice-hub-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
#practice-hub .practice-option { display: flex; flex-direction: column; align-items: flex-start; gap: 14px; min-width: 0; padding: 30px; border: var(--card-border); border-radius: var(--card-radius); background: var(--card-bg); box-shadow: var(--card-shadow); }
#practice-hub .practice-option-icon { display: grid; place-items: center; width: 65px; height: 65px; border-radius: 18px; background: var(--accent-soft); color: var(--accent-ink); }
#practice-hub .practice-option-teal .practice-option-icon { background: var(--studio-teal-wash); color: var(--studio-teal-ink); }
#practice-hub .practice-option h2 { margin: 5px 0 0; font: 700 24px/1.2 var(--sans); letter-spacing: -.035em; }
#practice-hub .practice-option p { color: var(--muted); font-size: 14px; line-height: 1.65; }
#practice-hub .practice-option :is(.primary, .secondary) { margin-top: auto; min-height: 46px; padding: 10px 19px; font-size: 13px; }
#practice-hub #nav-revise { width: auto; min-width: 132px; justify-content: center; gap: 10px; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); }
#practice-hub #nav-revise > svg { color: var(--studio-teal-ink); }
#practice-hub #nav-revise[aria-current="true"] { border-color: var(--accent); background: var(--accent-wash); }
#practice-hub .practice-topic-panel { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; padding: 26px 30px; border: 1px solid var(--accent-soft); border-radius: 18px; background: var(--accent-wash); }
#practice-hub .practice-topic-panel > div { flex: 1; min-width: 0; }
#practice-hub .practice-topic-panel > .nb-actions { flex: 1 1 24rem; }
#practice-hub .practice-topic-panel .nb-actions > .secondary { max-width: 100%; white-space: normal; }
#practice-hub .practice-topic-panel h2 { margin-bottom: 6px; font: 700 19px/1.25 var(--sans); letter-spacing: -.025em; }
#practice-hub .practice-topic-panel p { color: var(--muted); font-size: 13px; }
#practice-hub .practice-topic-panel .secondary { flex: none; border-color: var(--accent); background: var(--surface); color: var(--accent-ink); font-size: 13px; }
#practice-hub .practice-evidence-note { max-width: 650px; color: var(--muted); font-size: 12px; line-height: 1.7; }

/* Tablet and desktop-between states: avoid squeezing controls or cards. */
@media (max-width: 1250px) and (min-width: 861px) {
  #welcome .welcome-nav { gap: 17px; }
  #welcome .welcome-nav a { font-size: 12px; }
  #welcome .brand { font-size: 17px; }
  #welcome .welcome-account { gap: 12px; }
  #welcome .learning-choice { padding: 16px; gap: 12px; }
  #welcome .choice-icon { width: 52px; height: 60px; }
  #welcome .choice-words strong { font-size: 14px; }
  #home .dashboard-head { flex-wrap: wrap; }
  #home .learner-context { margin-top: 0; }
  #home .dashboard-grid, #home .dashboard-lower { grid-template-columns: minmax(0, 1.8fr) minmax(245px, 1fr); gap: 16px; }
  #home .composer-wrap { padding: 21px; }
  #home .composer-row { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 11px; }
  #home #go { justify-self: end; }
  #home .next-step { padding: 25px 22px; }
  #home .continue-list { grid-template-columns: minmax(0, 1fr); }
  #home .continue-card { padding: 16px; }
  #home .topic-art { height: 90px; }
}
@media (max-width: 1050px) {
  #welcome .welcome-nav { display: none; }
  #welcome .welcome-hero { gap: 30px; }
  #welcome .welcome-copy .studio-eyebrow { font-size: 11px; }
  #welcome .welcome-bottom { gap: 40px; grid-template-columns: minmax(0, 1fr) minmax(0, 390px); }
  #welcome .choice-icon { width: 48px; height: 56px; }
  #welcome .learning-choice { gap: 11px; padding: 16px; }
  #welcome .choice-words strong { font-size: 14px; }
  #home .dashboard-grid, #home .dashboard-lower { grid-template-columns: minmax(0, 1fr); }
  #home .next-step { min-height: 230px; padding-right: 120px; }
  #home .next-step h2, #home #next-step-reason { max-width: 440px; }
  #home .next-step-art { right: 35px; width: 94px; height: 78px; opacity: .65; }
  #home .continue-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #home .progress-explainer { padding: 23px; }
  #home .evidence-legend { display: flex; flex-wrap: wrap; gap: 14px 24px; }
  #home .progress-explainer > p { max-width: 620px; font-size: 11px; }
}

/* Phone and tablet: existing slide-in navigation, single-column public content. */
@media (max-width: 860px) {
  #welcome { padding: 0 28px; max-width: 760px; }
  #welcome .welcome-header { padding: 21px 0; gap: 16px; }
  #welcome .brand { font-size: 18px; }
  #welcome .welcome-hero { grid-template-columns: minmax(0, 1fr); gap: 34px; padding: 26px 0 40px; }
  #welcome .welcome-copy { padding: 0; }
  #welcome h1 { max-width: 620px; margin-top: 17px; font-size: clamp(2.8rem, 7vw, 4rem); }
  #welcome .lede { max-width: 540px; font-size: 17px; }
  #welcome .welcome-copy .studio-eyebrow { font-size: 12px; }
  #practice-hub .math-preview { width: 100%; max-width: 600px; justify-self: center; }
  #practice-hub .preview-board h2 { max-width: none; font-size: 19px; }
  #practice-hub .demo-graph { max-height: 310px; }
  #welcome .learning-choices { padding-bottom: 33px; }
  #welcome .choice-grid { grid-template-columns: minmax(0, 1fr); gap: 12px; margin-top: 18px; }
  #welcome .learning-choice { min-height: 98px; padding: 18px 20px; gap: 17px; }
  #welcome .choice-icon { width: 60px; height: 62px; }
  #welcome .choice-words strong { font-size: 17px; }
  #welcome .choice-words small { font-size: 13px; }
  #welcome .choice-words .planned-badge { font-size: 9px; }
  #welcome .welcome-bottom { grid-template-columns: minmax(0, 1fr); gap: 34px; padding: 36px 0 44px; }
  #welcome .welcome-how h2 { font-size: 30px; }
  #sidebar { padding-top: 20px; }
  #sidebar .side-top .brand { max-width: 205px; }
  #workspace .topbar { border-bottom: 1px solid var(--line); }
  #home { max-width: 800px; padding: 30px 24px 36px; }
  #home .dashboard-head { gap: 14px; margin-bottom: 24px; }
  #home h1 { font-size: clamp(1.9rem, 5.5vw, 2.65rem); }
  #home .learner-context { max-width: 180px; font-size: 10.5px; padding: 6px 10px; min-height: 33px; }
  #home .composer-wrap { padding: 24px; }
  #home .composer-heading h2 { font-size: 22px; }
  #home .composer-row { display: flex; gap: 10px; }
  #home .continue-card { padding: 18px; gap: 14px; }
  #practice-hub { padding: 30px 24px 42px; gap: 23px; }
}
@media (max-width: 650px) {
  #welcome .welcome-header { min-height: 83px; gap: 10px; }
  #welcome .welcome-account { gap: 9px; }
  #welcome .welcome-account .primary { min-height: 40px; padding: 0 13px; font-size: 12px; }
  #welcome .welcome-account .text-button { font-size: 12px; }
  #welcome .brand { gap: 8px; font-size: 15px; }
  #welcome .welcome-header .mark { width: 32px; height: 32px; border-radius: 10px; font-size: 26px; }
  #home .dashboard-head { flex-direction: column; }
  #home .learner-context { max-width: 100%; }
  #home .composer-row { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 12px; }
  #home #go { justify-self: end; }
  #home .continue-list { grid-template-columns: minmax(0, 1fr); }
  #home .continue-card { align-items: center; padding: 20px; gap: 19px; }
  #home .topic-art { flex-basis: 98px; width: 98px; height: 108px; }
  #home .continue-words h3 { font-size: 17px; }
  #home .continue-words p { font-size: 12px; }
  #home .continue-words .secondary { min-height: 38px; font-size: 12px; }
  #practice-hub .practice-hub-grid { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  #practice-hub .practice-option { padding: 25px; }
  #practice-hub .practice-topic-panel { padding: 24px; }
}
@media (max-width: 440px) {
  #welcome { padding: 0 20px; }
  #welcome .welcome-header { flex-wrap: wrap; padding: 17px 0; row-gap: 13px; }
  #welcome .welcome-header > .brand { flex: 1; min-width: 180px; font-size: 15px; }
  #welcome .welcome-account { gap: 10px; }
  #welcome .welcome-account .text-button { min-height: 36px; }
  #welcome .welcome-account .primary { min-height: 36px; padding: 0 12px; font-size: 11px; }
  #welcome .welcome-hero { padding-top: 21px; gap: 28px; }
  #welcome h1 { font-size: clamp(2.5rem, 10.5vw, 2.95rem); line-height: 1.04; margin-bottom: 18px; }
  #welcome .welcome-copy .studio-eyebrow { font-size: 10px; letter-spacing: .085em; }
  #welcome .lede { font-size: 15px; line-height: 1.6; }
  #welcome .welcome-actions { gap: 10px; margin: 23px 0 20px; }
  #welcome .welcome-actions :is(.primary, .secondary) { flex: 1; min-height: 48px; padding: 0 13px; font-size: 13px; }
  #welcome .welcome-actions svg { width: 16px; height: 16px; }
  #welcome .welcome-points { gap: 7px; }
  #welcome .welcome-points li { font-size: 10px; padding: 7px 9px; }
  #practice-hub .math-preview { border-radius: 22px; padding: 11px; }
  #practice-hub .math-preview::before { left: -12px; width: 64px; height: 75px; }
  #practice-hub .math-preview::after { right: -10px; width: 75px; height: 75px; }
  #practice-hub .preview-caption { padding: 3px 7px 11px; font-size: 9px; letter-spacing: .16em; }
  #practice-hub .preview-dots { gap: 6px; }
  #practice-hub .preview-dots i { width: 7px; height: 7px; }
  #practice-hub .preview-board { padding: 17px 14px 0; border-radius: 14px; }
  #practice-hub .preview-board h2 { max-width: 260px; font-size: 16px; }
  #practice-hub .demo-equation { font-size: 23px; }
  #practice-hub .demo-nudge { top: 69px; right: 11px; padding: 4px 6px; font-size: 8px; }
  #practice-hub .demo-controls { gap: 10px; min-height: 58px; padding: 8px 10px; }
  #practice-hub .demo-controls label { font-size: 11px; gap: 5px; }
  #practice-hub .demo-control-icon { width: 30px; height: 30px; }
  #practice-hub .demo-explanation { margin: 10px 5px 3px; font-size: 10.5px; min-height: 3em; }
  #welcome .learning-choices h2 { font-size: 23px; }
  #welcome .learning-choice { padding: 16px; gap: 12px; min-height: 103px; }
  #welcome .choice-icon { width: 50px; height: 58px; border-radius: 12px; }
  #welcome .choice-words strong { font-size: 15px; }
  #welcome .choice-words small { font-size: 11px; }
  #welcome .choice-arrow { font-size: 20px; }
  #welcome .welcome-how h2 { font-size: 28px; }
  #welcome .how-steps { gap: 20px; }
  #welcome .how-steps strong { font-size: 14px; }
  #welcome .how-steps p { font-size: 12.5px; }
  #home { padding: 26px 18px 30px; }
  #home .greeting { font-size: 9.5px; letter-spacing: .12em; }
  #home h1 { font-size: 32px; line-height: 1.09; }
  #home .composer-wrap { padding: 20px 17px; }
  #home .composer-heading h2 { font-size: 21px; line-height: 1.22; }
  #home .composer textarea { min-height: 122px; padding: 12px; font-size: 14px; }
  #home #photo-button { min-height: 43px; font-size: 11px; }
  #home #go { min-height: 43px; min-width: 134px; font-size: 12px; }
  #home .composer-preferences { gap: 3px 6px; }
  #home .composer-preferences > svg { display: none; }
  #home .composer-preferences .chip-select select, #home #lesson-style { font-size: 10.5px; }
  #home .next-step { min-height: 253px; padding: 25px 27px; }
  #home .next-step h2 { padding-right: 45px; font-size: 27px; }
  #home #next-step-reason { max-width: 245px; font-size: 12px; }
  #home .next-step-art { right: 24px; width: 58px; opacity: .25; }
  #home .dashboard-lower { margin-top: 25px; gap: 18px; }
  #home .continue-learning > h2 { font-size: 23px; }
  #home .continue-card { padding: 17px; gap: 16px; }
  #home .topic-art { flex-basis: 90px; width: 90px; }
  #home .continue-words h3 { font-size: 16px; }
  #home .continue-empty { padding: 21px; }
  #home .progress-explainer { padding: 23px; }
  #home .evidence-legend { display: grid; gap: 10px; }
  #practice-hub { padding: 28px 18px 38px; }
  #practice-hub .studio-view-head h1 { font-size: 37px; }
  #practice-hub .studio-view-head > p:last-child { font-size: 14px; }
  #practice-hub .practice-option { padding: 24px; }
}
@media (max-width: 360px) {
  #welcome .welcome-header > .brand { flex-basis: 100%; }
  #welcome .welcome-account { justify-content: space-between; width: 100%; }
  #home .continue-card { gap: 12px; }
  #home .topic-art { flex-basis: 70px; width: 70px; height: 94px; }
  #home .topic-art svg { width: 64px; height: 64px; }
}

/* Diagram surfaces remain legible in dark mode; decorative panels retain the
   same violet/teal hierarchy without turning the maths board into a glow effect. */
@media (prefers-color-scheme: dark) {
  #practice-hub .preview-board { background: #252438; color: #f0edf9; }
  #practice-hub .demo-grid { color: #504c65; }
  #practice-hub .demo-axes { color: #817892; }
  #practice-hub .demo-ticks { color: #b9afca; }
  #practice-hub .demo-line { color: #baa5ff; }
  #practice-hub .demo-point { color: #6addcd; stroke: #252438; }
  #practice-hub .demo-nudge { background: #513034; color: #ffd6cb; }
  #practice-hub .math-preview { background: linear-gradient(145deg, #5940b5, #392969); box-shadow: 0 12px 32px rgb(0 0 0 / 20%); }
  #welcome .learning-choice:hover { box-shadow: 0 9px 24px rgb(0 0 0 / 20%); }
  #welcome .welcome-actions .primary { box-shadow: none; }
  #home .next-step-art { color: #b5e8e0; }
  #home #next-step-action { background: #f7f4ff; color: #20204a; }
}
@media (prefers-reduced-motion: reduce) {
  :is(#welcome, #home, #practice-hub, #sidebar) *,
  :is(#welcome, #home, #practice-hub, #sidebar) *::before,
  :is(#welcome, #home, #practice-hub, #sidebar) *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
  #welcome .learning-choice:hover { transform: none; }
}

/* The same page shell holds the subject library and the existing Maths workspace. */
#workspace[data-maths="false"] .maths-context,
#workspace[data-maths="true"] .shared-home,
body:has(#workspace[data-maths="false"]) .maths-setting { display: none !important; }
.source-preview { min-width: 0; align-self: center; overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 12px 38px #17134812; }
.source-preview .preview-caption { padding: .75rem 1.35rem; }
.source-preview-body { padding: clamp(1.15rem,3vw,2rem); }
.source-preview-body > label, .nb-field { display: grid; gap: .4rem; font-weight: 600; }
.source-preview-body select { width: auto; margin: .4rem 0 1rem; }
.source-preview h2 { margin: 0 0 1.1rem; font: 500 clamp(1.7rem,3.5vw,2.6rem)/1.05 var(--serif); }
.source-preview figure { margin: 0; padding: 1rem 1.15rem; border-left: 3px solid var(--studio-teal-ink); background: var(--side); border-radius: 0 8px 8px 0; }
.source-preview figcaption, .nb-subject, #nb-subject { color: var(--studio-teal-ink); font: 650 .8rem/1.4 var(--sans); }
.source-preview blockquote { margin: .35rem 0 0; font: 500 1.14rem/1.5 var(--serif); }
#preview-question { font-weight: 650; margin: 1rem 0; }
#preview-guidance { margin: .6rem 0 0; }
#preview-guidance:empty { display:none; }
#nb-home-intake, .nb-task-card:not(:empty), #nb-view .nb-detail-grid > section { background: var(--surface); border:1px solid var(--line); border-radius: 16px; padding: clamp(1rem,2.5vw,1.6rem); min-width: 0; }
#nb-home-intake h2, #nb-library h2, #nb-view h2 { font: 500 clamp(1.35rem,2.3vw,1.8rem)/1.16 var(--serif); margin:0 0 .85rem; }
#nb-intake textarea, #nb-view textarea, #nb-dialog textarea { width:100%; resize:vertical; min-height: 5.5rem; }
#nb-intake :is(select,textarea), #nb-dialog :is(select,input,textarea) { min-width:0; max-width:100%; }
.nb-actions,.nb-intake-row,.nb-section-head { display:flex; align-items:center; gap:.65rem; flex-wrap:wrap; }
.nb-section-head { justify-content:space-between; margin-bottom: 1rem; }
#nb-library { margin-top: clamp(1.5rem,4vw,2.5rem); }
.nb-tiles,.nb-detail-grid { display:grid; grid-template-columns: repeat(auto-fit,minmax(min(100%,14rem),1fr)); gap: .85rem; }
.nb-tile { display:flex; flex-direction:column; justify-content:space-between; align-items:flex-start; gap:.4rem; min-height:6.5rem; background:var(--surface); border:1px solid var(--line); border-top:3px solid var(--accent); border-radius:12px; padding:1rem; color:var(--ink); text-align:start; overflow-wrap:anywhere; }
.nb-tile[data-subject="biology"] { border-top-color:var(--studio-teal-ink); }
.nb-tile[data-subject="history"] { border-top-color:#b07b38; }
.nb-tile strong { font:500 1.25rem/1.25 var(--serif); }
.nb-list-item { width:100%; text-align:start; padding:.55rem .7rem; border:1px solid transparent; border-radius:8px; color:var(--ink); background:transparent; white-space:normal; overflow-wrap:anywhere; }
.nb-list-item { background:var(--side); } .nb-list-item small { display:block; color:var(--muted); margin-top:.25rem; }
.nb-list-item:hover,.nb-tile:hover { border-color:var(--accent); }
.nb-file { position:relative; overflow:hidden; } .nb-file input { position:absolute; inset:0; opacity:0; cursor:pointer; width:100%; }
.nb-file:focus-within { outline:3px solid var(--focus); outline-offset:2px; }
#nb-filename { overflow-wrap:anywhere; }
#nb-side-list,.nb-items { display:grid; gap:.4rem; }
#nb-view { min-width:0; overflow-wrap:anywhere; }
#nb-view h1 { margin:.3rem 0; font:500 clamp(2.05rem,5vw,3.65rem)/1.03 var(--serif); }
#nb-study-choice { display:grid; gap:1rem; margin:1.5rem 0; padding:clamp(1rem,3vw,2rem); border:1px solid var(--line); border-radius:16px; background:var(--surface); }
#nb-study-heading { margin:0; font:500 1.65rem/1.2 var(--serif); }
#nb-chat-log { display:grid; gap:.75rem; max-height:24rem; overflow-y:auto; }
.nb-chat-turn { display:grid; gap:.2rem; max-width:min(92%,52rem); margin:0; line-height:1.5; }
.nb-chat-turn strong { color:var(--muted); font:600 .8rem/1.4 var(--sans); }
.nb-chat-turn.nb-chat-user { justify-self:end; padding:.55rem .9rem; background:var(--bg); border:1px solid var(--line); border-radius:12px; }
#nb-chat-actions { gap:.5rem; }
#nb-chat-actions button, #nb-chat-send { min-height:44px; white-space:normal; }
#nb-chat-form { display:flex; gap:.5rem; align-items:center; }
#nb-chat-input { flex:1; min-width:0; }
#nb-chat-status:empty { display:none; }
#nb-question-composer { padding:clamp(1rem,2.5vw,1.6rem); background:var(--surface); border:1px solid var(--line); border-radius:16px; }
#nb-question-composer h2 { margin:0; }
#nb-question-composer > label { font-weight:600; }
#nb-question-submit { margin-inline-start:auto; }
#nb-question-filename { min-width:0; overflow-wrap:anywhere; }
#nb-revision { display:grid; gap:1rem; }
#nb-revision h2 { margin:0; }
#nb-revision form { align-items:flex-end; }
#nb-revision .nb-field, #nb-revision-source { min-width:0; max-width:100%; }
.nb-revision-step { display:grid; gap:.65rem; }
.nb-guided-exam, .nb-exam-form { display:grid; gap:1rem; min-width:0; }
.nb-guided-exam > button, .nb-guided-exam .nb-revision-step > button { justify-self:start; }
.nb-guided-exam :is(.nb-task-card,.message,.nb-actions,p):empty { display:none; }
.nb-guided-exam :is(h3,h4,p,.nb-exam-form) { margin:0; }
.nb-exam-options { display:flex; flex-wrap:wrap; gap:.6rem; padding:0; border:0; min-width:0; }
.nb-exam-options legend { margin-bottom:.65rem; font-weight:600; }
.nb-exam-options label { display:inline-flex; align-items:center; gap:.45rem; min-height:44px; padding:.35rem .7rem; border:1px solid var(--line); border-radius:8px; cursor:pointer; }
.nb-exam-topics { margin:0; padding-inline-start:1.7rem; }
.nb-exam-topics li { padding:.5rem 0; }
.nb-exam-topics li > :is(p,button,details), .nb-exam-sources { margin-top:.45rem; }
.nb-guided-exam summary { cursor:pointer; }
#nb-sources-section > .text-button, #nb-practice-section > .nb-actions { margin-top:.55rem; }
#nb-view .nb-detail-grid, #nb-progress-section, #nb-task:not(:empty) { margin-top:1.25rem; }
.nb-task-card .nb-prompt,.nb-passage { white-space:pre-wrap; line-height:1.65; }
.nb-task-card form { margin:.85rem 0; } .nb-task-card .nb-actions { margin-top:.85rem; }
.nb-criterion { border-inline-start:2px solid var(--line); padding-inline-start:.85rem; margin:.65rem 0; }
#nb-citation, #nb-dialog { width:min(calc(100% - 2rem),36rem); max-height:85dvh; overflow:auto; padding:clamp(1rem,3vw,1.7rem); color:var(--ink); background:var(--surface); border:1px solid var(--line); border-radius:16px; }
#nb-citation::backdrop,#nb-dialog::backdrop { background:#16192a70; }
#nb-citation-pages article { padding:.6rem 0; } .nb-passage mark { background:#f5db85; color:#372b14; }
#nb-intake .message:empty, #nb-status:empty, #nb-form-status:empty { display:none; }

.nb-page-image { display:block; max-width:100%; height:auto; margin:.7rem 0; border-radius:5px; }

#nb-progress p > strong, #nb-progress p > span { display: block; }
