@font-face {
  font-family: "Alpha Serif";
  src: url("../vendor/katex/fonts/KaTeX_Main-Regular.woff2") format("woff2");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Alpha Serif";
  src: url("../vendor/katex/fonts/KaTeX_Main-Bold.woff2") format("woff2");
  font-style: normal;
  font-weight: 700;
  font-display: swap;
}

:root {
  color-scheme: light;
  --paper: #f8f5ed;
  --paper-bright: #fffdf8;
  --paper-deep: #eee8dc;
  --ink: #17241d;
  --ink-soft: #626b63;
  --ink-faint: #8a9089;
  --green: #174f3b;
  --green-deep: #103d2d;
  --green-soft: #e2ebe4;
  --line: #d9d2c5;
  --line-strong: #b9b2a5;
  --warning: #a45f32;
  --danger: #9c4d40;
  --success: #236f4a;
  --camera: #111714;
  --sans: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --serif: "Alpha Serif", Georgia, "Times New Roman", serif;
  --shadow-soft: 0 18px 50px rgba(36, 42, 36, 0.11);
  --shadow-menu: 0 14px 34px rgba(25, 30, 25, 0.15);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--paper); color: var(--ink); }
body { min-height: 100vh; overflow-x: hidden; font-family: var(--sans); }
button, input, textarea { font: inherit; }
button { color: inherit; }
button, [role="button"] { -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible, textarea:focus-visible, a:focus-visible {
  outline: 3px solid rgba(23, 79, 59, 0.26);
  outline-offset: 3px;
}
[hidden], .hidden { display: none !important; }
.sr-only { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; }

.skip-link {
  position: fixed;
  z-index: 200;
  left: 16px;
  top: -80px;
  padding: 10px 14px;
  color: #fff;
  background: var(--green);
  border-radius: 8px;
}
.skip-link:focus { top: 12px; }

.app-shell { min-height: 100vh; }
button { border: 0; background: transparent; cursor: pointer; }
.eyebrow {
  margin: 0 0 7px;
  color: var(--green);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .16em;
  text-transform: uppercase;
}

.dashboard-header {
  position: sticky;
  z-index: 30;
  top: 0;
  display: grid;
  grid-template-columns: 260px 1fr 260px;
  align-items: center;
  min-height: 76px;
  padding: 0 34px;
  border-bottom: 1px solid rgba(185, 178, 165, .72);
  background: rgba(248, 245, 237, .95);
  backdrop-filter: blur(16px);
}

.brand, .session-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  width: max-content;
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -.02em;
  color: var(--green-deep);
}
.brand img, .session-brand img { display: block; object-fit: contain; }

.main-nav { display: flex; justify-content: center; gap: 8px; }
.nav-link {
  padding: 10px 15px;
  border-radius: 8px;
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 650;
}
.nav-link:hover, .nav-link.active { color: var(--ink); background: var(--paper-bright); }

