@font-face { font-family: 'Fredoka'; font-style: normal; font-weight: 500; font-display: swap; src: url('../fonts/fredoka-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'Fredoka'; font-style: normal; font-weight: 600; font-display: swap; src: url('../fonts/fredoka-latin-600-normal.woff2') format('woff2'); }
/* Japanese: rounded font cut down to the characters the game uses (tools/build-fonts.py); system fonts cover anything new */
@font-face { font-family: 'RC Rounded JP'; font-style: normal; font-weight: 400 700; font-display: swap; src: url('../fonts/rc-rounded-jp.woff2') format('woff2'); }
@font-face { font-family: 'RC Rounded KR'; font-style: normal; font-weight: 400 700; font-display: swap; src: url('../fonts/rc-rounded-kr.woff2') format('woff2'); }
@font-face { font-family: 'RC Rounded ZH'; font-style: normal; font-weight: 400 700; font-display: swap; src: url('../fonts/rc-rounded-zh.woff2') format('woff2'); }
/* Russian: Nunito's Cyrillic set (Fredoka has no Cyrillic) */
@font-face { font-family: 'RC Rounded Cyrillic'; font-style: normal; font-weight: 700 900; font-display: swap; src: url('../fonts/rc-rounded-cyrillic.woff2') format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'RC Rounded Cyrillic'; font-style: normal; font-weight: 100 600; font-display: swap; src: url('../fonts/rc-rounded-cyrillic-600.woff2') format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'Fredoka'; font-style: normal; font-weight: 700; font-display: swap; src: url('../fonts/fredoka-latin-700-normal.woff2') format('woff2'); }
:root {
  --ol: #3a2a22;
  --font: 'Fredoka', 'Baloo 2', 'Arial Rounded MT Bold', 'Trebuchet MS', system-ui, sans-serif;
  --u: min(1vw, 1.78vh);           /* responsive unit (16:9 based) */
  --pk: 1;   /* set by game.js: 1 up to 1400x788, larger beyond (big screens) */
  --btn: clamp(46px, calc(var(--u) * 5.2), calc(76px * var(--pk)));
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
}
@media (pointer: fine) { :root { --btn: clamp(36px, calc(var(--u) * 5.2), calc(76px * var(--pk))); } }   /* mouse: small embeds keep room for the HUD */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #3fb4f0; font-family: var(--font); color: var(--ol);
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; touch-action: none; overscroll-behavior: none; }
#app { position: fixed; inset: 0; }
canvas#cv { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.hidden { display: none !important; }

/* ---------- Buttons ---------- */
.btn {
  font-family: var(--font); font-weight: 700; color: #fff;
  border: 2.5px solid var(--ol); border-radius: 16px; position: relative;
  box-shadow: 0 3px 0 var(--ol), inset 0 -4px 0 rgba(0,0,0,.12), inset 0 3px 0 rgba(255,255,255,.35);
  transition: transform .08s ease, box-shadow .08s ease, filter .15s, scale .28s cubic-bezier(.34,1.56,.64,1);
  text-shadow: 0 1.5px 0 rgba(0,0,0,.22);
  display: inline-flex; align-items: center; justify-content: center; gap: .35em;
  outline: none;
}
.btn svg { width: 1.1em; height: 1.1em; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; filter: drop-shadow(0 2px 0 rgba(0,0,0,.25)); }
.btn:hover { filter: brightness(1.06); box-shadow: 0 4px 0 var(--ol), inset 0 -4px 0 rgba(0,0,0,.12), inset 0 3px 0 rgba(255,255,255,.35); }
.btn:active, .btn.pressed { transform: translateY(3px); box-shadow: 0 0 0 var(--ol), inset 0 -2px 0 rgba(0,0,0,.12), inset 0 3px 0 rgba(255,255,255,.3); }
.btn-light { background: #fffaf0; color: var(--ol); text-shadow: none; }
.btn:focus-visible { outline: 3px solid rgba(255,255,255,.9); outline-offset: 3px; }
.btn[disabled] { filter: grayscale(.8) brightness(.9); opacity: .7; transform: none; scale: 1; }
/* smooth hover grow for everything clickable (scale property, so it stacks with pulse/intro animations) */
@media (hover: hover) {
  .btn:not([disabled]):hover { scale: 1.08; }
  .card:not(.locked):hover { scale: 1.05; z-index: 2; }
}
.btn:not([disabled]):active, .card:not(.locked):active, .btn.pressed:not([disabled]), .card.pressed:not(.locked), .lang-arrow.pressed, .toggle.pressed { scale: .97; transition-duration: .08s; }
.btn-green  { background: linear-gradient(#8ff062, #3fb93a); }
.btn-blue   { background: linear-gradient(#6fd3ff, #2e95e0); }
.btn-yellow { background: linear-gradient(#ffe066, #f5a623); }
.btn-orange { background: linear-gradient(#ffb56b, #f06a2e); }
.btn-pink   { background: linear-gradient(#ff9bb3, #ec4d77); }
.btn-xl { font-size: clamp(28px, calc(var(--u) * 4.4), 60px); padding: .3em 1.4em .35em; border-radius: 26px; border-width: 3px; box-shadow: 0 5px 0 var(--ol), inset 0 -5px 0 rgba(0,0,0,.12), inset 0 4px 0 rgba(255,255,255,.35); }
.btn-icon { width: var(--btn); height: var(--btn); border-radius: 50%; padding: 0; font-size: calc(var(--btn) * .5); }
.btn-icon svg { width: 1em; height: 1em; }
.btn-md { font-size: clamp(18px, calc(var(--u) * 2.3), 30px); padding: .45em 1.1em .5em; }

/* ---------- Screens ---------- */
.screen { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
#title { background: radial-gradient(ellipse at center, rgba(255,255,255,0) 40%, rgba(20,60,110,.25) 100%); gap: calc(var(--u) * 4); padding-bottom: 8vh; }
.logo { text-align: center; animation: logoIn .9s cubic-bezier(.2,1.6,.4,1) both; }
.logo-main { display: flex; flex-direction: column; line-height: .88; }
.logo-main span {
  font-size: clamp(52px, calc(var(--u) * 9.5), 132px); font-weight: 700; color: #ffd23f;
  -webkit-text-stroke: calc(var(--u) * .5) var(--ol); paint-order: stroke fill;
  /* 3D depth: drop-shadow filters, not text-shadow (Safari drops text-shadow on stroked text) */
  -webkit-filter: drop-shadow(0 calc(var(--u) * .8) 0 var(--ol)) drop-shadow(0 calc(var(--u) * .6) 0 rgba(0,0,0,.18));
  filter: drop-shadow(0 calc(var(--u) * .8) 0 var(--ol)) drop-shadow(0 calc(var(--u) * .6) 0 rgba(0,0,0,.18));
  letter-spacing: .02em; display: inline-block; animation: wobble 3.2s ease-in-out infinite;
}
.logo-main span:nth-child(2) { color: #6fe0ff; animation-delay: -1.6s; }
.logo-small { display: inline-block; background: #ff6b6b; color: #fff; font-weight: 700; padding: .2em .9em; border-radius: 999px;
  border: 4px solid var(--ol); font-size: clamp(16px, calc(var(--u) * 2.2), 30px); box-shadow: 0 5px 0 var(--ol); margin-bottom: .6em; transform: rotate(-3deg); }
#btnPlay { animation: pulse 1.6s ease-in-out infinite; }
#btnPlay svg { fill: currentColor; stroke-width: 2; }
@keyframes logoIn { from { transform: scale(.3) translateY(-60px); } }
@keyframes wobble { 0%,100% { transform: rotate(-2deg) translateY(0); } 50% { transform: rotate(2deg) translateY(-6px); } }
@keyframes pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.07); } }

/* ---------- Level select ---------- */
#levels { background: rgba(20, 70, 120, .35); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); justify-content: flex-start;
  padding: calc(var(--safe-t) + 2vh) calc(var(--safe-r) + 3vw) 3vh calc(var(--safe-l) + 3vw); gap: 3vh; }
.levels-head { width: 100%; display: flex; align-items: center; justify-content: space-between; }
.ribbon { margin: 0; font-size: clamp(24px, calc(var(--u) * 4), calc(52px * var(--pk))); color: #fff; background: linear-gradient(#ff8a5b, #e8553a);
  border: 2.5px solid var(--ol); border-radius: 20px; padding: .1em 1em .18em; box-shadow: 0 3px 0 var(--ol);
  text-shadow: 0 2px 0 rgba(0,0,0,.3); }
.hint-wallet { display: flex; align-items: center; gap: .3em; background: #fff7e1; border: 2.5px solid var(--ol); border-radius: 999px; padding: .2em .8em .2em .4em;
  font-weight: 700; font-size: clamp(18px, calc(var(--u) * 2.4), calc(30px * var(--pk))); box-shadow: 0 3px 0 var(--ol); }
.hint-wallet svg { width: 1.3em; height: 1.3em; fill: #ffd23f; stroke: var(--ol); stroke-width: 2; }
.levels-body { flex: 1; min-height: 0; width: 100%; display: flex; align-items: center; justify-content: center; gap: clamp(8px, 1.5vw, 20px); }
.pg-btn { flex: none; }
.pg-btn.invisible { visibility: hidden; }
.pg-dots { justify-content: center; min-height: 14px; }
.level-grid { display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(2, 1fr); column-gap: clamp(12px, 3vw, 44px); row-gap: clamp(26px, 5vh, 54px);
  flex: 0 1 calc(1060px * var(--pk)); min-width: 0; height: min(100%, calc(640px * var(--pk))); padding-top: clamp(14px, 2.4vh, 22px); }
.soon-card { grid-column: 1 / -1; grid-row: 1 / -1; display: flex; align-items: stretch; gap: clamp(12px, 2.5vw, 32px); min-height: 0;
  background: #fffaf0; border: 2.5px solid var(--ol); border-radius: 26px; box-shadow: 0 4px 0 var(--ol); padding: clamp(8px, 1.4vw, 16px); animation: cardIn .45s cubic-bezier(.2,1.5,.4,1) both; color: var(--ol); }
.soon-card .pic { position: relative; flex: 1.2; min-height: 0; border-radius: 18px; overflow: hidden; border: 2px solid var(--ol); background: #bfeaff; }
.soon-card canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.soon-text { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: .5em; padding-right: .6em; }
.soon-text { --k: 1; }
.soon-text h2 { margin: 0; font-size: calc(clamp(22px, calc(var(--u) * 4), 50px) * var(--k)); line-height: 1.05; color: #e8553a; }
.soon-text p { margin: 0; font-size: calc(clamp(14px, calc(var(--u) * 2), 24px) * var(--k)); font-weight: 600; opacity: .8; }
.soon-text .soon-prog { font-size: calc(clamp(12px, calc(var(--u) * 1.6), 19px) * var(--k)); opacity: .65; }
@media (orientation: portrait) { .soon-card { flex-direction: column; } .soon-text { text-align: center; padding: 0 .4em .6em; } }
.card { position: relative; min-height: 0; border: 2.5px solid var(--ol); border-radius: 22px; background: #fffaf0; box-shadow: 0 4px 0 var(--ol);
  display: flex; flex-direction: column; padding: 0; overflow: visible;
  font-family: var(--font); color: var(--ol); transition: transform .12s, scale .3s cubic-bezier(.34,1.56,.64,1), box-shadow .2s; animation: cardIn .45s cubic-bezier(.2,1.5,.4,1) both; }
.card:not(.locked):hover { box-shadow: 0 7px 0 var(--ol); }
.card:active, .card.pressed { transform: translateY(2px); box-shadow: 0 1px 0 var(--ol); }
.card .pic { position: relative; flex: 1; min-height: 0; margin: 6px; border-radius: 16px; overflow: hidden; border: 2px solid var(--ol); background: #bfeaff;
  container-type: size; }
.card canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.card .tab { position: absolute; top: 0; left: 50%; transform: translate(-50%, -58%); z-index: 3; white-space: nowrap;
  background: linear-gradient(#ffb56b, #f06a2e); color: #fff; border: 2.5px solid var(--ol); border-radius: 12px; box-shadow: 0 2px 0 var(--ol);
  font-weight: 700; font-size: clamp(13px, min(calc(var(--u) * 2.2), 8cqw), calc(26px * var(--pk))); padding: .02em .8em .08em; text-shadow: 0 1.5px 0 rgba(0,0,0,.25); }
/* level name sits on the picture's bottom edge: white text with the game's dark outline over a soft shade */
.card .cap { position: absolute; left: 0; right: 0; bottom: 0; z-index: 2; display: flex; justify-content: center; pointer-events: none;
  padding: 1.1em .45em .3em; background: linear-gradient(rgba(40,25,15,0), rgba(40,25,15,.42)); }
.card .name { font-weight: 700; font-size: clamp(12px, 7.2cqw, calc(20px * var(--pk))); line-height: 1.05; color: #fff; text-align: center;
  -webkit-text-stroke: .2em var(--ol); paint-order: stroke fill; letter-spacing: .01em;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; }
/* status ("Best 7", "Play") as a sticker on the card's top-right corner, on the same line as the level tab */
.card { container-type: inline-size; }
.card > .status { position: absolute; top: 0; right: 7%; transform: translateY(-50%); z-index: 3; font-size: clamp(10px, 5.4cqw, calc(15px * var(--pk))); font-weight: 700; line-height: 1;
  padding: .22em .5em .26em; border-radius: 999px; background: #fff7e1; border: 2px solid var(--ol); color: var(--ol); white-space: nowrap; }
.card .status.play { background: #7fdc5a; color: #fff; -webkit-text-stroke: .18em var(--ol); paint-order: stroke fill; }
/* with a status sticker the level tab moves to the left so the two never touch; narrow cards show the tab only */
@container (min-width: 170px) { .card:has(> .status) .tab { left: 7%; transform: translate(0, -58%); } }
@container (max-width: 169.9px) { .card > .status { display: none; } }
.card.locked { background: #ece6da; }
.card.locked .tab { background: linear-gradient(#c9bfae, #a89c88); }
.card.locked canvas { filter: grayscale(1) contrast(.85) brightness(1.08); opacity: .75; }
.card.locked .name { opacity: .8; }
.card .lock { position: absolute; left: 50%; top: 42%; transform: translate(-50%, -50%); width: min(30cqw, 46cqh, 76px); height: auto; z-index: 2;   /* always inside the picture, above the name */
  fill: #ffffff; stroke: var(--ol); stroke-width: 1.6; filter: drop-shadow(0 3px 0 rgba(0,0,0,.18)); }
@keyframes cardIn { from { transform: scale(.4); } }

/* ---------- HUD ---------- */
#hud { position: absolute; inset: 0; pointer-events: none; }
#hud > div { position: absolute; display: flex; gap: clamp(8px, 1vw, 14px); pointer-events: none; }
#hud .btn, #hud .pill { pointer-events: auto; }
.hud-tl { top: calc(var(--safe-t) + 14px); left: calc(var(--safe-l) + 14px); }
.hud-tr { top: calc(var(--safe-t) + 14px); right: calc(var(--safe-r) + 14px); }
.hud-tc { top: calc(var(--safe-t) + 10px); left: 50%; translate: -50% 0; width: max-content; transform-origin: 50% 0; flex-direction: column; align-items: center; gap: 6px !important; }
.hud-bc { bottom: calc(var(--safe-b) + 18px); left: 50%; transform: translateX(-50%); }
.pill { background: #fff7e1; border: 2.5px solid var(--ol); border-radius: 999px; box-shadow: 0 2px 0 var(--ol); font-weight: 700; display: flex; align-items: center; gap: .3em;
  padding: .12em .8em .16em .45em; font-size: clamp(16px, calc(var(--u) * 2.2), calc(28px * var(--pk))); }
.pill svg { width: 1.2em; height: 1.2em; fill: none; stroke: var(--ol); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.pill .ico-star { fill: #ffd23f; }
.pill-row { display: flex; gap: 8px; }
.chapter-pill { background: linear-gradient(#ff8a5b, #e8553a); color: #fff; padding: .1em 1em .14em; font-size: clamp(13px, calc(var(--u) * 1.7), calc(22px * var(--pk)));
  display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: center; line-height: 1.15;
  text-shadow: 0 1.5px 0 rgba(0,0,0,.3); }
.moves-pill #movesVal { min-width: 1.6ch; text-align: right; }
.moves-pill .lbl { font-size: .62em; font-weight: 600; opacity: .7; text-transform: uppercase; letter-spacing: .04em; }
.moves-pill.bump { animation: bump .35s; }
@keyframes bump { 40% { transform: scale(1.18); } }
.badge { position: absolute; top: -8px; right: -10px; min-width: 1.6em; height: 1.6em; border-radius: 999px; background: #ff4d5e; color: #fff; border: 3px solid var(--ol);
  font-size: calc(var(--btn) * .26); display: grid; place-items: center; padding: 0 .3em; text-shadow: none; -webkit-text-stroke: 0; }
.btn-go { font-size: clamp(26px, calc(var(--u) * 3.8), calc(50px * var(--pk))); padding: .22em 1.3em .28em; border-radius: 999px; border-width: 3px; box-shadow: 0 4px 0 var(--ol), inset 0 -5px 0 rgba(0,0,0,.12), inset 0 4px 0 rgba(255,255,255,.35); }
.btn-go svg { stroke-width: 3.6; }
.btn-go.hinted { animation: pulse 1s ease-in-out infinite; }
@keyframes arrowBob { to { transform: translateY(12px); } }

/* ---------- Hint bar ---------- */
.hint-bar { display: flex; align-items: center; gap: .35em; background: #fffbe8; border: 2.5px solid var(--ol); border-radius: 18px; box-shadow: 0 3px 0 var(--ol);
  padding: .18em .7em .22em .5em; font-weight: 700; font-size: clamp(14px, calc(var(--u) * 1.9), calc(24px * var(--pk))); pointer-events: auto; animation: hintIn .3s cubic-bezier(.2,1.5,.4,1) both; }
.hint-bar.hidden { display: none; }
.hint-bar .hb-tag { background: #ffcc33; border: 2px solid var(--ol); border-radius: 999px; padding: 0 .5em; font-size: .72em; text-transform: uppercase; letter-spacing: .04em; }
.hint-bar .hb-ico { position: relative; width: 2.2em; height: 2.2em; transition: opacity .2s, transform .2s; }
.hint-bar .hb-ico canvas { width: 100%; height: 100%; display: block; }
.hint-bar .hb-ico.done { opacity: .45; transform: scale(.88); }
.hint-bar .hb-ico.done::after { content: ''; position: absolute; right: -2px; bottom: -2px; width: .9em; height: .9em; border-radius: 50%; border: 2px solid var(--ol);
  background: #5ecb4f url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M3 6.3l2 2 4-4.6' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat center/80%; }
.hint-bar .hb-arrow { width: 1.4em; height: 1.4em; flex: none; }
.hint-bar .hb-arrow path { fill: none; stroke: var(--ol); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.hint-bar .hb-dest { color: #2f7fd0; white-space: nowrap; }
.hint-bar .hb-step { font-size: .68em; font-weight: 600; opacity: .7; margin-left: .3em; white-space: nowrap; }
@keyframes hintIn { from { transform: translateY(-8px) scale(.9); } }

/* ---------- Toast ---------- */
#toast { position: absolute; left: 50%; top: calc(var(--safe-t) + 20%); transform: translate(-50%, -20px) scale(.9); opacity: 0; pointer-events: none;
  background: #fff; border: 4px solid var(--ol); border-radius: 20px; padding: .45em 1.1em; font-weight: 600; box-shadow: 0 5px 0 var(--ol);
  font-size: clamp(16px, calc(var(--u) * 2.3), calc(28px * var(--pk))); transition: all .25s cubic-bezier(.2,1.5,.4,1); width: max-content; max-width: min(92vw, 30em); text-align: center; line-height: 1.2; }
#toast.show { opacity: 1; transform: translate(-50%, 0) scale(1); }

/* ---------- Modal / panel ---------- */
.modal { position: absolute; inset: 0; background: rgba(18, 40, 70, .55); display: grid; place-items: center; animation: fadeIn .2s both; z-index: 20;
  padding: max(3vh, var(--safe-t)) max(3vw, var(--safe-r)) max(3vh, var(--safe-b)) max(3vw, var(--safe-l)); overflow: hidden; }
.panel { position: absolute; left: 50%; top: 50%; translate: -50% -50%; width: min(92vw, 600px); background: #fffaf0; border: 2.5px solid var(--ol); border-radius: 28px;
  box-shadow: 0 16px 40px rgba(10,30,60,.35); padding: 1.3em 1.6em 1.5em; text-align: center; animation: popIn .38s cubic-bezier(.2,1.5,.4,1) both;
  font-size: clamp(14px, calc(var(--u) * 1.9), 22px); display: flex; flex-direction: column; align-items: center; gap: .8em; }
.panel > * { flex-shrink: 0; }
.panel:has(> .close) > h2 { padding-inline: 42px; }   /* long titles never run under the close button */
.panel h2 { margin: 0; font-size: clamp(26px, calc(var(--u) * 3.6), 44px); font-weight: 700; color: #e8743a; letter-spacing: .01em; line-height: 1.1; }
.panel.good h2 { color: #3aa84a; }
.panel.bad h2 { color: #e0506e; }
.panel .sub { font-weight: 500; opacity: .75; font-size: .92em; }
.result-big { display: flex; flex-direction: column; align-items: center; line-height: 1; margin: .2em 0 .1em; }
.result-big .num { font-size: clamp(64px, calc(var(--u) * 10), 120px); font-weight: 700; color: var(--ol); }
.result-big .lbl { font-size: 1.05em; font-weight: 600; opacity: .6; text-transform: uppercase; letter-spacing: .08em; }
.panel p { margin: 0; font-weight: 600; line-height: 1.3; }
.panel .row { display: flex; gap: .8em; flex-wrap: wrap; justify-content: center; margin-top: .3em; }
.panel .close { position: absolute; top: 12px; right: 12px; width: 42px; height: 42px; font-size: 20px; border-radius: 50%; padding: 0; }
.panel .close svg { width: 1em; height: 1em; }
.help-canvas { width: 100%; aspect-ratio: 2.15; border: 2.5px solid var(--ol); border-radius: 18px; background: #bfeaff; display: block; }
.help-text { min-height: 2.8em; display: flex; align-items: center; justify-content: center; }
.help-nav { display: flex; align-items: center; gap: 1em; }
.help-nav .btn-icon { --btn: 52px; }
.dots { display: flex; gap: 8px; }
.dots i { width: 14px; height: 14px; border-radius: 50%; background: #d9cdb4; border: 3px solid var(--ol); display: block; transition: transform .2s; }
.dots i.on { background: #ff8a5b; transform: scale(1.25); }
.result-stars { display: flex; gap: .4em; margin-top: .2em; }
.result-stars svg { width: clamp(52px, calc(var(--u) * 8), 96px); height: auto; fill: #d9cdb4; stroke: var(--ol); stroke-width: 1.4; stroke-linejoin: round; }
.result-stars svg:nth-child(2) { transform: translateY(-14px) scale(1.15); }
.result-stars svg.on { fill: #ffd23f; animation: starPop .5s cubic-bezier(.2,1.8,.4,1) both; }
@keyframes starPop { from { transform: scale(0) rotate(-90deg); } }
.result-stars svg:nth-child(2).on { animation-name: starPop2; }
@keyframes starPop2 { from { transform: translateY(-14px) scale(0) rotate(-90deg); } to { transform: translateY(-14px) scale(1.15); } }
.stat-row { display: flex; gap: .7em; justify-content: center; flex-wrap: wrap; }
.stat { background: #fff; border: 3px solid var(--ol); border-radius: 14px; padding: .2em .8em; font-weight: 700; }
.stat small { display: block; font-size: .65em; opacity: .65; font-weight: 600; }
.newbest { color: #e8743a; font-weight: 700; opacity: 1; }
.unlocked { display: inline-flex; align-items: center; gap: .35em; margin: .5em auto 0; padding: .2em .8em .25em; border: 2.5px solid var(--ol); border-radius: 999px;
  background: #fff1b8; font-weight: 700; box-shadow: 0 3px 0 var(--ol); animation: popIn .45s .35s cubic-bezier(.2,1.6,.4,1) both; }
.unlocked .unlock-ico { width: 1.2em; height: 1.2em; fill: #ffd23f; stroke: var(--ol); stroke-width: 2.2; stroke-linejoin: round; stroke-linecap: round; }
.menu-col { display: flex; flex-direction: column; gap: .7em; width: min(100%, 320px); }
.menu-col .btn { width: 100%; }
@keyframes fadeIn { from { opacity: 0; } }
/* no opacity here: Chrome could leave a card stuck at an invisible first frame (seen ~1 in 50 openings under load);
   the backdrop's fade-in already softens the entrance */
@keyframes popIn { from { transform: scale(.5); } }

/* ---------- Rotate overlay ---------- */
#rotate { position: absolute; inset: 0; z-index: 50; background: linear-gradient(#3fb4f0, #1c6fb3); display: grid; place-items: center; color: #fff; }
.rotate-card { text-align: center; font-weight: 700; font-size: 24px; text-shadow: 0 3px 0 rgba(0,0,0,.25); }
.rot-phone { width: 96px; height: 96px; fill: #fff7e1; stroke: var(--ol); stroke-width: 3; animation: rot 1.8s ease-in-out infinite; }
@keyframes rot { 0%,20% { transform: rotate(0); } 60%,100% { transform: rotate(-90deg); } }

@media (max-height: 480px) {
  .level-grid { row-gap: 22px; column-gap: 14px; padding-top: 12px; }
  .card { border-radius: 14px; }
  .card .pic { border-radius: 10px; margin: 4px; }
  #levels { gap: 1.2vh; }
  .panel { padding-top: 2.4em; gap: .5em; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* GO arrow points in the direction the boat will travel */
.btn-go svg { transition: transform .25s ease; }
.btn-go.to-left svg { transform: scaleX(-1); order: 0; }
.btn-go.to-right svg { order: 2; }
.btn-go span { order: 1; }

.time-pill #timeVal { min-width: 2ch; text-align: right; }
.time-pill .lbl { font-size: .62em; font-weight: 600; opacity: .7; }
.time-pill.low { background: #ffe0e0; animation: pulse 1s ease-in-out infinite; }
.time-pill.low #timeVal { color: #d63a3a; }

/* ---------- level instructions (single screen) ---------- */
.panel.help { width: min(92vw, 640px); padding: 1em 1.4em 1.2em; gap: .55em; }
.help-level { font-weight: 600; font-size: .85em; opacity: .65; margin-top: -.45em; }
.panel.help .help-canvas { width: auto; height: min(34vh, 280px); max-width: 100%; margin: 0 auto; border-radius: 18px; }
.help-text { display: block; min-height: 0; font-size: 1.05em; line-height: 1.35; margin: 0; padding: 0 .3em; text-align: center; max-width: 34em; }
.help-tip { background: #fff3c4; border: 2px solid #e8b020; border-radius: 14px; padding: .4em .8em; font-weight: 600; font-size: .95em; }
.help-tip b { color: #c07a00; }
@media (max-height: 480px) {
  .panel.help { padding: .6em 1em .8em; gap: .35em; }
  .panel.help h2 { font-size: 24px; }
  .panel.help .help-canvas { height: 36vh; }
  .help-text { font-size: .9em; }
  .help-tip { font-size: .82em; padding: .25em .6em; }
}

/* filled HUD icons */
.btn svg.ico-fill { fill: currentColor; stroke: none; width: 1.05em; height: 1.05em; }
.btn svg.ico-gear { width: 1.08em; height: 1.08em; fill: currentColor; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; }
#btnUndo[disabled] { filter: grayscale(.6) brightness(.95); opacity: .55; }
.btn svg.ico-restart { width: 1em; height: 1em; }

/* island chapters: two direction buttons; board chapter: no GO */
.go-right { display: none !important; }
body.island .go-right { display: inline-flex !important; }
body.island .hud-bc { gap: clamp(16px, 4vw, 60px); }
body.board #btnGo { display: none; }

:root {
  --cur-default: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'%3E%3Cpath d='M4 3v22l6-5.5 4 8.5 4.5-2-4-8.5h8z' transform='translate(1.6 1.6)' fill='rgba(0,0,0,.28)'/%3E%3Cpath d='M4 3v22l6-5.5 4 8.5 4.5-2-4-8.5h8z' fill='%23fff7e1' stroke='%233a2a22' stroke-width='2.4' stroke-linejoin='round'/%3E%3Cpath d='M6.6 8.5v10' stroke='%23ffd23f' stroke-width='2.2' stroke-linecap='round'/%3E%3C/svg%3E") 4 3, default;
  --cur-pointer: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'%3E%3Cpath d='M10 14V4.8a2.5 2.5 0 0 1 5 0V12a2.3 2.3 0 0 1 4.5.6 2.3 2.3 0 0 1 4.4.9 2.2 2.2 0 0 1 4.1 1.2V21c0 4.6-3.1 8-8 8h-3c-3 0-5-1.5-6.6-4L4.7 18.7a2.3 2.3 0 0 1 3.7-2.8L10 17.6z' transform='translate(1.6 1.6)' fill='rgba(0,0,0,.28)'/%3E%3Cg%3E%3Cpath d='M10 14V4.8a2.5 2.5 0 0 1 5 0V12a2.3 2.3 0 0 1 4.5.6 2.3 2.3 0 0 1 4.4.9 2.2 2.2 0 0 1 4.1 1.2V21c0 4.6-3.1 8-8 8h-3c-3 0-5-1.5-6.6-4L4.7 18.7a2.3 2.3 0 0 1 3.7-2.8L10 17.6z' fill='%23fff' stroke='%233a2a22' stroke-width='2.3' stroke-linejoin='round'/%3E%3Cpath d='M15 12.2v3.6M19.6 13v3.2M24 14.4v2.8' stroke='%233a2a22' stroke-width='1.6' stroke-linecap='round'/%3E%3Cpath d='M9.6 25.5c1.8 2 3.6 3 6.4 3h3c2.4 0 4.4-.9 5.8-2.5' fill='none' stroke='%236fd3ff' stroke-width='2.4' stroke-linecap='round'/%3E%3C/g%3E%3C/svg%3E") 12 2, pointer;
  --cur-press: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'%3E%3Cpath d='M10 14V4.8a2.5 2.5 0 0 1 5 0V12a2.3 2.3 0 0 1 4.5.6 2.3 2.3 0 0 1 4.4.9 2.2 2.2 0 0 1 4.1 1.2V21c0 4.6-3.1 8-8 8h-3c-3 0-5-1.5-6.6-4L4.7 18.7a2.3 2.3 0 0 1 3.7-2.8L10 17.6z' transform='translate(1.6 1.6)' fill='rgba(0,0,0,.28)'/%3E%3Cg transform='translate(1.3 2.2) scale(.92)'%3E%3Cpath d='M10 14V4.8a2.5 2.5 0 0 1 5 0V12a2.3 2.3 0 0 1 4.5.6 2.3 2.3 0 0 1 4.4.9 2.2 2.2 0 0 1 4.1 1.2V21c0 4.6-3.1 8-8 8h-3c-3 0-5-1.5-6.6-4L4.7 18.7a2.3 2.3 0 0 1 3.7-2.8L10 17.6z' fill='%23fff' stroke='%233a2a22' stroke-width='2.3' stroke-linejoin='round'/%3E%3Cpath d='M15 12.2v3.6M19.6 13v3.2M24 14.4v2.8' stroke='%233a2a22' stroke-width='1.6' stroke-linecap='round'/%3E%3Cpath d='M9.6 25.5c1.8 2 3.6 3 6.4 3h3c2.4 0 4.4-.9 5.8-2.5' fill='none' stroke='%236fd3ff' stroke-width='2.4' stroke-linecap='round'/%3E%3C/g%3E%3Cpath d='M6 3.5l2 1.6M12.5 0.8v0M19 3.4l-2 1.6' stroke='%233a2a22' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E") 12 4, pointer;
}
/* ---------- Custom cursor (cartoon arrow + glove hand) ---------- */
html, body, #cv { cursor: var(--cur-default); }
/* everything inside a clickable element (thumbnail canvas, tab, caption, icons) shows the hand too */
.btn, .btn *, .card, .card *, a, [role="button"] { cursor: var(--cur-pointer); }
.btn[disabled], .btn[disabled] *, .card.locked, .card.locked * { cursor: var(--cur-default); }
body.pressing .btn:not([disabled]), body.pressing .btn:not([disabled]) *, body.pressing .card:not(.locked), body.pressing .card:not(.locked) * { cursor: var(--cur-press); }

/* ---------- Settings ---------- */
.title-settings { position: absolute; top: calc(var(--safe-t) + 14px); right: calc(var(--safe-r) + 14px); }
.panel.settings { width: min(92vw, 520px); gap: .75em; padding: 1.1em 1.6em 1.3em; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: .8em; width: 100%; }
.set-label { font-weight: 700; font-size: 1.05em; }
.lang-pick { display: flex; align-items: center; gap: .35em; }
.lang-arrow { background: none; border: 0; padding: 0; width: 2.1em; height: 2.1em; cursor: var(--cur-pointer); transition: scale .25s cubic-bezier(.34,1.56,.64,1); }
.lang-arrow svg { width: 100%; height: 100%; display: block; fill: #5bc0ea; stroke: #1f5f8f; stroke-width: 1.8; stroke-linejoin: round; filter: drop-shadow(0 2.5px 0 rgba(31,95,143,.45)); }
@media (hover: hover) { .lang-arrow:hover { scale: 1.12; } }
.lang-arrow:active { scale: .92; }
.lang-name { min-width: 8.5em; text-align: center; padding: .28em .8em .34em; border-radius: 14px; background: #bcd6e6; border: 2.5px solid #9dbfd6;
  box-shadow: inset 0 -3px 0 rgba(31,95,143,.12); color: #fff; font-weight: 700; font-size: 1.25em; line-height: 1.15;
  -webkit-text-stroke: 5px var(--ol); paint-order: stroke fill; white-space: nowrap; }
.toggle { position: relative; display: inline-flex; align-items: center; gap: .45em; min-width: 5.6em; padding: .25em .7em .25em .3em; border-radius: 999px;
  border: 2.5px solid var(--ol); background: #e3dccf; box-shadow: 0 3px 0 var(--ol); font: 700 .95em var(--font); color: var(--ol);
  cursor: var(--cur-pointer); transition: background .2s, scale .25s cubic-bezier(.34,1.56,.64,1); }
.toggle i { width: 1.35em; height: 1.35em; border-radius: 50%; background: #fff; border: 2.5px solid var(--ol); transition: transform .2s cubic-bezier(.34,1.56,.64,1); }
.toggle.on { background: #7fdc5a; flex-direction: row-reverse; padding: .25em .3em .25em .7em; }
.toggle span { flex: 1; text-align: center; }
@media (hover: hover) { .toggle:hover { scale: 1.06; } }
.toggle:active { scale: .95; }
.set-note { font-size: .82em; opacity: .7; margin-top: -.3em !important; }
.set-note.hidden { display: none; }
.panel.settings .row { margin-top: .5em; }
/* languages with long words: let buttons and pills shrink a little */
html[data-lang="ja"] .panel h2 { letter-spacing: 0; }

/* settings panel rebuilt after a language change: no pop-in / fade */
.modal.no-anim, .modal.no-anim .panel { animation: none !important; }
/* fixed geometry so switching language never resizes the settings panel (CJK fonts have taller line boxes) */
.panel.settings h2, .panel.settings .set-label, .panel.settings .lang-name, .panel.settings .toggle, .panel.settings .row .btn { line-height: 1; }
.panel.settings h2 { height: 1.15em; display: flex; align-items: center; justify-content: center; }
.panel.settings .set-row { height: 2.6em; }
/* settings rows: one compact two-column block, centred in the card — each label sits right next to its control, however
   wide the card is. The label column has a fixed width so the controls never shift when the language changes. */
.set-grid { display: grid; grid-template-columns: minmax(6.5em, max-content) max-content; row-gap: .7em; column-gap: 1.1em;
  align-items: center; justify-content: center; }
.set-grid .set-row { display: contents; }
.set-grid .set-label { text-align: left; }
.set-grid .set-row > :last-child { justify-self: center; }   /* language picker and switches share one centre line */
.panel.settings .lang-name { height: 2em; display: flex; align-items: center; justify-content: center; padding-top: 0; padding-bottom: 0; }
.panel.settings .toggle { height: 2.2em; width: 6.2em; padding-top: 0; padding-bottom: 0; }
.panel.settings .row .btn { height: 2.3em; min-width: 6.4em; padding-top: 0; padding-bottom: 0; white-space: nowrap; }
.panel.settings .set-note { min-height: 1.2em; }
.panel.settings .set-note.hidden { display: block; visibility: hidden; }
/* two settings buttons always share one row, even with long words (Russian, German…) */
.panel.settings .row { flex-wrap: nowrap; }
.panel.settings .row { width: 100%; justify-content: center; gap: .7em; }
.panel.settings .row .btn { padding-left: .5em; padding-right: .5em; min-width: 0; flex: 1 1 0; max-width: 6.6em; overflow: hidden; text-overflow: ellipsis; }
html[lang="ru"] .panel.settings .row .btn, html[lang="de"] .panel.settings .row .btn, html[lang="id"] .panel.settings .row .btn { font-size: clamp(15px, calc(var(--u) * 2), 25px); max-width: 8em; }

/* touch: every tappable thing ignores browser gestures so our own tap handling gets clean pointer events */
.btn, .card, .lang-arrow, .toggle { touch-action: none; -webkit-touch-callout: none; }

/* Block all input while a level-transition advertisement is requested/playing. */
.ad-blocker { position: fixed; inset: 0; z-index: 10000; background: rgba(30, 45, 40, .35); cursor: wait; touch-action: none; }
.ad-blocker::after { content: ''; position: absolute; top: 50%; left: 50%; width: 36px; height: 36px; margin: -18px; border: 4px solid #fff7e1; border-top-color: #ffcc33; border-radius: 50%; animation: ad-spin 1s linear infinite; }
@keyframes ad-spin { to { transform: rotate(360deg); } }

/* ---- levels 13-27: raft load / day-night pill ---- */
.info-pill .lbl { font-size: .62em; font-weight: 600; opacity: .7; text-transform: uppercase; letter-spacing: .04em; }
.info-pill svg .fill { fill: #9aa4b0; }
.info-pill svg .sun { fill: #ffd23f; }
.info-pill svg .moon { fill: #fff3b0; }
.info-pill.over { background: #ffe0e0; }
.info-pill.over span:last-child { color: #d63a3a; }
.info-pill.night { background: #34407a; color: #fff8d8; }
.info-pill.night svg { stroke: #fff8d8; }
.info-pill.bump { animation: bump .35s; }
.info-pill .sep { width: 2px; align-self: stretch; margin: .15em .1em; background: rgba(58,42,34,.25); border-radius: 2px; }
/* phones: drop the text labels so the pills fit between the corner buttons */
@media (max-width: 760px) { .pill-row:has(.info-pill:not(.hidden)) .lbl { display: none; } .pill-row:has(.info-pill:not(.hidden)) { gap: 5px; } }
/* startup: keep the title fully visible while the SDK starts; small spinner over the PLAY button */
.ad-blocker.boot-wait { background: transparent; cursor: progress; }
.ad-blocker.boot-wait::after { top: auto; bottom: 14%; border-color: rgba(255,255,255,.85); border-top-color: #ffcc33; }

/* ---- hints & rewarded-video offer ---- */
.badge.more { background: #ffffff; height: auto; min-width: 0; padding: 1px 3px; top: -12px; right: -14px; }
#hintBadge.more svg { width: calc(var(--btn) * .48); height: calc(var(--btn) * .38); display: block; filter: none; }
#btnHint.guiding { box-shadow: 0 0 0 4px #fff3b0, 0 4px 0 var(--ol); }
.hint-bar .hb-left { margin-left: .35em; padding: 0 .55em; font-size: .7em; font-weight: 700; white-space: nowrap; background: #e9f6ff; color: #2f7fd0;
  border: 2px solid var(--ol); border-radius: 999px; }
.panel.offer { width: min(92vw, 620px); gap: .6em; }
.panel.offer .offer-ico svg { width: clamp(46px, calc(var(--u) * 7), 76px); height: auto; }
.ico-video rect { fill: #4dc3ff; stroke: var(--ol); stroke-width: 2; }
.ico-video path { fill: #fff; stroke: var(--ol); stroke-width: 1.6; stroke-linejoin: round; }
.btn svg.ico-video { width: 1.25em; height: 1.25em; filter: none; }
.panel.offer .row { flex-wrap: nowrap; width: 100%; }
.panel.offer .offer-btn { flex: 1 1 0; min-width: 0; max-width: 15em; display: inline-flex; align-items: center; justify-content: center; gap: .35em;
  padding-left: .6em; padding-right: .6em; line-height: 1.12; text-align: center; font-size: clamp(16px, calc(var(--u) * 2.1), 26px); }
.panel.offer .offer-btn svg { flex: none; }
@media (max-width: 560px) { .panel.offer .row { flex-wrap: wrap; } .panel.offer .offer-btn { flex: 1 1 100%; max-width: none; } }
/* settings: reset progress (quiet link-style button) + red confirm button */
.btn-red { background: linear-gradient(#ff8a7a, #d63a3a); }
.panel.reset p { max-width: 30em; text-align: center; }

/* First-clear hint reward: three segments, then a bulb flies to the hint wallet. */
.panel.good { gap: .5em; padding: .9em 1.3em; }
.win-hint-reward { width: min(100%, 340px); padding: .5em .8em; border: 2px solid #d9cda8; border-radius: 16px; background: #fff1c7; }
.reward-heading { display: flex; align-items: center; justify-content: space-between; gap: .6em; font-size: .88em; font-weight: 700; text-align: left; }
.reward-bulb { display: inline-flex; flex-shrink: 0; width: 32px; height: 32px; }
.reward-bulb svg, .hint-reward-flight svg { width: 100%; height: 100%; fill: #ffd23f; stroke: var(--ol); stroke-width: 2; stroke-linecap: round; }
.reward-track { display: flex; gap: 5px; margin: .35em 0; }
.reward-step { flex: 1; height: 12px; border: 2px solid #b4a47e; border-radius: 5px; background: #e9dfc3; transition: background-color .5s, border-color .5s; }
.reward-step.filled { background: #79ce59; border-color: #398849; }
.panel .reward-status { font-size: .93em; color: #526b30; }
.hint-reward-flight { position: fixed; width: 32px; height: 32px; z-index: 10001; pointer-events: none; filter: drop-shadow(0 2px 3px #83631480); }
#btnHint.reward-arrival { animation: reward-arrival .45s ease-out; }
@keyframes reward-arrival { 50% { transform: scale(1.2); filter: brightness(1.3); } }
@media (max-height: 500px) {
  .panel.good { gap: .28em; padding: .6em 1em; }
  .panel.good .result-big .num { font-size: 50px; }
  .panel.good .result-big { margin: 0; }
  .panel.good .win-hint-reward { padding: .3em .65em; }
}
@media (prefers-reduced-motion: reduce) { .reward-step { transition: none; } #btnHint.reward-arrival { animation: none; } }
/* hint video cooldown timer on the hint button badge */
#hintBadge.cool { background: #7d8ea3; min-width: 2.4em; font-variant-numeric: tabular-nums; }

/* wide, short screens: picture beside the text (chosen by fitPanel in game.js when it fits better) */
.panel.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 1.1em; row-gap: .45em; align-items: center; justify-items: center; align-content: center; }
.panel.split > * { grid-column: 2; }
.panel.split > .help-canvas, .panel.split.help > .help-canvas { grid-column: 1; grid-row: 1 / span var(--rows, 4); width: 100%; height: auto; max-width: none; margin: 0; }
.panel.split > .close { grid-column: auto; }
.panel.split .row { margin-top: .1em; }
/* very short screens (landscape phones with browser bars, small embeds): tighter cards so fitPanel scales less */
@media (max-height: 340px) {
  .panel { padding: .7em 1.2em .8em; gap: .45em; }
  .panel h2 { font-size: 24px; }
  .panel.settings { gap: .4em; padding-top: .7em; padding-bottom: .8em; }
  .panel.settings .set-row { height: 2.2em; }
  .set-grid { row-gap: .5em; }
  .panel.settings .row { margin-top: .2em; }
  .panel .row { margin-top: .1em; }
  .help-tip { font-size: .9em; }
  .help-level { font-size: .92em; }
  /* smaller close button, and the title band is at least as tall, so the close button never covers the first row */
  .panel .close { width: 32px; height: 32px; top: 8px; right: 8px; font-size: 16px; border-width: 2px; }
  .panel:has(> .close) > h2 { min-height: 32px; display: flex; align-items: center; justify-content: center; padding-inline: 34px; }
}

/* ---------- tutorial / hint pointer: glove hand tapping the next thing to tap ---------- */
#tapHand { position: absolute; left: 0; top: 0; width: var(--hand, 56px); height: var(--hand, 56px); pointer-events: none; z-index: 15; display: none; }
#tapHand.on { display: block; }
#tapHand .hand { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; transform-origin: 39% 8%; animation: handTap 1.2s ease-in-out infinite; }
#tapHand .sh { fill: rgba(0,0,0,.35); }
#tapHand .glove { fill: #fff; stroke: var(--ol); stroke-width: 2.7; stroke-linejoin: round; }
#tapHand .kn { fill: none; stroke: var(--ol); stroke-width: 1.6; stroke-linecap: round; }
#tapHand .cuff { fill: none; stroke: #6fd3ff; stroke-width: 2.4; stroke-linecap: round; }
#tapHand .ring { position: absolute; left: 39%; top: 8%; width: 80%; height: 80%; margin: -40% 0 0 -40%; border-radius: 50%;
  border: 3px solid #fff7e1; box-shadow: 0 0 0 2px rgba(58,42,34,.55), inset 0 0 0 2px rgba(58,42,34,.55); opacity: 0; animation: tapRing 1.2s ease-out infinite; }
#tapHand { --rot: -16deg; --dx: 18%; --dy: 22%; }
#tapHand.from-top { --rot: 196deg; --dx: -14%; --dy: -26%; }   /* GO button: the hand reaches down from above */
#tapHand.from-top .sh { display: none; }
@keyframes handTap {
  0%, 100% { transform: translate(var(--dx), var(--dy)) rotate(var(--rot)); }
  42%      { transform: translate(0, 0) rotate(var(--rot)) scale(.9); }
  58%      { transform: translate(0, 0) rotate(var(--rot)) scale(.9); }
}
@keyframes tapRing { 0%, 42% { opacity: 0; transform: scale(.25); } 50% { opacity: 1; transform: scale(.45); } 100% { opacity: 0; transform: scale(1.15); } }
@media (prefers-reduced-motion: reduce) { #tapHand .hand { animation: none; transform: rotate(var(--rot)); } #tapHand .ring { display: none; } }

/* tutorial / hints: the hint strip takes the crossings counter's place */
#hud.hinting .moves-pill { display: none; }
#hud.hinting .pill-row:not(:has(> .pill:not(.hidden):not(.moves-pill))) { display: none; }

/* short screens (landscape phones, small embeds): a smaller HUD that stays readable (text never below 12-13 px) */
@media (max-height: 420px) {
  :root { --btn: clamp(36px, 12vh, 46px); }
  .hud-tl, .hud-tr { top: calc(var(--safe-t) + 8px); }
  .hud-tl { left: calc(var(--safe-l) + 10px); }
  .hud-tr { right: calc(var(--safe-r) + 10px); }
  #hud > div { gap: 7px; }
  .hud-tc { top: calc(var(--safe-t) + 6px); gap: 4px !important; }
  .pill { font-size: clamp(14px, 4.8vh, 20px); border-width: 2px; }
  .chapter-pill { font-size: clamp(12px, 4vh, 16px); }
  .hint-bar { font-size: clamp(13px, 4.6vh, 18px); border-width: 2px; border-radius: 14px; }
  .hint-bar .hb-ico { width: 1.9em; height: 1.9em; }
  .hud-bc { bottom: calc(var(--safe-b) + 10px); }
  .btn-go { font-size: clamp(21px, 8.5vh, 32px); }
}

/* short screens: one row of three bigger level cards (game.js shows 3 per page) */
.level-grid.one-row { grid-template-rows: 1fr; }
