:root {
  --theme-bg: #030712;
  --theme-card-bg: rgba(11, 18, 33, 0.96);
  --theme-accent: #00f0ff;
  --theme-border: #142442;
  --text-main: #f8fafc;
  --text-dim: #94a3b8;
  --gold: #fbbf24;
  --danger: #ef4444;
  --success: #10b981;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

body {
  background-color: #010409;
  color: var(--text-main);
  font-family: "Inter", sans-serif;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  width: 100vw;
  touch-action: none;
}

.font-arcade {
  font-family: "Orbitron", monospace;
}

/* Outer Arcade Frame */
#arcade-container {
  position: relative;
  width: 100vw;
  height: 100vh;
  max-width: 480px;
  max-height: 940px;
  background: #02040a;
  display: flex;
  flex-direction: column;
  box-shadow:
    0 0 50px rgba(0, 0, 0, 0.95),
    0 0 0 1px #111d33;
}

@media (min-width: 500px) {
  #arcade-container {
    border-radius: 20px;
    overflow: hidden;
    height: 96vh;
  }
}

/* HUD Bar */
.arcade-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px;
  background: rgba(8, 14, 26, 0.96);
  border-bottom: 1px solid var(--theme-border);
  z-index: 40;
}

.hud-stat-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.hud-box {
  display: flex;
  flex-direction: column;
  background: rgba(255, 255, 255, 0.03);
  padding: 2px 7px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.hud-box .label {
  font-size: 8px;
  letter-spacing: 1px;
  color: var(--text-dim);
  font-weight: 700;
  font-family: "Orbitron", monospace;
}

.hud-box .val {
  font-size: 13px;
  font-weight: 800;
  color: #38bdf8;
}

.hud-wallet-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  background: rgba(251, 191, 36, 0.12);
  border: 1px solid rgba(251, 191, 36, 0.35);
  border-radius: 999px;
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  font-weight: 800;
  color: var(--gold);
}

.admin-tag {
  background: var(--danger);
  color: #fff;
  font-size: 8px;
  padding: 1px 4px;
  border-radius: 3px;
  font-weight: 800;
}

.hud-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.icon-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-main);
  padding: 6px 8px;
  border-radius: 8px;
  font-size: 12px;
  cursor: pointer;
  touch-action: manipulation;
}

/* Floating Ad Pill */
#ad-free-chest-btn {
  position: absolute;
  top: 56px;
  left: 12px;
  z-index: 45;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  border: 1px solid #fde68a;
  padding: 4px 10px;
  border-radius: 999px;
  font-family: "JetBrains Mono", monospace;
  font-size: 10px;
  font-weight: 800;
  color: #050814;
  display: flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  box-shadow: 0 0 14px rgba(245, 158, 11, 0.45);
  touch-action: manipulation;
}

/* Canvas Viewport */
.arcade-screen {
  position: relative;
  flex: 1;
  width: 100%;
  height: 100%;
  background: #02040a;
  overflow: hidden;
}

canvas#gameCanvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.arcade-screen::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none !important;
  z-index: 15;
  background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.2) 50%);
  background-size: 100% 3px;
  opacity: 0.35;
  box-shadow: inset 0 0 45px rgba(0, 0, 0, 0.85);
}

/* Floating HUD Layer */
.in-game-ui-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 12px;
  z-index: 20;
}

.powerup-hud-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-width: 75%;
}

.powerup-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px;
  border-radius: 6px;
  background: rgba(15, 23, 42, 0.85);
  font-size: 10px;
  font-weight: 700;
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-family: "JetBrains Mono", monospace;
}

.touch-hint-pill {
  align-self: center;
  background: rgba(8, 14, 26, 0.9);
  border: 1px solid rgba(0, 240, 255, 0.4);
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 11px;
  color: #38bdf8;
  font-family: "Orbitron", monospace;
  box-shadow: 0 0 16px rgba(0, 240, 255, 0.2);
  animation: pulseHint 2s infinite;
}

@keyframes pulseHint {
  0%,
  100% {
    opacity: 0.8;
    transform: scale(1);
  }
  50% {
    opacity: 1;
    transform: scale(1.03);
  }
}

.combo-pill {
  align-self: flex-end;
  text-align: right;
}

.combo-label {
  font-size: 9px;
  color: var(--text-dim);
  display: block;
  font-family: "Orbitron", monospace;
}

