/* Traffic Conductor — widget-local styles. Widget chrome (HUD, arena base,
   overlays, score form, leaderboard) lives in ../../style.css. The game
   itself is one canvas; everything visual on the road is drawn in widget.js
   from the palette variables below, so both color schemes stay authoritative
   here even though the pixels are canvas. */

:root {
  --tc-grass: #dbe6d4;
  --tc-road: #6b7280;
  --tc-road-edge: #4b5563;
  --tc-dash: #e5e7eb;
  --tc-box: #f3d67a;
  --tc-car-0: #e2564f;
  --tc-car-1: #3f8cff;
  --tc-car-2: #e8c93e;
  --tc-car-3: #58b368;
  --tc-car-4: #9a6ee0;
  --tc-car-5: #f0913c;
  --tc-bus: #7dd0d6;
  --tc-glass: rgba(21, 30, 46, 0.55);
  --tc-brake: #ff5147;
  --tc-bubble: #ffffff;
  --tc-bubble-ink: #1b2740;
}

@media (prefers-color-scheme: dark) {
  :root {
    --tc-grass: #17211a;
    --tc-road: #333a46;
    --tc-road-edge: #4a5568;
    --tc-dash: #98a4b8;
    --tc-box: #b99b3e;
    /* Same hue family, lifted for contrast on the darker asphalt. */
    --tc-car-0: #ef6a63;
    --tc-car-1: #5ea0ff;
    --tc-car-2: #f0d558;
    --tc-car-3: #6cc97d;
    --tc-car-4: #ab84ea;
    --tc-car-5: #f5a256;
    --tc-bus: #8adde3;
    --tc-glass: rgba(5, 10, 18, 0.6);
    --tc-brake: #ff6157;
    --tc-bubble: #f2f5fa;
    --tc-bubble-ink: #10182a;
  }
}

.arena-tc {
  height: auto;
  min-height: 0;
  padding: 12px 0;
  display: flex;
  justify-content: center;
  background: var(--surface);
}

.tc-stage {
  position: relative;
  width: min(100%, 500px);
  aspect-ratio: 1;
  border-radius: 12px;
  overflow: hidden;
}

.tc-stage:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 4px;
}

/* touch-action: none — stopping a car mid-panic must never scroll the page;
   everything outside the stage scrolls normally. */
#road {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.tc-eulogy {
  font-style: italic;
}

/* Results replace the road (house end-overlay pattern). */
.arena-tc.ended {
  display: block;
}

.arena-tc.ended .tc-stage {
  display: none;
}

.arena-tc.ended .overlay {
  position: static;
}

/* --- HUD bits (house pattern) --------------------------------------------------- */

.toolbar-spacer { flex: 1; }

.hud .tool {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.hud .tool[aria-pressed="true"] {
  background: var(--accent-soft);
  color: var(--accent-ink);
  box-shadow: inset 0 0 0 2px var(--accent);
}

.hud .tool svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.hud .tool svg .fill { fill: currentColor; stroke: none; }

#soundBtn .icon-when-on { display: none; }
#soundBtn[aria-pressed="true"] .icon-when-on { display: initial; }
#soundBtn[aria-pressed="true"] .icon-when-off { display: none; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
