/* ---------- Poppins (self-hosted, SIL OFL 1.1 — see /fonts/OFL.txt) ---------- */
@font-face { font-family: Poppins; font-style: normal; font-weight: 400; font-display: swap; src: url(/fonts/poppins-latin-400-normal.woff2) format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: Poppins; font-style: normal; font-weight: 400; font-display: swap; src: url(/fonts/poppins-latin-ext-400-normal.woff2) format('woff2'); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: Poppins; font-style: normal; font-weight: 500; font-display: swap; src: url(/fonts/poppins-latin-500-normal.woff2) format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: Poppins; font-style: normal; font-weight: 500; font-display: swap; src: url(/fonts/poppins-latin-ext-500-normal.woff2) format('woff2'); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: Poppins; font-style: normal; font-weight: 600; font-display: swap; src: url(/fonts/poppins-latin-600-normal.woff2) format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: Poppins; font-style: normal; font-weight: 600; font-display: swap; src: url(/fonts/poppins-latin-ext-600-normal.woff2) format('woff2'); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: Poppins; font-style: normal; font-weight: 700; font-display: swap; src: url(/fonts/poppins-latin-700-normal.woff2) format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: Poppins; font-style: normal; font-weight: 700; font-display: swap; src: url(/fonts/poppins-latin-ext-700-normal.woff2) format('woff2'); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }

/* ---------- theme ----------
   Brand palette: charcoal #444444 · orange #FF8B00 · amber #FFC60B · cream #FEFFDB.
   Text pairs were chosen to meet WCAG AA (4.5:1); orange and amber are used as fills,
   with darker/lighter derived tints where they must be read as text.
   good/bad are added status colours (the brand palette has no green/red). */
:root {
  --charcoal: #444444; --orange: #FF8B00; --amber: #FFC60B; --cream: #FEFFDB;

  /* light theme (default) */
  --bg: #FEFFDB;            /* cream */
  --bg2: #F6F4CC;           /* sidebar */
  --card: #FFFFF5;
  --card2: #F8F6D6;
  --line: #E4E0B8;
  --text: #444444;          /* 9.5:1 on cream */
  --heading: #2E2E2E;
  --muted: #5F5F56;         /* 6.3:1 */
  --dim: #6E6E62;           /* 5.0:1 */
  --accent: #FF8B00;        /* fills, bars, rings, focus */
  --accent-text: #B35C00;   /* orange as text: 4.6:1 on cream */
  --on-accent: #2A2A2A;     /* text on orange (6.1:1) / amber (9.1:1) fills */
  --accent2: #FFC60B;       /* amber: secondary fills */
  --accent-soft: #FFE7C2;   /* tinted backgrounds */
  --warn: #8A6400;          /* amber as text */
  --good: #2E7D46;
  --bad: #C0392B;
  --info: #3D6B8C;
  --c1: #FF8B00; --c2: #FFC60B; --c3: #444444; --c4: #C25E00; --c5: #A88B00; --c6: #FFB866; /* charts */
  --radius: 14px;
  --side-w: 240px;
  --shadow: 0 8px 24px rgba(68, 68, 68, .12);
  --mono: "JetBrains Mono", "Fira Code", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sans: Poppins, "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  color-scheme: light;
}
:root.dark {
  --bg: #2E2E2E;
  --bg2: #363636;
  --card: #444444;          /* charcoal */
  --card2: #4E4E4E;
  --line: #5C5C5C;
  --text: #FEFFDB;          /* cream: 9.5:1 on #444 */
  --heading: #FFFFF0;
  --muted: #D2D3B8;         /* 6.4:1 */
  --dim: #B5B6A0;           /* 4.7:1 */
  --accent: #FF8B00;
  --accent-text: #FFA43D;   /* 4.9:1 on #444 */
  --on-accent: #2A2A2A;
  --accent2: #FFC60B;
  --accent-soft: #5A4A33;
  --warn: #FFC60B;          /* 6.2:1 on #444 */
  --good: #7BD38F;
  --bad: #FF9E91;
  --info: #9CC6E4;
  --c3: #FEFFDB;            /* charcoal series flips to cream */
  --shadow: 0 8px 30px rgba(0, 0, 0, .35);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: 400 14px/1.55 var(--sans); -webkit-font-smoothing: antialiased; font-variant-numeric: lining-nums; }
