/* ═══════════════════════════════════════════════════════════════
   SUBWAY SHORTCUTS: CORRIDA DOS ATALHOS — F5 NOVA CURSOS
   Design Arcade, Colorido, Urbano & 3D
   ═══════════════════════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --subway-blue: #0284c7;
  --subway-yellow: #facc15;
  --subway-orange: #fb923c;
  --subway-red: #ef4444;
  --subway-green: #10b981;
  --subway-dark: #0f172a;
  --font-arcade: 'Baloo 2', cursive;
  --font-text: 'Nunito', sans-serif;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #020617;
  color: #fff;
  font-family: var(--font-text);
  user-select: none;
}

.runner-container {
  width: 100vw;
  height: 100vh;
  position: relative;
  overflow: hidden;
  background: #020617;
  display: flex;
  flex-direction: column;
}

/* ── TOPBAR NAVEGAÇÃO PRATIQUE ── */
.runner-topbar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 18px;
  background: linear-gradient(180deg, rgba(2, 6, 23, 0.85) 0%, transparent 100%);
  pointer-events: auto;
}
.brand-link {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}
.brand-link img {
  width: 32px;
  height: 32px;
  object-fit: contain;
}
.brand-text strong {
  display: block;
  font-family: var(--font-arcade);
  font-size: 1.05rem;
  color: #fff;
  line-height: 1.1;
}
.brand-text span {
  display: block;
  font-size: 0.62rem;
  font-weight: 800;
  color: var(--subway-yellow);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.top-btns {
  display: flex;
  align-items: center;
  gap: 8px;
}
.top-btn {
  height: 34px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1.5px solid rgba(255, 255, 255, 0.2);
  background: rgba(15, 23, 42, 0.85);
  color: #fff;
  font-family: var(--font-text);
  font-size: 0.8rem;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  backdrop-filter: blur(8px);
  transition: all 0.2s ease;
}
.top-btn:hover {
  background: rgba(56, 189, 248, 0.3);
  border-color: #38bdf8;
  transform: translateY(-2px);
}

/* ── VIEWPORT 3D THREE.JS ── */
#gameCanvasContainer {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
}
#gameCanvasContainer canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

/* ── HUD PRINCIPAL DO JOGO (SUBWAY STYLE) ── */
.runner-hud-overlay {
  position: absolute;
  inset: 0;
  z-index: 20;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 56px 20px 20px;
}

.hud-top-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

/* Placar de Moedas e Multiplicador */
.hud-score-cluster {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.hud-stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(15, 23, 42, 0.88);
  border: 2px solid rgba(250, 204, 21, 0.6);
  padding: 6px 14px;
  border-radius: 99px;
  backdrop-filter: blur(8px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5), 0 0 15px rgba(250, 204, 21, 0.25);
}
.hud-stat-pill .stat-icon {
  font-size: 1.2rem;
}
.hud-stat-pill .stat-val {
  font-family: var(--font-arcade);
  font-size: 1.25rem;
  font-weight: 900;
  color: #fff;
  line-height: 1;
}

.multiplier-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #fff;
  font-family: var(--font-arcade);
  font-size: 1.1rem;
  font-weight: 900;
  padding: 3px 12px;
  border-radius: 99px;
  border: 2px solid #fff;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.5);
  animation: pulseScale 1s infinite alternate;
}
@keyframes pulseScale {
  0% { transform: scale(1); }
  100% { transform: scale(1.12); }
}

/* Vidas e Distância */
.hud-right-cluster {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}
.lives-box {
  display: flex;
  gap: 4px;
  background: rgba(15, 23, 42, 0.88);
  border: 2px solid rgba(244, 63, 94, 0.6);
  padding: 6px 12px;
  border-radius: 99px;
  backdrop-filter: blur(8px);
}
.heart-icon {
  font-size: 1.25rem;
  filter: drop-shadow(0 0 8px #f43f5e);
  transition: transform 0.3s ease, opacity 0.3s ease;
}
.heart-icon.lost {
  opacity: 0.25;
  filter: grayscale(1);
  transform: scale(0.8);
}

.distance-pill {
  border-color: rgba(56, 189, 248, 0.6);
  box-shadow: 0 0 15px rgba(56, 189, 248, 0.25);
}

/* ── BANNER DE PERGUNTA (TOPO DA TELA — não interfere na pista) ── */
.runner-challenge-banner {
  position: fixed;
  left: 50%;
  top: 8%;
  transform: translateX(-50%) translateY(-16px);
  background: linear-gradient(135deg, rgba(2, 6, 23, 0.97) 0%, rgba(15, 23, 42, 0.95) 100%);
  border: 2px solid var(--subway-yellow);
  border-radius: 14px;
  padding: 8px 24px 10px;
  text-align: center;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.85), 0 0 22px rgba(250, 204, 21, 0.5);
  backdrop-filter: blur(10px);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1),
              opacity 0.3s ease;
  max-width: 640px;
  width: 88%;
  z-index: 40;
}
.runner-challenge-banner.visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.challenge-kicker {
  font-size: 0.65rem;
  font-weight: 900;
  color: #38bdf8;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  display: block;
  margin-bottom: 2px;
}
.challenge-title {
  font-family: var(--font-arcade);
  font-size: 1.15rem;
  font-weight: 900;
  color: #fff;
  margin: 0;
  line-height: 1.25;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.9);
}
.challenge-hint {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--subway-yellow);
  display: block;
  margin-top: 3px;
}

