/* Momova slova - Momo's reading notebook (sister of Sudoku: same paper, ink and Momo).
   Everything a child taps is at least 56 px. Layouts: portrait (default), landscape-short (phones sideways), wide desktop (centred column). */

@font-face {
  font-family: 'Atkinson Hyperlegible Next';
  src: url('../assets/fonts/AtkinsonHyperlegibleNext-Variable.ttf') format('truetype');
  font-weight: 200 800; font-style: normal; font-display: swap;
}

:root {
  --paper: #FFFDF7; --grid: #DCE9F5; --desk: #F3EEE3;
  --ink: #1D2945; --blue: #2463D1; --pencil: #6B7489; --red: #E0453A;
  --hl: #FFE36E; --soft: #FFF6C7;
  --sun: #FFC23C; --sky: #6CBDE9; --leaf: #6CC070; --peach: #FF9E6D; --sakura: #FF8FB1; --grape: #A98BE0;
  --good: #DDF2DC; --good-line: #2E8B3E;
  --shadow: rgba(29, 41, 69, .28);
  --gutter: 14px; --tap: 56px;
  --font: 'Atkinson Hyperlegible Next', 'Segoe UI', Arial, sans-serif;
  --emoji: 'Segoe UI Emoji', 'Apple Color Emoji', 'Noto Color Emoji', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100dvh; color: var(--ink); font: 500 16px/1.4 var(--font); font-synthesis: none;
  background-color: var(--desk);
  background-image: linear-gradient(rgba(36, 99, 209, .07) 1px, transparent 1px), linear-gradient(90deg, rgba(36, 99, 209, .07) 1px, transparent 1px);
  background-size: 26px 26px;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation; overflow-x: hidden;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: default; }