.profile-button {
  display: grid;
  grid-template-columns: 36px 1fr 16px;
  align-items: center;
  justify-self: end;
  gap: 10px;
  max-width: 230px;
  padding: 7px 9px;
  border: 1px solid transparent;
  border-radius: 10px;
  text-align: left;
}
.profile-button:hover { border-color: var(--line); background: var(--paper-bright); }
.profile-button > span:first-child, .profile-summary > span {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  color: #fff;
  background: var(--green);
  font-family: var(--serif);
  font-weight: 700;
}
.profile-copy { display: flex; min-width: 0; flex-direction: column; }
.profile-copy strong { overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.profile-copy small { color: var(--ink-faint); font-size: 10px; }
.profile-button svg { width: 15px; color: var(--ink-faint); }

.dashboard-view { width: min(1240px, calc(100% - 56px)); margin: 0 auto; padding: 54px 0 72px; }
.dashboard-hero {
  display: grid;
  grid-template-columns: minmax(0, .92fr) minmax(430px, 1.08fr);
  align-items: stretch;
  min-height: 430px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--paper-bright);
  box-shadow: var(--shadow-soft);
}
.hero-copy { display: flex; flex-direction: column; justify-content: center; padding: 60px; }
.hero-copy h1 {
  max-width: 520px;
  margin: 0 0 18px;
  font-family: var(--serif);
  font-size: clamp(42px, 5vw, 68px);
  line-height: .98;
  letter-spacing: -.045em;
}
.hero-copy > p:not(.eyebrow, .permission-note) {
  max-width: 500px;
  margin: 0;
  color: var(--ink-soft);
  font-size: 17px;
  line-height: 1.65;
}
.hero-actions { display: flex; align-items: center; gap: 13px; margin-top: 34px; }
.pdf-page-dialog {
  width: min(880px, calc(100vw - 32px));
  max-height: min(780px, calc(100vh - 32px));
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  color: var(--ink);
  background: var(--paper);
  box-shadow: 0 28px 90px rgba(20, 25, 21, .28);
}
.pdf-page-dialog::backdrop { background: rgba(17, 21, 18, .56); backdrop-filter: blur(3px); }
.pdf-page-dialog > header { display: flex; align-items: center; justify-content: space-between; padding: 20px 22px 14px; border-bottom: 1px solid var(--line); }
.pdf-page-dialog h2 { margin: 3px 0 0; font-family: var(--serif); font-size: 24px; font-weight: 500; }
.pdf-page-dialog > p { margin: 0; padding: 14px 22px; color: var(--ink-soft); font-size: 12px; }
.pdf-page-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(145px, 1fr)); gap: 14px; max-height: 600px; padding: 4px 22px 24px; overflow: auto; }
.pdf-page-option { position: relative; display: flex; flex-direction: column; gap: 8px; padding: 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--paper-bright); text-align: left; }
.pdf-page-option:hover, .pdf-page-option:focus-visible { border-color: var(--green); box-shadow: 0 8px 24px rgba(23, 79, 59, .12); }
.pdf-page-option img { width: 100%; aspect-ratio: 3 / 4; border-radius: 5px; background: #fff; object-fit: contain; box-shadow: 0 2px 8px rgba(0,0,0,.08); }
.pdf-page-option span { color: var(--ink-soft); font-size: 11px; font-weight: 800; }
.permission-note {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 18px 0 0;
  color: var(--ink-faint);
  font-size: 11px;
}
.permission-note svg { width: 14px; }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 44px;
  padding: 0 17px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--paper-bright);
  font-weight: 700;
  transition: transform 150ms ease, border-color 150ms ease, background 150ms ease;
}
.button:hover:not(:disabled) { transform: translateY(-1px); border-color: var(--line-strong); }
.button:disabled { cursor: not-allowed; opacity: .52; }
.button.primary { color: #fff; border-color: var(--green); background: var(--green); }
.button.primary:hover:not(:disabled) { background: var(--green-deep); }
.button.quiet { color: var(--ink); background: rgba(255, 253, 248, .75); }
.text-link {
  padding: 4px 0;
  color: var(--green);
  font-size: 12px;
  font-weight: 750;
}
.text-link.inverse { color: #fff; }
.start-button {
  min-width: 220px;
  min-height: 62px;
  justify-content: flex-start;
  padding: 0 17px;
  border-radius: 11px;
  box-shadow: 0 12px 26px rgba(23, 79, 59, .18);
}
.start-button > span { display: flex; flex: 1; flex-direction: column; align-items: flex-start; line-height: 1.15; }
.start-button strong { font-family: var(--serif); font-size: 17px; }
.start-button small { margin-top: 5px; opacity: .74; font-size: 10px; font-weight: 500; }

.hero-camera-card {
  position: relative;
  min-height: 430px;
  overflow: hidden;
  background: var(--camera);
  color: #fff;
  text-align: left;
}
.hero-camera-card::after {
  position: absolute;
  inset: 0;
  content: "";
  background: radial-gradient(circle at 70% 30%, rgba(123, 170, 143, .15), transparent 42%), linear-gradient(180deg, transparent 45%, rgba(0, 0, 0, .68));
}
.hero-camera-grid, .camera-grid {
  position: absolute;
  inset: 0;
  opacity: .11;
  background-image: linear-gradient(rgba(255,255,255,.18) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.18) 1px, transparent 1px);
  background-size: 42px 42px;
}
.hero-camera-status {
  position: absolute;
  z-index: 2;
  top: 24px;
  left: 24px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 11px;
  border: 1px solid rgba(255,255,255,.17);
  border-radius: 999px;
  background: rgba(12, 18, 15, .56);
  font-size: 11px;
  font-weight: 700;
  backdrop-filter: blur(10px);
}
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #8fd4a9; box-shadow: 0 0 0 4px rgba(143, 212, 169, .12); }
.hero-paper {
  position: absolute;
  z-index: 1;
  top: 66px;
  right: 65px;
  width: min(60%, 340px);
  height: 275px;
  padding: 44px 36px;
  transform: rotate(-4deg);
  border-radius: 5px;
  background: #f8f4e9;
  box-shadow: 0 28px 50px rgba(0,0,0,.32);
}
.hero-paper span { display: block; width: 100%; height: 6px; margin-bottom: 16px; border-radius: 5px; background: #c5c1b6; }
.hero-paper span.short { width: 64%; }
.hero-paper span.equation { width: auto; height: auto; margin-top: 29px; color: #4f554f; background: none; font-family: var(--serif); font-size: 25px; }
.hero-camera-label { position: absolute; z-index: 3; right: 28px; bottom: 27px; left: 28px; display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; }
.hero-camera-label span { color: rgba(255,255,255,.66); font-size: 11px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.hero-camera-label strong { font-family: var(--serif); font-size: 24px; font-weight: 400; }

.quick-tools { margin-top: 54px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; margin-bottom: 20px; }
.section-heading h2, .dashboard-card h2 { margin: 0; font-family: var(--serif); font-size: 25px; letter-spacing: -.02em; }
.tool-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.tool-card {
  display: grid;
  grid-template-columns: 48px 1fr 20px;
  align-items: center;
  gap: 16px;
  min-height: 108px;
  padding: 21px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--paper-bright);
  text-align: left;
  transition: transform 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
}
.tool-card:hover { transform: translateY(-2px); border-color: var(--line-strong); box-shadow: 0 12px 30px rgba(36,42,36,.07); }
.tool-card > span:nth-child(2) { display: flex; flex-direction: column; gap: 6px; }
.tool-card strong { font-family: var(--serif); font-size: 18px; }
.tool-card small { color: var(--ink-soft); line-height: 1.45; }
.tool-icon { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 12px; background: var(--green-soft); color: var(--green); }
.tool-card > svg { color: var(--ink-faint); }

.dashboard-grid { display: grid; grid-template-columns: 1.2fr .9fr .9fr; gap: 16px; margin-top: 42px; }
.dashboard-card { min-height: 280px; padding: 24px; border: 1px solid var(--line); border-radius: 15px; background: rgba(255,253,248,.78); }
.card-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.card-heading h2 { font-size: 20px; }
.empty-copy { margin: 22px 0; color: var(--ink-faint); font-size: 13px; line-height: 1.6; }
.recent-list, .weakness-list { display: flex; flex-direction: column; }
.recent-row {
  display: grid;
  grid-template-columns: 58px 1fr 18px;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 14px 0;
  border-bottom: 1px solid rgba(217,210,197,.65);
  text-align: left;
}
.recent-row:last-child { border-bottom: 0; }
.recent-row > span:nth-child(2) { display: flex; min-width: 0; flex-direction: column; gap: 4px; }
.recent-row strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.recent-row small { color: var(--ink-faint); font-size: 10px; }
.subject-badge { display: inline-flex; align-items: center; justify-content: center; width: max-content; max-width: 78px; padding: 5px 7px; overflow: hidden; border-radius: 6px; background: var(--green-soft); color: var(--green); font-size: 9px; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.weakness-row { display: grid; grid-template-columns: 8px 1fr; gap: 12px; padding: 15px 0; border-bottom: 1px solid rgba(217,210,197,.65); }
.weakness-row > span { width: 7px; height: 7px; margin-top: 5px; border-radius: 50%; background: var(--warning); }
.weakness-row div { display: flex; flex-direction: column; gap: 4px; }
.weakness-row strong { font-size: 13px; }
.weakness-row small { color: var(--ink-faint); font-size: 10px; }
.time-chip { padding: 5px 8px; border: 1px solid var(--line); border-radius: 999px; color: var(--ink-soft); font-size: 10px; font-weight: 750; }
.practice-title { display: block; margin: 20px 0 8px; font-family: var(--serif); font-size: 18px; }
#practice-content > p { color: var(--ink-soft); font-size: 12px; line-height: 1.55; }
.practice-list { margin: 14px 0 0; padding-left: 19px; color: var(--ink-soft); font-size: 12px; line-height: 1.7; }

/* Only the live workspace owns the viewport; the dashboard keeps normal page scrolling. */
html:has(#app[data-view="live"]:not([hidden])),
body:has(#app[data-view="live"]:not([hidden])) {
  height: 100%; min-height: 0; overflow: hidden; overscroll-behavior: none;
}
.live-view {
  position: fixed; inset: 0; display: grid; grid-template-rows: auto minmax(0, 1fr) auto;
  height: 100vh; height: 100dvh; min-height: 0; overflow: hidden; background: #ece8df;
}
.session-header {
  position: relative;
  z-index: 24;
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr) 220px;
  align-items: center;
  min-height: 68px;
  padding: 0 20px;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}
.session-brand { font-size: 18px; }
.session-context { display: flex; min-width: 0; align-items: center; justify-content: center; gap: 12px; }
.session-context > strong { overflow: hidden; font-family: var(--serif); font-size: 15px; text-overflow: ellipsis; white-space: nowrap; }
.teaching-mode-pill { padding: 6px 9px; border: 1px solid rgba(23,79,59,.28); border-radius: 99px; color: var(--green); background: var(--green-soft); font-size: 9px; font-weight: 800; white-space: nowrap; }
.teaching-mode-pill[data-mode="quick_check"] { border-color: rgba(164,95,50,.28); color: #75401f; background: #f5e8dc; }
.live-pill { display: inline-flex; align-items: center; gap: 7px; padding: 6px 9px; border: 1px solid #bfd1c5; border-radius: 999px; background: var(--green-soft); color: var(--green); font-size: 9px; font-weight: 850; letter-spacing: .09em; text-transform: uppercase; }
.live-pill i { width: 6px; height: 6px; border-radius: 50%; background: #3f9e68; box-shadow: 0 0 0 3px rgba(63,158,104,.13); }
.session-meta { display: flex; align-items: center; justify-content: flex-end; gap: 14px; }
.session-meta time { color: var(--ink-soft); font-variant-numeric: tabular-nums; font-size: 12px; font-weight: 700; }
.icon-button { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 8px; color: var(--ink-soft); }
.icon-button:hover { background: var(--paper-deep); color: var(--ink); }

.live-workspace { position: relative; display: grid; grid-template-columns: minmax(0, var(--primary-pane-size, 60%)) 0 minmax(0, 1fr); height: 100%; min-height: 0; gap: 0; background: transparent; }
.live-workspace.board-collapsed { grid-template-columns: 1fr; }
.live-workspace.board-collapsed .workspace-resizer { display: none; }
.session-primary-column { display: grid; grid-template-rows: minmax(0, var(--camera-pane-size, 46%)) 0 minmax(0, 1fr); min-width: 0; min-height: 0; gap: 0; background: transparent; }
.panel-resizer { position: relative; z-index: 22; touch-action: none; background: transparent; outline: none; }
.panel-resizer::before, .panel-resizer::after { position: absolute; pointer-events: none; opacity: 0; transition: opacity 120ms ease; }
.panel-resizer::before { z-index: 2; display: grid; width: 28px; height: 28px; place-items: center; border: 1px solid rgba(23,79,59,.3); border-radius: 999px; color: var(--green); background: rgba(255,253,248,.94); box-shadow: 0 5px 18px rgba(18,38,29,.14); font-size: 14px; font-weight: 800; line-height: 1; }
.panel-resizer::after { content: ""; z-index: 1; border-radius: 99px; background: rgba(23,79,59,.56); }
.panel-resizer:focus-visible::before, .panel-resizer:focus-visible::after,
.panel-resizer.dragging::before, .panel-resizer.dragging::after { opacity: 1; }
.workspace-resizer { width: 14px; margin-left: -7px; cursor: col-resize; }
.workspace-resizer::before { top: 50%; left: 50%; content: "↔"; transform: translate(-50%, -50%); }
.workspace-resizer::after { top: 10px; bottom: 10px; left: 6px; width: 2px; }
.primary-resizer { height: 14px; margin-top: -7px; cursor: row-resize; }
.primary-resizer::before { top: 50%; left: 50%; content: "↕"; transform: translate(-50%, -50%); }
.primary-resizer::after { top: 6px; right: 10px; left: 10px; height: 2px; }
body.resizing-layout { cursor: grabbing; user-select: none; }
.camera-panel { position: relative; min-width: 0; overflow: hidden; background: var(--camera); }
.camera-media-viewport { position: absolute; inset: 0; overflow: hidden; }
.camera-media-viewport > video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; transition: transform 200ms ease; }
.camera-media-viewport, .uploaded-document-open { touch-action: none; user-select: none; -webkit-user-select: none; overscroll-behavior: contain; }
.camera-media-viewport > video, .uploaded-document-preview img { transform-origin: center; }
.media-zoomed { cursor: grab !important; }
.media-panning { cursor: grabbing !important; }
.media-zoom-reset { position: absolute; z-index: 11; left: 12px; bottom: 8px; padding: 5px 9px; border: 1px solid rgba(255,255,255,.22); border-radius: 999px; color: #fff; background: rgba(10,15,12,.88); font-size: 10px; cursor: pointer; }
.uploaded-document-preview { position: absolute; z-index: 4; inset: 0; display: grid; min-width: 0; min-height: 0; place-items: stretch; overflow: hidden; padding: 64px 14px 96px; background: #171a18; }
.camera-panel.controls-collapsed .uploaded-document-preview { padding-bottom: 14px; }
.uploaded-document-open { display: grid; width: 100%; height: 100%; min-width: 0; min-height: 0; place-items: center; overflow: hidden; border-radius: 6px; background: transparent; cursor: zoom-in; }
.uploaded-document-preview img { display: block; width: 100%; height: 100%; min-width: 0; min-height: 0; object-fit: contain; object-position: center; filter: drop-shadow(0 12px 32px rgba(0,0,0,.28)); }
.uploaded-document-toolbar { position: absolute; z-index: 2; top: 22px; right: 22px; display: flex; align-items: center; gap: 7px; }
.uploaded-document-toolbar span, .uploaded-document-toolbar button { display: inline-flex; min-height: 30px; align-items: center; gap: 6px; padding: 7px 10px; border: 1px solid rgba(255,255,255,.18); border-radius: 999px; color: rgba(255,255,255,.92); background: rgba(10,15,12,.76); font-size: 9px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; backdrop-filter: blur(10px); }
.uploaded-document-toolbar button:hover, .uploaded-document-toolbar button:focus-visible { color: #fff; background: rgba(23,79,59,.92); }
.uploaded-document-toolbar svg { width: 13px; height: 13px; }
.camera-panel::after { position: absolute; inset: 0; pointer-events: none; content: ""; box-shadow: inset 0 0 100px rgba(0,0,0,.25); }
.camera-grid { opacity: .055; pointer-events: none; }
.camera-fallback { position: absolute; z-index: 3; inset: 0; display: flex; align-items: center; justify-content: center; flex-direction: column; padding: 36px; color: rgba(255,255,255,.82); text-align: center; }
.camera-fallback > svg { width: 32px; height: 32px; margin-bottom: 16px; opacity: .7; }
.camera-fallback strong { font-family: var(--serif); font-size: 28px; font-weight: 400; }
.camera-fallback p { max-width: 420px; margin: 9px 0 20px; color: rgba(255,255,255,.56); font-size: 13px; line-height: 1.6; }
.camera-fallback .button { color: #fff; border-color: rgba(255,255,255,.24); background: rgba(255,255,255,.08); }
.detection-status { position: absolute; z-index: 8; top: 22px; left: 22px; display: inline-flex; align-items: center; gap: 9px; max-width: calc(100% - 44px); padding: 9px 12px; border: 1px solid rgba(255,255,255,.16); border-radius: 999px; color: rgba(255,255,255,.88); background: rgba(11,17,14,.65); font-size: 11px; font-weight: 700; backdrop-filter: blur(12px); }
.detection-status[data-tone="working"] .status-dot { background: #e0ba66; animation: pulse 1.4s infinite; }
.detection-status[data-tone="warning"] .status-dot { background: #da8e58; }
.detection-status[data-tone="error"] .status-dot { background: #dc7769; }
@keyframes pulse { 50% { opacity: .35; transform: scale(.82); } }
.camera-mode-banner { position: absolute; z-index: 9; top: 22px; left: 50%; display: flex; align-items: center; gap: 15px; padding: 9px 12px; transform: translateX(-50%); border: 1px solid rgba(255,255,255,.18); border-radius: 9px; color: #fff; background: rgba(23,79,59,.88); font-size: 11px; font-weight: 700; backdrop-filter: blur(10px); }

.session-controls { position: absolute; z-index: 10; bottom: 22px; left: 50%; display: flex; align-items: center; gap: 5px; max-width: calc(100% - 30px); padding: 8px; transform: translateX(-50%); border: 1px solid rgba(255,255,255,.14); border-radius: 14px; background: rgba(10,15,12,.76); box-shadow: 0 16px 36px rgba(0,0,0,.28); backdrop-filter: blur(16px); }
.session-controls-body { display: flex; align-items: center; gap: 7px; }
.controls-toggle { display: grid; flex: 0 0 auto; width: 30px; height: 53px; place-items: center; border-radius: 9px; color: rgba(255,255,255,.76); }
.controls-toggle:hover, .controls-toggle:focus-visible { color: #fff; background: rgba(255,255,255,.11); }
.controls-toggle svg { width: 15px; height: 15px; transition: transform 160ms ease; }
.session-controls.collapsed { padding: 4px; }
.session-controls.collapsed .session-controls-body { display: none; }
.session-controls.collapsed .controls-toggle { width: 42px; height: 36px; }
.session-controls.collapsed .controls-toggle svg { transform: rotate(180deg); }
.control-button { display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 4px; min-width: 58px; height: 53px; padding: 5px 8px; border-radius: 9px; color: rgba(255,255,255,.72); }
.control-button:hover, .control-button.active { color: #fff; background: rgba(255,255,255,.11); }
.control-button svg { width: 16px; height: 16px; }
.control-button span { font-size: 8px; font-weight: 750; }
.control-button.done { color: #fff; background: var(--green); }
.control-button.danger:hover { background: rgba(156,77,64,.48); }

.session-transcript-panel { display: grid; grid-template-rows: auto minmax(0, 1fr) auto auto; min-width: 0; min-height: 0; overflow: hidden; background: var(--paper-bright); }
.session-transcript-header { display: flex; align-items: center; justify-content: space-between; gap: 18px; min-height: 68px; padding: 13px 20px; border-bottom: 1px solid var(--line); }
.session-transcript-header strong { display: block; margin-top: 2px; font-family: var(--serif); font-size: 17px; font-weight: 500; }
.transcript-save-state { display: inline-flex; align-items: center; gap: 7px; color: var(--green); font-size: 9px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; white-space: nowrap; }
.transcript-save-state i { width: 7px; height: 7px; border-radius: 50%; background: #3f9e68; box-shadow: 0 0 0 3px rgba(63,158,104,.12); }
.session-transcript-panel .transcript-list { min-height: 0; max-height: none; padding: 16px 20px 22px; scroll-behavior: smooth; overscroll-behavior: contain; }
.session-transcript-panel .transcript-row { width: min(94%, 760px); }
.session-transcript-panel .transcript-row.user { align-self: flex-end; margin-left: 0; }
.session-transcript-panel .transcript-row.pending { opacity: .72; }
.session-transcript-panel .transcript-row.pending p::after { content: ' ···'; letter-spacing: .12em; animation: transcript-thinking 1s steps(4, end) infinite; }
.transcript-meta { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.transcript-meta time { color: var(--ink-faint); font-size: 8px; font-variant-numeric: tabular-nums; }
.session-transcript-panel .transcript-row p { overflow-wrap: anywhere; white-space: pre-wrap; }
.math-display { display: block; max-width: 100%; overflow-x: auto; padding: 4px 0; white-space: normal; }
.math-inline { white-space: normal; }
.math-display .katex-display { margin: .5em 0; }
.math-error { color: var(--ink-soft); font-size: .9em; overflow-wrap: anywhere; }
.note-line { white-space: pre-wrap; }
@keyframes transcript-thinking { 50% { opacity: .35; } }

.tutor-shortcuts { display: flex; gap: 7px; padding: 9px 16px 0; overflow-x: auto; background: rgba(255,253,248,.96); scrollbar-width: none; }
.tutor-shortcuts::-webkit-scrollbar { display: none; }
.tutor-shortcut { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; gap: 6px; min-height: 34px; padding: 7px 11px; border: 1px solid #d8d0c2; border-radius: 999px; color: var(--green); background: #fffefa; font-size: 10px; font-weight: 750; line-height: 1.2; transition: border-color .16s ease, background .16s ease, transform .16s ease; }
.tutor-shortcut:hover { border-color: #87a995; background: var(--green-soft); transform: translateY(-1px); }
.tutor-shortcut:focus-visible { outline: 3px solid rgba(47,107,78,.16); outline-offset: 1px; }
.tutor-shortcut:disabled { cursor: wait; opacity: .5; transform: none; }
.tutor-shortcut svg { width: 14px; height: 14px; stroke-width: 1.9; }

.live-chat-composer { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 9px; padding: 12px 16px 14px; border-top: 1px solid var(--line); background: rgba(255,253,248,.96); }
.live-chat-composer textarea { min-height: 42px; max-height: 118px; resize: none; overflow-y: auto; padding: 11px 13px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); background: #fff; line-height: 1.42; outline: none; }
.live-chat-composer textarea:focus { border-color: #8cac9a; box-shadow: 0 0 0 3px rgba(47,107,78,.1); }
.live-chat-composer button { min-height: 42px; padding-inline: 15px; }
.live-chat-composer button svg { width: 15px; height: 15px; }
.live-chat-composer[data-busy="true"] textarea, .live-chat-composer[data-busy="true"] button { opacity: .62; }

.board-panel { display: grid; grid-template-rows: auto minmax(0, 1fr) auto auto auto; min-width: 0; min-height: 0; overflow: hidden; background: var(--paper-bright); }
.board-panel.collapsed { display: none; }
.board-header { display: flex; align-items: center; justify-content: space-between; gap: 15px; min-height: 72px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.board-header strong { font-family: var(--serif); font-size: 16px; }
.board-header-actions { display: flex; align-items: center; gap: 8px; }
.board-retry { color: var(--green); font-size: 10px; font-weight: 800; }
.board-stage { position: relative; display: flex; min-height: 0; flex-direction: column; overflow: hidden; background: #fffefa; }
.boardkit-surface { flex:1; min-height:0; width:100%; height:100%; }
.boardkit-surface[hidden] { display:none; }
.board-empty { display: flex; align-items: center; justify-content: center; flex-direction: column; height: 100%; min-height: 280px; padding: 28px; text-align: center; }
.board-mark { display: grid; place-items: center; width: 48px; height: 48px; margin-bottom: 15px; border-radius: 50%; background: var(--green-soft); color: var(--green); }
.board-empty strong { font-family: var(--serif); font-size: 19px; }
.board-empty p { max-width: 240px; margin: 8px 0 18px; color: var(--ink-soft); font-size: 12px; line-height: 1.5; }
#jxgbox { flex: 1; width: 100%; min-height: 220px; border: 0; }
#jxgbox.lesson-drawing { flex: 0 0 45%; min-height: 160px; max-height: 380px; }
.board-notes { display: flex; flex: 1; min-height: 0; flex-direction: column; gap: 10px; overflow-y: auto; overscroll-behavior: contain; padding: 20px; }
.lesson-visual { margin: 0 0 12px; flex: 0 0 auto; }
.lesson-visual svg { display: block; width: 100%; max-height: 370px; background: #fff; border-radius: 12px; }
.lesson-shape { color: #25473b; }
.lesson-focus { color: #bc5725; }
.lesson-label, .lesson-focus-label { font: 17px Georgia, serif; fill: #25473b; paint-order: stroke; stroke: white; stroke-width: 4px; stroke-linejoin: round; }
.lesson-focus-label { fill: #a44115; font-weight: 700; }
.lesson-visual figcaption { margin-top: 8px; color: var(--ink-soft); font-size: 12px; line-height: 1.5; }
.lesson-visual table { width: 100%; border-collapse: collapse; font-size: 14px; }
.lesson-visual th, .lesson-visual td { padding: 10px; border-bottom: 1px solid var(--line); text-align: left; overflow-wrap: anywhere; }
.lesson-visual th { background: #e9f0ec; }
.lesson-audio { display: flex; gap: 10px; align-items: center; padding: 8px 16px; font-size: 12px; color: var(--ink-soft); }
.lesson-audio[hidden] { display: none; }
.lesson-audio button { flex-shrink: 0; border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; background: var(--paper-bright); color: var(--green); cursor: pointer; }
.note-line { padding-left: 12px; border-left: 3px solid var(--green); color: var(--ink); font-family: var(--serif); font-size: 16px; line-height: 1.7; }
.note-formula { padding: 12px 8px; overflow-x: auto; text-align: center; }
.note-formula .katex-display { margin: 0; }
.note-kcard { padding: 12px 14px; border-left: 4px solid var(--green); border-radius: 10px; background: #fff; box-shadow: 0 4px 14px rgba(30,35,30,.07); }
.note-kcard .kc-tag { display: inline-block; margin-bottom: 7px; padding: 3px 6px; border-radius: 4px; color: #fff; background: var(--green); font-size: 8px; font-weight: 850; letter-spacing: .1em; }
.note-kcard b { display: block; margin-bottom: 4px; }
.note-kcard p { margin: 0; color: var(--ink-soft); font-size: 12px; line-height: 1.55; }
.note-kcard.k-formula { border-left-color: #6d61ae; } .note-kcard.k-formula .kc-tag { background: #6d61ae; }
.note-kcard.k-case { border-left-color: #bd7936; } .note-kcard.k-case .kc-tag { background: #bd7936; }
.note-kcard.k-tip { border-left-color: var(--success); } .note-kcard.k-tip .kc-tag { background: var(--success); }
.kc-links { display: flex; gap: 7px; flex-wrap: wrap; margin-top: 8px; }
.kc-links a { color: var(--green); font-size: 10px; font-weight: 750; text-decoration: none; }
.board-facts { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 14px; }
.board-facts:not(:empty) { padding-block: 8px; border-top: 1px dashed var(--line); }
.board-fact { padding: 4px 8px; border: 1px solid #b7cbbc; border-radius: 999px; color: var(--green); background: var(--green-soft); font-family: var(--serif); font-size: 11px; }
.board-state, .board-caption { margin: 0; padding: 9px 16px; color: var(--ink-soft); font-size: 10px; line-height: 1.4; }
.board-caption:empty { display: none; }
.board-controls { display: grid; grid-template-columns: 42px 42px 42px 42px minmax(92px, 1fr); gap: 7px; padding: 11px 14px 14px; border-top: 1px solid var(--line); }
.board-controls button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 40px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper-bright); font-size: 11px; font-weight: 750; }
.board-controls button.primary { color: #fff; border-color: var(--green); background: var(--green); }
.board-controls button:disabled { cursor: default; opacity: .38; }
.board-restore { position: absolute; z-index: 11; top: 20px; right: 20px; display: inline-flex; align-items: center; gap: 7px; padding: 9px 12px; border: 1px solid rgba(255,255,255,.18); border-radius: 9px; color: #fff; background: rgba(10,15,12,.66); font-size: 10px; font-weight: 750; backdrop-filter: blur(10px); }

.drawer-scrim { position: fixed; z-index: 70; inset: 0; background: rgba(16,24,19,.28); backdrop-filter: blur(2px); }
.drawer { position: fixed; z-index: 80; top: 0; right: 0; width: min(480px, 100%); height: 100vh; overflow: hidden; transform: translateX(104%); border-left: 1px solid var(--line); background: var(--paper-bright); box-shadow: -18px 0 54px rgba(25,30,25,.16); transition: transform 220ms ease; }
.drawer.open { transform: translateX(0); }
.drawer-header { display: flex; align-items: center; justify-content: space-between; min-height: 82px; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.drawer-header h2 { margin: 0; font-family: var(--serif); font-size: 25px; }
.drawer-tabs { display: flex; gap: 7px; padding: 12px 20px; border-bottom: 1px solid var(--line); }
.drawer-tabs button { padding: 8px 10px; border-radius: 7px; color: var(--ink-soft); font-size: 11px; font-weight: 750; }
.drawer-tabs button.active { color: var(--ink); background: var(--green-soft); }
.drawer-body { height: calc(100vh - 82px); overflow-y: auto; padding: 22px; }
.drawer-tabs + .drawer-body { height: calc(100vh - 135px); }
.history-row { display: grid; grid-template-columns: auto 1fr; align-items: start; gap: 12px; padding: 15px 0; border-bottom: 1px solid var(--line); }
.history-row-button { width: 100%; border: 0; text-align: left; background: transparent; cursor: pointer; }
.history-row-button:hover { color: var(--green); }
.history-row > div { display: flex; min-width: 0; flex-direction: column; gap: 5px; }
.history-row strong { font-family: var(--serif); font-size: 15px; font-weight: 400; line-height: 1.35; }
.history-row small { color: var(--ink-faint); font-size: 10px; }
.history-transcript-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-bottom: 13px; border-bottom: 1px solid var(--line); }
.history-transcript-heading strong { font-family: var(--serif); font-size: 17px; }
.history-transcript { display: flex; flex-direction: column; gap: 10px; padding-top: 15px; }
.mastery-dot { width: 8px; height: 8px; margin-top: 5px; border-radius: 50%; background: var(--success); }
.mastery-dot.weak { background: var(--warning); }
.concept-row { padding: 16px 0; border-bottom: 1px solid var(--line); }
.concept-row small { color: var(--green); font-size: 9px; font-weight: 850; text-transform: uppercase; }
.concept-row strong { display: block; margin-top: 5px; font-family: var(--serif); font-size: 17px; }
.concept-row p { margin: 7px 0 0; color: var(--ink-soft); font-size: 12px; line-height: 1.55; }
.profile-summary { display: grid; grid-template-columns: 54px 1fr; align-items: center; gap: 14px; padding: 8px 0 24px; border-bottom: 1px solid var(--line); }
.profile-summary > span { width: 54px; height: 54px; font-size: 21px; }
.profile-summary strong { font-family: var(--serif); font-size: 20px; }
.profile-summary p { margin: 5px 0 0; color: var(--ink-soft); font-size: 11px; }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 18px 0; border-bottom: 1px solid var(--line); }
.setting-row > div { display: flex; flex-direction: column; gap: 5px; }
.setting-row strong { font-size: 13px; }
.setting-row small { color: var(--ink-faint); font-size: 10px; }
.setting-row > span { max-width: 160px; color: var(--green); font-size: 11px; font-weight: 750; text-align: right; }
.teaching-mode-setting { align-items: flex-start; flex-direction: column; }
.teaching-mode-toggle { display: grid !important; width: 100%; grid-template-columns: 1fr 1fr; gap: 6px !important; padding: 4px; border-radius: 10px; background: var(--paper-deep); }
.teaching-mode-toggle button { min-height: 38px; padding: 8px 10px; border-radius: 7px; color: var(--ink-soft); font-size: 10px; font-weight: 800; }
.teaching-mode-toggle button.active { color: #fff; background: var(--green); box-shadow: 0 5px 14px rgba(23,79,59,.18); }
.help-body label { display: block; margin: 20px 0 8px; font-size: 11px; font-weight: 750; }
.help-body textarea { width: 100%; resize: vertical; padding: 13px; border: 1px solid var(--line); border-radius: 9px; color: var(--ink); background: #fff; line-height: 1.5; }
.help-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; }
.transcript-list { display: flex; max-height: 48vh; flex-direction: column; gap: 10px; overflow-y: auto; }
.transcript-row { padding: 11px 13px; border-radius: 10px; background: var(--paper-deep); }
.transcript-row.user { margin-left: 40px; background: var(--green-soft); }
.transcript-row small { color: var(--ink-faint); font-size: 8px; font-weight: 850; text-transform: uppercase; }
.transcript-row p { margin: 5px 0 0; font-family: var(--serif); font-size: 14px; line-height: 1.45; }
.review-score { display: flex; align-items: baseline; gap: 9px; padding: 10px 0 22px; border-bottom: 1px solid var(--line); }
.review-score strong { font-family: var(--serif); font-size: 50px; }
.review-score span, .review-source { color: var(--ink-soft); font-size: 11px; }
.drawer-body section h3 { margin: 25px 0 10px; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }
.criteria-row { padding: 12px 0; border-bottom: 1px solid var(--line); }
.criteria-row > div { display: flex; justify-content: space-between; gap: 15px; }
.criteria-row p { margin: 6px 0 0; color: var(--ink-soft); font-size: 11px; line-height: 1.5; }
.page-grade-summary { display: grid; grid-template-columns: auto 1fr auto 1fr; align-items: baseline; gap: 7px; padding: 14px 0 24px; border-bottom: 1px solid var(--line); }
.page-grade-summary strong { font-family: var(--serif); font-size: 33px; }
.page-grade-summary span { color: var(--ink-soft); font-size: 10px; }
.page-grade-list article { display: grid; grid-template-columns: 34px 1fr; gap: 12px; padding: 15px 0; border-bottom: 1px solid var(--line); }
.page-grade-list article > span { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; color: #fff; background: var(--warning); font-family: var(--serif); }
.page-grade-list strong { font-size: 13px; }
.page-grade-list p, .clean-result { color: var(--ink-soft); font-size: 11px; line-height: 1.55; }

.session-menu { max-height: calc(100dvh - 88px); overflow-y: auto; position: fixed; z-index: 60; width: 220px; padding: 6px; border: 1px solid var(--line); border-radius: 11px; background: var(--paper-bright); box-shadow: var(--shadow-menu); }
.session-menu button { display: flex; align-items: center; gap: 9px; width: 100%; padding: 11px 10px; border-radius: 7px; font-size: 11px; font-weight: 700; text-align: left; }
.session-menu button:hover { background: var(--paper-deep); }
.session-menu svg { width: 15px; }
.session-menu-label { display: block; margin: 5px 4px 2px; padding: 8px 6px 4px; border-top: 1px solid var(--line); color: var(--ink-faint); font-size: 8px; font-weight: 850; letter-spacing: .12em; text-transform: uppercase; }
.session-menu button.active { color: var(--green); background: var(--green-soft); }

.auth-gate { position: fixed; z-index: 300; inset: 0; display: grid; place-items: center; overflow-y: auto; padding: 24px; background: rgba(20,30,24,.84); backdrop-filter: blur(14px); }
.auth-card { max-height: calc(100dvh - 48px); overflow-y: auto; width: min(430px, 100%); padding: 34px; border: 1px solid rgba(255,255,255,.35); border-radius: 18px; background: var(--paper-bright); box-shadow: 0 30px 90px rgba(0,0,0,.28); }
.auth-card > img { display: block; margin-bottom: 18px; border-radius: 14px; }
.auth-card h1 { margin: 0 0 20px; font-family: var(--serif); font-size: 32px; }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; margin-bottom: 20px; padding: 4px; border-radius: 10px; background: var(--paper-deep); }
.auth-tabs button { min-height: 38px; border-radius: 7px; color: var(--ink-soft); font-size: 11px; font-weight: 800; }
.auth-tabs button.active { color: #fff; background: var(--green); }
.auth-providers { display: grid; gap: 10px; margin-bottom: 14px; }
.google-signin, #google-signin-button { min-height: 44px; }
#google-signin-button { display: flex; justify-content: center; overflow: hidden; }
.auth-providers > .button { width: 100%; }
.auth-divider { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; color: var(--ink-faint); font-size: 9px; font-weight: 750; text-transform: uppercase; }
.auth-divider::before, .auth-divider::after { height: 1px; background: var(--line); content: ''; }
.auth-card form { display: grid; gap: 8px; }
.auth-card .auth-field { display: grid; gap: 8px; }
.auth-card label { margin-top: 5px; color: var(--ink-soft); font-size: 10px; font-weight: 750; }
.auth-card input { width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); background: #fff; }
.auth-card form .button { margin-top: 10px; }
.auth-link { justify-self: center; margin-top: 4px; padding: 7px; color: var(--green); font-size: 11px; font-weight: 750; }
.auth-link:hover { text-decoration: underline; }
.auth-error { margin: 14px 0 0; color: var(--danger); font-size: 11px; line-height: 1.5; }
.recovery-key-panel { display: grid; gap: 12px; }
.recovery-key-panel h2 { margin: 0; font-family: var(--serif); font-size: 27px; }
.recovery-key-panel p:not(.eyebrow) { margin: 0; color: var(--ink-soft); font-size: 12px; line-height: 1.6; }
.recovery-key-panel code { display: block; overflow-wrap: anywhere; padding: 14px; border: 1px solid var(--line); border-radius: 9px; background: var(--paper-deep); color: var(--ink); font-size: 13px; font-weight: 800; line-height: 1.5; user-select: all; }
.account-actions { display: grid; gap: 10px; padding-top: 4px; }
.account-actions h3 { margin-bottom: 0 !important; }
.account-actions > .button { width: 100%; }
.account-password-form { display: grid; gap: 7px; padding: 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); }
.account-password-form label { color: var(--ink-soft); font-size: 10px; font-weight: 750; }
.account-password-form input { width: 100%; min-height: 42px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.form-message { margin: 2px 0 0; color: var(--danger); font-size: 10px; line-height: 1.45; }
.auth-success-message { color: var(--success); }
.google-link-setting { display: grid; gap: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--paper-deep); }
.google-link-setting > div:first-child { display: grid; gap: 4px; }
.google-link-setting strong { font-size: 12px; }
.google-link-setting small { color: var(--ink-faint); font-size: 10px; line-height: 1.4; }
#google-link-button { min-height: 40px; overflow: hidden; }
.setting-actions { display: flex !important; align-items: flex-end; gap: 8px !important; }
.setting-actions > span { color: var(--green); font-size: 11px; font-weight: 750; }
.setting-actions .button { min-height: 34px; padding: 7px 10px; }
.account-verification { align-items: flex-start; }
.account-signout { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, transparent); background: transparent; }
.onboarding-copy { margin: -8px 0 18px; color: var(--ink-soft); font-size: 12px; line-height: 1.6; }
.exam-tray { position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 10px 16px; border-top: 1px solid var(--line); background: var(--paper-bright); }
.exam-tray > div { display: flex; flex: 1; flex-direction: column; gap: 3px; }
.exam-tray strong { font-family: var(--serif); font-size: 14px; }
.exam-tray small { color: var(--ink-faint); font-size: 9px; }

.lightbox { position: fixed; z-index: 100; inset: 0; display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 16px; padding: 56px; background: rgba(10,15,12,.88); backdrop-filter: blur(10px); }
.lightbox img { display: block; width: auto; height: auto; max-width: calc(100vw - 112px); max-height: calc(100vh - 170px); object-fit: contain; border-radius: 6px; box-shadow: 0 24px 70px rgba(0,0,0,.42); }
.lightbox-close { position: fixed; top: 20px; right: 20px; color: #fff; background: rgba(255,255,255,.1); }
.lightbox-copy { max-width: 800px; color: #fff; text-align: center; }
.lightbox-copy small { color: #a6d6b6; font-size: 10px; font-weight: 850; text-transform: uppercase; }
.lightbox-copy p { margin: 8px 0 0; font-family: var(--serif); font-size: 17px; line-height: 1.45; }
.toast { position: fixed; z-index: 150; right: 20px; bottom: 20px; max-width: min(420px, calc(100vw - 40px)); padding: 12px 15px; border: 1px solid rgba(255,255,255,.12); border-radius: 9px; color: #fff; background: rgba(16,31,23,.94); box-shadow: var(--shadow-menu); font-size: 12px; line-height: 1.45; }
.connection-banner { position: fixed; z-index: 145; top: 88px; left: 50%; max-width: min(600px, calc(100vw - 30px)); padding: 10px 14px; transform: translateX(-50%); border: 1px solid #dfbf93; border-radius: 9px; color: #70421f; background: #fff4df; box-shadow: var(--shadow-menu); font-size: 11px; font-weight: 650; }
.connection-banner[data-tone="error"] { border-color: #d5aaa3; color: #7d362d; background: #fff0ed; }
.connection-banner[data-tone="neutral"] { border-color: var(--line); color: var(--ink-soft); background: var(--paper-bright); }

@media (max-width: 1080px) {
  .dashboard-header { grid-template-columns: 210px 1fr 210px; padding-inline: 22px; }
  .dashboard-view { width: min(100% - 36px, 1000px); }
  .dashboard-hero { grid-template-columns: 1fr 1fr; }
  .hero-copy { padding: 42px; }
  .dashboard-grid { grid-template-columns: 1fr 1fr; }
  .practice-card { grid-column: 1 / -1; min-height: 210px; }
  .live-workspace { grid-template-columns: minmax(0, var(--primary-pane-size, 60%)) 8px minmax(0, 1fr); }
}

@media (max-width: 780px) {
  .dashboard-header { grid-template-columns: 1fr auto; min-height: 66px; padding: 0 16px; }
  .main-nav { display: none; }
  .profile-copy, .profile-button > svg { display: none; }
  .profile-button { grid-template-columns: 36px; padding: 0; }
  .dashboard-view { width: calc(100% - 24px); padding: 24px 0 50px; }
  .dashboard-hero { display: flex; min-height: 0; flex-direction: column; border-radius: 16px; }
  .hero-copy { padding: 34px 26px; }
  .hero-copy h1 { font-size: 43px; }
  .hero-actions { align-items: stretch; flex-direction: column; }
  .start-button { width: 100%; }
  .hero-camera-card { min-height: 330px; }
  .hero-paper { right: 40px; width: 62%; height: 220px; }
  .tool-grid, .dashboard-grid { grid-template-columns: 1fr; }
  .practice-card { grid-column: auto; }
  .quick-tools { margin-top: 36px; }
  .session-header { grid-template-columns: auto minmax(0, 1fr) auto; padding: 0 12px; }
  .session-brand span { display: none; }
  .session-context { justify-content: flex-start; }
  .session-context > strong { font-size: 13px; }
  .live-pill { display: none; }
  .live-workspace, .live-workspace.board-collapsed { display: block; height: 100%; }
  .panel-resizer { display: none; }
  .session-primary-column { grid-template-rows: minmax(300px, 48vh) minmax(280px, 1fr); height: 100%; overflow-y: auto; overscroll-behavior: contain; }
  .camera-panel { min-height: 300px; }
  .session-transcript-panel { min-height: 320px; }
  .board-panel { position: fixed; z-index: 45; right: 0; bottom: 0; left: 0; display: grid; height: min(72vh, 640px); transform: translateY(0); border-top: 1px solid var(--line); border-radius: 18px 18px 0 0; box-shadow: 0 -18px 45px rgba(18,24,19,.2); }
  .board-panel.collapsed { display: grid; transform: translateY(105%); }
  .board-restore { top: 18px; right: 15px; }
  .detection-status { top: 14px; left: 14px; }
  .session-controls { bottom: 15px; width: calc(100% - 20px); }
  .session-controls.collapsed { width: auto; }
  .session-controls-body { min-width: 0; flex: 1; justify-content: space-between; overflow-x: auto; }
  .control-button { min-width: 50px; }
  .exam-tray { gap: 6px; padding: 8px; }
  .exam-tray .button { padding: 8px; font-size: 10px; }
  .exam-tray > div { flex-basis: 100%; }
  .camera-mode-banner { top: 58px; width: calc(100% - 28px); justify-content: space-between; }
  .lightbox { padding: 48px 16px 24px; }
}

@media (max-width: 480px) {
  .auth-gate { padding: 12px; }
  .auth-card { max-height: calc(100vh - 24px); padding: 24px 20px; border-radius: 14px; }
  .auth-card h1 { font-size: 28px; }
  .hero-copy { padding: 30px 21px; }
  .hero-copy h1 { font-size: 38px; }
  .hero-camera-card { min-height: 290px; }
  .hero-paper { top: 62px; right: 26px; height: 185px; padding: 28px 24px; }
  .hero-camera-label strong { font-size: 18px; }
  .tool-card { grid-template-columns: 44px 1fr 16px; padding: 17px; }
  .dashboard-card { min-height: 0; padding: 19px; }
  .control-button span { display: none; }
  .control-button { min-width: 42px; height: 44px; }
  .session-controls { border-radius: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

.exam-page { margin: 12px 0; padding: 10px; border: 1px solid var(--line); border-radius: 8px; }
.exam-page img { display: block; width: 100%; max-height: 180px; object-fit: contain; background: white; }
.exam-page-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.exam-page-actions button { padding: 8px; border: 1px solid var(--line); border-radius: 6px; }
#phone-policy { color: var(--ink-soft); line-height: 1.5; }
