/* Tiendorp: flat "sticker" cartoon look. No black outlines: flat colour shapes, soft drop shadows,
   rounded corners, a rounded display face (Fredoka) and an early-reader body face (Andika).
   Single theme on purpose. Layout: one screen at a time; the play screen stacks on phones/portrait
   and splits in two on landscape tablets; big desktop screens are scaled up by game.js. */
@font-face { font-family: "Fredoka"; src: url("fonts/fredoka-latin-500-normal.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Fredoka"; src: url("fonts/fredoka-latin-600-normal.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Fredoka"; src: url("fonts/fredoka-latin-700-normal.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Andika"; src: url("fonts/andika-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Andika"; src: url("fonts/andika-latin-700-normal.woff2") format("woff2"); font-weight: 700; font-display: swap; }

:root {
  color-scheme: light;
  --sky: #d6eefb;
  --paper: #ffffff;
  --ink: #2f3640;
  --muted: #6b7685;
  --soft: #eef3f8;
  --soft-2: #dde7f1;
  --sun: #ffc93c;
  --sun-dark: #e3a91a;
  --tomato: #ff6b6b;
  --leaf: #5fcb7d;
  --leaf-light: #79d793;
  --leaf-dark: #43ad62;
  --water: #4fb3ea;
  --water-light: #6cc4f2;
  --water-dark: #2f8fd0;
  --wood: #b9773f;
  --wood-light: #cf9156;
  --wood-dark: #8b5a32;
  --plank2: #ffa53a;
  --plank2-light: #ffbe6a;
  --good: #2fa866;
  --bad: #e5484d;
  --font-display: "Fredoka", "Andika", "Ubuntu", system-ui, sans-serif;
  --font-body: "Andika", "Ubuntu", system-ui, -apple-system, "Segoe UI", sans-serif;
  --emoji: "Noto Color Emoji", "Apple Color Emoji", "Segoe UI Emoji", sans-serif;
  --shadow: 0 10px 24px -14px rgba(30, 70, 115, .45), 0 2px 0 rgba(30, 70, 115, .05);
  --shadow-sm: 0 6px 14px -10px rgba(30, 70, 115, .5);
  --press: 0 4px 0 var(--soft-2);
  --r: 22px;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background-color: var(--sky);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 18px;
  line-height: 1.45;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
  overscroll-behavior: none;
}
input { -webkit-user-select: text; user-select: text; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; touch-action: manipulation; }
button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible { outline: 4px solid var(--water); outline-offset: 2px; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 600; margin: 0; line-height: 1.1; text-wrap: balance; }

#app { position: relative; z-index: 1; max-width: 640px; margin: 0 auto; padding-inline: 16px; padding-block: max(12px, env(safe-area-inset-top)) 40px; }
.screen { display: flex; flex-direction: column; gap: 16px; animation: fade .25s ease-out; }
@keyframes fade { from { opacity: .3; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- characters: flat sticker look (white rim from the halo copy) ---------- */
.doodle { display: block; width: 100%; height: 100%; overflow: visible; filter: drop-shadow(0 3px 2px rgba(30, 60, 100, .2)); }
.doodle .halo * { fill: #fff !important; stroke: #fff !important; stroke-width: 7px !important; stroke-linejoin: round; stroke-linecap: round; opacity: 1 !important; }
/* lines (tails, legs) get a rim around the line itself, not a white filled curve */
.doodle .halo [fill="none"] { fill: none !important; }
.doodle .halo .keep[fill="none"] { stroke-width: 13px !important; }
.doodle .art *:not(.keep) { stroke: none; }
.doodle .art [fill="none"]:not(.keep) { stroke: #463c3c; stroke-width: 2.4px; stroke-linecap: round; stroke-linejoin: round; }
.doodle .art .keep { stroke-linecap: round; stroke-linejoin: round; }

/* ---------- shared pieces ---------- */
.panel { background: var(--paper); border-radius: var(--r); padding: 22px 20px; display: flex; flex-direction: column; gap: 14px; box-shadow: var(--shadow); }
.panel h2 { font-size: 1.8rem; }
.btn { border: 0; border-radius: 16px; padding: 11px 22px; background: var(--sun); color: var(--ink); font-family: var(--font-display); font-weight: 600; font-size: 1.3rem; line-height: 1.15; cursor: pointer; box-shadow: 0 4px 0 var(--sun-dark); transition: transform .08s, box-shadow .08s; }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--sun-dark); }
.btn.ghost { background: var(--paper); box-shadow: 0 4px 0 var(--soft-2), var(--shadow-sm); }
.btn.ghost:active { box-shadow: 0 1px 0 var(--soft-2); }
.btn.danger { background: var(--tomato); color: #fff; box-shadow: 0 4px 0 #d24c50; }
.btn:disabled { opacity: .45; cursor: default; }
a.btn { text-decoration: none; display: inline-block; }
.link-btn { background: none; border: 0; color: var(--muted); text-decoration: underline; cursor: pointer; align-self: center; padding: 8px; font-size: .95rem; }
.icon-btn { width: 50px; height: 50px; border-radius: 16px; border: 0; background: var(--paper); cursor: pointer; font-size: 1.35rem; font-family: var(--emoji), var(--font-body); box-shadow: 0 4px 0 var(--soft-2), var(--shadow-sm); flex: none; display: grid; place-items: center; padding: 0; }
.icon-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--soft-2); }
.row-inline { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row-inline.center { justify-content: center; }
.pill { background: var(--sun); border-radius: 999px; padding: 2px 14px; font-family: var(--font-display); font-weight: 600; font-size: 1.15rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
input, select { font: inherit; font-size: 1.15rem; padding: 10px 14px; border-radius: 14px; border: 2px solid var(--soft-2); background: #fff; color: var(--ink); min-width: 0; }
input { flex: 1 1 160px; }
select { max-width: 100%; }
input:focus, select:focus { border-color: var(--water); outline: none; }
.store-note { color: var(--muted); font-size: .85rem; margin: 0; }
.hint-text { color: var(--muted); font-size: .9rem; margin: 0; }

.topbar { display: flex; align-items: center; gap: 10px; }
.topbar .who { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-family: var(--font-display); font-weight: 600; font-size: 1.45rem; line-height: 1.15; }
.topbar .who strong { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.top-actions { display: flex; gap: 8px; }

/* ---------- profiles ---------- */
.hero { text-align: center; padding-top: 6px; display: flex; flex-direction: column; gap: 6px; align-items: center; }
.hero h1 { font-size: clamp(2.7rem, 11vw, 4rem); font-weight: 700; line-height: .95; color: var(--water-dark); }
.hero h1 small { display: block; font-size: .4em; font-weight: 500; margin-top: 8px; color: var(--ink); }
.hero-art { display: flex; align-items: flex-end; gap: 4px; height: 124px; }
.hero-art .c { width: 112px; height: 112px; }
.hero-art .c.small { width: 88px; height: 88px; }
.hero-art .wave { animation: wave 1.8s ease-in-out infinite; transform-origin: 50% 100%; }
@keyframes wave { 0%, 100% { transform: rotate(-4deg); } 50% { transform: rotate(4deg); } }
.profile-list { display: grid; gap: 10px; }
.profile-btn { display: flex; align-items: center; gap: 12px; border: 0; border-radius: 18px; padding: 8px 14px; background: var(--soft); cursor: pointer; text-align: left; box-shadow: 0 4px 0 var(--soft-2); }
.profile-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--soft-2); }
.profile-btn .av { width: 56px; height: 56px; flex: none; }
.profile-btn .nm { font-family: var(--font-display); font-weight: 600; font-size: 1.5rem; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.new-profile { display: flex; flex-direction: column; gap: 6px; }
.new-profile label { font-weight: 700; font-size: .8rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }

/* ---------- map ---------- */
.world-tabs { display: flex; gap: 10px; flex-wrap: wrap; }
.world-tab { flex: 1 1 140px; border: 0; border-radius: 16px; background: var(--paper); padding: 8px 14px; font-family: var(--font-display); font-weight: 600; font-size: 1.3rem; line-height: 1.15; cursor: pointer; box-shadow: 0 4px 0 var(--soft-2), var(--shadow-sm); }
.world-tab[aria-selected="true"] { background: var(--water); color: #fff; box-shadow: 0 4px 0 var(--water-dark); }
.world-tab.locked { opacity: .75; }
.world-tab:active { transform: translateY(3px); }
.gate h2 { font-size: 1.6rem; }
.gate p { margin: 0; }
.gate-list { display: grid; gap: 8px; }
.gate-item { display: flex; justify-content: space-between; align-items: center; gap: 10px; border: 0; border-radius: 14px; background: var(--soft); padding: 10px 14px; cursor: pointer; text-align: left; box-shadow: 0 3px 0 var(--soft-2); }
.gate-item:active { transform: translateY(2px); box-shadow: none; }
.gate-item b { font-family: var(--font-display); font-weight: 600; font-size: 1.15rem; line-height: 1.15; }
.gate-item span { font-size: .95rem; white-space: nowrap; color: var(--muted); }
.gate-progress { height: 16px; border-radius: 10px; background: var(--soft); overflow: hidden; }
.gate-progress i { display: block; height: 100%; background: var(--leaf); border-radius: 10px; }

.village { background: var(--paper); border-radius: 20px; padding: 10px 14px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; box-shadow: var(--shadow); }
.village .lbl { font-family: var(--font-display); font-weight: 600; font-size: 1.15rem; width: 100%; }
.village .fr { width: 56px; height: 56px; }
.village .fr.missing { opacity: .3; filter: grayscale(1); }
.trail { list-style: none; margin: 0; padding: 4px 0 0; display: flex; flex-direction: column; position: relative; }
.trail::before { content: ""; position: absolute; top: 30px; bottom: 30px; left: 50%; width: 18px; margin-left: -9px; border-radius: 10px;
  background: linear-gradient(90deg, var(--water-dark), var(--water-light) 50%, var(--water-dark)); opacity: .85; }
.stop { position: relative; display: flex; padding: 9px 0; }
.stop:nth-child(odd) { justify-content: flex-start; }
.stop:nth-child(even) { justify-content: flex-end; }
.stop button { position: relative; z-index: 1; width: min(80%, 340px); display: flex; align-items: center; gap: 10px; text-align: left; border: 0; border-radius: 20px; padding: 8px 12px; background: var(--paper); cursor: pointer; box-shadow: 0 4px 0 var(--soft-2), var(--shadow); }
.stop button:active { transform: translateY(3px); }
.stop button:disabled { cursor: default; background: #f3f7fb; box-shadow: none; }
.stop .av { width: 64px; height: 64px; flex: none; }
.stop.locked .av { opacity: .3; filter: grayscale(1); }
.stop .txt { display: flex; flex-direction: column; min-width: 0; }
.stop .ch { font-weight: 700; font-size: .72rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.stop .nm { font-family: var(--font-display); font-weight: 600; font-size: 1.35rem; line-height: 1.1; }
.stop .st { font-size: 1rem; font-variant-numeric: tabular-nums; }
.stop.current button { background: var(--sun); box-shadow: 0 4px 0 var(--sun-dark), var(--shadow); }
.stop .lock { font-family: var(--emoji); }

/* ---------- chapter ---------- */
.chapter-head { display: flex; gap: 12px; align-items: center; }
.chapter-friend { width: 90px; height: 90px; flex: none; }
.chapter-head p { margin: 0; font-size: 1.05rem; }
.bridges { display: grid; gap: 10px; }
.bridge-btn { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border: 0; border-radius: 18px; background: var(--soft); cursor: pointer; text-align: left; box-shadow: 0 4px 0 var(--soft-2); }
.bridge-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--soft-2); }
.bridge-btn.next { background: var(--sun); box-shadow: 0 4px 0 var(--sun-dark); }
.bridge-btn:disabled { opacity: .45; cursor: default; box-shadow: none; }
.bridge-btn .n { font-family: var(--font-display); font-weight: 600; font-size: 1.4rem; flex: 1; line-height: 1.1; }
.bridge-btn .n small { display: block; font-family: var(--font-body); font-weight: 700; font-size: .88rem; color: var(--muted); margin-top: 2px; }
.stars-sm { font-size: 1.45rem; letter-spacing: 1px; color: var(--sun); white-space: nowrap; }
.stars-sm .no { color: #cfdbe7; }
.chap-note { margin: 0; background: #fff4d2; border-radius: 14px; padding: 10px 14px; font-weight: 700; }

/* ---------- story / bedtime ---------- */
.story { min-height: 82vh; justify-content: center; }
.story-place { align-self: center; font-family: var(--font-display); font-weight: 600; font-size: 1.2rem; background: var(--sun); padding: 2px 18px; border-radius: 999px; }
.story-stage { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.speaker { width: clamp(160px, 44vw, 230px); height: clamp(160px, 44vw, 230px); animation: bob 1.6s ease-in-out infinite; }
.speaker.jump { animation: jump .45s ease-out, bob 1.6s ease-in-out .45s infinite; }
@keyframes bob { 0%, 100% { transform: translateY(0) rotate(-1deg); } 50% { transform: translateY(-6px) rotate(1deg); } }
@keyframes jump { 0% { transform: translateY(20px) scale(.9, 1.1); } 50% { transform: translateY(-18px) scale(1.05, .95); } 100% { transform: none; } }
.bubble { position: relative; background: var(--paper); border-radius: 26px; padding: 16px 22px 18px; width: 100%; box-shadow: var(--shadow); }
.bubble::before { content: ""; position: absolute; top: -12px; left: 50%; margin-left: -13px; border: 13px solid transparent; border-top: 0; border-bottom-color: var(--paper); }
.speaker-name { font-family: var(--font-display); font-weight: 600; font-size: 1.1rem; color: var(--water-dark); }
.bubble p { margin: 4px 0 0; font-size: 1.35rem; line-height: 1.45; font-weight: 700; text-wrap: pretty; max-width: 40ch; }
.story-actions { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }

/* ---------- play ---------- */
.progress { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; max-width: 50%; }
.progress i { width: 12px; height: 24px; border-radius: 4px; background: rgba(255, 255, 255, .85); box-shadow: inset 0 -3px 0 var(--soft-2); }
.progress i.ok { background: var(--wood); box-shadow: inset 0 -3px 0 var(--wood-dark); }
.progress i.help { background: var(--plank2); box-shadow: inset 0 -3px 0 #e48a20; }
.progress i.now { background: var(--sun); box-shadow: inset 0 -3px 0 var(--sun-dark); }

.play-main { display: flex; flex-direction: column; gap: 14px; min-width: 0; }

/* river scene */
.scene { --bankw: clamp(44px, 12vw, 70px); --actor: clamp(64px, 16vw, 100px); position: relative; display: flex; align-items: stretch; border-radius: var(--r); overflow: hidden; min-height: 200px; box-shadow: var(--shadow); background: var(--water); }
.bank { flex: 0 0 var(--bankw); position: relative; z-index: 1; background: linear-gradient(180deg, var(--leaf-light) 0 14px, var(--leaf) 14px 100%); }
.bank.left { border-radius: 0 44px 34px 0; box-shadow: 6px 0 0 #e9d9a8; }
.bank.right { border-radius: 44px 0 0 34px; box-shadow: -6px 0 0 #e9d9a8; }
.water { flex: 1; min-width: 0; position: relative; display: flex; flex-direction: column; justify-content: space-between; align-items: center; padding: 60px 4px 16px; gap: 22px;
  background: linear-gradient(180deg, var(--water-light) 0, var(--water) 45%, var(--water-dark) 100%); }
.mist-note { display: none; }
.scene.no-help .bridge, .scene.no-help .raft-wrap, .scene.no-help .dock { visibility: hidden; }
.scene.no-help .water { background: linear-gradient(180deg, #a9d9f3, #8fcbee); }
.scene.no-help .mist-note { display: block; position: absolute; top: 12px; left: 50%; transform: translateX(-50%); z-index: 6; width: max-content; max-width: calc(100% - 16px);
  text-align: center; padding: 7px 14px; border-radius: 16px; background: rgba(255, 255, 255, .88); font-family: var(--font-display); font-weight: 600; font-size: 1.05rem; line-height: 1.2; color: var(--ink); box-shadow: var(--shadow-sm); }

.actor { position: absolute; top: max(2px, calc(var(--deck, 0px) - var(--actor) + 10px)); left: calc(var(--bankw) / 2); width: var(--actor); height: var(--actor); transform: translateX(-50%); transition: left 1.6s ease-in-out, top .3s ease-out; z-index: 3; cursor: pointer; }
.actor.friend { left: calc(100% - var(--bankw) / 2); }
.scene.cross #actorBram { left: calc(100% - var(--bankw) - 26px); animation: hop .32s ease-in-out 5; }
@keyframes hop { 50% { margin-top: -10px; } }
.actor.boing { animation: boing .55s ease-out; }
@keyframes boing {
  0% { transform: translateX(-50%) scale(1, 1); }
  25% { transform: translateX(-50%) scale(1.25, .78); }
  50% { transform: translateX(-50%) scale(.85, 1.22) translateY(-8px); }
  75% { transform: translateX(-50%) scale(1.08, .94); }
  100% { transform: translateX(-50%) scale(1, 1); }
}
.fred { position: absolute; right: calc(var(--bankw) + 4px); bottom: -8px; width: 58px; height: 58px; padding: 0; border: 0; background: none; cursor: pointer; z-index: 2; }
.fred.jump { animation: fredJump .7s ease-out; }
@keyframes fredJump { 0% { transform: translateY(0); } 40% { transform: translateY(-50px) rotate(-20deg); } 100% { transform: translateY(0); } }
.fred-say { position: absolute; right: calc(var(--bankw) + 52px); bottom: 36px; z-index: 4; background: #fff; border-radius: 14px; padding: 2px 12px; font-family: var(--font-display); font-weight: 600; font-size: 1.1rem; line-height: 1.3; max-width: 60%; box-shadow: var(--shadow-sm); }

/* bridge, raft and bundles: flat wood */
.bridge, .raft, .dock { display: flex; gap: 3px; align-items: center; position: relative; }
/* the bridge spans the whole river from bank to bank, with a railing on top and posts into the water */
.bridge { align-self: stretch; justify-content: center; margin: 18px -4px 0; padding: 6px 10px; border-radius: 3px; background: #6f4423;
  box-shadow: 0 6px 0 #573419, 0 26px 16px -10px rgba(0, 40, 90, .3); }
.bridge::before { content: ""; position: absolute; left: 6px; right: 6px; bottom: 100%; height: 20px; pointer-events: none;
  background:
    linear-gradient(#9a6236, #9a6236) 0 0 / 100% 5px no-repeat,
    repeating-linear-gradient(90deg, #7a4b28 0 7px, transparent 7px 52px) 0 0 / 100% 100% no-repeat;
  border-radius: 3px 3px 0 0; }
.bridge::after { content: ""; position: absolute; left: 14px; right: 14px; top: calc(100% + 6px); height: 26px; pointer-events: none;
  background: repeating-linear-gradient(90deg, #573419 0 9px, transparent 9px 64px);
  -webkit-mask: linear-gradient(#000 55%, transparent); mask: linear-gradient(#000 55%, transparent); }
.raft { padding: 7px 9px; border-radius: 14px; min-height: 58px; min-width: 70px;
  background: repeating-linear-gradient(90deg, var(--wood-dark) 0 14px, #7a4d2b 14px 16px); box-shadow: 0 5px 0 #5e3a20; }
.raft-wrap { animation: float 2.6s ease-in-out infinite; }
@keyframes float { 0%, 100% { transform: translateY(0) rotate(-1deg); } 50% { transform: translateY(4px) rotate(1deg); } }
.plank { width: clamp(19px, 5.4vw, 30px); height: clamp(36px, 10vw, 48px); border-radius: 6px; flex: none; position: relative; transition: background .3s, transform .3s, box-shadow .3s; }
.bridge .plank:nth-child(5) { margin-right: 12px; }
.plank.empty { background: rgba(255, 255, 255, .14); border: 2px dashed rgba(255, 255, 255, .75); }
.plank.a, .plank.given { background: linear-gradient(90deg, var(--wood-light) 0 30%, var(--wood) 30% 100%); box-shadow: inset 0 -4px 0 rgba(80, 40, 10, .25); }
.plank.b { background: linear-gradient(90deg, var(--plank2-light) 0 30%, var(--plank2) 30% 100%); box-shadow: inset 0 -4px 0 rgba(160, 80, 0, .25); }
.raft .plank.cut { margin-left: 14px; }
.plank.pop { animation: pop .55s both; }
.plank.hint { box-shadow: 0 0 0 4px var(--sun), 0 0 14px 2px rgba(255, 201, 60, .8); }
@keyframes pop { 0% { transform: translateY(40px) rotate(20deg) scale(.6); } 60% { transform: translateY(-6px) rotate(-6deg) scale(1.1); } 100% { transform: none; } }
.dock { flex-wrap: wrap; justify-content: center; padding: 5px 9px; border-radius: 10px; background: #6f4423; box-shadow: 0 5px 0 #573419; min-height: 56px; max-width: 100%; align-items: flex-end; gap: 4px; }
.bundle { width: clamp(22px, 6vw, 30px); height: clamp(40px, 10vw, 48px); border-radius: 6px; position: relative; flex: none;
  background: repeating-linear-gradient(90deg, var(--wood-light) 0 2px, var(--wood) 2px 3px); box-shadow: inset 0 -4px 0 rgba(80, 40, 10, .25); }
.bundle::after { content: ""; position: absolute; left: -3px; right: -3px; top: 40%; height: 7px; background: var(--sun); border-radius: 4px; box-shadow: 0 2px 0 var(--sun-dark); }
.bundle.b { background: repeating-linear-gradient(90deg, var(--plank2-light) 0 2px, var(--plank2) 2px 3px); }
.bundle.pop { animation: pop .55s both; }
.bundle.hint { box-shadow: 0 0 0 4px var(--sun), 0 0 14px 2px rgba(255, 201, 60, .8); }
.raft .bundle { margin-inline: 1px; }

/* sum card and keypad */
.q-card, .pad-card { background: var(--paper); border-radius: var(--r); padding: 16px 14px; box-shadow: var(--shadow); }
.q-card { display: flex; flex-direction: column; gap: 10px; }
.sum { display: flex; justify-content: center; align-items: center; gap: .24em; font-family: var(--font-display); font-weight: 600; font-size: clamp(3rem, 13vw, 4.4rem); line-height: 1; position: relative; font-variant-numeric: tabular-nums; }
.sum.has-split { padding-bottom: 116px; }
.sum .na { color: var(--wood); }
.sum .nb { color: var(--plank2); position: relative; }
.sum .op { color: #a3afbd; font-weight: 500; }
.sum .unit { font-size: .45em; color: var(--muted); align-self: flex-end; margin-left: -.12em; margin-bottom: .2em; }
.sum .sp { width: .2em; }
.split { position: absolute; top: 100%; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; }
.split svg { width: 108px; height: 32px; display: block; overflow: visible; }
.split line { stroke: #b6c2cf; stroke-width: 4; stroke-linecap: round; }
.split .boxes { display: flex; gap: 22px; }
.box { min-width: 1.4em; height: 1.2em; padding: 0 .1em; border: 3px dashed #c5d1de; border-radius: .25em; display: grid; place-items: center; color: var(--ink); background: #fff; transition: border-color .15s, background .15s, box-shadow .15s; }
.split .box { font-size: 2.4rem; min-width: 1.5em; }
.box.given { border: 0; color: var(--wood); background: var(--soft); }
.box.active { border: 3px solid var(--sun); background: #fff7dc; box-shadow: 0 0 0 5px rgba(255, 201, 60, .25); }
.box.ok { border: 3px solid #bfe8cf; background: #effaf3; color: var(--good); }
.box.fill.ok { color: var(--plank2); border-color: #ffd9a8; background: #fff6ea; }
.box.shake { animation: shake .4s; border-color: var(--bad); }
.caret { color: #c2ccd8; }
@keyframes shake { 0%, 100% { transform: translateX(0) rotate(0); } 25% { transform: translateX(-7px) rotate(-4deg); } 75% { transform: translateX(7px) rotate(4deg); } }

.prompt { text-align: center; display: flex; flex-direction: column; gap: 2px; min-height: 5.6em; justify-content: center; }
.step-label { font-size: .78rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.question { font-weight: 700; font-size: 1.28rem; line-height: 1.35; text-wrap: balance; }
.say { border: 0; background: var(--soft); border-radius: 10px; cursor: pointer; font-family: var(--emoji); font-size: .95rem; padding: 3px 8px; vertical-align: 2px; box-shadow: 0 2px 0 var(--soft-2); }
.feedback { font-family: var(--font-display); font-weight: 600; font-size: 1.35rem; line-height: 1.15; min-height: 1.15em; text-wrap: balance; margin: 2px 0 0; }
.feedback.good { color: var(--good); }
.feedback.bad { color: var(--bad); }
.feedback small { display: block; font-family: var(--font-body); font-weight: 700; font-size: 1.02rem; color: var(--ink); margin-top: 4px; line-height: 1.35; }

.pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.pad button { font-family: var(--font-display); font-weight: 600; font-size: 2rem; height: 64px; border: 0; border-radius: 16px; background: var(--soft); cursor: pointer; box-shadow: 0 4px 0 var(--soft-2); line-height: 1; transition: transform .06s, box-shadow .06s; }
.pad button:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--soft-2); }
.pad .go { background: var(--leaf); color: #fff; box-shadow: 0 4px 0 var(--leaf-dark); }
.pad .go:active { box-shadow: 0 1px 0 var(--leaf-dark); }
.pad .del { font-size: 1.25rem; color: var(--muted); }

/* landscape tablets: scene + question left, keypad right, everything on one screen */
@media (min-width: 860px) and (orientation: landscape) {
  #app { max-width: 1180px; }
  .play { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(300px, 1fr); grid-template-areas: "top top" "main pad"; align-items: start; column-gap: 20px; }
  .play > .topbar { grid-area: top; }
  .play-main { grid-area: main; }
  .pad-card { grid-area: pad; position: sticky; top: 12px; }
  .pad button { height: 82px; font-size: 2.4rem; }
  .scene { min-height: 214px; }
  #scr-map, #scr-chapter, #scr-badges, #scr-parent, #scr-profiles, #scr-done, #scr-story, #scr-sleep { max-width: 720px; margin-inline: auto; width: 100%; }
}

/* ---------- done ---------- */
.done-panel { text-align: center; align-items: center; padding-block: 26px; }
.done-art { width: 150px; height: 150px; animation: bob 1.6s ease-in-out infinite; }
.done-panel h2 { font-size: 2.3rem; }
.done-panel p { margin: 0; max-width: 36ch; font-size: 1.1rem; }
.big-stars { font-size: 3.4rem; letter-spacing: 6px; line-height: 1; }
.big-stars span { display: inline-block; color: #dbe5ef; }
.big-stars span.on { color: var(--sun); text-shadow: 0 4px 0 var(--sun-dark); animation: starIn .5s both; }
.big-stars span.on:nth-child(2) { animation-delay: .3s; }
.big-stars span.on:nth-child(3) { animation-delay: .6s; }
@keyframes starIn { 0% { transform: scale(0) rotate(-120deg); } 70% { transform: scale(1.4); } 100% { transform: none; } }
.new-badges { display: flex; flex-direction: column; gap: 8px; width: 100%; }

/* ---------- badges ---------- */
.badge-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.badge { background: var(--paper); border-radius: 18px; padding: 14px 10px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; box-shadow: var(--shadow); }
.badge .ic { font-family: var(--emoji); font-size: 2.2rem; width: 64px; height: 64px; border-radius: 50%; background: var(--sun); box-shadow: 0 4px 0 var(--sun-dark); display: grid; place-items: center; line-height: 1; }
.badge .t { font-family: var(--font-display); font-weight: 600; font-size: 1.15rem; line-height: 1.15; margin-top: 4px; }
.badge .d { font-size: .85rem; color: var(--muted); line-height: 1.3; }
.badge.locked { box-shadow: none; background: #f1f5f9; }
.badge.locked .ic { background: var(--soft-2); box-shadow: none; filter: grayscale(1); opacity: .5; }
.badge-row { display: flex; align-items: center; gap: 12px; background: #fff4d2; border-radius: 16px; padding: 10px 14px; text-align: left; }
.badge-row .ic { font-family: var(--emoji); font-size: 2rem; }
.badge-row .t { font-family: var(--font-display); font-weight: 600; font-size: 1.2rem; line-height: 1.1; }
.badge-row .d { font-size: .88rem; color: var(--muted); }

/* ---------- parent ---------- */
.parent { -webkit-user-select: text; user-select: text; }
.parent h3 { font-size: 1.35rem; margin-top: 6px; }
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
.stat { background: var(--soft); border-radius: 14px; padding: 10px 12px; }
.stat b { display: block; font-family: var(--font-display); font-weight: 600; font-size: 1.7rem; line-height: 1.05; font-variant-numeric: tabular-nums; }
.stat span { font-size: .82rem; color: var(--muted); font-weight: 700; }
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; font-size: .95rem; }
th, td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--soft-2); white-space: nowrap; }
th { font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.check { display: flex; gap: 10px; align-items: center; cursor: pointer; }
.check input { flex: none; width: 24px; height: 24px; accent-color: var(--water-dark); }
.confirm { background: #ffe8e8; border-radius: 14px; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.confirm p { margin: 0; }

/* ---------- toasts ---------- */
.toasts { position: fixed; left: 0; right: 0; bottom: calc(14px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; z-index: 20; padding-inline: 16px; }
.toast { display: flex; gap: 12px; align-items: center; background: var(--paper); border-radius: 18px; padding: 8px 18px 8px 10px; box-shadow: 0 14px 30px -12px rgba(30, 60, 100, .5); animation: toastIn .5s both; max-width: 100%; }
.toast .ic { font-family: var(--emoji); font-size: 1.9rem; width: 48px; height: 48px; border-radius: 50%; background: var(--sun); display: grid; place-items: center; }
.toast small { display: block; font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; font-weight: 700; color: var(--muted); }
.toast b { font-family: var(--font-display); font-weight: 600; font-size: 1.25rem; line-height: 1.1; }
@keyframes toastIn { 0% { transform: translateY(40px) scale(.9); opacity: 0; } 60% { transform: translateY(-6px) scale(1.02); opacity: 1; } 100% { transform: none; } }

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

/* moving waves on the river: two tiling wave layers drifting at different speeds */
.water::before, .water::after { content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 0; }
.water::before { background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='38'%3E%3Cpath d='M0 19 Q15 11 30 19 T60 19 T90 19 T120 19' fill='none' stroke='white' stroke-opacity='.38' stroke-width='3' stroke-linecap='round'/%3E%3C/svg%3E") 0 6px / 120px 38px repeat; animation: waves 7s linear infinite; }
.water::after { background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='54'%3E%3Cpath d='M0 27 Q22.5 17 45 27 T90 27 T135 27 T180 27' fill='none' stroke='white' stroke-opacity='.22' stroke-width='4' stroke-linecap='round'/%3E%3C/svg%3E") 0 20px / 180px 54px repeat; animation: waves2 11s linear infinite; }
@keyframes waves { from { background-position: 0 6px; } to { background-position: 120px 6px; } }
@keyframes waves2 { from { background-position: 180px 20px; } to { background-position: 0 20px; } }
.water > * { position: relative; z-index: 1; }
.water > .mist-note { position: absolute; }
.scene.no-help .water::before, .scene.no-help .water::after { opacity: .35; }

/* the friend on the other bank looks back at Bram (and keeps its nose inside the picture) */
.actor.friend.flip .doodle { transform: scaleX(-1); }
.actor.friend { left: calc(100% - var(--bankw) / 2 - 4px); }

/* ---------- landscape behind the game, one per place ---------- */
#backdrop { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.bd-layer { position: absolute; inset: 0; opacity: 0; transition: opacity .8s ease; }
.bd-layer.on { opacity: 1; }
.bd-layer svg { display: block; width: 100%; height: 100%; }
/* washes the landscape out a little so it stays calm behind the cards */
#backdrop::after { content: ""; position: absolute; inset: 0; background: rgba(255, 255, 255, .22); }
#backdrop[data-scene="night"]::after { background: rgba(255, 255, 255, .06); }
.clouds { position: absolute; inset: 0; z-index: 1; }
.cl { position: absolute; left: 0; width: 220px; opacity: .85; animation: drift linear infinite; }
.cl svg { display: block; width: 100%; height: auto; }
.cl.c1 { top: 7%; width: 200px; animation-duration: 140s; animation-delay: -30s; }
.cl.c2 { top: 17%; width: 150px; animation-duration: 190s; animation-delay: -120s; opacity: .7; }
.cl.c3 { top: 4%; width: 260px; animation-duration: 230s; animation-delay: -70s; opacity: .6; }
@keyframes drift { from { transform: translateX(-300px); } to { transform: translateX(calc(100vw + 300px)); } }
#backdrop[data-scene="night"] .clouds, #backdrop[data-scene="mistbos"] .clouds { opacity: 0; }
.clouds { transition: opacity .8s; }

/* Fred on the start screen, who "approved" the game */
.hero-fred { position: relative; cursor: pointer; }
.hero-say { position: absolute; bottom: 92%; left: 50%; transform: translateX(-30%); white-space: nowrap; background: #fff; border-radius: 14px; padding: 4px 12px; font-family: var(--font-display); font-weight: 600; font-size: 1.05rem; box-shadow: var(--shadow-sm); animation: fade .25s ease-out; }
.hero-say::after { content: ""; position: absolute; top: 100%; left: 24px; border: 8px solid transparent; border-top-color: #fff; border-bottom: 0; }
.hero-art { overflow: visible; }

/* ---------- language flags ---------- */
.lang-flags, .lang-menu { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.lang-menu { justify-content: flex-end; }
.lang-menu[hidden] { display: none; }
.flag-btn { display: flex; align-items: center; gap: 8px; border: 0; border-radius: 14px; padding: 7px 12px 7px 8px; background: var(--paper); cursor: pointer;
  font-family: var(--font-display); font-weight: 600; font-size: 1.05rem; color: var(--ink); box-shadow: 0 4px 0 var(--soft-2), var(--shadow-sm); }
.flag-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--soft-2); }
.flag-btn svg, .lang-btn svg { width: 30px; height: 20px; border-radius: 4px; display: block; box-shadow: 0 0 0 1.5px rgba(0,0,0,.12); }
.flag-btn[aria-pressed="true"] { background: var(--sun); box-shadow: 0 4px 0 var(--sun-dark); }
.lang-btn svg { width: 28px; height: 19px; }

/* ---------- gags in the water when the planks are hidden ---------- */
.gag { display: none; }
.scene.no-help .water > .gag { display: block; position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: 2; }
.gag svg { display: block; width: 100%; height: auto; overflow: visible; }
.gag .front { position: absolute; left: 0; right: 0; bottom: 0; height: 30px; z-index: 5;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='60' height='14'%3E%3Cpath d='M0 7 Q15 0 30 7 T60 7 V14 H0 Z' fill='%238fcbee'/%3E%3Cpath d='M0 7 Q15 0 30 7 T60 7' fill='none' stroke='white' stroke-opacity='.7' stroke-width='2.5'/%3E%3C/svg%3E") 0 0 / 60px 14px repeat-x,
    linear-gradient(#8fcbee, #8fcbee) 0 13px / 100% 100% no-repeat;
  animation: waves 4s linear infinite; }
:where(.gag) .it { position: absolute; bottom: 16px; animation-duration: 14s; animation-timing-function: ease-in-out; animation-delay: 1.2s; animation-iteration-count: infinite; animation-fill-mode: both; }
.g-bub i { position: absolute; width: 10px; height: 10px; border-radius: 50%; border: 2.5px solid #fff; opacity: 0; }
.g-bub i:nth-child(2) { left: 14px; width: 7px; height: 7px; }
.g-bub i:nth-child(3) { left: 4px; width: 8px; height: 8px; }

/* 1. a paper boat bonks into a giant rubber duck, sinks, and sneaks off with a periscope */
.g-boat { width: 80px; z-index: 3; animation-name: gBoat; }
.g-duck { width: 150px; bottom: 8px; z-index: 4; animation-name: gDuck; }
.g-bonk { width: 44px; bottom: 54px; left: calc(33% + 58px); z-index: 6; animation-name: gBonk; }
.gag-boat .g-bub { left: calc(33% + 30px); bottom: 26px; z-index: 6; }
.gag-boat .g-bub i { animation: gBub 14s ease-out 1.2s infinite both; }
.gag-boat .g-bub i:nth-child(2) { animation-delay: 1.5s; }
.gag-boat .g-bub i:nth-child(3) { animation-delay: 1.8s; }
.g-scope { width: 36px; bottom: 0; left: 33%; z-index: 3; animation-name: gScope; }
@keyframes gBoat {
  0% { left: -20%; transform: none; opacity: 1; }
  28% { left: 33%; transform: rotate(0); }
  31% { left: 30%; transform: rotate(-14deg); }
  36% { left: 31%; transform: rotate(16deg); }
  50% { left: 31%; transform: translateY(70px) rotate(40deg); opacity: 1; }
  51%, 100% { left: 31%; transform: translateY(90px); opacity: 0; }
}
@keyframes gDuck {
  0% { left: 110%; transform: none; }
  28% { left: calc(33% + 68px); transform: none; }
  31% { left: calc(33% + 80px); transform: rotate(4deg); }
  34%, 60% { left: calc(33% + 76px); transform: none; }
  63% { transform: rotate(-7deg); } 66% { transform: rotate(7deg); } 69% { transform: none; }
  70% { left: calc(33% + 76px); }
  92%, 100% { left: 115%; transform: none; }
}
@keyframes gBonk {
  0%, 27% { transform: scale(0); opacity: 0; }
  29% { transform: scale(1.25) rotate(20deg); opacity: 1; }
  36% { transform: scale(1) rotate(0); opacity: 1; }
  40%, 100% { transform: scale(0); opacity: 0; }
}
@keyframes gBub {
  0%, 45% { opacity: 0; transform: translateY(0); }
  47% { opacity: 1; }
  60%, 100% { opacity: 0; transform: translateY(-56px); }
}
@keyframes gScope {
  0%, 56% { left: 33%; transform: translateY(80px) scaleX(-1); }
  62% { left: 33%; transform: translateY(0) scaleX(-1); }
  67% { left: 33%; transform: translateY(0) scaleX(-1); }
  68% { left: 33%; transform: translateY(0) scaleX(1); }
  86% { left: -15%; transform: translateY(0) scaleX(1); }
  100% { left: -15%; transform: translateY(0) scaleX(1); }
}

/* 2. Mona dives head first into the river and comes back up with an old boot */
.g-gull { width: 80px; z-index: 3; animation-name: gGull; }
.g-gull .doodle { transform: scaleX(-1); }
.g-boot { position: absolute; width: 34px; right: -14px; top: 30px; rotate: 14deg; animation: gBoot 14s linear 1.2s infinite both; }
.g-splash { width: 90px; left: calc(46% - 12px); bottom: 22px; z-index: 6; transform-origin: 50% 100%; animation-name: gSplash; }
@keyframes gGull {
  0% { left: -20%; transform: translateY(-96px) rotate(0); }
  12% { transform: translateY(-108px) rotate(-4deg); }
  20% { transform: translateY(-94px) rotate(4deg); }
  26% { left: 46%; transform: translateY(-104px) rotate(0); }
  30% { left: 46%; transform: translateY(-116px) rotate(-25deg); }
  35% { left: 46%; transform: translateY(30px) rotate(160deg); }
  36%, 45% { left: 46%; transform: translateY(100px) rotate(170deg); }
  51% { left: 46%; transform: translateY(0) rotate(0); }
  62% { left: 46%; transform: translateY(0) rotate(0); }
  65% { transform: translateY(0) rotate(-10deg); }
  68% { transform: translateY(0) rotate(10deg); }
  71% { left: 46%; transform: translateY(0) rotate(0); }
  90%, 100% { left: 115%; transform: translateY(-112px) rotate(-6deg); }
}
@keyframes gBoot { 0%, 46% { opacity: 0; } 47%, 100% { opacity: 1; } }
@keyframes gSplash {
  0%, 33% { transform: scale(0); opacity: 0; }
  35% { transform: scale(1); opacity: 1; }
  41% { transform: scale(1.2) translateY(-6px); opacity: 0; }
  48% { transform: scale(0); opacity: 0; }
  50% { transform: scale(.75); opacity: 1; }
  56%, 100% { transform: scale(1); opacity: 0; }
}

/* 3. Kobe sails by in a bathtub, with a towel for a sail */
.g-tub { width: 170px; bottom: 4px; z-index: 3; animation-name: gTub; animation-duration: 16s; animation-timing-function: linear; }
.g-tub .bob { display: block; position: relative; animation: gBob 2.2s ease-in-out infinite; }
.g-tub .frog { position: absolute; width: 76px; left: 50px; top: -14px; }
.g-tub svg:last-of-type { position: relative; }
.gag-tub .g-bub { position: absolute; left: 76px; top: -10px; }
.gag-tub .g-bub i { animation: gBubT 2.4s ease-out infinite; }
.gag-tub .g-bub i:nth-child(2) { animation-delay: .8s; }
.gag-tub .g-bub i:nth-child(3) { animation-delay: 1.6s; }
@keyframes gTub { 0% { left: -40%; } 80%, 100% { left: 110%; } }
@keyframes gBob { 0%, 100% { transform: translateY(0) rotate(-2deg); } 50% { transform: translateY(-4px) rotate(2deg); } }
@keyframes gBubT { 0% { opacity: 0; transform: translateY(0); } 20% { opacity: 1; } 100% { opacity: 0; transform: translate(10px, -50px); } }

/* 4. a scary shark fin ... held up on a stick by a very small goldfish */
.g-shark { width: 90px; bottom: -70px; z-index: 3; animation-name: gShark; animation-duration: 13s; }
@keyframes gShark {
  0% { left: 110%; transform: none; }
  10% { transform: translateY(-4px); } 20% { transform: translateY(2px); } 30% { transform: translateY(-4px); }
  38%, 44% { left: 46%; transform: none; }
  49% { left: 46%; transform: translateY(-92px); }
  58% { left: 46%; transform: translateY(-92px) rotate(0); }
  61% { transform: translateY(-92px) rotate(-8deg); }
  64% { left: 46%; transform: translateY(-92px) rotate(0); }
  68% { left: 46%; transform: none; }
  84%, 100% { left: -25%; transform: none; }
}
@media (prefers-reduced-motion: reduce) { .scene.no-help .water > .gag { display: none; } }

/* ---------- keypad: the digit keys are little wooden planks (you build the bridge with them),
   delete and check are both green action buttons ---------- */
.pad button[data-k] { --k: #f2cf98; --kd: #c98f4e; color: #5a3a1e; box-shadow: 0 4px 0 var(--kd);
  background: linear-gradient(180deg, rgba(255, 255, 255, .25), rgba(255, 255, 255, 0) 45%), var(--k); }
.pad button[data-k]:active { box-shadow: 0 1px 0 var(--kd); }
.pad button[data-k="del"], .pad button[data-k="ok"] { --k: var(--leaf); --kd: var(--leaf-dark); color: #fff; background: var(--k); }
.pad button[data-k="del"] { --k: #f2665e; --kd: #c94a43; font-size: 1.35rem; }

/* the keypad sits on a dark wooden raft, like the raft in the river */
.pad-card { background:
    repeating-linear-gradient(0deg, transparent 0 30px, rgba(0, 0, 0, .10) 30px 33px),
    linear-gradient(180deg, #8a5a35, #74482a);
  box-shadow: 0 6px 0 #5a3820, var(--shadow); }

/* ---------- bridge list: colour per state + a tiny bridge that fills up with the stars ---------- */
.bridge-btn { --b: var(--soft); --bd: var(--soft-2); background: var(--b); box-shadow: 0 4px 0 var(--bd); }
.bridge-btn:active { box-shadow: 0 1px 0 var(--bd); }
.bridge-btn.started { --b: #f8e6c6; --bd: #e0bf8a; }
.bridge-btn.done { --b: #d6f2dd; --bd: #9fd8ae; }
.bridge-btn.next { --b: var(--sun); --bd: var(--sun-dark); }
.bridge-btn.locked { --b: var(--soft); opacity: .6; }
.bridge-btn .mini-bridge { width: 92px; height: 44px; flex: none; }
.bridge-btn .need { font-family: var(--font-display); font-weight: 600; font-size: .95rem; white-space: nowrap; background: #fff; border-radius: 999px; padding: 3px 10px; color: #b5651d; box-shadow: 0 2px 0 rgba(0,0,0,.08); }
.bridge-btn.locked .stars-sm { font-size: 1.2rem; }
.bridge-btn.next .stars-sm { color: #fff; text-shadow: 0 1px 0 rgba(0,0,0,.12); }
.bridge-btn.next .stars-sm .no { color: rgba(120, 80, 0, .22); text-shadow: none; }

/* ---------- phones in portrait: everything on one screen, keypad included (the scene is shrunk to fit by fitPlay in game.js) ---------- */
@media (orientation: portrait) and (max-height: 920px) {
  #app { padding-block: max(8px, env(safe-area-inset-top)) 8px; }
  .play, .play-main { gap: 8px; }
  .play .topbar .icon-btn { width: 42px; height: 42px; border-radius: 13px; }
  .play .topbar .who { font-size: 1.15rem; }
  .q-card { padding: 8px 12px 10px; gap: 4px; }
  .sum { font-size: clamp(2.3rem, 10vw, 3rem); }
  .prompt { min-height: 3.6em; }
  .sum.has-split { padding-bottom: 80px; }
  .split svg { width: 90px; height: 22px; }
  .split .boxes { gap: 16px; }
  .split .box { font-size: 1.8rem; }
  .question { font-size: 1.05rem; line-height: 1.25; }
  .feedback { font-size: 1.08rem; }
  .pad-card { padding: 8px; }
  .pad { gap: 7px; }
  .pad button { height: 50px; font-size: 1.7rem; }
  .pad button[data-k="del"] { font-size: 1.1rem; }
}
@media (orientation: portrait) and (max-height: 700px) {
  .pad button { height: 44px; font-size: 1.5rem; }
  .pad { gap: 6px; }
  .q-card { padding: 6px 10px 8px; }
  .step-label { font-size: .7rem; }
  .question { font-size: .98rem; }
}

/* ---------- online: login, pairing, family ---------- */
.family-bar { display: flex; justify-content: flex-end; }
.btn.small { padding: 6px 14px; font-size: 1rem; border-radius: 12px; }
a.btn { text-decoration: none; display: inline-block; }
.pill.small { font-size: .8rem; padding: 1px 8px; vertical-align: middle; }
.choice-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.choice { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 18px 14px; border: 0; border-radius: 18px; cursor: pointer;
  background: var(--soft); box-shadow: 0 4px 0 var(--soft-2); text-align: center; }
.choice:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--soft-2); }
.choice .ic { font-size: 2.4rem; line-height: 1; font-family: var(--emoji), var(--font-body); }
.choice b { font-family: var(--font-display); font-weight: 600; font-size: 1.3rem; }
.choice small { color: var(--muted); font-weight: 700; }
#loginEmail input[type="email"], #pairName { width: 100%; }
.code-input { font-family: var(--font-display); font-weight: 600; font-size: 2rem; letter-spacing: .18em; text-align: center; width: 100%; max-width: 320px; align-self: center; }
.pair-code { font-family: var(--font-display); font-weight: 700; font-size: clamp(2.6rem, 12vw, 4rem); letter-spacing: .12em; text-align: center;
  background: var(--sun); border-radius: 18px; padding: 10px 0; box-shadow: 0 4px 0 var(--sun-dark); }
.pair-steps { margin: 0; padding-left: 1.3em; display: grid; gap: 6px; }
.check a { color: var(--water-dark); font-weight: 700; }
.list { display: grid; gap: 8px; }
.list-row { display: flex; align-items: center; gap: 12px; background: var(--soft); border-radius: 14px; padding: 8px 12px; }
.list-row .ic { font-size: 1.6rem; width: 40px; text-align: center; flex: none; font-family: var(--emoji), var(--font-body); }
.list-row .ic.av { height: 40px; }
.list-row .tx { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.list-row .tx b { overflow: hidden; text-overflow: ellipsis; }
.list-row .tx small { color: var(--muted); font-size: .85rem; }
#deleteForm { flex-wrap: wrap; }
#deleteForm input { flex: 1 1 220px; min-width: 0; }
.panel > input { flex: none; }