a { color: var(--accent-text); text-decoration: none; font-weight: 500; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 .5em; line-height: 1.25; color: var(--heading); font-weight: 600; letter-spacing: -.01em; }
h1 { font-size: 24px; font-weight: 700; } h2 { font-size: 20px; } h3 { font-size: 16px; } h4 { font-size: 14px; }
p { margin: 0 0 .75em; }
code, kbd { font-family: var(--mono); font-size: .92em; background: var(--card2); padding: 1px 6px; border-radius: 6px; border: 1px solid var(--line); }
hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }
::selection { background: color-mix(in srgb, var(--accent) 45%, transparent); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 10px; border: 2px solid var(--bg); }

/* ---------- layout ---------- */
.app { display: grid; grid-template-columns: var(--side-w) 1fr; min-height: 100vh; transition: grid-template-columns .2s ease; }
.sidebar { position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--bg2); border-right: 1px solid var(--line); padding: 18px 14px; display: flex; flex-direction: column; gap: 14px; z-index: 30; }
.brand { display: flex; gap: 10px; align-items: center; font-weight: 700; font-size: 19px; color: var(--text); letter-spacing: .2px; }
.brand:hover { text-decoration: none; }
.me { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.me .row { display: flex; justify-content: space-between; align-items: baseline; }
.me .lvl { font-weight: 700; }
.me .xp { color: var(--muted); font-size: 12px; }
.me .streak { font-size: 12px; color: var(--warn); margin-top: 6px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-group { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--dim); margin: 10px 8px 4px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; color: var(--muted); font-weight: 500; }
.nav a i { width: 22px; text-align: center; font-style: normal; opacity: .9; }
.nav a:hover { background: var(--card); color: var(--text); text-decoration: none; }
.nav a.active { background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--text); }
.save-state { margin-top: auto; font-size: 11px; color: var(--dim); padding: 0 8px; }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 14px 28px; background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.topbar h1 { font-size: 20px; margin: 0; }
.topbar-right { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.view { padding: 24px 28px 120px; width: 100%; }

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; width: 250px; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow); }
  .sidebar.open { transform: none; }
  .menu-btn { display: inline-flex; }
  .view { padding: 16px 14px 140px; }
  .topbar { padding: 12px 14px; }
}