.combo-val {
  font-size: 16px;
  font-weight: 800;
  color: var(--gold);
}

/* Overlays */
.overlay-screen {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(3, 7, 18, 0.94);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 60 !important;
  padding: 20px;
  text-align: center;
  pointer-events: auto !important;
}

.clear-reward {
  margin: 8px 0 20px;
  padding: 10px 18px;
  border: 1px solid rgba(251, 191, 36, 0.75);
  border-radius: 10px;
  background: rgba(251, 191, 36, 0.16);
  box-shadow: 0 0 20px rgba(251, 191, 36, 0.3);
  color: #fbbf24;
  font-size: 16px;
  font-weight: 900;
  letter-spacing: 1px;
  text-shadow: 0 0 10px rgba(251, 191, 36, 0.5);
}

.menu-content-card {
  width: 100%;
  max-width: 320px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.engine-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 14px;
  background: rgba(0, 240, 255, 0.06);
  border: 1px solid rgba(0, 240, 255, 0.35);
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1px;
  color: #00f0ff;
  font-family: "Orbitron", monospace;
}

.pulse-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #00f0ff;
  box-shadow: 0 0 8px #00f0ff;
  animation: pulseDot 1.8s infinite;
}

@keyframes pulseDot {
  0%,
  100% {
    opacity: 0.3;
    transform: scale(0.9);
  }
  50% {
    opacity: 1;
    transform: scale(1.2);
  }
}

.main-title {
  font-size: 32px;
  line-height: 1.1;
  font-weight: 900;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: #38bdf8;
  text-shadow: 0 0 25px rgba(56, 189, 248, 0.45);
}

.sub-deluxe {
  display: block;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 2px;
  color: #00f0ff;
  text-transform: lowercase;
  margin-top: 3px;
}

.stage-highlights-desc {
  font-size: 12px;
  line-height: 1.45;
  color: #94a3b8;
  text-align: center;
  max-width: 290px;
}

.highlight-stats-box {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 12px 16px;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid #0284c7;
  border-radius: 12px;
  box-shadow: 0 0 16px rgba(2, 132, 199, 0.2);
}

.stat-col {
  display: flex;
  flex-direction: column;
  text-align: left;
}

.stat-col.right-align {
  text-align: right;
}

.stat-label {
  font-size: 9px;
  letter-spacing: 1px;
  color: #64748b;
  font-weight: 800;
  margin-bottom: 2px;
  font-family: "Orbitron", monospace;
}

.stat-val {
  font-size: 16px;
  font-weight: 800;
}

.stage-cyan {
  color: #38bdf8;
}
.vault-gold {
  color: #fbbf24;
}

.btn-launch {
  width: 100%;
  padding: 15px 18px;
  background: linear-gradient(180deg, #00f0ff 0%, #0284c7 100%);
  border: none;
  border-radius: 10px;
  color: #030712;
  font-size: 15px;
  font-weight: 900;
  letter-spacing: 1.5px;
  cursor: pointer;
  box-shadow:
    0 0 24px rgba(0, 240, 255, 0.5),
    inset 0 1px 1px #fff;
  touch-action: manipulation;
}
.btn-launch:active {
  transform: scale(0.97);
  filter: brightness(1.1);
}

.action-grid-3 {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
}

.btn-card-action {
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid #1e293b;
  color: #e2e8f0;
  padding: 10px 4px;
  border-radius: 8px;
  font-family: "Orbitron", monospace;
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  touch-action: manipulation;
}
.btn-card-action:active {
  background: rgba(30, 41, 59, 0.9);
  border-color: #00f0ff;
}

/* Animations */
.anim-icon {
  display: inline-block;
}
.float-icon {
  animation: iconFloat 2.2s infinite ease-in-out;
}
@keyframes iconFloat {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-3px);
  }
}
.spin-icon {
  animation: iconSpin 8s infinite linear;
}
@keyframes iconSpin {
  100% {
    transform: rotate(360deg);
  }
}
.pulse-icon {
  animation: iconPulse 1.8s infinite ease-in-out;
}
@keyframes iconPulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.15);
  }
}

#auth-status-container {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 6px;
}

#btn-open-leaderboard {
  width: 100%;
}

