:root {
  /* Deep lagoon teal + marigold, for a calm study tool with one bright accent */
  --bg: #f3f6f5;
  --surface: #ffffff;
  --ink: #12201f;
  --muted: #566664;
  --line: #d6e0de;
  --brand: #0f4c4a;
  --accent: #f2a516;
  --accent-ink: #3a2600;
  --good: #1d7a46;
  --good-bg: #e3f4ea;
  --bad: #b3261e;
  --bad-bg: #fbe7e5;
  --display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --body: "Atkinson Hyperlegible", "Segoe UI", system-ui, sans-serif;
  --radius: 14px;
  /* Layout: single column, max 680px, thumb-friendly controls */
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0c1514; --surface: #142120; --ink: #e6efed; --muted: #9bb0ad; --line: #26403d;
    --brand: #7fd1c9; --accent: #f5b53a; --accent-ink: #2b1c00;
    --good: #6fd39b; --good-bg: #133524; --bad: #ff8a80; --bad-bg: #3a1714;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0c1514; --surface: #142120; --ink: #e6efed; --muted: #9bb0ad; --line: #26403d;
  --brand: #7fd1c9; --accent: #f5b53a; --accent-ink: #2b1c00;
  --good: #6fd39b; --good-bg: #133524; --bad: #ff8a80; --bad-bg: #3a1714;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 17px/1.5 var(--body); -webkit-text-size-adjust: 100%; }
h1, h2, h3 { font-family: var(--display); line-height: 1.15; text-wrap: balance; margin: 0; }
h1 { font-size: 1.9rem; font-weight: 800; }
h2 { font-size: 1.2rem; font-weight: 600; }
h3 { font-size: 1.05rem; font-weight: 600; }
button, select, textarea, input { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
[hidden] { display: none !important; }

.bar { position: sticky; top: 0; z-index: 5; background: var(--brand); padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top)); }
.brand { display: flex; align-items: center; gap: 10px; background: none; border: 0; color: #fff; font-family: var(--display); font-weight: 800; font-size: 1.25rem; cursor: pointer; padding: 0; }
:root[data-theme="dark"] .brand, :root:not([data-theme="light"]) .brand { color: #fff; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .bar { background: #0a3533; } }
:root[data-theme="dark"] .bar { background: #0a3533; }
.brand img { border-radius: 8px; }

main { max-width: 680px; margin: 0 auto; padding: 20px 16px 64px; }
.view { display: grid; gap: 18px; }
.lede { color: var(--muted); margin: -6px 0 0; max-width: 60ch; }
.muted { color: var(--muted); }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; display: grid; gap: 14px; }
.step { display: flex; align-items: center; gap: 10px; }
.step span { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font-size: .95rem; }

.drop { display: grid; gap: 4px; place-items: center; text-align: center; padding: 26px 14px; border: 2px dashed var(--line); border-radius: var(--radius); cursor: pointer; transition: border-color .15s, background .15s; }
.drop:hover, .drop.over { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 6%, transparent); }
.drop input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.drop:focus-within { outline: 3px solid var(--accent); outline-offset: 2px; }
.drop strong { font-size: 1.1rem; color: var(--brand); }
.drop span { color: var(--muted); font-size: .95rem; overflow-wrap: anywhere; }
.drop.loaded { border-style: solid; border-color: var(--good); background: var(--good-bg); }
.drop.loaded strong { color: var(--good); }

.paste summary { cursor: pointer; color: var(--brand); font-weight: 700; }
.paste[open] { display: grid; gap: 10px; }
.paste[open] summary { margin-bottom: 4px; }
textarea { width: 100%; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); resize: vertical; }

.status { margin: 0; color: var(--muted); font-size: .95rem; }
.status:empty { display: none; }
.status.error { color: var(--bad); }

.modes { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.mode { text-align: left; padding: 12px 14px; border-radius: 12px; border: 2px solid var(--line); background: var(--surface); cursor: pointer; display: grid; gap: 2px; }
.mode b { font-family: var(--display); font-size: 1.05rem; }
.mode small { color: var(--muted); line-height: 1.3; }
.mode[aria-checked="true"] { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 8%, var(--surface)); }

.opts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.opts label { display: grid; gap: 4px; font-size: .9rem; color: var(--muted); font-weight: 700; }
.opts select { padding: 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); font-weight: 400; }

