/* Math Adventures – game styles. Kit tokens (ui.css) + "papirna diorama na moru". */
:root {
  --night: #1B2240; --indigo: #2B2F6B; --deep: #0E5A73; --sea: #1E9AA8; --parchment: #F6E7C8;
  --coral: #FF6B5A; --mango: #FFB627; --violet: #7B5CFA; --leaf: #3DBE6B; --glow: #FFE58A;
  --pv0: #FFB627; --pv1: #14B8A6; --pv2: #7B5CFA; --pv3: #FF6B5A;
  --chalk: #F7F3E8; --board: #2E4A3F; --wood: #A86A38;
  --ease-pop: cubic-bezier(.3, 1.5, .5, 1);
  --sticker: drop-shadow(0 4px 0 #24263B);
  --app-h: 100dvh;
}
@supports not (height: 100dvh) { :root { --app-h: calc(var(--vh, 1vh) * 100); } }
html.tk-app body { background: var(--night); color: var(--ink); }
#app { position: fixed; left: 0; top: 0; width: 100vw; height: var(--app-h); overflow: hidden; }
.scr { position: absolute; inset: 0; overflow: hidden; padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
.scr-in { animation: scr-in .35s ease both; }
@keyframes scr-in { from { opacity: 0; } }
.fill { position: absolute; inset: 0; }
.fill > svg, .bg > svg { width: 100%; height: 100%; display: block; }
.bg { position: absolute; inset: 0; pointer-events: none; }
.noscript { padding: 24px; font: 700 18px sans-serif; color: #fff; }
button { -webkit-tap-highlight-color: transparent; }
.tk-app :focus-visible { outline: 3px solid var(--orange); outline-offset: 3px; box-shadow: 0 0 0 6px rgba(36, 38, 59, .9); }

/* ------------------------------------------------------------------ common bits */
.corner { position: absolute; z-index: 20; display: flex; gap: .55rem; align-items: center; }
.corner-tl { left: calc(10px + env(safe-area-inset-left)); top: calc(10px + env(safe-area-inset-top)); }
.corner-tr { right: calc(10px + env(safe-area-inset-right)); top: calc(10px + env(safe-area-inset-top)); }
.corner-bl { left: calc(10px + env(safe-area-inset-left)); bottom: calc(10px + env(safe-area-inset-bottom)); }
.corner-br { right: calc(10px + env(safe-area-inset-right)); bottom: calc(10px + env(safe-area-inset-bottom)); }
.big-ico { width: 3.5rem; height: 3.5rem; }
.big-ico svg.tk-ico { width: 56%; height: 56%; }
.pic-btn { position: relative; width: 3.6rem; height: 3.6rem; border-radius: 18px; border: 3px solid var(--ink); background: #fff; box-shadow: 0 4px 0 var(--ink); display: inline-flex; align-items: center; justify-content: center; padding: 4px; cursor: pointer; }
.pic-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.pic-btn > svg { width: 100%; height: 100%; }
.paper { background: #FFF6E3; border: 3px solid var(--ink); border-radius: 22px; box-shadow: 0 5px 0 var(--ink); }
.hint-pulse { animation: hint-pulse 1s ease-in-out 3; }
@keyframes hint-pulse { 50% { box-shadow: 0 0 0 6px rgba(255, 150, 54, .85), 0 0 22px 6px rgba(255, 150, 54, .5); } }
.ink-title { font-weight: 1000; color: #fff; text-shadow: 3px 0 0 var(--ink), -3px 0 0 var(--ink), 0 3px 0 var(--ink), 0 -3px 0 var(--ink), 2px 2px 0 var(--ink), -2px 2px 0 var(--ink), 2px -2px 0 var(--ink), -2px -2px 0 var(--ink), 0 6px 0 var(--ink); letter-spacing: .01em; }
.say-box { font-weight: 800; }

/* ------------------------------------------------------------------ title */
.scr-title { background: var(--night); }
.title-sea { position: absolute; inset: 0; width: 100%; height: 100%; }
.title-sea .tw { animation: twinkle 3s ease-in-out infinite; }
@keyframes twinkle { 50% { opacity: .2; } }
.title-sea .waves { animation: waves 6s linear infinite; }
@keyframes waves { to { transform: translateX(-200px); } }
.t-logo { position: absolute; left: 50%; top: max(4%, 14px); transform: translateX(-50%); text-align: center; z-index: 5; width: min(94vw, 760px); }
.t-tiles { display: flex; flex-wrap: wrap; justify-content: center; gap: .35rem .2rem; }
.t-word { display: inline-flex; gap: .18rem; margin: 0 .4rem; }
.t-tile { display: inline-flex; align-items: center; justify-content: center; width: clamp(2.1rem, 5.6vw, 3.6rem); height: clamp(2.5rem, 6.6vw, 4.3rem); border: 3px solid var(--ink); border-radius: 10px; font-weight: 1000; font-size: clamp(1.5rem, 4.4vw, 2.9rem); color: var(--ink); box-shadow: 0 4px 0 var(--ink); animation: tile-in .6s var(--ease-pop) both; }
@keyframes tile-in { from { transform: translateY(-30px) rotate(-20deg); opacity: 0; } }
.t-sub { margin-top: .5rem; font-size: clamp(1.05rem, 2.6vw, 1.6rem); color: var(--glow); }
.t-lh { position: absolute; left: 4%; bottom: 14%; height: 62%; z-index: 2; }
.t-lh svg { height: 100%; width: auto; }
.t-okica { position: absolute; right: 9%; top: 26%; width: clamp(150px, 22vw, 250px); z-index: 4; animation: bob 4s ease-in-out infinite; }
.t-okica > svg { width: 100%; height: auto; display: block; }
.t-okica .t-tika { position: absolute; left: 24%; width: 52%; top: 49%; }
@keyframes bob { 50% { transform: translateY(-14px) rotate(1.5deg); } }
.ok-flame { animation: flame .5s ease-in-out infinite alternate; transform-origin: 60px 128px; transform-box: view-box; }
@keyframes flame { to { transform: scale(1.1, .88); } }
.t-zb { position: absolute; width: 90px; top: 40%; left: -120px; z-index: 3; animation: zb-fly 16s linear infinite; }
@keyframes zb-fly { 0%, 55% { transform: translateX(0) rotate(0); visibility: hidden; } 56% { visibility: visible; } 84% { visibility: visible; } 85% { transform: translateX(calc(100vw + 260px)) translateY(-60px) rotate(40deg); visibility: hidden; } 100% { transform: translateX(calc(100vw + 260px)) translateY(-60px); visibility: hidden; } }
.zb-spin { transform-origin: 51px 50px; transform-box: view-box; animation: spin 2.4s linear infinite; }
.zb-s2 { animation-duration: 1.4s; animation-direction: reverse; }
@keyframes spin { to { transform: rotate(360deg); } }
.t-go { position: absolute; left: 50%; bottom: max(9%, 52px); transform: translateX(-50%); z-index: 6; }
.t-go .tk-btn { min-height: 76px; font-size: 1.9rem; padding: .3em 1.6em; }
.t-free { position: absolute; left: 50%; bottom: max(2.5%, 12px); transform: translateX(-50%); z-index: 6; color: #C9CDEB; font-weight: 800; font-size: .95rem; white-space: nowrap; }
.scr-title .corner-tr { z-index: 30; }
[data-layout="port"] .t-okica { right: 50%; transform: translateX(50%); top: 30%; width: clamp(150px, 42vw, 260px); }
[data-layout="port"] .t-okica { animation: none; }
[data-layout="port"] .t-lh { height: 34%; bottom: 17%; left: 2%; }
[data-layout="short"] .t-logo { top: 6px; left: 50%; width: 440px; }
[data-layout="short"] .t-tiles { gap: .2rem; }
[data-layout="short"] .t-tile { width: 1.75rem; height: 2.15rem; font-size: 1.3rem; border-width: 2.5px; box-shadow: 0 3px 0 var(--ink); }
[data-layout="short"] .t-sub { margin-top: .2rem; font-size: 1rem; }
[data-layout="short"] .t-okica { top: 30%; width: 130px; right: 6%; }
[data-layout="short"] .t-go { bottom: 40px; }
[data-layout="short"] .t-go .tk-btn { min-height: 64px; font-size: 1.6rem; }
[data-layout="short"] .t-free { bottom: 8px; font-size: .85rem; }
[data-layout="short"] .t-lh { height: 70%; bottom: 6%; }

/* ------------------------------------------------------------------ simple screens (profiles, age, intro) */
.scr-paper { background: linear-gradient(180deg, #CDEFF2 0%, #F6E7C8 70%); }
.scr-paper::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(circle at 20% 10%, rgba(255, 255, 255, .5), transparent 40%); }
.head { position: absolute; left: 0; right: 0; top: 0; display: flex; align-items: center; gap: .8rem; padding: 12px 14px; z-index: 5; min-height: 76px; }
.head .tk-icon-btn { flex: 0 0 auto; }
.head-tika { width: 64px; flex: 0 0 auto; }
.head-bubble { flex: 1 1 auto; min-width: 0; font-weight: 800; font-size: clamp(1rem, 2.2vw, 1.3rem); line-height: 1.25; }
.head .ctl { margin-left: auto; display: flex; gap: .45rem; align-items: center; flex: 0 0 auto; }
.mid { position: absolute; left: 0; right: 0; top: 88px; bottom: 0; display: flex; align-items: center; justify-content: center; padding: 10px 16px 18px; }
.cards { display: flex; flex-wrap: wrap; gap: 18px; justify-content: center; align-items: stretch; max-width: 100%; }
.pcard { width: clamp(150px, 22vw, 210px); min-height: clamp(170px, 30vh, 240px); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .4rem; padding: 14px; background: #fff; border: 4px solid var(--ink); border-radius: 26px; box-shadow: 0 6px 0 var(--ink); cursor: pointer; font-weight: 900; font-size: 1.15rem; transition: transform .12s; }
.pcard:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--ink); }
.pcard .art-avatar { width: 70%; height: auto; }
.pcard .pc-age { display: flex; align-items: center; gap: .3rem; font-size: 1.25rem; }
.pcard .pc-stars { display: flex; align-items: center; gap: .25rem; color: var(--ink-2); font-size: 1rem; }
.pcard .pc-stars svg { width: 1.3rem; height: 1.3rem; color: var(--sun); }
.pcard-add { background: var(--sun-soft, #FFF1C4); border-style: dashed; }
.pcard-add .plus { width: 72px; height: 72px; border-radius: 50%; background: var(--go); color: #fff; display: flex; align-items: center; justify-content: center; border: 4px solid var(--ink); }
.pcard-add .plus svg { width: 60%; height: 60%; }
.avatars { display: grid; grid-template-columns: repeat(3, minmax(90px, 150px)); gap: 16px; }
.avatars .pcard { width: auto; min-height: 0; aspect-ratio: 1; padding: 8px; }
.avatars .pcard .art-avatar { width: 88%; }
[data-layout="short"] .avatars { grid-template-columns: repeat(6, minmax(70px, 110px)); }
[data-layout="short"] .head { min-height: 64px; padding: 6px 12px; }
[data-layout="short"] .mid { top: 66px; }
[data-layout="short"] .pcard { min-height: 0; height: calc(var(--app-h) - 110px); max-height: 230px; width: 170px; }
[data-layout="short"] .head-tika { width: 48px; }

.cakes { display: flex; gap: clamp(8px, 2vw, 22px); align-items: flex-end; justify-content: center; flex-wrap: wrap; max-width: 100%; }
.cake { background: transparent; border: 0; padding: 6px 4px 10px; border-radius: 22px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: .2rem; width: clamp(112px, 17vw, 170px); }
.cake .art-cake { width: 100%; height: auto; transition: transform .2s var(--ease-pop); }
.cake:hover .art-cake { transform: translateY(-4px); }
.cake .cake-lbl { font-weight: 1000; font-size: 1.5rem; background: #fff; border: 3px solid var(--ink); border-radius: 999px; padding: 0 .7em; box-shadow: 0 3px 0 var(--ink); white-space: nowrap; }
.cake.is-picked { background: rgba(255, 229, 138, .55); box-shadow: inset 0 0 0 4px var(--ink); }
.cake-flame { opacity: 0; transform-box: fill-box; transform-origin: 50% 100%; }
.cake-flame.is-lit { opacity: 1; animation: flame .45s ease-in-out infinite alternate; }
.age-ok { position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); }
.grade-chip { position: absolute; right: 14px; bottom: 16px; min-height: 48px; padding-inline: 16px; }
[data-layout="port"] .cakes { max-width: 560px; }
[data-layout="port"] .cake { width: clamp(100px, 28vw, 170px); }
[data-layout="short"] .cake { width: 120px; padding-bottom: 4px; }
[data-layout="short"] .cake .cake-lbl { font-size: 1.15rem; }
[data-layout="short"] .age-ok { bottom: 8px; }

/* intro comic */
.scr-intro { background: var(--night); }
.panel { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 70px 20px 120px; }
.panel-card { position: relative; width: min(100%, 980px); height: 100%; border: 5px solid var(--ink); border-radius: 26px; overflow: hidden; background: #1B2240; box-shadow: 0 8px 0 #000; }
.panel-card .bg > svg { width: 100%; height: 100%; }
.panel-art { position: absolute; inset: 0; }
.panel-cap { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); width: min(94%, 880px); font-size: clamp(1rem, 2.2vw, 1.35rem); font-weight: 800; line-height: 1.3; }
.intro-nav { position: absolute; left: 0; right: 0; bottom: 18px; display: flex; justify-content: center; gap: 14px; z-index: 5; }
.intro-dots { position: absolute; top: 20px; left: 50%; transform: translateX(-50%); z-index: 5; }
[data-layout="short"] .panel { padding: 8px 120px 8px 12px; }
[data-layout="short"] .intro-nav { left: auto; right: 12px; top: 0; bottom: 0; flex-direction: column; justify-content: center; }
[data-layout="short"] .intro-dots { top: auto; bottom: 14px; left: calc(50% - 60px); }
.pa { position: absolute; }
.pa > svg { width: 100%; height: auto; display: block; }

/* ------------------------------------------------------------------ map */
.scr-map { background: #BFE3E4; }
.map-svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.map-isl { cursor: pointer; }
.map-isl:focus { outline: none; }
.map-isl:focus-visible .mi-ring { stroke: var(--orange); stroke-width: 8; opacity: 1; }
.mi-ring { fill: none; stroke: transparent; }
.map-isl:hover .mi-lift, .map-isl:focus-visible .mi-lift { transform: translateY(-6px); }
.mi-lift { transition: transform .25s var(--ease-pop); }
.mi-label { font: 900 30px Nunito, sans-serif; paint-order: stroke; stroke: #FFF6E3; stroke-width: 8px; stroke-linejoin: round; fill: var(--ink); }
.mi-digit { font: 1000 40px Nunito, sans-serif; }
.mwave { animation: mwave 4s ease-in-out infinite; }
@keyframes mwave { 50% { transform: translateX(10px); opacity: .5; } }
.map-okica { transition: transform 1.2s ease-in-out; }
.map-okica .ok-bob { animation: bob 3.6s ease-in-out infinite; }
.wand-mark { animation: wandmark 1.6s ease-in-out infinite; transform-box: fill-box; transform-origin: 50% 100%; }
@keyframes wandmark { 50% { transform: translateY(-14px) scale(1.08); } }
.map-cloud { animation: cloud 40s linear infinite; }
@keyframes cloud { 50% { transform: translateX(60px); } }
.hold-gear { position: relative; }
.hold-gear .ring { position: absolute; inset: -6px; border-radius: 50%; pointer-events: none; background: conic-gradient(var(--orange) calc(var(--p, 0) * 1%), transparent 0); -webkit-mask: radial-gradient(circle, transparent 58%, #000 60%); mask: radial-gradient(circle, transparent 58%, #000 60%); }
.map-tika { position: absolute; left: calc(12px + env(safe-area-inset-left)); bottom: calc(12px + env(safe-area-inset-bottom)); display: flex; align-items: flex-end; gap: 8px; z-index: 10; max-width: min(560px, calc(100vw - 110px)); pointer-events: none; }
.map-tika .tika { width: 92px; flex: 0 0 auto; pointer-events: auto; }
.map-tika .tk-bubble { margin-bottom: 26px; font-size: 1.1rem; }
[data-layout="short"] .map-tika .tika { width: 66px; }
[data-layout="short"] .map-tika .tk-bubble { font-size: .95rem; margin-bottom: 14px; padding: .4rem .7rem; }
.chip-stars { display: inline-flex; align-items: center; gap: .3rem; background: #fff; border: 3px solid var(--ink); border-radius: 999px; padding: .2rem .7rem; font-weight: 1000; font-size: 1.15rem; box-shadow: 0 3px 0 var(--ink); min-height: 2.6rem; }
.chip-stars svg { width: 1.4rem; height: 1.4rem; color: var(--sun); }

/* ------------------------------------------------------------------ island path */
.scr-island .bg-layer { position: absolute; inset: 0; pointer-events: none; }
.scr-island .bg-layer .plx { transition: transform .3s ease-out; }
.scr-island .bg-layer > svg { width: 100%; height: 100%; display: block; }
.isl-title { position: absolute; left: 50%; top: 12px; transform: translateX(-50%); z-index: 6; font-size: clamp(1.4rem, 3.4vw, 2.2rem); white-space: nowrap; }
.isl-path { position: absolute; inset: 0; z-index: 4; }
.isl-path svg.trail { position: absolute; inset: 0; width: 100%; height: 100%; }
.stn { position: absolute; transform: translate(-50%, -50%); width: clamp(118px, 15vw, 160px); display: flex; flex-direction: column; align-items: center; gap: .3rem; background: none; border: 0; padding: 0; cursor: pointer; }
.stn .stn-disc { width: clamp(96px, 12vw, 128px); aspect-ratio: 1; border-radius: 50%; background: #FFF6E3; border: 4px solid var(--ink); box-shadow: 0 6px 0 var(--ink); display: flex; align-items: center; justify-content: center; position: relative; transition: transform .2s var(--ease-pop); }
.stn .stn-disc > svg { width: 64%; height: 64%; }
.stn.is-open .stn-disc { background: #fff; }
.stn.is-next .stn-disc { animation: stn-glow 1.6s ease-in-out infinite; }
@keyframes stn-glow { 50% { box-shadow: 0 6px 0 var(--ink), 0 0 0 9px rgba(255, 229, 138, .9), 0 0 30px 10px rgba(255, 197, 61, .6); } }
.stn:active .stn-disc { transform: translateY(4px); }
.stn.is-locked .stn-disc { background: #DCDDE6; filter: saturate(.3); }
.stn .stn-lock { position: absolute; right: -6px; bottom: -6px; width: 40px; height: 40px; border-radius: 50%; background: #fff; border: 3px solid var(--ink); display: flex; align-items: center; justify-content: center; }
.stn .stn-lock svg { width: 60%; height: 60%; }
.stn .stn-name { background: #fff; border: 3px solid var(--ink); border-radius: 999px; padding: .05rem .7rem; font-weight: 900; font-size: 1rem; white-space: nowrap; box-shadow: 0 3px 0 var(--ink); }
.stn .tk-stars svg { width: 1.45rem; height: 1.45rem; }
.isl-friend { position: absolute; z-index: 3; width: clamp(90px, 13vw, 150px); }
.isl-friend > svg { width: 100%; height: auto; display: block; filter: var(--sticker); }
.isl-tika { position: absolute; left: calc(10px + env(safe-area-inset-left)); bottom: calc(10px + env(safe-area-inset-bottom)); z-index: 8; display: flex; align-items: flex-end; gap: 8px; max-width: min(600px, calc(100vw - 20px)); pointer-events: none; }
.isl-tika .tika { width: clamp(70px, 10vw, 104px); flex: 0 0 auto; pointer-events: auto; }
.isl-tika .tk-bubble { margin-bottom: 20px; font-size: clamp(.95rem, 2vw, 1.2rem); }
[data-layout="short"] .stn { width: 112px; }
[data-layout="short"] .stn .stn-disc { width: 84px; }
[data-layout="short"] .isl-title { font-size: 1.3rem; top: 8px; }
[data-layout="short"] .isl-tika .tk-bubble { font-size: .9rem; padding: .35rem .7rem; margin-bottom: 8px; }

/* ------------------------------------------------------------------ station */
.scr-station { display: grid; gap: 8px; padding: calc(6px + env(safe-area-inset-top)) calc(8px + env(safe-area-inset-right)) calc(8px + env(safe-area-inset-bottom)) calc(8px + env(safe-area-inset-left)); }
.scr-station > .bg { z-index: 0; }
.scr-station > *:not(.bg) { position: relative; z-index: 1; min-width: 0; min-height: 0; }
.st-top { grid-area: top; display: flex; align-items: center; gap: .6rem; padding: 0 2px; }
.st-top .st-name { font-weight: 1000; font-size: 1.15rem; padding: .25rem .8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 0 1 auto; }
.st-top .ctl { margin-left: auto; display: flex; align-items: center; gap: .45rem; flex: 0 0 auto; }
.beads { display: flex; align-items: center; gap: 6px; padding: 4px 10px; flex: 0 0 auto; }
.bead { width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--ink); background: #fff; transition: background-color .3s, transform .3s var(--ease-pop); }
.bead.is-done { background: var(--mango); box-shadow: 0 0 10px 3px rgba(255, 229, 138, .9); }
.bead.is-now { background: var(--glow); transform: scale(1.25); }
.bead.is-nut { border-radius: 40% 40% 50% 50%; background: #E7D3B6; }
.bead.is-nut.is-done { background: #C98952; }
.st-tika { grid-area: tika; display: flex; min-height: 0; min-width: 0; }
.st-tika .tika-slot { flex: 0 0 auto; position: relative; }
.st-tika .tika { width: 100%; }
.st-bubble { position: relative; background: #fff; border: 3px solid var(--ink); border-radius: 22px; box-shadow: 0 4px 0 var(--ink); padding: .55rem .75rem; font-weight: 800; line-height: 1.24; font-size: var(--bfs, 20px); overflow: hidden; min-height: 0; display: flex; align-items: center; }
.st-bubble[hidden] { display: flex !important; visibility: hidden; }
.st-bubble::before { content: ""; position: absolute; width: 16px; height: 16px; background: #fff; border-left: 3px solid var(--ink); border-top: 3px solid var(--ink); }
.st-helpers { display: flex; gap: 10px; justify-content: center; flex: 0 0 auto; }
.help-btn { width: 64px; height: 64px; border-radius: 20px; border: 3px solid var(--ink); background: #fff; box-shadow: 0 4px 0 var(--ink); display: inline-flex; align-items: center; justify-content: center; padding: 6px; cursor: pointer; flex: 0 0 auto; }
.help-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.help-btn > svg { width: 100%; height: 100%; }
.help-btn.tk-speaking { background: var(--sun); }
.st-slate { grid-area: slate; }
.st-scene { grid-area: scene; position: relative; }
.st-tray { grid-area: tray; display: flex; align-items: stretch; justify-content: flex-end; gap: 10px; }
.tray-box { flex: 1 1 auto; min-width: 0; position: relative; display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; padding: 8px 10px; background: rgba(255, 246, 227, .92); border: 3px solid var(--ink); border-radius: 22px; box-shadow: 0 4px 0 var(--ink); }
.tray-box:empty { display: none; }
.ans-box { flex: 0 1 auto; min-width: 0; display: flex; align-items: center; justify-content: center; padding: 6px 10px; background: rgba(255, 246, 227, .96); border: 3px solid var(--ink); border-radius: 22px; box-shadow: 0 4px 0 var(--ink); }
.ans-box:empty { display: none; }
.ans-box.is-wide { flex: 1 1 auto; }
.lampica { flex: 0 0 auto; align-self: center; width: 84px; height: 84px; border-radius: 50%; border: 4px solid var(--ink); background: #4A4F78; box-shadow: 0 5px 0 var(--ink); display: flex; align-items: center; justify-content: center; padding: 8px; cursor: pointer; transition: background-color .3s, filter .3s; }
.lampica > svg { width: 100%; height: 100%; filter: grayscale(.7) brightness(.8); transition: filter .3s; }
.lampica.is-ready { background: #FFF1B8; }
.lampica.is-ready > svg { filter: none; }
.lampica.is-ready .lamp-halo { opacity: .6; }
.lampica.is-pulse { animation: lamp-pulse 1.2s ease-in-out infinite; }
@keyframes lamp-pulse { 50% { box-shadow: 0 5px 0 var(--ink), 0 0 0 10px rgba(255, 229, 138, .8), 0 0 30px 12px rgba(255, 197, 61, .7); } }
.lampica:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--ink); }
.lampica[hidden] { display: none; }
.lampica.is-off { visibility: hidden; }

/* land */
[data-layout="land"] .scr-station { grid-template-columns: clamp(176px, 19vw, 230px) minmax(0, 1fr); grid-template-rows: 58px auto minmax(0, 1fr) auto; grid-template-areas: "top top" "tika slate" "tika scene" "tika tray"; }
[data-layout="land"] .st-tika { flex-direction: column; gap: 10px; align-items: stretch; }
[data-layout="land"] .st-tika .tika-slot { width: clamp(118px, 13vw, 150px); align-self: center; }
[data-layout="land"] .st-bubble { flex: 0 1 auto; max-height: 15.5em; min-height: 4em; --bfs: clamp(17px, 1.75vw, 21px); }
[data-layout="land"] .st-bubble::before { left: 50%; top: -10px; margin-left: -8px; transform: rotate(45deg); }
[data-layout="land"] .tray-box, [data-layout="land"] .ans-box { min-height: clamp(104px, 16vh, 136px); }
/* port */
[data-layout="port"] .scr-station { grid-template-columns: minmax(0, 1fr); grid-template-rows: 54px clamp(92px, 13vh, 150px) auto minmax(0, 1fr) auto; grid-template-areas: "top" "tika" "slate" "scene" "tray"; gap: 6px; }
[data-layout="port"] .st-tika { flex-direction: row; gap: 8px; align-items: stretch; }
[data-layout="port"] .st-tika .tika-slot { height: 100%; aspect-ratio: 164 / 208; }
[data-layout="port"] .st-tika .tika-slot .tika { height: 100%; width: auto; }
[data-layout="port"] .st-bubble { flex: 1 1 auto; --bfs: clamp(15px, 2.3vw, 19px); }
[data-layout="port"] .st-bubble::before { left: -10px; top: 50%; margin-top: -8px; transform: rotate(-45deg); }
[data-layout="port"] .st-helpers { flex-direction: column; justify-content: center; gap: 6px; }
[data-layout="port"] .help-btn { width: 56px; height: 56px; border-radius: 16px; padding: 5px; }
[data-layout="port"] .tray-box, [data-layout="port"] .ans-box { min-height: clamp(96px, 13vh, 150px); }
[data-layout="port"] .lampica { width: 76px; height: 76px; }
[data-layout="port"] .st-top .st-name { display: none; }
/* short (phone landscape) */
[data-layout="short"] .scr-station { grid-template-columns: 128px minmax(0, 1fr) auto; grid-template-rows: auto minmax(0, 1fr); grid-template-areas: "tika slate tray" "tika scene tray"; gap: 6px; padding-top: calc(4px + env(safe-area-inset-top)); padding-bottom: calc(4px + env(safe-area-inset-bottom)); }
[data-layout="short"] .st-top { display: none; }
[data-layout="short"] .st-tika { flex-direction: column; gap: 4px; align-items: center; }
[data-layout="short"] .st-tika .rail-top { display: flex; gap: 6px; }
[data-layout="short"] .st-tika .tika-slot { width: 74px; }
[data-layout="short"] .st-bubble { width: 100%; flex: 1 1 auto; --bfs: 14px; padding: .3rem .45rem; border-radius: 14px; line-height: 1.2; }
[data-layout="short"] .st-bubble::before { left: 50%; top: -10px; margin-left: -8px; transform: rotate(45deg); }
[data-layout="short"] .help-btn { width: 56px; height: 56px; border-radius: 16px; padding: 5px; }
[data-layout="short"] .st-helpers { gap: 6px; }
[data-layout="short"] .st-tray { flex-direction: column; max-width: 300px; min-height: 0; justify-content: center; }
[data-layout="short"] .tray-box { flex: 0 1 auto; min-height: 0; max-height: 100%; flex-direction: column; flex-wrap: wrap; align-content: center; justify-content: center; padding: 6px; gap: 6px; }
[data-layout="short"] .tray-box > * { flex: 0 0 auto; }
[data-layout="short"] .ans-box { padding: 4px 6px; }
[data-layout="short"] .lampica { width: 62px; height: 62px; padding: 6px; border-width: 3px; }
.rail-top { display: none; }
[data-layout="short"] .rail-top .tk-icon-btn { width: 56px; height: 56px; }
[data-layout="short"] .beads { gap: 4px; padding: 2px 6px; }
[data-layout="short"] .bead { width: 16px; height: 16px; border-width: 2.5px; }

/* the slate (tabla) */
.slate { position: relative; display: flex; align-items: center; gap: 10px; min-height: 58px; padding: 6px 14px; background: var(--board); border: 6px solid var(--wood); border-radius: 14px; box-shadow: 0 4px 0 var(--ink), inset 0 0 0 2px rgba(0, 0, 0, .25); color: var(--chalk); font-weight: 900; font-variant-numeric: tabular-nums; cursor: pointer; overflow: hidden; }
.slate-lines { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; justify-content: center; }
.slate-old { font-size: .78em; opacity: .45; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.15; }
.slate-cur { font-size: clamp(22px, 2.6vw, 32px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.2; letter-spacing: .02em; }
.slate-cur.is-new { animation: chalk .45s steps(12) both; }
@keyframes chalk { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
.slate-cur.is-glow { color: #FFF7C7; text-shadow: 0 0 12px rgba(255, 229, 138, .9); }
.slate .ghost { opacity: .45; }
.slate .strike { text-decoration: line-through; text-decoration-color: var(--orange); text-decoration-thickness: 3px; opacity: .6; }
.slate .fr { display: inline-flex; flex-direction: column; align-items: center; vertical-align: middle; line-height: 1; font-size: .72em; margin: 0 .1em; }
.slate .fr > i { font-style: normal; }
.slate .fr > i:first-child { border-bottom: 3px solid currentColor; padding: 0 .15em .05em; }
.slate .slate-goal { flex: 0 0 auto; display: flex; align-items: center; gap: 6px; }
.slate .dots10 { display: inline-grid; grid-template-columns: repeat(5, 9px); gap: 3px; vertical-align: middle; margin-left: .3em; }
.slate .dots10 i { width: 9px; height: 9px; border-radius: 50%; border: 1.5px solid var(--chalk); }
.slate .dots10 i.on { background: var(--glow); border-color: var(--glow); }
[data-layout="port"] .slate { min-height: clamp(52px, 7vh, 84px); }
[data-layout="short"] .slate { min-height: 44px; padding: 2px 10px; border-width: 4px; }
[data-layout="short"] .slate-cur { font-size: 22px; }
[data-layout="short"] .slate-old { display: none; }

/* answer inputs */
.strip { display: grid; gap: 6px; justify-content: center; align-content: center; }
.strip-tile { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; border: 3px solid var(--ink); border-radius: 14px; background: #fff; box-shadow: 0 3px 0 var(--ink); font-weight: 1000; font-size: var(--sfs, 24px); line-height: 1; cursor: pointer; padding: 2px; font-variant-numeric: tabular-nums; }
.strip-tile:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.strip-tile.is-on { background: var(--sun); transform: translateY(-3px) scale(1.06); box-shadow: 0 6px 0 var(--ink); }
.strip-tile .tf { display: grid; grid-template-columns: repeat(5, 5px); gap: 1.5px; }
.strip-tile .tf i { width: 5px; height: 5px; border-radius: 50%; border: 1px solid var(--ink-2); }
.strip-tile .tf i.on { background: var(--mango); border-color: var(--ink); }
.dials { display: flex; gap: 8px; align-items: center; justify-content: center; }
.dial-group { display: flex; gap: 6px; align-items: center; }
.dial-group + .dial-group { margin-left: 8px; padding-left: 12px; border-left: 3px dashed var(--ink-3); }
.dial-label { font-weight: 1000; font-size: .95rem; writing-mode: horizontal-tb; text-align: center; max-width: 5.5em; }
.dial { display: flex; flex-direction: column; align-items: center; width: 60px; touch-action: none; }
.dial-btn { width: 60px; height: 46px; border: 3px solid var(--ink); background: #fff; box-shadow: 0 3px 0 var(--ink); border-radius: 14px; display: flex; align-items: center; justify-content: center; cursor: pointer; padding: 0; }
.dial-btn svg { width: 26px; height: 26px; }
.dial-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.dial-win { position: relative; width: 56px; height: 58px; margin: 5px 0; border: 3px solid var(--ink); border-radius: 12px; background: var(--pvc, #fff); display: flex; align-items: center; justify-content: center; font-weight: 1000; font-size: 38px; font-variant-numeric: tabular-nums; cursor: ns-resize; box-shadow: inset 0 -6px 0 rgba(0, 0, 0, .08); }
.dial-win.is-lead { color: rgba(36, 38, 59, .3); }
.dial-win.is-focus { outline: 4px solid var(--orange); outline-offset: 2px; }
.dial-win .pvi { position: absolute; top: -9px; left: -9px; width: 20px; height: 20px; background: #fff; border-radius: 50%; border: 2px solid var(--ink); padding: 0; z-index: 2; }
.dial-win .pvi > svg { width: 100%; height: 100%; }
.dials.is-compact .dial-btn { height: 40px; }
.dials.is-compact .dial-win { height: 50px; font-size: 32px; }
.frac-dials { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.frac-row { display: flex; align-items: center; gap: 8px; }
.frac-row .dial-btn { width: 52px; height: 48px; }
.frac-row .dial-win { width: 58px; height: 48px; margin: 0; font-size: 32px; }
.frac-bar { width: 80px; height: 6px; border-radius: 3px; background: var(--ink); }
.verdict { display: flex; gap: 18px; justify-content: center; }
.verdict-btn { display: flex; flex-direction: column; align-items: center; gap: 2px; width: 120px; padding: 6px; border: 4px solid var(--ink); border-radius: 22px; background: #fff; box-shadow: 0 5px 0 var(--ink); font-weight: 1000; font-size: 1.1rem; cursor: pointer; }
.verdict-btn svg { width: 66px; height: 66px; }
.verdict-btn:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--ink); }
[data-layout="short"] .verdict-btn { width: 96px; font-size: .95rem; }
[data-layout="short"] .verdict-btn svg { width: 48px; height: 48px; }
[data-layout="short"] .verdict { flex-direction: column; gap: 8px; }
.ans-slot { min-width: 64px; height: 64px; border: 3px dashed var(--ink-2); border-radius: 16px; display: flex; align-items: center; justify-content: center; font-size: 34px; font-weight: 1000; background: #fff; margin-right: 6px; }

/* ghost wand */
.ghost-wand { position: fixed; left: 0; top: 0; width: 64px; height: 64px; z-index: 8000; pointer-events: none; opacity: 0; transition: opacity .2s; filter: drop-shadow(0 0 10px rgba(255, 229, 138, .9)); }
.ghost-wand.is-on { opacity: 1; }
.ghost-wand svg { width: 100%; height: 100%; }
.ghost-wand.is-tap svg { animation: wand-tap .35s ease; }
@keyframes wand-tap { 50% { transform: scale(.82) translateY(6px); } }

/* feather */
.feather-btn { position: absolute; width: 56px; height: 56px; border: 0; background: none; padding: 0; cursor: pointer; z-index: 3; animation: sway 2.6s ease-in-out infinite; transform-origin: 50% 90%; }
.feather-btn > svg { width: 100%; height: 100%; filter: drop-shadow(0 0 8px rgba(255, 255, 255, .8)); }
@keyframes sway { 50% { transform: rotate(14deg); } }

/* overlays: station end, island saved, nut offer, band offer, finale */
.ovl { position: fixed; inset: 0; z-index: 7000; display: flex; align-items: center; justify-content: center; padding: 14px; background: rgba(27, 34, 64, .55); animation: tk-fade .25s ease both; }
.ovl-card { position: relative; max-width: min(640px, 94vw); max-height: 92%; padding: 18px 22px 20px; background: #FFF6E3; border: 4px solid var(--ink); border-radius: 30px; box-shadow: 0 8px 0 var(--ink); text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; animation: tk-modal-in .35s var(--ease-pop) both; overflow: hidden; }
.ovl-card h2 { margin: 0; font-size: clamp(1.4rem, 3.2vw, 2rem); font-weight: 1000; line-height: 1.1; }
.ovl-row { display: flex; gap: 14px; align-items: center; justify-content: center; flex-wrap: wrap; }
.ovl-tika { width: 120px; }
.ovl-friend { width: 110px; }
.ovl-friend > svg { width: 100%; height: auto; }
.end-stars { display: flex; gap: 12px; align-items: flex-end; justify-content: center; }
.end-star { width: 64px; height: 64px; position: relative; }
.end-star svg { width: 100%; height: 100%; }
.end-star.is-off svg path { fill: #E7E3D6; }
.end-star.is-in { animation: star-in .55s var(--ease-pop) both; }
@keyframes star-in { from { transform: scale(0) rotate(-120deg); } }
.end-star .why { position: absolute; left: 50%; bottom: -6px; transform: translateX(-50%); width: 28px; height: 28px; background: #fff; border: 2px solid var(--ink); border-radius: 50%; padding: 2px; }
.end-star .why svg { width: 100%; height: 100%; }
.ovl-btns { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
.ovl-btns .tk-btn { min-height: 64px; font-size: 1.2rem; }
.yes-no { display: flex; gap: 16px; }
.yes-no .tk-btn { min-width: 140px; min-height: 72px; font-size: 1.3rem; }
[data-layout="short"] .ovl-card { flex-direction: row; flex-wrap: wrap; max-width: 96vw; padding: 10px 16px; gap: 8px; }
[data-layout="short"] .ovl-card h2 { width: 100%; font-size: 1.3rem; }
[data-layout="short"] .ovl-tika { width: 84px; }
[data-layout="short"] .ovl-friend { width: 80px; }
[data-layout="short"] .ovl-btns .tk-btn { min-height: 56px; }
.saved-ovl { background: rgba(14, 20, 44, .82); }
.saved-ovl .lh-mini { position: absolute; right: 8%; top: 8%; width: clamp(90px, 14vw, 150px); }
.saved-ovl .lh-mini svg { width: 100%; height: auto; }
.saved-digit { position: absolute; width: 120px; height: 128px; z-index: 2; }
.saved-digit svg { width: 100%; height: 100%; filter: drop-shadow(0 0 18px rgba(255, 229, 138, .95)); }
.saved-text { position: absolute; left: 50%; bottom: 12%; transform: translateX(-50%); width: min(90vw, 700px); text-align: center; font-size: clamp(1.4rem, 3.6vw, 2.4rem); }

/* ------------------------------------------------------------------ book */
.scr-book { background: #6B4A2E; }
.book { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(96vw, 1000px); height: min(calc(var(--app-h) - 90px), 680px); margin-top: 30px; background: #FFF6E3; border: 5px solid var(--ink); border-radius: 26px; box-shadow: 0 10px 0 #2E1E10; display: flex; flex-direction: column; overflow: hidden; }
.book-tabs { display: flex; gap: 6px; padding: 10px 10px 0; flex-wrap: wrap; }
.book-tab { flex: 1 1 0; min-height: 56px; border: 3px solid var(--ink); border-bottom: 0; border-radius: 16px 16px 0 0; background: #F0DDB8; font-weight: 1000; font-size: 1.05rem; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: .4rem; padding: 4px 6px; }
.book-tab[aria-selected="true"] { background: #fff; transform: translateY(2px); }
.book-tab svg { width: 28px; height: 28px; }
.book-page { flex: 1 1 auto; min-height: 0; border-top: 3px solid var(--ink); background: #fff; padding: 14px; display: flex; flex-direction: column; }
.book-grid { flex: 1 1 auto; min-height: 0; display: grid; gap: 10px; align-content: center; justify-content: center; }
.book-cell { border: 3px solid var(--ink); border-radius: 18px; background: #FFF6E3; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 6px; cursor: pointer; font-weight: 900; font-size: .95rem; text-align: center; min-height: 0; overflow: hidden; }
.book-cell > svg { width: 100%; height: auto; max-height: calc(100% - 1.6em); flex: 1 1 auto; min-height: 0; }
.book-cell.is-off { background: #EEF0F6; color: var(--ink-3); }
.book-cell.is-off > svg { filter: grayscale(1) brightness(1.2) opacity(.35); }
.book-pager { display: flex; justify-content: center; align-items: center; gap: 12px; padding-top: 8px; }
.book-digits { flex: 1 1 auto; min-height: 0; display: flex; align-items: center; justify-content: center; gap: 20px; }
.book-digits .lh { height: 100%; max-height: 420px; }
.book-digits .lh svg { height: 100%; width: auto; }
[data-layout="short"] .book { height: calc(var(--app-h) - 70px); margin-top: 26px; }
[data-layout="short"] .book-tab { min-height: 48px; font-size: .95rem; }
[data-layout="short"] .book-page { padding: 8px; }

/* ------------------------------------------------------------------ parents */
.scr-parents { background: #EEF2F7; }
.par { position: absolute; inset: 0; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; padding: 12px 14px 12px; gap: 10px; }
.par-head { display: flex; align-items: center; gap: 10px; }
.par-head h1 { margin: 0; font-size: 1.5rem; font-weight: 1000; }
.par-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.par-body { background: #fff; border: 3px solid var(--ink); border-radius: 20px; padding: 14px; min-height: 0; overflow: hidden; display: flex; flex-direction: column; gap: 10px; font-size: .98rem; }
.par-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.par-row .lbl { font-weight: 900; min-width: 7.5em; }
.seg { display: inline-flex; border: 3px solid var(--ink); border-radius: 14px; overflow: hidden; }
.seg button { border: 0; background: #fff; font-weight: 900; padding: .45rem .8rem; min-height: 44px; min-width: 44px; cursor: pointer; }
.seg button + button { border-left: 2px solid var(--ink); }
.seg button[aria-pressed="true"] { background: var(--sun); }
.skills { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
.skill { border: 2px solid var(--ink-3); border-radius: 12px; padding: 4px 8px; font-size: .86rem; line-height: 1.25; }
.skill b { display: block; font-size: .92rem; }
.rung { letter-spacing: .1em; color: var(--go); }
.par-about { font-size: .9rem; color: var(--ink-2); line-height: 1.35; }
.par-about a { color: var(--sky); font-weight: 900; }
.par-pager { display: flex; justify-content: center; gap: 10px; }

/* ------------------------------------------------------------------ finale */
.fin { position: fixed; inset: 0; z-index: 7500; background: var(--night); overflow: hidden; }
.fin .bg > svg { width: 100%; height: 100%; }
.fin-lh { position: absolute; left: 50%; bottom: 6%; transform: translateX(-50%); height: 72%; }
.fin-lh svg { height: 100%; width: auto; }
.fin-zb { position: absolute; left: 12%; bottom: 18%; width: clamp(90px, 14vw, 150px); }
.fin-tika { position: absolute; right: 10%; bottom: 14%; width: clamp(110px, 15vw, 170px); }
.fin-cap { position: absolute; left: 50%; top: 4%; transform: translateX(-50%); width: min(92vw, 820px); font-size: clamp(1rem, 2.4vw, 1.4rem); }
.fin-skip { position: absolute; right: 14px; bottom: 14px; z-index: 3; }
.fin-ship { position: absolute; bottom: 9%; width: 90px; animation: ship-in 6s ease-out both; }
@keyframes ship-in { from { transform: translateX(-60vw); } }
.fw { position: absolute; font-weight: 1000; font-size: 44px; color: var(--glow); text-shadow: 0 0 16px #FF9636; animation: fw 1.6s ease-out both; pointer-events: none; }
@keyframes fw { from { transform: translateY(80px) scale(.3); opacity: 0; } 30% { opacity: 1; } to { transform: translateY(-40px) scale(1.4); opacity: 0; } }

/* ------------------------------------------------------------------ svetionik hub */
.lh-hub .lh-big { position: absolute; left: 50%; bottom: 4%; transform: translateX(-50%); height: 78%; z-index: 2; pointer-events: none; }
.lh-hub .lh-big svg { height: 100%; width: auto; }
.lh-brojko { position: absolute; z-index: 3; width: clamp(80px, 11vw, 130px); }
.lh-brojko svg { width: 100%; height: auto; filter: var(--sticker); }

/* ------------------------------------------------------------------ reduced motion */
html[data-motion="reduce"] *, html[data-motion="reduce"] *::before, html[data-motion="reduce"] *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .15s !important; }
@media (prefers-reduced-motion: reduce) {
  html:not([data-motion="full"]) *, html:not([data-motion="full"]) *::before, html:not([data-motion="full"]) *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .15s !important; }
}

/* book: digits list + Tika in the header strip */
.book { top: auto; bottom: 10px; transform: translateX(-50%); margin-top: 0; height: min(calc(var(--app-h) - 92px), 660px); }
.book-dlist { display: grid; grid-template-columns: repeat(2, minmax(0, auto)); gap: 4px 18px; align-content: center; }
.book-drow { display: flex; align-items: center; gap: 8px; font-weight: 900; font-size: .95rem; }
.book-drow .dg { width: 38px; height: 42px; flex: 0 0 auto; }
.book-drow .dg svg { width: 100%; height: 100%; }
.book-drow.is-off { opacity: .55; }
.book-digits .lh { height: 100%; max-height: 100%; display: flex; }
.book-tika { left: 84px; top: 6px; bottom: auto; align-items: center; max-width: calc(100vw - 330px); }
.book-tika .tika { width: 56px; }
.book-tika .tk-bubble { margin: 0; font-size: .95rem; padding: .35rem .7rem; }
[data-layout="port"] .book-tika { max-width: calc(100vw - 150px); }
[data-layout="port"] .book-tika .tk-bubble { font-size: .85rem; }
[data-layout="short"] .book { height: calc(var(--app-h) - 74px); bottom: 6px; }
[data-layout="short"] .book-tika .tika { width: 46px; }
[data-layout="port"] .book-digits { flex-direction: column; }
[data-layout="port"] .book-digits .lh { height: 46%; }
/* short landscape map: Tika gets her own column on the left, the chart moves right */
[data-layout="short"] .scr-map .fill { left: 172px; }
[data-layout="short"] .map-tika { flex-direction: column-reverse; align-items: flex-start; gap: 12px; max-width: 166px; }
[data-layout="short"] .map-tika .tk-bubble { margin-bottom: 0; }
[data-layout="short"] .map-tika .tk-bubble.tk-tail-left::after { left: 1.5rem; top: auto; bottom: -11px; margin: 0; border: 0; border-right: var(--line) solid var(--ink); border-bottom: var(--line) solid var(--ink); }
