/* UnderStandIt — theme: Main #B5A1D8 (Pale Lilac), Background #F2ECF8, Accent #8673A8 (Dusty Purple). Dark mode: black. */
:root {
  --main: #B5A1D8;
  --main-soft: #DCD0EE;   /* a lighter tint of --main */
  --on-main: #1E1530;     /* text on --main */
  --bg: #F2ECF8;
  --accent: #8673A8;
  --accent-strong: #6E5B92;
  --on-accent: #FFFFFF;
  --surface: #FFFFFF;
  --surface-2: #F8F4FC;
  --surface-3: #EDE5F7;
  --text: #2A2140;
  --muted: #6B6080;
  --border: #E2D8EF;
  --on-status: #FFFFFF;   /* text on --good, --mid and --bad */
  --good: #2F8A5F; --good-bg: #E3F4EA;
  --mid: #A9700F; --mid-bg: #FBF0D9;
  --bad: #C0394E; --bad-bg: #FBE4E8;
  --c0: #8673A8; --c1: #5BA8A0; --c2: #E09A5B; --c3: #D46A8E; --c4: #6C8FD6; --c5: #B5A1D8;
  --shadow: 0 1px 2px rgba(60, 40, 100, .06), 0 6px 20px rgba(60, 40, 100, .07);
  --radius: 16px;
  --font: 'Nunito', ui-rounded, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #000000; --surface: #121016; --surface-2: #1A1720; --surface-3: #241F2D; --text: #F2ECF8; --muted: #B3A8C7; --border: #2E2838;
    --accent: #B5A1D8; --accent-strong: #C9B9E6; --on-accent: #1A1326; --main: #B5A1D8; --on-status: #0B0B0B;
    --good: #6BD3A0; --good-bg: #10261B; --mid: #F0C062; --mid-bg: #2A2110; --bad: #FF8A9C; --bad-bg: #2C1218;
    --shadow: 0 1px 2px rgba(0, 0, 0, .5), 0 6px 20px rgba(0, 0, 0, .4); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #000000; --surface: #121016; --surface-2: #1A1720; --surface-3: #241F2D; --text: #F2ECF8; --muted: #B3A8C7; --border: #2E2838;
  --accent: #B5A1D8; --accent-strong: #C9B9E6; --on-accent: #1A1326; --main: #B5A1D8; --on-status: #0B0B0B;
  --good: #6BD3A0; --good-bg: #10261B; --mid: #F0C062; --mid-bg: #2A2110; --bad: #FF8A9C; --bad-bg: #2C1218;
  --shadow: 0 1px 2px rgba(0, 0, 0, .5), 0 6px 20px rgba(0, 0, 0, .4); color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }   /* the hidden attribute always wins over display rules */
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 1rem/1.55 var(--font); overflow-x: hidden; }
.boot { display: grid; place-items: center; min-height: 100vh; font-size: 1.3rem; font-weight: 800; color: var(--accent); }
h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 .5em; font-weight: 800; }
h1 { font-size: clamp(1.5rem, 3vw, 2rem); } h2 { font-size: 1.3rem; } h3 { font-size: 1.08rem; }
p { margin: 0 0 .7em; }
a { color: var(--accent-strong); }
img, svg, canvas { max-width: 100%; }
.muted { color: var(--muted); } .small { font-size: .87rem; } .big { font-size: 1.15rem; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.skip { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--accent); color: var(--on-accent); padding: 8px 12px; border-radius: 8px; }
.skip:focus { left: 8px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
#main:focus, #main:focus-visible { outline: none; }   /* focused by the router for screen readers only */
.good-text { color: var(--good); font-weight: 700; } .bad-text { color: var(--bad); font-weight: 700; } .warn-text { color: var(--mid); font-weight: 700; }
.center-text { text-align: center; }
.row { display: flex; align-items: center; } .gap { gap: 10px; } .wrap { flex-wrap: wrap; } .grow { flex: 1; min-width: 0; }
.center-row { justify-content: center; } .end-row { justify-content: flex-end; margin-top: 16px; }

/* ---------- layout ---------- */
.app { display: grid; grid-template-columns: 250px minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--surface); border-right: 1px solid var(--border); padding: 18px 12px; display: flex; flex-direction: column; }
.brand { display: flex; align-items: center; gap: 10px; font-size: 1.35rem; font-weight: 900; color: var(--text); text-decoration: none; padding: 4px 10px 16px; }
.brand b { color: var(--accent); }
.logo { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; background: var(--main); font-size: 1.2rem; }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar nav a { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 12px; color: var(--text); text-decoration: none; font-weight: 700; }
.sidebar nav a:hover { background: var(--surface-2); }
.sidebar nav a.on { background: var(--main); color: var(--on-main); }
.ni { width: 22px; text-align: center; }
.nav-badge { margin-left: auto; background: var(--bad); color: var(--on-status); font-size: .75rem; border-radius: 99px; padding: 0 7px; }
.side-foot { margin-top: auto; padding: 12px; }
.main-col { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 10px 24px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.mat-pick select { max-width: 260px; }
.level { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.level input { width: 120px; accent-color: var(--accent); }
.level-label { min-width: 92px; font-size: .9rem; color: var(--accent-strong); }
.ai-chip { border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 99px; padding: 6px 12px; font: 700 .85rem var(--font); cursor: pointer; }
.ai-chip.ai-chrome, .ai-chip.ai-webllm { background: var(--main); color: var(--on-main); border-color: transparent; }
.save { font-size: .82rem; color: var(--good); font-weight: 700; margin-left: auto; }
.save.dirty { color: var(--muted); }
.menu-btn { display: none; }
main { padding: 24px; max-width: 1240px; width: 100%; margin: 0 auto; outline: none; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head p { margin: 0; }
.scrim { position: fixed; inset: 0; background: rgba(0, 0, 0, .4); z-index: 39; }

/* ---------- components ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); margin-bottom: 18px; min-width: 0; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid transparent; border-radius: 12px; padding: 10px 16px; font: 800 .95rem var(--font); cursor: pointer; text-decoration: none; transition: transform .08s, background .15s; color: var(--text); background: var(--surface-3); }
.btn:hover { transform: translateY(-1px); } .btn:active { transform: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-strong); }
.btn-ghost { background: transparent; border-color: var(--border); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { background: var(--bad); color: var(--on-status); }
.btn-sm { padding: 6px 11px; font-size: .85rem; border-radius: 10px; }
.btn.on, .btn[aria-pressed="true"] { background: var(--main); color: var(--on-main); }
.btn.big { padding: 13px 22px; font-size: 1.05rem; }
.btn-confused { background: var(--mid-bg); color: var(--mid); border: 1px solid color-mix(in srgb, var(--mid) 40%, transparent); font-size: 1rem; }
.icon-btn { border: none; background: transparent; color: var(--text); font-size: 1.1rem; cursor: pointer; border-radius: 10px; padding: 6px 8px; }
.icon-btn:hover { background: var(--surface-2); }
.link { background: none; border: none; color: var(--accent-strong); font: inherit; font-weight: 700; cursor: pointer; padding: 0; text-align: left; }
.input { width: 100%; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); border-radius: 12px; padding: 10px 12px; font: 600 .95rem var(--font); }
textarea.input { resize: vertical; line-height: 1.5; }
select.input { width: auto; max-width: 100%; }
.field { display: flex; flex-direction: column; gap: 6px; font-weight: 700; margin-bottom: 12px; min-width: 0; }
fieldset { border: none; padding: 0; margin: 0 0 12px; } legend { font-weight: 800; margin-bottom: 6px; }
fieldset label { font-weight: 600; margin-right: 12px; }
.chip { display: inline-flex; align-items: center; gap: 4px; background: var(--surface-3); color: var(--text); border: 1px solid var(--border); border-radius: 99px; padding: 3px 10px; font-size: .85rem; font-weight: 700; text-decoration: none; cursor: default; }
button.chip, a.chip { cursor: pointer; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 8px; }
.chips.big .chip { padding: 8px 14px; font-size: .95rem; }
.badge { display: inline-block; background: var(--main); color: var(--on-main); border-radius: 99px; padding: 1px 9px; font-size: .75rem; font-weight: 800; }
.badge.good { background: var(--good-bg); color: var(--good); } .badge.mid { background: var(--mid-bg); color: var(--mid); } .badge.bad { background: var(--bad-bg); color: var(--bad); }
.tip { background: var(--surface-3); border-left: 4px solid var(--accent); padding: 10px 14px; border-radius: 10px; margin: 10px 0; }
.banner { background: var(--main); color: var(--on-main); border-radius: 14px; padding: 12px 16px; margin-bottom: 16px; font-weight: 700; }
.banner a { color: var(--on-main); }
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty h2 { color: var(--text); }
.empty.big { padding: 60px 20px; }
.empty-icon { font-size: 3rem; margin-bottom: 8px; }
.loading { display: flex; align-items: center; gap: 10px; padding: 30px; justify-content: center; color: var(--muted); font-weight: 700; }
.spinner { width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--surface-3); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.meter { height: 10px; background: var(--surface-3); border-radius: 99px; overflow: hidden; flex: 1; min-width: 60px; }
.meter span { display: block; height: 100%; background: var(--accent); border-radius: 99px; transition: width .4s; }
.meter.good span { background: var(--good); } .meter.mid span { background: var(--mid); } .meter.bad span { background: var(--bad); }
.bar { height: 6px; background: var(--surface-3); border-radius: 99px; margin: 6px 0 14px; overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--accent); transition: width .3s; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.grid2 > .card { margin-bottom: 0; }
.grid2.tight { gap: 20px; margin-top: 16px; }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .93rem; }
.table th, .table td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table thead th { color: var(--muted); font-size: .82rem; text-transform: uppercase; letter-spacing: .03em; }
.grade { font-weight: 900; padding: 2px 9px; border-radius: 8px; background: var(--surface-3); }
.grade.gA { background: var(--good-bg); color: var(--good); } .grade.gF, .grade.gD { background: var(--bad-bg); color: var(--bad); }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.tab { padding: 8px 14px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); color: var(--text); text-decoration: none; font-weight: 800; cursor: pointer; font-family: var(--font); font-size: .92rem; }
.tab.on { background: var(--accent); color: var(--on-accent); border-color: transparent; }
details summary { cursor: pointer; font-weight: 800; }

/* toasts & modals */
#toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; width: min(92vw, 460px); pointer-events: none; }
.toast { background: var(--text); color: var(--bg); padding: 12px 16px; border-radius: 12px; font-weight: 700; box-shadow: var(--shadow); animation: up .25s ease; }
.toast-good { border-left: 7px solid var(--good); } .toast-error { border-left: 7px solid var(--bad); } .toast-warn { border-left: 7px solid var(--mid); }
.toast.out { opacity: 0; transition: opacity .3s; }
@keyframes up { from { transform: translateY(10px); opacity: 0; } }
.modal-wrap { position: fixed; inset: 0; background: rgba(15, 8, 30, .5); z-index: 150; display: grid; place-items: center; padding: 16px; animation: fade .15s; }
.modal-wrap.out { opacity: 0; transition: opacity .18s; }
@keyframes fade { from { opacity: 0; } }
.modal { background: var(--surface); border-radius: 18px; width: min(100%, 520px); max-height: 90vh; display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0, 0, 0, .3); }
.modal.wide { width: min(100%, 820px); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px 6px; }
.modal-head h2 { margin: 0; }
.modal-body { padding: 10px 20px; overflow-y: auto; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px 18px; flex-wrap: wrap; }
.cam { width: 100%; border-radius: 12px; background: #000; }

/* ---------- dashboard ---------- */
.countdowns { display: grid; gap: 16px; margin-bottom: 18px; }
.countdown { display: flex; gap: 20px; background: linear-gradient(135deg, var(--main), var(--main-soft)); color: var(--on-main); border-radius: 22px; padding: 22px; box-shadow: var(--shadow); }
.countdown.urgent { background: linear-gradient(135deg, color-mix(in srgb, var(--bad) 35%, var(--main-soft)), var(--main)); }
.countdown .muted { color: color-mix(in srgb, var(--on-main) 78%, transparent); }
.countdown .btn-ghost { border-color: color-mix(in srgb, var(--on-main) 30%, transparent); color: var(--on-main); }
.countdown .btn-primary { background: var(--on-main); color: #fff; }
.countdown a:not(.btn) { color: var(--on-main); }
.cd-num { flex: none; width: 92px; height: 92px; border-radius: 24px; background: rgba(255, 255, 255, .6); display: grid; place-items: center; font-size: 2.8rem; font-weight: 900; }
.cd-body { min-width: 0; flex: 1; }
.cd-body h2 { font-size: 1.55rem; margin-bottom: 2px; }
.kit-line { font-weight: 700; margin: 8px 0 10px; }
.today-tasks { list-style: none; padding: 0; margin: 14px 0 0; display: grid; gap: 6px; }
.today-tasks li { background: rgba(255, 255, 255, .55); border-radius: 10px; padding: 8px 10px; }
.today-tasks li.done a { text-decoration: line-through; opacity: .7; }
.today-tasks input { accent-color: var(--on-main); margin-right: 6px; }
.cta { text-align: center; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 18px; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; text-decoration: none; color: var(--muted); font-weight: 700; font-size: .9rem; box-shadow: var(--shadow); }
.tile-num { font-size: 1.7rem; font-weight: 900; color: var(--text); line-height: 1.2; overflow-wrap: anywhere; }
.quick { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.q-item { display: flex; flex-direction: column; gap: 4px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 14px; padding: 14px; text-decoration: none; color: var(--text); font-weight: 800; }
.q-item span { font-size: 1.5rem; }
.q-item:hover { border-color: var(--accent); }
.event-list { list-style: none; padding: 0; margin: 0 0 10px; display: grid; gap: 8px; }
.ev-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; background: var(--c4); }
.ev-dot.test { background: var(--bad); } .ev-dot.assignment { background: var(--mid); } .ev-dot.event { background: var(--c1); }

/* ---------- library ---------- */
.drop { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; border: 2px dashed var(--main); border-radius: 18px; padding: 30px 16px; cursor: pointer; background: var(--surface-2); }
.drop.over, .drop:hover { border-color: var(--accent); background: var(--surface-3); }
.drop-icon { font-size: 2rem; }
.upload-status { margin-top: 10px; min-height: 1.5em; }
.progress-line { display: flex; gap: 8px; align-items: center; font-weight: 700; }
.mat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; }
.mat-grid .card { margin: 0; }
.mat.active { border-color: var(--accent); }
.mat-top { display: flex; gap: 12px; align-items: flex-start; }
.mat-top h3 { margin: 0; overflow-wrap: anywhere; }
.mat-icon { font-size: 1.8rem; }
.reader-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; align-items: start; }
.reader { font-size: 1.04rem; line-height: 1.75; }
.reader h3 { margin-top: 1em; color: var(--accent-strong); }
.reading { background: color-mix(in srgb, var(--main) 45%, transparent); border-radius: 6px; }
.words { margin: 0; display: grid; gap: 8px; }
.words div { background: var(--surface-2); border-radius: 10px; padding: 8px 12px; }
.words dt { font-weight: 800; } .words dd { margin: 0; }
.claim { border-radius: 10px; padding: 10px; margin-top: 8px; }
.claim.supported, .checks .supported { background: var(--good-bg); } .claim.partial, .checks .partial { background: var(--mid-bg); } .claim.unsupported, .checks .unsupported { background: var(--bad-bg); }

/* ---------- explain ---------- */
.recommend { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 10px 14px; margin-bottom: 14px; font-weight: 800; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.explain-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; }
.explain-layout.has-mode { grid-template-columns: 300px minmax(0, 1fr); }
.explain-layout.has-mode .modes { max-height: calc(100vh - 140px); overflow-y: auto; position: sticky; top: 76px; }
.mode-cat h3 { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 12px 0 8px; }
.mode-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.has-mode .mode-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.mode-card { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; cursor: pointer; font-family: var(--font); color: var(--text); text-align: left; transition: border-color .15s, transform .1s; }
.mode-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.mode-card.on { background: var(--main); border-color: var(--accent); color: var(--on-main); }
.mi { font-size: 1.5rem; } .mi.big { font-size: 2.2rem; }
.mn { font-weight: 800; font-size: .9rem; line-height: 1.2; }
.star { position: absolute; top: 6px; right: 8px; font-size: .8rem; }
.output-wrap { min-width: 0; }
.out-toolbar { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.out-title-row { display: flex; gap: 12px; align-items: center; }
.out-name { margin: 0; }
.out-title-row p { margin: 0; }
.out { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); min-height: 200px; }
.out-title { font-size: 1.35rem; color: var(--accent-strong); }
.confused-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 16px 0; }
.engine { font-size: .8rem; font-weight: 800; padding: 3px 10px; border-radius: 99px; background: var(--surface-3); color: var(--muted); }
.engine-chrome, .engine-webllm { background: var(--main); color: var(--on-main); }
.src-legend { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 10px; font-weight: 700; font-size: .9rem; }
.sc.supported { background: color-mix(in srgb, var(--good) 18%, transparent); border-radius: 4px; }
.sc.partial { background: color-mix(in srgb, var(--mid) 22%, transparent); border-radius: 4px; }
.sc.unsupported { background: color-mix(in srgb, var(--bad) 22%, transparent); border-radius: 4px; text-decoration: underline wavy var(--bad); }
.src-legend .sc { padding: 2px 8px; text-decoration: none; }
.check h3 { margin-bottom: 12px; }
.qc { margin-bottom: 16px; }
.qc .q { font-weight: 800; }
.opts { display: grid; gap: 8px; margin: 8px 0; }
.opt { text-align: left; padding: 12px 14px; border-radius: 12px; border: 2px solid var(--border); background: var(--surface-2); color: var(--text); font: 700 .97rem var(--font); cursor: pointer; }
.opt:hover:not(:disabled) { border-color: var(--accent); }
.opt.right { border-color: var(--good); background: var(--good-bg); }
.opt.wrong { border-color: var(--bad); background: var(--bad-bg); }
.opt.gone { opacity: .3; text-decoration: line-through; }
.opt-radio { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 2px solid var(--border); border-radius: 12px; cursor: pointer; font-weight: 600; }
.opt-radio:has(input:checked) { border-color: var(--accent); background: var(--surface-3); }
.opt-radio input { accent-color: var(--accent); margin-top: 4px; }

/* mode renderers */
.keypoints { padding-left: 1.3em; display: grid; gap: 10px; }
.keypoints li { padding-left: 4px; }
.keypoints li::marker { color: var(--accent); font-weight: 900; }
.thirty .big { font-size: 1.25rem; line-height: 1.7; }
.timer-row { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin-top: 12px; }
.timer { font-size: 1.6rem; font-weight: 900; color: var(--accent-strong); min-width: 3ch; }
.timer.running { animation: pulse 1s infinite; }
@keyframes pulse { 50% { transform: scale(1.08); } }
.simple p { font-size: 1.12rem; }
.steps { list-style: none; padding: 0; display: grid; gap: 12px; }
/* only the Step-by-Step list hides its steps until "Next step" (a flowchart's middle boxes must always show) */
.steps > .step { display: none; gap: 14px; background: var(--surface-2); border-radius: 14px; padding: 14px; animation: up .3s; }
.steps > .step.show { display: flex; }
.steps > .step h3 { margin-bottom: 4px; }
.step-num, .proc-num, .qnum { flex: none; width: 36px; height: 36px; border-radius: 50%; background: var(--accent); color: var(--on-accent); display: grid; place-items: center; font-weight: 900; }
.story p { font-size: 1.08rem; line-height: 1.8; }
.story p:first-child::first-letter { font-size: 2.6em; float: left; line-height: .9; margin: 6px 8px 0 0; color: var(--accent); font-weight: 900; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.cards.one { grid-template-columns: 1fr; }
.cards .card { margin: 0; }
.card-kicker { font-weight: 900; color: var(--accent-strong); margin-bottom: 8px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.example .ex, .analogy .an { font-size: 1.05rem; font-weight: 600; }
.dd { margin-bottom: 18px; }
.dd h3 { color: var(--accent-strong); }
.why { background: var(--surface-2); border-radius: 12px; padding: 10px 14px; }
.why ul { margin: 6px 0 0; padding-left: 1.2em; }
.venn { display: block; width: 100%; max-width: 520px; height: auto; margin: 0 auto 12px; }
.venn .va { fill: color-mix(in srgb, var(--c0) 30%, transparent); stroke: var(--c0); stroke-width: 2; }
.venn .vb { fill: color-mix(in srgb, var(--c1) 30%, transparent); stroke: var(--c1); stroke-width: 2; }
.venn .vt { font: 900 17px var(--font); fill: var(--text); }
.venn .vt.small { font-size: 14px; fill: var(--muted); }
.venn .vw { font: 700 14px var(--font); fill: var(--text); }
.compare-cols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
.compare-cols .col { background: var(--surface-2); border-radius: 14px; padding: 14px; }
.compare-cols .both { background: var(--surface-3); }
.compare-cols ul { padding-left: 1.1em; margin: 0; display: grid; gap: 6px; }
.formula-big { font-size: 1.8rem; font-weight: 900; color: var(--accent-strong); font-family: 'Cambria Math', Georgia, serif; margin-bottom: 4px; overflow-wrap: anywhere; }
.calc { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.calc label { display: flex; align-items: center; gap: 6px; font-weight: 800; }
.calc input { width: 90px; }
.calc-out { font-size: 1.2rem; font-weight: 800; }
/* The map viewport: it opens showing the whole map; drag to move, zoom with the buttons, a pinch or Ctrl/⌘ + scroll. */
.viewport { position: relative; overflow: hidden; border: 1px solid var(--border); border-radius: 16px; background: var(--surface-2); touch-action: pan-y; margin: 4px 0 10px; }
.viewport:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.viewport.can-pan { cursor: grab; touch-action: none; }
.viewport.grabbing { cursor: grabbing; user-select: none; }
.viewport.grabbing .mbox { cursor: grabbing; }
.viewport .stage { position: absolute; left: 0; top: 0; margin: 0; will-change: transform; }
.map-zoom { min-width: 3.4em; text-align: center; font-weight: 800; font-size: .85rem; color: var(--muted); }
.map-note .ic { vertical-align: -2px; }
@media print { .viewport { height: auto !important; overflow: visible; border: none; background: none; } .viewport .stage { position: relative; transform: none !important; width: 100% !important; } .map-tools { display: none !important; } }
/* Diagram and mind map: laid out in units (see js/layout.js). One unit is 100cqw / --w,
   so every box, font and line scales together, and the drawing is as big as its text needs. */
.stage { position: relative; width: calc(var(--w) * var(--z, 1) * 1px); aspect-ratio: var(--w) / var(--h); container-type: inline-size; }
.stage .lines { position: absolute; inset: 0; width: 100%; height: 100%; }
.stage .lines line, .stage .lines path { stroke: var(--main); stroke-width: 3; fill: none; }
.stage .lines .thin { stroke-width: 2; opacity: .75; }
.stage .lines .b0 { stroke: var(--c0); } .stage .lines .b1 { stroke: var(--c1); } .stage .lines .b2 { stroke: var(--c2); } .stage .lines .b3 { stroke: var(--c3); } .stage .lines .b4 { stroke: var(--c4); } .stage .lines .b5 { stroke: var(--c5); }
.mbox { --u: calc(100cqw / var(--w)); position: absolute; transform: translate(-50%, -50%); box-sizing: border-box; width: calc(var(--u) * var(--bw)); padding: calc(var(--u) * 9) calc(var(--u) * 12); font-size: calc(var(--u) * var(--fs)); line-height: 1.3; text-align: center; overflow-wrap: anywhere; background: var(--surface); border: 2px solid var(--main); border-radius: calc(var(--u) * 14); box-shadow: var(--shadow); animation: pop .35s backwards; }
.mbox strong { display: block; font-weight: 800; }
.mbox span { display: block; margin-top: calc(var(--u) * 4); font-size: calc(var(--u) * var(--ds)); font-weight: 600; color: var(--muted); }
.mbox.center { z-index: 2; background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.mbox.center span { color: inherit; opacity: .92; }
.mbox.outer { border-style: dashed; }
.mbox[title] { cursor: help; }
.mbox.branch { font-weight: 800; color: #fff; border: none; text-shadow: 0 1px 2px rgba(0, 0, 0, .45); }
.mbox.branch.b0 { background: var(--c0); } .mbox.branch.b1 { background: var(--c1); } .mbox.branch.b2 { background: var(--c2); } .mbox.branch.b3 { background: var(--c3); } .mbox.branch.b4 { background: var(--c4); } .mbox.branch.b5 { background: var(--c5); color: var(--on-main); text-shadow: none; }
.mbox.leaf { text-align: left; border-width: 2px; }
.mbox.leaf.b0 { border-color: var(--c0); } .mbox.leaf.b1 { border-color: var(--c1); } .mbox.leaf.b2 { border-color: var(--c2); } .mbox.leaf.b3 { border-color: var(--c3); } .mbox.leaf.b4 { border-color: var(--c4); } .mbox.leaf.b5 { border-color: var(--c5); }
html.easy-font .mbox { line-height: 1.45; }
.map-tools { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 6px 0; }
.map-tools [data-z-note] { flex: 1 1 220px; }
.connect-list { margin: 8px 0 0; padding-left: 1.2em; } .connect-list li { margin: 6px 0; }
.list-view { display: none; }
@keyframes pop { from { transform: translate(-50%, -50%) scale(.6); opacity: 0; } }
.flows { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.flow { display: flex; flex-direction: column; align-items: center; }
.fnode { background: var(--surface-2); border: 2px solid var(--main); border-radius: 12px; padding: 12px 16px; max-width: 520px; width: 100%; text-align: center; font-weight: 700; animation: up .35s backwards; }
.fnode.start, .fnode.end { border-radius: 999px; background: var(--main); color: var(--on-main); border-color: var(--accent); }
.fnode.decision { border-style: dashed; border-color: var(--c2); }
.fnode em { display: block; font-size: .8rem; color: var(--muted); }
.arrow { color: var(--accent); font-size: 1.4rem; font-weight: 900; line-height: 1.2; text-align: center; padding: 2px 0; }
.arrow span { display: block; font-size: .78rem; color: var(--muted); }
.timeline { list-style: none; padding: 0; position: relative; margin: 10px 0; }
.timeline::before { content: ''; position: absolute; left: 50%; top: 0; bottom: 0; width: 4px; background: var(--main); transform: translateX(-50%); border-radius: 4px; }
.timeline li { position: relative; width: 50%; padding: 0 30px 18px 0; animation: up .4s backwards; }
.timeline li:nth-child(even) { margin-left: 50%; padding: 0 0 18px 30px; }
.tl-dot { position: absolute; top: 14px; right: -9px; width: 18px; height: 18px; border-radius: 50%; background: var(--accent); border: 3px solid var(--surface); }
.timeline li:nth-child(even) .tl-dot { left: -9px; right: auto; }
.tl-card { background: var(--surface-2); border-radius: 14px; padding: 12px 14px; }
.tl-label { font-weight: 900; color: var(--accent-strong); }
.tl-card p { margin: 0; }
.anim { background: var(--surface-2); border-radius: 18px; padding: 18px; outline: none; }
.anim-stage { position: relative; min-height: 270px; }
.scene { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; opacity: 0; pointer-events: none; transition: opacity .5s; padding: 0 10px; }
.scene.on { opacity: 1; pointer-events: auto; }
.scene.on .scene-icon { animation: bounce 1s ease; }
.scene.on h3 { animation: up .5s .15s backwards; }
.scene.on p { animation: up .6s .35s backwards; }
.scene-icon { font-size: 4.2rem; }
.scene h3 { font-size: 1.5rem; color: var(--accent-strong); }
.scene p { font-size: 1.12rem; max-width: 620px; }
@keyframes bounce { 0% { transform: scale(.3) rotate(-15deg); opacity: 0; } 60% { transform: scale(1.15) rotate(5deg); } 100% { transform: scale(1); } }
.anim-bar { margin: 10px 0; }
.anim-progress { height: 6px; background: var(--surface-3); border-radius: 99px; overflow: hidden; }
.anim-progress span { display: block; height: 100%; width: 0; background: var(--accent); }
.dots { display: flex; gap: 6px; justify-content: center; margin-top: 10px; }
.dot { width: 12px; height: 12px; border-radius: 50%; border: none; background: var(--surface-3); cursor: pointer; padding: 0; }
.dot.on { background: var(--accent); }
.toggle { display: flex; gap: 6px; align-items: center; font-weight: 700; }
.chart-tools { margin-bottom: 8px; }
.chart { width: 100%; height: auto; display: block; }
.chart .axis { font: 700 13px var(--font); fill: var(--muted); }
.chart .axis.small { font-size: 11px; }
.chart .val { font: 800 13px var(--font); fill: var(--text); }
.chart .grid { stroke: var(--border); stroke-width: 1; }
.chart .line { fill: none; stroke: var(--accent); stroke-width: 3; }
.chart .c0 { fill: var(--c0); } .chart .c1 { fill: var(--c1); } .chart .c2 { fill: var(--c2); } .chart .c3 { fill: var(--c3); } .chart .c4 { fill: var(--c4); } .chart .c5 { fill: var(--c5); }
.chart .bar { cursor: pointer; outline: none; }
.chart .bar:hover rect, .chart .bar:focus rect, .chart path.bar:hover, .chart path.bar:focus { opacity: .8; }
.chart-note { min-height: 3em; margin-top: 8px; }
.explorer { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; align-items: start; }
.explorer canvas { display: block; width: 100%; background: var(--surface-2); border-radius: 16px; cursor: grab; touch-action: none; }
.ex-panel { background: var(--surface-2); border-radius: 14px; padding: 14px; }
.podcast .script { list-style: none; padding: 0; display: grid; gap: 10px; margin-top: 14px; }
.line { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 14px; background: var(--surface-2); }
.line.leo { background: var(--surface-3); }
.line p { margin: 0; }
.line.reading { outline: 3px solid var(--accent); }
.avatar { flex: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--main); color: var(--on-main); }
.avatar .ic { width: 19px; height: 19px; }
.line.leo .avatar { background: var(--c1); color: #fff; }
.bubble { background: var(--surface); border: 2px solid var(--text); border-radius: 16px; padding: 10px 12px; position: relative; font-weight: 600; margin-right: 34px; }
.bubble strong { display: block; font-size: .78rem; text-transform: uppercase; color: var(--accent-strong); }
.qa h3 { font-size: 1.15rem; }
.feedback { margin-top: 12px; }
.result { border-radius: 12px; padding: 12px 14px; margin-bottom: 10px; }
.result.good { background: var(--good-bg); } .result.mid { background: var(--mid-bg); } .result.bad { background: var(--bad-bg); }
.answer-box { background: var(--surface-2); border-radius: 12px; padding: 12px 14px; margin: 10px 0; }
.score-ring { --p: 0; width: 130px; height: 130px; border-radius: 50%; margin: 0 auto 12px; display: grid; place-items: center; background: conic-gradient(var(--accent) calc(var(--p) * 1%), var(--surface-3) 0); }
.score-ring span { width: 100px; height: 100px; border-radius: 50%; background: var(--surface); display: grid; place-items: center; font-size: 1.7rem; font-weight: 900; }
.score-ring.small { width: 70px; height: 70px; margin: 0; } .score-ring.small span { width: 54px; height: 54px; font-size: 1rem; }
.diff { background: var(--surface); border-radius: 8px; padding: 8px; margin-top: 6px; line-height: 1.8; }
ins { background: var(--good-bg); color: var(--good); text-decoration: none; padding: 0 3px; border-radius: 4px; font-weight: 700; }
del { background: var(--bad-bg); color: var(--bad); padding: 0 3px; border-radius: 4px; }
.checks, .mistakes { list-style: none; padding: 0; display: grid; gap: 10px; }
.checks li, .mistakes li { border-radius: 12px; padding: 12px; background: var(--surface-2); }
.checks li p, .mistakes li p { margin: 2px 0; }
.sim-body .card { margin-bottom: 12px; }
.slider { display: grid; grid-template-columns: minmax(0, 1fr) 2fr 50px; gap: 10px; align-items: center; margin: 10px 0; font-weight: 700; }
.slider input { accent-color: var(--accent); width: 100%; }
.sim-result { font-size: 1.5rem; font-weight: 900; margin: 10px 0; }
.chain { display: grid; gap: 12px; }
.chain-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.cause { background: var(--surface-3); border: 2px solid var(--main); max-width: 100%; text-align: left; }
.cause.on { background: var(--main); }
.chain-arrow { color: var(--accent-strong); font-weight: 900; }
.effect { background: var(--good-bg); border-radius: 12px; padding: 10px 14px; font-weight: 700; }
.effect.pop { animation: pop2 .4s; }
@keyframes pop2 { from { transform: scale(.7); opacity: 0; } }
.process { display: grid; gap: 10px; margin-bottom: 12px; }
.proc-step { display: flex; gap: 12px; align-items: center; padding: 12px; border-radius: 12px; background: var(--surface-2); border: 2px solid transparent; transition: all .3s; opacity: .55; }
.proc-step p { margin: 0; }
.proc-step.active { border-color: var(--accent); opacity: 1; transform: scale(1.02); background: var(--surface-3); }
.proc-step.done { opacity: 1; }
.proc-step.done .proc-num { background: var(--good); }
.match { display: grid; grid-template-columns: 1fr 2fr; gap: 12px; }
.match-col { display: grid; gap: 8px; align-content: start; }
.match .btn { justify-content: flex-start; text-align: left; font-weight: 700; border: 2px solid var(--border); background: var(--surface-2); }
.match .btn.on { border-color: var(--accent); background: var(--main); }
.match .btn.done { border-color: var(--good); background: var(--good-bg); opacity: .8; }
.match .btn.wrong { border-color: var(--bad); animation: shake .3s; }
@keyframes shake { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
.match-score { font-weight: 800; margin-top: 10px; }

/* chat */
.chat { display: flex; flex-direction: column; gap: 10px; overflow-y: auto; padding: 4px; }
.chat-card { display: flex; flex-direction: column; height: calc(100vh - 210px); min-height: 420px; }
.chat-card .chat, .drawer .chat, .chat-box .chat { flex: 1; min-height: 0; }
.chat-box { display: flex; flex-direction: column; height: 520px; }
.msg { display: flex; gap: 8px; align-items: flex-end; max-width: 92%; }
.msg.me { align-self: flex-end; }
.msg .bubble { margin: 0; border: none; background: var(--surface-2); border-radius: 16px 16px 16px 4px; font-weight: 600; }
.msg .bubble::after { display: none; }
.msg.me .bubble { background: var(--accent); color: var(--on-accent); border-radius: 16px 16px 4px 16px; }
.msg .bubble p:last-child { margin: 0; }
.msg .bubble ul { margin: 4px 0; padding-left: 1.2em; }
.msg .bubble .card { box-shadow: none; padding: 10px; margin: 0; background: transparent; border: none; }
.chat-quick { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0; }
.chat-input { display: flex; gap: 8px; align-items: flex-end; }
.chat-input textarea { min-height: 46px; max-height: 140px; }
.teacher-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 18px; align-items: start; }
.memory { list-style: none; padding: 0; display: grid; gap: 8px; }
.memory li { display: flex; justify-content: space-between; gap: 8px; background: var(--surface-2); padding: 8px 10px; border-radius: 10px; }
.teach-score { font-size: 1.1rem; }
.fab { position: fixed; right: 22px; bottom: 22px; z-index: 30; display: flex; align-items: center; gap: 8px; border: none; border-radius: 99px; padding: 12px 18px; background: var(--accent); color: var(--on-accent); font: 900 1rem var(--font); box-shadow: 0 8px 24px rgba(80, 50, 140, .35); cursor: pointer; }
.fab span { font-size: .95rem; }
.drawer { position: fixed; right: 0; top: 0; bottom: 0; width: min(420px, 100vw); background: var(--surface); border-left: 1px solid var(--border); z-index: 60; display: flex; flex-direction: column; transform: translateX(100%); transition: transform .2s; box-shadow: -10px 0 40px rgba(0, 0, 0, .15); }
.drawer.open { transform: none; }
.drawer-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.drawer-body { flex: 1; display: flex; flex-direction: column; padding: 12px; min-height: 0; }
.hl-pop { position: absolute; z-index: 70; }
.hl-card { position: absolute; z-index: 71; width: min(330px, 92vw); padding: 14px; }
.hl-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }

/* quiz */
.quiz-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.q-text { font-size: 1.18rem; font-weight: 800; }
.exam legend { display: flex; gap: 10px; align-items: flex-start; font-size: 1.05rem; }
.exam .q { border: 1px solid var(--border); }
.review { padding-left: 1.2em; display: grid; gap: 10px; }
.review li { padding: 10px 12px; border-radius: 12px; background: var(--surface-2); }
.review li.wrong { background: var(--bad-bg); }
.review li p { margin: 2px 0; }
.result-card h2 { margin-top: 6px; }
.mat-checks { display: grid; gap: 6px; }

/* flashcards */
.fc-wrap { max-width: 720px; margin: 0 auto 18px; }
.fc-head { display: flex; justify-content: space-between; }
.flashcard { display: block; width: 100%; height: 280px; perspective: 1200px; border: none; background: none; cursor: pointer; padding: 0; font-family: var(--font); color: var(--text); margin: 8px 0 16px; }
.fc-inner { position: relative; width: 100%; height: 100%; transition: transform .5s; transform-style: preserve-3d; }
.flashcard.flipped .fc-inner { transform: rotateY(180deg); }
.fc-face { position: absolute; inset: 0; backface-visibility: hidden; border-radius: 20px; display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 24px; text-align: center; border: 2px solid var(--main); background: var(--surface-2); overflow-y: auto; }
.fc-face p { font-size: 1.3rem; font-weight: 800; margin: 8px 0; }
.fc-face.back { transform: rotateY(180deg); background: var(--surface-3); }
.fc-face.back p { font-size: 1.12rem; font-weight: 700; }
.fc-label { font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; color: var(--accent-strong); font-weight: 900; }

/* study session */
.stepper { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 0 0 16px; }
.stepper button { width: 100%; display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 10px; font: 800 .88rem var(--font); color: var(--muted); cursor: pointer; text-align: left; }
.stepper button:disabled { cursor: default; opacity: .7; }
.stepper button span { flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-3); }
.stepper li.on button { border-color: var(--accent); color: var(--text); }
.stepper li.on span { background: var(--accent); color: var(--on-accent); }
.stepper li.done span { background: var(--good); color: var(--on-status); }
.study-para { font-size: 1.15rem; line-height: 1.85; }
.study-body .out { box-shadow: none; }

/* homework */
.hw-preview img { max-height: 260px; border-radius: 12px; margin: 12px 0; }
.hw-steps { display: grid; gap: 10px; padding-left: 1.3em; }
.hw-steps li { display: none; background: var(--surface-2); padding: 12px; border-radius: 12px; animation: up .3s; }
.hw-steps li.show, .hw-steps.all li { display: list-item; }
.math { font-family: 'Cambria Math', Georgia, serif; font-size: 1.25rem; margin-top: 4px; overflow-wrap: anywhere; }
.try { margin: 10px 0; }

/* calendar */
.cal-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 18px; align-items: start; }
.cal-nav { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.cal-nav h2 { margin: 0; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal-dow { text-align: center; font-weight: 800; color: var(--muted); font-size: .8rem; padding: 4px; }
.cal-cell { min-height: 92px; background: var(--surface-2); border-radius: 10px; padding: 4px; display: flex; flex-direction: column; gap: 3px; cursor: pointer; min-width: 0; }
.cal-cell:hover { outline: 2px solid var(--main); }
.cal-cell.empty { background: transparent; cursor: default; outline: none; }
.cal-cell.today { outline: 2px solid var(--accent); }
.cal-d { font-weight: 800; font-size: .85rem; }
.cal-ev { border: none; text-align: left; font: 700 .72rem var(--font); padding: 2px 5px; border-radius: 6px; background: var(--c4); color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.cal-ev.test { background: var(--bad); } .cal-ev.assignment { background: var(--mid); } .cal-ev.event { background: var(--c1); }
.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: .85rem; font-weight: 700; }

/* plan, grades, mastery */
.plan-days { list-style: none; padding: 0; display: grid; gap: 8px; }
.plan-days > li { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 12px; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); }
.plan-days > li.today { outline: 2px solid var(--accent); background: var(--surface-3); }
.plan-days > li.past { opacity: .65; }
.pd-date { display: flex; flex-direction: column; }
.plan-days ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; }
.plan-days li li.done { text-decoration: line-through; opacity: .7; }
.plan-days input { accent-color: var(--accent); }
.sub-row { display: grid; grid-template-columns: 130px minmax(0, 1fr) 50px 80px; gap: 10px; align-items: center; margin: 8px 0; }
.mastery-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.mastery-list { list-style: none; padding: 0; display: grid; gap: 8px; }
.mastery-list li { display: grid; grid-template-columns: minmax(120px, 1fr) minmax(80px, 2fr) auto auto auto; gap: 10px; align-items: center; }
.mt-name { font-weight: 800; overflow-wrap: anywhere; }
.engine-box { background: var(--surface-2); border-radius: 14px; padding: 14px; margin-top: 12px; }
.engine-box .meter { margin-top: 8px; }

/* ---------- icons ---------- */
.ic { width: 1.15em; height: 1.15em; flex: none; vertical-align: -0.2em; overflow: visible; }
.ic.good { color: var(--good); } .ic.bad { color: var(--bad); } .ic.mid { color: var(--mid); }
.ic.gold { color: #D99A1E; } .ic.flame { color: #E8743B; }
.ic.spin { animation: spin 1s linear infinite; }
.btn .ic { width: 1.12em; height: 1.12em; }
.icon-btn .ic { width: 20px; height: 20px; vertical-align: middle; }
.ni .ic { width: 20px; height: 20px; vertical-align: middle; }
.logo .ic { width: 22px; height: 22px; color: var(--on-main); }
.mi .ic { width: 26px; height: 26px; color: var(--accent); }
.mi.big .ic { width: 36px; height: 36px; }
.mode-card.on .mi .ic { color: var(--on-main); }
.star .ic { width: 15px; height: 15px; }
.q-item .ic { width: 26px; height: 26px; color: var(--accent); }
.empty-icon .ic { width: 54px; height: 54px; color: var(--accent); stroke-width: 1.6; }
.drop-icon .ic { width: 36px; height: 36px; color: var(--accent); }
.mat-icon { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: var(--surface-3); color: var(--accent-strong); flex: none; }
.mat-icon .ic { width: 24px; height: 24px; }
.scene-icon { display: grid; place-items: center; width: 120px; height: 120px; border-radius: 32px; background: var(--surface-3); color: var(--accent-strong); margin-bottom: 10px; }
.scene-icon .ic { width: 64px; height: 64px; stroke-width: 1.6; }
.cd-num .ic { width: 50px; height: 50px; color: var(--on-main); }
.tile-num .ic { width: .85em; height: .85em; vertical-align: -0.08em; }
.fab .ic { width: 22px; height: 22px; }
.chip .ic { width: 1em; height: 1em; }
.arrow .ic { width: 22px; height: 22px; display: block; margin: 0 auto; }
.engine .ic { width: 1em; height: 1em; }
.ai-chip .ic { width: 16px; height: 16px; vertical-align: -3px; }
.save .ic { width: 14px; height: 14px; vertical-align: -2px; }
.tip > .ic:first-child { color: var(--accent-strong); }
.card-kicker .ic { color: var(--accent); }
.page-head h1 .ic, h2 .ic, h3 .ic { color: var(--accent); }
.countdown h2 .ic, .countdown .ic { color: var(--on-main); }
.mode-cat h3 .ic { color: inherit; }
.result .ic, .claim .ic, .checks .ic, .qc-fb .ic, .review .ic, .src-legend .ic { width: 1.2em; height: 1.2em; }
.stepper button span .ic { width: 15px; height: 15px; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .explain-layout.has-mode { grid-template-columns: 1fr; }
  .explain-layout.has-mode .modes { position: static; max-height: none; }
  .has-mode .mode-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
  .reader-grid, .teacher-grid, .cal-layout { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 270px; z-index: 40; transform: translateX(-100%); transition: transform .2s; }
  .sidebar.open { transform: none; }
  .menu-btn { display: inline-block; }
  .grid2 { grid-template-columns: 1fr; }
  .compare-cols { grid-template-columns: 1fr; }
  .explorer { grid-template-columns: 1fr; }
  .stepper { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  main { padding: 16px; }
  .topbar { padding: 8px 16px; gap: 8px; }
  .mat-pick { flex: 1; min-width: 0; } .mat-pick select { width: 100%; max-width: none; }
  .level { order: 5; width: 100%; } .level input { flex: 1; }
  .save { display: none; }
  .countdown { flex-direction: column; gap: 12px; padding: 18px; }
  .cd-num { width: 70px; height: 70px; font-size: 2.1rem; }
  .cd-body h2 { font-size: 1.3rem; }
  .list-view { display: block; padding-left: 1.1em; }
  .list-view li { margin: 6px 0; }
  .timeline::before { left: 10px; }
  .timeline li, .timeline li:nth-child(even) { width: 100%; margin-left: 0; padding: 0 0 16px 34px; }
  .tl-dot, .timeline li:nth-child(even) .tl-dot { left: 1px; right: auto; }
  .match { grid-template-columns: 1fr; }
  .slider { grid-template-columns: 1fr; }
  .cal-cell { min-height: 58px; }
  .cal-ev { font-size: 0; height: 8px; padding: 0; }
  .plan-days > li { grid-template-columns: 1fr; }
  .sub-row { grid-template-columns: 90px minmax(0, 1fr) 44px; } .sub-row > :last-child { display: none; }
  .mastery-list li { grid-template-columns: 1fr 1fr; }
  .fab span { display: none; }
  .fab { padding: 14px 16px; }
  .flashcard { height: 240px; }
  .explorer + .list-view { display: none; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}


/* =========================================================
   Improvements: reading settings, search, player bar, etc.
   ========================================================= */
/* Reading and accessibility settings */
html[data-text="large"] { font-size: 112.5%; }
html[data-text="xl"] { font-size: 125%; }
html.easy-font { --font: 'Lexend', 'Nunito', ui-rounded, system-ui, sans-serif; }
html.easy-font body { line-height: 1.8; letter-spacing: .01em; word-spacing: .08em; }
html.easy-font .reader p, html.easy-font .reader li { max-width: 68ch; }
html.reduce-motion *, html.reduce-motion *::before, html.reduce-motion *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
kbd { display: inline-block; min-width: 1.6em; padding: 0 .4em; border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 6px; background: var(--surface-2); font: 800 .8em var(--font); text-align: center; color: var(--text); }
.kbd-tip { margin: 6px 0 0; }
.check-row { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; cursor: pointer; }
.check-row input { margin-top: 5px; accent-color: var(--accent); width: 18px; height: 18px; flex: none; }
.nowrap { white-space: nowrap; }

/* Search boxes */
.search-box { position: relative; display: flex; align-items: center; min-width: 0; }
.search-box > .ic { position: absolute; left: 11px; color: var(--muted); pointer-events: none; }
.search-box .input { padding-left: 36px; margin: 0; width: 100%; }
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.section-head h2 { margin: 0; }
.mode-search { margin-bottom: 4px; }
.search-btn { width: auto; padding: 0 10px; gap: 6px; display: inline-flex; align-items: center; }
.kbd-hint { font: 700 .85rem var(--font); color: var(--muted); }

/* Search everything (Ctrl/⌘ + K) */
.palette-wrap { position: fixed; inset: 0; z-index: 90; background: rgba(20, 12, 35, .45); display: flex; justify-content: center; align-items: flex-start; padding: 10vh 16px 16px; }
.palette { width: min(640px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: 18px; box-shadow: 0 20px 60px rgba(0, 0, 0, .3); overflow: hidden; display: flex; flex-direction: column; max-height: 75vh; }
.palette-input { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--border); color: var(--muted); }
.palette-input input { flex: 1; min-width: 0; border: none; outline: none; background: transparent; font: 700 1.05rem var(--font); color: var(--text); }
.palette-list { list-style: none; margin: 0; padding: 6px; overflow-y: auto; }
.pal-group { font-size: .74rem; font-weight: 900; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 10px 10px 4px; }
.pal-item { display: flex; gap: 12px; align-items: center; padding: 9px 10px; border-radius: 10px; cursor: pointer; }
.pal-item.on { background: var(--surface-3); }
.pal-icon { flex: none; width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: var(--surface-2); color: var(--accent-strong); }
.pal-text { display: flex; flex-direction: column; min-width: 0; }
.pal-text > span:first-child { font-weight: 700; overflow: hidden; text-overflow: ellipsis; }
.pal-empty { padding: 16px; }
.palette-foot { margin: 0; padding: 8px 14px; border-top: 1px solid var(--border); }
.sr-help { position: fixed; left: -999px; bottom: 8px; z-index: 31; }
.sr-help:focus { left: 8px; }

/* Read Aloud player bar */
.speak-bar { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 60; display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--border); border-radius: 99px; padding: 6px 8px 6px 16px; box-shadow: 0 10px 30px rgba(40, 20, 80, .25); width: min(460px, calc(100vw - 32px)); }
.speak-bar .sb-icon { color: var(--accent-strong); display: grid; }
.speak-bar .sb-text { font-weight: 800; font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.speak-bar .sb-meter { min-width: 40px; height: 6px; }
.speak-bar.paused .sb-icon { opacity: .5; }

/* Dashboard: next step, daily goal, week */
.today-row { margin-bottom: 18px; }
.next-step { display: flex; gap: 16px; align-items: flex-start; border: 2px solid var(--main); }
.next-step h2 { margin-bottom: .3em; }
.next-icon { flex: none; width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; background: var(--main); color: var(--on-main); }
.next-icon .ic { width: 26px; height: 26px; }
.card-kicker { font-size: .75rem; text-transform: uppercase; letter-spacing: .07em; font-weight: 900; color: var(--accent-strong); margin: 0 0 4px; }
.goal { display: flex; gap: 18px; align-items: center; }
.goal-body { flex: 1; min-width: 0; }
.goal h2 { margin-bottom: .2em; }
.score-ring.met { background: conic-gradient(var(--good) 100%, var(--surface-3) 0); }
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; height: 74px; margin-top: 8px; }
.wk-col { display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; min-width: 0; }
.wk-bar { width: 100%; max-width: 26px; background: var(--surface-3); border-radius: 6px 6px 3px 3px; }
.wk-col.met .wk-bar { background: var(--good); }
.wk-col.today .wk-bar { background: var(--accent); }
.wk-col.today.met .wk-bar { background: var(--good); }
.wk-day { font-size: .72rem; font-weight: 800; color: var(--muted); }

/* Reader: key terms, outline, find */
dfn.term { font-style: normal; border-bottom: 2px dotted var(--accent); cursor: help; position: relative; }
dfn.term:hover::after, dfn.term:focus::after { content: attr(data-def); position: absolute; left: 50%; bottom: calc(100% + 8px); transform: translateX(-50%); width: max-content; max-width: min(280px, 80vw); background: var(--text); color: var(--bg); font-size: .85rem; font-weight: 600; line-height: 1.4; padding: 8px 10px; border-radius: 10px; z-index: 40; box-shadow: var(--shadow); white-space: normal; }
.find-bar { display: flex; align-items: center; gap: 10px; padding: 10px 14px; margin-bottom: 14px; }
.reader mark { background: #FBE38A; color: #2A2140; border-radius: 3px; padding: 0 1px; }
.reader mark.current { background: #F5A623; outline: 2px solid #F5A623; }
.outline { margin: 0; padding-left: 1.3em; display: grid; gap: 4px; }
.outline a { font-weight: 700; text-decoration: none; }
.outline a:hover { text-decoration: underline; }
.reader h3.flash { animation: flash 1.2s; }
@keyframes flash { 0%, 60% { background: var(--surface-3); } 100% { background: transparent; } }
.reader h3 { scroll-margin-top: 80px; border-radius: 6px; }

/* Quizzes and exams */
.opt { display: flex; gap: 10px; align-items: center; }
.opt-key { flex: none; width: 24px; height: 24px; border-radius: 7px; display: grid; place-items: center; background: var(--surface-3); color: var(--muted); font-size: .78rem; font-weight: 900; }
.exam-head { position: sticky; top: 64px; z-index: 5; background: var(--bg); padding: 6px 0; gap: 12px; flex-wrap: wrap; }
.exam-nav { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 14px; }
.qdot { width: 34px; height: 34px; border-radius: 10px; border: 2px solid var(--border); background: var(--surface); font: 800 .85rem var(--font); color: var(--text); cursor: pointer; }
.qdot.done { background: var(--main); border-color: var(--main); color: var(--on-main); }
.qdot.flagged { border-color: var(--mid); box-shadow: inset 0 -3px 0 var(--mid); }
.flag { display: flex; width: fit-content; margin: 0 0 8px auto; border: 1px solid var(--border); background: transparent; color: var(--muted); border-radius: 99px; padding: 3px 10px; font: 700 .8rem var(--font); cursor: pointer; gap: 4px; align-items: center; }
.flag.on { background: var(--mid-bg); color: var(--mid); border-color: var(--mid); }
.timer.low { color: var(--bad); }
.topic-break { list-style: none; padding: 0; margin: 0 0 10px; display: grid; gap: 8px; }
.topic-break li { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 2fr) auto; gap: 10px; align-items: center; }
.weak-opt { display: flex; gap: 8px; align-items: center; margin: 6px 0 12px; font-weight: 700; }
.weak-opt input { accent-color: var(--accent); }
.result-card.celebrate { position: relative; overflow: hidden; }
.result-card.celebrate::before, .result-card.celebrate::after { content: ''; position: absolute; inset: -20px 0 auto; height: 140%; pointer-events: none; background-image: radial-gradient(circle, var(--c1) 3px, transparent 4px), radial-gradient(circle, var(--c2) 3px, transparent 4px), radial-gradient(circle, var(--c3) 3px, transparent 4px), radial-gradient(circle, var(--c4) 3px, transparent 4px); background-size: 90px 110px, 130px 90px, 110px 140px, 70px 120px; background-position: 10px 0, 40px 30px, 70px 10px, 20px 60px; animation: confetti 2.4s ease-out 1 forwards; opacity: 0; }
.result-card.celebrate::after { animation-delay: .35s; background-position: 50px 20px, 0 50px, 30px 0, 60px 40px; }
@keyframes confetti { 0% { transform: translateY(-40%); opacity: 1; } 100% { transform: translateY(30%); opacity: 0; } }

/* Flashcards */
.fc-actions .btn { min-width: 110px; justify-content: center; }
.flashcard.swipe-right .fc-inner { transform: translateX(40%) rotate(8deg); opacity: .4; }
.flashcard.swipe-left .fc-inner { transform: translateX(-40%) rotate(-8deg); opacity: .4; }
.flashcard.flipped.swipe-right .fc-inner { transform: rotateY(180deg) translateX(-40%) rotate(-8deg); }
.flashcard.flipped.swipe-left .fc-inner { transform: rotateY(180deg) translateX(40%) rotate(8deg); }
.edit-cards { list-style: none; padding: 0; display: grid; gap: 10px; counter-reset: card; }
.edit-card { display: grid; grid-template-columns: 1fr 1fr auto; gap: 12px; align-items: start; margin: 0; }
.edit-card .field { margin: 0; }
.sticky-actions { position: sticky; bottom: 0; background: var(--bg); padding: 12px 0; z-index: 4; }

/* AI Teacher */
.mic.on { background: var(--bad-bg); color: var(--bad); border-color: var(--bad); animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--bad) 20%, transparent); } }
.msg-tools { display: flex; gap: 2px; margin-top: 4px; opacity: .65; }
.msg-tools .icon-btn { width: 30px; height: 30px; }
.msg:hover .msg-tools, .msg-tools:focus-within { opacity: 1; }
.followups { display: flex; flex-wrap: wrap; gap: 6px; padding-left: 42px; }
.followups .chip { cursor: pointer; background: var(--surface); }
.followups .chip:hover { border-color: var(--accent); }

/* Homework Helper */
.hw-recent { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 12px; }
.hw-recent .chip { cursor: pointer; }
.similar .formula-big { margin: 8px 0 12px; }
.math { white-space: normal; }

/* Calendar, plan, settings */
.cal-cd { display: inline-block; background: rgba(255, 255, 255, .3); border-radius: 4px; padding: 0 3px; margin-right: 4px; font-weight: 900; }
.cal-nav [data-today] { margin-left: 8px; }
.plan-progress { display: flex; align-items: center; gap: 12px; margin: 6px 0 12px; flex-wrap: wrap; }
.plan-progress .meter { max-width: 320px; }
.storage { display: grid; gap: 6px; margin: 8px 0 14px; max-width: 480px; }
.chip.good { background: var(--good-bg); color: var(--good); border-color: transparent; }
.chip.bad { background: var(--bad-bg); color: var(--bad); border-color: transparent; }
.mastery-head > div:first-child { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.keys-table td:first-child { white-space: nowrap; width: 1%; }

@media (max-width: 860px) {
  .kbd-hint { display: none; }
  .search-btn { padding: 0; width: 40px; justify-content: center; }
  .exam-head { top: 56px; }
}
@media (max-width: 640px) {
  .next-step { flex-direction: column; }
  .goal { flex-direction: column; align-items: flex-start; }
  .edit-card { grid-template-columns: 1fr; }
  .topic-break li { grid-template-columns: 1fr auto; } .topic-break li .meter { grid-column: 1 / -1; grid-row: 2; }
  .speak-bar { bottom: 84px; }
  .fc-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .fc-actions .btn { min-width: 0; white-space: nowrap; padding: 10px 6px; font-size: .9rem; gap: 4px; }
  .fc-actions [data-act=speak] { grid-column: 1 / -1; }
  .kbd-tip { display: none; }
  .palette-wrap { padding-top: 16px; }
}

/* =========================================================
   Clearer explanations: labelled blocks, inputs → outputs, key words,
   recaps, check-yourself questions, and "How this works" guides
   ========================================================= */
.xblock { background: var(--surface-2); border: 1px solid var(--border); border-radius: 14px; padding: 12px 16px; margin: 0 0 12px; }
.xblock > :last-child { margin-bottom: 0; }
.xblock .words div { background: var(--surface); }
.xlabel { display: flex; align-items: center; gap: 6px; font-size: .8rem; font-weight: 900; text-transform: uppercase; letter-spacing: .04em; color: var(--accent-strong); margin: 0 0 6px; }
.xlabel .ic { width: 1.05em; height: 1.05em; }
.xlabel.small { font-size: .72rem; margin: 8px 0 4px; }
.xblock.big { background: var(--surface-3); border-color: transparent; border-left: 4px solid var(--accent); }
.big-idea { font-size: 1.12rem; font-weight: 700; margin: 0; }
.xblock.picture .an { font-style: italic; margin-bottom: 4px; }
.xblock.why { border-left: 4px solid var(--c2); }
.xblock.recap { border-left: 4px solid var(--good); margin-top: 16px; }
.xblock.recap .xlabel { color: var(--good); }
.recap-list, .insights { margin: 0; padding-left: 1.2em; display: grid; gap: 4px; }
.mini-steps { margin: 0; padding-left: 1.4em; display: grid; gap: 4px; font-weight: 700; }
.mini-steps li::marker { color: var(--accent); font-weight: 900; }
.intro { margin-bottom: 12px; }
.intro .ic, .read-hint .ic, .study-tip .ic { width: 1.05em; height: 1.05em; vertical-align: -2px; color: var(--accent-strong); }
.read-hint { margin: 10px 0; }
.study-tip { margin-top: 12px; }
.kp-group { font-size: .95rem; color: var(--accent-strong); margin: 14px 0 6px; }
/* inputs → process → outputs */
.io-box { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 10px; align-items: center; margin: 4px 0 14px; }
.io-col { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; min-width: 0; }
.xblock .io-col { background: var(--surface); }
.io-col.io-out { border-color: color-mix(in srgb, var(--good) 45%, var(--border)); }
.io-k { display: block; font-size: .72rem; font-weight: 900; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-bottom: 4px; }
.io-col ul { margin: 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 6px; }
.io-col li { background: var(--surface-3); border-radius: 99px; padding: 2px 10px; font-weight: 800; font-size: .9rem; }
.io-col.io-out li { background: var(--good-bg); color: var(--good); }
.io-mid { display: flex; align-items: center; gap: 4px; font-weight: 900; color: var(--accent-strong); text-align: center; }
.io-mid span { max-width: 140px; line-height: 1.2; }
.io-mid .ic { flex: none; }
/* step-by-step extras */
.step-body { min-width: 0; flex: 1; }
.step-why { margin: 6px 0 0; font-size: .93rem; }
.step-words { margin-top: 6px; }
.mini-words { margin: 0; display: grid; gap: 4px; }
.mini-words div { display: flex; gap: 6px; flex-wrap: wrap; font-size: .9rem; }
.mini-words dt { font-weight: 800; } .mini-words dt::after { content: ':'; }
.mini-words dd { margin: 0; color: var(--muted); }
.step-tip { display: flex; gap: 6px; align-items: flex-start; margin: 8px 0 0; font-size: .9rem; color: var(--muted); }
.step-tip .ic { flex: none; margin-top: 3px; color: var(--accent-strong); }
.step-summary { margin-top: 12px; }
/* examples, analogies, deep dive */
.your-turn { border-style: dashed; }
.your-turn h3 .ic { color: var(--accent-strong); }
.dd-num { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: var(--on-accent); font-size: .85rem; vertical-align: 2px; }
.dd-overview { margin-top: -2px; }
.dd-example { display: flex; gap: 8px; align-items: flex-start; background: var(--surface-2); border-radius: 12px; padding: 10px 14px; margin: 10px 0; }
.dd-example .ic { flex: none; margin-top: 3px; color: var(--accent-strong); }
.dd-check { margin-top: 10px; border: 1px dashed var(--main); border-radius: 12px; padding: 8px 14px; }
.dd-check summary { cursor: pointer; font-weight: 800; }
.dd-check summary .ic { vertical-align: -3px; color: var(--accent-strong); }
.dd-check p { margin: 8px 0 2px; }
/* mind map guide, flowchart titles, timeline gaps */
.map-guide { margin-top: 14px; background: var(--surface-2); border-radius: 14px; padding: 10px 16px; }
.map-guide summary { cursor: pointer; font-weight: 900; color: var(--accent-strong); }
.map-guide summary .ic { vertical-align: -3px; }
.guide-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; margin-top: 10px; }
.guide-branch { background: var(--surface); border-radius: 12px; padding: 10px 12px; border-top: 4px solid var(--c0); }
.guide-branch.b1 { border-top-color: var(--c1); } .guide-branch.b2 { border-top-color: var(--c2); } .guide-branch.b3 { border-top-color: var(--c3); } .guide-branch.b4 { border-top-color: var(--c4); } .guide-branch.b5 { border-top-color: var(--c5); }
.guide-branch h4 { margin: 0 0 6px; font-size: .95rem; }
.guide-branch dl { margin: 0; display: grid; gap: 6px; }
.guide-branch dt { font-weight: 800; font-size: .9rem; } .guide-branch dd { margin: 0; font-size: .87rem; color: var(--muted); }
.fn-title { display: block; font-weight: 900; margin-bottom: 2px; }
.fnode .fn-title + .fact { font-weight: 600; font-size: .92rem; }
.tl-gap { display: inline-block; font-size: .75rem; font-weight: 800; color: var(--muted); background: var(--surface-3); border-radius: 99px; padding: 1px 9px; margin-bottom: 6px; }
.tl-head { display: block; margin: 2px 0; }
.step-more { margin: 6px 0 0; padding-left: 1.1em; } .step-more li { margin: 4px 0; }
.tl-facts { margin: 6px 0 0; padding-left: 1.1em; font-size: .93rem; } .tl-facts li { margin: 3px 0; }
.fnode.has-facts { text-align: left; }
.fn-facts { margin: 6px 0 0; padding-left: 1.1em; font-weight: 600; font-size: .93rem; } .fn-facts li { margin: 3px 0; }
.fnode.start .fn-facts, .fnode.end .fn-facts { color: inherit; }
.fnode.has-facts.start, .fnode.has-facts.end { border-radius: 18px; }
.fn-words { margin: 8px 0 0; font-size: .82rem; font-weight: 600; text-align: left; color: var(--muted); } .fn-words dt { display: inline; font-weight: 800; } .fn-words dd { display: inline; margin: 0; }
.fnode.start .fn-words, .fnode.end .fn-words { color: inherit; opacity: .9; }
.fnode:not(.has-facts) .fn-words { text-align: center; }
/* mode guide under the toolbar */
.mode-guide { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 8px 14px; margin-bottom: 12px; font-size: .92rem; }
.mode-guide summary { cursor: pointer; }
.mode-guide p { margin: 8px 0 2px; }
.mode-guide .ic { width: 1em; height: 1em; vertical-align: -2px; color: var(--accent-strong); }
/* quizzes and flashcards: why an answer is wrong, memory hooks */
.why-wrong { display: flex; gap: 6px; align-items: flex-start; margin: 6px 0; }
.why-wrong .ic { flex: none; margin-top: 3px; }
.result .muted .ic { width: 1em; height: 1em; vertical-align: -2px; }
.fc-extra { font-size: .9rem !important; font-weight: 600 !important; color: var(--muted); margin-top: 4px !important; }
.hw-why { display: flex; gap: 6px; align-items: flex-start; margin: 8px 0 0; font-size: .92rem; color: var(--muted); }
.hw-why .ic { flex: none; margin-top: 3px; color: var(--accent-strong); }
/* "How this works" guide at the top of each page */
.howto { background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--main); border-radius: 14px; padding: 10px 16px; margin: 0 0 16px; }
.howto summary { cursor: pointer; font-weight: 800; color: var(--accent-strong); list-style-position: outside; }
.howto summary .ic { width: 1.1em; height: 1.1em; vertical-align: -3px; }
.howto ol { margin: 8px 0 6px; padding-left: 1.4em; display: grid; gap: 4px; }
.howto-tip { margin: 6px 0 2px; font-size: .9rem; color: var(--muted); }
.howto-tip .ic { width: 1em; height: 1em; vertical-align: -2px; color: var(--accent-strong); }
@media (max-width: 640px) {
  .io-box { grid-template-columns: 1fr; }
  .io-mid { justify-content: center; transform: none; }
  .io-mid .ic { transform: rotate(90deg); }
}

/* ---------- 3D Explorer ---------- */
.x3d-stage { position: relative; }
.x3d-stage canvas { display: block; width: 100%; background: var(--surface-2); border-radius: 16px; cursor: grab; touch-action: none; }
.x3d-stage canvas.grabbing { cursor: grabbing; }
.x3d-hint { position: absolute; left: 12px; bottom: 10px; display: inline-flex; align-items: center; gap: 6px; font-size: .8rem; font-weight: 700; color: var(--muted); background: var(--surface); border: 1px solid var(--border); border-radius: 99px; padding: 3px 10px; pointer-events: none; transition: opacity .5s; }
.x3d-hint .ic { width: 1em; height: 1em; }
.x3d-hint.gone { opacity: 0; }
.x3d-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 10px 0; }
.x3d-tools .btn.on { background: var(--surface-3); border-color: var(--main); color: var(--text); }
.x3d-zoom { display: inline-flex; gap: 2px; }
.x3d-progress { margin-left: auto; display: inline-flex; align-items: center; gap: 8px; font-size: .87rem; font-weight: 800; color: var(--muted); }
.x3d-progress .meter { width: 90px; flex: none; }
.ex-panel { background: var(--surface-2); border-radius: 14px; padding: 14px 16px; }
.ex-panel h3 { font-size: 1.2rem; margin-bottom: 6px; }
.ex-kicker { display: flex; align-items: center; gap: 6px; font-size: .75rem; font-weight: 900; text-transform: uppercase; letter-spacing: .04em; color: var(--accent-strong); margin-bottom: 4px; }
.ex-kicker .ic { width: 1.05em; height: 1.05em; }
.ex-links { margin: 10px 0; }
.ex-why { font-size: .93rem; margin: 8px 0 0; }
.ex-example { display: flex; gap: 8px; align-items: flex-start; font-size: .93rem; margin: 8px 0; }
.ex-example .ic { flex: none; margin-top: 3px; color: var(--accent-strong); }
.ex-tip .ic { width: 1em; height: 1em; vertical-align: -2px; }
.ex-actions { margin-top: 10px; }
.lg-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; flex: none; }
.x3d-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.x3d-chip, .x3d-link { cursor: pointer; font-family: inherit; gap: 6px; }
.x3d-chip:hover, .x3d-link:hover { border-color: var(--main); }
.x3d-chip.on { background: var(--main); color: var(--on-main); border-color: var(--accent); }
.x3d-chip .seen-ic { display: none; color: var(--good); }
.x3d-chip.seen .seen-ic { display: inline-flex; }
.x3d-chip.on .seen-ic { color: var(--on-main); }
.x3d-legend { margin-top: 14px; display: grid; gap: 4px; }
.x3d-legend .ic { width: 1em; height: 1em; vertical-align: -2px; }
.lg-groups { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; }
.lg-groups .xlabel { margin: 0; }
.lg-item { display: inline-flex; align-items: center; gap: 6px; font-size: .87rem; font-weight: 700; }
.x3d-all { margin-top: 10px; }
@media (max-width: 640px) {
  .x3d-progress { margin-left: 0; width: 100%; }
}

/* ---------- Color themes: top-bar picker and Settings cards ---------- */
.theme-pop { position: fixed; z-index: 60; width: 270px; max-width: calc(100vw - 16px); background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: 0 12px 40px rgba(0, 0, 0, .18); padding: 12px; animation: up .15s; }
.theme-pop .xlabel { margin: 4px 4px 6px; }
.theme-pop > a { display: block; margin: 10px 4px 2px; font-weight: 700; }
.theme-swatches { display: grid; gap: 2px; margin-bottom: 8px; }
.theme-sw { display: flex; align-items: center; gap: 10px; width: 100%; border: 1px solid transparent; background: none; color: var(--text); font: 700 .95rem var(--font); padding: 7px 8px; border-radius: 10px; cursor: pointer; text-align: left; }
.theme-sw:hover { background: var(--surface-2); }
.theme-sw.on { background: var(--surface-3); border-color: var(--main); }
.theme-sw > span:nth-child(2) { flex: 1; }
.theme-sw .ic { width: 1.1em; height: 1.1em; color: var(--accent-strong); }
.sw-dots { display: inline-flex; flex: none; }
.sw-dots span { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--surface); margin-left: -5px; }
.sw-dots span:first-child { margin-left: 0; }
.seg { display: inline-flex; flex-wrap: wrap; background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 3px; gap: 3px; }
.seg button, .seg label { border: none; background: none; color: var(--text); font: 700 .9rem var(--font); padding: 6px 12px; border-radius: 9px; cursor: pointer; }
.seg button.on, .seg label.on { background: var(--main); color: var(--on-main); }
.seg label:focus-within { outline: 3px solid var(--accent); outline-offset: 1px; }
.theme-pop .seg { display: flex; } .theme-pop .seg button { flex: 1; }
.theme-grid, .seg-field { border: none; padding: 0; margin: 0 0 14px; min-width: 0; }
.theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.theme-grid legend, .seg-field legend { padding: 0; margin-bottom: 8px; }
.theme-card { display: flex; flex-direction: column; gap: 4px; border: 2px solid var(--border); border-radius: 14px; padding: 8px; cursor: pointer; background: var(--surface); transition: border-color .15s, transform .15s; }
.theme-card:hover { border-color: var(--main); transform: translateY(-1px); }
.theme-card.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--main); }
.theme-card:focus-within { outline: 3px solid var(--accent); outline-offset: 2px; }
.tc-preview { display: flex; gap: 6px; height: 78px; border-radius: 9px; padding: 6px; overflow: hidden; border: 1px solid rgba(0, 0, 0, .08); }
.tc-side { width: 26%; border-radius: 6px; padding: 5px 4px; display: flex; flex-direction: column; gap: 4px; }
.tc-side i { display: block; height: 7px; border-radius: 4px; }
.tc-body { flex: 1; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.tc-card { flex: 1; border: 1px solid; border-radius: 6px; padding: 5px 6px; display: flex; flex-direction: column; gap: 4px; }
.tc-card b { display: block; height: 5px; border-radius: 3px; width: 80%; }
.tc-card b + b { width: 55%; opacity: .8; }
.tc-dots { display: flex; gap: 3px; margin-top: auto; }
.tc-dots i { width: 9px; height: 9px; border-radius: 50%; }
.tc-btn { align-self: flex-start; font: 900 .7rem var(--font); padding: 2px 10px; border-radius: 99px; }
.tc-name { display: flex; align-items: center; gap: 6px; font-weight: 800; margin-top: 2px; }
.tc-name .ic { width: 1.05em; height: 1.05em; }
.tc-desc { font-size: .82rem; color: var(--muted); line-height: 1.35; }
#set-theme > div > p .ic { width: 1em; height: 1em; vertical-align: -2px; }
@media (max-width: 640px) {
  .theme-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .tc-preview { height: 64px; }
}

/* ---------- Comic: a printed comic book in every theme ---------- */
.cm-mast { container-type: inline-size; position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; margin: 0 0 6px; padding: 14px 96px 18px 18px; border: 3px solid #1F1A2E; border-radius: 6px; overflow: hidden; color: #1F1A2E;
  background: radial-gradient(rgba(31, 26, 46, .16) 1.2px, transparent 1.7px) 0 0 / 8px 8px, repeating-conic-gradient(from 0deg at 85% 130%, #4DABF7 0 6deg, #74C0FC 6deg 12deg); box-shadow: 4px 4px 0 #1F1A2E; }
.cm-mast-kicker { font: 700 .85rem 'Comic Neue', 'Comic Sans MS', var(--font); background: #fff; border: 2px solid #1F1A2E; padding: 1px 10px; transform: rotate(-2deg); text-transform: uppercase; letter-spacing: .05em; }
.cm-mast-title { font-family: 'Bangers', 'Impact', 'Arial Black', var(--font); font-weight: 400; font-size: clamp(1.5rem, 9.5cqi, 3.6rem); line-height: 1.05; letter-spacing: .05em; color: #FFD43B;
  -webkit-text-stroke: 2.5px #1F1A2E; paint-order: stroke fill; text-shadow: 4px 4px 0 #E8505B, 6px 6px 0 #1F1A2E; transform: rotate(-2deg); margin: 6px 0 0 4px; overflow-wrap: break-word; max-width: 100%; }
.cm-mast-no { position: absolute; top: 10px; right: 12px; width: 66px; padding: 6px 4px 4px; background: #fff; border: 2px solid #1F1A2E; text-align: center; font: 400 1.1rem/1.05 'Bangers', 'Impact', var(--font); letter-spacing: .05em; transform: rotate(4deg); box-shadow: 2px 2px 0 #1F1A2E; }
.cm-mast-no small { display: block; font-size: .85rem; color: #E8505B; }
.cm-mast-tag { margin: 0 0 12px; font: italic 700 .92rem 'Comic Neue', 'Comic Sans MS', var(--font); color: var(--muted); }
.cm-tools { margin-bottom: 12px; }
.cm-page { --ink: #1F1A2E; --paper: #FFFDF7; --wall: color-mix(in srgb, var(--main) 22%, #FFFDF7); --floor: color-mix(in srgb, var(--main) 42%, #F7EFE2); --dots: radial-gradient(rgba(31, 26, 46, .12) 1.1px, transparent 1.6px) 0 0 / 7px 7px;
  display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; background: var(--paper); border: 3px solid var(--ink); border-radius: 6px; padding: 12px; color: var(--ink);
  font-family: 'Comic Neue', 'Comic Sans MS', var(--font); }
html.easy-font .cm-page { font-family: var(--font); }
.cm-panel { position: relative; margin: 0; grid-column: span var(--cols, 3); display: flex; flex-direction: column; background: var(--dots), var(--wall); border: 3px solid var(--ink); border-radius: 3px; overflow: hidden; box-shadow: 3px 3px 0 var(--ink); animation: cm-pop .45s var(--d, 0ms) backwards; }
@keyframes cm-pop { from { transform: scale(.94) rotate(-1deg); opacity: 0; } }
.cm-panel.reading { box-shadow: 0 0 0 4px var(--accent), 3px 3px 0 var(--ink); }
/* camera shots: focus rays for close-ups (colored by feeling), a dreamy sky to imagine in, a sunny splash and a party finale */
.cm-panel.shot-close { --r1: #FFE066; --r2: #FFF4C2; background: var(--dots), repeating-conic-gradient(from 3deg at 50% 66%, var(--r1) 0 5deg, var(--r2) 5deg 12deg); }
.cm-panel.shot-close.mood-dizzy, .cm-panel.shot-close.mood-confused { --r1: #A5D8FF; --r2: #E7F5FF; }
.cm-panel.shot-close.mood-surprised, .cm-panel.shot-close.mood-panic { --r1: #FFA8A8; --r2: #FFE3E3; }
.cm-panel.shot-close.mood-laugh { --r1: #B2F2BB; --r2: #EBFBEE; }
.cm-panel.shot-imagine { background: var(--dots), linear-gradient(165deg, #FFDEEB, #E5DBFF 55%, #D0EBFF); }
.cm-panel.shot-action { background: var(--dots), linear-gradient(90deg, #FFF3BF, var(--wall) 45%); }
.cm-panel.shot-finale { background: var(--dots), repeating-conic-gradient(from 0deg at 50% 40%, #FFE066 0 6deg, #FFF3BF 6deg 12deg); }
.cm-caption { align-self: flex-start; position: relative; z-index: 2; background: #FFE066; color: var(--ink); border: 0 solid var(--ink); border-width: 0 2.5px 2.5px 0; padding: 5px 12px; font-weight: 700; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }
.cm-talk { position: relative; z-index: 1; padding: 10px 12px 14px; display: flex; }
.cm-talk.reply { padding-top: 0; }
.cm-talk.left { justify-content: flex-start; } .cm-talk.right { justify-content: flex-end; } .cm-talk.center { justify-content: center; }
.cm-bubble { background: #fff; color: var(--ink); border: 2.5px solid var(--ink); border-radius: 22px; padding: 10px 16px; min-width: 50%; max-width: 92%; font-weight: 700; font-size: 1.05rem; line-height: 1.35; text-align: center; box-shadow: 2px 3px 0 rgba(31, 26, 46, .18); }
.cm-talk.reply .cm-bubble { min-width: 0; font-size: 1rem; }
.cm-panel[style*="--cols:2"] .cm-bubble { font-size: .98rem; padding: 9px 12px; min-width: 70%; }
.cm-bubble.think { border-radius: 999px; padding: 12px 22px; font-style: italic; }
.cm-em { color: #C2255C; font-weight: 800; }
/* shouting: a spiky bubble (clip-path) outlined by drop shadows */
.cm-shout { display: flex; min-width: 50%; max-width: 94%; filter: drop-shadow(2.5px 0 0 var(--ink)) drop-shadow(-2.5px 0 0 var(--ink)) drop-shadow(0 2.5px 0 var(--ink)) drop-shadow(0 -2.5px 0 var(--ink)) drop-shadow(3px 4px 0 rgba(31, 26, 46, .22)); }
.cm-bubble.shout { flex: 1; min-width: 0; max-width: none; border: 0; border-radius: 0; padding: 20px 30px; box-shadow: none; font-size: 1.12rem; }
/* the tail's top sits just over the bubble's bottom edge, so its white covers the outline */
.cm-tail { position: absolute; bottom: -7px; left: var(--tail); width: 30px; height: 24px; margin-left: -6px; overflow: visible; }
.cm-talk.right .cm-tail:not(.think) { transform: scaleX(-1); margin-left: -24px; }
.cm-tail.think { width: 30px; height: 30px; bottom: -14px; margin-left: -14px; }
.cm-tail.shout { height: 30px; bottom: -9px; }
.cm-art { display: block; width: 100%; height: auto; margin-top: auto; }
.cm-floor { fill: var(--floor); }
.cm-hoodie { fill: var(--c1); } .cm-sleeve-student { stroke: var(--c1); }
.cm-cardigan { fill: var(--c0); } .cm-sleeve-teacher { stroke: var(--c0); }
.cm-jeans { fill: #3E5C8A; } .cm-skirt { fill: #4A4E69; }
.cm-mark { font-family: 'Bangers', 'Comic Neue', 'Comic Sans MS', var(--font); font-weight: 700; stroke: var(--ink); stroke-width: 1.4px; paint-order: stroke; }
.cm-mark.question { fill: #3D7BE0; } .cm-mark.exclaim { fill: #E8505B; } .cm-mark.haha { fill: #2F9E44; letter-spacing: 1px; }
.cm-zz { font-family: 'Bangers', 'Comic Neue', var(--font); fill: #3D7BE0; stroke: #fff; stroke-width: 2.4px; paint-order: stroke; }
.cm-chalk { font-family: 'Comic Neue', 'Comic Sans MS', var(--font); font-weight: 700; fill: #F4F1E8; opacity: .92; }
.cm-dream { stroke: var(--c0); color: var(--c0); }
.cm-c0 { fill: var(--c0); } .cm-c1 { fill: var(--c1); } .cm-c2 { fill: var(--c2); } .cm-c3 { fill: var(--c3); } .cm-c4 { fill: var(--c4); } .cm-c5 { fill: var(--c5); }
/* sound effects: big outlined letters in a spiky burst that boings in */
.cm-sfx { transform-box: fill-box; transform-origin: center; animation: cm-boing .6s calc(var(--d, 0ms) + .3s) backwards; }
@keyframes cm-boing { 0% { transform: scale(.2) rotate(-20deg); opacity: 0; } 60% { transform: scale(1.18) rotate(4deg); opacity: 1; } 100% { transform: scale(1); } }
.cm-sfx-bg { stroke: var(--ink); stroke-width: 2.4px; stroke-linejoin: round; }
.cm-sfx-t, .cm-sfx-sh { font-family: 'Bangers', 'Impact', 'Arial Black', sans-serif; letter-spacing: 1px; }
.cm-sfx-t { stroke: var(--ink); stroke-width: 3.4px; stroke-linejoin: round; paint-order: stroke; }
.cm-sfx-sh { fill: var(--ink); }
.cm-sfx-bg.t-yellow { fill: #FFD43B; } .cm-sfx-t.t-yellow { fill: #F03E3E; }
.cm-sfx-bg.t-red { fill: #FF6B6B; } .cm-sfx-t.t-red { fill: #FFE066; }
.cm-sfx-bg.t-blue { fill: #74C0FC; } .cm-sfx-t.t-blue { fill: #fff; }
.cm-sfx-bg.t-green { fill: #8CE99A; } .cm-sfx-t.t-green { fill: #F03E3E; }
.cm-sfx-bg.t-white { fill: #fff; } .cm-sfx-t.t-white { fill: #339AF0; }
.cm-end { display: flex; flex-direction: column; align-items: center; gap: 6px; margin: 18px 0 14px; text-align: center; }
.cm-end-t { font: 400 2.4rem/1 'Bangers', 'Impact', var(--font); letter-spacing: .06em; color: #FFD43B; -webkit-text-stroke: 2px #1F1A2E; paint-order: stroke fill; text-shadow: 3px 3px 0 #1F1A2E; transform: rotate(-2deg); }
.cm-next { font: italic 700 .95rem 'Comic Neue', 'Comic Sans MS', var(--font); color: var(--muted); }
.cm-next b { color: var(--text); }
@media (max-width: 760px) {
  .cm-page { grid-template-columns: minmax(0, 1fr); padding: 8px; gap: 10px; }
  .cm-panel { grid-column: 1 / -1; }
  .cm-art { min-height: 180px; }
  .cm-mast { padding-right: 14px; }
  .cm-mast-kicker { margin-right: 74px; }
}

/* Printing: hide the app chrome; "Save as PDF" prints only the explanation */
@media print {
  .sidebar, .topbar, .fab, .drawer, .speak-bar, #toasts, .hl-pop, .hl-card, .scrim, .sr-help, .tools, .confused-row, .check-box, .src-summary, .modes, .recommend, .howto, .mode-guide, [data-print], [data-ics] { display: none !important; }
  .app { display: block; }
  body { background: #fff; color: #000; }
  .card { box-shadow: none; border: 1px solid #ccc; break-inside: avoid; }
  html.print-explanation body * { visibility: hidden; }
  html.print-explanation .output-wrap .out-toolbar, html.print-explanation .output-wrap .out-toolbar *, html.print-explanation .output-wrap .out, html.print-explanation .output-wrap .out * { visibility: visible; }
  html.print-explanation .output-wrap { position: absolute; left: 0; top: 0; width: 100%; }
}
.btn-primary .ic.good, .btn-primary .ic.mid { color: inherit; }

/* ---- Explain: the explanation comes first ---- */
.btn-icon { padding: 6px 9px; }
.out-toolbar .tools { row-gap: 6px; }
/* Under 1100px the 25 mode cards would push the explanation far down the page,
   so once a mode is open they become one row you can swipe through. */
@media (max-width: 1100px) {
  .explain-layout.has-mode { gap: 10px; }
  .explain-layout.has-mode .modes { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 8px; scroll-snap-type: x proximity; }
  .has-mode .mode-search, .has-mode .mode-cat h3 { display: none; }
  .has-mode .mode-cat { display: contents; }
  .has-mode .mode-cat[hidden] { display: none; }
  .has-mode .mode-grid { display: contents; }
  .has-mode .mode-card { flex: 0 0 auto; flex-direction: row; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 999px; scroll-snap-align: start; white-space: nowrap; }
  .has-mode .mode-card .star { display: none; }
}
@media (max-width: 640px) {
  /* The notes picker is already in the top bar, and the mode's own name says where you are. */
  .view-explain:has(.has-mode) .page-head { margin-bottom: 8px; }
  .view-explain:has(.has-mode) .page-head > div:first-child, .view-explain:has(.has-mode) [data-mat] { display: none; }
  .view-explain .page-head .row { width: 100%; }
  .view-explain .page-head select { flex: 1 1 140px; min-width: 0; }
  .out-title-row .mi.big { display: none; }
  .out-toolbar .tools { flex-wrap: nowrap; overflow-x: auto; width: 100%; padding-bottom: 4px; }
  .out-toolbar .tools .btn { flex: none; }
  /* Room for the notes picker: the engine chip keeps its icon, which still opens Settings. */
  .topbar .ai-chip span { display: none; }
  .topbar .ai-chip { padding: 6px 8px; }
  .topbar .mat-pick { min-width: 110px; }
}

/* ---- Small additions ---- */
.toast { display: flex; align-items: center; gap: 12px; justify-content: space-between; }
.toast-action { background: none; border: 1px solid currentColor; color: inherit; border-radius: 8px; padding: 3px 10px; font: inherit; font-size: .9em; cursor: pointer; flex: none; }
.toast-action:hover { background: rgba(127, 127, 127, .25); }
.welcome h2 { margin-top: 0; }
.welcome-steps { margin: 10px 0 16px; padding-left: 1.3em; display: grid; gap: 6px; }
.resume-card, .due-all { display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; border-color: var(--accent); }
.resume-card h2, .due-all h2 { margin: 0 0 2px; }
.resume-card p, .due-all p { margin: 0; }
.tile-num { overflow-wrap: anywhere; }
/* A file being dragged over the app: show that it can be dropped anywhere. */
body.dragging::after { content: 'Drop your file to add it to My Materials'; position: fixed; inset: 12px; z-index: 90; display: flex; align-items: center; justify-content: center; font-size: 1.4rem; font-weight: 800; color: var(--accent-strong); background: color-mix(in srgb, var(--bg) 88%, transparent); border: 3px dashed var(--accent); border-radius: 18px; pointer-events: none; }
.hl-card { max-width: calc(100vw - 16px); }
.rate-it { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; }
