/* Svensklärare. Visual language: Stockholm transit signage. Black station-sign panels, one mint "signal" colour
   from the logo, every course week is a metro line with its own colour, Barlow type (OFL, self-hosted). */
@font-face { font-family: "Barlow"; src: url(../fonts/barlow-latin-400-normal.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Barlow"; src: url(../fonts/barlow-latin-500-normal.woff2) format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Barlow"; src: url(../fonts/barlow-latin-600-normal.woff2) format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Barlow"; src: url(../fonts/barlow-latin-700-normal.woff2) format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Barlow Semi Condensed"; src: url(../fonts/barlow-semi-condensed-latin-600-normal.woff2) format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Barlow Semi Condensed"; src: url(../fonts/barlow-semi-condensed-latin-700-normal.woff2) format("woff2"); font-weight: 700; font-display: swap; }

:root {
  --paper: #f3f3ef;          /* platform tiles */
  --card: #ffffff;
  --ink: #111111;
  --muted: #55585e;
  --faint: #8a8d93;
  --line: #dcdcd5;           /* hairlines */
  --frame: #111111;          /* sign frames */
  --soft: #e9e9e3;
  --sign: #111111;           /* station-sign panel */
  --sign-ink: #ffffff;
  --signal: #26f79f;         /* logo mint, used on black */
  --accent: #0b8a55;         /* mint, deep enough for text on white */
  --accent-ink: #ffffff;
  --accent-soft: #dff7ea;
  --gold: #f2b705;
  --gold-soft: #fff1c2;
  --ok: #0b8a55;
  --ok-soft: #dff7ea;
  --bad: #d23a2a;
  --bad-soft: #fbe3df;
  --lc: #111111;             /* current line colour (set per week) */
  --r: 6px;
  --font: "Barlow", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --font-head: "Barlow Semi Condensed", "Barlow", system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0d0e10; --card: #17191c; --ink: #f2f2ee; --muted: #a9adb3; --faint: #7d8188; --line: #2c2f34;
    --frame: #f2f2ee; --soft: #22252a; --sign: #000000; --accent: #26f79f; --accent-ink: #06130d; --accent-soft: #0f2a1e;
    --gold-soft: #2e2710; --ok: #26f79f; --ok-soft: #0f2a1e; --bad: #ff7a66; --bad-soft: #33150f; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #0d0e10; --card: #17191c; --ink: #f2f2ee; --muted: #a9adb3; --faint: #7d8188; --line: #2c2f34;
  --frame: #f2f2ee; --soft: #22252a; --sign: #000000; --accent: #26f79f; --accent-ink: #06130d; --accent-soft: #0f2a1e;
  --gold-soft: #2e2710; --ok: #26f79f; --ok-soft: #0f2a1e; --bad: #ff7a66; --bad-soft: #33150f; color-scheme: dark;
}

/* the 13 lines (weeks) */
.l1 { --lc: #1fa45b; } .l2 { --lc: #e0362c; } .l3 { --lc: #1f6fd6; } .l4 { --lc: #f28c1b; } .l5 { --lc: #7b4bc4; }
.l6 { --lc: #0fa3a3; } .l7 { --lc: #d9478c; } .l8 { --lc: #8a5a35; } .l9 { --lc: #d4a90c; } .l10 { --lc: #1d3b7a; }
.l11 { --lc: #6fa312; } .l12 { --lc: #b5179e; } .l13 { --lc: #4a6274; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 17px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--ink); text-decoration-color: var(--accent); text-decoration-thickness: 2px; text-underline-offset: 3px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- layout ---------- */
.app { display: grid; grid-template-columns: 1fr; min-height: 100vh; }
.side { display: none; }
main:focus { outline: none; }
main { padding: 18px 16px 108px; max-width: 760px; width: 100%; margin: 0 auto; }
#view { min-width: 0; }
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--sign); padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
}
.tabs a, .side a {
  display: flex; flex-direction: column; align-items: center; gap: 3px; text-decoration: none; color: #b9bcc2;
  font-size: 12px; font-weight: 600; letter-spacing: .02em; padding: 6px 2px; border-radius: 4px;
}
.tabs a svg, .side a svg { width: 22px; height: 22px; }
.tabs a[aria-current="page"], .side a[aria-current="page"] { color: #fff; }
.tabs a[aria-current="page"] svg, .side a[aria-current="page"] svg { color: var(--signal); }
.tabs a[aria-current="page"]::after { content: ""; width: 18px; height: 3px; background: var(--signal); border-radius: 2px; }
@media (min-width: 900px) {
  .app { grid-template-columns: 248px 1fr; }
  .tabs { display: none; }
  .side { display: flex; flex-direction: column; gap: 2px; position: sticky; top: 0; height: 100vh; padding: 22px 14px; background: var(--sign); }
  .side a { flex-direction: row; gap: 12px; font-size: 16px; padding: 10px 12px; }
  .side a[aria-current="page"] { background: #232528; box-shadow: inset 3px 0 0 var(--signal); }
  .side a:hover { color: #fff; }
  .side .brand { margin: 0 6px 22px; color: #fff; }
  main { padding: 40px 36px 64px; }
}
.brand { display: flex; align-items: center; gap: 10px; font: 700 21px/1 var(--font-head); letter-spacing: -.01em; }
.brand img, .brand svg { width: 36px; height: 36px; flex: none; background: #fff; border-radius: 9px; padding: 3px; box-shadow: 0 0 0 1px var(--line); }
.side .brand img { box-shadow: none; }
.mobile-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
@media (min-width: 900px) { .mobile-head { display: none; } }

/* ---------- type ---------- */
h1 { font: 700 32px/1.08 var(--font-head); letter-spacing: -.01em; margin: 4px 0 8px; }
h2 { font: 700 22px/1.15 var(--font-head); margin: 28px 0 12px; }
h3 { font: 700 18px/1.2 var(--font-head); margin: 0 0 6px; }
.lede { color: var(--muted); margin: 0 0 18px; font-size: 18px; }
.label { font: 700 12px/1 var(--font); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 14.5px; }
.sv { font: 600 23px/1.3 var(--font); letter-spacing: -.005em; }
.sv.big { font-size: 29px; }
.en { color: var(--muted); }
.kbd { font: 12px/1 ui-monospace, Consolas, monospace; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; padding: 2px 5px; }

/* ---------- surfaces ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; }
.card + .card { margin-top: 12px; }
.grid { display: grid; gap: 12px; }
.grid.two { grid-template-columns: 1fr; }
@media (min-width: 620px) { .grid.two { grid-template-columns: 1fr 1fr; } }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.stack > * + * { margin-top: 10px; }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 700; letter-spacing: .04em; padding: 3px 8px; border-radius: 3px; background: var(--soft); color: var(--muted); }
.pill.lvl { background: var(--ink); color: var(--paper); }
.pill.gold { background: var(--gold-soft); color: #7a5800; }
:root[data-theme="dark"] .pill.gold { color: var(--gold); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .pill.gold { color: var(--gold); } }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.tile { display: block; text-decoration: none; color: inherit; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; transition: border-color .12s, transform .12s; position: relative; }
.tile:hover { border-color: var(--frame); transform: translateY(-1px); }
.list { list-style: none; margin: 0; padding: 0; }
.list > li { padding: 12px 0; border-bottom: 1px solid var(--line); }
.list > li:last-child { border-bottom: 0; }

/* the station sign: the one dark panel per screen */
.sign { background: var(--sign); color: var(--sign-ink); border-radius: var(--r); padding: 20px; position: relative; overflow: hidden; }
.sign .label { color: #9fa3a9; }
.sign .muted, .sign .small { color: #c7cacf; }
.sign h2, .sign .title { font: 700 30px/1.05 var(--font-head); margin: 6px 0 4px; color: #fff; }
.sign .btn.primary { background: var(--signal); border-color: var(--signal); color: #06130d; }
.sign .btn.primary:hover { background: #fff; border-color: #fff; }
.sign::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 6px; background: var(--lc, var(--signal)); }

/* line badge: the week number in its line colour, like a metro line roundel */
.lb { display: inline-grid; place-items: center; min-width: 30px; height: 30px; padding: 0 6px; border-radius: 6px; background: var(--lc); color: #fff; font: 700 17px/1 var(--font-head); flex: none; }
.lb.sm { min-width: 24px; height: 24px; font-size: 14px; border-radius: 5px; }

/* ---------- controls ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 18px;
  border-radius: var(--r); border: 1.5px solid var(--frame); background: var(--card); font-weight: 700; cursor: pointer;
  text-decoration: none; color: var(--ink); -webkit-tap-highlight-color: transparent; letter-spacing: .01em;
}
.btn:hover { background: var(--soft); }
.btn:focus-visible, .icon-btn:focus-visible, .chip:focus-visible, .w:focus-visible, .station:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.btn.primary { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.btn.primary:hover { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink); text-decoration: underline; text-decoration-color: var(--accent); text-decoration-thickness: 2px; text-underline-offset: 4px; }
.btn.ghost:hover { background: var(--soft); }
details.card > summary { cursor: pointer; font-weight: 700; }
.btn.big { min-height: 56px; font-size: 18px; padding: 0 24px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .45; cursor: default; }
.btn svg { width: 20px; height: 20px; }
.icon-btn { width: 46px; height: 46px; display: inline-grid; place-items: center; border-radius: var(--r); border: 1.5px solid var(--frame); background: var(--card); cursor: pointer; flex: none; }
.icon-btn svg { width: 22px; height: 22px; }
.icon-btn.on { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.icon-btn.rec, .btn.rec { background: var(--bad); color: #fff; border-color: var(--bad); animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 8px color-mix(in srgb, var(--bad) 20%, transparent); } }
.chip { border: 1.5px solid var(--line); background: var(--card); border-radius: 4px; padding: 6px 12px; font-weight: 700; font-size: 14.5px; cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.field { width: 100%; border: 1.5px solid var(--line); border-radius: var(--r); background: var(--card); padding: 12px 14px; font-size: 18px; }
.field:focus { outline: none; border-color: var(--frame); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea.field { min-height: 92px; resize: vertical; line-height: 1.45; }
input[type="range"] { accent-color: var(--accent); }

/* rating buttons */
.rate { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.rate button { min-height: 60px; border-radius: var(--r); border: 1.5px solid var(--line); background: var(--card); cursor: pointer; font-weight: 700; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.1; }
.rate button:hover { border-color: var(--frame); }
.rate button small { font-weight: 600; color: var(--faint); font-size: 12px; margin-top: 3px; }
.rate .again { color: var(--bad); } .rate .hard { color: #a16207; } .rate .good { color: var(--ok); } .rate .easy { color: var(--ink); }

/* tappable words */
.w { cursor: pointer; border-radius: 3px; padding: 0 1px; border-bottom: 2px dotted transparent; }
.w:hover { border-bottom-color: var(--accent); }
.w.sel { background: var(--gold-soft); }
.w.new { border-bottom-color: var(--gold); }
.karaoke .line { padding: 10px 12px; border-radius: var(--r); cursor: pointer; transition: background .2s; border-left: 4px solid transparent; }
.karaoke .line.now { background: var(--soft); border-left-color: var(--lc, var(--accent)); }
.karaoke .scene { text-align: center; padding: 10px 0 4px; letter-spacing: .02em; }
.karaoke .who { font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--faint); }
.karaoke .line .sv { font-size: 20px; }
.hide-en .en { display: none; }
.hide-sv .line .sv { filter: blur(6px); }
.hide-sv .line.now .sv, .hide-sv .line.shown .sv { filter: none; }
.hide-sv .line.mine:not(.shown) .sv { filter: blur(6px); }

/* progress */
.bar { height: 6px; background: var(--soft); border-radius: 0; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--lc, var(--accent)); }
.sign .bar { background: #2a2c30; }
.bar.gold > i { background: var(--gold); }
.ring { --p: 0; width: 64px; height: 64px; border-radius: 50%; background: conic-gradient(var(--accent) calc(var(--p) * 1%), var(--soft) 0); display: grid; place-items: center; flex: none; }
.ring > span { width: 50px; height: 50px; border-radius: 50%; background: var(--card); display: grid; place-items: center; font-weight: 700; font-size: 15px; }
.stat { font: 700 30px/1 var(--font-head); }
.heat { display: grid; grid-template-columns: repeat(14, 1fr); gap: 4px; }
.heat i { aspect-ratio: 1; border-radius: 2px; background: var(--soft); }
.heat i.l1 { background: color-mix(in srgb, var(--accent) 30%, var(--soft)); }
.heat i.l2 { background: color-mix(in srgb, var(--accent) 60%, var(--soft)); }
.heat i.l3 { background: var(--accent); }

/* diff */
.diff span { padding: 1px 3px; border-radius: 3px; margin-right: 2px; }
.diff .ok { background: var(--ok-soft); color: var(--ok); }
.diff .near { background: var(--gold-soft); color: #7a5800; }
.diff .miss { background: var(--bad-soft); color: var(--bad); text-decoration: line-through; }
.diff .extra { color: var(--faint); }

.note { background: var(--gold-soft); border-radius: var(--r); padding: 12px 14px; font-size: 15.5px; border-left: 4px solid var(--gold); }
.note.blue { background: var(--soft); border-left-color: var(--lc, var(--ink)); }
.note.green { background: var(--ok-soft); border-left-color: var(--ok); }
.toast { position: fixed; left: 50%; bottom: 100px; transform: translateX(-50%); background: var(--sign); color: #fff; padding: 11px 16px; border-radius: var(--r); font-weight: 600; z-index: 50; max-width: calc(100% - 32px); box-shadow: inset 0 -3px 0 var(--signal); }
@media (min-width: 900px) { .toast { bottom: 28px; } }
.pop { position: fixed; inset: auto 12px 96px 12px; z-index: 40; max-width: 520px; margin: 0 auto; box-shadow: 0 10px 30px rgba(0,0,0,.18); }
@media (min-width: 900px) { .pop { inset: auto 24px 24px auto; width: 400px; } }
.empty { text-align: center; padding: 28px 12px; color: var(--muted); }
.hr { height: 1px; background: var(--line); margin: 18px 0; }
.choice { display: grid; gap: 8px; }
.choice button { text-align: left; padding: 14px 16px; border-radius: var(--r); border: 1.5px solid var(--line); background: var(--card); cursor: pointer; font-weight: 600; font-size: 18px; }
.choice button:hover { border-color: var(--frame); }
.choice button.right { border-color: var(--ok); background: var(--ok-soft); }
.choice button.wrong { border-color: var(--bad); background: var(--bad-soft); }
.order { display: flex; flex-wrap: wrap; gap: 8px; min-height: 52px; padding: 8px; border: 1.5px dashed var(--line); border-radius: var(--r); }
.order button { padding: 8px 12px; border-radius: 4px; border: 1.5px solid var(--frame); background: var(--card); font-weight: 700; font-size: 18px; cursor: pointer; }
.fade-in { animation: fade .18s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } }

/* ---------- the 90-day metro map ---------- */
.week { margin: 28px 0 8px; }
.week-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.week-head h2 { margin: 0; }
.week-head .en { font-size: 15px; }
.map { position: relative; padding-left: 34px; }
.map::before { content: ""; position: absolute; left: 13px; top: 8px; bottom: 8px; width: 8px; background: var(--lc); border-radius: 4px; }
.station { position: relative; display: flex; align-items: center; gap: 12px; padding: 9px 10px 9px 8px; margin: 0 0 2px; border-radius: var(--r); color: inherit; text-decoration: none; min-height: 52px; }
a.station:hover { background: var(--card); }
.station .dot { position: absolute; left: -29px; width: 20px; height: 20px; border-radius: 50%; background: var(--card); border: 4px solid var(--lc); }
.station.done .dot { background: var(--lc); }
.station.done .dot::after { content: ""; position: absolute; inset: 3px 4px 5px 4px; border: solid #fff; border-width: 0 0 2.5px 2.5px; transform: rotate(-45deg); }
.station.review .dot { width: 26px; left: -32px; border-radius: 7px; border-color: var(--frame); }
.station.now .dot { width: 28px; height: 28px; left: -33px; border-width: 6px; border-color: var(--ink); background: var(--signal); }
.station.now { background: var(--card); border: 1.5px solid var(--frame); }
.station.locked { color: var(--faint); }
.station.locked .dot { border-color: color-mix(in srgb, var(--lc) 45%, var(--paper)); }
.station .t { display: flex; flex-direction: column; min-width: 0; }
.station .t b { font-weight: 700; font-size: 17px; }
.station .t span { font-size: 14px; color: var(--muted); }
.station.locked .t span { color: var(--faint); }
.station .no { margin-left: auto; font: 700 14px/1 var(--font-head); color: var(--faint); letter-spacing: .04em; }
.here { font: 700 11px/1 var(--font); letter-spacing: .14em; text-transform: uppercase; background: var(--signal); color: #06130d; padding: 4px 6px; border-radius: 3px; margin-left: auto; }

/* lesson: steps drawn as a short line with stops */
.stepper { max-width: 100%; list-style: none; display: flex; padding: 0; margin: 16px 0 18px; overflow-x: auto; scrollbar-width: none; position: relative; }
.stepper li { flex: 1 0 auto; position: relative; display: flex; flex-direction: column; align-items: center; min-width: 74px; }
.stepper li::before { content: ""; position: absolute; top: 10px; left: 0; right: 0; height: 5px; background: color-mix(in srgb, var(--lc, var(--ink)) 25%, var(--paper)); }
.stepper li:first-child::before { left: 50%; } .stepper li:last-child::before { right: 50%; }
.stepper li.past::before, .stepper li.now::before { background: var(--lc, var(--ink)); }
.stepper li.now::before { right: 50%; }
.stepper li:first-child.now::before { display: none; }
.stepper li button { position: relative; display: flex; flex-direction: column; align-items: center; gap: 7px; border: 0; background: none; cursor: pointer; font: 600 13px/1.1 var(--font); color: var(--muted); padding: 0 4px; white-space: nowrap; }
.stepper li button::before { content: ""; width: 14px; height: 14px; border-radius: 50%; background: var(--card); border: 4px solid color-mix(in srgb, var(--lc, var(--ink)) 35%, var(--paper)); }
.stepper li.past button::before { background: var(--lc, var(--ink)); border-color: var(--lc, var(--ink)); }
.stepper li.now button { color: var(--ink); font-weight: 700; }
.stepper li.now button::before { width: 18px; height: 18px; border: 5px solid var(--ink); background: var(--signal); margin-top: -2px; }
.stepper li button[disabled] { cursor: default; }
@media (max-width: 600px) {          /* phones: every stop fits; only the current one is named */
  .stepper { overflow: visible; margin-bottom: 26px; }
  .stepper li { flex: 1 1 0; min-width: 0; }
  .stepper li button { font-size: 0; padding: 0; }
  .stepper li.now button { font-size: 13px; }
}
.lesson-stage { display: grid; gap: 12px; }
.lesson-nav { justify-content: space-between; margin-top: 18px; position: sticky; bottom: 84px; background: color-mix(in srgb, var(--paper) 88%, transparent); padding: 10px 0; backdrop-filter: blur(6px); }
@media (min-width: 900px) { .lesson-nav { bottom: 0; } }
.phrase mark { background: var(--gold-soft); color: inherit; border-radius: 2px; padding: 0 2px; box-shadow: inset 0 -2px 0 var(--gold); }
.center { text-align: center; align-items: center; }
.big-check { width: 68px; height: 68px; border-radius: 50%; background: var(--signal); color: #06130d; display: grid; place-items: center; border: 6px solid var(--ink); }
.big-check svg { width: 30px; height: 30px; }
.certificate { border: 2px solid var(--frame); border-radius: var(--r); padding: 20px; display: grid; gap: 6px; justify-items: center; background: var(--card); box-shadow: inset 0 -8px 0 var(--signal); }
.btn.good { border-color: var(--ok); background: var(--ok-soft); }
.btn.wrong { border-color: var(--bad); background: var(--bad-soft); }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
@media print { .side, .tabs, .stepper, .lesson-nav, .btn { display: none !important; } }
