/* LeerLab — neo-brutalist study app for Kayden.
   Cream paper, thick ink outlines, hard offset shadows, bright folder colours. */
:root {
  --paper: #fbf7ee;
  --card: #ffffff;
  --ink: #111111;
  --ink-2: #4a4a4a;
  --ink-3: #8a8780;
  --line: 2.5px;
  --r: 14px;
  --r-lg: 20px;
  --sh: 4px 4px 0 var(--ink);
  --sh-sm: 2px 2px 0 var(--ink);
  --sh-lg: 6px 6px 0 var(--ink);

  --yellow: #ffd23f;
  --sand: #ffe49a;
  --pink: #ff5d8f;
  --purple: #7b61ff;
  --green: #3cc13b;
  --lime: #b5e14a;
  --orange: #ff8a3d;
  --blue: #4da8ff;
  --teal: #2ec4b6;
  --gray: #a7a49c;
  --good: #3cc13b;
  --bad: #ff5d5d;

  --font: "Lexend", "Avenir Next", "Segoe UI", system-ui, sans-serif;
  --nav-h: 76px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font: 400 16px/1.45 var(--font);
  color: var(--ink);
  background: var(--yellow);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
img { display: block; max-width: 100%; }
:focus-visible { outline: 3px solid var(--purple); outline-offset: 3px; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- stage: full screen on every device; layout adapts below ---------- */
.backdrop { display: none; }
body { background: var(--paper); }
#app { position: relative; min-height: 100dvh; background: var(--paper); overflow-x: hidden; }
#view { padding: 18px 20px calc(var(--nav-h) + 40px); }
#view.no-nav { padding-bottom: 40px; }
.view-enter { animation: view-in .35s cubic-bezier(.2, .8, .2, 1); }
@keyframes view-in { from { opacity: 0; transform: translateY(10px); } }

/* ---------- neo-brutalist primitives ---------- */
.box {
  background: var(--card);
  border: var(--line) solid var(--ink);
  border-radius: var(--r);
  box-shadow: var(--sh);
}
.press { transition: transform .08s ease, box-shadow .08s ease; }
.press:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--ink); }

