/*!
 * Kid Kit — the v2 skins' look (pairs with js/kid-kit.js).
 * From Treble Trouble v2 and the game covers: flat worlds, a Grobold title on
 * an arch, big picture buttons, menus in the corners (Kiddopia), the grown-up
 * detail behind a gear. Every rule is scoped to .kk-* so it can sit on top of
 * any game without touching it.
 */
@font-face {
  font-family: "Grobold";
  src: url("../fonts/grobold.ttf") format("truetype");
  font-display: swap;
}

.kk-vh {
  position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
}

/* ── The menu layer: over the game's own menu, the whole screen ─────────── */
.kk-menu {
  position: fixed; inset: 0; z-index: 40;
  overflow: hidden;
  font-family: "Nunito", ui-rounded, system-ui, sans-serif;
  color: #1b233e;
  -webkit-tap-highlight-color: transparent;
}
.kk-menu.is-off { display: none; }
/* the game chrome (Menu pill, coin purse, pause) stays on top of the kit */
html.kk-menu-on .pgc-root, html.kk-menu-on [data-coin-purse] { z-index: 60; }

/* ── A flat world ───────────────────────────────────────────────────────── */
.kk-scene { position: absolute; inset: 0; background: var(--kk-sky, #8fd6f4); pointer-events: none; }
.kk-scene svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.kk-cloudset { animation: kk-drift 16s ease-in-out infinite alternate; }
@keyframes kk-drift { from { transform: translateX(-10px); } to { transform: translateX(12px); } }
.kk-scene svg.kk-moon { position: absolute; inset: auto; top: calc(max(10px, env(safe-area-inset-top)) + 58px); width: clamp(84px, 11vw, 150px); height: auto; aspect-ratio: 1; }
.kk-moon-left { left: max(10px, 2vw); }
.kk-moon-right { right: max(10px, 2vw); left: auto; }
.kk-stars circle { animation: kk-twinkle 3.2s ease-in-out infinite alternate; }
.kk-stars circle:nth-child(2n) { animation-delay: -1.1s; }
.kk-stars circle:nth-child(3n) { animation-delay: -2.3s; }
@keyframes kk-twinkle { from { opacity: 0.35; } to { opacity: 1; } }

/* ── The title ──────────────────────────────────────────────────────────── */
.kk-title {
  position: relative; margin: 0;
  display: flex; flex-direction: column; align-items: center;
  line-height: 0.9; letter-spacing: 0; font-weight: 400;
}
.kk-row { display: flex; justify-content: center; }
.kk-l {
  display: inline-block;
  translate: 0 var(--y);
  rotate: var(--r);
  animation: kk-ripple 2s ease-in-out infinite;
  animation-delay: calc(var(--d) * -2s);
}
@keyframes kk-ripple { 0%, 100% { margin-top: 0; } 50% { margin-top: -0.04em; } }
.kk-sp { display: inline-block; width: 0.28em; }
.kk-kicker {
  font-family: "Nunito", system-ui, sans-serif; font-weight: 900;
  font-size: clamp(32px, 7.5vw, 58px);
}
.kk-word {
  font-family: "Grobold", "Nunito", system-ui, sans-serif; font-weight: 400;
  font-variant-caps: small-caps;
  font-size: clamp(60px, 14.5vw, 116px);
  margin-top: -0.06em;
}
.kk-word.is-long { font-size: clamp(46px, 11vw, 96px); }

/* ── The front: the title, then BAM, the big buttons ────────────────────── */
.kk-front {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: clamp(14px, 4vh, 40px);
  padding: 70px 16px 60px;
}
.kk-big { display: flex; gap: clamp(14px, 3vw, 32px); justify-content: center; flex-wrap: wrap; position: relative; z-index: 2; }
.kk-btn {
  position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  width: clamp(150px, 24vw, 250px); aspect-ratio: 1 / 0.9;
  border: 0; border-radius: 34px; cursor: pointer;
  background: var(--kk-c); color: #fff; font: inherit;
  box-shadow: 0 9px 0 var(--kk-s), 0 16px 24px rgba(27, 35, 62, 0.18);
  transition: transform 0.12s ease;
  animation: kk-float 3s ease-in-out infinite;
}
.kk-btn:active { transform: scale(0.95); }
.kk-btn:focus-visible { outline: 5px solid #fff; outline-offset: 4px; }
@keyframes kk-float { 50% { translate: 0 -6px; } }
.kk-btn b {
  font-family: "Grobold", "Nunito", system-ui, sans-serif; font-weight: 400;
  font-size: clamp(22px, 3.4vw, 36px); line-height: 1;
  text-shadow: 0 0.07em 0 rgba(27, 35, 62, 0.28);
}
.kk-sub { font-weight: 900; font-size: 13px; opacity: 0.85; }
.kk-ico { display: grid; place-items: center; width: 52%; height: 44%; margin-bottom: 8px; }
.kk-ico svg { width: 100%; height: 100%; overflow: visible; }
.kk-dots { display: flex; gap: 5px; margin-top: 2px; flex-wrap: wrap; justify-content: center; max-width: 86%; }
.kk-dots i { width: 11px; height: 11px; border-radius: 50%; background: rgba(255, 255, 255, 0.35); }
.kk-dots i.on { background: var(--c); box-shadow: 0 0 0 2px #fff; }
.kk-dots:has(i:nth-child(9)) { gap: 3px; }
.kk-dots:has(i:nth-child(9)) i { width: 8px; height: 8px; }
.kk-lock { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: #fff; }
.kk-btn .kk-lock { position: absolute; top: -10px; right: -10px; box-shadow: 0 3px 8px rgba(27, 35, 62, 0.25); }
.kk-lock svg { width: 20px; height: 20px; }

/* ── The map: stepping stones along an arch, the next one hopping ───────── */
.kk-map { position: absolute; inset: 96px 5% 100px; z-index: 2; }
.kk-menu:not([data-view="map"]) .kk-map,
.kk-menu[data-view="map"] .kk-front { display: none; }
.kk-menu[data-view="map"] .kk-hero { display: none; }
.kk-road { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.kk-road path { fill: none; stroke: #fff; stroke-width: 9; stroke-linecap: round; stroke-dasharray: 2 18; opacity: 0.9; vector-effect: non-scaling-stroke; }
.kk-road-p { display: none; }
.kk-stone {
  position: absolute; left: var(--x); top: var(--y); translate: -50% -50%;
  width: var(--kk-sz); aspect-ratio: 1;
  border-radius: 50%; border: 6px solid #fff; cursor: pointer;
  background: var(--c); color: #fff; font: inherit;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  box-shadow: 0 7px 0 rgba(27, 35, 62, 0.18);
}
.kk-stone:active { scale: 0.94; }
/* stones size by how many there are (--kk-n, set by the kit, never under 6) so 10-12 never touch */
.kk-map { --kk-sz: clamp(52px, min(10vw, calc(80vw / (var(--kk-n, 8) + 1.5))), 118px); }
.kk-num { font-family: "Grobold", "Nunito", system-ui, sans-serif; font-size: calc(var(--kk-sz, 96px) * 0.4); line-height: 0.9; text-shadow: 0 0.07em 0 rgba(27, 35, 62, 0.3); }
.kk-stone .kk-stars { font-size: clamp(11px, 1.3vw, 15px); letter-spacing: 1px; }
.kk-stars i { font-style: normal; color: rgba(255, 255, 255, 0.45); }
.kk-stars i.on { color: #ffd25b; text-shadow: 0 1px 0 rgba(27, 35, 62, 0.35); }
.kk-stone.is-locked { filter: saturate(0.45) brightness(1.05); }
.kk-stone .kk-lock { width: clamp(18px, calc(var(--kk-sz, 96px) * 0.28), 30px); height: clamp(18px, calc(var(--kk-sz, 96px) * 0.28), 30px); }
.kk-stone.is-next { animation: kk-hop 1.1s ease-in-out infinite; z-index: 1; }
@keyframes kk-hop { 0%, 100% { translate: -50% -50%; } 45% { translate: -50% -62%; } }
.kk-go { position: absolute; right: -14%; top: -14%; display: grid; place-items: center; width: clamp(30px, calc(var(--kk-sz, 96px) * 0.38), 44px); height: clamp(30px, calc(var(--kk-sz, 96px) * 0.38), 44px); border-radius: 50%; background: #1b233e; border: 4px solid #fff; }
.kk-go svg { width: 45%; height: 45%; margin-left: 2px; }

/* ── Corner buttons: back (bottom-left on the map) and the gear (top-right) */
.kk-round {
  position: absolute; z-index: 5;
  display: grid; place-items: center;
  width: 60px; height: 60px; border-radius: 50%;
  border: 0; cursor: pointer;
  background: rgba(255, 255, 255, 0.92); color: #1b233e;
  box-shadow: 0 4px 0 rgba(27, 35, 62, 0.15);
}
.kk-round svg { width: 30px; height: 30px; }
.kk-back { position: fixed; left: max(16px, env(safe-area-inset-left)); bottom: max(16px, env(safe-area-inset-bottom)); }
.kk-gear { right: max(16px, env(safe-area-inset-right)); top: calc(max(10px, env(safe-area-inset-top)) + 62px); width: 52px; height: 52px; }
.kk-gear-badge { position: absolute; right: -6px; bottom: -6px; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: #009999; color: #fff; border: 2px solid #fff; }
.kk-gear-badge svg { width: 14px; height: 14px; }
.kk-gear-badge[hidden] { display: none; }

/* ── The grown-ups sheet ─────────────────────────────────────────────────── */
.kk-scrim, .kk-sheet { display: none; }
.kk-menu[data-view="sheet"] .kk-scrim { display: block; position: absolute; inset: 0; z-index: 20; background: rgba(15, 12, 40, 0.4); }
.kk-menu[data-view="sheet"] .kk-sheet {
  display: block; position: absolute; z-index: 21; left: 50%; top: 50%; translate: -50% -50%;
  width: min(560px, calc(100vw - 24px)); max-height: calc(100svh - 40px); overflow: auto;
  background: #fdfbf6; color: #1b233e; border-radius: 28px;
  padding: 14px 20px 22px; text-align: left;
  box-shadow: 0 20px 50px rgba(15, 12, 40, 0.35);
}
.kk-sheet-head { display: flex; align-items: center; justify-content: space-between; }
.kk-sheet-head b { font-size: 20px; font-weight: 900; }
.kk-x { width: 44px; height: 44px; border: 0; border-radius: 50%; background: rgba(27, 35, 62, 0.08); color: #1b233e; font: 900 24px/1 Nunito, system-ui, sans-serif; cursor: pointer; }
.kk-h { margin: 14px 0 8px; font-size: 11px; font-weight: 900; letter-spacing: 1.8px; text-transform: uppercase; color: #8a93ad; }
.kk-hint { margin: 4px 0; font-size: 12.5px; font-weight: 700; color: #6a7392; line-height: 1.45; }
.kk-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.kk-pill { appearance: none; border: 2px solid #d5dced; background: #fff; color: #1b233e; font: 900 14px/1 Nunito, system-ui, sans-serif; padding: 10px 16px; border-radius: 999px; cursor: pointer; min-height: 44px; }
.kk-pill.is-on, .kk-pill[aria-pressed="true"] { background: #1b233e; border-color: #1b233e; color: #fff; }
.kk-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.kk-list li { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 14px; }
.kk-list li > i { display: grid; place-items: center; min-width: 26px; height: 26px; border-radius: 13px; padding: 0 6px; background: var(--c, #1b233e); color: #fff; font-style: normal; font-weight: 900; font-size: 13px; }
.kk-list .kk-stars { margin-left: auto; }
.kk-list .kk-stars i { color: #d5dced; text-shadow: none; }
.kk-list .kk-stars i.on { color: #f2b72b; }
/* a game's own rows moved into the sheet: let them breathe and wrap */
.kk-sheet-body > * { max-width: 100%; }

/* ── The hero bell, cropped by a bottom corner ───────────────────────────── */
.kk-hero {
  position: absolute; z-index: 1; bottom: -5%;
  width: clamp(240px, 30vw, 440px); aspect-ratio: 1;
  pointer-events: none;
  transform-origin: 50% 94%;
  animation: kk-sway 4s ease-in-out infinite;
}
.kk-hero-right { right: -2%; }
.kk-hero-left { left: -2%; }
.kk-hero > * { width: 100%; height: 100%; display: block; }
.kk-hero > img.kk-hero-img { object-fit: contain; object-position: 50% 100%; }
@keyframes kk-sway { 0%, 100% { rotate: -9deg; } 50% { rotate: -7deg; } }
.kk-hero-left { animation-name: kk-sway-l; }
@keyframes kk-sway-l { 0%, 100% { rotate: 9deg; } 50% { rotate: 7deg; } }
@media (max-width: 900px) { .kk-hero { display: none; } }
/* three or more big buttons fill the width: the hero would stand under one
   (and a badge is never covered), so it waits for a really wide screen */
@media (max-width: 1199px) { .kk-menu:has(.kk-btn:nth-child(3)) .kk-hero { display: none; } }

/* ── Night: the title and stones keep their colours; corner chrome stays light */
.kk-theme-night .kk-road path { stroke: #ffd25b; opacity: 0.75; }

/* ── An upright phone: smaller buttons side by side; stones zig-zag down ── */
@media (orientation: portrait) and (max-width: 700px) {
  .kk-btn { width: min(43vw, 200px); border-radius: 28px; }
  /* exactly three: one row of three; four or more wrap two to a row at full size */
  .kk-big:has(.kk-btn:nth-child(3)):not(:has(.kk-btn:nth-child(4))) { gap: 10px; flex-wrap: nowrap; }
  .kk-big:has(.kk-btn:nth-child(3)):not(:has(.kk-btn:nth-child(4))) .kk-btn { width: min(28vw, 150px); border-radius: 24px; }
  .kk-big:has(.kk-btn:nth-child(3)):not(:has(.kk-btn:nth-child(4))) .kk-btn b { font-size: 18px; }
  .kk-map { inset: 120px 6% 96px; }
  /* a tall phone: the sheet starts below the chrome's Menu pill and purse */
  .kk-menu[data-view="sheet"] .kk-sheet { top: calc(max(10px, env(safe-area-inset-top)) + 70px); translate: -50% 0; max-height: calc(100svh - 90px); }
  .kk-stone { left: var(--px); top: var(--py); }
  /* the zig-zag runs down the screen's height: a few cases get big stones, twelve still fit */
  .kk-map { --kk-sz: clamp(52px, calc(66svh / (var(--kk-n, 8) + 1)), 100px); }
  .kk-road-l { display: none; }
  .kk-road-p { display: inline; }
}
@media (prefers-reduced-motion: reduce) {
  .kk-btn, .kk-stone.is-next, .kk-l, .kk-hero, .kk-cloudset, .kk-stars circle { animation: none; }
}

/* ── A phone on its side (≤500px tall): the title and buttons share the height ── */
@media (max-height: 500px) and (orientation: landscape) {
  .kk-front { padding: 50px 16px 18px; gap: 10px; justify-content: center; }
  .kk-word, .kk-word.is-long { font-size: clamp(44px, 17vh, 80px); }
  .kk-kicker { font-size: clamp(24px, 8vh, 40px); }
  .kk-btn { width: clamp(124px, min(19vw, 42vh), 176px); border-radius: 26px; }
  .kk-btn b { font-size: 21px; }
  .kk-big { gap: 14px; flex-wrap: nowrap; }
}

/* ── The corner chrome on every v2 page: a round back arrow, no "Menu" word
   (Rob, 2026-10-09: "just a kid friendly back arrow"); pause round to match ── */
html .pgc-root .pgc-menu { width: 52px; min-width: 52px; height: 52px; padding: 0; border: 0; box-shadow: 0 4px 0 rgba(27, 35, 62, 0.14); }
html .pgc-root .pgc-menu .pgc-label { display: none; }
html .pgc-root .pgc-menu svg { width: 26px; height: 26px; stroke-width: 3; }
html .pgc-root .pgc-icon { width: 52px; min-width: 52px; height: 52px; border: 0; box-shadow: 0 4px 0 rgba(27, 35, 62, 0.14); }
html .pgc-root .pgc-icon svg { width: 22px; height: 22px; }

/* ── My Bell on the map: your bell (in your outfit) stands on the stone you'll
   play next and hops with it; it says "you are here", so the stone's ▶ badge steps aside ── */
.kk-me { position: absolute; left: 50%; bottom: 72%; width: 112%; aspect-ratio: 1; translate: -50% 0; pointer-events: none; z-index: 2; }
.kk-me > svg { display: block; width: 100%; height: 100%; overflow: visible; }
.kk-me-pic { position: absolute; inset: 0; background-repeat: no-repeat; background-size: 700% 100%; background-position: 0 0; }
.kk-stone.has-me .kk-go { display: none; }
