@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght,SOFT@9..144,400..800,50&family=Public+Sans:wght@400;500;600;700&display=swap');

:root {
  --night: #0f1b2d; --night-2: #16253d; --sheet: #ffffff; --grid: rgba(15,27,45,.06);
  --ink: #1b2233; --ink-2: #4a5468; --ink-3: #8a93a6; --line: #e3e7ef;
  --brand: #1f5f4a; --brand-2: #2b8a6b; --chalk: #ffd166; --chalk-2: #f4b400; --coral: #e4572e; --sky: #2a4a8f;
  --r-lg: 22px; --r: 14px; --r-sm: 10px;
  --display: "Fraunces", Georgia, serif; --body: "Public Sans", -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--night); color: var(--ink); font-family: var(--body); font-size: 17px; line-height: 1.55; -webkit-font-smoothing: antialiased; }
a { color: var(--brand); }
h1, h2, h3 { font-family: var(--display); font-weight: 600; line-height: 1.1; margin: 0 0 .5rem; letter-spacing: -.012em; font-variation-settings: "SOFT" 50; }
h1 { font-size: clamp(1.9rem, 4.5vw, 2.6rem); } h2 { font-size: 1.45rem; } h3 { font-size: 1.15rem; }
p { margin: 0 0 .85rem; max-width: 74ch; }
.muted { color: var(--ink-2); } .small { font-size: .92rem; }
.wrap { max-width: 820px; margin: 0 auto; padding: 18px; }
@media (max-width: 600px) { .wrap { padding: 12px; } }