.icon-btn {
  width: 48px; height: 48px; flex: none;
  display: grid; place-items: center;
  background: var(--card);
  border: var(--line) solid var(--ink);
  border-radius: 12px;
  box-shadow: var(--sh);
  padding: 0;
  text-decoration: none;
}
.icon-btn svg { width: 22px; height: 22px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 54px; padding: 0 22px;
  border: var(--line) solid var(--ink);
  border-radius: var(--r);
  background: var(--yellow);
  box-shadow: var(--sh);
  font-weight: 700; font-size: 17px;
  text-decoration: none;
}
.btn svg { width: 22px; height: 22px; }
.btn.block { width: 100%; }
.btn.ink { background: var(--ink); color: #fff; box-shadow: 4px 4px 0 var(--pink); }
.btn.white { background: var(--card); }
.btn.pink { background: var(--pink); }
.btn.green { background: var(--green); }
.btn.big { min-height: 64px; font-size: 19px; }
.btn:disabled { background: #e6e2d8; color: var(--ink-3); box-shadow: var(--sh-sm); cursor: not-allowed; }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 36px; padding: 0 12px;
  border: var(--line) solid var(--ink);
  border-radius: 999px;
  background: var(--card);
  box-shadow: var(--sh-sm);
  font-weight: 700; font-size: 14px;
}
.chip svg { width: 18px; height: 18px; }
.pill {
  display: inline-block; padding: 2px 9px;
  border: 2px solid var(--ink); border-radius: 999px;
  font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  background: var(--card);
}
.pill.new { background: var(--pink); color: #fff; border-color: var(--pink); }
.pill.done { background: var(--green); }
.pill.busy { background: var(--sand); }
.pill.wait { background: #ece8de; color: var(--ink-2); border-color: #c9c4b8; }

.topbar { display: flex; align-items: center; gap: 10px; margin-bottom: 22px; }
.topbar .spacer { flex: 1; }
.topbar h2 { margin: 0; font-size: 20px; font-weight: 800; }

.headline { margin: 0 0 6px; font-size: 40px; line-height: 1.04; font-weight: 800; letter-spacing: -.02em; }
.lede { margin: 0 0 20px; font-size: 16px; color: var(--ink-2); }
.section-h { display: flex; align-items: baseline; justify-content: space-between; margin: 28px 0 14px; }
.section-h h3 { margin: 0; font-size: 19px; font-weight: 800; }
.section-h a, .section-h button { font-size: 14px; font-weight: 700; background: none; border: 0; padding: 0; text-decoration: underline; text-underline-offset: 3px; }

/* ---------- home ---------- */
.scanbar { display: flex; gap: 12px; align-items: stretch; }
.scanbar .field {
  flex: 1; display: flex; align-items: center; gap: 12px;
  min-height: 62px; padding: 0 16px;
  background: var(--card); border: var(--line) solid var(--ink); border-radius: var(--r); box-shadow: var(--sh);
  font-weight: 500; color: var(--ink-2); text-align: left; text-decoration: none;
}
.scanbar .field svg { width: 22px; height: 22px; color: var(--ink); flex: none; }
.scanbar .plus { width: 62px; height: 62px; border-radius: var(--r); background: var(--yellow); }
.scanbar .plus svg { width: 30px; height: 30px; }

.continue {
  display: grid; grid-template-columns: 64px 1fr auto; gap: 14px; align-items: center;
  padding: 14px; text-decoration: none; background: var(--purple); color: #fff;
}
.continue .thumb { width: 64px; height: 64px; border-radius: 12px; border: var(--line) solid var(--ink); background: var(--yellow); display: grid; place-items: center; color: var(--ink); }
.continue .thumb svg { width: 30px; height: 30px; }
.continue .k { margin: 0; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; opacity: .85; }
.continue .t { margin: 2px 0 8px; font-size: 17px; font-weight: 800; line-height: 1.2; }
.continue .play { width: 46px; height: 46px; border-radius: 50%; background: var(--card); color: var(--ink); border: var(--line) solid var(--ink); display: grid; place-items: center; }
.continue .play svg { width: 20px; height: 20px; margin-left: 3px; }
.bar { display: block; height: 10px; border: 2px solid var(--ink); border-radius: 999px; background: var(--card); overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--green); border-right: 2px solid var(--ink); }
.bar i[style*="width: 0"] { border-right: 0; }

/* folder cards */
.folders { display: grid; grid-template-columns: 1fr 1fr; gap: 26px 16px; padding-top: 12px; }
.folder { position: relative; display: block; text-decoration: none; color: var(--ink); }
.folder::before {   /* the tab behind the card */
  content: ""; position: absolute; left: 10px; top: -13px; width: 54%; height: 26px;
  background: var(--c, var(--gray)); border: var(--line) solid var(--ink); border-bottom: 0;
  border-radius: 10px 14px 0 0;
}
.folder .box { position: relative; min-height: 132px; padding: 14px; display: flex; flex-direction: column; justify-content: space-between; }
.folder .row { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.folder .ic { width: 48px; height: 48px; border-radius: 10px; border: var(--line) solid var(--ink); background: var(--c, var(--gray)); display: grid; place-items: center; }
.folder .ic svg { width: 24px; height: 24px; }
.folder .count { font-size: 12.5px; color: var(--ink-2); text-align: right; line-height: 1.35; }
.folder .name { margin: 14px 0 0; font-size: 16.5px; font-weight: 800; line-height: 1.15; }
.folder:active .box { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--ink); }
.folder .box { transition: transform .08s, box-shadow .08s; }

.helper {
  display: grid; grid-template-columns: 74px 1fr; gap: 14px; align-items: center;
  padding: 14px 16px; background: var(--sand); text-decoration: none;
}
.helper p { margin: 0; }
.helper .t { font-weight: 800; font-size: 17px; }
.helper .s { font-size: 14px; color: var(--ink-2); }

/* ---------- bottom nav ---------- */
.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  height: var(--nav-h);
  display: grid; grid-template-columns: repeat(5, 1fr); align-items: center;
  padding: 0 8px env(safe-area-inset-bottom);
  background: var(--card);
  border-top: var(--line) solid var(--ink);
}
.nav[hidden] { display: none; }
.nav a { display: flex; flex-direction: column; align-items: center; gap: 3px; text-decoration: none; font-size: 11.5px; font-weight: 600; color: var(--ink-3); }
.nav a svg { width: 24px; height: 24px; }
.nav a.on { color: var(--ink); }
.nav a.on .ni { background: var(--yellow); border-color: var(--ink); }
.nav .ni { display: grid; place-items: center; width: 44px; height: 30px; border-radius: 10px; border: 2px solid transparent; }
.nav a.scan .ni { width: 58px; height: 58px; margin-top: -30px; border-radius: 16px; background: var(--pink); border: var(--line) solid var(--ink); box-shadow: var(--sh); color: var(--ink); }
.nav a.scan svg { width: 28px; height: 28px; }
.nav a.scan.on .ni { background: var(--pink); }

/* ---------- scan flow ---------- */
.steps { display: flex; flex-direction: column; gap: 22px; }
.step-h { display: flex; align-items: center; gap: 10px; margin: 0 0 12px; font-size: 17px; font-weight: 800; }
.step-h .n { width: 30px; height: 30px; border-radius: 50%; border: var(--line) solid var(--ink); display: grid; place-items: center; font-size: 14px; background: var(--yellow); }
.vak-chips { display: flex; flex-wrap: wrap; gap: 10px; }
.vak-chip { display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 14px 0 6px; border: var(--line) solid var(--ink); border-radius: 12px; background: var(--card); box-shadow: var(--sh-sm); font-weight: 700; font-size: 14.5px; }
.vak-chip .dot { width: 30px; height: 30px; border-radius: 8px; border: 2px solid var(--ink); background: var(--c); display: grid; place-items: center; }
.vak-chip .dot svg { width: 16px; height: 16px; }
.vak-chip[aria-pressed="true"] { background: var(--ink); color: #fff; box-shadow: 2px 2px 0 var(--c); }

.drop {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  min-height: 190px; padding: 22px; text-align: center;
  border: 3px dashed var(--ink); border-radius: var(--r-lg); background: repeating-linear-gradient(-45deg, #fff, #fff 12px, #fdf8ea 12px, #fdf8ea 24px);
  cursor: pointer;
}
.drop .cam { width: 70px; height: 70px; border-radius: 18px; border: var(--line) solid var(--ink); background: var(--yellow); box-shadow: var(--sh); display: grid; place-items: center; }
.drop .cam svg { width: 34px; height: 34px; }
.drop b { font-size: 17px; }
.drop span { font-size: 14px; color: var(--ink-2); }
.drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.thumbs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 14px; }
.thumbs:empty { display: none; }
.thumb-item { position: relative; aspect-ratio: 3 / 4; border: var(--line) solid var(--ink); border-radius: 12px; overflow: hidden; box-shadow: var(--sh-sm); background: #eee; }
.thumb-item img { width: 100%; height: 100%; object-fit: cover; }
.thumb-item .pg { position: absolute; left: 6px; top: 6px; }
.thumb-item button { position: absolute; right: 6px; top: 6px; width: 30px; height: 30px; padding: 0; border-radius: 8px; border: 2px solid var(--ink); background: var(--card); display: grid; place-items: center; }
.thumb-item button svg { width: 16px; height: 16px; }
.tips { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.tip { padding: 10px; text-align: center; font-size: 12.5px; font-weight: 600; line-height: 1.3; }
.tip svg { width: 22px; height: 22px; margin: 0 auto 6px; display: block; }

.making { text-align: center; padding-top: 10px; }
.making .stack { position: relative; width: 170px; height: 190px; margin: 20px auto 30px; }
.making .stack .pg { position: absolute; inset: 0; border: var(--line) solid var(--ink); border-radius: 14px; background: var(--card); box-shadow: var(--sh); }
.making .stack .pg:nth-child(1) { transform: rotate(-8deg); background: var(--sand); }
.making .stack .pg:nth-child(2) { transform: rotate(5deg); background: var(--lime); }
.making .stack .pg:nth-child(3) { display: grid; place-items: center; animation: wobble-pg 1.6s ease-in-out infinite; }
.making .stack .pg:nth-child(3) svg { width: 120px; height: 120px; }
@keyframes wobble-pg { 50% { transform: rotate(-3deg) translateY(-6px); } }
.checklist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; text-align: left; }
.checklist li { display: flex; align-items: center; gap: 12px; padding: 12px 14px; font-weight: 600; opacity: .45; transition: opacity .3s; }
.checklist li .ck { width: 28px; height: 28px; flex: none; border-radius: 8px; border: 2px solid var(--ink); display: grid; place-items: center; background: var(--card); }
.checklist li .ck svg { width: 16px; height: 16px; opacity: 0; }
.checklist li.on { opacity: 1; }
.checklist li.done .ck { background: var(--green); }
.checklist li.done .ck svg { opacity: 1; }
.checklist li.on:not(.done) .ck { animation: spin-ck 1s linear infinite; border-style: dashed; }
@keyframes spin-ck { to { transform: rotate(360deg); } }

/* ---------- subject + lesson lists ---------- */
.vak-hero { position: relative; padding: 18px; background: var(--c); margin-bottom: 26px; }
.vak-hero .ic { width: 58px; height: 58px; border-radius: 14px; border: var(--line) solid var(--ink); background: var(--card); display: grid; place-items: center; box-shadow: var(--sh-sm); }
.vak-hero .ic svg { width: 30px; height: 30px; }
.vak-hero h1 { margin: 14px 0 2px; font-size: 30px; font-weight: 800; letter-spacing: -.01em; }
.vak-hero p { margin: 0; font-weight: 600; }
.lessons { display: flex; flex-direction: column; gap: 14px; }
.lesson { display: grid; grid-template-columns: 52px 1fr auto; gap: 14px; align-items: center; padding: 14px; text-decoration: none; }
.lesson .no { width: 52px; height: 52px; border-radius: 12px; border: var(--line) solid var(--ink); background: var(--c, var(--yellow)); display: grid; place-items: center; font-weight: 800; font-size: 19px; }
.lesson .t { margin: 0 0 4px; font-weight: 800; font-size: 16px; line-height: 1.2; }
.lesson .m { margin: 0 0 8px; font-size: 13px; color: var(--ink-2); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.lesson .go svg { width: 22px; height: 22px; }
.lesson.pending { background: #f4f0e6; box-shadow: var(--sh-sm); }
.lesson.pending .no { background: #e6e2d8; }
.lesson.pending .no svg { width: 22px; height: 22px; }
.empty { padding: 26px 20px; text-align: center; }
.empty .ic { width: 64px; height: 64px; margin: 0 auto 12px; border-radius: 16px; border: var(--line) solid var(--ink); background: var(--sand); display: grid; place-items: center; }
.empty .ic svg { width: 30px; height: 30px; }
.empty h4 { margin: 0 0 6px; font-size: 18px; font-weight: 800; }
.empty p { margin: 0 0 18px; color: var(--ink-2); font-size: 14.5px; }

/* ---------- lesson page ---------- */
.les-hero { padding: 0; overflow: hidden; margin-bottom: 18px; }
.les-hero .art { position: relative; aspect-ratio: 16 / 9; background: var(--c); border-bottom: var(--line) solid var(--ink); display: grid; place-items: center; overflow: hidden; }
.les-hero .art .big-play { width: 84px; height: 84px; border-radius: 50%; border: 3px solid var(--ink); background: var(--card); box-shadow: var(--sh); display: grid; place-items: center; z-index: 2; text-decoration: none; color: var(--ink); }
.les-hero .art .big-play svg { width: 36px; height: 36px; margin-left: 5px; }
.les-hero .art .deco { position: absolute; font-weight: 800; font-size: 16px; padding: 5px 10px; border: var(--line) solid var(--ink); border-radius: 10px; background: var(--card); box-shadow: var(--sh-sm); }
.les-hero .body { padding: 16px; }
.les-hero .k { margin: 0; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2); }
.les-hero h1 { margin: 4px 0 10px; font-size: 26px; line-height: 1.1; font-weight: 800; }
.les-hero .meta { display: flex; flex-wrap: wrap; gap: 8px; }
.les-hero .meta .chip { height: 32px; font-size: 13px; }

.tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; margin: 22px 0 16px; border: var(--line) solid var(--ink); border-radius: 14px; overflow: hidden; box-shadow: var(--sh-sm); }
.tabs button { height: 46px; border: 0; background: var(--card); font-weight: 700; font-size: 14.5px; }
.tabs button + button { border-left: var(--line) solid var(--ink); }
.tabs button[aria-selected="true"] { background: var(--ink); color: #fff; }

.points { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.points li { display: grid; grid-template-columns: 36px 1fr; gap: 12px; padding: 14px; align-items: start; }
.points .n { width: 36px; height: 36px; border-radius: 10px; border: var(--line) solid var(--ink); background: var(--c, var(--yellow)); display: grid; place-items: center; font-weight: 800; }
.points p { margin: 0; font-size: 15.5px; line-height: 1.45; }
.points .pap { margin-top: 6px; font-size: 13.5px; color: var(--ink-2); font-style: italic; }
mark.pv { background: var(--pink); color: #fff; padding: 0 4px; border-radius: 4px; font-weight: 700; }
mark.ow { background: var(--blue); color: #fff; padding: 0 4px; border-radius: 4px; font-weight: 700; }

.words { display: flex; flex-direction: column; gap: 12px; }
.word { display: grid; grid-template-columns: 1fr auto; gap: 10px; padding: 14px; align-items: center; }
.word .w { margin: 0; font-weight: 800; font-size: 17px; }
.word .d { margin: 3px 0 0; font-size: 14px; color: var(--ink-2); }
.word .p { margin: 6px 0 0; font-size: 13px; }
.word .p b { display: inline-block; padding: 0 6px; margin-right: 4px; border: 1.5px solid var(--ink); border-radius: 6px; background: var(--sand); font-size: 11px; }
.speak { width: 46px; height: 46px; }

.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; margin-bottom: 14px; }
.toggle-row span { font-weight: 700; font-size: 14.5px; }
.switch { position: relative; width: 56px; height: 32px; flex: none; border: var(--line) solid var(--ink); border-radius: 999px; background: #e6e2d8; padding: 0; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 23px; height: 23px; border-radius: 50%; background: var(--card); border: 2px solid var(--ink); transition: transform .18s; }
.switch[aria-checked="true"] { background: var(--green); }
.switch[aria-checked="true"]::after { transform: translateX(24px); }

/* ---------- practice ---------- */
.games { display: grid; gap: 16px; }
.game { display: grid; grid-template-columns: 64px 1fr auto; gap: 14px; align-items: center; padding: 16px; text-align: left; width: 100%; background: var(--c); }
.game .ic { width: 64px; height: 64px; border-radius: 14px; border: var(--line) solid var(--ink); background: var(--card); display: grid; place-items: center; }
.game .ic svg { width: 30px; height: 30px; }
.game .t { margin: 0; font-weight: 800; font-size: 17px; }
.game .s { margin: 2px 0 0; font-size: 13.5px; }
.game .go svg { width: 24px; height: 24px; }

.flash-wrap { perspective: 1200px; margin: 6px 0 22px; }
.flash { position: relative; height: 290px; transform-style: preserve-3d; transition: transform .5s cubic-bezier(.3, .9, .3, 1.1); cursor: pointer; }
.flash.flipped { transform: rotateY(180deg); }
.flash .face { position: absolute; inset: 0; backface-visibility: hidden; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 24px; text-align: center; border: 3px solid var(--ink); border-radius: var(--r-lg); box-shadow: var(--sh-lg); }
.flash .front { background: var(--card); }
.flash .back { background: var(--sand); transform: rotateY(180deg); }
.flash .face .k { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); }
.flash .face .w { font-size: 34px; font-weight: 800; }
.flash .face .d { font-size: 18px; font-weight: 500; }
.flash .face .p { font-size: 14px; color: var(--ink-2); }
.flash .face .hint { position: absolute; bottom: 16px; font-size: 13px; color: var(--ink-3); }
.flash-acts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.progress-dots { display: flex; gap: 6px; justify-content: center; margin-bottom: 16px; }
.progress-dots i { width: 22px; height: 8px; border-radius: 999px; border: 2px solid var(--ink); background: var(--card); }
.progress-dots i.on { background: var(--yellow); }
.progress-dots i.ok { background: var(--green); }
.progress-dots i.no { background: var(--pink); }

.tapgame .q { margin: 0 0 6px; font-size: 13px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2); }
.tapgame .ask { margin: 0 0 18px; font-size: 21px; font-weight: 800; line-height: 1.25; }
.sentence { display: flex; flex-wrap: wrap; gap: 10px; padding: 20px 16px; margin-bottom: 18px; }
.wtok { min-height: 50px; padding: 0 14px; border: var(--line) solid var(--ink); border-radius: 12px; background: var(--card); box-shadow: var(--sh-sm); font-size: 19px; font-weight: 600; }
.wtok.good { background: var(--green); animation: pop-in .35s ease-out; }
.wtok.bad { background: var(--bad); color: #fff; animation: shake .4s; }
.wtok.reveal { background: var(--green); outline: 3px dashed var(--ink); outline-offset: 3px; }
.wtok:disabled { cursor: default; }
.feedback { min-height: 64px; padding: 14px 16px; font-size: 15.5px; font-weight: 500; display: none; }
.feedback.show { display: block; animation: view-in .25s; }
.feedback.ok { background: #dff6d8; }
.feedback.no { background: #ffe1e1; }
.feedback b { font-weight: 800; }
@keyframes pop-in { 0% { transform: scale(.8); } 60% { transform: scale(1.12); } }
@keyframes shake { 20% { transform: translateX(-6px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(4px); } }
.result { text-align: center; padding: 26px 18px; }
.result .score { font-size: 56px; font-weight: 800; line-height: 1; margin: 10px 0; }
.result p { margin: 0 0 20px; color: var(--ink-2); }

/* ---------- profile ---------- */
.me { display: grid; grid-template-columns: 84px 1fr; gap: 16px; align-items: center; padding: 18px; background: var(--pink); margin-bottom: 18px; }
.avatar { width: 84px; height: 84px; border-radius: 22px; border: 3px solid var(--ink); background: var(--yellow); display: grid; place-items: center; font-size: 40px; font-weight: 800; box-shadow: var(--sh-sm); }
.me h1 { margin: 0; font-size: 26px; font-weight: 800; }
.me p { margin: 2px 0 8px; font-weight: 600; }
.me .bar { background: #fff; }
.me .bar i { background: var(--yellow); }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.stat { padding: 14px 10px; text-align: center; }
.stat svg { width: 24px; height: 24px; margin: 0 auto 6px; display: block; }
.stat b { display: block; font-size: 24px; font-weight: 800; line-height: 1.1; }
.stat span { font-size: 12px; color: var(--ink-2); font-weight: 600; }
.badges { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.badge { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; font-size: 11.5px; font-weight: 700; line-height: 1.2; }
.badge .b { width: 64px; height: 64px; border-radius: 18px; border: var(--line) solid var(--ink); background: var(--c); box-shadow: var(--sh-sm); display: grid; place-items: center; }
.badge .b svg { width: 28px; height: 28px; }
.badge.locked .b { background: #ece8de; border-style: dashed; box-shadow: none; color: var(--ink-3); }
.badge.locked { color: var(--ink-3); }
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; padding: 14px; }
.day { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; color: var(--ink-2); }
.day i { width: 32px; height: 32px; border-radius: 10px; border: 2px solid var(--ink); background: var(--card); display: grid; place-items: center; }
.day i svg { width: 18px; height: 18px; }
.day.on i { background: var(--orange); }
.day.today { color: var(--ink); }
.day.today i { outline: 2px dashed var(--ink); outline-offset: 2px; }
.settings { display: flex; flex-direction: column; gap: 0; padding: 0; overflow: hidden; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; }
.set-row + .set-row { border-top: 2px solid var(--ink); }
.set-row .l b { display: block; font-size: 15px; }
.set-row .l span { font-size: 13px; color: var(--ink-2); }
.seg-ctl { display: flex; border: var(--line) solid var(--ink); border-radius: 10px; overflow: hidden; flex: none; }
.seg-ctl button { height: 36px; padding: 0 10px; border: 0; background: var(--card); font-weight: 700; font-size: 13px; }
.seg-ctl button + button { border-left: 2px solid var(--ink); }
.seg-ctl button[aria-pressed="true"] { background: var(--yellow); }

/* ---------- Max, the tutor ---------- */
.chatpane { display: flex; flex-direction: column; min-height: 0; background: var(--paper); }
.chatpane.full { height: 100dvh; }
.chatpane.docked { position: sticky; top: 24px; height: calc(100dvh - 48px); border: var(--line) solid var(--ink); border-radius: var(--r-lg); box-shadow: var(--sh-lg); overflow: hidden; }
.chat-head { display: flex; align-items: center; gap: 12px; padding: 12px 16px; padding-top: max(12px, env(safe-area-inset-top)); background: var(--sand); border-bottom: var(--line) solid var(--ink); }
.chat-head .who { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.chat-head .who b { font-size: 18px; font-weight: 800; line-height: 1.1; }
.chat-head .who span { font-size: 13px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-head .icon-btn { width: 42px; height: 42px; box-shadow: var(--sh-sm); }
.chat { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; padding: 18px 16px; overscroll-behavior: contain; }
.msg { position: relative; max-width: 88%; padding: 12px 14px; font-size: 16px; line-height: 1.5; }
.msg.max { align-self: flex-start; background: var(--card); border-radius: 4px 16px 16px 16px; }
.msg.max .txt b { background: var(--sand); padding: 0 3px; border-radius: 4px; }
.msg.me { align-self: flex-end; background: var(--ink); color: #fff; border-radius: 16px 4px 16px 16px; box-shadow: 4px 4px 0 var(--purple); }
.msg .say-btn { position: absolute; right: -14px; bottom: -14px; width: 34px; height: 34px; padding: 0; display: grid; place-items: center; border: 2px solid var(--ink); border-radius: 50%; background: var(--yellow); box-shadow: var(--sh-sm); }
.msg .say-btn svg { width: 17px; height: 17px; }
.msg.max:has(.say-btn) { margin-bottom: 8px; }
.msg.typing .txt { display: flex; gap: 5px; padding: 4px 2px; }
.msg.typing i { width: 8px; height: 8px; border-radius: 50%; background: var(--ink); animation: dot 1s infinite; }
.msg.typing i:nth-child(2) { animation-delay: .15s; }
.msg.typing i:nth-child(3) { animation-delay: .3s; }
@keyframes dot { 50% { transform: translateY(-5px); opacity: .4; } }
.composer { padding: 10px 12px calc(12px + env(safe-area-inset-bottom)); background: var(--paper); border-top: var(--line) solid var(--ink); }
.chatpane.docked .composer { background: var(--card); }
.composer .quick { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 12px; scrollbar-width: none; }
.composer .quick::-webkit-scrollbar { display: none; }
.composer .quick button { flex: none; height: 36px; padding: 0 12px; border: 2px solid var(--ink); border-radius: 999px; background: var(--card); font-size: 13.5px; font-weight: 700; box-shadow: var(--sh-sm); }
.composer form { display: flex; gap: 10px; }
.composer input { flex: 1; min-width: 0; height: 52px; padding: 0 14px; border: var(--line) solid var(--ink); border-radius: var(--r); background: var(--card); box-shadow: var(--sh-sm); font-size: 16px; }
.composer .send { width: 52px; height: 52px; background: var(--yellow); }
.composer .mic { width: 52px; height: 52px; }
.composer .mic.on { background: var(--pink); animation: pulse-mic 1s ease-in-out infinite; }
@keyframes pulse-mic { 50% { transform: scale(1.06); } }
#view.chat-view { padding: 0; max-width: none; }
.les-side { display: none; }
.chatlog .a { display: block; margin-top: 4px; font-size: 13.5px; color: var(--ink); }

/* mascot */
.max-svg { display: block; overflow: visible; }
.max-svg .body { animation: max-bob 3s ease-in-out infinite; transform-origin: 50% 90%; transform-box: fill-box; }
.max-svg .eye { animation: max-blink 4.5s infinite; transform-origin: center; transform-box: fill-box; }
@keyframes max-bob { 50% { transform: translateY(-3px) rotate(-2deg); } }
@keyframes max-blink { 0%, 92%, 100% { transform: scaleY(1); } 95% { transform: scaleY(.1); } }

.toast { position: fixed; left: 50%; bottom: calc(var(--nav-h) + 20px); z-index: 50; transform: translateX(-50%); padding: 12px 18px; background: var(--ink); color: #fff; border-radius: 12px; box-shadow: 4px 4px 0 var(--yellow); font-weight: 700; font-size: 14.5px; animation: view-in .25s; white-space: nowrap; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- photo → lesson ---------- */
.pill.fail { background: var(--bad); color: #fff; border-color: var(--bad); }
.spin { display: grid; place-items: center; }
.spin svg { width: 22px; height: 22px; animation: spin-ck 1.2s linear infinite; }
.lesson.pending { text-decoration: none; }
.les-hero .art .page-photo { position: absolute; left: 50%; top: 50%; width: 46%; aspect-ratio: 3 / 4; transform: translate(-50%, -50%) rotate(-4deg);
  padding: 6px; background: #fff; border: var(--line) solid var(--ink); border-radius: 8px; box-shadow: var(--sh); overflow: hidden; }
.les-hero .art .page-photo img { width: 100%; height: 100%; object-fit: cover; border-radius: 3px; }
.les-hero .art .page-photo + .big-play { position: absolute; right: 16px; bottom: 16px; width: 70px; height: 70px; }
.answers { display: flex; flex-direction: column; gap: 12px; margin-bottom: 18px; }
.answers .wtok { width: 100%; min-height: 58px; padding: 10px 16px; text-align: left; font-size: 17px; line-height: 1.3; }
.tipline { margin: 18px 0 0; padding: 14px 16px; background: var(--sand); font-size: 14.5px; font-weight: 600; text-align: left; }
.code-in { flex: 1; min-width: 0; height: 54px; padding: 0 14px; border: var(--line) solid var(--ink); border-radius: var(--r); background: var(--card); box-shadow: var(--sh-sm); font-size: 17px; font-weight: 700; letter-spacing: .04em; }
.koppel-form { display: flex; gap: 10px; width: 100%; max-width: 420px; margin: 0 auto; }
.koppel-form .btn { flex-shrink: 0; }

/* ---------- tablets and computers: side rail, wider grids, Max beside the lesson ---------- */
.nav .brand { display: none; }
@media (min-width: 720px) {
  :root { --rail: 112px; }
  #app { margin-left: var(--rail); }
  #view { max-width: 1180px; margin: 0 auto; padding: 36px 44px 64px; }
  #view.no-nav { padding-bottom: 64px; }
  #view.narrow { max-width: 820px; }
  .nav { left: 0; top: 0; bottom: 0; right: auto; width: var(--rail); height: auto; display: flex; flex-direction: column; align-items: center; gap: 18px;
    padding: 20px 0 calc(20px + env(safe-area-inset-bottom)); border-top: 0; border-right: var(--line) solid var(--ink); }
  .nav[hidden] { display: flex; }
  .nav .brand { order: -2; display: flex; flex-direction: column; align-items: center; gap: 2px; margin-bottom: 10px; font-size: 13px; font-weight: 800; color: var(--ink); }
  .nav a { font-size: 12.5px; }
  .nav .ni { width: 54px; height: 40px; border-radius: 12px; }
  .nav a.scan { order: -1; margin-bottom: 6px; }
  .nav a.scan .ni { margin-top: 0; width: 64px; height: 64px; }
  .headline { font-size: 52px; }
  .folders { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 30px 20px; }
  .games { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
  .lessons { display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); }
  .words { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
  .badges { grid-template-columns: repeat(auto-fill, minmax(86px, 1fr)); }
  .thumbs { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
  .toast { bottom: 28px; left: calc(50% + var(--rail) / 2); }
  .chatpane.full { height: 100dvh; max-width: 920px; margin: 0 auto; border-left: var(--line) solid var(--ink); border-right: var(--line) solid var(--ink); }
  .flash { height: 340px; }
  .vak-hero { padding: 26px; }
  .les-hero .art { aspect-ratio: 21 / 9; }
}
@media (min-width: 1000px) {
  .home { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); grid-template-areas: "main vakken" "max vakken"; gap: 0 48px; align-items: start; }
  .h-main { grid-area: main; } .h-vakken { grid-area: vakken; } .h-max { grid-area: max; }
  .h-vakken .section-h:first-child { margin-top: 8px; }
  .les-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(340px, 400px); gap: 32px; align-items: start; }
  .les-side { display: block; }
  .les-layout .max-card { display: none; }
  .les-hero .art { aspect-ratio: 16 / 7; }
  .ik-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 40px; align-items: start; }
}
/* An iPad in portrait has the rail; on a phone the lesson page links to Max instead. */
.max-card { margin-top: 24px; }

/* ---------- Toets ---------- */
.toets .q { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pill.lvl { text-transform: none; letter-spacing: 0; font-size: 12.5px; }
.pill.lvl-onthouden { background: var(--sand); } .pill.lvl-begrijpen { background: var(--lime); }
.pill.lvl-toepassen { background: var(--blue); color: #fff; border-color: var(--ink); } .pill.lvl-uitleggen { background: var(--pink); color: #fff; border-color: var(--ink); }
.statement { padding: 16px 18px; font-size: 18px; font-weight: 700; line-height: 1.4; margin-bottom: 14px; background: var(--sand); }
.tf-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tf-row .wtok, .answers .wtok { font-size: 17px; }
.wtok[aria-pressed="true"], .wtok.picked { background: var(--yellow); outline: 3px solid var(--ink); outline-offset: 2px; }
.fill-sentence { align-items: center; font-size: 19px; font-weight: 600; line-height: 1.6; }
.tfill { width: 170px; height: 48px; margin: 0 8px; padding: 0 12px; border: var(--line) solid var(--ink); border-radius: 12px; font-size: 18px; font-weight: 700; text-align: center; box-shadow: var(--sh-sm); }
.tfill.good { background: #dff6d8; } .tfill.bad { background: #ffe1e1; }
.order-row { display: flex; align-items: center; gap: 12px; }
.ord-n { flex: none; width: 34px; height: 34px; border-radius: 10px; border: 2px solid var(--ink); display: grid; place-items: center; font-weight: 800; background: var(--card); }
.match { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.match .answers { margin: 0; }
.paired.c0 { background: #ffe49a; } .paired.c1 { background: #ffc2d4; } .paired.c2 { background: #bfe0ff; } .paired.c3 { background: #d9f2a6; }
.open-wrap { position: relative; margin-bottom: 18px; }
.topen { width: 100%; min-height: 130px; padding: 14px 64px 14px 14px; font: 500 17px/1.5 var(--font); resize: vertical; }
.open-wrap .mic { position: absolute; right: 10px; bottom: 10px; width: 46px; height: 46px; }
.open-wrap .mic.on { background: var(--pink); }
.submit-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.feedback .hint { display: inline-block; margin-top: 6px; color: var(--ink-2); }
.feedback details { margin-top: 8px; } .feedback summary { cursor: pointer; font-weight: 700; }
.toets #tfb .feedback { margin-bottom: 16px; }
.mastery { padding: 14px 16px; margin-top: 16px; }
.mastery .mrow { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; font-size: 15px; }
.mastery .mrow span { font-size: 13px; color: var(--ink-2); }
.mastery-bar i { background: var(--purple); }
.mchips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.mchips .pill { text-transform: none; letter-spacing: 0; font-size: 12px; }
.toets-btn { margin-top: 12px; background: var(--yellow); }
.pill.ok { background: var(--blue); color: #fff; border-color: var(--ink); }

/* Google sign-in */
.google-btn { gap: 10px; }
.google-box { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 14px 16px; flex-wrap: wrap; }
.google-box p { margin: 0; font-size: 15px; } .google-box span { font-size: 13px; color: var(--ink-2); }

/* Uitlegvideo card in a lesson (only when a parent uploaded one) */
.explainer { padding: 12px; margin: 14px 0; }
.explainer .k { display: flex; gap: 6px; align-items: center; margin: 0 0 8px; font-weight: 700; }
.explainer .k svg { width: 18px; height: 18px; }
.explainer video, .explainer img { display: block; width: 100%; max-height: 60vh; border-radius: 12px; background: #000; object-fit: contain; }
