/* ═══════════════════════════════════════════════
   ROOTS RUN — Game Stylesheet
   Cinematic reggae arcade style
═══════════════════════════════════════════════ */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --gold:        #c9a227;
  --gold-light:  #e8d08a;
  --green:       #1db87a;
  --green-dark:  #0d7a50;
  --brown-dark:  #120c04;
  --brown-mid:   #2a1a08;
  --text-warm:   rgba(240, 225, 195, 0.9);
  --text-dim:    rgba(180, 160, 120, 0.6);
  --font-head:   'Cinzel', serif;
  --font-ui:     'Rajdhani', sans-serif;
  --font-body:   'Inter', sans-serif;
}

html, body {
  width: 100%;
  height: 100%;
  background: #0a0602;
  color: var(--text-warm);
  font-family: var(--font-body);
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

/* ════════════════════════════════
   SCREENS
════════════════════════════════ */

.screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.screen-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 50% 30%, rgba(42,26,8,0.85) 0%, rgba(8,5,2,0.98) 70%);
  z-index: 0;
}

.screen-bg::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 30% 60%, rgba(29,184,122,0.06) 0%, transparent 55%),
    radial-gradient(ellipse at 70% 20%, rgba(201,162,39,0.07) 0%, transparent 55%);
}

.screen-bg--red {
  background:
    radial-gradient(ellipse at 50% 30%, rgba(60,15,5,0.9) 0%, rgba(8,3,2,0.98) 70%);
}

.screen-bg--gold {
  background:
    radial-gradient(ellipse at 50% 30%, rgba(50,35,5,0.92) 0%, rgba(8,5,2,0.98) 70%);
}

.screen-content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  padding: 40px 32px;
  text-align: center;
  max-width: 480px;
  width: 100%;
}

/* ── Brand tag ── */
.brand-tag {
  font-family: var(--font-ui);
  font-size: 0.62rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--gold);
  opacity: 0.7;
}

/* ── Game title ── */
.game-title {
  font-family: var(--font-head);
  font-size: clamp(2.8rem, 10vw, 5rem);
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--text-warm);
  line-height: 1;
  text-shadow: 0 0 40px rgba(201,162,39,0.3), 0 2px 12px rgba(0,0,0,0.8);
}

.game-title-accent {
  color: var(--gold);
  text-shadow: 0 0 30px rgba(201,162,39,0.5);
}

.game-subtitle {
  font-family: var(--font-ui);
  font-size: 0.9rem;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  max-width: 320px;
  line-height: 1.6;
}

/* ── Key hint ── */
.key-hint {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-ui);
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  color: var(--text-dim);
}

.key-icon {
  background: rgba(201,162,39,0.1);
  border: 1px solid rgba(201,162,39,0.3);
  border-radius: 4px;
  padding: 3px 10px;
  color: var(--gold);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
}

/* ── Buttons ── */
@keyframes btn-gold-pulse {
  0%, 100% { box-shadow: 0 4px 20px rgba(201,162,39,0.40), 0 0 0 1px rgba(255,220,80,0.18); }
  50%       { box-shadow: 0 4px 32px rgba(201,162,39,0.70), 0 0 0 3px rgba(255,220,80,0.28), 0 0 48px rgba(201,162,39,0.22); }
}

.btn-game {
  font-family: var(--font-ui);
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 0.20em;
  text-transform: uppercase;
  color: #0a0602;
  background: linear-gradient(135deg, #c9a227 0%, #f0d458 45%, #c9a227 100%);
  border: none;
  border-radius: 6px;
  padding: 15px 40px;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(201,162,39,0.40), 0 0 0 1px rgba(255,220,80,0.18);
  transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
  margin-top: 8px;
  animation: btn-gold-pulse 2.4s ease-in-out infinite;
}

.btn-game:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 10px 36px rgba(201,162,39,0.60), 0 0 0 2px rgba(255,220,80,0.30);
  filter: brightness(1.12);
  animation: none;
}

.btn-game:active {
  transform: translateY(0) scale(0.98);
  filter: brightness(0.95);
  animation: none;
}