/* ---------- components ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.card.pad-sm { padding: 12px; }
.card h3 { display: flex; align-items: center; gap: 8px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.card-head h3 { margin: 0; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.auto { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.auto-sm { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.span2 { grid-column: span 2; }
@media (max-width: 1100px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 700px) { .g2, .g3, .g4 { grid-template-columns: 1fr; } .span2 { grid-column: auto; } }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row.nowrap { flex-wrap: nowrap; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--muted); }
.dim { color: var(--dim); }
.small { font-size: 12px; }
.mono { font-family: var(--mono); }
.right { text-align: right; }
.center { text-align: center; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.good { color: var(--good); } .bad { color: var(--bad); } .warn { color: var(--warn); }
.mt { margin-top: 16px; } .mb { margin-bottom: 16px; } .mt-sm { margin-top: 8px; }
.hidden { display: none !important; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--card2); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; transition: background .15s, border-color .15s, transform .05s; white-space: nowrap; }
.btn:hover { border-color: color-mix(in srgb, var(--accent) 60%, var(--line)); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { filter: brightness(1.1); }
.btn.success { background: var(--accent2); border-color: var(--accent2); color: var(--on-accent); }
.btn.danger { color: var(--bad); }
.btn.danger:hover { border-color: var(--bad); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--card2); }
.btn.sm { padding: 4px 10px; font-size: 12px; border-radius: 8px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; min-width: 34px; height: 34px; padding: 0 8px; border-radius: 9px; border: 1px solid transparent; background: transparent; color: var(--text); cursor: pointer; font: inherit; font-size: 14px; }
.icon-btn:hover { background: var(--card2); border-color: var(--line); }

input[type=text], input[type=email], input[type=number], input[type=url], input[type=date], input[type=search], input[type=password], textarea, select {
  width: 100%; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg2); color: var(--text); font: inherit; outline: none;
}
input:focus, textarea:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }
textarea { resize: vertical; min-height: 80px; }
label.field { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--muted); font-weight: 600; }
label.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }
input[type=range] { accent-color: var(--accent); }
.form-grid { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid .full { grid-column: 1 / -1; }

.pill { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: 11px; font-weight: 600; background: var(--card2); border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.pill.accent { background: color-mix(in srgb, var(--accent) 18%, transparent); color: color-mix(in srgb, var(--accent) 55%, var(--text)); border-color: transparent; }
.pill.good { background: color-mix(in srgb, var(--good) 15%, transparent); color: var(--good); border-color: transparent; }
.pill.warn { background: color-mix(in srgb, var(--warn) 15%, transparent); color: var(--warn); border-color: transparent; }
.pill.bad { background: color-mix(in srgb, var(--bad) 15%, transparent); color: var(--bad); border-color: transparent; }
.pill.info { background: color-mix(in srgb, var(--info) 15%, transparent); color: var(--info); border-color: transparent; }

.tabs { display: flex; gap: 4px; background: var(--bg2); border: 1px solid var(--line); padding: 4px; border-radius: 12px; flex-wrap: wrap; }
.tabs button { border: 0; background: transparent; color: var(--muted); padding: 7px 14px; border-radius: 9px; cursor: pointer; font: inherit; font-weight: 600; }
.tabs button.active { background: var(--card2); color: var(--text); box-shadow: 0 1px 0 var(--line); }

.bar { height: 8px; background: var(--card2); border-radius: 999px; overflow: hidden; border: 1px solid var(--line); }
.bar > span { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 50%, var(--accent2))); border-radius: 999px; transition: width .3s; }
.bar.thin { height: 5px; }
.bar.green > span { background: var(--accent2); }

.stat { display: flex; flex-direction: column; gap: 2px; }
.stat .label { font-size: 12px; color: var(--muted); font-weight: 600; }
.stat .value { font-size: 26px; font-weight: 700; letter-spacing: -.5px; }
.stat .sub { font-size: 12px; color: var(--dim); }

.list { display: flex; flex-direction: column; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 10px 4px; border-bottom: 1px solid var(--line); }
.list-item:last-child { border-bottom: 0; }
.list-item.clickable { cursor: pointer; border-radius: 10px; padding: 10px; }
.list-item.clickable:hover { background: var(--card2); }
.list-item.active { background: color-mix(in srgb, var(--accent) 14%, transparent); border-radius: 10px; }
.empty { text-align: center; color: var(--muted); padding: 30px 10px; }
.empty .big { font-size: 34px; margin-bottom: 6px; }

table.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table th { font-size: 11px; text-transform: uppercase; letter-spacing: .6px; color: var(--dim); font-weight: 700; }
.table tr:last-child td { border-bottom: 0; }
.table-wrap { overflow-x: auto; }

.tile { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 10px; cursor: pointer; transition: transform .12s, border-color .12s; color: var(--text); }
.tile:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); text-decoration: none; }
.tile .ico { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; font-weight: 700; font-size: 14px; color: #fff; flex-shrink: 0; font-family: var(--mono); }

.checklist .ci { display: flex; gap: 10px; align-items: flex-start; padding: 9px 8px; border-radius: 10px; }
.checklist .ci:hover { background: var(--card2); }
.checklist .ci.done .t { color: var(--muted); text-decoration: line-through; }
.checklist .ci input { margin-top: 2px; }

/* ---------- toasts / modal ---------- */
.toasts { position: fixed; right: 18px; top: 18px; display: flex; flex-direction: column; gap: 10px; z-index: 100; pointer-events: none; }
.toast { pointer-events: auto; min-width: 260px; max-width: 380px; background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 12px; padding: 12px 14px; box-shadow: var(--shadow); animation: slidein .25s ease; display: flex; gap: 12px; align-items: center; }
.toast.good { border-left-color: var(--good); } .toast.bad { border-left-color: var(--bad); } .toast.warn { border-left-color: var(--warn); }
.toast.badge { border-left-color: gold; }
.toast .t-title { font-weight: 700; }
@keyframes slidein { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-root .backdrop { position: fixed; inset: 0; background: rgba(5, 7, 12, .6); z-index: 90; display: grid; place-items: center; padding: 20px; animation: fade .15s; }
.modal { background: var(--card); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); width: min(640px, 100%); max-height: calc(100vh - 40px); overflow: auto; padding: 22px; }
.modal.wide { width: min(900px, 100%); }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.modal-head h2 { margin: 0; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
@keyframes fade { from { opacity: 0; } }

/* ---------- player ---------- */
.player { position: fixed; left: var(--side-w); right: 0; bottom: 0; z-index: 40; display: flex; align-items: center; gap: 14px; padding: 10px 20px; background: color-mix(in srgb, var(--bg2) 92%, transparent); backdrop-filter: blur(12px); border-top: 1px solid var(--line); }
.player-art { width: 46px; height: 46px; border-radius: 8px; object-fit: cover; background: var(--card2); flex-shrink: 0; }
.player-meta { min-width: 0; width: 220px; }
.player-title { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player-sub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player-controls { display: flex; gap: 4px; align-items: center; }
.player-controls .play { width: 40px; height: 40px; border-radius: 50%; background: var(--accent); color: var(--on-accent); font-size: 16px; }
.player-seek { flex: 1; display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--muted); font-family: var(--mono); min-width: 120px; }
.player-seek input { flex: 1; }
.player select { width: auto; padding: 5px 8px; }
#pVol { width: 80px; }
@media (max-width: 900px) { .player { left: 0; flex-wrap: wrap; gap: 8px; padding: 8px 12px; } .player-meta { width: auto; flex: 1; } .player-seek { order: 5; flex-basis: 100%; } #pVol { display: none; } }

/* ---------- charts ---------- */
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart text { fill: var(--muted); font-size: 10px; font-family: var(--sans); }
.chart .grid-line { stroke: var(--line); stroke-dasharray: 3 4; }
.heatmap rect { rx: 2; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.ring-wrap { position: relative; display: inline-grid; place-items: center; }
.ring-wrap .ring-label { position: absolute; text-align: center; }
.ring-wrap .ring-label b { display: block; font-size: 20px; }

/* ---------- typing ---------- */
.typing-wrap { max-width: 1000px; margin: 0 auto; }
.typing-config { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; background: var(--bg2); border: 1px solid var(--line); border-radius: 12px; padding: 6px 10px; margin-bottom: 26px; }
.typing-config button { background: transparent; border: 0; color: var(--dim); font: inherit; font-weight: 600; padding: 5px 9px; border-radius: 8px; cursor: pointer; }
.typing-config button:hover { color: var(--text); }
.typing-config button.on { color: var(--accent-text); }
.typing-config .sep { width: 1px; background: var(--line); margin: 4px 6px; }
.typing-live { display: flex; gap: 22px; font-family: var(--mono); font-size: 24px; color: var(--accent-text); height: 34px; margin-bottom: 8px; }
.typing-live .lbl { font-size: 11px; color: var(--dim); margin-left: 4px; }
.words-box { position: relative; font-family: var(--mono); font-size: 26px; line-height: 1.6; height: calc(1.6em * 3); overflow: hidden; color: var(--dim); user-select: none; cursor: text; outline: none; }
.words-box.blur .words { filter: blur(5px); opacity: .5; }
.words-box .focus-hint { position: absolute; inset: 0; display: none; place-items: center; font-family: var(--sans); font-size: 16px; color: var(--text); z-index: 2; }
.words-box.blur .focus-hint { display: grid; }
.words { display: flex; flex-wrap: wrap; position: relative; transition: transform .12s; }
.word { margin: 0 .3em 0 0; position: relative; white-space: nowrap; }
.word.error { text-decoration: underline; text-decoration-color: var(--bad); text-underline-offset: 6px; }
.word letter { position: relative; }
.word letter.correct { color: var(--text); }
.word letter.incorrect { color: var(--bad); }
.word letter.extra { color: color-mix(in srgb, var(--bad) 65%, black); }
.caret { position: absolute; width: 3px; height: 1.25em; background: var(--accent); border-radius: 2px; transition: left .08s linear, top .08s linear; z-index: 1; animation: blink 1s step-end infinite; }
.caret.typing { animation: none; }
@keyframes blink { 50% { opacity: 0; } }
.typing-input { position: absolute; opacity: 0; pointer-events: none; left: 0; top: 0; width: 1px; height: 1px; }
.typing-hint { text-align: center; color: var(--dim); font-size: 12px; margin-top: 26px; }
.result-grid { display: grid; grid-template-columns: 200px 1fr; gap: 24px; align-items: center; }
.result-big .label { font-size: 22px; color: var(--dim); }
.result-big .value { font-size: 60px; color: var(--accent-text); font-weight: 700; line-height: 1; font-family: var(--mono); }
.result-small { display: flex; flex-wrap: wrap; gap: 26px; margin-top: 14px; }
.result-small .label { color: var(--dim); font-size: 12px; }
.result-small .value { font-size: 22px; font-family: var(--mono); color: var(--text); }
@media (max-width: 700px) { .result-grid { grid-template-columns: 1fr; } .words-box { font-size: 20px; } }

/* ---------- media / courses ---------- */
.course-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 16px; align-items: start; }
@media (max-width: 1100px) { .course-layout { grid-template-columns: 1fr; } }
.video-frame { position: relative; width: 100%; aspect-ratio: 16 / 9; background: #000; border-radius: 12px; overflow: hidden; }
.video-frame iframe, .video-frame video, .video-frame > div { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.video-frame .placeholder { display: grid; place-items: center; color: var(--muted); }
.module-list { max-height: 70vh; overflow-y: auto; }
.module-section { font-size: 11px; text-transform: uppercase; letter-spacing: .8px; color: var(--dim); font-weight: 700; padding: 12px 10px 4px; }
.mod-item { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 10px; cursor: pointer; }
.mod-item:hover { background: var(--card2); }
.mod-item.current { background: color-mix(in srgb, var(--accent) 16%, transparent); }
.mod-item .num { width: 22px; color: var(--dim); font-size: 12px; text-align: right; font-family: var(--mono); }
.mod-item .done-dot { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line); flex-shrink: 0; display: grid; place-items: center; font-size: 11px; cursor: pointer; }
.mod-item.done .done-dot { background: var(--accent2); border-color: var(--accent2); color: var(--on-accent); }
.thumb { width: 100%; aspect-ratio: 16/9; object-fit: cover; border-radius: 10px; background: var(--card2); display: grid; place-items: center; color: var(--dim); font-size: 30px; }

.pod-art { width: 64px; height: 64px; border-radius: 10px; object-fit: cover; background: var(--card2); flex-shrink: 0; }
.pod-art.lg { width: 120px; height: 120px; border-radius: 14px; }
.ep { display: flex; gap: 12px; padding: 12px 6px; border-bottom: 1px solid var(--line); align-items: flex-start; }
.ep.played .ep-title { color: var(--muted); }
.ep-title { font-weight: 600; }
.ep-desc { color: var(--muted); font-size: 12px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-top: 2px; }

/* ---------- badges ---------- */
.badge-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.badge-card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px 10px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 6px; cursor: pointer; transition: transform .12s; }
.badge-card:hover { transform: translateY(-2px); }
.badge-card.locked { opacity: .45; filter: grayscale(1); }
.badge-card .b-name { font-weight: 700; font-size: 13px; }
.badge-card .b-desc { font-size: 11px; color: var(--muted); }
.badge-card svg { width: 96px; height: 96px; }

/* ---------- misc ---------- */
.hero { background: radial-gradient(1200px 300px at 0% 0%, color-mix(in srgb, var(--accent) 28%, transparent), transparent), var(--card); }
.kbd-hint kbd { font-size: 11px; }
.subnet-q { font-family: var(--mono); font-size: 18px; }
details summary { cursor: pointer; font-weight: 600; }
.lab-steps li { margin-bottom: 8px; }
.tag-input { display: flex; gap: 8px; }
.timer-display { font-family: var(--mono); font-size: 46px; font-weight: 700; letter-spacing: 1px; text-align: center; }
.drop-hint { border: 2px dashed var(--line); border-radius: 12px; padding: 16px; text-align: center; color: var(--muted); }

/* ---------- auth & profile ---------- */
body.signed-out .app, body.signed-out .player { display: none !important; }
#authRoot { display: none; }
body.signed-out #authRoot { display: block; }
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(900px 500px at 20% 0%, color-mix(in srgb, var(--accent) 22%, transparent), transparent), var(--bg); }
.auth-card { width: min(420px, 100%); padding: 28px; box-shadow: var(--shadow); }
.auth-brand { justify-content: center; font-size: 24px; margin-bottom: 6px; }
.auth-tabs { margin-bottom: 14px; }
.auth-tabs button { flex: 1; }
.auth-msg { border-radius: 10px; padding: 10px 12px; margin-bottom: 12px; font-size: 13px; border: 1px solid var(--line); }
.auth-msg.bad { background: color-mix(in srgb, var(--bad) 12%, transparent); color: var(--bad); border-color: transparent; }
.auth-msg.good { background: color-mix(in srgb, var(--good) 12%, transparent); color: var(--good); border-color: transparent; }
.auth-msg.info { background: color-mix(in srgb, var(--info) 12%, transparent); color: var(--info); border-color: transparent; }
.user-chip { display: flex; align-items: center; gap: 6px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 8px; }
.user-link { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; color: var(--text); }
.user-link:hover { text-decoration: none; }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 17px; flex-shrink: 0; }
.avatar.lg { width: 96px; height: 96px; font-size: 44px; }
.emoji-pick { display: flex; flex-wrap: wrap; gap: 6px; }
.emoji-pick button { width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg2); font-size: 20px; cursor: pointer; }
.emoji-pick button.on { border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 40%, transparent); }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatches button { width: 28px; height: 28px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; }
.swatches button.on { border-color: var(--text); }
.danger-zone { border-color: color-mix(in srgb, var(--bad) 45%, var(--line)); }
input:-webkit-autofill, input:-webkit-autofill:focus { -webkit-box-shadow: 0 0 0 40px var(--bg2) inset; -webkit-text-fill-color: var(--text); caret-color: var(--text); }
input:disabled { opacity: .65; cursor: not-allowed; }
.oauth-btn { width: 100%; gap: 10px; background: var(--bg2); padding: 10px 14px; }
.oauth-btn:disabled { opacity: .45; }
.auth-divider { display: flex; align-items: center; gap: 10px; color: var(--dim); font-size: 12px; margin: 16px 0 12px; }
.auth-divider::before, .auth-divider::after { content: ''; flex: 1; border-top: 1px solid var(--line); }
.avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; }
.provider-pill { display: inline-flex; align-items: center; gap: 6px; }