/* ── D-PAD TOUCH MOBILE ── */
.runner-touch-controls {
  pointer-events: auto;
  display: none;
  justify-content: space-between;
  align-items: flex-end;
  width: 100%;
  padding: 0 10px 10px;
}
.touch-swipe-grid {
  display: grid;
  grid-template-columns: repeat(3, 58px);
  grid-template-rows: repeat(3, 58px);
  gap: 6px;
}
.t-btn {
  background: rgba(15, 23, 42, 0.85);
  border: 2.5px solid rgba(56, 189, 248, 0.45);
  border-radius: 16px;
  color: #fff;
  font-size: 1.5rem;
  display: grid;
  place-items: center;
  cursor: pointer;
  user-select: none;
  touch-action: manipulation;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.5);
}
.t-btn:active {
  background: #38bdf8;
  color: #020617;
  transform: scale(0.92);
}
.t-up { grid-column: 2; grid-row: 1; }
.t-left { grid-column: 1; grid-row: 2; }
.t-center { grid-column: 2; grid-row: 2; opacity: 0.2; pointer-events: none; }
.t-right { grid-column: 3; grid-row: 2; }
.t-down { grid-column: 2; grid-row: 3; }

/* ── MODAL DE GAME OVER ── */
.gameover-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.92);
  backdrop-filter: blur(14px);
  z-index: 100;
  display: none;
  place-items: center;
  padding: 16px;
}
.gameover-modal-overlay.active {
  display: grid;
  animation: fadeIn 0.3s ease;
}

.gameover-card {
  width: min(500px, 100%);
  background: linear-gradient(145deg, #1e1b4b 0%, #0f172a 100%);
  border: 3.5px solid var(--subway-yellow);
  border-radius: 26px;
  padding: 32px 24px;
  text-align: center;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.95), 0 0 50px rgba(250, 204, 21, 0.35);
  animation: popIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.gameover-icon {
  font-size: 3.8rem;
  line-height: 1;
  margin-bottom: 8px;
}
.gameover-card h2 {
  font-family: var(--font-arcade);
  font-size: 2.2rem;
  color: #fff;
}
.gameover-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 20px 0 24px;
}
.g-stat-box {
  background: rgba(2, 6, 23, 0.75);
  border: 1.5px solid rgba(255, 255, 255, 0.15);
  border-radius: 14px;
  padding: 10px;
}
.g-stat-box strong {
  display: block;
  font-family: var(--font-arcade);
  font-size: 1.5rem;
  color: var(--subway-yellow);
}
.g-stat-box span {
  font-size: 0.72rem;
  font-weight: 800;
  color: #94a3b8;
  text-transform: uppercase;
}

.btn-restart-run {
  background: linear-gradient(135deg, #facc15 0%, #f59e0b 100%);
  color: #0f172a;
  border: none;
  padding: 14px 36px;
  border-radius: 14px;
  font-family: var(--font-arcade);
  font-size: 1.25rem;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(250, 204, 21, 0.5);
  transition: all 0.2s ease;
}
.btn-restart-run:hover {
  transform: translateY(-3px) scale(1.03);
  box-shadow: 0 14px 40px rgba(250, 204, 21, 0.7);
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn { from { transform: scale(0.85); opacity: 0; } to { transform: scale(1); opacity: 1; } }

@media (max-width: 768px) {
  .runner-touch-controls {
    display: flex;
  }
  .challenge-title {
    font-size: 1.15rem;
  }
}