.btn-game--gold {
  background: linear-gradient(135deg, #1db87a 0%, #42e8a0 45%, #1db87a 100%);
  box-shadow: 0 4px 20px rgba(29,184,122,0.45);
  color: #061a10;
  animation: none;
}

.btn-game--gold:hover {
  box-shadow: 0 10px 32px rgba(29,184,122,0.65);
  animation: none;
}

.btn-back {
  font-family: var(--font-ui);
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
  text-decoration: none;
  padding: 6px 0;
  border-bottom: 1px solid transparent;
  transition: color 0.2s, border-color 0.2s;
}

.btn-back:hover {
  color: var(--gold);
  border-bottom-color: rgba(201,162,39,0.3);
}

/* ── Screen score ── */
/* ── New High Score badge ── */
.new-high-score {
  font-family: var(--font-head);
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--gold-light);
  background: rgba(201,162,39,0.14);
  border: 1px solid rgba(201,162,39,0.40);
  border-radius: 6px;
  padding: 8px 22px;
  animation: nhsPulse 1s ease-in-out infinite alternate;
}
.new-high-score--gold {
  color: #fff8d0;
  background: rgba(255,220,80,0.18);
  border-color: rgba(255,220,80,0.50);
}
@keyframes nhsPulse {
  from { opacity: 0.75; transform: scale(0.97); }
  to   { opacity: 1.00; transform: scale(1.02); }
}

.screen-score-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 16px 40px;
  background: rgba(201,162,39,0.06);
  border: 1px solid rgba(201,162,39,0.16);
  border-radius: 6px;
}

.screen-score-label {
  font-family: var(--font-ui);
  font-size: 0.62rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold);
  opacity: 0.7;
}

.screen-score-value {
  font-family: var(--font-head);
  font-size: 2.8rem;
  font-weight: 700;
  color: var(--gold-light);
  line-height: 1;
}

/* ── Screen title ── */
.screen-title {
  font-family: var(--font-head);
  font-size: clamp(1.6rem, 6vw, 2.6rem);
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--text-warm);
  text-shadow: 0 2px 12px rgba(0,0,0,0.7);
}

.screen-title--gold {
  color: var(--gold-light);
  text-shadow: 0 0 30px rgba(201,162,39,0.4);
}

.screen-sub {
  font-family: var(--font-ui);
  font-size: 0.88rem;
  letter-spacing: 0.07em;
  color: var(--text-dim);
  max-width: 300px;
  line-height: 1.6;
}

.complete-icon {
  font-size: 3rem;
  animation: pulse-icon 1.8s ease-in-out infinite;
}

@keyframes pulse-icon {
  0%, 100% { transform: scale(1);   opacity: 1; }
  50%       { transform: scale(1.12); opacity: 0.85; }
}

/* ── Decorative elements on start screen ── */
.screen-deco {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  overflow: hidden;
}

.deco-leaf {
  position: absolute;
  font-size: 4rem;
  opacity: 0.08;
  animation: sway 6s ease-in-out infinite;
}

.deco-leaf--1 { top: 10%; left: -2%; animation-delay: 0s; }
.deco-leaf--2 { bottom: 15%; right: -1%; animation-delay: 2s; font-size: 6rem; }

@keyframes sway {
  0%, 100% { transform: rotate(-8deg) scale(1); }
  50%       { transform: rotate(8deg)  scale(1.04); }
}

.deco-record {
  position: absolute;
  bottom: 8%;
  left: 6%;
  font-size: 5rem;
  opacity: 0.05;
  animation: spin-slow 12s linear infinite;
}

@keyframes spin-slow {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* ════════════════════════════════
   HOW TO PLAY SCREEN
════════════════════════════════ */

.howto-content {
  gap: 12px;
  max-width: 520px;
}

.howto-jump {
  margin: 4px 0 2px;
}

.howto-section-label {
  font-family: var(--font-ui);
  font-size: 0.58rem;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--gold);
  opacity: 0.65;
  margin-top: 6px;
}

/* ── Collectibles grid ── */
.howto-items {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px 10px;
  width: 100%;
}

.howto-item {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(201,162,39,0.06);
  border: 1px solid rgba(201,162,39,0.14);
  border-radius: 5px;
  padding: 6px 8px;
}

.howto-item--rare {
  background: rgba(201,162,39,0.10);
  border-color: rgba(201,162,39,0.25);
}

.howto-emoji {
  font-size: 1.1rem;
  flex-shrink: 0;
}

.howto-name {
  font-family: var(--font-ui);
  font-size: 0.72rem;
  color: var(--text-warm);
  flex: 1;
  letter-spacing: 0.04em;
}

