/* Sudoku v2 - Momo's drawing notebook.
   Two worlds: the board, digits and pad are print-clean; everything around them is drawn. */

@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; --grid-major: #C5DBEE; --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;
  --line: #B7CFE6; --line-major: #5B82B0;
  --peer: #FFF6C7; --same: #D3ECFA; --conflict: #FCDDD8;
  --shadow: rgba(29, 41, 69, .28);
  /* digit colours (Boje brojeva): dark crayon hues, never red or orange (red is the teacher's pen) */
  --c1: #1D5FBF; --c2: #26692A; --c3: #6D3FC0; --c4: #0B6B63; --c5: #6B4423; --c6: #0B6A96; --c7: #9D2F8F; --c8: #765B00; --c9: #475569;
  --gutter: 14px;
  --font: 'Atkinson Hyperlegible Next', 'Segoe UI', Arial, 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%; }
.digit { font-variant-numeric: lining-nums; font-feature-settings: 'lnum'; }

/* ---------- shared controls ---------- */
.ibtn {
  width: 44px; height: 44px; flex: none; display: grid; place-items: center; padding: 0; border: 0; border-radius: 12px;
  background: transparent; color: var(--ink);
}
.ibtn svg { width: 26px; height: 26px; }
.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); }

.pill {
  min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 0 16px;
  border: 2px solid var(--ink); border-radius: 22px; background: var(--paper); font-weight: 700; font-size: 16px; box-shadow: 0 2px 0 var(--shadow);
}
.pill svg { width: 20px; height: 20px; }
.pill.go { background: var(--sun); }
.pill.square { padding: 0; width: 44px; }
.pill.warn { border-color: var(--red); color: #A52A20; }
.pill:active { transform: translateY(2px); box-shadow: none; }

.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: 34px; height: 34px; }
.tag-thumb { flex: none; display: grid; place-items: center; }
.tag-thumb .mini { width: 52px; height: 52px; border: 2px solid var(--ink); }
.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; }

/* ---------- top bar ---------- */
.topbar {
  display: flex; align-items: center; gap: 4px; height: 56px; 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; }
.timer { font-weight: 800; font-variant-numeric: tabular-nums; font-size: 16px; padding: 0 6px; }

/* ---------- cover ---------- */
#screen-cover { display: grid; place-items: center; padding: 12px; position: relative; overflow: hidden; }
.notebook {
  --cover: #6CBDE9; --cover-dark: #3E97CC; --spine: 26px;
  position: relative; width: min(100%, 480px); 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; }