/* ---------- icons & page headings ---------- */
.i { width: 1.15em; height: 1.15em; vertical-align: -0.2em; flex-shrink: 0; }
.btn .i, .pill .i { width: 1.05em; height: 1.05em; }
.icon-btn .i { width: 18px; height: 18px; }
.nav a .i { width: 19px; height: 19px; color: var(--dim); }
.nav a:hover .i, .nav a.active .i { color: var(--accent-text); }
.nav a.active { background: var(--accent-soft); color: var(--heading); font-weight: 600; box-shadow: inset 3px 0 0 var(--accent); }
.page-head { display: flex; align-items: center; gap: 12px; min-width: 0; }
.page-icon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--accent); color: var(--on-accent); flex-shrink: 0; }
.page-icon .i { width: 22px; height: 22px; }
.page-titles { min-width: 0; }
.page-titles h1 { margin: 0; font-size: 22px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.page-sub { margin: 0; font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-head h3, .card > h3 { display: flex; align-items: center; gap: 8px; font-size: 15.5px; }
.card-head h3 .i, .card > h3 .i, .section-title .i { color: var(--accent-text); width: 18px; height: 18px; }
.section-title { display: flex; align-items: center; gap: 8px; font-size: 17px; margin: 6px 0 12px; }
.empty .big { display: grid; place-items: center; margin: 0 auto 10px; width: 56px; height: 56px; border-radius: 16px; background: var(--accent-soft); color: var(--accent-text); }
.empty .big .i { width: 28px; height: 28px; }
.stat .label { display: flex; align-items: center; gap: 6px; }
.stat .label .i { color: var(--accent-text); }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 2px; flex-shrink: 0; }
.ico-chip { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); flex-shrink: 0; }
.ico-chip .i { width: 18px; height: 18px; }
.num-badge { font-size: 10px; font-weight: 600; margin-left: 2px; }
.brand-mark { width: 30px; height: 30px; }
@media (max-width: 900px) { .page-icon { width: 34px; height: 34px; } .page-sub { display: none; } .page-titles h1 { font-size: 18px; } }
.toast-ico { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: var(--card2); }
.toast.good .toast-ico { color: var(--good); } .toast.bad .toast-ico { color: var(--bad); } .toast.warn .toast-ico { color: var(--warn); } .toast .toast-ico { color: var(--accent-text); }
.heatmap rect { stroke: color-mix(in srgb, var(--line) 60%, transparent); stroke-width: .5; }
.pod-art-ph { display: grid; place-items: center; color: var(--accent-text); background: var(--accent-soft); }
.pod-art-ph .i { width: 45%; height: 45%; }
.play-btn { background: var(--accent) !important; color: var(--on-accent) !important; border-radius: 50% !important; width: 38px; height: 38px; flex-shrink: 0; }
.play-btn:hover { filter: brightness(1.05); }