.howto-pts {
  font-family: var(--font-head);
  font-size: 0.72rem;
  color: var(--gold-light);
  white-space: nowrap;
}

/* ── Obstacles row ── */
.howto-obstacles {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  justify-content: center;
  width: 100%;
}

.howto-obs {
  font-family: var(--font-ui);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  background: rgba(200,50,30,0.08);
  border: 1px solid rgba(200,50,30,0.18);
  border-radius: 4px;
  padding: 4px 10px;
}

@media (max-width: 480px) {
  .howto-items {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ════════════════════════════════
   GAME CANVAS WRAP
════════════════════════════════ */

.game-wrap {
  position: fixed;
  inset: 0;
  background: #0a0602;
}

#gameCanvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* ════════════════════════════════
   HUD
════════════════════════════════ */

.hud-music-btn {
  pointer-events: all;
  margin-left: auto;
  background: rgba(201,162,39,0.10);
  border: 1px solid rgba(201,162,39,0.30);
  border-radius: 5px;
  color: var(--gold-light);
  font-family: var(--font-ui);
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  padding: 4px 10px;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
  white-space: nowrap;
}
.hud-music-btn:hover { background: rgba(201,162,39,0.22); border-color: rgba(201,162,39,0.55); }
.hud-music-btn.muted  { opacity: 0.45; }

.btn-music-start {
  background: transparent;
  border: 1px solid rgba(201,162,39,0.30);
  border-radius: 5px;
  color: var(--gold);
  font-family: var(--font-ui);
  font-size: 0.62rem;
  letter-spacing: 0.18em;
  padding: 6px 18px;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}
.btn-music-start:hover { background: rgba(201,162,39,0.10); border-color: rgba(201,162,39,0.50); }
.btn-music-start.muted { opacity: 0.45; }

.hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 10px 20px;
  background: linear-gradient(180deg, rgba(4,2,1,0.92) 0%, rgba(4,2,1,0.4) 70%, transparent 100%);
  pointer-events: none;
  z-index: 10;
}

.hud-score,
.hud-level {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  min-width: 56px;
}

.hud-label {
  font-family: var(--font-ui);
  font-size: 0.50rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--gold);
  opacity: 0.75;
  text-shadow: 0 0 8px rgba(201,162,39,0.4);
}

.hud-value {
  font-family: var(--font-head);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--gold-light);
  line-height: 1;
  text-shadow: 0 0 12px rgba(232,208,138,0.5);
  letter-spacing: 0.04em;
}

/* Progress bar */
.hud-progress {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 7px;
  background: rgba(255,255,255,0.06);
  border-radius: 4px;
  border: 1px solid rgba(255,255,255,0.05);
  position: relative;
  overflow: visible;
}

.hud-progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #0e6830, #28cc70, #60e890);
  border-radius: 4px;
  transition: width 0.25s ease;
  box-shadow: 0 0 10px rgba(40,204,112,0.55);
}

.hud-progress-icon {
  font-size: 1rem;
  flex-shrink: 0;
}

/* ── Health bar ── */
.hud-health {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  flex-shrink: 0;
}

.hud-health-bar {
  display: flex;
  gap: 3px;
}

