/* ===== Taalstroom =====
   Rustig en plat: wit papier, haarlijnen, één groene kleur voor de hoofdactie.
   Blauw en geel zijn alleen woordkleuren (nieuw / leerwoord), nooit interface. */
:root {
  --bg: #ffffff;
  --card: #ffffff;
  --surface: #f6f6f4;
  --ink: #1d1c1a;
  --text: #3d3c39;
  --muted: #74726b;
  --line: #e8e7e3;
  --line-strong: #d4d2cc;
  --accent: #278458;
  --accent-hover: #1f6e49;
  --accent-ink: #ffffff;
  --accent-soft: #e8f3ec;
  --good: #278458;
  --bad: #b8402c;
  --new: rgba(62, 124, 222, .15);
  --new-line: rgba(62, 124, 222, .8);
  --new-fg: #2c63bd;
  --hl1: #ffe38a;
  --hl2: #ffeeb5;
  --hl3: #fff6d6;
  --hl-line: #d9a600;
  --hl-fg: #946c00;
  --shadow: none;
  --float: 0 10px 34px rgba(20, 20, 18, .14), 0 1px 3px rgba(20, 20, 18, .08);
  --radius: 8px;
  --r-btn: 6px;
  --ui: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --display: "Charter", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --read: "Charter", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --bg: #141414; --card: #1b1b1a; --surface: #222220; --ink: #efeeea; --text: #d6d4ce; --muted: #9a9890;
    --line: #2c2b29; --line-strong: #3b3a37; --accent: #47a877; --accent-hover: #5bbb89; --accent-ink: #0c1f15; --accent-soft: #1b2e23;
    --new: rgba(110, 160, 255, .2); --new-line: rgba(130, 175, 255, .85); --new-fg: #8db4ff;
    --hl1: rgba(240, 196, 60, .42); --hl2: rgba(240, 196, 60, .27); --hl3: rgba(240, 196, 60, .14); --hl-line: rgba(240, 196, 60, .8); --hl-fg: #f0c84a;
    --float: 0 10px 34px rgba(0, 0, 0, .5), 0 1px 3px rgba(0, 0, 0, .4);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #141414; --card: #1b1b1a; --surface: #222220; --ink: #efeeea; --text: #d6d4ce; --muted: #9a9890;
  --line: #2c2b29; --line-strong: #3b3a37; --accent: #47a877; --accent-hover: #5bbb89; --accent-ink: #0c1f15; --accent-soft: #1b2e23;
  --new: rgba(110, 160, 255, .2); --new-line: rgba(130, 175, 255, .85); --new-fg: #8db4ff;
  --hl1: rgba(240, 196, 60, .42); --hl2: rgba(240, 196, 60, .27); --hl3: rgba(240, 196, 60, .14); --hl-line: rgba(240, 196, 60, .8); --hl-fg: #f0c84a;
  --float: 0 10px 34px rgba(0, 0, 0, .5), 0 1px 3px rgba(0, 0, 0, .4);
  color-scheme: dark;
}
:root[data-theme="sepia"] {
  --bg: #f6efdf; --card: #fbf6ea; --surface: #efe6d2; --ink: #33291d; --text: #4a3d2c; --muted: #7d6c57;
  --line: #e4d8bf; --line-strong: #d3c4a6; --accent-soft: #e6ecdc;
  --new: rgba(70, 120, 200, .15);
}
.reader[data-hl="green"] {
  --hl1: rgba(46, 160, 95, .38); --hl2: rgba(46, 160, 95, .24); --hl3: rgba(46, 160, 95, .13); --hl-line: rgba(30, 130, 72, .85); --hl-fg: #1b7a45;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15.5px/1.5 var(--ui); padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
a { color: var(--accent); }
h1 { font-family: var(--display); font-weight: 600; font-size: 1.7rem; line-height: 1.2; margin: 0 0 .3rem; color: var(--ink); text-wrap: balance; }
h2 { font-size: 1rem; font-weight: 650; margin: 1.8rem 0 .6rem; color: var(--ink); }
h3 { font-size: .9rem; font-weight: 650; margin: 1.2rem 0 .4rem; color: var(--ink); }
.muted { color: var(--muted); }
.small, small { font-size: .84rem; }
.lead { font-size: 1.02rem; max-width: 60ch; color: var(--muted); text-wrap: pretty; }
[hidden] { display: none !important; }
kbd { font: 600 .74rem var(--ui); background: var(--surface); border: 1px solid var(--line); border-radius: 4px; padding: 1px 6px; }
.ico { flex: none; display: block; }

/* ---------- kop en navigatie ---------- */
.top {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  height: 54px; padding: 0 16px; background: var(--bg); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; font-size: 1.05rem; letter-spacing: -.02em; color: var(--ink); text-decoration: none; }
.brand img { border-radius: 6px; }
.top-right { display: flex; align-items: center; gap: 6px; }
.coins { display: flex; align-items: center; gap: 6px; padding: 4px 8px; border-radius: var(--r-btn); color: var(--ink); font-weight: 600; font-size: .85rem; font-variant-numeric: tabular-nums; text-decoration: none; }
.coins:hover { background: var(--surface); }
.ring-bg { fill: none; stroke: var(--line); stroke-width: 4; }
.ring-fg { fill: none; stroke: var(--accent); stroke-width: 4; stroke-linecap: round; }
.lang-sel { font: inherit; font-size: .88rem; font-weight: 600; padding: 6px 28px 6px 10px; border-radius: var(--r-btn); border: 1px solid var(--line); background: var(--bg); color: var(--ink); max-width: 40vw; }
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; justify-content: space-around;
  background: var(--bg); border-top: 1px solid var(--line); padding: 6px 4px calc(4px + env(safe-area-inset-bottom));
}
.tabs a { position: relative; display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 60px; font-size: .68rem; font-weight: 550; color: var(--muted); text-decoration: none; padding: 2px 6px; }
.tabs a.on { color: var(--accent); }
.badge { position: absolute; top: -2px; left: calc(50% + 6px); min-width: 17px; padding: 0 5px; border-radius: 9px; background: var(--accent); color: var(--accent-ink); font-size: .66rem; font-weight: 700; line-height: 17px; text-align: center; }
@media (min-width: 780px) {
  body { padding-bottom: 0; }
  .tabs { position: sticky; top: 54px; bottom: auto; justify-content: flex-start; gap: 2px; padding: 0 16px; border-top: 0; border-bottom: 1px solid var(--line); }
  .tabs a { flex-direction: row; gap: 7px; min-width: 0; font-size: .9rem; padding: 12px 12px 11px; border-bottom: 2px solid transparent; margin-bottom: -1px; }
  .tabs a .ico { width: 18px; height: 18px; }
  .tabs a:hover { color: var(--ink); }
  .tabs a.on { color: var(--ink); border-bottom-color: var(--accent); }
  .badge { position: static; margin-left: 2px; }
}
body[data-view="les"] .tabs, body.onboarding .tabs { display: none; }
body[data-view="les"] { padding-bottom: 0; }