svg { display: block; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { font-weight: 800; line-height: 1.15; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
[tabindex="-1"]:focus { outline: none; }
.screen { min-height: 100dvh; width: 100%; }

/* ---------- shared controls (every one at least 56 px) ---------- */
.ibtn {
  width: var(--tap); height: var(--tap); flex: none; display: grid; place-items: center; padding: 0; border: 0; border-radius: 12px;
  background: transparent; color: var(--ink);
}
.ibtn svg { width: 28px; height: 28px; }
.ibtn:active { background: rgba(29, 41, 69, .1); }
.ibtn[aria-pressed="false"] { color: var(--pencil); }
.ibtn.on-cover { background: rgba(255, 253, 247, .85); border: 2px solid var(--ink); border-radius: 50%; }
.ibtn.on-cover[aria-pressed="false"] { color: var(--ink); }
.ibtn.back { width: auto; min-width: var(--tap); padding: 0 12px 0 6px; display: inline-flex; align-items: center; gap: 2px; border-radius: 0; }
.ibtn.back .back-label { font-weight: 800; font-size: 16px; }

.pill {
  min-height: var(--tap); display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 0 18px;
  border: 2px solid var(--ink); border-radius: 28px; background: var(--paper); font-weight: 700; font-size: 16px; box-shadow: 0 2px 0 var(--shadow);
}
.pill svg { width: 22px; height: 22px; }
.pill.go { background: var(--sun); }
.pill.square { padding: 0; width: var(--tap); }
.pill.warn { border-color: var(--red); color: #A52A20; }
.pill:active { transform: translateY(2px); box-shadow: none; }
.pill.album { padding: 0 16px 0 12px; gap: 8px; white-space: nowrap; }
.pill.album svg { width: 26px; height: 26px; }

.chip { font-size: 13px; font-weight: 700; padding: 1px 9px; border: 1.5px solid var(--ink); border-radius: 10px; background: var(--soft); white-space: nowrap; }

.tag-btn {
  position: relative; width: 100%; min-height: 72px; display: flex; align-items: center; gap: 12px; padding: 8px 14px 8px 30px; text-align: left;
  border: 2.5px solid var(--ink); border-radius: 17px 13px 15px 14px / 14px 16px 13px 17px; background: var(--paper); box-shadow: 0 3px 0 var(--shadow);
}
.tag-btn::before { content: ''; position: absolute; left: 10px; top: 50%; width: 11px; height: 11px; margin-top: -5.5px; border-radius: 50%; background: var(--desk); border: 2px solid var(--ink); }
.tag-btn.primary { background: var(--sun); padding-left: 14px; }
.tag-btn.primary::before { display: none; }
.tag-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--shadow); }
.tag-icon { width: 44px; height: 44px; display: grid; place-items: center; flex: none; }
.tag-icon svg { width: 32px; height: 32px; }
.tag-thumb { flex: none; display: grid; place-items: center; }
.tag-thumb svg { width: 50px; height: 50px; }
.tag-text { flex: 1; min-width: 0; display: block; }
.tag-text b { display: block; font-size: 24px; font-weight: 800; line-height: 1.1; }
.tag-text small { display: block; font-size: 14px; font-weight: 600; opacity: .8; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tag-go svg { width: 28px; height: 28px; }

.pick-tag { position: absolute; top: -12px; left: 10px; z-index: 2; padding: 1px 10px; font-size: 13px; font-weight: 800; color: var(--ink); background: var(--hl); border: 2px solid var(--ink); border-radius: 9px; transform: rotate(-2deg); box-shadow: 0 2px 0 var(--shadow); white-space: nowrap; }

.star svg { width: 100%; height: 100%; fill: none; stroke: var(--ink); stroke-width: 1.8; }
.star.on svg { fill: var(--sun); }

/* ---------- top bar ---------- */
.topbar {
  display: flex; align-items: center; gap: 4px; height: 60px; padding: 0 6px 0 4px;
  background: var(--paper); border-bottom: 2.5px solid var(--ink);
}
.topbar-title { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; }
.topbar-title h1 { font-size: 20px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#screen-play .topbar-title h1 { white-space: normal; overflow: visible; font-size: 19px; line-height: 1.12; }
#album-count { font-size: 15px; padding: 2px 10px; background: var(--hl); font-variant-numeric: tabular-nums; }
@media (max-width: 400px) { #screen-play .ibtn.back .back-label { display: none; } #screen-play .ibtn.back { padding: 0 4px; } .topbar-title h1 { font-size: 18px; } }

/* ---------- cover ---------- */
#screen-cover { display: grid; place-items: center; padding: 12px; position: relative; overflow: hidden; grid-template-columns: minmax(0, 1fr); }
.notebook {
  --cover: #6CBDE9; --cover-dark: #3E97CC; --spine: 26px;
  position: relative; width: min(100%, 480px); min-width: 0; height: min(calc(100dvh - 24px), 740px); display: flex; flex-direction: column; gap: 10px;
  padding: 12px 16px 14px calc(var(--spine) + 14px); border: 3px solid var(--ink); border-radius: 10px 20px 20px 10px;
  background: var(--cover); box-shadow: 0 10px 0 -4px var(--shadow), 0 14px 26px rgba(29, 41, 69, .18);
}
.notebook::after { content: ''; position: absolute; inset: 7px 7px 7px calc(var(--spine) + 7px); border: 2px dashed rgba(255, 253, 247, .75); border-radius: 6px 14px 14px 6px; pointer-events: none; }
.cover-spine { position: absolute; left: 0; top: 0; bottom: 0; width: var(--spine); border-right: 3px solid var(--ink); border-radius: 7px 0 0 7px; background: var(--cover-dark); }
.cover-spine::after { content: ''; position: absolute; left: 50%; top: 14px; bottom: 14px; width: 0; border-left: 4px dotted var(--paper); transform: translateX(-50%); }
.cover-top { position: relative; z-index: 1; display: flex; justify-content: flex-end; align-items: center; gap: 8px; }
.cover-top .pill.album { margin-right: auto; }
.cover-window { flex: 1; min-height: 70px; padding: 6px; background: var(--paper); border: 3px solid var(--ink); border-radius: 12px; overflow: hidden; }
.cover-art, .cover-art svg { width: 100%; height: 100%; }
.cover-title { text-align: center; line-height: 0; }
.cover-lettering svg { height: clamp(44px, 9dvh, 76px); width: auto; max-width: 100%; margin: 0 auto; }
.cover-actions { position: relative; z-index: 1; display: flex; flex-direction: column; gap: 10px; }
.tag-btn.resume { min-height: 64px; padding: 6px 12px; }
.tag-btn.resume::before { display: none; }
.tag-btn.resume .tag-text b { font-size: 21px; }
.tag-btn.resume .tag-thumb svg { width: 44px; height: 44px; }
.cover-main { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.big-btn {
  position: relative; min-height: 118px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 12px 6px 10px; text-align: center;
  border: 2.5px solid var(--ink); border-radius: 19px 16px 18px 15px / 16px 19px 15px 18px; background: #DDF0FB; box-shadow: 0 4px 0 var(--shadow);
}
.big-btn.go { background: var(--sun); }
.big-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--shadow); }
.big-btn .big-ico svg { width: 46px; height: 46px; }
.big-btn b { font-size: 22px; font-weight: 800; line-height: 1.1; text-wrap: balance; }

.desk-doodles { position: absolute; inset: 0; pointer-events: none; display: none; }
.dd { position: absolute; width: 90px; opacity: .9; }
.dd-sun { left: 8%; top: 12%; transform: rotate(-8deg); } .dd-cloud { right: 9%; top: 9%; width: 120px; }
.dd-flower { left: 12%; bottom: 10%; width: 100px; } .dd-star { right: 12%; bottom: 14%; transform: rotate(10deg); }

/* ---------- Igre ---------- */
#screen-igre, #screen-album { display: flex; flex-direction: column; }
.igre-body {
  width: min(100%, 560px); margin: 0 auto; padding: 22px var(--gutter) 30px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 14px; align-content: center; flex: 1;
}
.game-card {
  position: relative; min-height: 150px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 14px 8px 10px; text-align: center;
  border: 2.5px solid var(--ink); border-radius: 18px 14px 17px 15px / 15px 18px 14px 17px; background: var(--paper); box-shadow: 0 4px 0 var(--shadow);
}
.game-card:nth-child(6n+1) { background: #E8F6E6; } .game-card:nth-child(6n+2) { background: #FFF3CC; } .game-card:nth-child(6n+3) { background: #DDF0FB; }
.game-card:nth-child(6n+4) { background: #FFE9DE; } .game-card:nth-child(6n+5) { background: #F1EAFB; } .game-card:nth-child(6n+6) { background: #FFE7EF; }
.game-card:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--shadow); }
.gc-art svg { width: 62px; height: 62px; }
.gc-name { font-size: 19px; font-weight: 800; line-height: 1.12; text-wrap: balance; }
.gc-stars { display: flex; gap: 3px; }
.gc-stars .star { width: 24px; height: 24px; }
.igre-body .pick-tag { left: 50%; top: -13px; transform: translateX(-50%) rotate(-2deg); }

/* ---------- play ---------- */
#screen-play { height: 100dvh; min-height: 0; display: flex; flex-direction: column; overflow-y: auto; overflow-x: hidden; --pic: clamp(120px, min(54vw, 31dvh), 300px); }
.dots { display: flex; justify-content: center; align-items: center; gap: 12px; padding: 9px 0 3px; min-height: 30px; }
.dot { width: 16px; height: 16px; border-radius: 50%; border: 2.5px solid var(--ink); background: var(--paper); }
.dot.done { background: var(--leaf); }
.dot.done.star { background: var(--sun); }
.dot.cur { width: 20px; height: 20px; background: var(--hl); box-shadow: 0 0 0 3px var(--paper), 0 0 0 5px var(--ink); margin: 0 2px; }
.stage { flex: 1 0 auto; width: min(100%, 640px); margin: 0 auto; display: flex; flex-direction: column; align-items: stretch; padding: 4px var(--gutter) 14px; gap: 6px; }
.margin { order: -1; flex: none; }
.momo-row { position: relative; display: flex; align-items: flex-end; gap: 10px; }
.momo-btn { width: 92px; height: 92px; flex: none; padding: 0; border: 0; background: none; border-radius: 50%; transform-origin: 50% 90%; }
.momo-btn svg { width: 100%; height: 100%; overflow: visible; }
.momo-btn svg, .momo-btn svg * { pointer-events: none; }
.momo-btn[data-state="idle"] { animation: bob 3.2s ease-in-out infinite; }
.momo-btn.speaking { animation: nod .5s ease-in-out infinite; }
.momo-btn[data-state="cheer"] { animation: hop .45s ease-out 3; }
.momo-btn[data-state="surprised"] { animation: shake .35s ease-out 1; }
.momo-btn[data-state="wave"] { animation: hop .4s ease-out 1; }
.momo-btn[data-state="sleep"] { animation: breathe 3.6s ease-in-out infinite; }
.momo-btn[data-state="idle"] .momo-tail { transform-box: fill-box; transform-origin: 85% 85%; animation: wag 2.6s ease-in-out infinite; }
.momo-btn[data-state="idle"] .momo-eyes { transform-box: fill-box; transform-origin: 50% 50%; animation: blink 4.5s infinite; }
.bubble {
  position: relative; flex: 1; min-width: 0; padding: 8px 12px; background: var(--paper); border: 2.5px solid var(--ink); border-radius: 14px; box-shadow: 0 3px 0 var(--shadow);
  display: flex; flex-direction: column; gap: 6px; margin-bottom: 4px;
}
.bubble::before { content: ''; position: absolute; left: -9px; bottom: 18px; width: 14px; height: 14px; background: var(--paper); border-left: 2.5px solid var(--ink); border-bottom: 2.5px solid var(--ink); transform: rotate(45deg); }
.bubble-text { font-size: clamp(17px, 2.4dvh, 20px); font-weight: 700; line-height: 1.3; min-height: 22px; overflow-wrap: anywhere; }
.bubble-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.bubble-actions .pill { font-size: 15px; padding: 0 14px; }
.pill.speak { background: var(--hl); }
.pill.speak svg { width: 26px; height: 26px; }

.play-main { flex: 1 0 auto; display: flex; flex-direction: column; justify-content: center; }
.play-zone { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.play-zone.demoing { cursor: default; }
.zone { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 12px; min-width: 0; }

/* pictures: a real picture or a soft placeholder card (emoji, or a neutral pencil question mark) */
.pic { position: relative; display: block; width: 100%; aspect-ratio: 1; container-type: inline-size; border-radius: 14px; overflow: hidden; background: var(--soft); }
.pic img { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }
.pic .ph { display: grid; place-items: center; width: 100%; height: 100%; background: radial-gradient(circle at 50% 40%, #FFFBE6, var(--soft)); }
.pic .emo { font-family: var(--emoji); font-size: 56cqw; line-height: 1; }
.pic .ph.blank { color: #B8A98E; }
.pic .ph.blank svg { width: 56%; height: 56%; }
.pic-block { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.pic-btn { position: relative; width: var(--pic); padding: 5px; border: 3px solid var(--ink); border-radius: 20px; background: var(--paper); box-shadow: 0 4px 0 var(--shadow); }
.pic-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--shadow); }
.pic-ear { position: absolute; right: -10px; bottom: -10px; width: 44px; height: 44px; display: grid; place-items: center; border: 2.5px solid var(--ink); border-radius: 50%; background: var(--hl); }
.pic-ear svg { width: 24px; height: 24px; }
.pic-word { min-height: 38px; font-size: 30px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; opacity: 0; transform: translateY(4px); }
.pic-word.on { opacity: 1; transform: none; animation: rise .3s ease-out; }

.listen-block, .mm-top { display: flex; align-items: center; justify-content: center; gap: 14px; }
.listen { width: 72px; height: 72px; display: grid; place-items: center; padding: 0; border: 3px solid var(--ink); border-radius: 50%; background: var(--sun); box-shadow: 0 4px 0 var(--shadow); }
.listen svg { width: 36px; height: 36px; }
.listen:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--shadow); }
.sound-boxes { display: flex; gap: 8px; }
.sb { width: 34px; height: 34px; border: 3px solid var(--ink); border-radius: 9px; background: var(--paper); transition: background .12s; }
.sb.on { background: var(--sun); transform: translateY(-4px); }
.sb.all { background: var(--leaf); }

/* choices (Prvi glas, Momo mrmlja) */
.choices { width: 100%; display: grid; gap: 12px; justify-content: center; }
.choices.n3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.choices.n4 { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 320px; margin: 0 auto; }
.choices.n2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.letter-tile, .pic-tile {
  position: relative; min-width: 0; padding: 6px; border: 3px solid var(--ink); border-radius: 18px 15px 17px 16px / 16px 18px 15px 17px; background: var(--paper); box-shadow: 0 4px 0 var(--shadow);
}
.letter-tile { min-height: 104px; display: grid; place-items: center; }
.letter-tile .lt { font-size: 60px; font-weight: 800; line-height: 1; letter-spacing: .02em; }
.pic-tile { aspect-ratio: 1; }
.pic-tile .pic { height: 100%; border-radius: 12px; }
.letter-tile:active, .pic-tile:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--shadow); }

/* Lupkaj slogove */
.paws { min-height: 52px; display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 6px; }
.pawc { display: block; width: 44px; height: 44px; padding: 3px; border-radius: 50%; }
.paw { width: 100%; height: 100%; fill: var(--ink); }
.pawc.pop { animation: pop .22s ease-out; }
.pawc.ghost { opacity: .3; }
.pawc.ghost .paw { fill: var(--pencil); }
.pawc.glow { background: var(--soft); }
.drum-row { width: 100%; display: flex; align-items: center; justify-content: center; gap: 14px; }
.drum {
  flex: 1 1 auto; max-width: 250px; min-height: 104px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 8px 14px;
  border: 3px solid var(--ink); border-radius: 50% / 38%; background: var(--sun); box-shadow: 0 5px 0 var(--shadow);
}
.drum svg { width: 46px; height: 46px; }
.drum span { font-size: 22px; font-weight: 800; }
.drum:active, .drum.hit { transform: translateY(4px) scale(.97); box-shadow: 0 1px 0 var(--shadow); }
.drum-side { display: flex; flex-direction: column; gap: 10px; }
.drum-side .pill:disabled { opacity: .45; box-shadow: none; }

/* chips of syllables */
.chips { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 6px; min-height: 8px; }
.chips i { font-style: normal; font-weight: 800; color: var(--pencil); }
.chips .chip { font-size: 24px; font-weight: 800; padding: 3px 14px; border-width: 2.5px; border-radius: 14px; background: var(--paper); }
.chips .chip.on { background: var(--hl); transform: translateY(-3px); }
.chips:empty { display: none; }

/* Gdje je glas? */
.target-chip { min-height: 64px; display: inline-flex; align-items: center; gap: 10px; padding: 0 22px 0 16px; border: 3px solid var(--ink); border-radius: 32px; background: var(--hl); box-shadow: 0 4px 0 var(--shadow); }
.target-chip svg { width: 28px; height: 28px; }
.target-chip b { font-size: 40px; font-weight: 800; line-height: 1; }
.train { width: 100%; display: flex; gap: 6px; align-items: flex-end; }
.wagon { position: relative; flex: 1 1 0; min-width: 0; min-height: 96px; display: flex; flex-direction: column; align-items: center; gap: 0; padding: 4px 2px 6px; border: 3px solid transparent; border-radius: 16px; background: transparent; }
.wagon svg { width: 100%; height: auto; overflow: visible; }
.wagon small { font-size: 18px; font-weight: 800; }
.wagon .body { fill: var(--sky); stroke: var(--ink); stroke-width: 3; }
.wagon .body2 { fill: var(--peach); stroke: var(--ink); stroke-width: 3; }
.wagon .wheel { fill: var(--ink); }
.wagon .slat { fill: none; stroke: var(--ink); stroke-width: 2.5; opacity: .5; }
.wagon .smoke { fill: none; stroke: var(--pencil); stroke-width: 3; stroke-linecap: round; }
.wagon.w1 .body { fill: #A8DFAE; } .wagon.w2 .body { fill: #FFD98A; }
.wagon:active { transform: translateY(3px); }
/* A word never breaks inside its tiles: --k tiles per row (one row up to 6 letters, otherwise two balanced rows), sized to fit. */
.boxes, .slots { width: 100%; container-type: inline-size; --k: 5; --cell: calc((100cqw - 8px * (var(--k) - 1)) / var(--k)); }
.boxes { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.lbox { flex: 0 0 min(64px, var(--cell)); min-width: 0; min-height: 80px; padding: 0; display: grid; place-items: center; border: 3px solid var(--ink); border-radius: 14px; background: var(--paper); box-shadow: 0 4px 0 var(--shadow); }
.lbox b { font-size: min(42px, calc(var(--cell) * .62)); font-weight: 800; line-height: 1; }
.lbox:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--shadow); }

/* Složi slogove, Složi riječ */
.slots { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.slot {
  flex: 0 0 min(96px, var(--cell)); min-width: 0; min-height: 76px; padding: 0 2px; display: grid; place-items: center; border: 3px dashed var(--pencil); border-radius: 14px; background: rgba(255, 253, 247, .6);
  font-size: min(30px, calc(var(--cell) * .3)); font-weight: 800; line-height: 1; color: var(--ink);
}
.slots.letters .slot { flex-basis: min(64px, var(--cell)); min-height: 76px; padding: 0; font-size: min(40px, calc(var(--cell) * .62)); }
.slot.filled { border-style: solid; background: var(--paper); box-shadow: 0 3px 0 var(--shadow); }
.slot.fixed { border-style: solid; border-color: var(--pencil); background: #EFEBDD; color: var(--ink); }
.slot:disabled { opacity: 1; color: var(--ink); }
.bank { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.tile {
  min-width: 68px; min-height: 68px; padding: 0 18px; display: grid; place-items: center; border: 3px solid var(--ink); border-radius: 16px 14px 15px 14px / 14px 16px 14px 15px; background: var(--sun);
  box-shadow: 0 4px 0 var(--shadow); font-size: 30px; font-weight: 800; line-height: 1;
}
.bank.letters .tile { min-width: 60px; padding: 0 8px; font-size: 38px; }
.tile:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--shadow); }
.tile.gone { background: transparent; border: 3px dotted rgba(107, 116, 137, .4); box-shadow: none; }

/* long words (two rows of boxes or slots): a smaller picture and lower tiles so the screen does not scroll */
.play-zone.dense .pic-btn { width: calc(var(--pic) * .78); }
.play-zone.dense .slot, .play-zone.dense .slots.letters .slot, .play-zone.dense .tile, .play-zone.dense .bank.letters .tile { min-height: 58px; }
.play-zone.dense .lbox { min-height: 60px; }

/* states */
.right { background: var(--good) !important; border-color: var(--good-line) !important; }
.pop { animation: pop .3s ease-out; }
.wiggle { animation: wiggle .45s ease-in-out; }
.glow { box-shadow: 0 0 0 4px var(--sun), 0 0 16px 5px rgba(255, 194, 60, .85) !important; animation: glowPulse 1.1s ease-in-out infinite; }
.demo-press { transform: scale(.92) !important; outline: 4px solid var(--hl); outline-offset: 2px; }
.tile.gone.glow { box-shadow: none !important; }

/* ---------- end of a round ---------- */
.round-end { flex: 1; display: flex; align-items: center; justify-content: center; padding: 6px 0; }
.re-card { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 14px 16px; border: 3px solid var(--ink); border-radius: 20px; background: var(--paper); box-shadow: 0 5px 0 var(--shadow); }
.re-momo { width: 96px; height: 96px; }
.re-momo svg { width: 100%; height: 100%; overflow: visible; }
.re-card[data-stars="3"] .re-momo { animation: hop .45s ease-out 3; }
.re-body { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }
.re-title { font-size: 34px; color: var(--red); transform: rotate(-2deg); }
.re-stars { display: flex; gap: 8px; }
.re-stars .star { width: 56px; height: 56px; }
.re-stars .star.on { animation: starPop .5s cubic-bezier(.2, .9, .3, 1.3) both; animation-delay: calc(var(--i) * .25s + .15s); }
.re-line { font-size: 20px; font-weight: 700; }
.re-change { font-size: 17px; font-weight: 700; color: var(--pencil); }
.re-new { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.re-box { position: relative; width: 120px; height: 84px; display: grid; place-items: end center; }
.box-ico svg { width: 56px; height: 56px; }
.plus { position: absolute; right: 8px; bottom: 2px; padding: 0 8px; border: 2px solid var(--ink); border-radius: 12px; background: var(--hl); font-size: 18px; font-weight: 800; animation: pop .4s ease-out 1.2s both; }
.fly { position: absolute; left: 50%; top: 0; width: 44px; height: 44px; margin-left: -22px; opacity: 0; animation: flyIn 1s ease-in var(--d, .9s) both; }
.fly .pic { border-radius: 8px; border: 2px solid var(--ink); }
.re-newtext { font-size: 17px; font-weight: 700; }
.re-words { font-size: 20px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; overflow-wrap: anywhere; }
.re-actions { width: 100%; display: flex; flex-direction: column; gap: 10px; margin-top: 6px; }
.re-actions .pill { align-self: center; }

/* ---------- Album ---------- */
.album-body { width: min(100%, 720px); margin: 0 auto; padding: 14px var(--gutter) 150px; display: flex; flex-direction: column; gap: 18px; }
.album-group { padding: 10px; border: 2.5px solid var(--ink); border-radius: 14px; background: var(--paper); box-shadow: 0 4px 0 var(--shadow); }
.ag-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.ag-head h2 { font-size: 20px; }
.ag-head .chip { font-size: 15px; font-variant-numeric: tabular-nums; background: var(--hl); }
.ag-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(68px, 1fr)); gap: 8px; }
.wtile { position: relative; min-width: 56px; min-height: 56px; aspect-ratio: 1; padding: 3px; border: 2.5px solid var(--ink); border-radius: 12px; background: var(--paper); overflow: hidden; }
.wtile .pic { border-radius: 8px; height: 100%; }
.wtile.locked { border-style: dashed; border-color: var(--pencil); background: #F4F1E8; }
.wtile.locked .pic { filter: brightness(0) opacity(.1); }
.wtile.sel { box-shadow: 0 0 0 3px var(--sun); }
.wt-word { position: absolute; left: 0; right: 0; bottom: 0; padding: 1px 2px; background: rgba(255, 253, 247, .92); font-size: 10.5px; font-weight: 800; line-height: 1.2; text-align: center; text-transform: uppercase; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.album-detail {
  position: fixed; left: 50%; bottom: 0; z-index: 20; width: min(100%, 640px); transform: translateX(-50%); display: flex; align-items: center; gap: 14px; padding: 10px 16px calc(12px + env(safe-area-inset-bottom));
  border: 3px solid var(--ink); border-bottom: 0; border-radius: 18px 18px 0 0; background: var(--paper); box-shadow: 0 -6px 20px rgba(29, 41, 69, .2);
}
.ad-pic { width: 88px; flex: none; border: 2.5px solid var(--ink); border-radius: 14px; overflow: hidden; }
.ad-pic.locked .pic { filter: brightness(0) opacity(.12); }
.ad-text { min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.ad-text > b { font-size: 28px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; overflow-wrap: anywhere; line-height: 1.1; }
.ad-text .chips { justify-content: flex-start; }

/* ---------- sheets (settings) ---------- */
dialog.sheet {
  width: 100%; max-width: 520px; max-height: 92dvh; margin: auto auto 0; padding: 0; overflow: auto; color: var(--ink);
  border: 3px solid var(--ink); border-bottom: 0; border-radius: 20px 20px 0 0; background: var(--paper); box-shadow: 0 -6px 30px rgba(29, 41, 69, .3);
}
dialog.sheet[open] { animation: rise .28s ease-out; }
dialog.sheet::backdrop { background: rgba(29, 41, 69, .5); }
.sheet-body { padding: 14px 16px calc(20px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 14px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; }
.sheet-head h2 { font-size: 22px; }
.switches { display: flex; flex-direction: column; gap: 8px; }
.switch { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 60px; padding: 4px 12px; text-align: left; border: 2px solid var(--ink); border-radius: 12px; background: var(--paper); }
.switch .ico svg { width: 28px; height: 28px; }
.switch .lbl { flex: 1; font-weight: 800; font-size: 18px; }
.switch .lbl small { display: block; font-size: 12px; font-weight: 600; color: var(--pencil); }
.switch:disabled { opacity: .65; cursor: default; }
.knob { position: relative; width: 50px; height: 30px; border-radius: 15px; border: 2px solid var(--ink); background: #CDD3DF; flex: none; }
.knob i { position: absolute; top: 2px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--paper); border: 2px solid var(--ink); transition: transform .15s; }
.switch[aria-checked="true"] .knob { background: var(--leaf); }
.switch[aria-checked="true"] .knob i { transform: translateX(19px); }
.parents { margin-top: 4px; border-top: 2px dashed var(--pencil); padding-top: 4px; }
.parents > summary { min-height: var(--tap); display: flex; align-items: center; font-weight: 800; font-size: 18px; cursor: pointer; list-style: none; }
.parents > summary::-webkit-details-marker { display: none; }
.parents > summary::after { content: ''; width: 10px; height: 10px; margin: -4px 6px 0 auto; border-right: 3px solid var(--ink); border-bottom: 3px solid var(--ink); transform: rotate(45deg); transition: transform .15s; }
.parents[open] > summary::after { margin-top: 4px; transform: rotate(-135deg); }
.parents-body { display: flex; flex-direction: column; gap: 14px; padding-bottom: 6px; }
.pick-label { font-weight: 800; font-size: 14px; color: var(--pencil); margin-bottom: 4px; }
.parent-lines { margin: 0 0 8px; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; font-weight: 500; font-size: 15px; }
.parent-lines b { font-weight: 800; }
.parent-lines .lvl { color: var(--pencil); }
.note { font-size: 14px; font-weight: 600; color: var(--pencil); }
.danger .pill { width: 100%; justify-content: center; text-align: center; min-height: var(--tap); }
.danger .pill.armed { background: #FDE3DF; }
.danger .note { margin-top: 8px; visibility: hidden; min-height: 2.8em; }
.danger .note.on { visibility: visible; }
.version { text-align: center; font-size: 12px; color: var(--pencil); }
.update-banner { position: fixed; left: 50%; bottom: calc(12px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 50; display: flex; align-items: center; gap: 10px; padding: 6px 8px 6px 14px; border: 2px solid var(--ink); border-radius: 14px; background: var(--soft); box-shadow: 0 4px 0 var(--shadow); font-weight: 700; max-width: calc(100vw - 24px); }
.update-banner small { display: block; font-weight: 600; font-size: 12px; }

/* ---------- motion ---------- */
@keyframes wag { 0%, 100% { transform: rotate(0); } 50% { transform: rotate(7deg); } }
@keyframes blink { 0%, 92%, 100% { transform: scaleY(1); } 96% { transform: scaleY(.1); } }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }
@keyframes nod { 0%, 100% { transform: rotate(0); } 50% { transform: rotate(-4deg) translateY(-2px); } }
@keyframes hop { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
@keyframes wiggle { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-6px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(4px); } }
@keyframes pop { 0% { transform: scale(.6); } 70% { transform: scale(1.12); } 100% { transform: scale(1); } }
@keyframes breathe { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.03, .97); } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes rise { from { transform: translateY(26px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes glowPulse { 0%, 100% { filter: none; } 50% { filter: brightness(1.06); } }
@keyframes starPop { 0% { transform: scale(0) rotate(-40deg); } 70% { transform: scale(1.25) rotate(8deg); } 100% { transform: scale(1); } }
@keyframes flyIn { 0% { opacity: 0; transform: translate(var(--x, 0), -30px) scale(1); } 15% { opacity: 1; } 100% { opacity: 0; transform: translate(0, 42px) scale(.25); } }
body.no-motion *, body.no-motion *::before, body.no-motion *::after, body.fast-mode *, body.fast-mode *::before, body.fast-mode *::after { animation: none !important; transition: none !important; }
body.no-motion .fly, body.fast-mode .fly { display: none; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; } .fly { display: none; } }

/* ---------- small phones (360 x 640) ---------- */
@media (max-width: 374px) {
  :root { --gutter: 10px; }
  .big-btn b { font-size: 20px; } .big-btn .big-ico svg { width: 40px; height: 40px; }
  .gc-name { font-size: 17px; }
}
@media (max-height: 700px) and (orientation: portrait) {
  #screen-play { --pic: clamp(104px, min(40vw, 24dvh), 200px); }
  .slot, .slots.letters .slot { min-height: 58px; } .tile, .bank.letters .tile { min-height: 58px; } .lbox { min-height: 60px; } .boxes, .slots, .bank { gap: 6px; }
  .momo-btn { width: 60px; height: 60px; }
  .bubble { padding: 6px 10px; }
  .bubble-text { font-size: 16px; }
  .letter-tile { min-height: 92px; } .letter-tile .lt { font-size: 52px; }
  .drum { min-height: 88px; }
  .pic-word { min-height: 32px; font-size: 26px; }
  .re-momo { width: 72px; height: 72px; } .re-title { font-size: 28px; } .re-stars .star { width: 46px; height: 46px; }
  .tag-btn { min-height: 64px; }
  .game-card { min-height: 128px; } .gc-art svg { width: 52px; height: 52px; }
}

/* ---------- wide windows (desktop): a centred column, larger picture ---------- */
@media (min-width: 700px) {
  .desk-doodles { display: block; }
  dialog.sheet { margin: auto; border-bottom: 3px solid var(--ink); border-radius: 20px; }
  .notebook { width: min(100%, 460px); }
  .igre-body { width: min(100%, 860px); grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 700px) and (min-height: 700px) {
  #screen-play { --pic: clamp(200px, 32dvh, 300px); }
  .notebook { width: min(100%, calc((100dvh - 48px) * .64), 640px); height: min(calc(100dvh - 48px), 960px); }
  .momo-btn { width: 112px; height: 112px; }
  .bubble-text { font-size: 21px; }
  .stage { gap: 10px; }
  .game-card { min-height: 190px; } .gc-art svg { width: 76px; height: 76px; } .gc-name { font-size: 22px; }
  .letter-tile { min-height: 124px; } .letter-tile .lt { font-size: 72px; }
  .choices.n3 { gap: 18px; }
  .tile { min-width: 76px; min-height: 76px; font-size: 34px; } .bank.letters .tile { min-width: 68px; font-size: 42px; }
  .ag-grid { grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); }
  .igre-body { padding-top: 30px; gap: 24px 18px; }
}

/* short desktop windows (1280 x 720, laptops): everything must still fit without scrolling */
@media (min-width: 700px) and (min-height: 700px) and (max-height: 860px) {
  #screen-play { --pic: clamp(140px, 24dvh, 240px); }
  .momo-btn { width: 88px; height: 88px; }
  .stage { gap: 6px; padding-bottom: 8px; }
  .bubble-text { font-size: 19px; }
  .letter-tile { min-height: 104px; } .letter-tile .lt { font-size: 60px; }
}

/* ---------- phones sideways (844 x 390): Momo left, the game right ---------- */
@media (orientation: landscape) and (max-height: 520px) {
  .topbar { height: 56px; }
  #screen-cover { padding: 8px; }
  .notebook { width: min(100%, 800px); height: calc(100dvh - 16px); display: grid; grid-template-columns: 1fr 1.1fr; grid-template-rows: auto auto auto 1fr auto; column-gap: 16px; row-gap: 7px; padding: 8px 14px 10px calc(var(--spine) + 12px); align-content: stretch; }
  .cover-top { grid-column: 2; grid-row: 1; }
  .cover-window { grid-column: 1; grid-row: 1 / span 4; min-height: 0; aspect-ratio: 320 / 220; align-self: center; }
  .cover-title { grid-column: 1; grid-row: 5; align-self: center; }
  .cover-lettering svg { height: clamp(36px, 12dvh, 56px); }
  .cover-actions { grid-column: 2; grid-row: 2 / span 3; align-self: center; gap: 8px; }
  .tag-btn.resume { min-height: 58px; }
  .big-btn { min-height: 76px; flex-direction: row; gap: 8px; padding: 8px 6px; }
  .big-btn .big-ico svg { width: 34px; height: 34px; }
  .big-btn b { font-size: 19px; }
  .desk-doodles { display: none; }
  .igre-body { width: min(100%, 900px); grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px 12px; padding: 14px var(--gutter) 14px; }
  .game-card { min-height: 132px; padding: 10px 6px 8px; gap: 4px; } .gc-art svg { width: 48px; height: 48px; } .gc-name { font-size: 17px; }
  #screen-play { --pic: min(38dvh, 150px); }
  .dots { padding: 4px 0 0; min-height: 24px; }
  .stage { width: min(100%, 900px); display: grid; grid-template-columns: 250px minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); column-gap: 14px; align-items: center; padding: 2px var(--gutter) 8px; }
  .margin { order: 0; grid-column: 1; grid-row: 1; }
  .play-main { grid-column: 2; grid-row: 1; flex: none; }
  .round-end { grid-column: 1 / -1; grid-row: 1; }
  .momo-row { flex-direction: column; align-items: center; gap: 12px; }
  .momo-btn { width: 76px; height: 76px; }
  .bubble { width: 100%; flex: none; padding: 6px 10px; margin-bottom: 0; }
  .bubble::before { left: 50%; bottom: auto; top: -9px; margin-left: -7px; transform: rotate(135deg); }
  .bubble-text { font-size: 16px; line-height: 1.25; }
  .play-zone { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; column-gap: 16px; row-gap: 6px; }
  .play-zone.game-mrmlja { grid-template-columns: minmax(0, 1fr); }
  .pic-block, .listen-block { grid-column: 1; }
  .play-zone > .zone { grid-column: 2; }
  .play-zone.game-mrmlja > .zone, .play-zone.game-mrmlja > .mm-top { grid-column: 1; }
  .pic-word { min-height: 30px; font-size: 24px; }
  .zone { gap: 8px; }
  .letter-tile { min-height: 84px; } .letter-tile .lt { font-size: 46px; }
  .choices.n4 { grid-template-columns: repeat(4, minmax(0, 1fr)); max-width: none; }
  .game-mrmlja .pic-tile { max-width: 100px; margin: 0 auto; width: 100%; }
  .slot { min-height: 64px; font-size: min(26px, calc(var(--cell) * .3)); } .slots.letters .slot { min-height: 64px; font-size: min(34px, calc(var(--cell) * .62)); }
  .tile { min-width: 60px; min-height: 60px; font-size: 26px; } .bank.letters .tile { min-width: 56px; font-size: 32px; }
  .lbox { min-height: 68px; } .lbox b { font-size: min(36px, calc(var(--cell) * .62)); }
  .drum { min-height: 84px; }
  .paws { min-height: 46px; } .pawc { width: 38px; height: 38px; }
  .target-chip { min-height: 56px; } .target-chip b { font-size: 34px; }
  .wagon { min-height: 78px; } .wagon small { font-size: 16px; }
  dialog.sheet { max-height: 96dvh; max-width: 640px; }
  .re-card { display: grid; grid-template-columns: 110px minmax(0, 1fr); align-items: center; column-gap: 14px; padding: 10px 14px; }
  .re-momo { width: 100px; height: 100px; }
  .re-body { flex-direction: row; flex-wrap: wrap; justify-content: center; align-items: center; column-gap: 18px; row-gap: 4px; }
  .re-line { flex-basis: 100%; }
  .re-new { flex-basis: 100%; flex-direction: row; justify-content: center; align-items: center; column-gap: 12px; flex-wrap: wrap; }
  .re-new .re-newtext, .re-new .re-words { flex: 0 1 auto; }
  .re-box { width: 70px; height: 52px; }
  .re-actions { flex-basis: 100%; }
  .re-title { font-size: 26px; } .re-stars .star { width: 40px; height: 40px; } .re-line { font-size: 17px; }
  .box-ico svg { width: 44px; height: 44px; }
  .re-actions { flex-direction: row; flex-wrap: wrap; margin-top: 2px; gap: 8px; }
  .re-actions .tag-btn { width: auto; flex: 1 1 0; min-height: 58px; padding-right: 10px; } .re-actions .tag-btn .tag-text b { font-size: 19px; }
  .album-detail { padding-top: 6px; padding-bottom: 8px; } .ad-pic { width: 64px; } .ad-text > b { font-size: 22px; }
}
