/*!
 * Whack-a-Bell v2 — a field of holes over the same game (with js/kid-kit.js).
 * Since 2026-10-22 the field is Perform's night lawn (see below): pods are a slate
 * rim #2b3963 / rim shade #1a2446 / a near-black hole; the mallet head is still
 * C red with E yellow bands on a #c98a4b handle. (The day cover colours live in git.)
 */
/* 2026-10-22: the night concert field (Rob: "the Prodigies Perform concert field ... lo fi chill ...
   night time cool navy dark field vibes ... but not the stage"). Perform's night: sky #070b20 to
   #232a5c, lawn #141b3c to #1d3550, festoon lights in the bells' colours, a far tree line. The
   bells keep their own colours; only the world around them went to night. */
body.is-v2 {
  --wb-grass: #131b3c;
  --wb-sky1: #0e1636; --wb-sky2: #1a2250;
  background: #0b1026;
}
body.is-v2 .v2-night { position: absolute; inset: 0; }
body.is-v2 .v2-night svg { width: 100%; height: 100%; display: block; }
body.is-v2 .kk-menu .kk-scene .kk-moon, body.is-v2 .kk-menu .kk-stars { display: none; }   /* the night sky brings its own */
body.is-v2 .v2-tw { animation: v2-tw 4.6s ease-in-out infinite alternate; }
@keyframes v2-tw { from { opacity: 1; } to { opacity: 0.25; } }
body.is-v2 .v2-halo { animation: v2-halo 5.5s ease-in-out infinite alternate; }
@keyframes v2-halo { from { opacity: 0.1; } to { opacity: 0.24; } }
body.is-v2 .wb-scenery .kk-scene { position: absolute; inset: 0; }

/* the game's own menu stays in the page (the kit presses its buttons) but is never seen */
html.kk-menu-on body.is-v2 { overflow: hidden; }
body.is-v2 #wbMenu { visibility: hidden; }
body.is-v2 #wbMenu .wb-field-deco { display: none; }

/* the menu's field gets the cover's holes (decoration only) */
body.is-v2 .kk-menu::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: url("./menu-holes-night.svg") center bottom / cover no-repeat;
}
body.is-v2 .kk-menu[data-view="map"]::after { display: none; }

/* the mallet on the Whack! button: the cover's toy mallet (a code stand-in until Rob's art) */
.v2-mallet-ico { display: grid; place-items: center; width: 100%; height: 100%; }
.v2-mallet-ico svg { height: 96%; translate: 0 -6%; width: auto; filter: drop-shadow(0 4px 0 rgba(27, 35, 62, 0.25)); }
.kk-btn .kk-ico svg path, .kk-btn .kk-ico svg circle { vector-effect: none; }

/* a locked stone that isn't reached yet: a little "not yet" shake */
.kk-stone.kk-nope { animation: v2-nope 0.36s ease-in-out; }
@keyframes v2-nope { 25% { translate: calc(-50% - 6px) -50%; } 75% { translate: calc(-50% + 6px) -50%; } }

