:root {
  --bg: #f2f3f7;
  --surface: #ffffff;
  --surface-2: #f1f2f6;
  --sidebar: #e9ebf0;
  --text: #14161b;
  --muted: #676d7c;
  --border: #e1e4ea;
  --accent: #2f6fed;
  --accent-soft: rgba(47, 111, 237, 0.12);
  --on-accent: #ffffff;
  --green: #16a34a;
  --orange: #ea8a0c;
  --red: #dc2626;
  --purple: #7c3aed;
  --indigo: #4f46e5;
  --teal: #0d9488;
  --radius: 14px;
  --shadow: 0 1px 1px rgba(16, 24, 40, 0.04), 0 2px 10px rgba(16, 24, 40, 0.05);
  --radius-sm: 10px;
  /* one color per letter grade, everywhere */
  --grade-a: #15803d;
  --grade-b: #2563eb;
  --grade-c: #b45309;
  --grade-d: #ea580c;
  --grade-f: #dc2626;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1013;
    --surface: #18191d;
    --surface-2: #222328;
    --sidebar: #141518;
    --text: #f1f2f4;
    --muted: #979ba6;
    --border: #2a2c32;
    --accent: #5b8dff;
    --accent-soft: rgba(91, 141, 255, 0.16);
    --shadow: none;
    --grade-a: #4ade80;
    --grade-b: #60a5fa;
    --grade-c: #fbbf24;
    --grade-d: #fb923c;
    --grade-f: #f87171;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0f1013;
  --surface: #18191d;
  --surface-2: #222328;
  --sidebar: #141518;
  --text: #f1f2f4;
  --muted: #979ba6;
  --border: #2a2c32;
  --accent: #5b8dff;
  --accent-soft: rgba(91, 141, 255, 0.16);
  --shadow: none;
  --grade-a: #4ade80;
  --grade-b: #60a5fa;
  --grade-c: #fbbf24;
  --grade-d: #fb923c;
  --grade-f: #f87171;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html { scrollbar-gutter: stable; -webkit-text-size-adjust: 100%; }
html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.47 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI Variable Text", "Segoe UI", Roboto, system-ui, sans-serif;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
.tabular { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.hidden { display: none !important; }
.nowrap { white-space: nowrap; }

/* ---------- shell ---------- */

.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; min-height: 100dvh; }

.sidebar {
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  padding: 18px 12px;
  position: sticky; top: 0; height: 100vh; height: 100dvh;
  display: flex; flex-direction: column; gap: 4px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; font-weight: 700; font-size: 18px; letter-spacing: -.01em; }
.brand img { width: 30px; height: 30px; border-radius: 8px; }
.nav-label { font-size: 12px; font-weight: 600; color: var(--muted); padding: 6px 10px 4px; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 8px;
  color: var(--text); text-decoration: none; font-weight: 500;
}
.nav a .icon .ic { color: var(--accent); }
.nav a.active .icon .ic { color: inherit; }
.nav a:hover { background: color-mix(in srgb, var(--text) 6%, transparent); }
.nav a.active { background: var(--accent); color: var(--on-accent); box-shadow: 0 1px 2px color-mix(in srgb, var(--accent) 40%, transparent); }
.nav a .icon { width: 20px; display: grid; place-items: center; font-size: 18px; }
.nav a .badge { margin-left: auto; font-size: 12px; background: var(--red); color: #fff; border-radius: 10px; padding: 0 7px; }
.sidebar-foot { margin-top: auto; padding: 10px; font-size: 12px; color: var(--muted); border-top: 1px solid var(--border); }
.sidebar-foot strong { color: var(--text); display: block; font-size: 12px; }

.main { min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 12px;
  padding: 14px 28px; padding-top: max(14px, env(safe-area-inset-top));
  /* Solid, not frosted: a blurred bar has to be redrawn on every scroll frame,
     which is what made scrolling stutter on slower laptops and Chromebooks. */
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.topbar h1 { font-size: 21px; letter-spacing: -.015em; margin: 0; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.view { padding: 24px 28px 48px; max-width: 1800px; }

.tabbar { display: none; }

@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .topbar { padding-left: 16px; padding-right: 16px; }
  .view { padding: 16px 16px calc(96px + env(safe-area-inset-bottom)); }
  .tabbar {
    display: grid; grid-template-columns: repeat(5, 1fr);
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 10;
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .tabbar a {
    display: flex; flex-direction: column; align-items: center; gap: 1px;
    padding: 8px 0 6px; font-size: 11px; color: var(--muted); text-decoration: none;
  }
  .tabbar a .icon { font-size: 22px; line-height: 1; height: 24px; display: grid; place-items: center; }
  .tabbar a.active { color: var(--accent); font-weight: 600; }
}

/* ---------- building blocks ---------- */

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px;
}
.card + .card, .stack > * + * { margin-top: 16px; }
.card h2 { font-size: 15px; font-weight: 650; letter-spacing: -.005em; margin: 0 0 12px; display: flex; align-items: center; gap: 8px; }
.card h2 > .ic:first-child { color: var(--muted); font-size: 17px; }
.card h2 .spacer { flex: 1; }

.grid { display: grid; gap: 14px; }
.tiles { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.two-col { grid-template-columns: 1fr 1fr; }
.two-col > .card { margin-top: 0; }
@media (max-width: 900px) { .two-col { grid-template-columns: 1fr; } }

.tile { display: flex; align-items: center; gap: 12px; padding: 14px 16px; }
.tile .glyph {
  width: 42px; height: 42px; border-radius: 11px; display: grid; place-items: center; font-size: 21px; flex: none;
}
.tile .label { font-size: 12.5px; font-weight: 550; color: var(--muted); }
.tile .value { font-size: 26px; font-weight: 700; letter-spacing: -.02em; line-height: 1.15; font-variant-numeric: tabular-nums; }
.tile .value.small { font-size: 15px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--border); background: var(--surface); border-radius: 10px;
  padding: 8px 14px; cursor: pointer; font-weight: 550; text-decoration: none; color: var(--text);
}
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { filter: brightness(1.05); }
.btn.danger { color: var(--red); }
.btn.small { padding: 5px 10px; font-size: 13px; }
.btn.icon-only { padding: 7px 9px; font-size: 17px; line-height: 1; }
.btn .ic { font-size: 1.1em; }
.btn:disabled { opacity: .5; cursor: default; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row .grow { flex: 1; }

input[type=text], input[type=password], input[type=search], input[type=email], input[type=date], select, textarea {
  width: 100%; border: 1px solid var(--border); background: var(--surface); border-radius: 10px;
  padding: 10px 12px; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
label.check { display: flex; gap: 8px; align-items: flex-start; cursor: pointer; }
label.check input { margin-top: 3px; }
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field > span { font-size: 13px; font-weight: 600; }

.pill { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 20px; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.pill.green { background: color-mix(in srgb, var(--green) 14%, transparent); color: var(--green); }
.pill.orange { background: color-mix(in srgb, var(--orange) 16%, transparent); color: var(--orange); }
.pill.red { background: color-mix(in srgb, var(--red) 14%, transparent); color: var(--red); }
.pill.indigo { background: color-mix(in srgb, var(--indigo) 14%, transparent); color: var(--indigo); }

.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--border); background: var(--surface); border-radius: 20px; padding: 5px 12px; cursor: pointer; font-size: 13px; font-weight: 550; }
.chip.active { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }

.list > * { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-top: 1px solid var(--border); }
.list > *:first-child { border-top: 0; padding-top: 2px; }
.list .main-text { flex: 1; min-width: 0; }
.list .title { font-weight: 560; overflow-wrap: anywhere; }
.list .sub { font-size: 13px; color: var(--muted); }
.list a { color: inherit; text-decoration: none; }
.clickable { cursor: pointer; border-radius: 10px; }
.clickable:hover { background: var(--surface-2); }

.course-icon { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; font-size: 19px; flex: none; }
.letter { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; font-weight: 750; font-size: 16px; flex: none; }
.bar { height: 6px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 4px; }

.empty { text-align: center; color: var(--muted); padding: 28px 10px; }
.error-box { background: color-mix(in srgb, var(--red) 10%, transparent); color: var(--red); border-radius: 10px; padding: 10px 12px; font-size: 14px; }
.note-box { background: var(--surface-2); border-radius: 10px; padding: 10px 12px; font-size: 13px; color: var(--muted); }

/* ---------- today ---------- */

.day-head { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; margin: 10px 0 18px; }
.day-head .letter-day { font-size: 40px; font-weight: 800; color: var(--accent); letter-spacing: -.03em; line-height: 1; }
.day-head .date { font-size: 20px; font-weight: 600; color: var(--muted); }
.day-head .clock { margin-left: auto; font-size: 18px; color: var(--muted); font-variant-numeric: tabular-nums; }
.now { display: flex; gap: 16px; align-items: center; }
.now .glyph { width: 60px; height: 60px; border-radius: 16px; display: grid; place-items: center; font-size: 30px; flex: none; }
.now .kicker { font-size: 13px; font-weight: 650; }
.now .big { font-size: 28px; font-weight: 750; letter-spacing: -.02em; line-height: 1.15; }
.now .count { margin-left: auto; text-align: right; }
.now .count .num { font-size: 38px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.05; }
@media (max-width: 560px) {
  .now { flex-wrap: wrap; }
  .now .count { margin-left: 0; text-align: left; width: 100%; }
  .day-head .letter-day { font-size: 30px; }
  .day-head .date { font-size: 17px; }
}
.block-row { display: flex; gap: 14px; align-items: center; padding: 10px 6px; border-top: 1px solid var(--border); }
.block-row:first-child { border-top: 0; }
.block-row .when { width: 132px; flex: none; }
.block-row .when b { display: block; }
.block-row.current { background: var(--accent-soft); border-radius: 10px; border-top-color: transparent; }
.block-row.current + .block-row { border-top-color: transparent; }
.block-row.past { opacity: .55; }
.block-row.lunch { background: color-mix(in srgb, var(--green) 10%, transparent); border-radius: 10px; color: var(--green); font-weight: 600; border-top-color: transparent; }
.block-row.lunch + .block-row { border-top-color: transparent; }
@media (max-width: 560px) { .block-row .when { width: 98px; font-size: 13px; } }

/* ---------- privacy cover ---------- */

.covered { position: relative; }
.covered > .content { filter: blur(18px); pointer-events: none; user-select: none; }
.covered > .cover { position: absolute; inset: 0; display: grid; place-items: start center; padding-top: 80px; }
.cover .card { text-align: center; }

/* ---------- chat ---------- */

.ask { display: grid; grid-template-columns: 250px 1fr; gap: 16px; align-items: start; }
.ask.solo { grid-template-columns: 1fr; max-width: 860px; }
@media (max-width: 900px) { .ask { grid-template-columns: 1fr; } .chat-list { max-height: 210px; overflow: auto; } }
.chat-list { background: var(--sidebar); }
.chat-list .item { padding: 8px 10px; border-radius: 9px; cursor: pointer; }
.chat-list .item:hover { background: var(--surface-2); }
.chat-list .item.active { background: var(--accent-soft); }
.chat-list .item .t { font-weight: 560; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat { display: flex; flex-direction: column; min-height: 60vh; }
.messages { flex: 1; display: flex; flex-direction: column; gap: 10px; padding: 4px 0 12px; }
.bubble { max-width: 85%; padding: 10px 14px; border-radius: 16px; overflow-wrap: anywhere; }
.bubble.user { align-self: flex-end; background: var(--accent); color: var(--on-accent); border-bottom-right-radius: 5px; }
.bubble.model { align-self: flex-start; background: var(--surface-2); border-bottom-left-radius: 5px; }
.bubble p { margin: 0 0 8px; } .bubble p:last-child { margin: 0; }
.bubble ul, .bubble ol { margin: 4px 0 8px; padding-left: 20px; }
.bubble img { max-width: 160px; border-radius: 8px; display: block; margin-bottom: 6px; }
.composer { display: flex; gap: 8px; align-items: flex-end; border-top: 1px solid var(--border); padding-top: 12px; }
.composer textarea { resize: none; min-height: 44px; max-height: 160px; }
.thumbs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.thumbs img { width: 54px; height: 54px; object-fit: cover; border-radius: 8px; }
.status-line { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.dots::after { content: "…"; animation: dots 1.2s steps(3) infinite; }
@keyframes dots { 0% { content: "."; } 33% { content: ".."; } 66% { content: "..."; } }

/* ---------- sign in ---------- */

.signin { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.signin .card { width: 100%; max-width: 420px; padding: 28px; }
.signin .logo { width: 72px; height: 72px; border-radius: 18px; display: block; margin: 0 auto 12px; }
.signin h1 { text-align: center; margin: 0 0 4px; }

dialog { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text); padding: 22px; max-width: min(420px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(0, 0, 0, .35); }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(24px + env(safe-area-inset-bottom));
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 12px; z-index: 50; font-size: 14px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, .2); max-width: calc(100vw - 32px);
}
@media (max-width: 760px) { .toast { bottom: calc(84px + env(safe-area-inset-bottom)); } }

.spin { display: inline-block; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spin, .dots::after { animation: none; } }

/* sample data */
.signin .or { display: flex; align-items: center; gap: 12px; margin: 16px 0; color: var(--muted); font-size: 13px; }
.signin .or::before, .signin .or::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.demo-button { width: 100%; justify-content: center; font-weight: 600; }
.signin input.typing { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); caret-color: var(--accent); }
.signin form.demo-typing input { cursor: default; }
.btn.pressed { transform: scale(.96); filter: brightness(.92); }
.btn { transition: transform .12s ease, filter .12s ease, background .15s; }
.demo-banner { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 12px 16px 0; padding: 10px 14px; border-radius: 12px; background: color-mix(in srgb, var(--accent) 12%, transparent); border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); font-size: 14px; }

/* customizable sections */
.modules { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; align-items: start; }
.mod { min-width: 0; grid-column: 1 / -1; }
.mod.size-half { grid-column: span 2; }
.mod.size-tile { grid-column: span 1; }
.mod > .card, .mod-body > .card, .mod > div > .card { margin-top: 0 !important; }
.mod > .card.tile, .mod-body > .card.tile { height: 100%; }
@media (max-width: 900px) { .modules { grid-template-columns: repeat(2, minmax(0, 1fr)); } .mod.size-half { grid-column: 1 / -1; } }
.mod.editing { outline: 2px dashed color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 4px; border-radius: 14px; }
.mod.is-hidden .mod-body { opacity: .45; }
.mod-tools { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; font-size: 13px; font-weight: 600; color: var(--accent); }
.mod-tools .grow { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mod-placeholder { color: var(--muted); font-size: 14px; text-align: center; padding: 18px; }
.edit-banner { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 12px 16px 0; padding: 10px 14px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); font-size: 14px; }

/* grade simulator */
.sim-result { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.sim-result > div { display: grid; gap: 4px; justify-items: start; }
.sim-num { font-size: 32px; font-weight: 700; line-height: 1.1; }
.sim-arrow { font-size: 26px; color: var(--muted); }
.sim-gpa { margin-left: auto; gap: 6px !important; }
.sim-score { display: flex; align-items: center; gap: 6px; flex: none; }
.sim-score input { width: 72px; text-align: right; }
.sim-changed { background: color-mix(in srgb, var(--accent) 7%, transparent); border-radius: 10px; }
.sim-add { align-items: center; }
@media (max-width: 600px) { .sim-gpa { margin-left: 0; } }
.list > .sim-changed { padding-left: 8px; padding-right: 8px; }
.mod.size-tile .mod-tools { flex-wrap: wrap; } .mod.size-tile .mod-tools .grow { flex-basis: 100%; }

/* status boxes */
.warn-box { background: color-mix(in srgb, var(--orange) 12%, transparent); color: var(--text); border: 1px solid color-mix(in srgb, var(--orange) 40%, transparent); border-radius: 10px; padding: 10px 12px; font-size: 14px; }
.warn-banner { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 12px 16px 0; padding: 10px 14px; border-radius: 12px; background: color-mix(in srgb, var(--orange) 12%, transparent); border: 1px solid color-mix(in srgb, var(--orange) 40%, transparent); font-size: 14px; }
dialog.whats-new { max-width: min(520px, calc(100vw - 32px)); }

/* motion: quick and quiet */
@keyframes view-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes pop-in { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.view-enter { animation: view-in .26s cubic-bezier(.2, .8, .2, 1) both; }
.signin .card { animation: pop-in .35s cubic-bezier(.2, .7, .2, 1) both; }
dialog[open] { animation: pop-in .22s cubic-bezier(.2, .7, .2, 1) both; }
dialog[open]::backdrop { animation: fade-in .2s ease both; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 10px); } to { opacity: 1; transform: translate(-50%, 0); } }
.toast { animation: toast-in .22s cubic-bezier(.2, .7, .2, 1) both; }
.btn:active:not(:disabled) { transform: scale(.97); }
.clickable, .chat-list .item, .chip, .nav a, .tabbar a { transition: background .15s ease, color .15s ease, transform .12s ease; }
.clickable:active, .chat-list .item:active { transform: scale(.995); }
.bar i { transition: width .5s cubic-bezier(.2, .7, .2, 1); }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
.hint-banner { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 12px 16px 0; padding: 10px 14px; border-radius: 12px; background: color-mix(in srgb, var(--accent) 10%, transparent); border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent); font-size: 14px; }

/* colors */
.swatches { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 10px; }
.swatch { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--border); cursor: pointer; padding: 0; transition: transform .12s ease; }
.swatch:hover { transform: scale(1.08); }
.swatch.on { outline: 2px solid var(--accent); outline-offset: 2px; }
.presets { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; margin: 6px 0 14px; }
.preset { border: 1px solid var(--border); border-radius: 12px; padding: 0; overflow: hidden; cursor: pointer; text-align: left; background: none; color: var(--text); transition: transform .12s ease, border-color .15s; }
.preset:hover { transform: translateY(-2px); }
.preset.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.preset .look { height: 46px; display: flex; align-items: flex-end; gap: 5px; padding: 8px; }
.preset .look i { display: block; height: 8px; border-radius: 4px; }
.preset .name { display: block; font-size: 12px; font-weight: 600; padding: 6px 8px; }
.hexrow { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.hexrow input[type="text"] { width: 120px; font-family: ui-monospace, Menlo, monospace; text-transform: uppercase; }
.hexrow input[type="color"] { width: 40px; height: 36px; padding: 2px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); cursor: pointer; }

/* trend charts */
svg.trend { width: 100%; height: 150px; display: block; overflow: visible; }
svg.trend .grid { stroke: var(--border); stroke-width: 1; vector-effect: non-scaling-stroke; }
svg.trend .axis { fill: var(--muted); font-size: 11px; }
svg.trend .line { fill: none; stroke-width: 2.5; vector-effect: non-scaling-stroke; stroke-linejoin: round; stroke-linecap: round; }
svg.trend .area { opacity: .12; }
svg.trend .goal { stroke: var(--green); stroke-dasharray: 5 5; stroke-width: 1.5; vector-effect: non-scaling-stroke; }
svg.trend .goal-text { fill: var(--green); }

/* homework */
.hw-form { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr); gap: 0 12px; }
@media (max-width: 640px) { .hw-form { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .hw-form .field:first-child { grid-column: 1 / -1; } }
.table-wrap { overflow-x: auto; }
.hw-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.hw-table th { text-align: left; font-size: 12.5px; color: var(--muted); font-weight: 600; padding: 0 10px 8px; border-bottom: 1px solid var(--border); }
.hw-table td { padding: 12px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
.hw-table tr:last-child td { border-bottom: 0; }
.hw-table td:first-child, .hw-table th:first-child { padding-left: 2px; width: 28px; }
.hw-table input[type="checkbox"] { width: 18px; height: 18px; margin-top: 2px; }
.hw-course { display: inline-flex; align-items: center; gap: 7px; font-weight: 600; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: none; }
.hw-bullets { margin: 0; padding-left: 18px; }
.hw-bullets li + li { margin-top: 3px; }
.hw-done td { opacity: .5; }
.hw-done .hw-bullets { text-decoration: line-through; }
@media (max-width: 640px) {
  .hw-table thead { display: none; }
  .hw-table tr { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; border-bottom: 1px solid var(--border); padding: 10px 0; }
  .hw-table td { border: 0; padding: 2px 6px; }
  .hw-table td:nth-child(3) { grid-column: 2 / -1; }
  .hw-table td:nth-child(4) { grid-column: 2; }
  .hw-table td:nth-child(5) { grid-column: 3; grid-row: 1; }
}

/* calendar */
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal-head { font-size: 12px; font-weight: 600; color: var(--muted); text-align: center; padding-bottom: 4px; }
.cal-day { min-height: 92px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text); padding: 6px; text-align: left; display: flex; flex-direction: column; gap: 3px; cursor: pointer; min-width: 0; font: inherit; transition: border-color .15s, background .15s; }
.cal-day:hover { border-color: var(--accent); }
.cal-day.other { opacity: .45; }
.cal-day.today .n { background: var(--accent); color: var(--on-accent); border-radius: 50%; width: 24px; height: 24px; display: inline-grid; place-items: center; }
.cal-day.picked { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.cal-day .n { font-size: 13px; font-weight: 600; }
.cal-item { display: flex; align-items: center; gap: 4px; font-size: 11px; min-width: 0; }
.cal-item .dot { width: 6px; height: 6px; background: var(--c); }
.cal-item .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-item.big .t { font-weight: 700; }
.cal-day .more { font-size: 11px; color: var(--muted); }
.cal-day .cal-dots { display: none; gap: 3px; flex-wrap: wrap; }
.cal-day .cal-dots i { width: 6px; height: 6px; border-radius: 50%; display: block; }
@media (max-width: 700px) {
  .cal-day { min-height: 54px; padding: 4px; align-items: center; }
  .cal-item, .cal-day .more { display: none; }
  .cal-day .cal-dots { display: flex; justify-content: center; }
}

/* quick search and more sheet */
dialog.qs { width: min(560px, calc(100vw - 32px)); max-width: none; padding: 14px; position: fixed; top: 12vh; margin: 0 auto; }
dialog.qs #qs-input { width: 100%; font-size: 16px; padding: 12px 14px; }
.qs-results { max-height: 52vh; overflow-y: auto; margin-top: 10px; display: grid; gap: 2px; }
.qs-item { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px; text-decoration: none; color: var(--text); }
.qs-item .main-text { display: grid; min-width: 0; }
.qs-item .title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qs-item .sub { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qs-item.on, .qs-item:hover { background: var(--accent-soft); }
.qs-icon { width: 26px; text-align: center; font-size: 18px; flex: none; }
dialog.more { width: min(520px, calc(100vw - 24px)); max-width: none; position: fixed; bottom: calc(12px + env(safe-area-inset-bottom)); top: auto; margin: 0 auto; }
.more-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.more-item { display: grid; justify-items: center; gap: 4px; padding: 12px 6px; border-radius: 12px; background: var(--surface-2); color: var(--text); text-decoration: none; font-size: 13px; font-weight: 600; text-align: center; }
.more-item .icon { font-size: 22px; }

/* report for parents */
.report { max-width: 820px; margin: 0 auto; padding: 32px 20px 60px; background: var(--surface); color: var(--text); min-height: 100vh; }
.report header { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; border-bottom: 2px solid var(--text); padding-bottom: 12px; }
.report h1 { margin: 0; font-size: 26px; }
.report header p { margin: 4px 0 0; }
.report h2 { font-size: 16px; margin: 26px 0 8px; }
.report-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-top: 18px; }
.report-tiles div { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; display: grid; }
.report-tiles span { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.report-tiles b { font-size: 22px; font-variant-numeric: tabular-nums; }
.report table { width: 100%; border-collapse: collapse; font-size: 14px; }
.report th { text-align: left; font-size: 11px; text-transform: uppercase; color: var(--muted); border-bottom: 1px solid var(--border); padding: 6px 8px; }
.report td { padding: 7px 8px; border-bottom: 1px solid var(--border); font-variant-numeric: tabular-nums; }
@media (max-width: 600px) { .report-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media print {
  .no-print, .toast { display: none !important; }
  html, body { background: #fff !important; color: #000 !important; }
  .report { padding: 0; max-width: none; background: #fff; color: #000; }
  .report * { color: #000 !important; border-color: #bbb !important; }
}

/* polish */
.settings-grid { columns: 2 440px; column-gap: 16px; max-width: 1200px; }
.settings-grid > .card { break-inside: avoid; margin: 0 0 16px !important; display: block; }
.settings-grid > p { column-span: all; }
.recap-figs { margin-bottom: 12px; }
.block-row.lunch.past { opacity: .55; background: transparent; }
.coming-day { width: 100px; flex: none; }
.coming-day b { display: block; white-space: nowrap; }
dialog.whats-new form { display: flex; flex-direction: column; max-height: min(640px, calc(100vh - 80px)); }
dialog.whats-new .list { overflow-y: auto; margin: 0 -4px; padding: 0 4px; }
input[type=date] { min-height: 40px; }
@media (max-width: 760px) {
  .demo-banner, .warn-banner, .hint-banner, .edit-banner { margin: 8px 12px 0; padding: 8px 10px; font-size: 13px; gap: 8px; border-radius: 10px; }
  .demo-banner .btn, .warn-banner .btn, .hint-banner .btn, .edit-banner .btn { padding: 5px 10px; font-size: 12px; }
  .demo-banner { flex-wrap: nowrap; }
  .demo-banner span { line-height: 1.3; }
}
.tiles.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 480px) { .tiles.three .tile { padding: 10px 12px; } .tiles.three .label { font-size: 10px; } }
select[data-override="level"] { width: 195px !important; flex: none; }
select[data-override="credits"] { width: 135px !important; flex: none; }
@media (max-width: 480px) { select[data-override="level"], select[data-override="credits"] { width: 100% !important; flex: 1 1 120px; } }

/* ---------- icons and finish ---------- */

.ic { width: 1em; height: 1em; flex: none; display: inline-block; vertical-align: -0.14em; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.glyph .ic, .course-icon .ic, .qs-icon .ic, .news-icon .ic { vertical-align: 0; }
.news-icon { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-size: 18px; flex: none; color: var(--accent); background: var(--accent-soft); }
.qs-icon { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: var(--surface-2); color: var(--accent); font-size: 16px; flex: none; }
.more-item .icon { font-size: 22px; color: var(--accent); }
.letter { font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
h1, h2, h3 { letter-spacing: -.01em; }
.greeting { font-size: 30px; font-weight: 750; letter-spacing: -.025em; line-height: 1.15; margin: 4px 0 4px; }

/* Keyboard focus that's easy to see, never on mouse clicks. */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn:focus:not(:focus-visible), a:focus:not(:focus-visible) { outline: none; }

/* Smooth scrolling: let the browser skip work for the page underneath a
   dialog, and keep scroll from chaining into the page behind it. */
dialog { overscroll-behavior: contain; }
.chat-list, .messages, .table-wrap { overscroll-behavior: contain; }

/* course page: summary on top, one panel at a time below */
.back-link { display: inline-block; margin-bottom: 10px; text-decoration: none; }
.course-meta { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }
.course-meta .stat { font-size: 14px; color: var(--muted); }
.course-meta .stat b { font-size: 17px; font-variant-numeric: tabular-nums; margin-right: 3px; }
.course-meta select { padding: 6px 10px; }
.seg { display: inline-flex; gap: 2px; padding: 3px; margin: 16px 0 14px; border-radius: 11px; background: var(--surface-2); border: 1px solid var(--border); max-width: 100%; overflow-x: auto; }
.seg button { border: 0; background: none; color: var(--muted); font: inherit; font-weight: 600; font-size: 14px; padding: 7px 14px; border-radius: 8px; cursor: pointer; white-space: nowrap; transition: background .15s ease, color .15s ease; }
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, .08); }
@media (max-width: 560px) { .seg { display: flex; } .seg button { flex: 1; padding: 7px 8px; font-size: 13px; } }

/* ===== diagrams (interactive, shared by Study Guides and Math Lab) ===== */
.dg { margin: 12px 0; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); overflow: hidden; --dg-ink: var(--text); --dg-soft: var(--muted); --dg-a: var(--accent); }
.dg-head { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.dg-title { font-weight: 700; font-size: 13px; }
.dg-grow { flex: 1; }
.dg-stage { padding: 6px; touch-action: pan-y; }
.dg-svg { display: block; width: 100%; height: auto; max-height: 440px; user-select: none; -webkit-user-select: none; }
.dg-svg text { font-family: inherit; fill: var(--dg-ink); }
.dg-line { stroke: var(--dg-ink); stroke-width: 2; fill: none; stroke-linecap: round; }
.dg-circle { stroke: var(--dg-ink); stroke-width: 2.2; fill: none; }
.dg-thin { stroke-width: 1; opacity: .55; }
.dg-dash { stroke-dasharray: 6 5; }
.dg-accent { stroke: var(--dg-a); stroke-width: 2.6; }
.dg-long { stroke-width: 1.4; opacity: .6; }
.dg-par { stroke: var(--dg-a); }
.dg-tick, .dg-tick-mark { stroke-width: 1.6; }
.dg-asym { stroke: var(--red); stroke-width: 1.2; opacity: .7; }
.dg-ang { fill: color-mix(in srgb, var(--orange) 22%, transparent); stroke: var(--orange); stroke-width: 1.8; }
.dg-arc { fill: none; stroke: var(--dg-a); stroke-width: 4; stroke-linecap: round; opacity: .85; }
.dg-fill { fill: color-mix(in srgb, var(--dg-a) 14%, transparent); stroke: var(--dg-a); stroke-width: 1.4; }
.dg-fill2 { fill: color-mix(in srgb, var(--green) 14%, transparent); stroke: var(--green); stroke-dasharray: 5 4; }
.dg-axis { stroke: var(--dg-soft); stroke-width: 1.4; }
.dg-grid { stroke: var(--border); stroke-width: 1; }
.dg-frame { fill: none; stroke: var(--border); }
.dg-curve { fill: none; stroke-width: 2.8; stroke-linejoin: round; stroke-linecap: round; }
.dg-plot { fill: none; }
.dg-trace { fill: var(--surface); stroke: var(--dg-a); stroke-width: 2; }
.dg-tick-t { font-size: 11px; fill: var(--dg-soft) !important; }
.dg-pt { fill: var(--dg-ink); stroke: var(--surface); stroke-width: 2; }
.dg-pt-center { fill: var(--dg-soft); }
.dg-pt-feat { fill: var(--green); }
.dg-handle { fill: transparent; stroke: none; cursor: grab; touch-action: none; }
.dg-handle:hover, .dg-handle:focus, .dg-handle.dragging { fill: color-mix(in srgb, var(--dg-a) 22%, transparent); stroke: var(--dg-a); stroke-width: 2; outline: none; }
.dg-handle.dragging { cursor: grabbing; }
.dg-lbl { font-size: 15px; font-weight: 700; paint-order: stroke; stroke: var(--surface); stroke-width: 4px; stroke-linejoin: round; }
.dg-lbl-small, .dg-lbl-feat { font-size: 12px; font-weight: 600; }
.dg-lbl-ang, .dg-lbl-arc { font-size: 13px; fill: var(--orange) !important; }
.dg-lbl-arc { fill: var(--dg-a) !important; }
.dg-lbl-node { font-size: 13px; font-weight: 600; stroke: none; }
.dg-sin { stroke: var(--red); stroke-width: 3; } .dg-cos { stroke: var(--accent); stroke-width: 3; } .dg-tan { stroke: var(--green); stroke-width: 3; }
.dg-wedge { fill: color-mix(in srgb, var(--dg-soft) 12%, transparent); stroke: none; cursor: pointer; transition: fill .15s; }
.dg-wedge:hover, .dg-wedge:focus { fill: color-mix(in srgb, var(--dg-a) 26%, transparent); outline: none; }
.dg-wedge.picked { fill: color-mix(in srgb, var(--dg-a) 40%, transparent); stroke: var(--dg-a); stroke-width: 2; }
.dg-wedge.pc0 { fill: color-mix(in srgb, var(--accent) 30%, transparent); } .dg-wedge.pc1 { fill: color-mix(in srgb, var(--orange) 34%, transparent); }
.dg-wedge.pc2 { fill: color-mix(in srgb, var(--green) 30%, transparent); } .dg-wedge.pc3 { fill: color-mix(in srgb, var(--purple) 30%, transparent); }
.dg-lbl-wedge { font-size: 12px; pointer-events: none; }
.dg-lbl-val { font-size: 13px; }
.dg-flowedge { stroke: var(--dg-soft); stroke-width: 2; } .dg-arrowhead { fill: var(--dg-soft); }
.dg-node rect { fill: var(--surface-2); stroke: var(--border); stroke-width: 1.5; cursor: pointer; transition: fill .15s, stroke .15s; }
.dg-node:hover rect, .dg-node:focus rect { stroke: var(--dg-a); outline: none; } .dg-node.picked rect { fill: var(--accent-soft); stroke: var(--dg-a); stroke-width: 2.5; }
.dg-node { outline: none; } .dg-step-n { font-size: 10px; font-weight: 700; fill: var(--dg-soft) !important; stroke: none; }
.dg-controls { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; padding: 4px 12px; }
.dg-controls:empty { display: none; }
.dg-slider { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; }
.dg-slider input { width: clamp(110px, 24vw, 200px); accent-color: var(--accent); }
.dg-slider b { min-width: 3ch; font-variant-numeric: tabular-nums; }
.dg-chips { margin: 0; }
.dg-trace-read { min-height: 0; padding: 0 12px; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.dg-trace-read:empty { display: none; }
.dg-read { padding: 6px 12px 10px; font-size: 14px; line-height: 1.5; display: grid; gap: 3px; }
.dg-read:empty { display: none; }
.dg-key { display: inline-block; width: 10px; height: 10px; border-radius: 3px; background: var(--k); margin-right: 6px; }
.dg-cap { padding: 0 12px 10px; font-size: 12.5px; color: var(--muted); }
.dg-html { padding: 8px 10px; }
.dg-tablewrap { overflow-x: auto; }
.dg-table { border-collapse: collapse; width: 100%; font-size: 14px; }
.dg-table th, .dg-table td { border: 1px solid var(--border); padding: 7px 10px; text-align: left; }
.dg-table th { background: var(--surface-2); }
.dg-covered { background: repeating-linear-gradient(45deg, var(--surface-2), var(--surface-2) 6px, var(--border) 6px, var(--border) 12px); color: transparent; cursor: pointer; }
.dg-covered:hover, .dg-covered:focus { outline: 2px solid var(--accent); }
.dg-punnett td { text-align: center; cursor: pointer; font-weight: 600; } .dg-punn.picked { background: var(--accent-soft); }
.dg-timeline { list-style: none; margin: 0; padding: 0 0 0 14px; border-left: 3px solid var(--border); display: grid; gap: 8px; }
.dg-timeline li button { all: unset; cursor: pointer; display: flex; gap: 10px; align-items: baseline; padding: 6px 8px; border-radius: 8px; width: calc(100% - 16px); }
.dg-timeline li button:hover, .dg-timeline li button:focus-visible { background: var(--surface-2); }
.dg-when { font-weight: 700; color: var(--accent); min-width: 5.5em; font-size: 13px; } .dg-what { font-size: 14px; }
.dg-detail { margin: 2px 0 4px 8px; font-size: 13.5px; color: var(--muted); }
.dg-slot:empty { min-height: 0; }

/* ===== study guides ===== */
.study { max-width: 880px; display: grid; gap: 14px; }
.study > * { margin: 0 !important; }
.study-h { font-size: 15px; margin: 6px 0 -4px !important; }
.study-hero { display: flex; gap: 16px; align-items: center; justify-content: space-between; flex-wrap: wrap; background: linear-gradient(135deg, var(--accent-soft), transparent 70%), var(--surface); }
.study-steps4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; }
.study-step-card { position: relative; padding-top: 18px; } .study-step-card h3 { font-size: 14px; margin: 0 0 4px; } .study-step-card p { margin: 0; }
.study-num { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--accent); color: var(--on-accent); font-size: 12px; font-weight: 700; flex: none; }
.study-step-card .study-num { position: absolute; top: -10px; left: 14px; }
.study-guide-card { cursor: pointer; transition: transform .12s, box-shadow .12s; } .study-guide-card:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.study-fair { font-size: 13px; }
.study-head { display: grid; gap: 10px; }
.study-seg { display: grid; grid-template-columns: repeat(4, 1fr); margin: 0; }
.study-seg button { display: flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap; }
.study-seg .study-n { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: var(--surface-2); font-size: 11px; }
.study-seg button.on .study-n { background: var(--accent); color: var(--on-accent); }
@media (max-width: 560px) { .study-seg button { font-size: 12px; padding-inline: 4px; } .study-seg .study-n { display: none; } .study-head { position: static; } }
.concepts { display: grid; gap: 8px; }
.concept { display: flex; gap: 12px; align-items: flex-start; padding: 12px; border: 1.5px solid var(--border); border-radius: 12px; cursor: pointer; transition: border-color .12s, background .12s; }
.concept.on { border-color: var(--accent); background: var(--accent-soft); } .concept input { margin-top: 4px; width: 18px; height: 18px; accent-color: var(--accent); flex: none; }
.concept-statement { margin: 4px 0 0; font-size: 14px; } .concept p.tiny { margin: 2px 0 0; }
.study-list { margin: 6px 0; padding-left: 20px; display: grid; gap: 4px; font-size: 14px; } .study-list.key li::marker { color: var(--accent); }
.study-next { padding-top: 4px; }
.sheet-section h2 { margin-bottom: 8px; } .sheet-explain { margin: 0 0 8px; line-height: 1.55; }
.sheet-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; margin: 10px 0; }
.sheet-box { padding: 10px 12px; border-radius: 10px; font-size: 14px; } .sheet-box p { margin: 4px 0 0; }
.sheet-box.warn { background: color-mix(in srgb, var(--orange) 12%, transparent); } .sheet-box.tip { background: color-mix(in srgb, var(--green) 12%, transparent); }
.sheet-example { margin-top: 10px; padding: 12px; border: 1.5px dashed var(--border); border-radius: 12px; } .sheet-example p { margin: 4px 0 8px; }
.steps { margin: 6px 0; padding-left: 22px; display: grid; gap: 5px; font-size: 14px; line-height: 1.5; } .steps li::marker { font-weight: 700; color: var(--accent); }
.answer-line { color: var(--green); }
.cheat { border: 1.5px solid var(--accent); background: var(--accent-soft); }
.study-empty { text-align: center; padding: 28px 20px; } .study-empty .row { justify-content: center; }
.study-config { display: flex; gap: 18px 28px; flex-wrap: wrap; align-items: flex-end; margin: 8px 0 12px; }
.stepper { display: inline-flex; align-items: center; gap: 12px; } .stepper b { min-width: 2ch; text-align: center; font-size: 20px; }
.study-progress { margin: 10px 0; display: grid; gap: 8px; }
.study-more > summary { cursor: pointer; padding: 2px 0; } .study-more[open] > summary { margin-bottom: 10px; }
.study-more .study-builder { border: 0; padding: 0; box-shadow: none; background: none; } .study-more .study-builder h2 { display: none; }
.study-score { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.study-problems { display: grid; gap: 14px; }
.prob-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; } .pill.topic { max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.prompt { font-size: 16px; line-height: 1.55; margin: 0 0 8px; }
.choices { display: grid; gap: 8px; margin: 10px 0; }
.choice { all: unset; box-sizing: border-box; display: flex; gap: 12px; align-items: center; padding: 11px 14px; border: 1.5px solid var(--border); border-radius: 12px; cursor: pointer; font-size: 15px; line-height: 1.4; transition: border-color .12s, background .12s; }
.choice:hover:not(:disabled), .choice:focus-visible { border-color: var(--accent); background: var(--accent-soft); outline: none; }
.choice .ltr { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--surface-2); font-weight: 700; font-size: 13px; flex: none; }
.choice.picked { border-color: var(--accent); background: var(--accent-soft); }
.choice.right { border-color: var(--green); background: color-mix(in srgb, var(--green) 13%, transparent); } .choice.right .ltr { background: var(--green); color: #fff; }
.choice.wrong { border-color: var(--red); background: color-mix(in srgb, var(--red) 11%, transparent); } .choice.wrong .ltr { background: var(--red); color: #fff; }
.choice.dim { opacity: .55; } .choice:disabled { cursor: default; }
.prob-tools, .stepchips { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.steps-ui { margin-top: 10px; display: grid; gap: 6px; }
.hint-box { padding: 8px 12px; border-radius: 10px; background: color-mix(in srgb, var(--orange) 13%, transparent); font-size: 14px; }
.feedback { margin-top: 10px; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); font-size: 14px; } .feedback p { margin: 4px 0; }
.feedback.ok { background: color-mix(in srgb, var(--green) 11%, transparent); } .feedback.no { background: color-mix(in srgb, var(--red) 8%, transparent); }
.feedback.model { background: var(--surface-2); margin-top: 8px; }
textarea.ans { width: 100%; resize: vertical; min-height: 84px; }
.topic-row { display: flex; align-items: center; gap: 12px; padding: 6px 0; font-size: 14px; }
.study-result .row { gap: 16px; } .study-bigscore { font-size: 44px; font-weight: 800; color: var(--accent); line-height: 1; }
.study-thumb { position: relative; } .study-thumb img { height: 70px; border-radius: 8px; border: 1px solid var(--border); display: block; }
.study-thumb .x { position: absolute; top: -6px; right: -6px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: var(--red); color: #fff; font-size: 11px; cursor: pointer; }
.tabular { font-variant-numeric: tabular-nums; }

/* ===== math lab ===== */
.lab { display: grid; gap: 14px; max-width: 1040px; }
.lab-tabs { display: flex; flex-wrap: wrap; margin: 0; } .lab-tabs button { flex: 1; white-space: nowrap; }
.lab-grid { display: grid; grid-template-columns: 280px 1fr; gap: 14px; align-items: start; } .lab-grid.solo { grid-template-columns: 1fr; }
@media (max-width: 760px) { .lab-grid { grid-template-columns: 1fr; } }
.lab-fn { display: grid; grid-template-columns: 34px 1fr; align-items: center; gap: 6px; margin: 6px 0; } .lab-fn input { font-family: ui-monospace, Menlo, monospace; }
.lab-stage .dg { margin: 0; border: 0; } .lab-stage .dg-head { background: none; }
.lab code { background: var(--surface-2); padding: 1px 5px; border-radius: 5px; font-size: 12px; }

/* ===== printing study material ===== */
#study-print { display: none; }
@media print {
  body.printing-study #app, body.printing-study .toast, body.printing-study dialog { display: none !important; }
  body.printing-study #study-print { display: block; color: #000; background: #fff; font-size: 12.5pt; line-height: 1.45; }
  #study-print * { color: #000 !important; border-color: #999 !important; }
  #study-print h1 { font-size: 20pt; margin: 0 0 2pt; } #study-print h2 { font-size: 14pt; margin: 0 0 4pt; }
  .pr-sub { margin: 0 0 14pt; font-size: 10.5pt; }
  .pr-q { break-inside: avoid; margin: 0 0 14pt; } .pr-ch { margin: 4pt 0; padding-left: 22pt; } .pr-lines { height: 80pt; border-bottom: 1px solid #999; }
  .pr-ans { margin: 4pt 0 0; }
  #study-print .dg { border: 0; max-width: 360px; } #study-print .dg-head, #study-print .dg-controls, #study-print .dg-trace-read { display: none; }
  #study-print .dg-svg text { fill: #000 !important; } #study-print .dg-lbl { stroke: #fff; }
}
.study .back-link, .lab .back-link { all: unset; cursor: pointer; color: var(--accent); font-weight: 600; font-size: 14px; width: fit-content; }
.study .back-link:hover { text-decoration: underline; }
.dg-svg { max-height: 340px; margin: 0 auto; }

/* page tabs (Grades, Planner, Study, Settings) */
.page-tabs { margin: 0 0 18px; }
.seg a { color: var(--muted); font-weight: 600; font-size: 14px; padding: 7px 14px; border-radius: 8px; white-space: nowrap; text-decoration: none; transition: background .15s ease, color .15s ease; }
.seg a:hover { color: var(--text); }
.seg a.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, .08); }
@media (max-width: 560px) { .seg a { flex: 1; text-align: center; padding: 7px 8px; font-size: 13px; } }
a.card.tile:hover { border-color: color-mix(in srgb, var(--accent) 35%, var(--border)); }
@media (max-width: 560px) {
  .seg button, .seg a { white-space: normal; line-height: 1.2; padding: 7px 4px; font-size: 12.5px; text-align: center; }
}

/* Marking periods and the What if tab */
.mp-bar { margin: 0 0 6px; }
.seg button:disabled { opacity: .4; cursor: not-allowed; }
.mp-caption { margin: 0 0 12px; }
.mp-strip { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--border); font-size: 14px; }
.mp-strip .stat { white-space: nowrap; }
.course-tools { gap: 8px; flex-wrap: wrap; align-items: center; }
.course-tools .seg { margin: 16px 0 14px; }
.whatif-head { gap: 12px; flex-wrap: wrap; align-items: center; }
.whatif-head .seg { margin: 8px 0; }

/* Guided tour */
.tour { position: fixed; inset: 0; z-index: 1000; pointer-events: none; }
.tour-spot { position: fixed; border-radius: 12px; box-shadow: 0 0 0 9999px rgba(15, 18, 30, .45); outline: 2px solid var(--accent); transition: all .25s ease; }
.tour-card { position: fixed; pointer-events: auto; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 14px; padding: 16px; box-shadow: 0 12px 40px rgba(0, 0, 0, .25); transition: top .25s ease, left .25s ease; }
.tour-card h3 { margin: 6px 0 6px; font-size: 17px; }
.tour-card p { margin: 0 0 14px; color: var(--muted); font-size: 14px; line-height: 1.45; }
.tour-steps { display: flex; gap: 5px; }
.tour-steps i { width: 7px; height: 7px; border-radius: 50%; background: var(--border); }
.tour-steps i.on { background: var(--accent); width: 18px; border-radius: 4px; }
.tour-buttons { display: flex; gap: 8px; align-items: center; }
.tour-buttons .grow { flex: 1; }
@media (prefers-reduced-motion: reduce) { .tour-spot, .tour-card { transition: none; } }