/* top bar */
.topbar { position: sticky; top: 0; z-index: 20; background: var(--brand); color: #fff; }
.topbar .wrap { display: flex; align-items: center; justify-content: space-between; padding: 12px 28px; max-width: 1560px; }
.brand { font-family: var(--display); font-weight: 700; font-size: 1.15rem; color: #fff; text-decoration: none; }
.brand small { font-family: var(--body); font-weight: 500; opacity: .75; margin-left: 8px; font-size: .85rem; }
.topbar button { background: rgba(255,255,255,.12); color: #fff; border: 0; }
.topbar button.ghost { border: 1px solid rgba(255,255,255,.3); color: #fff; background: transparent; }

/* sheet (card) */
.card { position: relative; background: var(--sheet); border-radius: var(--r-lg); padding: 22px; margin-bottom: 16px; box-shadow: 0 20px 50px rgba(0,0,0,.35); }
.card.flat { box-shadow: none; }
.card.notebook { background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px); background-size: 24px 24px; }
.card.notebook::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 6px; border-radius: var(--r-lg) 0 0 var(--r-lg); background: var(--chalk); }
@media (max-width: 600px) { .card { padding: 18px 16px; border-radius: 18px; } }

.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 520px) { .grid2 { grid-template-columns: 1fr; } }

/* controls */
button, .btn { display: inline-flex; align-items: center; gap: 8px; font: 600 1rem var(--body); padding: 12px 18px; border-radius: 999px; border: 1px solid transparent; background: var(--ink); color: #fff; cursor: pointer; text-decoration: none; transition: transform .08s ease, background .15s; }
button:active, .btn:active { transform: translateY(1px); }
button.primary, .btn.primary { background: var(--brand); }
button.secondary, .btn.secondary { background: #fff; color: var(--ink); border-color: var(--line); }
button.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
button.danger { background: var(--coral); }
button:disabled { opacity: .45; cursor: default; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid var(--chalk); outline-offset: 2px; }
input, select, textarea { font: inherit; width: 100%; padding: 12px 14px; border: 1.5px solid var(--line); border-radius: var(--r-sm); background: #fff; color: var(--ink); }
input:focus, textarea:focus { border-color: var(--ink); }
textarea { min-height: 110px; resize: vertical; }
label { display: block; font-size: .92rem; font-weight: 600; color: var(--ink-2); margin: 12px 0 6px; }
input[type=range] { padding: 0; height: 32px; accent-color: var(--chalk-2); }

/* pills */
.pill { display: inline-block; font-size: .78rem; font-weight: 600; padding: 4px 11px; border-radius: 999px; background: #edf4f0; color: var(--brand); }
.pill.ai { background: #fff6dc; color: #8a5a00; }
.pill.academic { background: #e9eefb; color: var(--sky); }
.pill.locked { background: #f1f2f5; color: var(--ink-3); }
.pill.ok { background: #e3f3ea; color: #1c6b48; }
.pill.warn { background: #fdeae4; color: #b13e1c; }

/* stats, lists */
.stat { text-align: center; padding: 14px 8px; }
.stat b { display: block; font-family: var(--display); font-size: 2rem; font-weight: 700; color: var(--ink); line-height: 1; }
.stat span { font-size: .82rem; color: var(--ink-2); }
.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: 13px 0; border-top: 1px solid var(--line); display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.list li:first-child { border-top: 0; }
.list li a { font-weight: 600; text-decoration: none; color: var(--ink); }
.tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 10px; }
.tabs button { white-space: nowrap; background: rgba(255,255,255,.08); color: #fff; border-color: transparent; padding: 8px 14px; }
.tabs button.active { background: var(--chalk); color: var(--ink); }
.progress { height: 8px; background: #edf0f5; border-radius: 999px; overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--brand-2); }
footer { text-align: center; color: rgba(255,255,255,.45); font-size: .82rem; padding: 28px 0; }
.toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 11px 18px; border-radius: 999px; font-size: .92rem; opacity: 0; transition: opacity .2s; pointer-events: none; z-index: 50; box-shadow: 0 10px 30px rgba(0,0,0,.4); }
.toast.show { opacity: 1; }
.center { text-align: center; }
#view > h1, #view > h2 { color: #fff; }
#view > p.muted, #view > a.small { color: rgba(255,255,255,.65); }

/* ---------- lesson page ---------- */
.lesson-wrap { max-width: 1560px; margin: 0 auto; padding: 22px 28px; display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 36px; }
@media (min-width: 1400px) { .lesson-wrap { padding: 28px 40px; } .card.notebook { padding: 36px 48px; } body { font-size: 18px; } .lesson-body p, .q .qt { max-width: 78ch; } .step h2 { font-size: 1.8rem; } }
@media (max-width: 1040px) { .lesson-wrap { grid-template-columns: minmax(0, 1fr); padding: 12px; } .rail { display: none; } }
.rail { position: sticky; top: 84px; align-self: start; color: #fff; }
.rail ol { list-style: none; margin: 0 0 12px; padding: 0; border-left: 2px solid rgba(255,255,255,.14); }
.rail li { position: relative; padding: 8px 0 8px 18px; color: rgba(255,255,255,.5); font-size: .95rem; font-weight: 500; transition: color .2s; }
.rail li::before { content: ""; position: absolute; left: -6px; top: 15px; width: 10px; height: 10px; border-radius: 50%; background: var(--night); border: 2px solid rgba(255,255,255,.3); transition: all .2s; }
.rail li.active { color: #fff; }
.rail li.active::before { background: var(--chalk); border-color: var(--chalk); box-shadow: 0 0 0 5px rgba(255,209,102,.18); }
.rail li.done { color: rgba(255,255,255,.75); }
.rail li.done::before { background: var(--brand-2); border-color: var(--brand-2); }
.rail .back { color: rgba(255,255,255,.6); text-decoration: none; font-size: .9rem; display: inline-block; margin-bottom: 14px; }
.rail .back:hover { color: #fff; }
.rail .mentor { margin-top: 18px; min-height: 10px; }

.lesson-head .meta { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0 0; }
.lesson-head .meta span { font-size: .85rem; color: var(--ink-2); background: #f3f5f9; padding: 5px 11px; border-radius: 999px; }
.lesson-head .listen { margin-top: 14px; }
.mini-steps { display: none; gap: 6px; margin: 14px 0 4px; }
@media (max-width: 1040px) { .mini-steps { display: flex; } }
.mini-steps i { flex: 1; height: 4px; border-radius: 2px; background: #e9edf3; }
.mini-steps i.active { background: var(--chalk-2); } .mini-steps i.done { background: var(--brand-2); }

.lesson-body h3 { margin-top: 1rem; }
.lesson-body ol, .lesson-body ul { padding-left: 1.2rem; }
.lesson-body .formula { font-family: var(--display); font-size: 1.35rem; text-align: center; padding: 16px; margin: 12px 0; background: var(--night); color: var(--chalk); border-radius: var(--r); }
.step { margin: 34px 0 0; padding-top: 22px; border-top: 1px dashed var(--line); }
.step:first-child { margin-top: 10px; border-top: 0; padding-top: 0; }
.step .pill { margin-bottom: 10px; }
.step h2 { font-size: 1.6rem; margin-bottom: 10px; }
.step .lead { font-size: 1.12rem; }

/* sim stage */
.widget { margin: 14px 0 4px; border-radius: var(--r); overflow: hidden; background: var(--night-2); color: #fff; box-shadow: 0 16px 40px rgba(0,0,0,.35); }
.widget canvas { width: 100%; display: block; }
.widget .controls { padding: 14px 16px 16px; display: grid; grid-template-columns: 1fr auto; gap: 12px 16px; align-items: end; }
@media (max-width: 520px) { .widget .controls { grid-template-columns: 1fr; } }
.widget label { color: rgba(255,255,255,.75); margin: 0 0 6px; }
.widget label b { color: var(--chalk); font-size: 1.1rem; }
.widget input[type=number] { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.18); color: #fff; }
.widget input[type=number]::placeholder { color: rgba(255,255,255,.4); }
.widget .throw { background: var(--chalk); color: var(--ink); font-weight: 700; padding: 14px 24px; }
.widget .result { grid-column: 1 / -1; min-height: 1.4em; color: rgba(255,255,255,.85); }
.widget table { width: 100%; border-collapse: collapse; font-size: .95rem; grid-column: 1 / -1; }
.widget th { font-weight: 500; color: rgba(255,255,255,.55); text-align: center; padding: 6px 4px; }
.widget th:first-child, .widget td:first-child { text-align: left; }
.widget td { padding: 8px 4px; border-top: 1px solid rgba(255,255,255,.1); text-align: center; }
.widget .guessv { color: #ff9a7a; } .widget .actualv { color: var(--chalk); font-weight: 700; }
.widget .pattern { grid-column: 1 / -1; background: var(--chalk); color: var(--ink); padding: 14px 16px; border-radius: var(--r-sm); line-height: 1.5; }

/* questions */
.q { padding: 18px 0; border-top: 1px solid var(--line); }
.q:first-child { border-top: 0; padding-top: 6px; }
.q .qt { font-weight: 600; font-size: 1.05rem; margin-bottom: 10px; }
.q .opt { position: relative; display: flex; align-items: center; gap: 12px; padding: 11px 14px; margin: 8px 0; border: 1.5px solid var(--line); border-radius: var(--r-sm); cursor: pointer; transition: border-color .12s, background .12s; }
.q .opt:hover { border-color: var(--ink-3); }
.q .opt input { position: absolute; opacity: 0; width: 0; height: 0; }
.q .opt .k { flex: 0 0 28px; height: 28px; border-radius: 50%; background: #f1f3f7; color: var(--ink-2); font-weight: 700; font-size: .85rem; display: grid; place-items: center; }
.q .opt:has(input:checked) { border-color: var(--ink); background: #f7f8fb; }
.q .opt:has(input:checked) .k { background: var(--ink); color: #fff; }
.q .opt.correct { border-color: var(--brand-2); background: #e9f6ef; }
.q .opt.correct .k { background: var(--brand-2); color: #fff; }
.q .opt.wrong { border-color: var(--coral); background: #fdf0eb; }
.q .opt.wrong .k { background: var(--coral); color: #fff; }
.explain { font-size: .95rem; color: var(--ink-2); margin-top: 8px; padding-left: 14px; border-left: 3px solid var(--chalk); }
.hint { font-size: .9rem; color: #8a5a00; cursor: pointer; display: inline-block; margin-bottom: 4px; }
.hint:hover { text-decoration: underline; }

/* landing */
.hero { background: linear-gradient(160deg, var(--brand), var(--brand-2)); color: #fff; padding: 44px 0 36px; }
.hero h1 { font-size: clamp(2.1rem, 5vw, 3rem); color: #fff; max-width: 14ch; }
.hero p { font-size: 1.1rem; opacity: .95; max-width: 52ch; }
.hero .btn { background: var(--chalk); color: var(--ink); margin-top: 12px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 16px 0 0; }
.chips span { background: rgba(255,255,255,.15); padding: 6px 12px; border-radius: 999px; font-size: .88rem; }
.landing h2 { color: #fff; margin-top: 30px; }
.feature { padding: 16px; border-radius: var(--r); background: #fff; }
.feature b { display: block; margin-bottom: 4px; font-family: var(--display); font-size: 1.1rem; }
.weekstrip { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; }
.weekstrip div { background: #fff; border-radius: var(--r-sm); padding: 12px; font-size: .92rem; }
.weekstrip b { color: var(--brand); font-family: var(--display); }
.price { font-family: var(--display); font-size: 2.6rem; font-weight: 700; color: var(--ink); }
details { border-top: 1px solid var(--line); padding: 10px 0; }
details summary { font-weight: 600; cursor: pointer; }
.wa { background: #25d366; color: #fff; }
.logline { font-family: ui-monospace, Menlo, monospace; font-size: .8rem; padding: 2px 0; }
.logline.ok { color: #1c6b48; } .logline.err { color: var(--coral); font-weight: 700; }
#log { max-height: 320px; overflow: auto; background: #f7f8fb; border: 1px solid var(--line); border-radius: 10px; padding: 10px; }
.video { aspect-ratio: 16/9; width: 100%; border: 0; border-radius: var(--r); background: #000; }



.wrap.wide { max-width: none; padding: 0; }

/* explainer */
.explainer .cap { font-size: 1.05rem; line-height: 1.45; color: #fff; } .explainer .cap .n { color: var(--chalk); font-weight: 700; margin-right: 6px; }
.explainer .next { background: var(--chalk); color: var(--ink); }
/* next word */
.nextword .cands { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; min-height: 40px; }
.nextword .cand { background: rgba(255,255,255,.1); padding: 6px 12px; border-radius: 999px; font-size: .95rem; } .nextword .cand b { color: var(--chalk); margin-left: 4px; }
.nextword .cands .small { width: 100%; }
.nextword .out { min-height: 2.4em; font-size: 1.15rem; line-height: 1.7; padding: 10px 12px; background: rgba(255,255,255,.06); border-radius: var(--r-sm); }
.nextword .tok.gen { background: var(--chalk); color: var(--ink); padding: 2px 6px; border-radius: 6px; animation: tok-in .25s ease-out; }
@keyframes tok-in { from { transform: scale(.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.nextword .go { background: var(--chalk); color: var(--ink); }
/* spot */
.spot .spot-item { padding: 12px 0; border-top: 1px solid rgba(255,255,255,.1); } .spot .st { font-size: 1.05rem; margin-bottom: 8px; }
.spot .v { background: rgba(255,255,255,.08); color: #fff; border-color: rgba(255,255,255,.18); padding: 8px 14px; } .spot .v.picked { background: var(--chalk); color: var(--ink); border-color: var(--chalk); }
.spot .why { margin-top: 8px; font-size: .95rem; color: rgba(255,255,255,.85); }
.spot .check { background: var(--chalk); color: var(--ink); justify-self: start; }
/* cards */
.cards .deck { perspective: 800px; display: grid; place-items: center; padding: 10px 0; }
.cards .cardq { width: min(100%, 520px); min-height: 150px; display: grid; place-items: center; text-align: center; padding: 24px; font-family: var(--display); font-size: 1.5rem; line-height: 1.25; color: var(--ink); background: #fff; border-radius: var(--r); box-shadow: 0 16px 40px rgba(0,0,0,.4); transition: transform .22s ease, opacity .22s; }
.cards .cardq.swipe-r { transform: translateX(60%) rotate(12deg); opacity: 0; } .cards .cardq.swipe-l { transform: translateX(-60%) rotate(-12deg); opacity: 0; }
.cards .yes { background: var(--chalk); color: var(--ink); } .cards .no { background: rgba(255,255,255,.08); color: #fff; border-color: rgba(255,255,255,.2); }
.cards .bar { display: grid; grid-template-columns: 1fr 44px; gap: 8px; align-items: center; margin: 8px 0; } .cards .bar span { grid-column: 1 / -1; font-size: .95rem; }
.cards .bar i { display: block; height: 10px; border-radius: 999px; background: var(--chalk); transition: width .6s ease; } .cards .bar b { text-align: right; color: var(--chalk); }

/* dashboard */
.dash { max-width: 1560px; margin: 0 auto; padding: 22px 28px; display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 28px; }
@media (max-width: 1040px) { .dash { grid-template-columns: 1fr; padding: 12px; } }
.dash-head h1 { color: #fff; } .dash-head p { color: rgba(255,255,255,.65); } .dash-head a { color: var(--chalk); }
.dash .stats { display: grid; grid-template-columns: repeat(3, 1fr); padding: 8px; }
.lessons { list-style: none; margin: 10px 0 0; padding: 0; }
.lessons li { display: grid; grid-template-columns: 40px 1fr auto; gap: 14px; align-items: center; padding: 14px 0; border-top: 1px solid var(--line); }
.lessons li:first-child { border-top: 0; }
.lessons .num { width: 36px; height: 36px; border-radius: 50%; background: var(--night); color: var(--chalk); font-family: var(--display); font-weight: 700; display: grid; place-items: center; }
.lessons li.done .num { background: var(--brand-2); color: #fff; }
.lessons .t a { font-family: var(--display); font-size: 1.15rem; font-weight: 600; color: var(--ink); text-decoration: none; }
.lessons .t .pill { font-size: .72rem; padding: 2px 8px; }
.mentor-card { display: grid; place-items: center; background: transparent; box-shadow: none; }
.mentor-card .stickman.inline { width: 150px; } .mentor-card .stickman.inline .name { color: rgba(255,255,255,.7); }
.mentor-card .stickman.inline .sm path { stroke: #fff; } .mentor-card .stickman.inline .sm .head > circle { stroke: #fff; } .mentor-card .stickman.inline .sm .hand { fill: #fff; } .mentor-card .stickman.inline .sm .face path { stroke: #1b2233 !important; }
#view.wide > h1 { padding: 0 28px; }