.notebook[data-profile="little"] { --cover: #FFC23C; --cover-dark: #E0A000; }
.notebook[data-profile="young"] { --cover: #6CBDE9; --cover-dark: #3E97CC; }
.notebook[data-profile="grown"] { --cover: #CDB68C; --cover-dark: #2B3A67; }
.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 { display: flex; justify-content: flex-end; align-items: center; gap: 8px; }
.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-label {
  align-self: center; display: flex; align-items: baseline; gap: 8px; padding: 4px 16px; border: 2px solid var(--ink); border-radius: 6px; background: var(--paper);
  transform: rotate(-1deg); font-size: 14px;
}
.cover-label span { color: var(--pencil); font-weight: 600; }
.cover-label b { font-size: 20px; font-weight: 800; }
#cover-primary { min-height: 78px; }
.cover-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.round-btn {
  position: relative; min-height: 78px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; padding: 6px 4px;
  border: 2.5px solid var(--ink); border-radius: 19px 16px 18px 15px / 16px 19px 15px 18px; background: var(--paper); box-shadow: 0 3px 0 var(--shadow);
}
.round-btn:active { transform: translateY(2px); box-shadow: none; }
.round-btn .ico svg { width: 32px; height: 32px; }
.round-btn .lbl { font-size: 13px; font-weight: 800; line-height: 1.1; text-align: center; }
.round-btn .count { position: absolute; top: 4px; right: 8px; min-width: 22px; padding: 0 5px; text-align: center; font-size: 13px; font-weight: 800; border-radius: 11px; background: var(--sun); border: 1.5px solid var(--ink); }
.round-btn .dot { position: absolute; top: 8px; right: 12px; width: 13px; height: 13px; border-radius: 50%; background: var(--red); border: 2px solid var(--paper); box-shadow: 0 0 0 1.5px var(--ink); }
.round-btn .done { position: absolute; top: 4px; right: 8px; color: #2F7D32; }
.round-btn .done svg { width: 22px; height: 22px; stroke-width: 3; }
.who { display: flex; flex-direction: column; gap: 4px; }
.who-title { text-align: center; font-weight: 800; font-size: 13px; }
.who-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.who-btn { min-height: 46px; display: flex; align-items: center; justify-content: center; gap: 7px; padding: 4px 6px; border: 2px solid var(--ink); border-radius: 10px; background: rgba(255, 253, 247, .7); font-size: 14px; }
.who-btn[aria-pressed="true"] { background: var(--paper); transform: translateY(-3px); box-shadow: 0 4px 0 var(--ink); }
.who-book { width: 18px; height: 26px; flex: none; border: 2px solid var(--ink); border-radius: 2px 5px 5px 2px; background: #6CBDE9; border-left-width: 5px; }
.who-btn[data-role="little"] .who-book { background: #FFC23C; }
.who-btn[data-role="young"] .who-book { background: #6CBDE9; }
.who-btn[data-role="grown"] .who-book { background: #CDB68C; border-left-color: #2B3A67; }
.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); }

/* ---------- play screen ---------- */
/* Sizes come from src/ui/layout.js: it sets --board, --col, --momo, --keys, --keyh ... on #stage and picks data-layout
   (portrait | land3 | land2). The fallbacks below only cover the first frame. */
#screen-play { height: 100dvh; min-height: 0; display: flex; flex-direction: column; overflow-y: auto; overflow-x: hidden; }
.stage {
  --board: min(92vw, 52dvh); --momo: 64px; --keys: 4; --keyh: 64px; --keyfs: 30px; --toolh: 54px; --kgap: 8px; --pad-w: min(92vw, 520px); --strip-w: min(92vw, 760px); --cgap: 28px; --col: 240px;
  flex: 1 0 auto; width: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 8px 0 10px;
}
.margin { flex: none; width: var(--strip-w); position: relative; padding: 0 0 4px; }
.margin.momo-off { display: none; }
.momo-row { display: flex; align-items: flex-end; gap: 10px; }
.momo-btn { width: var(--momo); height: var(--momo); 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[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="sleep"] { animation: breathe 3.6s ease-in-out 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;
}
.bubble::before { content: ''; position: absolute; left: -9px; bottom: 16px; 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(16px, 2.3dvh, 19px); font-weight: 600; line-height: 1.35; min-height: 22px; padding-right: 4px; overflow-wrap: anywhere; }
.bubble-text::before { content: ''; float: right; width: 18px; height: 14px; }
.bubble-x { position: absolute; top: -20px; right: -14px; width: 44px; height: 44px; padding: 0; display: grid; place-items: center; border: 0; background: none; z-index: 2; }
.bubble-x::before { content: ''; position: absolute; inset: 6px; border: 2px solid var(--ink); border-radius: 50%; background: var(--paper); }
.bubble-x svg { position: relative; width: 18px; height: 18px; }
.steps { display: flex; gap: 6px; }
.steps button { flex: 1; min-height: 44px; border: 2px solid var(--ink); border-radius: 10px; background: var(--paper); font-weight: 700; font-size: 14px; }
.steps button[aria-pressed="true"] { background: var(--hl); box-shadow: inset 0 -4px 0 var(--sun); }
.steps button:disabled { opacity: .45; }
.dots-progress { display: flex; gap: 5px; }
.dots-progress i { width: 18px; height: 6px; border-radius: 3px; background: rgba(29, 41, 69, .18); }
.dots-progress i.complete { background: var(--leaf); }
.dots-progress i.current { background: var(--sun); box-shadow: 0 0 0 1.5px var(--ink); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-note { min-height: 44px; display: inline-flex; align-items: center; gap: 6px; padding: 0 10px; border: 2px solid var(--ink); border-radius: 12px; background: var(--paper); font-size: 18px; }
.chip-note svg { width: 22px; height: 22px; fill: none; stroke: var(--red); stroke-width: 2; }
.chip-note svg circle:last-child, .chip-note svg circle + circle { fill: var(--red); stroke: none; }
.chip-note b { font-weight: 800; }
.chip-note.done { background: #DDF2DC; }
.response { font-size: 14px; font-weight: 600; color: var(--pencil); min-height: 0; }
.response:empty { display: none; }
.bubble-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.bubble-actions:not(:has(> :not([hidden]))) { display: none; }
.demo { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.demo-progress { font-weight: 800; font-variant-numeric: tabular-nums; min-width: 42px; text-align: center; }
.audio-note { font-size: 13px; color: var(--pencil); }
.audio-note:empty { display: none; }
.margin-doodles { display: none; }

.board-col { flex: none; display: block; padding: 0; }
.board-wrap { position: relative; width: var(--board); height: var(--board); --cell: calc(var(--board) / var(--n, 9)); }
#board {
  --n: 9; position: relative; width: 100%; height: 100%; display: grid; grid-template-columns: repeat(var(--n), 1fr); grid-template-rows: repeat(var(--n), 1fr);
  background: var(--paper); border: 3px solid var(--ink); border-radius: 3px; box-shadow: 0 4px 0 var(--shadow); overflow: hidden; container-type: normal;
}
#board.size-4 { --nc: 2; } #board.size-6 { --nc: 3; } #board.size-9 { --nc: 3; }
#board.holding { box-shadow: 0 0 0 4px var(--hl), 0 4px 0 4px var(--shadow); cursor: copy; }
.cell {
  position: relative; display: grid; place-items: center; min-width: 0; min-height: 0; padding: 0; margin: 0; border: 0; border-radius: 0;
  background: var(--paper); color: var(--ink); font-family: var(--font); line-height: 1;
  border-right: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
.cell.box-right { border-right: 2.5px solid var(--line-major); }
.cell.box-bottom { border-bottom: 2.5px solid var(--line-major); }
.size-9 .cell:nth-child(9n), .size-4 .cell:nth-child(4n), .size-6 .cell:nth-child(6n), .size-2 .cell:nth-child(2n) { border-right-color: transparent; }
.cell:focus-visible { outline: 3px solid var(--blue); outline-offset: -3px; z-index: 3; }
.cell > .digit { font-size: calc(var(--cell) * .8); font-weight: 700; }
.size-9 .cell > .digit { font-size: calc(var(--cell) * .82); }
.cell.given > .digit { font-weight: 800; color: var(--ink); }
.cell.entry > .digit { font-weight: 700; color: var(--blue); }
body.colors .cell.given.d1 > .digit, body.colors .cell.entry.d1 > .digit { color: var(--c1); }
body.colors .cell.d2 > .digit { color: var(--c2); } body.colors .cell.d3 > .digit { color: var(--c3); } body.colors .cell.d4 > .digit { color: var(--c4); }
body.colors .cell.d5 > .digit { color: var(--c5); } body.colors .cell.d6 > .digit { color: var(--c6); } body.colors .cell.d7 > .digit { color: var(--c7); }
body.colors .cell.d8 > .digit { color: var(--c8); } body.colors .cell.d9 > .digit { color: var(--c9); }
body.colors .cell.d1 > .digit { color: var(--c1); }
.cell.peer { background: var(--peer); }
.cell.same { background: var(--same); }
.cell.highlight { background: #FFF0A8; }
.cell.focus { background: #FFE98A; }
.cell.selected { background: var(--hl); box-shadow: inset 0 0 0 2.5px var(--ink); z-index: 2; }
.cell.selected.sweep { animation: sweep .16s ease-out; }
.cell.conflict { background: var(--conflict); }
.cell.conflict > .digit { color: var(--red) !important; animation: wiggle .35s ease-in-out; }
.cell.placed > .digit { animation: pop .18s ease-out; }
.cell:active { background: #FFF0A8; }
.cell.unit-complete { animation: unitHl .55s ease-out backwards; }
/* a wrong number stays for a moment, faint and red, with a small wiggle */
.cell > .ghost { position: absolute; inset: 0; display: grid; place-items: center; font-size: calc(var(--cell) * .8); font-weight: 700; line-height: 1; color: var(--red); opacity: .42; pointer-events: none; animation: ghost .65s ease-out both; }
.notes { position: absolute; inset: 2px; display: grid; grid-template-columns: repeat(var(--nc, 3), 1fr); grid-auto-rows: 1fr; align-items: center; justify-items: center; pointer-events: none; }
.notes > span { font-size: max(11px, calc(var(--cell) * .3)); font-weight: 800; line-height: 1; color: #55607A; }
.notes .digit { font-size: inherit; font-weight: inherit; }
.notes .shown-note { color: var(--ink); }
.notes .written-note { color: #55607A; }
.teaching-overlay { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; z-index: 4; --pen: 8; }
.teaching-overlay * { vector-effect: non-scaling-stroke; }
.teaching-track { fill-opacity: .3; stroke-width: 2.5; mix-blend-mode: multiply; }
.track-row { stroke: #E8A800; } .track-column { stroke: #3B9AD3; } .track-box { stroke: #4FA552; }
.hatch-row { stroke: #C99000; stroke-opacity: .55; stroke-width: 1.2; }
.hatch-column { stroke: #2E82B8; stroke-opacity: .5; stroke-width: 1.2; }
.hatch-box { stroke: #3E8F42; stroke-opacity: .5; stroke-width: 1.2; }
.teaching-overlay .teaching-ring { vector-effect: none; fill: none; stroke: var(--red); stroke-width: var(--pen); stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1; animation: draw .3s ease-out both; }
.teaching-ring.ring-clue { stroke-width: calc(var(--pen) * .8); }
.teaching-link { fill: none; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; animation: fade .3s ease-out both; }
.link-block { stroke: var(--red); } .link-compare { stroke: var(--blue); stroke-dasharray: 7 6; }
.arrow-tip { stroke: var(--red); stroke-width: 2; fill: none; stroke-linecap: round; }
.teaching-strike { stroke: var(--red); stroke-width: 2.5; stroke-linecap: round; }
.excluded-note rect { fill: var(--paper); stroke: var(--red); stroke-width: 1; }
.excluded-note text { fill: var(--ink); font-family: var(--font); font-weight: 700; text-anchor: middle; stroke: none; }
.proof-cell-badge { fill: var(--paper); stroke: var(--red); stroke-width: 2; }
.proof-dot { fill: var(--red); }
.ticks { position: absolute; inset: 0; pointer-events: none; }
.tick { position: absolute; width: 24px; height: 24px; color: var(--red); filter: drop-shadow(0 0 2px var(--paper)); }
.tick svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 3.4; stroke-linecap: round; stroke-linejoin: round; }
.tick .draw { stroke-dasharray: 1; animation: draw .3s ease-out both; }
.tick.still .draw { animation: none; }
/* half over the board edge, so it stays inside a 360px screen */
.tick.row { right: -12px; transform: translateY(-50%); } .tick.col { bottom: -12px; transform: translateX(-50%); }
.win-mark { position: absolute; inset: -1%; pointer-events: none; opacity: 0; z-index: 6; }
.win-mark.show { opacity: 1; }
.win-mark svg { width: 100%; height: 100%; }
/* the circle is a soft swirl over the middle of the board, so the digits stay readable */
.win-mark > svg { position: absolute; left: 16%; top: 16%; width: 68%; height: 68%; opacity: .75; }
.win-mark .draw { stroke-dasharray: 1; animation: draw .9s ease-in-out both; stroke-width: 3.5; }
.win-stamp { position: absolute; right: 1%; bottom: 1%; width: 25%; border-radius: 50%; background: rgba(255, 253, 247, .94); box-shadow: 0 0 0 3px rgba(255, 253, 247, .94); transform: rotate(-12deg); animation: thump .22s cubic-bezier(.2, .9, .3, 1) both; }
.win-stamp svg { shape-rendering: geometricPrecision; }

.pad-col { flex: none; width: var(--pad-w); padding: 0; display: flex; flex-direction: column; gap: 10px; }
.pad-col.all-off { display: none; }
.pad-col.pad-off #palette, .pad-col .tools-off, .tools.tools-off { display: none; }
#palette { display: grid; grid-template-columns: repeat(var(--keys, 9), minmax(0, 1fr)); gap: var(--kgap); width: 100%; margin: 0 auto; }
.key {
  position: relative; min-height: var(--keyh); display: grid; place-items: center; padding: 0 0 6px; border: 2px solid var(--ink); border-radius: 10px;
  background: var(--paper); box-shadow: 0 3px 0 var(--shadow); font-family: var(--font);
}
.key-digit { font-size: var(--keyfs); font-weight: 800; line-height: 1; margin-top: 2px; }
.key:active { transform: translateY(3px); box-shadow: 0 0 0 var(--shadow); }
body.colors .key.d1 .key-digit { color: var(--c1); } body.colors .key.d2 .key-digit { color: var(--c2); } body.colors .key.d3 .key-digit { color: var(--c3); }
body.colors .key.d4 .key-digit { color: var(--c4); } body.colors .key.d5 .key-digit { color: var(--c5); } body.colors .key.d6 .key-digit { color: var(--c6); }
body.colors .key.d7 .key-digit { color: var(--c7); } body.colors .key.d8 .key-digit { color: var(--c8); } body.colors .key.d9 .key-digit { color: var(--c9); }
.dots { position: absolute; left: 0; right: 0; bottom: 4px; display: grid; grid-template-columns: repeat(3, 5px); justify-content: center; gap: 2px; }
.dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--pencil); }
#palette[data-size="4"] .dots, #palette[data-size="6"] .dots { grid-template-columns: repeat(4, 6px); gap: 3px; } #palette[data-size="4"] .dots i, #palette[data-size="6"] .dots i { width: 6px; height: 6px; }
.key.complete { background: #EFEBDD; border-color: #9AA1B2; color: var(--pencil); box-shadow: none; }
.key.complete .key-digit { opacity: .45; }
.mini-hana { position: absolute; left: 50%; bottom: 3px; width: 18px; height: 18px; margin-left: -9px; color: var(--red); }
.key.held { background: var(--hl); transform: translateY(3px); box-shadow: inset 0 0 0 2px var(--ink); }
.key-pin { position: absolute; top: 2px; right: 2px; width: 18px; height: 18px; color: var(--ink); }
.key-pin svg { width: 100%; height: 100%; }
.tools { display: grid; grid-template-columns: repeat(var(--tool-cols, 4), minmax(0, 1fr)); gap: 8px; width: 100%; margin: 0 auto; }
.tool {
  min-height: var(--toolh); min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 4px 2px; border: 2px solid var(--ink); border-radius: 12px 13px 12px 14px / 13px 12px 14px 12px; background: var(--paper);
  box-shadow: 0 3px 0 var(--shadow); font-weight: 800; font-size: clamp(13px, calc(var(--toolh) * .25), 17px); line-height: 1.05;
}
.tool .ico svg { width: clamp(22px, calc(var(--toolh) * .44), 32px); height: clamp(22px, calc(var(--toolh) * .44), 32px); }
.tool:active { transform: translateY(3px); box-shadow: none; }
.tool[aria-pressed="true"] { background: var(--blue); color: #fff; }
.tool.hint { background: var(--sun); }
.tool:disabled { opacity: .4; box-shadow: none; }
.save-note { margin: 0 auto 8px; width: min(100% - 24px, 560px); padding: 6px 10px; border: 2px solid var(--red); border-radius: 8px; background: #FDE3DF; font-weight: 700; font-size: 14px; }

/* ---------- play layouts (chosen by layout.js) ---------- */
/* portrait: Momo strip, board, pad, tools stacked and centred */
.stage[data-layout="portrait"] .board-col { margin-bottom: 22px; }
.stage[data-layout="portrait"][data-mode="learn"] .pad-col { min-height: var(--padh); }
.stage[data-layout="portrait"] .margin { padding-bottom: 8px; }
.stage[data-layout="portrait"] .margin-doodles { display: none; }
.stage[data-layout="portrait"] .pad-col { padding-bottom: 4px; }

/* land3: Momo margin | board | pad and tools */
.stage[data-layout="land3"], .stage[data-layout="land2"] {
  flex: 1 1 0; min-height: 0; display: grid; justify-content: center; align-items: center; column-gap: var(--cgap); padding: var(--vt) var(--outer, 16px) var(--vb); overflow: hidden;
}
.stage[data-layout="land3"] { grid-template-columns: var(--col) var(--board) var(--col); grid-template-rows: minmax(0, 1fr); }
.stage[data-layout="land3"] .margin { grid-column: 1; grid-row: 1; width: var(--col); max-height: var(--margin-max, 100%); overflow-y: auto; padding: 0 2px 4px 0; display: flex; flex-direction: column; align-items: center; gap: 14px; align-self: center; }
.stage[data-layout="land3"] .margin.momo-off { display: flex; }
.stage[data-layout="land3"] .margin.momo-off .momo-row { display: none; }
.stage[data-layout="land3"] .momo-row { flex-direction: column; align-items: center; gap: 16px; width: 100%; }
.stage[data-layout="land3"] .bubble { width: 100%; flex: none; }
.stage[data-layout="land3"] .bubble::before { left: 50%; bottom: auto; top: -9px; margin-left: -7px; transform: rotate(135deg); }
.stage[data-layout="land3"] .margin-doodles { display: block; position: relative; width: 100%; height: 76px; flex: 0 1 76px; min-height: 0; overflow: hidden; }
.stage[data-layout="land3"] .margin-doodles .dd { width: 60px; }
.stage[data-layout="land3"] .board-col { grid-column: 2; grid-row: 1; }
.stage[data-layout="land3"] .pad-col { grid-column: 3; grid-row: 1; width: var(--col); align-self: center; }

/* land2: board left, Momo strip above pad and tools on the right */
.stage[data-layout="land2"] { grid-template-columns: var(--board) var(--col); grid-template-rows: minmax(0, 1fr) auto auto minmax(0, 1fr); }
.stage[data-layout="land2"] .board-col { grid-column: 1; grid-row: 1 / -1; align-self: center; }
.stage[data-layout="land2"] .margin { grid-column: 2; grid-row: 2; width: var(--col); max-height: var(--margin-max, none); overflow-y: auto; padding: 0 0 8px; }
.stage[data-layout="land2"] .pad-col { grid-column: 2; grid-row: 3; width: var(--col); }
.stage[data-layout="land2"] .margin-doodles { display: none; }
.stage[data-layout="land2"] .bubble { padding: 6px 10px; }
.stage[data-layout="land2"] .bubble-text { font-size: 14px; line-height: 1.3; }

/* ---------- Momova škola ---------- */
#screen-school, #screen-stickers { padding-bottom: 28px; }
.school-list, .stickers-layout { width: min(100%, 960px); margin: 0 auto; padding: 14px var(--gutter); }
.school-hero { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.momo-hero { width: 84px; height: 84px; flex: none; }
.momo-hero svg { width: 100%; height: 100%; }
.school-hint { font-size: 18px; font-weight: 800; }
.chapter { margin-top: 14px; }
.chapter h2 { font-size: 19px; margin-bottom: 8px; display: inline-block; padding: 0 6px; background: linear-gradient(transparent 55%, var(--hl) 55% 92%, transparent 92%); }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.card {
  position: relative; display: flex; flex-direction: column; gap: 6px; padding: 8px; min-height: 172px; text-align: left; background: var(--paper);
  border: 2px solid var(--ink); border-radius: 13px 11px 14px 12px / 12px 14px 11px 13px; box-shadow: 0 3px 0 var(--shadow);
}
.card:active { transform: translateY(2px); box-shadow: none; }
.card-board { display: grid; place-items: center; background: var(--paper); }
.card-board .mini { width: 92px; height: 92px; border: 2px solid var(--ink); }
.card-text b { display: block; font-size: 16px; font-weight: 800; line-height: 1.15; }
.card-text small { display: block; margin-top: 2px; font-size: 13px; font-weight: 700; color: var(--pencil); }
.card.recommended { background: #FFFBE0; }
.card.recommended .card-board { background: transparent; }
.card.recommended .card-text b { display: inline; line-height: 1.35; padding: 0 3px; margin-left: -3px; background: linear-gradient(transparent 50%, var(--hl) 50% 94%, transparent 94%); -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.pick-tag { position: absolute; top: -10px; left: 10px; 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); }
.card.inprogress { background: var(--soft); }
.card .paw { position: absolute; top: 4px; right: 4px; width: 46px; height: 46px; transform: rotate(10deg); }
.card .paw svg { width: 100%; height: 100%; }
.mini { display: block; }

/* ---------- Naljepnice ---------- */
.stickers-layout { display: grid; gap: 18px; }
.sticker-chart { background: var(--paper); border: 2.5px solid var(--ink); border-radius: 10px; padding: 12px; box-shadow: 0 4px 0 var(--shadow); display: flex; flex-direction: column; gap: 14px; }
.sticker-row { display: grid; grid-template-columns: 40px 1fr; align-items: center; gap: 6px; padding-bottom: 10px; border-bottom: 2px dashed var(--grid-major); }
.sticker-row:last-child { border-bottom: 0; padding-bottom: 0; }
.row-label { font-weight: 800; font-size: 15px; color: var(--pencil); writing-mode: horizontal-tb; }
.slots { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.slot { position: relative; min-width: 0; aspect-ratio: 1 / 1.15; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 3px; border: 2px dashed var(--pencil); border-radius: 12px; background: transparent; }
.slot.earned { border: 2px solid var(--ink); background: var(--paper); border-style: solid; box-shadow: 0 2px 0 var(--shadow); }
.slot.gold { border-color: #D9A400; border-width: 3px; border-style: solid; box-shadow: 0 0 0 2px var(--hl); }
.slot.empty.gold { border-style: dashed; box-shadow: none; }
.slot-art { flex: 1; min-height: 0; width: 100%; display: grid; place-items: center; }
.slot-art svg { width: 100%; height: 100%; }
.slot-num { font-size: clamp(22px, 7vw, 34px); font-weight: 800; color: #7B8498; }
.slot-time { font-size: 11px; font-weight: 800; color: var(--ink); min-height: 13px; font-variant-numeric: tabular-nums; }
.slot.next { box-shadow: 0 0 0 3px var(--paper), 0 0 0 5.5px var(--red); }
.mode-cards { display: grid; gap: 14px; align-content: start; }
.mode-card { padding: 14px; background: var(--soft); border: 2px solid var(--ink); border-radius: 6px; box-shadow: 0 4px 0 var(--shadow); display: flex; flex-direction: column; gap: 10px; }
.mode-card.free { transform: rotate(-.5deg); } .mode-card.daily { transform: rotate(.5deg); background: #E5F4FC; }
.mode-card h2 { font-size: 19px; }
.mode-card p { font-weight: 600; }
.calendar { max-width: 280px; display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.calendar .dn { text-align: center; font-size: 11px; font-weight: 800; color: var(--ink); }
.day { position: relative; aspect-ratio: 1; border-radius: 50%; border: 1.5px dashed #9AA1B2; display: grid; place-items: center; }
.day.blank { border: 0; } .day.done { border: 0; } .day.done svg { width: 100%; height: 100%; } .day.today { border: 2.5px solid var(--red); background: var(--soft); }
.day i { font-style: normal; font-size: 11px; font-weight: 800; line-height: 1; color: var(--ink); font-variant-numeric: tabular-nums; }
.day.done i { position: absolute; right: -1px; bottom: -1px; min-width: 14px; padding: 1px 2px; border-radius: 7px; background: var(--paper); border: 1px solid var(--ink); text-align: center; }
.day.today i { font-size: 12px; }
.cal-title { font-weight: 800; font-size: 15px; } .cal-title small { font-weight: 700; font-size: 13px; color: var(--ink); }
/* ---------- sheets ---------- */
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: 6px; }
.switch { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 54px; padding: 4px 12px; text-align: left; border: 2px solid var(--ink); border-radius: 12px; background: var(--paper); }
.switch .ico svg { width: 26px; height: 26px; }
.switch .lbl { flex: 1; font-weight: 800; font-size: 17px; }
.knob { position: relative; width: 48px; height: 28px; border-radius: 14px; border: 2px solid var(--ink); background: #CDD3DF; flex: none; }
.knob i { position: absolute; top: 2px; left: 3px; width: 20px; height: 20px; 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(18px); }
.pick-group { display: flex; flex-direction: column; gap: 6px; }
.pick-label { font-weight: 800; font-size: 14px; color: var(--pencil); }
.pick-row { display: flex; gap: 8px; }
.pick { flex: 1; min-height: 48px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 6px; border: 2px solid var(--ink); border-radius: 12px; background: var(--paper); }
.pick.on { background: var(--hl); box-shadow: inset 0 -4px 0 var(--sun); }
.pick .pick-mini .mini { width: 54px; height: 54px; border: 2px solid var(--ink); }
.pick b { font-size: 16px; font-weight: 800; }
.best-line { font-size: 16px; } .best-line b { font-weight: 800; }
.keys summary { min-height: 44px; display: flex; align-items: center; font-weight: 800; cursor: pointer; list-style: none; }
.keys summary::-webkit-details-marker { display: none; }
.keys 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; }
.keys[open] summary::after { margin-top: 4px; transform: rotate(-135deg); }
.keys ul { margin: 0; padding-left: 20px; font-weight: 600; }
.danger .note { margin-top: 8px; font-weight: 600; font-size: 14px; }
.version { text-align: center; font-size: 12px; color: var(--pencil); }
.win-body { align-items: stretch; text-align: center; }
.win-body h2 { font-size: 34px; color: var(--red); }
.win-sticker { position: relative; width: 150px; height: 150px; margin: 4px auto; }
.win-sticker .ring { position: absolute; inset: -14px; }
.win-sticker .ring svg { width: 100%; height: 100%; }
.win-sticker .ring .draw { stroke-dasharray: 1; animation: draw .6s ease-out both; stroke-width: 6; }
.win-sticker .stk { position: absolute; inset: 14px; animation: peel .5s ease-out .2s both; }
.win-sticker .stk svg { width: 100%; height: 100%; }
.win-sticker.gold .stk { filter: drop-shadow(0 0 6px #FFC23C); }
.sticker-name { font-weight: 800; }
.win-time { font-size: 20px; } .win-time b { font-weight: 800; font-variant-numeric: tabular-nums; }
.record { font-size: 22px; font-weight: 800; color: var(--red); transform: rotate(-2deg); }
.win-row { display: flex; gap: 10px; justify-content: center; }
.win-row { flex-wrap: wrap; }
.win-row .pill { flex: 1; min-width: 0; }
.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); }

.making { position: fixed; left: 50%; top: 42%; transform: translateX(-50%); z-index: 60; padding: 10px 18px; border: 2px solid var(--ink); border-radius: 999px; background: var(--soft); box-shadow: 0 4px 0 var(--shadow); font-weight: 700; }
.making[hidden] { display: none; }

/* ---------- motion ---------- */
@keyframes wag { 0%, 100% { transform: rotate(0); } 50% { transform: rotate(7deg); } }
@keyframes blink { 0%, 92%, 100% { transform: scaleY(1); } 96% { transform: scaleY(.1); } }
.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; }
@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 sweep { from { background-position: -100% 0; background-image: linear-gradient(90deg, transparent 0 50%, #FFF6C7 50% 100%); background-size: 200% 100%; } to { background-position: 0 0; } }
@keyframes wiggle { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-4px); } 40% { transform: translateX(4px); } 60% { transform: translateX(-3px); } 80% { transform: translateX(3px); } }
@keyframes pop { 0% { transform: scale(.6); } 70% { transform: scale(1.12); } 100% { transform: scale(1); } }
@keyframes unitHl { 0% { background: var(--paper); } 22% { background: #FFE36E; } 100% { background: var(--paper); } }
@keyframes ghost { 0% { opacity: .55; transform: translateX(0); } 10% { transform: translateX(-5px); } 20% { transform: translateX(5px); } 30% { transform: translateX(-3px); } 40% { transform: translateX(3px); } 50% { opacity: .4; transform: translateX(0); } 100% { opacity: 0; } }
@keyframes breathe { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.03, .97); } }
@keyframes doodlePop { 0% { transform: scale(.6) rotate(-12deg); } 45% { transform: scale(1.25) rotate(6deg); } 100% { transform: scale(1); } }
@keyframes draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes rise { from { transform: translateY(26px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes thump { from { transform: rotate(-12deg) scale(1.8); opacity: 0; } to { transform: rotate(-12deg) scale(1); opacity: 1; } }
@keyframes peel { from { transform: rotate(-24deg) scale(.4); opacity: 0; } 70% { transform: rotate(6deg) scale(1.08); opacity: 1; } to { transform: none; opacity: 1; } }
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; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }

/* ---------- desk layouts ---------- */
@media (min-width: 700px) {
  .desk-doodles { display: block; }
  dialog.sheet { margin: auto; border-bottom: 3px solid var(--ink); border-radius: 20px; }
  .stickers-layout { grid-template-columns: minmax(0, 1.3fr) minmax(300px, 1fr); align-items: start; }
  .notebook { width: min(100%, 460px); }
}
@media (max-width: 374px) {
  :root { --gutter: 10px; }
  .tag-text b { font-size: 21px; }
}

@media (orientation: landscape) and (max-height: 520px) {
  #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-label { grid-column: 2; grid-row: 2; padding: 2px 14px; }
  #cover-primary { grid-column: 2; grid-row: 3; min-height: 64px; }
  .cover-row { grid-column: 2; grid-row: 4; align-self: start; }
  .round-btn { min-height: 62px; } .round-btn .ico svg { width: 26px; height: 26px; }
  .who { grid-column: 2; grid-row: 5; align-self: end; }
  .who-btn { min-height: 40px; }
  .who-title { display: none; }
  .desk-doodles { display: none; }
}

/* win sheet and narrow-top-bar adjustments */
.win-art, .win-actions { display: flex; flex-direction: column; gap: 10px; align-items: stretch; }
@media (max-width: 400px) { #screen-play:has(#stage[data-mode="learn"]) #play-size { display: none; } }
@media (orientation: landscape) and (max-height: 520px) {
  dialog.sheet { max-height: 96dvh; max-width: 640px; }
  .win-body { display: grid; grid-template-columns: 1fr 1.1fr; column-gap: 18px; row-gap: 4px; align-items: center; padding-top: 8px; padding-bottom: 12px; }
  .win-body h2 { grid-column: 1 / -1; font-size: 26px; line-height: 1.1; }
  .win-sticker { width: 104px; height: 104px; }
  .win-time { font-size: 17px; }
}
/* keep the "how many left" dots clear of the digit on crowded pads */
#palette[data-size="9"] .key { padding-bottom: 15px; }
#palette[data-size="6"] .key { padding-bottom: 11px; }
#palette[data-size="9"] .key-digit, #palette[data-size="6"] .key-digit { margin-top: 0; }
#pad-col[data-learn="1"] #palette .key { padding-bottom: 6px; }
.stage[data-layout="land3"] .pad-col.all-off { display: flex; visibility: hidden; }
/* steps tabs wrap instead of clipping in narrow bubbles */
.steps { flex-wrap: wrap; }
.steps button { flex: 1 1 auto; min-width: 0; padding: 0 6px; }
/* margin doodles: loose sketches in the left margin, more of them when there is no Momo */
.stage[data-layout="land3"] .margin-doodles .dd { position: absolute; }
.stage[data-layout="land3"] .margin-doodles .dd-sun { left: 10%; top: 6%; width: 64px; transform: rotate(-8deg); }
.stage[data-layout="land3"] .margin-doodles .dd-flower { left: 44%; top: 30%; width: 54px; bottom: auto; }
.stage[data-layout="land3"] .margin-doodles .dd-star { left: auto; right: 14%; top: 4%; bottom: auto; width: 52px; }
/* without Momo the margin has nothing to show: the board and pad are centred as a pair */
.stage[data-layout="land3"]:has(.margin.momo-off) { grid-template-columns: var(--board) var(--col); }
.stage[data-layout="land3"] .margin.momo-off { display: none; }
.stage[data-layout="land3"]:has(.margin.momo-off) .board-col { grid-column: 1; }
.stage[data-layout="land3"]:has(.margin.momo-off) .pad-col { grid-column: 2; }
.stage[data-layout="land3"] .margin-doodles .dd.pop { animation: doodlePop .9s ease-out; }

/* ---------- responsive polish (layout sweep) ---------- */
#screen-cover { grid-template-columns: minmax(0, 1fr); }
.notebook { min-width: 0; }
.cover-row, .who-row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.who-btn { min-height: 44px; min-width: 0; }
.who-btn > span:last-child, .who-btn b { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 359px) {
  .who-btn { gap: 4px; padding: 4px; font-size: 13px; }
  .who-book { width: 12px; }
  .round-btn .lbl { font-size: 12px; }
  .sticker-row { grid-template-columns: 1fr; gap: 4px; }
  .sticker-chart { padding: 10px; }
  .slots { gap: 6px; }
}
@media (min-width: 700px) and (min-height: 700px) {
  .notebook { width: min(100%, calc((100dvh - 48px) * .64), 640px); height: min(calc(100dvh - 48px), 960px); }
}
@media (min-width: 1500px) {
  .school-list, .stickers-layout { width: min(100%, 1200px); }
}
.stage[data-layout="land3"] .bubble-text { font-size: var(--bfs, 17px); }
.stage[data-layout="land3"] .bubble { padding: 10px 14px; }

/* school and stickers: on tall windows the content sits in the middle of the page instead of hugging the top */
#screen-school, #screen-stickers { display: flex; flex-direction: column; }
#screen-school .school-list, #screen-stickers .stickers-layout { margin-block: auto; }
@media (min-width: 700px) and (min-height: 700px) {
  #screen-school .school-list, #screen-stickers .stickers-layout { margin-block: auto; padding-bottom: 6vh; }
}

/* narrow phones: a slimmer book and tighter padding so "Najmlađi" fits without an ellipsis */
@media (max-width: 420px) {
  .who-btn { gap: 4px; padding: 4px 3px; font-size: 13px; }
  .who-btn .who-book { width: 10px; height: 18px; border-left-width: 3px; }
}

/* phone landscape cover: the reader buttons drop the little book so names are not cut */
@media (max-height: 480px) and (orientation: landscape) {
  .who-btn { gap: 4px; padding: 4px 4px; font-size: 13px; }
  .who-btn .who-book { width: 12px; height: 18px; }
}

/* ---------- feedback and small reward pieces (v2-ux) ---------- */
.toast { position: fixed; left: 50%; top: 66px; z-index: 40; transform: translateX(-50%); max-width: calc(100vw - 24px); padding: 6px 14px; border: 2px solid var(--ink); border-radius: 14px; background: var(--soft); box-shadow: 0 3px 0 var(--shadow); font-size: 15px; font-weight: 700; text-align: center; pointer-events: none; animation: rise .2s ease-out; }
/* replay button sits in the bubble corner so it never makes the bubble taller */
.pill.speak { position: absolute; right: 6px; bottom: 6px; width: 44px; min-height: 44px; padding: 0; background: var(--hl); }
.pill.speak[hidden] { display: none; }
.pill.speak svg { width: 22px; height: 22px; }
.bubble:has(#coach-speak:not([hidden])) { min-height: 62px; }
.bubble:has(#coach-speak:not([hidden])) .bubble-text { padding-right: 50px; }
.notebook[data-profile="little"] #cover-primary { background: var(--paper); box-shadow: 0 4px 0 var(--ink); }
.notebook[data-profile="little"] #cover-primary .tag-icon { width: 50px; height: 50px; border-radius: 50%; background: var(--hl); border: 2.5px solid var(--ink); }
.notebook[data-profile="little"] #cover-primary .tag-icon svg { width: 30px; height: 30px; }
.win-mark.lesson-done { inset: 0; }
.win-mark.lesson-done .win-stamp { width: 32%; }
.fly-sticker { position: fixed; z-index: 100; pointer-events: none; }
.fly-sticker svg { width: 100%; height: 100%; }
.win-row .pill.got, .tag-btn.got { animation: gotPop .5s ease-out; }
@keyframes gotPop { 0%, 100% { transform: scale(1); } 40% { transform: scale(1.06); } }
dialog.sheet.win.beside[open] { position: fixed; inset: auto; left: var(--wl); top: 50%; width: var(--ww); max-width: none; margin: 0; border-bottom: 3px solid var(--ink); border-radius: 20px; transform: translateY(-50%); animation: fade .25s ease-out; }
dialog.sheet.win.beside::backdrop { background: rgba(29, 41, 69, .12); }
.switch .lbl small { display: block; font-size: 12px; font-weight: 600; color: var(--pencil); }
.switch:disabled { opacity: .65; cursor: default; }