/* ---------- algemeen ---------- */
main { padding: 22px 16px 48px; }
.page { max-width: 1080px; margin: 0 auto; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; margin-top: 16px; }
.row.center { justify-content: center; }
.row.between { justify-content: space-between; }
.row.tight { gap: 2px; flex-wrap: nowrap; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 560px) { .two { grid-template-columns: 1fr; } }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; font: inherit; font-size: .92rem; font-weight: 600;
  min-height: 38px; padding: 0 14px; border-radius: var(--r-btn); cursor: pointer; border: 1px solid var(--line-strong); background: var(--bg); color: var(--ink);
  text-decoration: none; transition: background .15s, border-color .15s, color .15s; white-space: nowrap;
}
.btn:hover { background: var(--surface); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text); }
.btn.ghost:hover { background: var(--surface); }
.btn.small { min-height: 32px; padding: 0 10px; font-size: .84rem; }
.btn.good { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.bad { background: var(--bg); border-color: var(--line-strong); color: var(--ink); }
.btn.danger, .danger { color: var(--bad); }
.icon { font: inherit; font-size: 1rem; min-width: 36px; height: 36px; border-radius: var(--r-btn); flex: none; border: 0; background: transparent; color: var(--text); cursor: pointer; text-decoration: none; display: inline-grid; place-items: center; }
.icon:hover { background: var(--surface); color: var(--ink); }
.icon:disabled { opacity: .3; }
.icon.small { min-width: 28px; height: 28px; font-size: .85rem; }
.linkish { background: none; border: 0; color: var(--muted); font: inherit; cursor: pointer; padding: 0; }
.linkish:hover { color: var(--ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.field { width: 100%; font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line-strong); border-radius: var(--r-btn); padding: 8px 11px; min-height: 38px; }
.field:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.field.short { width: auto; min-width: 90px; }
textarea.field { resize: vertical; }
textarea.read { font-family: var(--read); font-size: 1.05rem; line-height: 1.6; }
.fieldrow { display: grid; gap: 6px; margin: 10px 0; }
.fieldrow > span { font-weight: 600; font-size: .86rem; color: var(--ink); }
.short-row { max-width: 280px; }
.toggle { display: flex; gap: 8px; align-items: flex-start; margin: 7px 0; cursor: pointer; }
.toggle input { margin-top: 4px; accent-color: var(--accent); }
.notice { background: var(--surface); border-left: 3px solid var(--accent); padding: 10px 14px; border-radius: 0 var(--r-btn) var(--r-btn) 0; font-size: .9rem; color: var(--text); }
.empty { text-align: center; padding: 44px 16px; background: var(--surface); border-radius: var(--radius); color: var(--muted); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 8px 0; }
.chips.tight { margin: 2px 0 0; gap: 4px; }
.chip { font: inherit; font-size: .86rem; padding: 4px 11px; border-radius: 999px; cursor: pointer; border: 1px solid var(--line-strong); background: var(--bg); color: var(--ink); }
.chip:hover { background: var(--surface); }
.tag { display: inline-flex; align-items: center; gap: 2px; font-size: .74rem; padding: 1px 8px; border-radius: 4px; background: var(--surface); color: var(--text); font-weight: 550; }
.tag button { border: 0; background: none; color: inherit; cursor: pointer; padding: 0 0 0 2px; font-size: .9rem; }
.tag.pos { background: transparent; border: 1px solid var(--line-strong); color: var(--muted); }
.pill { padding: 1px 7px; border-radius: 4px; font-weight: 600; font-size: .74rem; }
.pill.new { background: var(--surface); color: var(--text); }
.pill.done { background: var(--accent-soft); color: var(--accent); }
.bar { height: 3px; background: var(--line); border-radius: 2px; overflow: hidden; margin-top: 12px; }
.bar i { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.bar.big { height: 10px; max-width: 560px; border-radius: 5px; }

.toast {
  position: fixed; left: 50%; bottom: calc(90px + env(safe-area-inset-bottom)); z-index: 80; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-weight: 600; transition: opacity .2s, transform .2s; max-width: calc(100vw - 32px);
}
.toast.on { opacity: 1; transform: translate(-50%, 0); }

.dlg { border: 0; border-radius: 12px; padding: 0; width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 40px); background: var(--card); color: var(--text); box-shadow: var(--float); }
.dlg.wide { width: min(800px, calc(100vw - 32px)); }
.dlg::backdrop { background: rgba(15, 15, 13, .42); }
.dlg-head { position: sticky; top: 0; display: flex; justify-content: space-between; align-items: center; padding: 16px 20px 8px; background: var(--card); z-index: 1; }
.dlg-head h2 { margin: 0; overflow-wrap: anywhere; }
.dlg-body { padding: 0 20px; }
.dlg .row.end, .dlg > .lang-grid { padding: 0 20px 18px; }
.menu, .popover {
  position: absolute; z-index: 70; background: var(--card); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--float);
}
.menu { min-width: 220px; padding: 6px; display: grid; }
.menu button { font: inherit; text-align: left; padding: 9px 12px; border: 0; border-radius: 8px; background: none; color: var(--ink); cursor: pointer; }
.menu button:hover:not(:disabled) { background: var(--accent-soft); }
.menu button:disabled { opacity: .4; cursor: default; }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }
.popover { width: min(380px, calc(100vw - 16px)); padding: 14px; }