.btn { border: 0; border-radius: 12px; padding: 10px 16px; cursor: pointer; font-weight: 700; }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.primary:disabled { background: var(--line); color: var(--muted); cursor: not-allowed; }
.btn.big { padding: 15px; font-size: 1.1rem; width: 100%; }
.btn.ghost { background: transparent; border: 1px solid var(--line); color: var(--ink); }
.btn.ghost:hover { border-color: var(--brand); }

.recent h2 { margin-bottom: 8px; }
.recent ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.recent li button { width: 100%; text-align: left; display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; cursor: pointer; }
.recent .pill { grid-row: span 2; }
.recent .t { font-weight: 700; overflow-wrap: anywhere; }
.recent .d { color: var(--muted); font-size: .88rem; }
.pill { display: inline-block; font-size: .75rem; font-weight: 700; padding: 3px 8px; border-radius: 99px; background: color-mix(in srgb, var(--brand) 14%, transparent); color: var(--brand); text-transform: uppercase; letter-spacing: .04em; }
.pill.example { background: color-mix(in srgb, var(--accent) 25%, transparent); color: var(--ink); }

.loading { display: grid; place-items: center; text-align: center; gap: 6px; padding: 60px 10px; }
.loading p { margin: 0; }
#loadingText { font-family: var(--display); font-size: 1.3rem; font-weight: 600; }
.spinner { width: 48px; height: 48px; border-radius: 50%; border: 5px solid var(--line); border-top-color: var(--accent); animation: spin 0.9s linear infinite; margin-bottom: 10px; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 3s; } .card-inner { transition: none !important; } }

.result-head { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.result-actions { display: flex; gap: 8px; }
.kicker { margin: 0 0 -10px; color: var(--brand); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; font-size: .8rem; }

/* Quiz */
.score { position: sticky; top: 56px; z-index: 3; display: flex; justify-content: space-between; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; font-weight: 700; }
.score .bar-track { flex: 1; height: 8px; background: var(--line); border-radius: 9px; margin: 0 12px; overflow: hidden; }
.score .bar-fill { height: 100%; background: var(--good); width: 0; transition: width .3s; }
.q { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: grid; gap: 10px; }
.q .num { color: var(--muted); font-size: .85rem; font-weight: 700; }
.q p.question { margin: 0; font-weight: 700; }
.opt { text-align: left; padding: 12px 14px; border-radius: 10px; border: 2px solid var(--line); background: var(--bg); cursor: pointer; display: flex; gap: 10px; }
.opt .letter { font-weight: 700; color: var(--muted); }
.opt.correct { border-color: var(--good); background: var(--good-bg); }
.opt.wrong { border-color: var(--bad); background: var(--bad-bg); }
.opt:disabled { cursor: default; }
.explain { margin: 0; padding: 10px 12px; border-left: 4px solid var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent); border-radius: 0 8px 8px 0; }
.final { text-align: center; padding: 20px; background: var(--surface); border-radius: var(--radius); border: 2px solid var(--good); display: grid; gap: 10px; }
.final .big-num { font-family: var(--display); font-size: 2.6rem; font-weight: 800; color: var(--good); font-variant-numeric: tabular-nums; }

