/* Study interface: readable type, consistent controls, and optional detail. */
:root {
  --sans: "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --shadow-soft: 0 2px 8px rgba(19, 32, 51, .04);
  --shadow-card: 0 2px 10px rgba(19, 32, 51, .04);
  --question-size: 20px;
}
html[data-theme="daylight"], body[data-theme="daylight"] {
  --paper: #f5f7fa;
  --surface-2: #eef2f7;
  --ink: #182638;
  --muted: #526276;
  --blue: #2457b2;
  --green: #006b68;
  --coral: #b94132;
  --violet: #5e46bb;
  --orange: #9a4400;
  --line: #d5dde8;
}
body:not(.auth-restoring) { background: var(--paper); font-size: 16px; }
body.rich-atmosphere:not(.auth-restoring) { background: var(--paper); }
h1, h2, h3, .next-best > strong, .home-strip strong {
  font-family: var(--sans); font-weight: 700; letter-spacing: -.025em;
}
h1 { font-size: clamp(28px, 3vw, 36px); line-height: 1.2; }
h2 { line-height: 1.3; }
p { line-height: 1.65; }
.page-heading p { max-width: 65ch; margin-bottom: 0; }
.eyebrow, .nav-section-label, .filter-field { letter-spacing: .04em; }
.view { padding: 30px; }
body .sidebar { background: #14243a; box-shadow: none; }
body .sidebar .brand { padding-bottom: 18px; }
body .sidebar .brand span { color: #c7d5e7; font-size: 12px; }
/* Ambient messages belong outside the task navigation. Keep the timer compact. */
.atmosphere-tip { display: none; }
.session-meter { background: transparent; border: 0; box-shadow: none; margin: 14px 6px 2px; padding: 0; }
.session-meter-track { display: none; }
.session-meter-copy small { color: #c7d5e7; font-size: 12px; }
.session-meter-copy strong { font-size: 14px; }
.main-nav { gap: 4px; }
.nav-section-label { font-size: 11px; color: #aebfd5; }
body .nav-item { min-height: 46px; border-radius: 9px; color: #e2eaf5; font-size: 15px; }
body.compact-nav .nav-item { min-height: 44px; }
body .main-nav .nav-item:nth-child(n) svg { color: #aebfd5; }
body .nav-item:hover { background: #233b56; transform: none; }
body .nav-item.active { background: #294566; box-shadow: inset 3px 0 #a8d4ff; border-color: transparent; color: #fff; }
body .main-nav .nav-item.active:nth-child(n) svg { color: #fff; }
.nav-more { margin-top: 12px; border-top: 1px solid #40516a; padding-top: 8px; }
.nav-more summary { padding: 12px 10px; color: #d6e3f5; min-height: 44px; cursor: pointer; font-size: 14px; font-weight: 600; }
#secondary-nav { display: grid; gap: 4px; padding-top: 6px; }
.sidebar-bottom { box-shadow: none; }
.sidebar-dock { box-shadow: none; }
body .topbar { background: var(--surface); box-shadow: none; backdrop-filter: none; }
.topbar-context span { font-size: 11px; }
.topbar-context strong { font-size: 17px; }
.search-box { border-radius: 10px; box-shadow: none; }
.search-box input { font-size: 15px; }
.profile-badge { border-radius: 10px; min-height: 48px; }
.profile-badge strong { font-size: 13px; }
.profile-badge small { font-size: 12px; }
.button, .button.small, .icon-button, .icon-button.small, .text-button,
.exam-tool-button, .highlight-swatch, .tei-hotspot-button, .tei-chip, .question-number,
.bookmark-tag { min-height: 44px; }
.icon-button, .icon-button.small, .question-number { min-width: 44px; }
.button, .button.small { font: 600 14px/1.3 var(--sans); padding: 10px 16px; border-radius: 9px; box-shadow: none; }
.button:not(.secondary), .button.coral { color: #fff; background: #2457b2; border-color: #2457b2; box-shadow: none; }
.button:not(.secondary):hover, .button.coral:hover { background: #1b438b; border-color: #1b438b; box-shadow: none; }
.button.secondary { border-color: #a7b4c4; color: var(--ink); }
.button.secondary:hover { background: var(--surface-2); border-color: var(--blue); }
.button:hover, .choice:hover, .choice.selected { transform: none; }
.button:disabled { opacity: 1; color: var(--muted); border-color: var(--line); background: var(--surface-2); }
.text-button { padding: 8px; font-size: 14px; }
:where(button, a, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 3px solid var(--blue) !important; outline-offset: 3px;
  box-shadow: 0 0 0 2px var(--surface);
}
.sidebar :focus-visible { outline-color: #a8d4ff !important; box-shadow: none; }
.select, .text-input, .tei-select { min-height: 44px; font-size: 15px; color: var(--ink); border-color: #a7b4c4; border-radius: 9px; }
.filter-field { font-size: 12px; text-transform: none; font-weight: 600; }
.filter-count { border: 0; background: transparent; font-size: 14px; padding: 0; }
.practice-toolbar { align-items: end; gap: 12px; margin-bottom: 20px; }
.practice-toolbar .filter-field { flex: 1; min-width: min(180px, 100%); }
.practice-reading-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 16px; font-size: 14px; }
.question-position { color: var(--muted); margin-right: auto; }
.practice-reading-bar .select { width: auto; }
.practice-reading-bar label { color: var(--muted); }
#practice-view .practice-layout { grid-template-columns: minmax(0, 1fr); max-width: 900px; margin: 0 auto; }
.question-panel { border-top-width: 1px; border-radius: 14px; min-height: 0; padding: 28px; box-shadow: var(--shadow-soft); }
.question-meta { gap: 8px; margin-bottom: 20px; }
.question-meta .tag:nth-child(n) { font-size: 12px; font-weight: 500; text-transform: none; letter-spacing: 0; color: var(--muted); background: var(--surface-2); border: 0; padding: 5px 9px; }
.question-meta .bookmark-tag:nth-child(n) { margin-left: auto; color: var(--blue); cursor: pointer; border: 1px solid var(--line); background: var(--surface); }
.question-meta .bookmark-tag.on:nth-child(n) { background: var(--blue-soft); border-color: var(--blue); }
.question-stem { font-family: var(--sans); font-size: var(--question-size); font-weight: 400; line-height: 1.65; max-width: 68ch; margin-bottom: 24px; }
body.text-size-large { --question-size: 23px; }
body.text-size-xlarge { --question-size: 26px; }
body.text-size-large .choice, body.text-size-xlarge .choice { font-size: calc(var(--question-size) - 3px); }
.native-visual { background: #fff; border-radius: 10px; padding: 12px; margin: 0 auto 24px; max-width: 620px; }
.native-visual img { display: block; width: auto; max-width: 100%; max-height: 380px; height: auto; margin: auto; object-fit: contain; }
.choice { font: 400 18px/1.5 var(--sans); min-height: 54px; border-color: #a7b4c4; border-radius: 9px; gap: 10px; }
.choice:nth-child(n):hover, .choice:nth-child(n).selected { background: var(--blue-soft); border-color: var(--blue); box-shadow: none; }
.choice.correct { background: var(--green-soft); border-color: var(--green); }
.choice.incorrect { background: var(--coral-soft); border-color: var(--coral); }
.choice-label { color: var(--ink); }
.question-actions { padding-top: 20px; border-top: 1px solid var(--line); }
.study-tools { margin-bottom: 22px; border-bottom: 1px solid var(--line); padding-bottom: 8px; }
.study-tools summary, .practice-coach summary, .public-extras summary { cursor: pointer; min-height: 44px; padding: 10px 0; font-size: 15px; font-weight: 600; color: var(--ink); }
.study-tools summary span, .practice-coach summary span { color: var(--muted); font-size: 13px; font-weight: 400; margin-left: 12px; }
.study-tools .exam-tool-strip { margin: 12px 0; padding: 0; background: var(--surface); box-shadow: none; border: 0; }
.exam-tool-button { font: 600 14px/1.4 var(--sans); background: var(--surface); }
.exam-tool-button.active { background: #2457b2; }
.practice-coach.coach-panel { display: block; min-height: 0; border-top: 1px solid var(--line); border-radius: 12px; box-shadow: none; }
.practice-coach summary { padding: 16px 22px; }
.practice-coach .message { font-size: 15px; }
.practice-coach .coach-actions { display: flex; flex-wrap: wrap; padding: 16px; }
body.practice-focus-mode .sidebar, body.practice-focus-mode .topbar { display: none; }
body.practice-focus-mode .app-shell { grid-template-columns: minmax(0, 1fr); }
body.practice-focus-mode #practice-view { max-width: 1000px; }
body.practice-focus-mode .practice-reading-bar { position: sticky; top: 0; z-index: 15; background: var(--paper); padding: 12px 0; border-bottom: 1px solid var(--line); }
.home-quiet { max-width: 1040px; }
.home-quiet h1 { font-size: clamp(28px, 3vw, 36px); }
.next-best { background: var(--surface); box-shadow: none; border: 1px solid var(--line); border-left: 4px solid var(--blue); }
.next-best p { font-size: 15px; max-width: 65ch; }
.next-best > strong { font-size: 22px; }
.home-strip small, .home-more summary span { font-size: 12px; color: var(--muted); }
.home-strip .heat-week { display: none; }
.home-more summary { min-height: 52px; font-size: 16px; }
.message, .settings-card p { font-size: 15px; }
.settings-toggle small { font-size: 13px; }
.settings-toggle input { min-width: 24px; min-height: 24px; }
.test-row small { font-size: 13px; }
.public-hero-content h1 { font-size: clamp(34px, 5vw, 58px); line-height: 1.15; }
.public-hero-content p { line-height: 1.65; }
.public-hero .button.secondary { color: #fff; background: transparent; border-color: #b9cde2; }
.public-explore { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 8px; }
.public-explore .text-button { color: #e3efff; }
.public-extras { margin: 24px auto; max-width: 1120px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 24px; }
.public-extras > summary { font-size: 17px; }
.public-extras .public-section { margin: 24px 0; }
body.theme-dark .button:not(.secondary) { background: #a8d4ff; color: #14243a; border-color: #a8d4ff; }
body.theme-dark .button:not(.secondary):hover { background: #d1e7ff; }
body.theme-dark .button:disabled { background: var(--surface-2); color: var(--muted); border-color: var(--line); }
body.theme-dark .exam-tool-button.active { color: #14243a; background: #a8d4ff; }
body.theme-dark .select, body.theme-dark .text-input, body.theme-dark .choice, body.theme-dark .button.secondary { border-color: #788ba3; }
body.high-contrast { --paper: #fff; --surface: #fff; --surface-2: #f2f2f2; --ink: #000; --muted: #222; --line: #555; --blue: #174797; }
@media (max-width: 1040px) {
  .view { padding: 24px; }
  .practice-toolbar .filter-field { min-width: min(160px, 100%); }
}
@media (max-width: 700px) {
  .view { padding: 20px 16px; }
  .question-panel { padding: 20px 16px; }
  .practice-toolbar { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .practice-toolbar .filter-field { min-width: 0; }
  .practice-toolbar .filter-field:nth-child(2) { grid-column: 1 / -1; grid-row: 2; }
  .practice-toolbar .select { width: 100%; }
  .practice-reading-bar { gap: 8px; }
  .question-position { flex-basis: 100%; }
  .practice-reading-bar label { font-size: 13px; }
  .practice-reading-bar .button { margin-left: auto; }
  .study-tools summary span, .practice-coach summary span { display: block; margin: 4px 0 0 18px; }
  .exam-tool-group { flex-wrap: wrap; width: 100%; }
  .exam-tool-button { flex: 1; padding: 0 9px; }
  .question-meta .bookmark-tag:nth-child(n) { margin-left: 0; }
  .question-actions > .button { flex: 1; }
  .question-actions .action-cluster { width: 100%; }
  .question-actions .action-cluster > .button { flex: 1; }
  .native-visual { padding: 6px; }
  .public-extras { margin: 20px 0; padding: 12px 16px; }
  .public-nav-actions { gap: 8px; }
}
@media print {
  .practice-reading-bar, .study-tools { display: none; }
  body.practice-focus-mode .app-shell { display: block; }
}

body.rich-atmosphere::before { opacity: .12; animation: none; }
.public-hero .eyebrow { color: #c7dcff; }
.public-hero :focus-visible { outline-color: #a8d4ff !important; box-shadow: none; }

@media (max-width: 700px) {
  .page-heading > .action-cluster { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); width: 100%; }
  .page-heading > .action-cluster .button { padding: 10px; font-size: 13px; }
}

.test-row:nth-child(n) .test-letter { color: var(--blue); background: var(--blue-soft); font-family: var(--sans); box-shadow: none; }

/* One task statement; response controls carry their own accessible labels. */
.question-meta .tag.tei-badge:nth-child(n) { background: #e7efff; color: #234f9c; border: 1px solid #b4c9ed; font-size: 12px; font-weight: 750; letter-spacing: .06em; }
.tei-answer-card { padding: 22px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: none; }
.tei-sentence { display: block; color: var(--ink); font: 400 var(--question-size)/2.6 var(--sans); }
.tei-inline-select { display: inline-block; width: auto; min-width: 104px; max-width: 100%; margin: 4px 5px; vertical-align: middle; font: 600 17px/1.4 var(--sans); background: var(--surface-2); padding: 10px 30px 10px 12px; }
.tei-inline-fallback { display: inline-block; margin: 8px 12px 0 0; }
.tei-multi-option, .tei-match-row, .tei-drop-slot, .tei-chip { font-weight: 500; font-size: 17px; line-height: 1.5; }
.tei-multi-option { padding: 14px 16px; text-align: left; min-height: 54px; }
.tei-multi-grid { grid-template-columns: 1fr; }
.tei-match-row { gap: 16px; }
.tei-match-row > span { font-weight: 500; }
.tei-coordinate-entry { display: flex; gap: 16px; flex-wrap: wrap; margin: 12px 0; }
.tei-coordinate-entry fieldset { display: flex; gap: 14px; border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px 14px; min-width: 0; }
.tei-coordinate-entry legend { font: 600 13px var(--sans); color: var(--muted); padding: 0 6px; }
.tei-coordinate-entry label { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.tei-coordinate-entry select { min-width: 96px; }
.tei-graph-wrap > svg { max-width: 460px; }
.native-visual { position: relative; margin: 24px 0; padding: 16px; background: #fff; border: 1px solid #d5dde8; border-radius: 12px; }
.native-visual img { display: block; max-height: 440px; width: 100%; object-fit: contain; }
.diagram-expand { display: flex; align-items: center; gap: 6px; margin: 8px 0 0 auto; color: #2457b2; font: 600 13px var(--sans); }
.diagram-expand svg { width: 16px; height: 16px; }
.diagram-reader { width: min(1100px, 94vw); max-height: 94dvh; padding: 20px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--ink); }
.diagram-reader::backdrop { background: rgba(15, 23, 42, .65); }
.diagram-reader-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 16px; }
.diagram-reader > img { display: block; width: 100%; max-height: 76dvh; object-fit: contain; background: #fff; border-radius: 8px; }
html[data-theme="midnight"] .question-meta .tag.tei-badge:nth-child(n) { color: #d1e1ff; background: #263e60; border-color: #526b8f; }
@media (max-width: 600px) {
  .tei-answer-card { padding: 16px; }
  .tei-inline-select { font-size: 16px; margin: 3px; min-width: 88px; }
  .tei-sentence { font-size: 18px; line-height: 2.5; }
  .tei-coordinate-entry { gap: 8px; }
  .tei-coordinate-entry fieldset { flex: 1 1 220px; }
  .tei-coordinate-entry select { min-width: 80px; }
  .native-visual { padding: 8px; }
  .diagram-reader { padding: 12px; }
}

.profile-badge { font-family: var(--sans); text-align: left; cursor: pointer; flex-shrink: 0; }
.profile-badge #profile-initials { flex-shrink: 0; }
.profile-badge .profile-text strong, .profile-badge .profile-text small { white-space: nowrap; }
.tei-graph-point:not(.selected):hover { fill: rgba(36,87,178,.16); stroke: #2457b2; }

.profile-badge .profile-text { display: block; color: var(--ink); min-width: 0; }
#toast { background: #14243a; color: #fff; border: 1px solid #526b8f; }

/* A consistent reading column keeps filters, heading and question edges aligned. */
#practice-view { max-width: 1104px; margin-inline: auto; padding: 28px 32px; }
#practice-view .page-heading { display: flex; align-items: center; gap: 20px; margin-bottom: 22px; }
#practice-view .page-heading h1 { font-size: 30px; line-height: 1.2; margin: 0 0 6px; }
#practice-view .page-heading p { font-size: 15px; margin: 0; }
#practice-view .page-heading > .action-cluster { margin-left: auto; flex-shrink: 0; }
#practice-view .practice-toolbar { display: grid; grid-template-columns: 1fr 1.25fr .8fr auto; gap: 12px; margin-bottom: 12px; }
#practice-view .practice-toolbar .filter-field { min-width: 0; }
#practice-view .practice-toolbar .select { width: 100%; }
#practice-view .filter-summary { display: flex; align-items: center; gap: 8px; min-height: 44px; }
#practice-view .filter-count { font-size: 13px; white-space: nowrap; padding: 0; }
#practice-view .filter-summary [data-clear-practice-filters] { padding: 8px; min-height: 44px; font-size: 13px; border-color: var(--line); background: var(--surface); }
#practice-view .practice-reading-bar { min-height: 44px; margin-bottom: 18px; gap: 10px; font-size: 13px; }
#practice-view .practice-reading-bar .select { min-height: 38px; font-size: 13px; }
#practice-view .practice-reading-bar .button { min-height: 38px; font-size: 13px; padding: 8px 12px; }
#practice-view .practice-layout { max-width: none; }
#practice-view .question-panel { padding: 24px; box-shadow: 0 2px 8px rgba(20,36,58,.035); }
#practice-view .study-tools { margin-bottom: 14px; padding-bottom: 6px; }
#practice-view .study-tools summary { min-height: 36px; padding: 4px 0; font-size: 13px; }
#practice-view .study-tools summary span { font-size: 12px; }
#practice-view .question-meta { margin-bottom: 16px; }
#practice-view .question-meta .tag:nth-child(n) { min-height: 30px; padding: 4px 8px; border-radius: 6px; }
#practice-view .question-meta .bookmark-tag:nth-child(n) { min-height: 36px; }
#practice-view .question-stem { margin: 0 0 22px; }
#practice-view .practice-coach { padding: 12px 24px; }
body .topbar { min-height: 68px; padding-inline: 28px; gap: 18px; }
.topbar-context { min-width: 144px; }
.topbar-context span { display: none; }
.topbar-context strong { font-size: 15px; font-weight: 600; }
body .search-box { max-width: 560px; min-height: 42px; }
body .profile-badge { min-width: 0; min-height: 44px; padding: 4px 8px; gap: 8px; border: 0; background: transparent; box-shadow: none; border-radius: 8px; }
body .profile-badge:hover { background: var(--surface-2); }
body .profile-badge #profile-initials { width: 30px; height: 30px; color: var(--blue); background: var(--blue-soft); font-size: 11px; }
body .profile-badge .profile-text strong { font-size: 13px; font-weight: 600; max-width: 156px; overflow: hidden; text-overflow: ellipsis; }
body .profile-badge #profile-label { display: none; }
body .profile-badge > svg { width: 14px; height: 14px; color: var(--muted); }
body .sidebar-dock { background: transparent; border: 0; padding: 0 8px; box-shadow: none; }
body .sidebar-bottom { background: transparent; padding-top: 16px; }
body .studio-status { padding: 0; margin: 0; border-top: 0; }
body .studio-status-dot { width: 6px; height: 6px; box-shadow: none; }
body .studio-status small { color: #b9c9dc; font-size: 11px; }
@media (min-width: 1041px) { .app-shell { grid-template-columns: 248px minmax(0, 1fr); } body .sidebar { width: 248px; } }
@media (max-width: 1100px) { .profile-badge .profile-text { display: none; } body .topbar { gap: 12px; padding-inline: 20px; } }
@media (max-width: 700px) {
  #practice-view { padding: 20px 16px; }
  #practice-view .page-heading { align-items: start; flex-wrap: wrap; gap: 14px; margin-bottom: 20px; }
  #practice-view .page-heading h1 { font-size: 27px; }
  #practice-view .page-heading > .action-cluster { margin: 0; }
  #practice-view .practice-toolbar { grid-template-columns: 1fr 1fr; }
  #practice-view .practice-toolbar .filter-field:nth-child(2) { grid-column: 1 / -1; grid-row: 2; }
  #practice-view .filter-summary { grid-column: 1 / -1; min-height: 32px; justify-content: space-between; }
  #practice-view .question-panel { padding: 18px; }
  #practice-view .practice-coach { padding: 10px 18px; }
  #practice-view .practice-reading-bar { margin-bottom: 16px; }
  body .topbar { min-height: 60px; padding-inline: 16px; }
  .topbar-context { min-width: 0; }
}

#practice-view .native-visual { margin-inline: auto; }
body.theme-dark .profile-badge { background: transparent; }
body.theme-dark .profile-badge:hover { background: var(--surface-2); }
body[data-theme] .sidebar-dock { background: transparent; border: 0; box-shadow: none; }
body[data-theme] .sidebar-bottom { background: transparent; }

/* Editorial workspace: the problem leads; supporting controls stay quiet. */
#practice-view .page-heading { margin-bottom: 24px; }
#practice-view .page-heading h1 { letter-spacing: -.035em; }
#practice-view .practice-toolbar { padding: 16px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; margin-bottom: 10px; }
#practice-view .practice-toolbar .filter-field > span { font-size: 11px; font-weight: 650; color: var(--muted); letter-spacing: .025em; }
#practice-view .practice-toolbar .select { border-color: var(--line); font-weight: 500; }
#practice-view .practice-reading-bar { padding-inline: 2px; margin-bottom: 14px; }
#practice-view .question-panel { border-top: 1px solid var(--line); border-radius: 16px; padding: 28px; box-shadow: 0 4px 16px rgba(20,36,58,.035); }
#practice-view .question-meta { gap: 10px; align-items: center; margin-bottom: 22px; }
#practice-view .question-meta .tag:nth-child(n) { background: transparent; border: 0; padding: 0; border-radius: 0; min-height: 0; font-size: 12px; }
#practice-view .question-meta .tag:nth-child(2):not(.bookmark-tag)::before,
#practice-view .question-meta .tag:nth-child(3):not(.bookmark-tag)::before { content: '·'; margin-right: 10px; color: var(--muted); }
#practice-view .question-meta .tag.coral:nth-child(n) { color: var(--blue); font-weight: 650; }
#practice-view .question-meta .tag.tei-badge:nth-child(n) { background: var(--blue-soft); color: var(--blue); border-radius: 5px; padding: 4px 7px; letter-spacing: .06em; font-size: 10px; font-weight: 750; }
#practice-view .question-meta .attempt-tag:nth-child(n) { margin-left: auto; font-size: 11px; }
#practice-view .question-meta .bookmark-tag:nth-child(n) { min-height: 36px; margin-left: 0; border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; font-size: 12px; color: var(--blue); }
#practice-view .question-meta .bookmark-tag.on:nth-child(n) { background: var(--blue-soft); }
#practice-view .question-stem { line-height: 1.65; max-width: 72ch; margin-bottom: 26px; }
#practice-view .choice { border-color: var(--line); min-height: 56px; padding: 12px 16px; border-radius: 10px; }
#practice-view .choice-label { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; flex: 0 0 28px; border-radius: 6px; background: var(--surface-2); color: var(--muted); font-size: 13px; font-weight: 650; }
#practice-view .choice.selected .choice-label { background: var(--blue); color: var(--surface); }
#practice-view .choice[aria-pressed="true"] { border-color: var(--blue); }
#practice-view .study-tools { margin: 18px 0 -4px; padding: 12px 0 0; border-top: 1px solid var(--line); border-bottom: 0; }
#practice-view .study-tools summary { min-height: 36px; font-size: 12px; font-weight: 600; }
#practice-view .study-tools summary span { font-size: 12px; margin-left: 10px; }
#practice-view .question-actions { margin-top: 24px; }
#practice-view .practice-coach { border: 1px solid var(--line); border-radius: 12px; background: transparent; }
#practice-view .practice-coach summary { font-size: 13px; padding: 10px 0; }
.tei-answer-card { background: var(--surface); padding: 20px; }
.tei-response-note { color: var(--muted); margin: 0 0 14px; font-size: 13px; }
.tei-match-row { padding: 12px 0; border-bottom: 1px solid var(--line); }
.tei-match-row:last-child { border-bottom: 0; }
.tei-match-row .tei-select { background: var(--surface-2); border-color: var(--line); }
.tei-multi-option { display: flex; align-items: center; gap: 12px; border-color: var(--line); }
.tei-multi-option::before { content: ''; width: 18px; height: 18px; flex: 0 0 18px; border: 1.5px solid var(--muted); border-radius: 4px; }
.tei-multi-option.selected::before { content: '✓'; background: var(--blue); border-color: var(--blue); color: var(--surface); text-align: center; font-size: 13px; line-height: 18px; }
.tei-sentence { line-height: 2.2; }
@media (max-width: 700px) {
  #practice-view .practice-toolbar { padding: 14px; }
  #practice-view .question-panel { padding: 20px 18px; }
  #practice-view .question-meta { gap: 8px; margin-bottom: 18px; }
  #practice-view .question-meta .attempt-tag:nth-child(n) { flex-basis: calc(100% - 105px); margin-left: 0; }
  #practice-view .question-meta .bookmark-tag:nth-child(n) { margin-left: auto; }
  #practice-view .study-tools summary span { display: block; margin: 4px 0 0 16px; }
  #practice-view .choice { font-size: 17px; padding: 12px; }
  .tei-match-row { grid-template-columns: 1fr; gap: 8px; }
  .tei-match-row .tei-select { width: 100%; }
}
@media (prefers-reduced-motion: reduce) { .choice, .tei-multi-option, .button { transition: none; } }
:root { --control-line: #7f8fa4; }
body.theme-dark { --control-line: #7388a4; }
#practice-view .choice, #practice-view .practice-toolbar .select, .tei-match-row .tei-select { border-color: var(--control-line); }
#practice-view .choice.selected { border-color: var(--blue); }
body.theme-dark .tei-answer-card { background: var(--surface); border-color: var(--line); }
body .tei-match-row .tei-select { font-weight: 500; }
body .tei-selected-value, body .tei-response-note, body .small-note { font-size: 13px; font-weight: 400; line-height: 1.6; color: var(--muted); }
body .tei-match-row { border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: transparent; padding: 12px 0; }
body .tei-match-row:last-child { border-bottom: 0; }
body .tei-match-pairs { gap: 0; }
@media (max-width: 700px) {
  #practice-view .question-meta .attempt-tag:nth-child(n) { flex-basis: auto; margin-left: auto; }
  #practice-view .question-meta .bookmark-tag:nth-child(n) { margin-left: 0; min-width: 36px; padding: 8px; }
  #practice-view .bookmark-text { display: none; }
}

/* Learning support: a quiet sequence of hints and clearly separated solutions. */
.requested-hints, .worked-solution { color: var(--ink); font-size: 15px; line-height: 1.7; overflow-wrap: anywhere; }
.requested-hints ol { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.requested-hints li { background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--blue); border-radius: 9px; padding: 14px 16px; }
.requested-hints li > strong { display: block; font-size: 12px; color: var(--blue); letter-spacing: .015em; }
.requested-hints li p { margin: 5px 0 0; line-height: 1.7; }
.requested-hints .hint-progress { color: var(--muted); font-size: 12px; margin: 10px 0 16px; }
.worked-solution { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 20px; margin-top: 14px; }
.worked-solution h3 { font-size: 17px; margin: 0 0 16px; }
.solution-reasoning { border-left: 3px solid var(--green); padding-left: 12px; margin-bottom: 20px; }
.solution-reasoning > strong { font-size: 12px; color: var(--green); }
.solution-reasoning p { margin: 4px 0 0; }
.solution-steps { margin: 0; padding-left: 24px; display: grid; gap: 12px; }
.solution-steps li { padding-left: 6px; line-height: 1.75; }
.solution-steps li::marker { color: var(--muted); font-weight: 700; }
.solution-calculation { margin: 0; }
.solution-answer { border-left: 3px solid var(--green); }
.attempt-guidance { color: var(--muted); font-size: 13px; }
.worked-solution:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }
@media (max-width: 600px) {
  .worked-solution { padding: 16px; }
  .requested-hints li { padding: 12px 14px; }
}

/* October interface refresh: a shared visual rhythm across study surfaces. */
html[data-theme="daylight"], body[data-theme="daylight"] {
  --paper: #f3f5f9;
  --ink: #1b2b42;
  --muted: #53647a;
  --line: #d9e0ea;
  --blue-soft: #edf3ff;
  --surface-2: #edf1f6;
}
body .sidebar { background: #17263d; }
body .sidebar .brand { gap: 10px; padding-bottom: 20px; }
.sidebar .brand-mark { width: 38px; height: 38px; flex: 0 0 38px; }
.sidebar .brand strong { font-size: 15px; letter-spacing: -.015em; }
body .nav-item.active { background: #2b4262; box-shadow: inset 3px 0 #9fc8ff; }
body .topbar { border-bottom: 1px solid var(--line); min-height: 72px; }
body .search-box { max-width: 480px; background: var(--paper); border-color: transparent; }
body .search-box:focus-within { background: var(--surface); border-color: var(--blue); }
body .search-box input::placeholder { color: var(--muted); opacity: 1; }
.view:is(#dashboard-view, #practice-view, #adaptive-view, #tests-view, #review-view) { max-width: 1120px; padding: 32px; }
.page-heading h1, .home-quiet-head h1 { letter-spacing: -.035em; }
.page-heading h1, .home-quiet-head h1, .adaptive-banner h2, .public-intro h1, .section-heading h2 { font-family: var(--sans); font-weight: 700; }
.page-heading .eyebrow { font-size: 11px; letter-spacing: .08em; }
.page-heading p { font-size: 15px; max-width: 62ch; }
.button, .choice, .study-path { transition: background-color .15s, border-color .15s, box-shadow .15s; }
.button.secondary { background: var(--surface); }

.practice-library { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; margin-bottom: 16px; padding: 8px 12px; }
.practice-library-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.practice-collections { display: flex; gap: 4px; padding: 3px; background: var(--paper); border-radius: 9px; }
.collection-button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 10px 14px; border: 1px solid transparent; border-radius: 7px; background: transparent; color: var(--muted); cursor: pointer; font: 600 13px/1.3 var(--sans); }
.collection-button svg { width: 15px; height: 15px; }
.collection-button:hover { color: var(--ink); background: var(--surface-2); }
.collection-button.active { color: var(--blue); border-color: var(--line); background: var(--surface); box-shadow: 0 1px 3px rgba(20,36,58,.06); }
.library-count { margin-left: auto; color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
#practice-view .refine-button { border-color: transparent; padding: 10px; min-height: 44px; font-size: 13px; }
.refine-button svg { width: 16px; height: 16px; }
#practice-view .practice-library .practice-toolbar { grid-template-columns: repeat(3, minmax(0,1fr)); border: 0; border-top: 1px solid var(--line); border-radius: 0; padding: 16px 2px 8px; margin: 8px 0 0; background: transparent; box-shadow: none; }
.active-practice-filters { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; padding: 8px 2px 0; }
.active-practice-filters > span { color: var(--muted); font-size: 12px; line-height: 1.5; padding: 5px 9px; border-radius: 5px; background: var(--surface-2); overflow-wrap: anywhere; }
.active-practice-filters .text-button { color: var(--blue); font-size: 12px; margin-left: auto; }
#practice-view .practice-reading-bar { margin-bottom: 12px; }
#practice-view .question-panel, #adaptive-view .question-panel { border-top: 1px solid var(--line); box-shadow: 0 3px 14px rgba(20,36,58,.025); border-radius: 14px; padding: 30px; }
#practice-view .question-stem, #adaptive-view .question-stem { font-size: var(--question-size); line-height: 1.65; max-width: 66ch; }
:root { --question-size: 21px; }
#practice-view .choice, #adaptive-view .choice { display: flex; align-items: center; gap: 12px; min-height: 58px; background: var(--surface); border: 1px solid var(--control-line); padding: 13px 16px; text-align: left; box-shadow: none; }
.choice-value { flex: 1; min-width: 0; }
.choice-result { margin-left: auto; font: 600 12px/1.4 var(--sans); color: var(--muted); flex-shrink: 0; }
#practice-view .choice.selected, #adaptive-view .choice.selected { background: var(--blue-soft); border: 2px solid var(--blue); padding: 12px 15px; }
.choice.selected .choice-result { color: var(--blue); }
#practice-view .choice.correct, #adaptive-view .choice.correct { background: var(--green-soft); border-color: var(--green); }
#practice-view .choice.incorrect, #adaptive-view .choice.incorrect { background: var(--coral-soft); border-color: var(--coral); }
.choice.correct .choice-result { color: var(--green); }
.choice.incorrect .choice-result { color: var(--coral); }
#practice-view .question-actions, #adaptive-view .question-actions { padding-top: 20px; gap: 12px; }
.grid-answer { max-width: 360px; font-size: 13px; }
.grid-answer .text-input { min-height: 48px; font-size: 18px; width: 100%; }
.practice-coach.coach-panel { padding: 8px 24px; background: var(--surface); border-radius: 12px; }
#practice-view .practice-coach summary, #adaptive-view .practice-coach summary { display: flex; align-items: center; gap: 10px; padding: 12px 0; min-height: 48px; list-style: none; font-size: 14px; }
.practice-coach summary::-webkit-details-marker { display: none; }
.practice-coach summary > svg { width: 18px; height: 18px; color: var(--blue); flex: 0 0 18px; }
.practice-coach summary > svg:last-child { margin-left: auto; color: var(--muted); transition: transform .15s; }
.practice-coach[open] summary > svg:last-child { transform: rotate(180deg); }
.practice-coach summary span { margin-left: 0; font-size: 12px; }
.practice-coach .coach-messages { padding: 8px 0 16px; gap: 12px; }
.practice-coach .coach-actions { padding: 14px 0; border-top: 1px solid var(--line); }
.adaptive-learning-layout { grid-template-columns: minmax(0, 1fr); }
.adaptive-control-panel { box-shadow: none; border-radius: 12px; background: var(--surface); padding: 20px; }
.adaptive-banner { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--blue); border-radius: 12px; box-shadow: none; padding: 20px; }
.adaptive-banner h2 { font-size: 20px; }
.adaptive-path-insights article { box-shadow: none; border-radius: 10px; padding: 14px 16px; }
.adaptive-path-insights h3 { font-size: 15px; }

.home-quiet { max-width: none; gap: 24px; }
.home-quiet-head { align-items: center; gap: 20px; padding: 4px 0; }
.home-quiet-head h1 { margin: 8px 0; font-size: 34px; }
.home-quiet-head .muted { margin: 0; font-size: 15px; }
.dashboard-greeting { font-size: 13px; color: var(--muted); }
.home-quiet-actions { gap: 8px; }
.home-strip { border-radius: 12px; box-shadow: none; padding: 20px 24px; }
.home-strip-stats { gap: 16px; }
.home-strip-stats > div + div { border-left: 1px solid var(--line); padding-left: 24px; }
.home-strip-stats small { text-transform: none; letter-spacing: 0; font-size: 13px; }
.home-strip-stats strong { font-family: var(--sans); font-size: 26px; line-height: 1.2; font-variant-numeric: tabular-nums; margin-top: 6px; }
.next-best { position: relative; display: grid; grid-template-columns: minmax(0,1fr) auto; column-gap: 28px; padding: 24px; border-radius: 12px; background: var(--surface); border-left-width: 4px; }
.next-best > small, .next-best > strong, .next-best > p { grid-column: 1; }
.next-best .next-best-actions { grid-column: 2; grid-row: 1/4; align-self: center; display: flex; flex-direction: column; align-items: end; gap: 8px; margin: 0; }
.next-best > small { color: var(--blue); font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.next-best > strong { font-size: 23px; margin-top: 8px; }
.next-best p { margin: 8px 0 16px; }
.study-paths { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 16px; }
.study-path { display: grid; gap: 12px; padding: 22px; border: 1px solid var(--line); border-radius: 12px; color: var(--ink); background: var(--surface); text-align: left; cursor: pointer; font-family: var(--sans); }
.study-path:hover { border-color: var(--blue); background: var(--blue-soft); box-shadow: 0 3px 12px rgba(20,36,58,.05); }
.study-path-icon { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 9px; color: var(--blue); background: var(--blue-soft); }
.study-path-icon svg { width: 20px; height: 20px; }
.study-path strong { font-size: 17px; letter-spacing: -.02em; }
.study-path-copy { font-size: 14px; line-height: 1.65; color: var(--muted); }
.study-path-link { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--blue); margin-top: 4px; }
.study-path-link svg { width: 16px; height: 16px; }
.home-more { border-radius: 12px; }
.home-more > summary::before { content: '+'; color: var(--blue); font-size: 20px; }
.home-more[open] > summary::before { content: '−'; }
.home-more > summary > span { margin-left: auto; }
.test-list { border-radius: 12px; box-shadow: none; overflow: hidden; }
.test-row { padding: 22px 24px; border-bottom: 1px solid var(--line); gap: 18px; }
.test-row:last-child { border-bottom: 0; }
.test-row:nth-child(n) .test-letter { border-radius: 9px; width: 48px; height: 48px; font-size: 20px; }
.test-row > div > strong { font-size: 16px; }
.test-row small { color: var(--muted); line-height: 1.6; }
.test-row .button { min-width: 140px; }
.panel { box-shadow: none; }

.public-hero { background: #17263d; min-height: 0; }
.public-hero::before, .public-hero::after { display: none; }
.public-nav { height: auto; min-height: 84px; padding-block: 16px; }
.public-hero-content { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 32px 64px; align-items: center; padding: 56px 0 32px; }
.public-intro h1 { font-size: clamp(36px,4.5vw,58px); line-height: 1.15; max-width: 650px; margin: 16px 0 20px; }
.public-intro p { max-width: 54ch; font-size: 18px; color: #d3deed; }
.public-hero .public-cta-row .button:not(.secondary) { background: #fff; color: #1e4e9c; border-color: #fff; }
.public-hero .public-cta-row .button:not(.secondary):hover { background: #edf3ff; }
.public-explore { margin-top: 16px; }
.public-explore .text-button { padding-left: 0; font-size: 14px; }
.public-explore .mobile-book-preview { display: none; }
.public-hero-book { margin: 0; text-align: center; justify-self: end; }
.public-hero-book > img { display: block; width: 240px; height: auto; border-radius: 8px; box-shadow: 0 16px 36px rgba(0,0,0,.2); }
.public-hero-book .text-button { color: #d3deed; margin-top: 14px; }
.public-proof-strip { grid-column: 1/-1; max-width: none; margin-top: 12px; border-top: 1px solid #41516a; padding-top: 28px; gap: 20px; }
.public-proof-strip span { background: transparent; border: 0; box-shadow: none; border-radius: 0; padding: 0; min-height: 58px; font-size: 13px; backdrop-filter: none; }
.public-proof-strip strong { font: 700 24px/1.2 var(--sans); }
.public-hero .book-owner-note { grid-column: 1/-1; max-width: none; font-size: 13px !important; color: #c2d0e2 !important; margin: 0; }
.public-about-card, .diagnostic-launch-card, .feature-proof-card { background: var(--surface); box-shadow: none; border-radius: 14px; }
.public-about-copy h2 { font-size: clamp(24px,2.3vw,30px); }
.public-about-copy p { font-size: 15px; }
.public-section .section-heading h2 { font-size: clamp(26px,3vw,34px); }
@media (max-width: 1100px) {
  .home-quiet-head { align-items: start; flex-direction: column; }
  .public-hero-content { gap: 28px 32px; grid-template-columns: minmax(0,1fr) 220px; }
  .public-hero-book > img { width: 200px; }
}
@media (max-width: 700px) {
  .view:is(#dashboard-view, #practice-view, #adaptive-view, #tests-view, #review-view) { padding: 22px 16px; }
  body .topbar { min-height: 64px; }
  .practice-library { padding: 8px 10px; }
  .practice-library-bar { gap: 6px; }
  .practice-collections { flex: 1 1 100%; }
  .collection-button { flex: 1; padding: 10px 6px; }
  .library-count { margin-left: 4px; }
  #practice-view .refine-button { margin-left: auto; }
  #practice-view .practice-library .practice-toolbar { grid-template-columns: minmax(0,1fr); gap: 14px; }
  #practice-view .practice-library .practice-toolbar .filter-field:nth-child(n) { grid-column: auto; grid-row: auto; }
  #practice-view .question-panel, #adaptive-view .question-panel { padding: 22px 18px; }
  #practice-view .question-stem, #adaptive-view .question-stem { font-size: var(--question-size); }
  :root { --question-size: 19px; }
  .choice-result { font-size: 11px; }
  .practice-coach.coach-panel { padding: 8px 18px; }
  .practice-coach summary { flex-wrap: wrap; }
  .practice-coach summary span { display: none; }
  .home-quiet-head h1 { font-size: 28px; }
  .home-strip { padding: 18px; }
  .home-strip-stats > div + div { padding-left: 0; border-left: 0; }
  .study-paths { grid-template-columns: minmax(0,1fr); gap: 12px; }
  .study-path { grid-template-columns: 38px 1fr auto; padding: 18px; gap: 6px 14px; }
  .study-path-icon { grid-row: 1/3; }
  .study-path-copy { grid-column: 2/4; }
  .study-path-link { grid-column: 3; grid-row: 1; margin-top: 0; }
  .next-best { padding: 20px; }
  .next-best { display: block; }
  .next-best .next-best-actions { flex-direction: row; align-items: center; flex-wrap: wrap; }
  .next-best > strong { font-size: 21px; }
  .test-row { padding: 18px; gap: 12px; }
  .test-row .test-actions { grid-column: 1/-1; }
  .test-row .button { width: 100%; }
  .public-nav { align-items: start; flex-wrap: wrap; gap: 14px; }
  .public-nav-actions { justify-content: start; width: 100%; gap: 6px; }
  .public-nav-actions .button { padding: 8px 10px; font-size: 12px; }
  .public-nav-actions .button svg { display: none; }
  .public-brand small { font-size: 11px; }
  .public-hero-content { display: block; padding: 36px 0 28px; }
  .public-intro h1 { font-size: 38px; }
  .public-intro p { max-width: 100%; font-size: 17px; }
  .public-hero-book { display: none; }
  .public-explore .mobile-book-preview { display: inline-flex; }
  .public-proof-strip { grid-template-columns: repeat(2,minmax(0,1fr)); margin-top: 32px; padding-top: 24px; gap: 24px; }
  .public-hero .book-owner-note { margin-top: 24px; }
}
@media (prefers-reduced-motion: reduce) { .button, .choice, .study-path, .practice-coach summary > svg { transition: none; } }

/* Keep mobile question interactions stable and clear of device chrome. */
.question-panel { overflow-anchor: none; scroll-margin-top: 90px; }
.choice-result { min-width: 76px; text-align: right; }
.question-actions .button { min-height: 48px; touch-action: manipulation; }
@media (max-width: 700px) {
  .question-panel { scroll-margin-top: calc(80px + env(safe-area-inset-top)); }
  .question-actions { padding-bottom: max(8px, env(safe-area-inset-bottom)); }
  .choice { min-height: 56px; }
  .choice-result { min-width: 0; font-size: 12px; }
  input, select, textarea { font-size: max(16px, 1em); }
  .tei-table { overflow-x: auto; max-width: 100%; }
  .native-visual { min-width: 0; }
}
/* Let interactive grids shrink inside narrow question cards. */
.tei-answer-card, .tei-graph-wrap, .tei-table-entry, .tei-match-pairs { min-width: 0; }
.tei-graph-wrap > svg { min-width: 0; max-width: min(460px, 100%); }
@media (max-width: 600px) {
  .tei-coordinate-entry { min-width: 0; width: 100%; }
  .tei-coordinate-entry fieldset { width: 100%; max-width: 100%; box-sizing: border-box; gap: 10px; padding-inline: 10px; }
  .tei-coordinate-entry label { flex: 1 1 0; min-width: 0; gap: 6px; }
  .tei-coordinate-entry select { width: 100%; min-width: 0; flex: 1 1 0; }
  .tei-match-row { min-width: 0; }
  .tei-match-row select { min-width: 0; max-width: 100%; }
}
.tei-table-scroll { min-width: 0; max-width: 100%; overflow-x: auto; overscroll-behavior-x: contain; -webkit-overflow-scrolling: touch; }
.tei-table-scroll-note { display: none; }
.tei-entry-table th { font-family: var(--sans); font-size: 16px; font-weight: 700; }
@media (max-width: 600px) {
  .tei-answer-card { padding: 16px; }
  .tei-table-scroll-note { display: block; color: var(--muted); font-size: 13px; margin: 0; }
  .tei-entry-table th, .tei-entry-table td { padding: 8px; }
}

/* Adaptive workspace: the question comes before optional controls and reports. */
#adaptive-view .adaptive-quiet-heading { align-items: center; margin-bottom: 18px; gap: 12px; }
#adaptive-view .adaptive-quiet-heading h1 { font-size: clamp(25px, 2.5vw, 32px); margin: 0; }
#adaptive-view .adaptive-quiet-heading p { font-size: 15px; margin: 6px 0 0; }
.adaptive-session-count { color: var(--muted); font-size: 13px; white-space: nowrap; }
.adaptive-settings, .adaptive-progress { border: 1px solid var(--line); background: var(--surface); border-radius: 12px; margin: 0 0 18px; }
.adaptive-settings > summary, .adaptive-progress > summary { display: flex; align-items: center; gap: 10px; min-height: 50px; padding: 12px 16px; list-style: none; cursor: pointer; font-size: 14px; font-weight: 600; }
.adaptive-settings > summary::-webkit-details-marker, .adaptive-progress > summary::-webkit-details-marker { display: none; }
.adaptive-settings > summary > svg, .adaptive-progress > summary > svg { width: 17px; height: 17px; flex: 0 0 auto; }
.adaptive-settings > summary > svg:last-child, .adaptive-progress > summary > svg:last-child { margin-left: auto; }
.adaptive-settings[open] > summary > svg:last-child, .adaptive-progress[open] > summary > svg:last-child { transform: rotate(180deg); }
.adaptive-setting-value { font-size: 13px; font-weight: 400; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.adaptive-settings-body, .adaptive-progress-body { border-top: 1px solid var(--line); padding: 16px; }
#adaptive-view .adaptive-picker-row { grid-template-columns: repeat(3, minmax(0,1fr)); margin-top: 0; }
#adaptive-view .adaptive-picker-row label { text-transform: none; font-size: 13px; letter-spacing: 0; }
.adaptive-settings-note { font-size: 13px; color: var(--muted); margin: 14px 0 0; line-height: 1.5; }
#adaptive-view .adaptive-question-panel { margin: 0; }
#adaptive-view .adaptive-question-panel .question-meta { margin-bottom: 18px; }
#adaptive-view .adaptive-learning-layout { gap: 16px; margin-bottom: 18px; }
#adaptive-view .practice-coach.coach-panel { min-height: 0; }
#adaptive-view .practice-coach > summary { padding: 16px; }
#adaptive-view .practice-coach > summary > svg:last-child { margin-left: auto; }
.adaptive-progress-stats { display: flex; flex-wrap: wrap; gap: 24px; margin-bottom: 14px; }
.adaptive-progress-stats span { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
.adaptive-progress-stats strong { color: var(--ink); font-size: 22px; font-weight: 700; }
.adaptive-progress-body p { font-size: 14px; line-height: 1.6; }
.adaptive-hint-empty { margin: 0; color: var(--muted); }
.adaptive-welcome { padding: 32px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); margin-bottom: 18px; max-width: 700px; }
.adaptive-welcome h2 { font-size: 23px; margin: 16px 0 8px; }
.adaptive-welcome p { color: var(--muted); line-height: 1.6; max-width: 52ch; margin: 0 0 22px; }
.adaptive-welcome-icon { display: inline-flex; padding: 12px; background: var(--blue-soft); color: var(--blue); border-radius: 12px; }
.adaptive-welcome-icon svg { width: 24px; height: 24px; }
@media (max-width: 680px) {
  #adaptive-view .adaptive-quiet-heading { align-items: flex-start; }
  .adaptive-session-count { display: none; }
  .adaptive-setting-value { margin-left: auto; max-width: 45%; }
  #adaptive-view .adaptive-picker-row { grid-template-columns: 1fr; }
  .adaptive-settings > summary { padding: 12px; }
  .adaptive-progress-stats { gap: 18px; }
  #adaptive-view .adaptive-simple-actions { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px; }
  #adaptive-view .adaptive-simple-actions > button:last-child { grid-column: 1 / -1; width: 100%; }
  .adaptive-welcome { padding: 24px; }
}

/* Keep introductory equations above prose in every question surface. */
.question-stem-with-given .question-stem-body { margin: 0; }
.question-given-equations { margin: 0 0 1rem; padding: .5rem 0; text-align: center; overflow-x: auto; max-width: 100%; }
.question-given-equations mjx-container[display="true"] { margin: .25em 0 !important; }
@media (max-width: 600px) {
  .question-given-equations { margin-bottom: .8rem; padding: .35rem 0; }
}

/* Math responses keep their exact source value; only the visible label is TeX. */
.tei-math-choice { display: inline-block; position: relative; vertical-align: middle; min-width: 7rem; max-width: 100%; margin: .2rem .35rem; }
.tei-math-choice > summary, .tei-math-selected { display: inline-flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 48px; padding: .5rem .85rem; border: 1px solid #99a9bf; border-radius: 10px; background: #fff; color: #17263b; cursor: pointer; list-style: none; }
.tei-math-choice > summary::-webkit-details-marker { display: none; }
.tei-math-choice > summary::after { content: "⌄"; font-size: 1rem; }
.tei-math-choice[open] > summary { outline: 2px solid #2457b2; outline-offset: 2px; }
.tei-math-choice :focus-visible { outline: 3px solid #2457b2; outline-offset: 3px; }
.tei-math-options { position: absolute; z-index: 20; top: 100%; left: 0; width: max-content; min-width: 100%; box-sizing: border-box; display: grid; gap: .25rem; padding: .5rem; margin: .45rem 0 0; border: 1px solid #b8c6d9; border-radius: 12px; background: #fff; box-shadow: 0 6px 18px #17263b12; max-height: 18rem; overflow-y: auto; }
.tei-math-option { display: flex; align-items: center; gap: .65rem; min-height: 48px; padding: .35rem .65rem; border-radius: 7px; cursor: pointer; white-space: nowrap; }
.tei-math-option:has(input:checked) { background: #edf3fc; }
.tei-math-option input { width: 18px; height: 18px; flex: 0 0 auto; accent-color: #2457b2; }
.tei-match-row .tei-math-choice { margin: 0; min-width: 0; }
.tei-inline-fallback { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem; }
.tei-math-legend { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.tei-math-choice:not([open]) > .tei-math-options { display: none; }

/* Opening a response menu must not move the question or reflow its sentence. */
.tei-answer-card:has(.tei-math-choice) { overflow: visible; }
.tei-math-choice[open] { z-index: 20; }

/* Provider integrations stay out of the question flow. */
.study-music-panel { position: fixed; z-index: 1200; right: 24px; top: 84px; width: min(380px, calc(100vw - 32px)); max-height: calc(100dvh - 108px); overflow: auto; padding: 18px; background: var(--surface, #fff); color: var(--ink, #17263b); border: 1px solid var(--line, #cdd6e2); border-radius: 16px; box-shadow: 0 12px 40px #17263b26; }
.study-music-panel[hidden] { display: none; }
.study-music-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.study-music-heading strong { font-size: 18px; }
.study-music-heading p, .study-music-disclosure { color: var(--muted); font-size: 12px; line-height: 1.5; margin: 4px 0 0; }
#spotify-player iframe { display: block; border: 0; border-radius: 12px; max-width: 100%; }
.study-music-links { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; justify-content: space-between; margin: 10px 0 14px; font-size: 12px; }
.study-music-links small { color: var(--muted); }
.study-music-custom { border-top: 1px solid var(--line); padding-top: 12px; margin-bottom: 12px; font-size: 13px; }
.study-music-custom summary { cursor: pointer; min-height: 36px; }
#spotify-playlist-form, .google-link-form { display: grid; gap: 10px; }
#spotify-playlist-status:empty { display: none; }
.google-sign-in-controls { min-height: 48px; }
.google-button-host { max-width: 100%; }
.google-link-form label { display: grid; gap: 6px; }
.google-link-form p { font-size: 14px; line-height: 1.5; margin: 0; }
@media (max-width: 680px) { .study-music-panel { right: 12px; top: 72px; width: calc(100vw - 24px); max-height: calc(100dvh - 88px); padding: 16px; } .study-music-toggle { min-width: 44px; min-height: 44px; } }

.provider-notice { width: min(760px, calc(100% - 40px)); margin: 48px auto; line-height: 1.7; }
.provider-notice h1 { margin: 24px 0 8px; }
.provider-notice h2 { margin-top: 32px; font-size: 1.25rem; }
@media (max-width: 680px) { .provider-notice { margin: 24px auto; } }

.update-banner[hidden] { display: none; }

/* Exam-season plans: clear duration choices, with shared tools and no renewal. */
.studio-pricing { margin: 32px 0; scroll-margin-top: 100px; }
.studio-pricing-heading { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 24px; }
.studio-pricing-heading h2 { margin: 8px 0; font-size: clamp(26px, 3vw, 36px); letter-spacing: -.035em; }
.studio-pricing-heading p { margin: 0; color: #526176; line-height: 1.6; max-width: 62ch; }
.offer-deadline { color: #24468e; background: #eef3ff; border: 1px solid #d5dff4; border-radius: 10px; padding: 12px 16px; font-size: 13px; line-height: 1.5; max-width: 265px; }
.studio-plan-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 20px; }
.studio-plan-grid-two { grid-template-columns: repeat(2,minmax(0,1fr)); }
.studio-plan { display: flex; flex-direction: column; min-width: 0; padding: 28px; background: #fff; color: #1b293b; border: 1px solid #d7dfeb; border-radius: 18px; box-shadow: 0 6px 22px rgba(26,45,74,.035); }
.studio-plan-featured { border: 2px solid #345bbb; padding: 27px; }
.studio-plan-selected { outline: 3px solid #cbd8fc; outline-offset: 3px; }
.plan-kicker { font-size: 12px; font-weight: 750; color: #34549a; letter-spacing: .03em; }
.studio-plan h3 { margin: 14px 0 10px; font-size: 25px; letter-spacing: -.025em; }
.plan-description { color: #526176; font-size: 15px; line-height: 1.55; margin: 0; min-height: 47px; }
.plan-amount { margin: 26px 0 8px; font-size: 42px; font-weight: 750; line-height: 1.15; letter-spacing: -.045em; }
.plan-amount span { font-size: 13px; font-weight: 500; color: #526176; letter-spacing: 0; }
.plan-duration { margin: 0; font-weight: 700; font-size: 14px; line-height: 1.5; }
.plan-inclusions { list-style: none; padding: 22px 0; margin: 16px 0; border-top: 1px solid #e6eaf1; flex: 1; }
.plan-inclusions li { display: flex; gap: 10px; font-size: 14px; line-height: 1.6; margin: 8px 0; }
.plan-inclusions li::before { content: "✓"; color: #335799; font-weight: 750; }
.studio-plan .button { width: 100%; justify-content: center; min-height: 48px; white-space: normal; text-align: center; }
.studio-plan button:disabled { opacity: 1; background: #eff2f7; color: #59677b; border-color: #dbe2ec; cursor: default; }
.plan-fine-print, .plan-next-price { color: #526176; font-size: 12px; line-height: 1.5; margin: 12px 0 0; text-align: center; }
.pricing-availability { color: #3b506c; background: #eef3f9; border-radius: 10px; padding: 14px 18px; line-height: 1.6; font-size: 14px; }
.book-bundle-strip { display: grid; grid-template-columns: 1fr auto; gap: 16px 28px; padding: 24px; margin: 24px 0; border: 1px solid #d7dfeb; border-radius: 14px; background: #fff; }
.book-bundle-strip strong { font-size: 18px; }
.book-bundle-strip p { max-width: 70ch; color: #526176; font-size: 14px; line-height: 1.65; margin: 8px 0 0; }
.book-bundle-actions { display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 12px; }
.book-bundle-strip small { grid-column: 1/-1; color: #526176; font-size: 12px; }
.pricing-details { border-top: 1px solid #d7dfeb; padding: 16px 0; font-size: 14px; color: #526176; line-height: 1.7; }
.pricing-details summary { font-weight: 700; color: #253852; cursor: pointer; padding: 8px 0; }
.pricing-details p { max-width: 95ch; }
.book-unlock-details { background: #fff; border: 1px solid #d7dfeb; border-radius: 14px; margin: 24px 0; padding: 20px 24px; }
.book-unlock-details summary { font-weight: 700; display: flex; gap: 10px; cursor: pointer; align-items: center; }
.book-unlock-details form { max-width: 610px; margin-top: 22px; }
.access-success { display: flex; align-items: center; gap: 16px; margin-bottom: 28px; }
.access-success .button { margin-left: auto; }
@media (max-width: 1050px) { .studio-plan { padding: 22px; } .studio-plan-featured { padding: 21px; } .plan-amount { font-size: 36px; } }
@media (max-width: 760px) {
  .studio-pricing-heading { flex-direction: column; align-items: flex-start; gap: 16px; }
  .offer-deadline { max-width: none; }
  .studio-plan-grid, .studio-plan-grid-two { grid-template-columns: 1fr; }
  .plan-description { min-height: 0; }
  .plan-inclusions { padding: 16px 0; margin-bottom: 8px; }
  .book-bundle-strip { grid-template-columns: 1fr; padding: 20px; }
  .book-bundle-actions { align-items: stretch; }
  .access-success { flex-wrap: wrap; }
  .access-success .button { margin-left: 0; width: 100%; }
  .book-unlock-details { padding: 20px; }
}

.public-hero .book-owner-note a { color: #e4eeff; text-underline-offset: 3px; font-weight: 650; }