.seg { display: inline-flex; flex-wrap: wrap; gap: 3px; background: var(--surface); border-radius: 8px; padding: 3px; }
.seg button { font: inherit; font-size: .84rem; padding: 5px 10px; border-radius: 7px; border: 0; background: none; color: var(--ink); cursor: pointer; }
.seg button.on { background: var(--bg); box-shadow: 0 0 0 1px var(--line-strong); font-weight: 600; color: var(--ink); }
.stepper { display: inline-flex; align-items: center; gap: 4px; }
.step-val { min-width: 48px; text-align: center; font-weight: 650; font-variant-numeric: tabular-nums; }
.text-settings { display: grid; gap: 10px; max-width: 560px; }
.ts-row { display: grid; grid-template-columns: 130px 1fr; gap: 10px; align-items: center; font-size: .9rem; }
.ts-sample { font-size: 1.2rem; margin: 4px 0 0; }
.opts-cols { columns: 2 280px; column-gap: 28px; }
.opts-cols h3:first-child { margin-top: 0; }
.opts-cols .toggle, .opts-cols h3 { break-inside: avoid; }

/* ---------- welkom ---------- */
.welcome { max-width: 820px; padding-top: 2vh; }
.welcome h1 { font-size: 2.1rem; }
.lang-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin: 12px 0 20px; }
.lang-btn { display: flex; align-items: center; gap: 10px; font: inherit; font-weight: 550; text-align: left; padding: 11px 13px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--bg); color: var(--ink); cursor: pointer; }
.lang-btn:hover { border-color: var(--line-strong); background: var(--surface); }
.lang-btn .code { font-size: .7rem; font-weight: 700; letter-spacing: .05em; color: var(--muted); border: 1px solid var(--line-strong); border-radius: 4px; padding: 1px 5px; min-width: 30px; text-align: center; }
.lang-list { display: grid; gap: 6px; margin-bottom: 10px; }