/* ---------- sidebar: collapsible rail (desktop) / drawer (phone & tablet) ---------- */
.scrim { display: none; }
@media (min-width: 901px) {
  :root.nav-collapsed { --side-w: 76px; }
  .nav-collapsed .sidebar { padding: 18px 10px; }
  .nav-collapsed .brand { justify-content: center; }
  .nav-collapsed .brand span,
  .nav-collapsed .nav a > span,
  .nav-collapsed .nav-group,
  .nav-collapsed .me,
  .nav-collapsed .user-chip .grow,
  .nav-collapsed #signOutBtn,
  .nav-collapsed .save-state span { display: none; }
  .nav-collapsed .nav a { justify-content: center; padding: 10px 0; }
  .nav-collapsed .nav a .i { width: 21px; height: 21px; }
  .nav-collapsed .user-chip { justify-content: center; padding: 6px; }
  .nav-collapsed .user-link { flex: 0; }
  .nav-collapsed .save-state { text-align: center; padding: 0; }
}
@media (max-width: 900px) {
  .sidebar { z-index: 60; }
  .sidebar.open { box-shadow: 0 0 0 100vmax rgba(20, 20, 20, .35), var(--shadow); }
  .scrim.show { display: block; position: fixed; inset: 0; z-index: 55; background: transparent; }
}