#account-status {
  min-height: 14px;
  font-size: 10px;
  text-align: center;
  flex-direction: column;
  gap: 6px;
}

#btn-open-leaderboard {
  width: 100%;
}

#account-status {
  min-height: 14px;
  font-size: 10px;
  text-align: center;
}

#google-synced-pill {
  width: 100%;
  max-width: 280px;
  padding: 4px 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: "JetBrains Mono", monospace;
  color: #34d399;
}

.google-synced-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}

#google-synced-name {
  font-size: 12px;
}

#google-synced-text {
  font-size: 10px;
  font-weight: 500;
  color: var(--text-dim);
}

.google-icon-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  color: #000;
  font-size: 10px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
}

.google-signin-retry {
  min-width: 280px;
  min-height: 40px;
  padding: 8px 16px;
  border: 1px solid rgba(148, 163, 184, 0.55);
  border-radius: 6px;
  background: #fff;
  color: #1f2937;
  font-family: "Inter", sans-serif;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.google-signin-retry:disabled {
  cursor: wait;
  opacity: 0.7;
}

#google-signin-button {
  min-width: 280px;
  min-height: 40px;
}

.btn-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  max-width: 280px;
}

.btn-gold {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #000;
  border: none;
  padding: 12px;
  border-radius: 8px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 0 20px rgba(245, 158, 11, 0.4);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.5);
  color: #fca5a5;
  padding: 12px;
  border-radius: 8px;
  font-weight: 800;
  cursor: pointer;
}

.modal-sheet {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  background: var(--theme-card-bg);
  z-index: 80 !important;
  padding: 18px;
  overflow-y: auto;
  pointer-events: auto !important;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--theme-border);
  padding-bottom: 12px;
  margin-bottom: 16px;
}

.modal-header h3 {
  font-size: 16px;
  font-weight: 800;
  color: var(--theme-accent);
}

.close-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  font-size: 16px;
  cursor: pointer;
}

/* Road Map List & Locked Fog of War */
.map-scroll-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding-bottom: 20px;
}

.map-node {
  width: 100%;
  max-width: 300px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid #1e293b;
  background: rgba(15, 23, 42, 0.85);
  cursor: pointer;
  transition: all 0.2s ease;
}

.map-node.active-stage {
  border-color: #f59e0b;
  background: rgba(245, 158, 11, 0.12);
  box-shadow: 0 0 16px rgba(245, 158, 11, 0.25);
}

.map-node.locked-stage {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}

.leaderboard-player-rank {
  margin-bottom: 12px;
  padding: 12px;
  border: 1px solid var(--theme-accent);
  border-radius: 10px;
  color: var(--gold);
  font-family: "Orbitron", monospace;
  font-size: 13px;
  font-weight: 800;
  text-align: center;
}

.leaderboard-status {
  margin-bottom: 10px;
  color: var(--text-dim);
  font-size: 12px;
  text-align: center;
}

.leaderboard-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
}

.leaderboard-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--theme-border);
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.85);
  font-size: 12px;
}

.leaderboard-row.current-player {
  border-color: var(--theme-accent);
  background: rgba(0, 240, 255, 0.1);
}

.leaderboard-rank {
  color: var(--gold);
  font-family: "Orbitron", monospace;
  font-weight: 800;
}

.leaderboard-country-flag {
  margin-right: 7px;
}

.leaderboard-country-unknown {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin: 0 7px 1px 2px;
  border-radius: 50%;
  background: #ef4444;
  vertical-align: middle;
}

.leaderboard-score {
  color: var(--theme-accent);
  font-family: "JetBrains Mono", monospace;
  text-align: right;
}

/* Shop Grid */
.theme-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.theme-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--theme-border);
  border-radius: 12px;
}

.theme-card.locked {
  opacity: 0.65;
  filter: grayscale(0.5);
}

/* Options Form */
.options-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
  text-align: left;
}

.option-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.option-title {
  font-weight: 700;
  font-size: 14px;
}
.option-sub {
  font-size: 11px;
  color: var(--text-dim);
}

/* Ad Simulator */
#ad-sim-modal {
  display: none;
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.95);
  z-index: 100;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  color: #fff;
}

#ad-sim-timer {
  font-family: "JetBrains Mono", monospace;
  font-size: 44px;
  font-weight: 800;
  color: var(--gold);
  margin: 16px 0;
}