/* the game's rows, moved into the grown-ups sheet, wear the kit's pills */
.kk-sheet .wb-optrow { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 10px; justify-content: flex-start; }
.kk-sheet .wb-optlabel { min-width: 74px; font-size: 12px; font-weight: 900; letter-spacing: 1px; text-transform: uppercase; color: #8a93ad; opacity: 1; }
.kk-sheet .wb-opt {
  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; min-height: 44px; cursor: pointer; box-shadow: none;
}
.kk-sheet .wb-opt.is-on { background: #1b233e; border-color: #1b233e; color: #fff; }

/* ── Play: the far tree line of the Perform field (and the warm glow behind it), then the lawn ── */
body.is-v2 .wb-field::before {
  content: ""; position: absolute; z-index: -2;
  left: 50%; transform: translateX(-50%);
  width: 100vw; top: -34px; height: 96px;
  background: url("./field-trees.svg") center / 100% 100% no-repeat;
}
/* the lawn: dark navy, a little lighter toward the front, two soft pools of light where the
   holes are, and a whisper of grain (lo-fi) */
body.is-v2 .wb-field::after {
  background:
    radial-gradient(ellipse 46% 34% at 30% 34%, rgba(150, 175, 255, 0.1), rgba(150, 175, 255, 0) 70%),
    radial-gradient(ellipse 46% 34% at 72% 62%, rgba(255, 214, 160, 0.08), rgba(255, 214, 160, 0) 70%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .05 0'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)'/%3E%3C/svg%3E"),
    linear-gradient(#131b3c, #172645 40%, #1c3250 100%);
}
body.is-v2 .wb-wave { color: #131b3c; }
/* fireflies (v2.js): over the lawn, under the holes */
body.is-v2 .wb-garden { position: relative; z-index: 1; }
body.is-v2 .v2-flies { position: absolute; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
body.is-v2 .v2-flies i {
  position: absolute; width: 5px; height: 5px; border-radius: 50%;
  background: #f4f1b0; box-shadow: 0 0 10px 3px rgba(244, 241, 176, 0.45);
  animation-name: v2-fly, v2-glim; animation-timing-function: ease-in-out, ease-in-out;
  animation-iteration-count: infinite, infinite; animation-direction: alternate, alternate;
}
@keyframes v2-fly { 0% { translate: 0 0; } 33% { translate: 26px -14px; } 66% { translate: -12px -26px; } 100% { translate: 18px 8px; } }
@keyframes v2-glim { from { opacity: 0; } 60% { opacity: 0.75; } to { opacity: 0.15; } }
/* more sky than v1 on tall screens, like the cover (the field still meets the pods) */
@media (min-height: 720px) and (orientation: landscape) {
  body.is-v2 .wb-field { padding-top: clamp(56px, 8vh, 130px); }
  body.is-v2 .wb-wave { height: clamp(58px, 7vh, 100px); }
  body.is-v2 .wb-field::after { top: clamp(52px, 6.6vh, 94px); }
  body.is-v2 .wb-field::before { top: calc(clamp(0px, 0.6vh, 8px) - 40px); height: clamp(96px, 12vh, 150px); }
}

/* ── the pods: the cover's holes (sand rim, dark hole, a front lip over the bell) */
body.is-v2 .wb-pod-back,
body.is-v2 .wb-pod-front {
  left: 2%; right: 2%; bottom: 0; height: 30%;
  border-radius: 0; box-shadow: none; background-color: transparent;
  background-position: center; background-size: 100% 100%; background-repeat: no-repeat;
}
body.is-v2 .wb-pod-back { background-image: url("./pod-back-night.svg"); }
body.is-v2 .wb-pod-front { background-image: url("./pod-front-night.svg"); }
/* a risen bell lights its hole softly in its own note colour (the hole, never the bell) */
body.is-v2 .wb-pod-back::after {
  content: ""; position: absolute; left: 12%; right: 12%; top: -30%; bottom: 10%; border-radius: 50%;
  background: radial-gradient(ellipse at 50% 70%, var(--wb-note, #ffd25b), transparent 68%);
  opacity: 0; transition: opacity 0.25s ease-out; pointer-events: none;
}
body.is-v2 .wb-pod.is-up .wb-pod-back::after, body.is-v2 .wb-pod.is-held .wb-pod-back::after { opacity: 0.32; }
body.is-v2 .wb-bell { width: 70%; }

/* bells never in lockstep: those that rise together (Find's choices, Echo's
   row) rise one by one, and each sways at its own tempo */
body.is-v2 .wb-pod.is-held .wb-bell { animation: wb-pop 0.2s cubic-bezier(.2,1.5,.5,1) both; transform: none; }
body.is-v2 .wb-pod:nth-child(1) { --v2-d: 0.04s; --v2-t: 2.3s; --v2-a: 1.6deg; }
body.is-v2 .wb-pod:nth-child(2) { --v2-d: 0.17s; --v2-t: 2.9s; --v2-a: 2.2deg; }
body.is-v2 .wb-pod:nth-child(3) { --v2-d: 0.09s; --v2-t: 2.1s; --v2-a: 1.2deg; }
body.is-v2 .wb-pod:nth-child(4) { --v2-d: 0.24s; --v2-t: 3.3s; --v2-a: 2deg; }
body.is-v2 .wb-pod:nth-child(5) { --v2-d: 0.13s; --v2-t: 2.6s; --v2-a: 1.8deg; }
body.is-v2 .wb-pod:nth-child(6) { --v2-d: 0s;    --v2-t: 3.1s; --v2-a: 1.4deg; }
body.is-v2 .wb-pod:nth-child(7) { --v2-d: 0.2s;  --v2-t: 2.4s; --v2-a: 2.4deg; }
body.is-v2 .wb-pod:nth-child(8) { --v2-d: 0.07s; --v2-t: 2.8s; --v2-a: 1.5deg; }
body.is-v2 .wb-pod.is-held .wb-bell { animation-delay: var(--v2-d, 0s); }
/* a wrong tap wobbles the bell itself, so the rise above never re-runs */
body.is-v2 .wb-pod.is-wrong .wb-bell svg.wb-rig,
body.is-v2 .wb-pod.is-wrong .wb-bell img { transform-origin: 50% 96%; animation: v2-wobble 0.4s ease-in-out; }
@keyframes v2-wobble { 25% { rotate: -8deg; } 75% { rotate: 8deg; } }
body.is-v2 .wb-bell svg.wb-rig {
  transform-origin: 50% 96%;
  animation: v2-sway var(--v2-t, 2.6s) ease-in-out infinite alternate;
  animation-delay: calc(var(--v2-d, 0s) * -7);
}
@keyframes v2-sway { from { rotate: calc(var(--v2-a, 2deg) * -1); } to { rotate: var(--v2-a, 2deg); } }

/* the mallet's bonk, over the tapped pod (look only, never a target) */
.v2-bonk {
  position: absolute; z-index: 3; pointer-events: none;
  left: 28%; top: -28%; width: 62%; aspect-ratio: 1;
  transform-origin: 70% 92%;
  animation: v2-bonk 0.4s cubic-bezier(.3, 1.4, .5, 1) forwards;
}
.v2-bonk svg { width: 100%; height: 100%; display: block; filter: drop-shadow(0 4px 0 rgba(27, 35, 62, 0.2)); }
.v2-bonk.is-flip { left: auto; right: 28%; transform-origin: 30% 92%; scale: -1 1; }
@keyframes v2-bonk {
  0%   { rotate: 34deg; opacity: 0; }
  25%  { rotate: -16deg; opacity: 1; }
  45%  { rotate: -6deg; }
  80%  { rotate: -10deg; opacity: 1; }
  100% { rotate: 6deg; opacity: 0; }
}

/* ── HUD and prompt: soft glass pills on the night sky (Perform's wallet and buttons) ── */
body.is-v2 .wb-chip { background: rgba(255, 255, 255, 0.14); color: #fff; border-radius: 999px; box-shadow: none;
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
body.is-v2 .wb-chip b { font-family: "Grobold", "Nunito", system-ui, sans-serif; font-weight: 400; }
body.is-v2 .wb-chip small { color: #c3cbe6; opacity: 1; }
body.is-v2 .wb-ask { border-radius: 999px; background: rgba(255, 255, 255, 0.14); padding: 8px 22px; box-shadow: none;
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
body.is-v2 .wb-ask .wb-ask-note { display: inline-block; min-width: 1.3em; text-align: center; border-radius: 999px; padding: 0 0.35em;
  font-family: "Grobold", "Nunito", system-ui, sans-serif; font-weight: 400; }
body.is-v2 .wb-hear { border-radius: 999px; background: rgba(255, 255, 255, 0.16); box-shadow: none;
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
body.is-v2 .wb-hear:active { transform: scale(0.94); box-shadow: none; }

/* ── big words in Grobold: countdown, streak toasts ─────────────────────── */
body.is-v2 .wb-count b { font-family: "Grobold", "Nunito", system-ui, sans-serif; font-weight: 400; color: #fff; text-shadow: 0 6px 0 rgba(3, 6, 20, 0.45); }
body.is-v2 .wb-toast { font-family: "Grobold", "Nunito", system-ui, sans-serif; font-weight: 400; letter-spacing: 0.5px; }

/* ── Sideways play (2026-10-21, the app is landscape only) ─────────────────
   The play screen is one fixed sheet that never scrolls (v1's 300vh ground let a drag pull the page up
   175px, hiding the HUD and parking the top holes under the back arrow). One top row: the back arrow's
   room, the chips, the Find note + a speaker button in the middle, the pause's room. The garden takes
   everything under it, inside the safe area. */
html:has(body.is-v2 #wbPlay:not([hidden])), html:has(body.is-v2 #wbPlay:not([hidden])) body {
  overflow: hidden; overscroll-behavior: none; height: 100%; min-height: 0;
}
body.is-v2 #wbPlay {
  --sl: max(14px, env(safe-area-inset-left)); --sr: max(14px, env(safe-area-inset-right));
  --bot: max(10px, env(safe-area-inset-bottom));
  position: fixed; inset: 0; z-index: 1; overflow: hidden; touch-action: manipulation; overscroll-behavior: none;
  display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-rows: 66px minmax(0, 1fr);
  grid-template-areas: "hud prompt" "field field"; gap: 0;
  padding: 0 calc(var(--sr) + 74px) 0 calc(var(--sl) + 74px);
}
body.is-v2 #wbPlay[hidden] { display: none; }
body.is-v2 .wb-hud { grid-area: hud; padding: 0; align-self: center; flex-wrap: nowrap; gap: 8px; justify-content: flex-start; }
body.is-v2 .wb-chip { min-width: 0; padding: 5px 14px 6px; }
body.is-v2 .wb-chip b { font-size: 21px; }
body.is-v2 .wb-chip small { font-size: 9px; }
body.is-v2 .wb-prompt { grid-area: prompt; position: static; padding: 0 0 0 10px; min-height: 0; flex-wrap: nowrap; gap: 10px; align-self: center; justify-content: center; }
body.is-v2 .wb-field { grid-area: field; margin: 0 calc(-1 * (var(--sr) + 74px)) 0 calc(-1 * (var(--sl) + 74px)); padding: 30px var(--sr) var(--bot) var(--sl); display: flex; align-items: center; min-height: 0; }
body.is-v2 .wb-wave { height: 40px; }
body.is-v2 .wb-field::after { top: 34px; height: 100vh; }
body.is-v2 .wb-field::before { top: -22px; height: 64px; }
/* the garden: as big as the field allows (two rows of four, so 2.17 turns its height into a width) */
body.is-v2 .wb-garden {
  --wb-chrome: calc(66px + 30px + 12px + var(--bot));
  --wb-garden-max: 1000px;
  margin: 0 auto; padding: 4px 4px 0;
  width: min(var(--wb-garden-max), 100%, calc((100dvh - var(--wb-chrome)) * 2.17));
}

/* an iPad: the top row grows with the screen, and the two rows of holes breathe */
@media (min-height: 700px) {
  body.is-v2 #wbPlay { grid-template-rows: 84px minmax(0, 1fr); }
  body.is-v2 .wb-chip { padding: 7px 20px 8px; }
  body.is-v2 .wb-chip b { font-size: 28px; }
  body.is-v2 .wb-chip small { font-size: 11px; }
  body.is-v2 #wbPlay .wb-ask { font-size: 34px; }
  body.is-v2 #wbPlay .wb-hear { width: 64px; height: 64px; }
  body.is-v2 #wbPlay .wb-hear::before { width: 34px; height: 34px; }
  body.is-v2 .wb-garden { row-gap: clamp(26px, 6vh, 64px); --wb-chrome: calc(84px + 30px + 60px + var(--bot)); }
  /* the night needs its sky: on a tall screen the horizon (tree line, wave, lawn) sits lower, so the
     moon, the lights and the stars have room above the field instead of a big empty lawn */
  body.is-v2 .wb-field { --hz: clamp(40px, 11vh, 110px); }
  body.is-v2 .wb-wave { top: var(--hz); }
  body.is-v2 .wb-field::after { top: calc(var(--hz) + 34px); }
  body.is-v2 .wb-field::before { top: calc(var(--hz) - 22px); }
}

/* No reading on the play screen: the Find sign is just the coloured note (high C wears a little mark,
   not the word), Echo needs no "Watch and listen" / "Your turn" (the bells show it), and the replay
   is a speaker, not a sentence. Streak toasts ("YES!", "WOW!") stay quiet: the bells and the sparkle say it. */
body.is-v2 .wb-ask { font-size: 26px; padding: 4px 8px; line-height: 1; }
body.is-v2 .wb-ask .wb-ask-word, body.is-v2 .wb-ask .wb-ask-high { display: none; }
body.is-v2 .wb-ask:not(:has(.wb-ask-note)) { display: none; }
body.is-v2 .wb-ask .wb-ask-note { min-width: 1.6em; padding: 6px 0.45em; position: relative; }
body.is-v2 .wb-ask .wb-ask-note.is-high::after {
  content: ""; position: absolute; left: 50%; top: -7px; width: 9px; height: 9px; margin-left: -4.5px;
  border-radius: 50%; background: currentColor; box-shadow: 0 0 0 2px #fff;
}
body.is-v2 #wbPlay[data-mode="echo-pattern"] .wb-ask { display: none; }
body.is-v2 .wb-hear {
  font-size: 0; width: 52px; height: 52px; padding: 0; display: grid; place-items: center; flex: 0 0 auto;
}
body.is-v2 .wb-hear::before {
  content: ""; width: 28px; height: 28px; background: #fff;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M3 9v6h4l5 4V5L7 9H3z'/%3E%3Cpath d='M15.5 8.5a5 5 0 0 1 0 7' fill='none' stroke='%23000' stroke-width='2.2' stroke-linecap='round'/%3E%3Cpath d='M18.2 5.8a9 9 0 0 1 0 12.4' fill='none' stroke='%23000' stroke-width='2.2' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M3 9v6h4l5 4V5L7 9H3z'/%3E%3Cpath d='M15.5 8.5a5 5 0 0 1 0 7' fill='none' stroke='%23000' stroke-width='2.2' stroke-linecap='round'/%3E%3Cpath d='M18.2 5.8a9 9 0 0 1 0 12.4' fill='none' stroke='%23000' stroke-width='2.2' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat;
}
body.is-v2 .wb-toast { display: none; }

/* the results card (2026-10-22, Rob: "needs a little love ... less big fonts. and not red use navy").
   Sideways and short, inside the safe area, never scrolling. Left: three stars (the reward a 3-year-old
   reads), a short navy line in Nunito and the score; right: Play Again over the menu pill. No frame,
   no outline, a soft shadow only. The grown-up stats line and the score's caption ("FIRST TRY") go. */
body.is-v2 .wb-veil {
  /* 72px on top: the card stays under the back arrow / coin purse row, never beneath them */
  padding: max(72px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  overflow: hidden; touch-action: none;
  background: rgba(5, 8, 24, 0.5);
}
body.is-v2 .wb-stats, body.is-v2 .wb-big small { display: none; }
body.is-v2 .wb-card {
  width: min(520px, 100%); max-height: 100%; overflow: hidden;
  border: 0; border-radius: 28px; background: #fdfbf6; box-shadow: 0 18px 44px rgba(3, 6, 20, 0.45);
  padding: clamp(14px, 4vh, 26px) clamp(18px, 3vw, 30px);
  grid-template-columns: 1fr 1fr; grid-template-areas: "stars again" "title again" "big menu";
  column-gap: clamp(14px, 3vw, 28px); row-gap: clamp(2px, 1vh, 6px); align-items: center;
}
body.is-v2 .wb-res-stars { grid-area: stars; display: flex; gap: 6px; justify-content: center; }
body.is-v2 .wb-res-stars:empty { display: none; }
body.is-v2 .wb-res-stars i {
  width: clamp(26px, 7.4vh, 38px); aspect-ratio: 1; background: #e4e7f1;
  clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
}
body.is-v2 .wb-res-stars i.on { background: linear-gradient(#ffe27a, #f9c53a); animation: v2-star 0.42s cubic-bezier(.3, 1.6, .5, 1) both; }
body.is-v2 .wb-res-stars i.on:nth-child(2) { animation-delay: 0.14s; }
body.is-v2 .wb-res-stars i.on:nth-child(3) { animation-delay: 0.28s; }
@keyframes v2-star { from { scale: 0.2; opacity: 0; } to { scale: 1; opacity: 1; } }
body.is-v2 .wb-card h2 {
  grid-area: title; margin: 0;
  font-family: "Nunito", system-ui, sans-serif; font-weight: 900; font-size: clamp(17px, 4.8vh, 22px); line-height: 1.15;
  color: #1b233e; text-shadow: none; letter-spacing: 0; text-transform: lowercase;
}
body.is-v2 .wb-card h2::first-letter { text-transform: uppercase; }
body.is-v2 .wb-big {
  grid-area: big; align-self: start;
  font-family: "Grobold", "Nunito", system-ui, sans-serif; font-weight: 400; color: #1b233e; text-shadow: none;
  font-size: clamp(34px, 10.5vh, 50px); line-height: 1;
}
body.is-v2 .wb-again {
  grid-area: again; align-self: end; width: 100%; margin: 0; padding: 0 14px;
  height: clamp(48px, 13vh, 60px); display: flex; align-items: center; justify-content: center; gap: 10px;
  font-family: "Nunito", system-ui, sans-serif; font-weight: 900; font-size: clamp(17px, 4.8vh, 21px);
  background: #6ab845; box-shadow: 0 5px 0 #4c8f30;
}
body.is-v2 .wb-again::before {
  content: ""; width: 0.8em; height: 0.9em; background: currentColor; clip-path: polygon(8% 0, 100% 50%, 8% 100%); flex: 0 0 auto;
}
body.is-v2 .wb-menu-btn2 {
  grid-area: menu; align-self: start; justify-self: center; text-decoration: none; min-height: 44px; padding: 10px 22px; margin-top: 8px;
  border-radius: 999px; background: rgba(27, 35, 62, 0.07); color: #1b233e; font-size: 14px; font-weight: 800;
}

/* an upright phone: three picture buttons in one row (the kit's gap is a hair too wide at 390) */
@media (orientation: portrait) and (max-width: 700px) {
  body.is-v2 .kk-big:has(.kk-btn:nth-child(3)) { gap: 10px; flex-wrap: nowrap; }
  body.is-v2 .kk-big:has(.kk-btn:nth-child(3)) .kk-btn { width: min(28vw, 150px); }
}

@media (prefers-reduced-motion: reduce) {
  body.is-v2 .wb-bell svg.wb-rig, body.is-v2 .v2-tw, body.is-v2 .v2-halo, body.is-v2 .wb-res-stars i.on { animation: none; }
  body.is-v2 .wb-pod.is-held .wb-bell { animation: none; transform: translate(-50%, 0); }
}