.hud-health-seg {
  width: 16px;
  height: 13px;
  border-radius: 3px;
  background: rgba(180,120,60,0.10);
  border: 1px solid rgba(200,140,60,0.18);
  transition: background 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.hud-health-seg.filled {
  background: linear-gradient(135deg, #e83828, #c02010);
  border-color: #ff6050;
  box-shadow: 0 0 8px rgba(230,56,40,0.75), 0 0 2px rgba(255,100,80,0.5);
}

.hud-health-seg.shake {
  animation: seg-shake 0.25s ease;
}

@keyframes seg-shake {
  0%   { transform: scale(1.3); }
  50%  { transform: scale(0.9); }
  100% { transform: scale(1); }
}

@media (max-width: 480px) {
  .hud-health-seg {
    width: 11px;
    height: 10px;
  }
}

/* ════════════════════════════════
   TAP ZONE (mobile)
════════════════════════════════ */

.tap-zone {
  position: absolute;
  inset: 0;
  z-index: 5;
  /* transparent overlay for touch input */
}

/* ════════════════════════════════
   RESPONSIVE
════════════════════════════════ */

@media (max-width: 480px) {
  .screen-content {
    padding: 32px 20px;
    gap: 14px;
  }

  .hud {
    padding: 8px 14px;
    gap: 16px;
  }

  .hud-value {
    font-size: 1rem;
  }

  .btn-game {
    padding: 12px 28px;
    font-size: 0.82rem;
  }
}

/* ═══════════════════════════════════════════════
   LEVEL 2 — KINGSTON STREETS additions
═══════════════════════════════════════════════ */

/* Transition screen city background */
.screen-bg--city {
  background: linear-gradient(180deg,
    #1a0e30 0%,
    #2e1840 20%,
    #5a2818 55%,
    #8a4010 80%,
    #c06020 100%
  );
}

/* Transition screen — level tag */
.transition-level-tag {
  font-family: var(--font-ui);
  font-size: 0.70rem;
  letter-spacing: 0.38em;
  text-transform: uppercase;
  color: var(--gold);
  opacity: 0.80;
  margin-bottom: 6px;
}

/* Score row on transition screen */
.transition-score-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 14px 36px;
  background: rgba(201,162,39,0.06);
  border: 1px solid rgba(201,162,39,0.18);
  border-radius: 6px;
  margin-top: 8px;
}

/* Transition screen fade animation */
.screen--transition {
  animation: none;
}

/* ════════════════════════════════
   COMING SOON SCREEN
════════════════════════════════ */
.screen--comingsoon {
  display: flex;
  align-items: stretch;
  justify-content: center;
  overflow: hidden;
}

/* Full-bleed Kingston background SVG */
.cs-bg-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}

/* Main layout container */
.comingsoon-wrap {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 20px;
  width: 100%;
  max-width: 1100px;
  padding: 0 16px 24px;
  margin: auto;
}

/* LEFT column: rastaman + sign + speaker */
.comingsoon-left {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-end;
}

.rasta-svg {
  width: clamp(220px, 34vw, 400px);
  height: auto;
  filter: drop-shadow(0 12px 32px rgba(0,0,0,0.65));
}

/* Lantern pulse animation */
.cs-lantern-glow {
  animation: csLanternPulse 2.4s ease-in-out infinite;
  transform-origin: center;
}
@keyframes csLanternPulse {
  0%, 100% { opacity: 0.7; }
  50%       { opacity: 1.0; }
}

/* RIGHT column: text + scores + buttons */
.comingsoon-panel {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
  padding-bottom: 8px;
  /* subtle dark panel so text is readable over the city bg */
  background: rgba(10,6,2,0.60);
  border: 1px solid rgba(201,162,39,0.15);
  border-radius: 14px;
  padding: 22px 24px 20px;
  backdrop-filter: blur(4px);
}

.comingsoon-title {
  font-family: var(--font-head);
  font-size: clamp(1.6rem, 4vw, 2.8rem);
  font-weight: 700;
  color: var(--gold);
  letter-spacing: 0.12em;
  text-shadow: 0 0 32px rgba(201,162,39,0.65), 0 2px 0 #000;
  line-height: 1.1;
}

/* Congratulations block */
.comingsoon-congrats {
  border-top: 1px solid rgba(201,162,39,0.18);
  border-bottom: 1px solid rgba(201,162,39,0.18);
  padding: 10px 0;
  width: 100%;
}

.comingsoon-congrats-head {
  font-family: var(--font-head);
  font-size: clamp(0.85rem, 2vw, 1.1rem);
  font-weight: 700;
  color: var(--gold-light);
  letter-spacing: 0.18em;
  margin-bottom: 6px;
}

.comingsoon-congrats-body {
  font-family: var(--font-body);
  font-size: clamp(0.70rem, 1.5vw, 0.82rem);
  color: var(--text-warm);
  line-height: 1.7;
  opacity: 0.80;
}

/* Score rows */
.comingsoon-scores {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 100%;
}

/* Buttons */
.comingsoon-btns {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
  width: 100%;
}

/* ── Mobile ── */
@media (max-width: 680px) {
  .comingsoon-wrap {
    flex-direction: column;
    align-items: center;
    padding-bottom: 16px;
    gap: 12px;
    overflow-y: auto;
    max-height: 100vh;
  }
  .comingsoon-left {
    order: 1;
  }
  .comingsoon-panel {
    order: 2;
    width: 100%;
  }
  .rasta-svg {
    width: clamp(180px, 55vw, 260px);
  }
}
