:root {
  --bg: #14171a; --surface: #1d2125; --surface-2: #262b30; --line: #343a40;
  --text: #eceae4; --muted: #a3a8ad; --accent: #d4a544; --accent-ink: #1a1405;
  --ok: #6fbf73; --warn: #e0894a; --danger: #e06666;
  --radius: 12px; --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: light) {
  :root { --bg: #f5f3ee; --surface: #fff; --surface-2: #efece5; --line: #dcd7cc;
    --text: #1d1f21; --muted: #5d6166; --accent: #9a6d12; --accent-ink: #fff; --ok: #2e7d32; }
}
* { box-sizing: border-box; }
html { color-scheme: dark light; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.55 var(--font); }
a { color: var(--accent); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5rem; }
h1 { font-size: 1.6rem; } h2 { font-size: 1.25rem; } h3 { font-size: 1.05rem; }
.muted { color: var(--muted); }
.skip { position: absolute; left: -999px; } .skip:focus { left: 8px; top: 8px; background: var(--accent); color: var(--accent-ink); padding: 8px; z-index: 10; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .75rem 1rem; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(6px); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.brand { font-weight: 800; letter-spacing: .08em; text-decoration: none; color: var(--accent); display: flex; gap: .6rem; align-items: baseline; }
.brand span { color: var(--muted); font-weight: 500; letter-spacing: 0; font-size: .9rem; }
nav { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }
nav a { color: var(--text); text-decoration: none; } nav a[aria-current="page"] { color: var(--accent); font-weight: 600; }
.link { background: none; border: 0; color: var(--muted); font: inherit; cursor: pointer; padding: 0; }
.pill { background: var(--accent); color: var(--accent-ink); border-radius: 99px; padding: 0 .45rem; font-size: .75rem; font-weight: 700; }

main { max-width: 920px; margin: 0 auto; padding: 1.25rem 16px 4rem; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; }
.grid { display: grid; gap: 1rem; }
.stats { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); margin-bottom: 1.25rem; }
.stat .big { font-size: 1.6rem; font-weight: 800; }
.bar { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; margin: .4rem 0; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: 99px; transition: width .4s; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; border: 1px solid var(--line); background: var(--surface-2);
  color: var(--text); padding: .65rem 1rem; border-radius: 10px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; min-height: 44px; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.row { display: flex; gap: .75rem; flex-wrap: wrap; align-items: center; }

.trail { display: flex; gap: 1rem; align-items: center; text-decoration: none; color: inherit; }
.trail.locked { opacity: .55; }
.badge-n { flex: none; width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; font-weight: 800;
  border: 2px solid var(--accent); color: var(--accent); }
.trail.done .badge-n { background: var(--accent); color: var(--accent-ink); }
.trail .grow { flex: 1; min-width: 0; }

.path { list-style: none; padding: 0; margin: 0; display: grid; gap: .75rem; }
.step h3 { display: flex; justify-content: space-between; gap: .5rem; }
.nodes { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .5rem; }
.node { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; border: 2px solid var(--line);
  color: var(--text); text-decoration: none; font-weight: 700; background: var(--surface-2); }
.node.done { background: var(--ok); border-color: var(--ok); color: #0b1a0c; }
.node.next { border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 25%, transparent); }
.lessons { list-style: none; padding: 0; margin: .5rem 0 0; display: grid; gap: .25rem; }
.lesson-row { display: flex; align-items: center; gap: .75rem; padding: .35rem .5rem; border-radius: 10px; color: var(--text); text-decoration: none; }
.lesson-row:hover, .lesson-row.next { background: var(--surface-2); }
.lesson-row[aria-disabled="true"] { opacity: .45; pointer-events: none; }
.lesson-row .grow { flex: 1; min-width: 0; }
.lesson-row .node { width: 34px; height: 34px; flex: none; font-size: .85rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.crumbs { font-size: .9rem; color: var(--muted); margin-bottom: .5rem; }
.video { aspect-ratio: 16/9; width: 100%; border: 0; border-radius: var(--radius); background: #000; }
.transcript { max-height: 55vh; overflow: auto; padding-right: .5rem; }
.transcript p { margin: 0 0 .5rem; }
.transcript time { color: var(--muted); font-variant-numeric: tabular-nums; font-size: .8rem; margin-right: .5rem; }
textarea, input { width: 100%; font: inherit; color: var(--text); background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: .7rem .8rem; }
textarea { min-height: 120px; resize: vertical; }
label { display: block; font-weight: 600; margin: .75rem 0 .3rem; }
.hint { font-size: .85rem; color: var(--muted); }
.error { color: var(--danger); min-height: 1.2em; }

.auth { max-width: 420px; margin: 8vh auto 0; }
.auth h1 { color: var(--accent); letter-spacing: .04em; }
.tabs { display: flex; gap: .5rem; margin: 1rem 0; }
.tabs button[aria-selected="true"] { background: var(--accent); color: var(--accent-ink); }

.badges { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.medal { text-align: center; }
.medal .ico { font-size: 2rem; }
.medal.off { opacity: .4; filter: grayscale(1); }

.toasts { position: fixed; right: 16px; bottom: 16px; display: grid; gap: .5rem; z-index: 20; }
.toast { background: var(--accent); color: var(--accent-ink); padding: .7rem 1rem; border-radius: 10px; font-weight: 700; animation: pop .25s ease-out; }
@keyframes pop { from { transform: translateY(8px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
@media (max-width: 560px) { .brand span { display: none; } h1 { font-size: 1.35rem; } }