/* ---------- bibliotheek ---------- */
.subtabs { display: flex; gap: 4px; margin-bottom: 16px; overflow-x: auto; }
.subtabs a { padding: 6px 12px; border-radius: var(--r-btn); color: var(--muted); text-decoration: none; font-weight: 550; font-size: .92rem; white-space: nowrap; }
.subtabs a:hover { color: var(--ink); }
.subtabs a.on { background: var(--surface); color: var(--ink); }
.lib-tools { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.lib-tools .search { flex: 1 1 280px; }
.lvl-row { display: flex; align-items: center; gap: 12px; margin: 14px 0 6px; }
.lvl-range { flex: 0 1 320px; accent-color: var(--accent); }
.lvl-now { font-weight: 700; }
.shelf { margin-top: 22px; }
.shelf-head { display: flex; justify-content: space-between; align-items: baseline; }
.shelf-head h2 { margin: 0 0 10px; }
.shelf-row { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(240px, 270px); gap: 12px; overflow-x: auto; padding: 2px 2px 12px; scroll-snap-type: x proximity; }
.shelf-row > * { scroll-snap-align: start; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.lesson { position: relative; background: var(--card); border-radius: var(--radius); border: 1px solid var(--line); transition: border-color .15s; }
.lesson:hover { border-color: var(--line-strong); }
.lesson-main { display: block; padding: 14px 16px; color: inherit; text-decoration: none; border-radius: var(--radius); height: 100%; }
.lesson-top { display: flex; gap: 10px; align-items: center; font-size: .76rem; color: var(--muted); margin-right: 26px; }
.lesson-top .src { display: inline-flex; align-items: center; gap: 4px; margin: 0; font-size: inherit; }
.lvl-badge { color: var(--muted); font-weight: 600; }
.lesson h3 { margin: 6px 0 2px; font-size: 1rem; font-weight: 600; color: var(--ink); font-family: var(--read); line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.course-name { margin: 0 0 6px; font-size: .8rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.meta { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: .78rem; color: var(--muted); align-items: center; margin-top: 8px; }
.more { position: absolute; top: 8px; right: 6px; }
.course { display: flex; gap: 12px; align-items: center; padding: 12px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); color: inherit; text-decoration: none; transition: border-color .15s; }
.course:hover { border-color: var(--line-strong); }
.course h3 { margin: 0; font-size: .98rem; font-weight: 600; color: var(--ink); font-family: var(--read); }
.course p { margin: 2px 0 0; }
.course > div:last-child { flex: 1; min-width: 0; }
.course-cover { flex: none; width: 50px; height: 64px; border-radius: 4px; display: grid; place-items: center; font-weight: 800; font-size: 1.1rem; color: var(--muted); background: var(--surface); border: 1px solid var(--line); font-family: var(--display); }
.course-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.course-list { list-style: none; padding: 0; margin: 10px 0; display: grid; border-top: 1px solid var(--line); }
.course-list li { display: grid; grid-template-columns: 32px 1fr auto auto auto; gap: 10px; align-items: center; padding: 10px 4px; border-bottom: 1px solid var(--line); }
.course-list .num { color: var(--muted); font-weight: 700; text-align: center; }
.cl-title { color: var(--ink); text-decoration: none; font-family: var(--read); font-size: 1.02rem; min-width: 0; overflow-wrap: anywhere; }
.cl-title:hover { text-decoration: underline; text-underline-offset: 3px; }
@media (max-width: 560px) { .course-list li { grid-template-columns: 26px 1fr auto; } .course-list li > .pill, .course-list li > span:nth-child(4) { display: none; } }
.filters-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.filters-row .field { width: auto; flex: 0 1 auto; }
.filters-row .search { flex: 1 1 240px; }
.now-playing { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 6px 0 12px; }
.pick-list { display: grid; gap: 6px; margin-bottom: 12px; }
.pick-list .btn { justify-content: flex-start; }

/* ---------- importeren ---------- */
.steps { list-style: none; display: flex; gap: 6px; padding: 0; margin: 14px 0 20px; flex-wrap: wrap; }
.steps button { display: flex; align-items: center; gap: 8px; font: inherit; font-size: .9rem; padding: 6px 12px 6px 6px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); color: var(--muted); cursor: pointer; }
.steps button:disabled { cursor: default; }
.steps b { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--line); color: var(--ink); font-size: .8rem; }
.steps .on button { color: var(--ink); border-color: var(--line-strong); font-weight: 600; }
.steps .on b, .steps .done b { background: var(--accent); color: var(--accent-ink); }
.source-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.source { display: grid; gap: 4px; text-align: left; font: inherit; color: var(--ink); cursor: pointer; padding: 14px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--card); transition: border-color .15s, background .15s; }
.source:hover { border-color: var(--line-strong); background: var(--surface); }
.source strong { font-weight: 600; }
.source span:last-child { font-size: .86rem; color: var(--muted); }
.source.off { cursor: default; box-shadow: none; opacity: .75; background: transparent; }
.src-icon { color: var(--text); margin-bottom: 4px; }
.howto li { margin: 6px 0; }
.bookmarklet { cursor: grab; }
.pick { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line); }

