/* COUNTING COVE — flat bright kid aesthetic, touch-first, no fonts/images
   fetched. Pattern copied from fractions-3d style.css. The WebGL canvas has a
   transparent clear color, so the sunny cove sky behind everything IS this
   gradient: warm morning gold at the horizon rising into turquoise high sky. */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  width: 100%; height: 100%; overflow: hidden;
  font-family: "Trebuchet MS", "Comic Sans MS", Verdana, sans-serif;
  background: linear-gradient(180deg,
    rgb(64, 156, 214) 0%,
    rgb(110, 190, 230) 30%,
    rgb(172, 224, 240) 55%,
    rgb(246, 222, 168) 82%,
    rgb(250, 232, 190) 100%);
  touch-action: none; -webkit-user-select: none; user-select: none;
  overscroll-behavior: none;
}
#game3d { position: fixed; inset: 0; display: block; touch-action: none; }

/* ---------- top bar ---------- */
#topbar {
  position: fixed; top: calc(10px + env(safe-area-inset-top)); right: 14px; z-index: 8;
  display: flex; gap: 10px;
}
.pillBtn {
  width: 56px; height: 56px; border: 0; border-radius: 50%;
  background: rgba(255,255,255,.85); color: #0b7285; font-size: 26px; cursor: pointer;
  box-shadow: 0 4px 0 rgba(0,0,0,.15);
}
.pillBtn:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(0,0,0,.15); }
.pillBtn.off { opacity: .45; }

/* ---------- big label ---------- */
#wordLabel {
  position: fixed; top: calc(12px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%);
  max-width: 78vw; padding: 14px 36px; border-radius: 30px;
  background: #ffffff; color: #2b3a55;
  /* round 2: bigger floor + ceiling so the count word reads at tablet distance
     (5vmin→6.2vmin, 52→60px cap) without overflowing the 78vw pill on phones */
  font-size: clamp(28px, 6.2vmin, 60px); font-weight: 900; text-align: center;
  box-shadow: 0 5px 0 rgba(0,0,0,.15);
  z-index: 7; pointer-events: none; min-height: 1em;
}
/* per-beat label colors: cove = sea teal, count = coral (the count pops),
   tide = sky blue, many = sun gold, down = deep sea, hero = white-gold */
#wordLabel[data-link="cove"]  { background: #c3fae8; color: #087f5b; }
#wordLabel[data-link="count"] { background: #ffe3e3; color: #c92a2a; }
#wordLabel[data-link="tide"]  { background: #d0ebff; color: #1971c2; }
#wordLabel[data-link="many"]  { background: #ffec99; color: #b08900; }
#wordLabel[data-link="down"]  { background: #a5d8ff; color: #1864ab; }
#wordLabel[data-link="hero"]  { background: #fff9e6; color: #9a7b00; }
/* Phone width: the wide word (MORE CRITTERS! TEN 10 CRITTERS!) slides under the
   pill buttons and hides the read-again control — drop the label below the top bar. */
@media (max-width: 900px) { #wordLabel { top: calc(78px + env(safe-area-inset-top)); } }
#wordLabel.pop { animation: labelPop .5s ease-out; }
@keyframes labelPop { 0% { transform: translateX(-50%) scale(.5); opacity: 0; }
                      60% { transform: translateX(-50%) scale(1.12); opacity: 1; }
                      100% { transform: translateX(-50%) scale(1); } }

/* ---------- micro-pop (TAP THEM IN! / BLAST OFF!) — deliberately quieter
   than the big label ---------- */
#microPop {
  position: fixed; top: 24%; left: 50%; transform: translateX(-50%) scale(.6);
  padding: 8px 22px; border-radius: 20px; z-index: 7; pointer-events: none;
  background: rgba(255,255,255,.92); color: #0b7285;
  font-size: clamp(18px, 3vmin, 30px); font-weight: 900; opacity: 0;
  box-shadow: 0 3px 0 rgba(0,0,0,.15);
}
#microPop.pop { animation: microPop 1.0s ease-out; }
@keyframes microPop { 0% { opacity: 0; transform: translateX(-50%) scale(.6); }
                      18% { opacity: 1; transform: translateX(-50%) scale(1.06); }
                      75% { opacity: 1; transform: translateX(-50%) scale(1); }
                      100% { opacity: 0; transform: translateX(-50%) scale(.94); } }

/* ---------- first-time hint ---------- */
#handHint {
  position: fixed; bottom: calc(22px + env(safe-area-inset-bottom)); left: 50%;
  transform: translateX(-50%);
  padding: 12px 26px; border-radius: 26px; z-index: 7; pointer-events: none;
  background: rgba(255,255,255,.88); color: #0b7285;
  font-size: clamp(18px, 3.4vmin, 30px); font-weight: 900;
  box-shadow: 0 4px 0 rgba(0,0,0,.15);
  animation: hintBob 1.6s ease-in-out infinite;
  transition: opacity .6s ease, transform .6s ease;
}
#handHint.gone { opacity: 0; transform: translateX(-50%) translateY(30px); }
@keyframes hintBob { 0%,100% { margin-bottom: 0; } 50% { margin-bottom: 10px; } }

/* 2026-11-05 phone layout fixes (Claude Code, Ryan: "fix and finish all 18 learning apps").
   left:50% + translateX(-50%) with no width made these shrink-to-fit inside HALF the screen: on a phone the hint
   wrapped to 5-6 lines in a 192px bubble and two-word titles broke onto two lines. max-content + a screen-wide cap fixes it. */
#handHint { width: max-content; max-width: calc(100vw - 32px); text-align: center; }
#wordLabel { width: max-content; }
#wordLabel:empty { display: none; }   /* an empty white pill showed before the first word */

/* ---------- ten frame: two rows of five, left edge, dots fill as critters are counted ---------- */
#tenFrame { position: fixed; left: 12px; top: 42%; z-index: 6; display: grid; grid-template-columns: repeat(5, 26px); grid-auto-rows: 26px; gap: 4px;
  padding: 8px; background: rgba(255,255,255,.72); border-radius: 14px; box-shadow: 0 4px 0 rgba(0,0,0,.14); pointer-events: none; transition: box-shadow .3s; }
#tenFrame i { border: 3px solid #74c0fc; border-radius: 50%; background: transparent; transition: background .2s, transform .2s; }
#tenFrame i.on { background: #ff6b6b; border-color: #ff6b6b; transform: scale(1.06); }
#tenFrame.full5 { box-shadow: 0 4px 0 rgba(0,0,0,.14), 0 0 0 4px rgba(255,212,59,.65); }
#tenFrame.full10 { box-shadow: 0 4px 0 rgba(0,0,0,.14), 0 0 0 6px rgba(81,207,102,.8); }
@media (max-width: 520px) { #tenFrame { top: 30%; left: 8px; grid-template-columns: repeat(5, 20px); grid-auto-rows: 20px; gap: 3px; padding: 6px; } }