/* Flashcards */
.deck { display: grid; gap: 14px; }
.card { perspective: 1200px; height: 280px; cursor: pointer; border: 0; padding: 0; background: none; width: 100%; }
.card-inner { position: relative; width: 100%; height: 100%; transition: transform .45s; transform-style: preserve-3d; }
.card.flipped .card-inner { transform: rotateY(180deg); }
.face { position: absolute; inset: 0; backface-visibility: hidden; display: grid; place-items: center; text-align: center; padding: 22px; border-radius: 18px; border: 1px solid var(--line); background: var(--surface); font-size: 1.2rem; overflow: auto; }
.face.back { transform: rotateY(180deg); background: var(--brand); color: #fff; border-color: transparent; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .face.back { color: #0c1514; } }
:root[data-theme="dark"] .face.back { color: #0c1514; }
.face small { position: absolute; top: 12px; left: 16px; font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; opacity: .7; }
.deck-nav { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.deck-nav .count { font-variant-numeric: tabular-nums; color: var(--muted); font-weight: 700; }
.know { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.know .btn { padding: 12px; }
.know .yes { background: var(--good-bg); color: var(--good); }
.know .no { background: var(--bad-bg); color: var(--bad); }

/* Summary, test, assignment */
.block { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; display: grid; gap: 10px; }
.block p { margin: 0; max-width: 65ch; }
.block ul, .block ol { margin: 0; padding-left: 1.2em; display: grid; gap: 6px; }
dl.terms { margin: 0; display: grid; gap: 10px; }
dl.terms dt { font-weight: 700; }
dl.terms dd { margin: 0; color: var(--muted); }
.marks { float: right; font-size: .8rem; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; margin-left: 8px; }
.answer { margin: 0; padding: 10px 12px; border-radius: 8px; background: var(--good-bg); color: var(--ink); }
.answer b { color: var(--good); }
.test-opts { margin: 0; padding-left: 1.4em; list-style: upper-alpha; }
.lines { height: 64px; background: repeating-linear-gradient(transparent 0 30px, var(--line) 30px 31px); }
.lines.long { height: 160px; }
.toggle { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.toggle input { width: 20px; height: 20px; accent-color: var(--brand); }
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; min-width: 560px; width: 100%; font-size: .92rem; }
th, td { border: 1px solid var(--line); padding: 8px 10px; text-align: left; vertical-align: top; }
th { background: color-mix(in srgb, var(--brand) 10%, transparent); font-family: var(--display); }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: 99px; font-weight: 700; opacity: 0; pointer-events: none; transition: opacity .2s; }
.toast.show { opacity: 1; }

@media (max-width: 340px) {
  h1 { font-size: 1.6rem; }
  .opts { grid-template-columns: 1fr; }
}
.foot { font-size: .85rem; margin: 0; }
.foot a { color: var(--brand); }

/* Header tabs */
.bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.tabs { display: flex; gap: 4px; background: rgba(255,255,255,.12); padding: 4px; border-radius: 12px; }
.tab { border: 0; background: transparent; color: #fff; font-weight: 700; padding: 7px 14px; border-radius: 9px; cursor: pointer; }
.tab[aria-current="page"] { background: var(--accent); color: var(--accent-ink); }
.offline-banner { background: var(--accent); color: var(--accent-ink); text-align: center; font-weight: 700; font-size: .9rem; padding: 6px 12px; }

/* Chat */
.chat { gap: 12px; }
.chat-top { display: flex; align-items: end; gap: 8px; flex-wrap: wrap; }
.chat-notes { flex: 1 1 200px; display: grid; gap: 4px; font-size: .85rem; font-weight: 700; color: var(--muted); }
.chat-notes select { padding: 9px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-weight: 400; min-width: 0; }
.btn.small { padding: 8px 12px; font-size: .9rem; }
.chip { font-size: .78rem; font-weight: 700; padding: 6px 10px; border-radius: 99px; background: var(--good-bg); color: var(--good); white-space: nowrap; align-self: center; }
.chip[data-mode="phone"] { background: color-mix(in srgb, var(--brand) 14%, transparent); color: var(--brand); }
.chip[data-mode="notes"] { background: color-mix(in srgb, var(--accent) 25%, transparent); color: var(--ink); }
.local { padding: 12px 16px; gap: 10px; }
.local summary { cursor: pointer; }
.local p { margin: 0; font-size: .93rem; }
.local-actions { display: flex; gap: 8px; }
.local-actions:has(> :not([hidden])) { display: flex; }
.progress { height: 10px; background: var(--line); border-radius: 9px; overflow: hidden; }
.progress-fill { height: 100%; width: 0; background: var(--brand); transition: width .3s; }
.messages { display: grid; gap: 10px; padding-bottom: 90px; }
.welcome { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; display: grid; gap: 10px; }
.welcome p { margin: 0; }
.ideas { display: grid; gap: 8px; }
.idea { text-align: left; padding: 11px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); cursor: pointer; color: var(--brand); font-weight: 700; }
.msg { display: grid; gap: 3px; max-width: 88%; }
.msg.user { justify-self: end; }
.msg.assistant { justify-self: start; }
.bubble { padding: 10px 14px; border-radius: 16px; overflow-wrap: anywhere; }
.bubble p { margin: 0 0 .5em; }
.bubble p:last-child { margin: 0; }
.msg.user .bubble { background: var(--brand); color: #fff; border-bottom-right-radius: 4px; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .msg.user .bubble { color: #0c1514; } }
:root[data-theme="dark"] .msg.user .bubble { color: #0c1514; }
.msg.assistant .bubble { background: var(--surface); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.via { font-size: .72rem; color: var(--muted); font-weight: 700; padding-left: 4px; }
.dots { color: var(--muted); }
.composer { position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; display: flex; gap: 8px; align-items: end; padding: 10px 16px; padding-bottom: max(10px, env(safe-area-inset-bottom)); background: var(--bg); border-top: 1px solid var(--line); }
.composer textarea { flex: 1; max-width: 600px; margin-left: auto; resize: none; background: var(--surface); border-radius: 14px; min-height: 46px; max-height: 160px; }
.composer button { margin-right: auto; height: 46px; }
@media (min-width: 700px) { .composer { padding-left: calc(50% - 324px); padding-right: calc(50% - 324px); } .composer textarea, .composer button { margin: 0; } .composer textarea { max-width: none; } }
.report { justify-self: start; background: none; border: 0; padding: 2px 4px; color: var(--muted); font-size: .78rem; text-decoration: underline; cursor: pointer; }

/* Account */
@media (max-width: 430px) { .brand span { display: none; } .tab { padding: 7px 12px; } }
.code { font-family: ui-monospace, Menlo, Consolas, monospace; letter-spacing: .05em; font-size: 1.05rem; background: color-mix(in srgb, var(--accent) 22%, transparent); padding: 2px 8px; border-radius: 6px; }
.plan-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.pill.good { background: var(--good-bg); color: var(--good); }
.pill.bad { background: var(--bad-bg); color: var(--bad); }
.meters { display: grid; gap: 10px; }
.meter-top { display: flex; justify-content: space-between; font-size: .92rem; margin-bottom: 4px; font-variant-numeric: tabular-nums; }
.small { font-size: .85rem; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; background: var(--bg); border: 1px solid var(--line); padding: 4px; border-radius: 12px; }
.seg button { border: 0; background: transparent; padding: 9px; border-radius: 9px; font-weight: 700; cursor: pointer; color: var(--muted); }
.seg button[aria-selected="true"] { background: var(--surface); color: var(--brand); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.otp { display: grid; gap: 8px; }
.otp label, .field { font-size: .9rem; font-weight: 700; color: var(--muted); display: grid; gap: 4px; }
.otp input, .field select { padding: 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); font-size: 1.05rem; width: 100%; }
#otpCode { letter-spacing: .4em; font-size: 1.4rem; text-align: center; font-variant-numeric: tabular-nums; }
.phone { display: flex; align-items: stretch; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--bg); }
.phone span { padding: 12px; font-weight: 700; color: var(--muted); border-right: 1px solid var(--line); }
.phone input { border: 0 !important; border-radius: 0 !important; }
.gbtn { min-height: 44px; display: flex; justify-content: center; }
.or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: .85rem; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.ticks { list-style: none; padding: 0 !important; }
.ticks li::before { content: "✓ "; color: var(--good); font-weight: 700; }
.steps { padding-left: 1.3em; }
.pay-panel { display: grid; gap: 10px; }
.premium { border: 2px solid var(--accent); }
.pays { list-style: none; padding: 0 !important; display: grid; gap: 8px; }
.pays li { display: flex; gap: 10px; align-items: flex-start; }
.help a { color: var(--brand); font-weight: 700; }
.row-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.btn.danger { color: var(--bad); }
.btn.danger-fill { background: var(--bad); color: #fff; }
.confirm { display: grid; gap: 10px; padding: 12px; border-radius: 10px; background: var(--bad-bg); }
.confirm p { margin: 0; }

/* Online files */
.save-online { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: .95rem; }
.save-online input { width: 20px; height: 20px; accent-color: var(--brand); }
.progress.big { height: 14px; }
.progress-fill.warn { background: var(--bad); }
.upload { position: relative; text-align: center; display: block; }
.upload input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.upload.disabled { background: var(--line); color: var(--muted); cursor: not-allowed; }
.upload:focus-within { outline: 3px solid var(--accent); outline-offset: 2px; }
.files { list-style: none; margin: 0; padding: 0 !important; display: grid; gap: 10px; }
.files li { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.files li:first-child { border-top: 0; }
.fmeta { display: grid; min-width: 0; }
.fmeta b { overflow-wrap: anywhere; }
.factions { grid-column: 1 / -1; display: flex; gap: 6px; flex-wrap: wrap; }
.files .confirm { grid-column: 1 / -1; }
.ftype { width: 44px; height: 44px; border-radius: 10px; display: grid; place-items: center; font-size: .72rem; font-weight: 800; background: color-mix(in srgb, var(--brand) 14%, transparent); color: var(--brand); }
.ftype.pdf { background: var(--bad-bg); color: var(--bad); }
.ftype.xlsx, .ftype.xls, .ftype.csv { background: var(--good-bg); color: var(--good); }
@media (max-width: 430px) { .tab { padding: 7px 9px; font-size: .92rem; } }

/* Bottom navigation (5 sections) */
:root { --nav-h: 64px; }
.bar { justify-content: flex-start; }
@media (max-width: 430px) { .brand span { display: inline; } }
main { padding-bottom: calc(var(--nav-h) + 40px); }
.bottom-nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 8; display: grid; grid-template-columns: repeat(5, 1fr); background: var(--surface); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); height: calc(var(--nav-h) + env(safe-area-inset-bottom)); }
.bottom-nav .tab { display: grid; place-items: center; align-content: center; gap: 2px; background: none; border: 0; border-radius: 0; color: var(--muted); font-size: .74rem; font-weight: 700; padding: 6px 2px; cursor: pointer; }
.bottom-nav .tab svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.bottom-nav .tab[aria-current="page"] { color: var(--brand); background: none; }
.bottom-nav .tab[aria-current="page"] svg { stroke-width: 2.4; }
.bottom-nav .tab[aria-current="page"]::before { content: ""; position: absolute; }
.bottom-nav .tab[aria-current="page"] span { border-bottom: 3px solid var(--accent); padding-bottom: 1px; }
.composer { bottom: calc(var(--nav-h) + env(safe-area-inset-bottom)); padding-bottom: 10px; }
.messages { padding-bottom: 150px; }
.toast { bottom: calc(var(--nav-h) + 24px + env(safe-area-inset-bottom)); }
.score { top: 64px; }

/* Progress dashboard */
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; display: grid; gap: 2px; }
.tile-num { font-family: var(--display); font-weight: 800; font-size: 2rem; line-height: 1; color: var(--brand); font-variant-numeric: tabular-nums; }
.tile-lbl { font-weight: 700; }
.tile small { font-size: .8rem; }
.goal-lbl { display: flex; align-items: center; gap: 6px; font-size: .85rem; font-weight: 700; color: var(--muted); }
.goal-lbl select { padding: 6px 8px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); }
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.wday { display: grid; justify-items: center; gap: 4px; color: var(--muted); font-weight: 700; }
.wdot { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; border: 2px solid var(--line); color: var(--accent-ink); font-weight: 800; }
.wday.on .wdot { background: var(--accent); border-color: var(--accent); }
.wday.today .wdot { border-color: var(--brand); }
.wday.today small { color: var(--brand); }
.wday.future .wdot { border-style: dashed; }
.goal-done { color: var(--good); font-weight: 700; margin: 0; }
.chart-wrap { overflow: hidden; }
.chart { width: 100%; height: auto; display: block; font-family: var(--body); }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .axis { fill: var(--muted); font-size: 10px; font-variant-numeric: tabular-nums; }
.chart .val { fill: var(--ink); font-size: 12px; font-weight: 700; paint-order: stroke; stroke: var(--surface); stroke-width: 4px; stroke-linejoin: round; }
.chart .mark { fill: var(--brand); }
.chart .hit { cursor: pointer; outline: none; }
.chart .hit.active .mark, .chart .hit:focus .mark { fill: var(--accent); }
.chart .line { fill: none; stroke: var(--brand); stroke-width: 2; stroke-linejoin: round; }
.chart .area { fill: var(--brand); opacity: .1; }
.chart .dot { fill: var(--brand); stroke: var(--surface); stroke-width: 2; }
.chart .dot.last { fill: var(--accent); }
.chart .hit.active .dot { fill: var(--accent); }
.chart-tip { position: absolute; z-index: 20; max-width: 260px; background: var(--ink); color: var(--bg); padding: 6px 10px; border-radius: 8px; font-size: .82rem; font-weight: 700; pointer-events: none; box-shadow: 0 2px 8px rgba(0,0,0,.2); }
.topics, .mistakes { list-style: none; margin: 0; padding: 0 !important; display: grid; gap: 12px; }
.topics li { display: grid; gap: 4px; }
.topic-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.topic-top b { overflow-wrap: anywhere; }
.pill.warn { background: color-mix(in srgb, var(--accent) 28%, transparent); color: var(--ink); }
.mistakes li { display: grid; gap: 6px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.mistakes li:last-child { border-bottom: 0; }
.mistakes p { margin: 0; }
.badges { list-style: none; margin: 0; padding: 0 !important; display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.badges li { display: grid; grid-template-columns: auto 1fr; gap: 0 8px; align-items: center; padding: 10px; border-radius: 12px; border: 1px dashed var(--line); color: var(--muted); }
.badges li b { font-size: .9rem; }
.badges li small { grid-column: 2; font-size: .75rem; line-height: 1.25; }
.badge-icon { grid-row: span 2; font-size: 1.5rem; line-height: 1; }
.badges li.got { border-style: solid; border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, var(--surface)); color: var(--ink); }
.badges li.got .badge-icon { color: var(--accent); }
.empty-progress { text-align: left; }

/* Grade 12 set-up */
.countdown { display: flex; align-items: center; gap: 14px; background: var(--brand); color: #fff; border-radius: var(--radius); padding: 14px 16px; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .countdown { background: #0a3533; } }
:root[data-theme="dark"] .countdown { background: #0a3533; }
.countdown b { font-family: var(--display); font-size: 2.4rem; line-height: 1; color: var(--accent); font-variant-numeric: tabular-nums; }
.countdown span { display: grid; font-weight: 700; }
.countdown small { font-weight: 400; opacity: .85; font-size: .85rem; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-b { border: 1.5px solid var(--line); background: var(--surface); border-radius: 99px; padding: 7px 12px; font-weight: 700; font-size: .9rem; cursor: pointer; color: var(--ink); }
.chip-b[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: #fff; }
.chip-s { background: color-mix(in srgb, var(--brand) 12%, transparent); color: var(--brand); border-radius: 99px; padding: 4px 10px; font-weight: 700; font-size: .82rem; }
.profile.compact { gap: 10px; }
.field input[type="date"] { padding: 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); }
.note-tags { display: grid; grid-template-columns: 1.4fr 1fr; gap: 10px; }
.note-tags label { display: grid; gap: 4px; font-size: .9rem; color: var(--muted); font-weight: 700; }
.note-tags select { padding: 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); font-weight: 400; min-width: 0; }
.add-ways { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.way { display: flex; align-items: center; justify-content: center; gap: 8px; position: relative; text-align: center; }
.way input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.way svg { width: 20px; height: 20px; fill: none; stroke: var(--brand); stroke-width: 2; stroke-linejoin: round; }
.way:focus-within { outline: 3px solid var(--accent); outline-offset: 2px; }
.photo-panel, .fode-panel { display: grid; gap: 10px; padding: 12px; border-radius: 12px; background: var(--bg); border: 1px solid var(--line); }
.thumbs { display: flex; gap: 8px; flex-wrap: wrap; }
.thumbs figure { position: relative; margin: 0; width: 72px; }
.thumbs img { width: 72px; height: 96px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); display: block; }
.thumbs figcaption { text-align: center; font-size: .75rem; color: var(--muted); }
.thumbs .x { position: absolute; top: -6px; right: -6px; width: 24px; height: 24px; border-radius: 50%; border: 0; background: var(--ink); color: var(--bg); font-weight: 800; cursor: pointer; line-height: 1; }
.add-page { width: 72px; height: 96px; border: 2px dashed var(--line); border-radius: 8px; display: grid; place-items: center; color: var(--brand); font-weight: 700; cursor: pointer; }
.fode-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.fode-list li { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.fode-list li:last-child { border-bottom: 0; }
.fode-list a.btn { text-decoration: none; display: inline-block; }

/* Exam practice */
.exam-cover { gap: 14px; }
.exam-parts { min-width: 0; font-size: .92rem; }
.exam-parts td { border: 0; border-bottom: 1px solid var(--line); padding: 8px 6px; }
.exam-parts tr.tot td { font-weight: 800; border-bottom: 0; }
.exam-parts td:last-child { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.exam-bar { position: sticky; top: 60px; z-index: 4; display: flex; align-items: center; justify-content: space-between; gap: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; font-weight: 800; font-variant-numeric: tabular-nums; }
#examClock.low { color: var(--bad); }
.part-h { margin-top: 8px; }
fieldset.q { margin: 0; min-width: 0; }
fieldset.q legend { padding: 0; }
.opt.radio { cursor: pointer; align-items: center; }
.opt.radio input { width: 20px; height: 20px; accent-color: var(--brand); margin: 0; }
.opt.radio:has(input:checked) { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 8%, var(--surface)); }
.q textarea { width: 100%; }
.q .marks { float: none; margin-left: 6px; }
.my-answer { padding: 10px 12px; border-radius: 8px; background: var(--bg); border: 1px solid var(--line); overflow-wrap: anywhere; }

/* Welcome page and profile questions */
body.intro .bottom-nav { display: none; }
body.intro main { padding-bottom: 120px; }
.welcome-view { gap: 22px; }
.welcome-hero { display: grid; justify-items: center; text-align: center; gap: 6px; padding-top: 8px; }
.welcome-hero img { border-radius: 22px; box-shadow: 0 6px 20px rgba(15, 76, 74, .25); }
.welcome-hero h1 { font-size: 2.3rem; }
.welcome-hero .tag { margin: 0; color: var(--brand); font-weight: 800; font-family: var(--display); font-size: 1.15rem; }
.welcome-hero .lede { margin: 4px 0 0; text-align: center; }
.intro-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.intro-list li { display: grid; grid-template-columns: 44px 1fr; gap: 12px; align-items: start; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.intro-list .ic { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: color-mix(in srgb, var(--accent) 25%, transparent); color: var(--ink); font-size: 1.3rem; font-weight: 800; }
.intro-list p { margin: 2px 0 0; color: var(--muted); font-size: .95rem; }
.intro-actions { display: grid; gap: 10px; text-align: center; }
.intro-actions a { color: var(--brand); }
.ob-top { display: flex; justify-content: space-between; align-items: center; }
.ob-bar { height: 8px; background: var(--line); border-radius: 9px; overflow: hidden; }
.ob-bar div { height: 100%; background: var(--accent); transition: width .3s; }
.onboard-view h1 { font-size: 1.7rem; }
.onboard-view .lede { margin: -8px 0 0; }
.ob-body { display: grid; gap: 12px; }
.ob-next { position: fixed; left: 0; right: 0; bottom: 0; z-index: 9; padding: 12px 16px; padding-bottom: max(12px, env(safe-area-inset-bottom)); background: var(--bg); border-top: 1px solid var(--line); }
.ob-next .btn { max-width: 648px; margin: 0 auto; display: block; }
.big-input { width: 100%; padding: 14px; font-size: 1.15rem; border-radius: 12px; border: 1.5px solid var(--line); background: var(--surface); color: var(--ink); }
.big-input:focus { border-color: var(--brand); }
.field input:not([type="date"]) { padding: 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-size: 1rem; width: 100%; }
.cards { display: grid; gap: 10px; }
.card-opt { text-align: left; display: grid; gap: 2px; padding: 14px 16px; border-radius: 14px; border: 2px solid var(--line); background: var(--surface); cursor: pointer; color: var(--ink); }
.card-opt b { font-size: 1.02rem; }
.card-opt small { color: var(--muted); }
.card-opt[aria-pressed="true"] { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 9%, var(--surface)); }
.card-opt[aria-pressed="true"] b::after { content: "  ✓"; color: var(--brand); }
.q-label { margin: 6px 0 -4px; font-weight: 700; color: var(--muted); font-size: .92rem; }
.conf { display: grid; gap: 14px; }
.conf-row { display: grid; gap: 6px; }
.seg.small button { padding: 8px 4px; font-size: .85rem; }
.done-hero { display: grid; justify-items: center; text-align: center; gap: 6px; }
.big-check { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; background: var(--good-bg); color: var(--good); font-size: 2rem; font-weight: 800; }
.plan-list { display: grid; gap: 10px; }
.plan-list li { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.chip-s.weak { background: var(--bad-bg); color: var(--bad); }
.plan { border: 2px solid var(--accent); }
.today { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.today li { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.today li span { flex: 1; }
.seg.grades button { font-size: 1.1rem; padding: 10px 0; }