/* ---------- lezer ---------- */
.reader { --rfs: 21px; --rlh: 1.8; --rfont: var(--read); max-width: 780px; margin: 0 auto; }
.reader[data-width="wide"] { max-width: 1040px; }
.reader[data-width="double"] { max-width: 1240px; }
@media (min-width: 1000px) { .reader[data-width="double"] .reading:not(.sentence-mode) { column-count: 2; column-gap: 56px; column-rule: 1px solid var(--line); } }
.r-bar { display: flex; align-items: center; gap: 6px; padding-bottom: 8px; }
.r-title { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.r-title strong { font-family: var(--read); font-size: 1.08rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.r-title > span { font-size: .8rem; }
.r-title a { text-decoration: none; font-weight: 700; }
.r-progress { display: flex; align-items: center; gap: 10px; padding: 4px 0 8px; border-bottom: 1px solid var(--line); }
.r-progress input { flex: 1; accent-color: var(--accent); }
/* Video: vast in de pagina, of als zwevende mini-speler (standaard op de telefoon) */
.video { max-width: 560px; margin: 10px auto; border-radius: 10px; overflow: hidden; background: #000; }
.video-bar { display: flex; align-items: center; gap: 2px; padding: 2px 4px; background: #111; color: #fff; }
.video-bar .icon { color: #fff; font-size: .8rem; font-weight: 700; }
.video-bar .icon:hover, .video-bar .icon.on { background: rgba(255, 255, 255, .16); }
.video-drag { flex: 1; align-self: stretch; display: flex; align-items: center; padding-left: 6px; color: #888; font-size: .9rem; user-select: none; touch-action: none; }
.video.mini .video-drag { cursor: grab; }
.video:not(.mini) .video-drag { visibility: hidden; }
.video-box { position: relative; aspect-ratio: 16 / 9; background: #000; }
.video-box iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.video-cc { display: none; padding: 6px 10px; min-height: 2.7em; background: #000; color: #fff; font-family: var(--ui); font-size: .92rem; line-height: 1.35; text-align: center; }
.video.cc-on .video-cc { display: block; }
.video.mini { position: fixed; z-index: 35; right: 12px; bottom: calc(var(--foot-h, 80px) + 10px); width: min(62vw, 340px); margin: 0; box-shadow: var(--float); }
.video.mini .video-cc { font-size: .8rem; min-height: 2.4em; padding: 4px 8px; }
/* Verborgen maar levend: het geluid speelt door */
.video.gone { position: fixed; left: -10000px; top: 0; width: 320px; opacity: 0; pointer-events: none; }
.thumb { display: block; width: calc(100% + 32px); margin: -14px -16px 10px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: var(--radius) var(--radius) 0 0; background: var(--line); }

/* Plak een link = les */
.quick { display: flex; align-items: center; gap: 8px; padding: 5px 5px 5px 12px; margin-bottom: 16px; background: var(--bg); border: 1px solid var(--line-strong); border-radius: var(--radius); }
.quick-icon { color: var(--muted); }
.quick:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.quick .field { border: 0; background: transparent; padding: 9px 2px; min-width: 0; }
.quick .field:focus-visible { outline: none; }
.reading { font-family: var(--rfont); font-size: var(--rfs); line-height: var(--rlh); padding: 16px 0 8px; min-height: 40vh; overflow-wrap: break-word; }
.para { margin: 0 0 1em; }
.para-tr { margin: -.5em 0 1.2em; font-family: var(--ui); font-size: .78em; line-height: 1.5; color: var(--muted); border-left: 3px solid var(--line); padding-left: 10px; }
.sentence-mode { text-align: center; padding-top: 6vh; }
.sentence-mode .para { font-size: 1.25em; }
.sentence-mode .para-tr { border: 0; padding: 0; margin: 0 auto 1em; max-width: 60ch; }
.s-vocab { display: grid; gap: 4px; max-width: 520px; margin: 20px auto 0; text-align: left; font-family: var(--ui); font-size: .9rem; }
.sv-row { display: flex; justify-content: space-between; gap: 10px; padding: 6px 10px; border-radius: 9px; border: 1px solid var(--line); background: var(--card); color: var(--ink); font: inherit; cursor: pointer; text-align: left; }

.w { border-radius: 4px; padding: 1px 1px; cursor: pointer; transition: background .12s, box-shadow .12s; }
.w:hover { box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 45%, transparent); }
.w.sn { background: var(--new); }
.w.s1 { background: var(--hl1); }
.w.s2 { background: var(--hl2); }
.w.s3 { background: var(--hl3); }
.w.s4 { box-shadow: inset 0 -2px 0 var(--hl-line); }
.reader[data-style="underline"] .w.sn, .reader[data-style="underline"] .w.s1, .reader[data-style="underline"] .w.s2, .reader[data-style="underline"] .w.s3 { background: none; }
.reader[data-style="underline"] .w.sn { box-shadow: inset 0 -2px 0 var(--new-line); }
.reader[data-style="underline"] .w.s1, .reader[data-style="underline"] .w.s2 { box-shadow: inset 0 -3px 0 var(--hl-line); }
.reader[data-style="underline"] .w.s3 { box-shadow: inset 0 -1px 0 var(--hl-line); }
.reader[data-style="fg"] .w.sn, .reader[data-style="fg"] .w.s1, .reader[data-style="fg"] .w.s2, .reader[data-style="fg"] .w.s3 { background: none; }
.reader[data-style="fg"] .w.sn { color: var(--new-fg); }
.reader[data-style="fg"] .w.s1, .reader[data-style="fg"] .w.s2, .reader[data-style="fg"] .w.s3 { color: var(--hl-fg); font-weight: 600; }
.reader[data-style="fg"] .w.s4 { box-shadow: none; color: var(--hl-fg); }
.reader[data-style="off"] .w.sn, .reader[data-style="off"] .w.s1, .reader[data-style="off"] .w.s2, .reader[data-style="off"] .w.s3 { background: none; }
.reader[data-style="off"] .w.s4 { box-shadow: none; }
.w.ph { text-decoration: underline wavy var(--hl-line); text-decoration-thickness: 1px; text-underline-offset: 5px; }
.w.sel { box-shadow: 0 0 0 2px var(--accent) !important; }
.w.speaking { outline: 2px solid var(--accent); outline-offset: 1px; }
/* Wat de speler nu laat horen: een tint over de eigen woordkleur heen */
.w.cue-on {
  background-image: linear-gradient(color-mix(in srgb, var(--ink) 10%, transparent), color-mix(in srgb, var(--ink) 10%, transparent));
  box-shadow: inset 0 -3px 0 var(--accent) !important;
  border-radius: 3px;
}
#yt-player { position: absolute; inset: 0; display: grid; place-items: center; }

.r-foot {
  position: sticky; bottom: 0; display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 10px 0 calc(10px + env(safe-area-inset-bottom)); background: var(--bg); border-top: 1px solid var(--line); z-index: 5;
}
.r-audio { display: flex; align-items: center; gap: 4px; flex: 1 1 260px; min-width: 0; }
.r-audio input[type=range] { flex: 1; min-width: 60px; accent-color: var(--accent); }
.play { width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--ink); color: var(--bg); cursor: pointer; flex: none; display: grid; place-items: center; }
.r-nav { display: flex; gap: 6px; margin-left: auto; }
/* Telefoon: zoals LingQ een rustige onderbalk met een grote afspeelknop */
@media (max-width: 779px) {
  .r-foot { gap: 4px; padding-top: 8px; flex-wrap: nowrap; }
  .r-audio { flex: 0 1 auto; gap: 2px; }
  #a-time, #a-seek, .r-audio .icon[title="5 seconden vooruit"], #r-prev { display: none; }
  .r-foot .btn.small { padding: 6px 9px; }
  .r-nav { margin-left: auto; }
  .r-nav .btn { padding: 10px 16px; font-size: 1.05rem; }
  .reading { padding-top: 10px; }
  .r-bar .r-title > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
}

.complete { text-align: center; font-family: var(--ui); font-size: 1rem; line-height: 1.5; padding: 20px 0; }
.complete h2 { font-size: 1.6rem; }
.complete details { text-align: left; margin: 14px 0; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; }
.complete summary { cursor: pointer; font-weight: 650; }
.mini { margin: 6px 0; padding-left: 18px; font-size: .9rem; }
.mini li { margin: 3px 0; }
.mini.cols { columns: 2 220px; }
.grammar { white-space: pre-wrap; font-size: .95rem; padding-bottom: 16px; }
.info { border-collapse: collapse; width: 100%; margin-bottom: 18px; font-size: .92rem; }
.info th { text-align: left; color: var(--muted); font-weight: 600; padding: 5px 12px 5px 0; white-space: nowrap; vertical-align: top; }
.info td { padding: 5px 0; overflow-wrap: anywhere; }

/* paneel: onderblad op mobiel, zijkolom op breed scherm */
.panel {
  position: fixed; z-index: 40; left: 0; right: 0; bottom: 0; max-height: 64vh; overflow-y: auto; background: var(--card);
  border-top-left-radius: 16px; border-top-right-radius: 16px; box-shadow: var(--float);
  padding: 14px 18px calc(18px + env(safe-area-inset-bottom)); animation: up .18s ease-out;
}
@keyframes up { from { transform: translateY(20px); opacity: 0; } }
@media (min-width: 1100px) {
  .panel { top: 0; bottom: 0; left: auto; right: 0; width: 380px; max-height: none; border-radius: 0; border-left: 1px solid var(--line); box-shadow: none; animation: none; }
  body.panel-open[data-view="les"] main { padding-right: 404px; }
}
.p-head { display: flex; align-items: center; gap: 4px; }
.p-word { flex: 1; font-family: var(--read); font-size: 1.55rem; font-weight: 700; overflow-wrap: anywhere; }
.p-status { display: flex; gap: 8px; align-items: center; font-size: .8rem; color: var(--muted); margin-bottom: 10px; }
.pos { font-weight: 650; color: var(--good); }
.lvls { display: grid; grid-template-columns: repeat(6, 1fr); gap: 5px; margin-bottom: 12px; }
.lvl { font: inherit; font-weight: 650; height: 36px; border-radius: var(--r-btn); cursor: pointer; border: 1px solid var(--line-strong); background: var(--bg); color: var(--ink); display: grid; place-items: center; }
.lvl[data-s="1"] { background: var(--hl1); }
.lvl[data-s="2"] { background: var(--hl2); }
.lvl[data-s="3"] { background: var(--hl3); }
.lvl.known, .lvl[data-s="5"] { color: var(--good); }
.lvl.ign, .lvl[data-s="-1"] { color: var(--muted); }
.lvl.on { outline: 2px solid var(--ink); outline-offset: 1px; border-color: var(--ink); }
.lvl.mini { padding: 3px 0; width: 28px; font-size: .82rem; }
.p-label { display: block; font-size: .72rem; font-weight: 750; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 10px 0 5px; }
.meanings { margin: 0 0 6px; padding-left: 22px; }
.meanings li { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.m-text { font: inherit; font-size: 1.02rem; text-align: left; background: none; border: 0; color: var(--ink); cursor: pointer; padding: 2px 0; }
.meanings li:first-child .m-text { font-weight: 700; }
.merged { margin: 0 0 6px; font-weight: 650; }
.hint, .notes, .tag-in { width: 100%; font: inherit; padding: 8px 11px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); }
.notes { resize: vertical; font-size: .92rem; }
.p-tags { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; margin: 6px 0; }
.tag-in { width: 110px; padding: 3px 8px; font-size: .82rem; border-radius: 999px; }
.note { font-size: .88rem; color: var(--muted); margin: 2px 0 6px; }
.note:empty { display: none; }
.src { font-size: .7rem; color: var(--muted); margin-left: auto; }
.p-sent { border-top: 1px solid var(--line); margin-top: 10px; padding-top: 4px; }
.sent { font-family: var(--read); font-size: 1rem; margin: 0 0 8px; }
.sentT { font-size: .93rem; margin: 8px 0 0; }
.sentT:empty { display: none; }
.links { display: flex; gap: 6px 14px; flex-wrap: wrap; margin-top: 14px; font-size: .84rem; }

/* ---------- woordenschat ---------- */
.vtabs { display: flex; gap: 6px; margin-bottom: 12px; flex-wrap: wrap; }
.vtabs button { font: inherit; font-size: .9rem; font-weight: 550; padding: 6px 13px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--bg); color: var(--ink); cursor: pointer; }
.vtabs button.on { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.vtabs b { margin-left: 6px; font-size: .78rem; opacity: .75; }
.bulk { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 8px 12px; margin-bottom: 10px; border-radius: var(--radius); background: var(--surface); }
.vocab-list { display: grid; }
.vrow { display: grid; grid-template-columns: 22px minmax(140px, 1fr) minmax(160px, 1.5fr) auto; gap: 10px; align-items: center; border-bottom: 1px solid var(--line); padding: 9px 6px; }
.vrow.vhead { background: none; border: 0; font-size: .76rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; padding-bottom: 0; }
.vrow.focus { background: var(--surface); }
.wr-word { font: inherit; font-family: var(--read); font-size: 1.05rem; text-align: left; background: none; border: 0; color: var(--ink); cursor: pointer; padding: 2px; overflow-wrap: anywhere; }
.wr-hint { width: 100%; font: inherit; font-size: .92rem; padding: 5px 8px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); }
.vsent { margin: 3px 0 0; font-size: .8rem; color: var(--muted); font-family: var(--read); }
.vstatus { display: flex; gap: 3px; align-items: center; }
.pager { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 12px; }
@media (max-width: 700px) {
  .vrow { grid-template-columns: 22px 1fr; }
  .vrow > .vmean, .vrow > .vstatus { grid-column: 2; }
  .vrow.vhead span:nth-child(n+3) { display: none; }
  .hide-sm { display: none; }
}

/* ---------- herhalen ---------- */
.type-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px; margin-bottom: 18px; }
.type-opt { display: flex; gap: 10px; align-items: flex-start; padding: 12px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--card); cursor: pointer; }
.type-opt:has(input:checked) { border-color: var(--line-strong); background: var(--surface); }
.type-opt input { margin-top: 4px; accent-color: var(--accent); }
.type-opt span { display: grid; }
.type-opt small { color: var(--muted); }
.review { max-width: 640px; }
.rv-top { display: flex; justify-content: space-between; gap: 10px; font-size: .88rem; margin-bottom: 14px; }
.card { background: var(--card); border-radius: 12px; border: 1px solid var(--line); padding: 32px 22px; display: grid; gap: 16px; text-align: center; }
.front { display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap; }
.big { font-family: var(--read); font-size: 2.1rem; font-weight: 700; overflow-wrap: anywhere; }
.card .sent { color: var(--muted); margin: 8px 0 0; }
.card mark { background: var(--hl1); color: inherit; border-radius: 4px; padding: 0 3px; }
.blank { font-weight: 700; color: var(--accent); letter-spacing: .1em; }
.meaning { font-size: 1.4rem; font-weight: 700; margin-bottom: 12px; }
.opts { display: grid; gap: 8px; }
.opt { display: flex; align-items: center; gap: 10px; text-align: left; font: inherit; font-size: 1rem; cursor: pointer; padding: 12px 14px; border-radius: var(--radius); border: 1px solid var(--line-strong); background: var(--bg); color: var(--ink); }
.opt:hover { background: var(--surface); }
.opt.right { background: color-mix(in srgb, var(--good) 22%, var(--card)); border-color: var(--good); }
.opt.wrong { background: color-mix(in srgb, var(--bad) 20%, var(--card)); border-color: var(--bad); }
.answer { font: inherit; font-family: var(--read); font-size: 1.3rem; text-align: center; padding: 12px; border-radius: var(--radius); border: 1px solid var(--line-strong); background: var(--bg); color: var(--ink); }
.answer:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.result { margin: 0; font-weight: 600; min-height: 1.5em; }
.result.right { color: var(--good); }
.result.wrong { color: var(--bad); }
.big-play { font-size: 1.1rem; padding: 14px 22px; }

/* ---------- statistiek ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; margin: 14px 0; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: grid; gap: 2px; }
.stat strong { font-size: 1.7rem; font-weight: 650; letter-spacing: -.02em; color: var(--ink); font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-size: .86rem; }
.ring-stat { display: flex; align-items: center; gap: 12px; }
.ring-stat > div { display: grid; }
.table-wrap { overflow-x: auto; }
.period { border-collapse: collapse; min-width: 480px; width: 100%; max-width: 760px; }
.period th, .period td { padding: 8px 12px; text-align: right; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.period th:first-child { text-align: left; color: var(--muted); font-weight: 600; }
.period thead th { font-size: .8rem; color: var(--muted); }
.chart { display: grid; grid-template-columns: repeat(30, 1fr); gap: 3px; height: 170px; align-items: end; max-width: 760px; margin-top: 12px; }
.col { display: grid; grid-template-rows: 1fr 14px; height: 100%; gap: 4px; text-align: center; font-size: .66rem; color: var(--muted); }
.stack { display: flex; flex-direction: column-reverse; background: color-mix(in srgb, var(--line) 45%, transparent); border-radius: 4px; overflow: hidden; }
.stack i { display: block; background: var(--accent); }

/* ---------- coach ---------- */
.coach { max-width: 760px; }
.chat { display: grid; gap: 10px; max-height: 55vh; overflow-y: auto; padding: 6px 2px; margin: 10px 0; }
.msg { max-width: 85%; padding: 10px 14px; border-radius: 16px; white-space: pre-wrap; line-height: 1.5; }
.msg.user { justify-self: end; background: var(--surface); color: var(--ink); border-bottom-right-radius: 4px; }
.msg.assistant { justify-self: start; background: var(--bg); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.composer { flex-wrap: nowrap; align-items: flex-end; }
.composer textarea { flex: 1; }
.tips li { margin: 8px 0; }

.settings h2 { border-top: 1px solid var(--line); padding-top: 18px; }
.settings h2:first-of-type { border-top: 0; padding-top: 0; }
.settings .fieldrow { max-width: 560px; }

/* ---------- printen ---------- */
#print { display: none; }
@media print {
  body.printing > *:not(#print) { display: none !important; }
  body.printing #print { display: block; font-family: var(--read); font-size: 13pt; line-height: 1.6; color: #000; }
  body.printing { background: #fff; padding: 0; }
}

/* Aan/uit-knoppen: aan = lichtgroen, de volle groene kleur blijft voor de hoofdactie */
.btn.on { background: var(--accent-soft); border-color: transparent; color: var(--accent); }
.lvl-row > span { white-space: nowrap; }
.subtabs { scrollbar-width: none; }
.subtabs::-webkit-scrollbar { display: none; }

/* ---------- ingebouwd woordenboek in het woordpaneel ---------- */
.dict { border-top: 1px solid var(--line); margin-top: 12px; padding-top: 6px; }
.dict-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.seg.small button { font-size: .76rem; padding: 3px 9px; }
.dict-back { display: inline-flex; align-items: center; gap: 4px; margin: 2px 0 6px; }
.dict-word { font-family: var(--read); font-size: 1.15rem; font-weight: 700; color: var(--ink); margin: 2px 0 6px; }
.dict-entry + .dict-entry { margin-top: 10px; }
.dict-pos { font-size: .76rem; font-style: italic; color: var(--muted); margin-bottom: 2px; }
.dict-defs { margin: 0; padding-left: 20px; }
.dict-defs li { margin: 4px 0; font-size: .92rem; color: var(--text); }
.dict-defs li::marker { color: var(--muted); font-size: .82rem; }
.dict-line { display: flex; align-items: flex-start; justify-content: space-between; gap: 6px; }
.dict-line .icon.small { margin-top: -3px; color: var(--muted); }
.dict-line .icon.small:hover { color: var(--accent); }
.dict-def { flex: 1; }
.dict-tr { display: block; flex-basis: 100%; font-size: .86rem; color: var(--accent); margin-top: 1px; }
.dict-ex { font-family: var(--read); font-style: italic; font-size: .88rem; color: var(--muted); margin: 2px 0 0; }
.dict-meta { display: grid; gap: 1px; margin: 4px 0 6px; font-size: .86rem; color: var(--muted); }
.dict-meta strong { font-family: var(--read); font-size: 1.1rem; color: var(--ink); }
.dict-lemma { margin-top: 8px; gap: 5px; }
.dict-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.dict-foot a, .dict-foot .linkish { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); }
.more-dicts { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 8px; }
.more-dicts summary { cursor: pointer; font-size: .84rem; color: var(--muted); }
.more-dicts .links { margin-top: 8px; }
.links a { display: inline-flex; align-items: center; gap: 3px; }
.brand b { color: var(--accent); font-weight: 800; }

/* ---------- inloggen ---------- */
.login { max-width: 380px; padding-top: 6vh; text-align: center; }
.login-mark { border-radius: 14px; margin: 0 auto 14px; display: block; }
.login-form { text-align: left; margin-top: 20px; }
.btn.wide { width: 100%; min-height: 44px; margin-top: 6px; }
.form-error { color: var(--bad); font-size: .88rem; min-height: 1.2em; margin: 4px 0; }
.login h1 b { color: var(--accent); }
.account-box { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius); max-width: 560px; }
.account-box strong { color: var(--ink); }

/* Vlaggen: klein, met een haarlijn zodat witte vlakken (Japan, Finland) zichtbaar blijven */
.flag { display: block; flex: none; width: auto; border-radius: 3px; object-fit: cover; box-shadow: 0 0 0 1px rgba(0, 0, 0, .1); }
.lang-flag { display: flex; align-items: center; }
.lang-line { display: inline-flex; align-items: center; gap: 10px; }
