/* Circuit Courier — styles.
 * Midnight navy + electric teal + coral hazards. Generous, legible type.
 * No emoji as game art. Designed around the game. Responsive to 390px.
 */

:root {
  --navy-0: #070d1e;
  --navy-1: #0a1430;
  --navy-2: #111a3a;
  --teal: #26e0d6;
  --teal-soft: #3df5e6;
  --coral: #ff5a4d;
  --ink: #eaf6ff;
  --ink-dim: #9fb0d0;
  --card: rgba(17, 26, 58, 0.92);
  --line: rgba(38, 224, 214, 0.25);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  /* prevent the game area from causing a horizontal scroll on narrow phones */
  overflow-x: hidden;
}

body {
  min-height: 100dvh;
  display: flex;
  align-items: stretch;
  background: var(--navy-0);
  color: var(--ink);
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue",
      Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.cc-shell {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  padding: 8px 12px 10px;
  gap: 8px;
}

/* ---- HUD ---------------------------------------------------------------- */
.cc-hud {
  width: 100%;
  display: flex;
  justify-content: center;
}
.cc-hud-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  width: 100%;
  justify-content: space-between;
}
.cc-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 58px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(17, 26, 58, 0.6);
}
.cc-stat-label {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-dim);
}
.cc-stat-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--teal-soft);
  line-height: 1;
}
.cc-combo {
  color: #ffd9a0;
  font-weight: 700;
  font-size: 18px;
  justify-content: center;
  align-items: center;
}
.cc-combo[hidden] { display: none; }

.cc-lives {
  display: flex;
  gap: 4px;
  align-items: center;
  min-height: 20px;
}
.cc-lives .life {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  display: inline-block;
}
.cc-lives .life.on {
  background: var(--teal-soft);
  box-shadow: 0 0 8px var(--teal);
}
.cc-lives .life.off {
  background: transparent;
  border: 2px solid rgba(38, 224, 214, 0.4);
}

/* ---- Stage / canvas ------------------------------------------------------ */
/* The playfield is sized by the available stage height AND width (see
   resizeCanvas in game.js): it is a fixed-aspect portrait box that fits
   the viewport, with the HUD and footer controls visible without scrolling. */
.cc-stage {
  position: relative;
  width: 100%;
  display: flex;
  justify-content: center;
  flex: 1;
  min-height: 0;
  min-height: clamp(280px, 58vh, 640px);
}
#board {
  display: block;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--navy-0);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  max-width: 100%;
  max-height: 100%;
  height: auto;
  width: auto;
  image-rendering: pixelated;
}

/* ---- Overlay ------------------------------------------------------------- */
.cc-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(7, 13, 30, 0.55);
  backdrop-filter: blur(2px);
  z-index: 3;
}
.cc-overlay-card {
  width: 100%;
  max-width: 380px;
  text-align: center;
  padding: 24px 22px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.5);
}
.cc-overlay-title {
  margin: 0 0 12px;
  font-size: 30px;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: var(--teal-soft);
}
.cc-overlay-sub {
  margin: 0 0 18px;
  color: var(--ink);
  font-size: 16px;
  line-height: 1.5;
}
.cc-controls p { margin: 0 0 12px; }
.cc-controls ul {
  margin: 0 0 8px;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 14px;
  color: var(--ink-dim);
}
.cc-controls kbd {
  display: inline-block;
  min-width: 22px;
  padding: 2px 6px;
  margin: 0 2px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: rgba(38, 224, 214, 0.08);
  font-size: 12px;
  text-align: center;
  color: var(--teal-soft);
}
.cc-score {
  font-size: 20px;
  color: var(--teal-soft);
  margin: 8px 0 4px;
}
.cc-record {
  color: #ffd9a0;
  font-weight: 700;
}

.cc-btn {
  appearance: none;
  border: 1px solid var(--line);
  background: rgba(38, 224, 214, 0.08);
  color: var(--ink);
  font-size: 16px;
  font-weight: 700;
  padding: 12px 22px;
  border-radius: 10px;
  cursor: pointer;
  min-width: 120px;
  margin: 4px;
  transition: transform 0.08s ease, background 0.12s ease;
}
.cc-btn:hover, .cc-btn:focus-visible {
  background: rgba(38, 224, 214, 0.2);
  outline: 2px solid var(--teal);
  outline-offset: 2px;
}
.cc-btn-primary {
  background: var(--teal);
  color: #04121a;
  border-color: var(--teal);
}
.cc-btn-primary:hover, .cc-btn-primary:focus-visible {
  background: var(--teal-soft);
}
.cc-overlay-buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
}

.cc-hidden { display: none !important; }

/* ---- Footer / touch controls --------------------------------------------- */
.cc-footer {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}
.cc-touchbar {
  display: flex;
  gap: 10px;
  width: 100%;
  justify-content: space-between;
  max-width: 420px;
}
.cc-touch {
  flex: 1;
  min-height: 48px;
  border: 1px solid var(--line);
  background: rgba(38, 224, 214, 0.08);
  color: var(--teal-soft);
  font-size: 20px;
  font-weight: 800;
  border-radius: 12px;
  cursor: pointer;
  user-select: none;
  touch-action: manipulation;
}
.cc-touch:active {
  background: rgba(38, 224, 214, 0.25);
}
.cc-touch-pause {
  font-size: 14px;
  color: var(--ink);
  background: rgba(38, 224, 214, 0.05);
}
.cc-touch:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
}
.cc-byline {
  margin: 0;
  font-size: 11px;
  color: var(--ink-dim);
  text-align: center;
}

/* ---- Reduced motion: calm decorative motion ------------------------------ */
@media (prefers-reduced-motion: reduce) {
  .cc-btn, .cc-touch {
    transition: none;
  }
}

/* ---- Small phone --------------------------------------------------------- */
@media (max-width: 420px) {
  .cc-shell { padding: 8px 8px 12px; gap: 8px; }
  .cc-hud-row { gap: 6px; }
  .cc-stat { min-width: 56px; padding: 6px 8px; }
  .cc-stat-label { font-size: 10px; }
  .cc-stat-value { font-size: 16px; }
  .cc-overlay-title { font-size: 24px; }
  .cc-overlay-sub { font-size: 15px; }
  .cc-touch { min-height: 48px; }
  .cc-touch-pause { font-size: 14px; }
}