/* TypTik: vingerkleuren, toetsenbord, oefening, resultaat, overwinningen */
.f-lp { --kc: #f9c3d6; --ks: #ef6a9a; }
.f-lr { --kc: #ffd9ab; --ks: #f59a3c; }
.f-lm { --kc: #fff0b0; --ks: #f2c230; }
.f-li { --kc: #c4efd2; --ks: #3dbe78; }
.f-ri { --kc: #c6e0ff; --ks: #4c9bf5; }
.f-rm { --kc: #ddd0fa; --ks: #8f6be6; }
.f-rr { --kc: #bdeee9; --ks: #27b3a6; }
.f-rp { --kc: #ffcdbf; --ks: #ef6a4a; }
.f-lt, .f-rt { --kc: #ece5d3; --ks: #a89f86; }

.confetti { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 60; }

/* ---------- toetsenbord ---------- */
.kbd-wrap { width: 100%; max-width: 980px; margin: 18px auto 0; container-type: inline-size; }
/* sleutelhoogte volgt de sleutelbreedte (container-eenheden): het bord schaalt uniform, nooit alleen horizontaal */
.kbd { --g: clamp(2px, 0.65cqw, 6px); --ku: calc((100cqw - 18 * var(--g) - 4 * var(--g)) / 15.2); display: grid; gap: var(--g); padding: calc(var(--g) * 2); background: var(--paper); border: var(--line); border-radius: 26px; box-shadow: 0 6px 0 var(--ink); }
.kbd-row { display: flex; gap: var(--g); }
.key { position: relative; height: min(var(--ku), 58px); min-width: 0; background: var(--kc, #fff); border: clamp(1.5px, 0.3cqw, 3px) solid var(--ink); border-radius: clamp(5px, 1cqw, 12px); box-shadow: 0 clamp(2px, 0.4cqw, 4px) 0 var(--ink); display: grid; place-items: center; font-family: var(--mono); font-weight: 900; font-size: clamp(8px, 2.1cqw, 22px); transition: transform .08s; }
.key .k-main { line-height: 1; }
.key .k-top { position: absolute; top: 2px; left: 6px; font-size: .55em; opacity: .7; }
.key .k-alt { position: absolute; bottom: 1px; right: 5px; font-size: .5em; opacity: .6; }
.key-space { background: var(--kc, #ece5d3); }
.key-shift, .key-altgr, .key-caps, .key-tab, .key-enter, .key-backspace, .key-ctrl, .key-alt, .key-meta { font-size: clamp(6px, 1.3cqw, 14px); }
.key-bump::after { content: ""; position: absolute; bottom: 5px; width: 14px; height: 4px; border-radius: 3px; background: var(--ink); opacity: .55; }
.key.next { background: var(--ks); color: #fff; animation: keypulse .8s ease-in-out infinite; z-index: 1; }
.key.next .k-top, .key.next .k-alt { opacity: 1; }
.key.pressed { transform: translateY(4px); box-shadow: 0 0 0 var(--ink); background: var(--green); }
/* glow-laag: eigen pseudo-element, dus de pulse (animation op .key.next) blijft doorlopen */
.key::before { content: ""; position: absolute; inset: -5px; border-radius: 16px; pointer-events: none; opacity: 0; box-shadow: 0 0 0 4px rgba(61, 220, 132, .9), 0 0 18px 8px rgba(61, 220, 132, .75); }
.key.glow-ok::before { animation: keyglow .26s ease-out; }
.key.glow-bad::before { box-shadow: 0 0 0 4px rgba(239, 106, 74, .95), 0 0 18px 8px rgba(239, 106, 74, .8); animation: keyglow .26s ease-out; }
@keyframes keyglow { 0% { opacity: 1; } 100% { opacity: 0; } }
.key.pressed-bad { transform: translateY(2px); background: var(--coral); color: #fff; }
.kbd.shake { animation: shake .3s; }
@keyframes keypulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.1); } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }

/* ---------- handen ---------- */
.palm { fill: #fbe3c7; stroke: var(--ink); stroke-width: 4; }
.hands .fing { fill: var(--ks); stroke: var(--ink); stroke-width: 4; transform-box: fill-box; transform-origin: 50% 100%; }
.hands.has-active .fing:not(.active) { opacity: .45; }
.hands .fing.active { animation: wiggle .5s ease-in-out infinite; }
.hands .fglow.glow-ok { animation: fglow-ok .26s ease-out; }
.hands .fglow.glow-bad { animation: fglow-bad .26s ease-out; }
.hands .palm.glow-ok { animation: palmglow-ok .26s ease-out; }
.hands .palm.glow-bad { animation: palmglow-bad .26s ease-out; }
@keyframes fglow-ok { 0% { filter: drop-shadow(0 0 7px #3ddc84) drop-shadow(0 0 12px #3ddc84); } 100% { filter: none; } }
@keyframes fglow-bad { 0% { filter: drop-shadow(0 0 7px #ef6a4a) drop-shadow(0 0 12px #ef6a4a); } 100% { filter: none; } }
@keyframes palmglow-ok { 0% { filter: drop-shadow(0 0 8px #3ddc84); } 100% { filter: none; } }
@keyframes palmglow-bad { 0% { filter: drop-shadow(0 0 8px #ef6a4a); } 100% { filter: none; } }
.hands .tip { font-family: var(--mono); font-weight: 900; font-size: 22px; fill: var(--ink); }
.hands .tip-small { font-size: 15px; font-family: var(--ui); font-weight: 700; }
.hands-wrap { max-width: 380px; margin: 12px auto 0; }
/* oefening: toetsenbord over de volledige breedte, geen handen (die staan op het introscherm) */
.play { display: block; }
@media (min-width: 1000px) and (max-height: 860px) {
  .page-ex .text-win { height: calc(2.5 * 1.7 * 36px); }
  .page-ex .kbd-wrap { max-width: 800px; margin-top: 12px; }
}
@keyframes wiggle { 0%, 100% { transform: rotate(-3deg) translateY(0); } 50% { transform: rotate(3deg) translateY(-8px); } }

/* ---------- oefening ---------- */
.ex { display: grid; gap: 14px; }
.ex-top { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.ex-title { display: grid; flex: 1; line-height: 1.2; }
.ex-lvl { font-size: 14px; font-weight: 900; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-soft); }
.live { display: flex; gap: 10px; }
.live-item { display: grid; justify-items: center; min-width: 74px; padding: 2px 12px; border: var(--line); border-radius: 16px; background: var(--paper); line-height: 1.2; }
.live-item b { font-size: 22px; font-family: var(--mono); }
.live-item span { font-size: 12px; font-weight: 800; text-transform: uppercase; }
.prog { height: 18px; border: var(--line); border-radius: 999px; background: var(--paper); overflow: hidden; }
.prog-fill { height: 100%; width: 0; background: var(--green); border-right: 3px solid var(--ink); transition: width .25s ease-out; }
.ex-main { display: flex; align-items: flex-start; gap: 18px; max-width: 980px; margin: 0 auto; width: 100%; }
.coach { width: 150px; flex: none; display: grid; gap: 8px; justify-items: center; }
.bubble-msg { position: relative; background: #fff; border: 3px solid var(--ink); border-radius: 18px; padding: 6px 12px; font-weight: 800; font-size: 14px; text-align: center; line-height: 1.25; }
.paper { flex: 1; min-width: 0; background: var(--paper); border: var(--line); border-radius: var(--radius); padding: 20px 26px; box-shadow: 0 6px 0 var(--ink); display: grid; gap: 10px; }
.text-win { height: calc(3 * 1.7 * 36px); overflow: hidden; position: relative; }
.text-inner { font-family: ui-monospace, Menlo, "Courier New", monospace; font-size: 36px; line-height: 1.7; transition: transform .2s ease-out; word-break: keep-all; overflow-wrap: anywhere; white-space: pre-wrap; }
.ch { display: inline; padding: 0 1px; border-radius: 6px; color: var(--ink); opacity: .55; }
.ch.done { opacity: 1; color: #2f9d62; }
.ch.done.had-err { color: #d6402b; background: #ffe3dc; box-shadow: 0 3px 0 #d6402b; font-weight: 700; }
.ch.cur { opacity: 1; background: var(--yellow); box-shadow: 0 3px 0 var(--ink); }
.ch.err { animation: errflash .35s; }
.ch-space.cur { box-shadow: 0 3px 0 var(--ink); }
@keyframes errflash { 0%, 100% { background: var(--yellow); } 30% { background: var(--coral); } }
.text-win.is-done .ch { animation: hop .5s var(--pop); }
@keyframes hop { 40% { transform: translateY(-8px); } }
.step-hint { min-height: 1.6em; font-weight: 800; color: var(--ink-soft); }
.step-hint.on { color: var(--ink); }
.start-note { font-size: 15px; color: var(--ink-soft); }
.blind { max-width: 980px; margin: 16px auto 0; display: grid; justify-items: center; text-align: center; gap: 2px; background: var(--c, var(--purple)); background: var(--purple); border: var(--line); border-radius: var(--radius); padding: 18px; box-shadow: 0 6px 0 var(--ink); }
.blind-emoji { font-size: 48px; }

/* ---------- resultaat ---------- */
.result { max-width: 820px; margin: 0 auto; display: grid; gap: 20px; }
.res-card { background: var(--c); border: var(--line); border-radius: var(--radius); padding: 22px 26px; box-shadow: 0 6px 0 var(--ink); display: grid; gap: 12px; justify-items: center; text-align: center; }
.res-head { display: flex; align-items: center; gap: 18px; text-align: left; flex-wrap: wrap; justify-content: center; }
.res-level { font-weight: 800; font-size: 15px; }
.res-head h1 { font-size: 38px; font-weight: 900; line-height: 1.1; }
.medal-stage { display: grid; justify-items: center; gap: 4px; min-height: 160px; }
.medal-svg { width: 150px; height: auto; filter: drop-shadow(0 6px 0 rgba(30, 27, 58, .25)); }
.medal-stage.won .medal { animation: medaldrop 1s var(--pop) .2s both; }
.medal-name { font-weight: 900; font-size: 22px; }
.try-emoji { font-size: 80px; animation: bob 2s ease-in-out infinite; }
@keyframes medaldrop { 0% { transform: translateY(-260px) rotate(-30deg) scale(.4); opacity: 0; } 60% { transform: translateY(8px) rotate(6deg) scale(1.1); opacity: 1; } 100% { transform: none; opacity: 1; } }
.ribbon { background: var(--ink); color: var(--yellow); font-weight: 900; padding: 4px 18px; border-radius: 999px; animation: popin .5s var(--pop) 1s both; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; }
.stat { background: var(--paper); border: var(--line); border-radius: 18px; padding: 10px 14px; display: grid; justify-items: center; text-align: center; line-height: 1.25; }
.stat b { font-family: var(--mono); font-size: 34px; }
.stat span { font-weight: 800; }
.stat small { color: var(--ink-soft); font-size: 14px; }
.misses { margin: 0; padding: 12px 16px 12px 36px; background: #ffe3dc; border: var(--line); border-radius: 18px; font-weight: 700; }
.thr-result td.ok { background: var(--green); }
.thr-result td.miss { opacity: .6; }
.newbadges { display: grid; gap: 10px; }
.newbadges h2 { font-size: 26px; font-weight: 900; }
.newbadge { display: flex; align-items: center; gap: 14px; background: var(--pink); border: var(--line); border-radius: 18px; padding: 10px 16px; animation: popin .6s var(--pop) both; }
.nb-icon { font-size: 40px; }
.nb-text { display: grid; line-height: 1.3; }

/* ---------- overwinningen ---------- */
.cabinet { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 16px; }
.bcard { background: var(--paper); border: 3px dashed var(--ink); border-radius: 20px; padding: 14px; display: grid; justify-items: center; text-align: center; gap: 4px; opacity: .65; animation: popin .5s var(--pop) both; }
.bcard.got { opacity: 1; border-style: solid; background: var(--yellow); box-shadow: 0 5px 0 var(--ink); transition: transform .2s var(--pop); }
.bcard.got:hover { transform: translateY(-4px) rotate(-2deg) scale(1.04); }
.bcard-icon { font-size: 44px; line-height: 1.2; }
.bcard-desc { font-size: 14px; color: var(--ink-soft); line-height: 1.3; }
.bcard.got .bcard-desc { color: var(--ink); }
.medal-row { display: flex; flex-wrap: wrap; gap: 10px; }
.mtile { width: 64px; display: grid; justify-items: center; text-decoration: none; transition: transform .2s var(--pop); }
.mtile:hover { transform: translateY(-4px) rotate(-4deg) scale(1.1); }
.mtile .medal-svg { width: 56px; filter: none; }
.medal-svg.locked { opacity: .35; filter: grayscale(1); }
.mtile-n { font-weight: 900; font-size: 14px; }

/* minder beweging: geen animatie, wel een korte statische highlight */
@media (prefers-reduced-motion: reduce) {
  .key.glow-ok::before, .key.glow-bad::before { opacity: 1 !important; }
  .hands .fglow.glow-ok, .hands .palm.glow-ok { filter: drop-shadow(0 0 6px #3ddc84) drop-shadow(0 0 6px #3ddc84) !important; }
  .hands .fglow.glow-bad, .hands .palm.glow-bad { filter: drop-shadow(0 0 6px #ef6a4a) drop-shadow(0 0 6px #ef6a4a) !important; }
}
/* titel boven de confetti (confetti-canvas staat op z-index 60) */
.res-head { position: relative; z-index: 61; padding: 8px 18px; border-radius: 22px; background: rgba(255, 253, 245, .55); }
.res-head h1, .res-head p { text-shadow: 0 0 6px var(--c, #fff); }

@media (max-width: 720px) {
  .ex-main { flex-direction: column; align-items: stretch; }
  .coach { width: 100%; grid-template-columns: 90px 1fr; align-items: center; }
  .mascot-coach { width: 90px; }
  .text-win { height: calc(3 * 1.7 * 26px); }
  .text-inner { font-size: 26px; }
}
