/* colors.css - Colors: a gumball-machine balloon popper. Reuses tokens
   from styles.css and game-shell.css's shell/bar/pause chrome, same as
   every other game. No joystick -- the whole interaction is a direct
   drag on the board itself (closer to Letters'/Sliders' control-free
   posture than the twin-stick games). */

.colors-stage {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 10px;
  gap: 8px;
}

.colors-stats {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  flex: 0 0 auto;
  flex-wrap: wrap;
}

/* Mobile clearance for the shell's own left/right button cluster (see
   game-shell.css) -- same pattern every game's own stats row uses.
   Balloons/Coins were later removed from this row entirely ("hide coins
   and balloon count on header to save room"), which is what let the
   min-width floor come back up from the more aggressive 0 this row
   needed while it briefly held 5 stats (Balloons/Moves/Score/Left/
   Coins, see this project's own history for that tightening) -- with
   just 3 (Moves/Score/Left) left, a small floor is enough to keep them
   comfortably on one line without needing the smaller mobile-only font
   override that row also needed at the time. */
@media (max-width: 480px) {
  .colors-stats {
    padding: 0 var(--gs-bar-right-clear) 0 var(--gs-bar-left-clear);
    gap: 10px;
  }
  .colors-stats .colors-stat {
    min-width: 40px;
  }
}

.colors-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.1;
  min-width: 56px;
}

.colors-stat-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .08em;
  font-weight: 600;
  color: var(--muted);
}

.colors-stat-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

/* Fixed widths sized for each value's largest realistic form (score is
   shown compactly past 99999 -- see formatScoreCompact() in colors.js),
   so the stats row is the SAME width no matter what the numbers are.
   Real bug found & fixed: a big fibonacci pop (a "32000+ pt hit") could
   lengthen the score enough to wrap this row onto another line mid-game,
   shrinking the board with no window resize event -- which, on iPhone,
   left bottom-row balloons untappable. With fixed widths, whether the
   row wraps is decided once at load and never changes during play. */
#colorsLevel { min-width: 2ch; }
#colorsMoves,
#colorsBalloons { min-width: 3ch; }
#colorsScore { min-width: 5ch; }

.colors-board-wrap {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
}

.colors-canvas {
  display: block;
  width: 100%;
  height: 100%;
  background: #14181f;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  touch-action: none;
}

/* Per-level countdown -- per explicit instruction ("a timer starts at
   level 3 at 3 minutes decreasing 15 secs a level after down to 90
   seconds"). Hidden entirely (via the `hidden` attribute, toggled in
   colors.js's updateTimerBar()) on levels 1-2, which have no timer at
   all. Same bright-line/numeric-readout/slow-red-flash-under-10s
   pattern this project already uses for every other per-round timer
   (Letters' own word countdown, Numbers', Doors').
   Made deliberately more prominent, per a live report ("ensure the
   timer is always visible on the bottom of colours ... it's running
   but isn't known until it runs out"): the ORIGINAL 3px line with a
   near-invisible (8% opacity) track and 11px `--muted`-gray text was
   technically rendering and counting down correctly the whole time
   (confirmed directly -- not a positioning/hidden-attribute bug) but
   was easy to miss entirely during fast-paced balloon gameplay,
   especially against the canvas's own busy, colorful content right
   above it. Now a real, opaque dark pill track (not a thin near
   -invisible line) plus a bold white text chip with its own background,
   so both read as a persistent HUD element regardless of what's
   happening on the board behind them.
   MOVED from the bottom to just below the top edge, per an immediate
   explicit follow-up instruction -- the balloon pile grows from the
   BOTTOM up over the course of a level, so anchoring it there meant it
   was increasingly likely to sit right in front of (or, on the original
   near-transparent styling, effectively behind) the thickest part of
   the pile; the top of the canvas stays clearer for far longer. The
   opaque-background fix above still matters just as much here -- a
   balloon scattering in during the intro drop, or the overflow stack
   poking through on a later level, can still pass directly behind it,
   same as the pile could at the bottom. */
.colors-timer-bar {
  position: absolute;
  left: 8px;
  right: 8px;
  top: 8px;
  height: 8px;
  border-radius: 999px;
  /* Solidly opaque, per the exact live report ("the balloons cover it
     instead of sitting on top") -- the DOM bar always painted above the
     canvas in real stacking order the whole time (confirmed directly),
     but its original near-transparent (.08 alpha) track let a bright
     balloon sitting right behind it show straight through, LOOKING
     covered even though it technically wasn't. A real, solid background
     (matching this project's own established "75% opaque" overlay
     convention elsewhere, e.g. the high-score panel) can't be seen
     through no matter what's on the canvas underneath it. */
  background: rgba(0, 0, 0, .82);
  border: 1px solid rgba(255, 255, 255, .18);
  overflow: hidden;
  z-index: 6;
}

.colors-timer-fill {
  height: 100%;
  width: 100%;
  background: #34d399;
  transition: width .2s linear;
}

.colors-timer-fill.is-urgent {
  animation: colors-timer-flash 1.6s ease-in-out infinite;
}

@keyframes colors-timer-flash {
  0%, 100% { background: #f87171; opacity: 1; }
  50% { background: #f87171; opacity: .35; }
}

.colors-timer-text {
  position: absolute;
  right: 10px;
  top: 22px;
  padding: 2px 9px;
  border-radius: 999px;
  background: rgba(0, 0, 0, .82); /* same solid-not-see-through fix as .colors-timer-bar's own */
  border: 1px solid rgba(255, 255, 255, .18);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .3px;
  color: #fff;
  z-index: 6;
  font-variant-numeric: tabular-nums;
}

.colors-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 13, 16, .72);
  border-radius: var(--radius);
}

.colors-overlay[hidden] { display: none; }

/* Graphics refresh: the START overlay is lighter (.55) than the
   game-over overlay (.72) so the attract-mode balloon pile behind it
   actually shows through -- same pattern as Vines' own
   .vines-overlay--start. The game-over overlay keeps the darker .72
   so the final board stays subdued behind the result. */
.colors-overlay--start {
  background: rgba(10, 13, 16, .55);
}

.colors-overlay-card {
  text-align: center;
  padding: 24px;
  max-width: 340px;
}

.colors-overlay-title {
  font-family: Georgia, serif;
  font-size: 26px;
  color: var(--text);
  margin-bottom: 8px;
}

.colors-overlay-text {
  color: var(--muted);
  font-size: 14px;
  margin: 0 0 18px;
}
