:root {
  --bg: #0d1321;
  --fg: #e6e6e6;
  --accent: #00ffb9;
  --accent-2: #0066ff;
  --muted: #8a8a8a;
  --maxw: 1100px;
}

/* Page layout */
html {
  background: var(--bg);
}
body {
  margin: 0;
  min-height: 100dvh; /* allow page to grow & scroll */
  background: var(--bg);
  color: var(--fg);
  font-family: "VT323", monospace;
  line-height: 1.3;
  /* no flex here */
}

.wrap {
  width: min(100%, var(--maxw));
  margin: 32px auto; /* centers horizontally with top breathing room */
  padding: 24px clamp(16px, 3vw, 32px);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 28px;
  position: relative;
}

/* Header */
.brand {
  font-family: "Press Start 2P", system-ui, sans-serif;
  font-size: clamp(16px, 2.2vw, 22px);
  letter-spacing: 1px;
  color: var(--muted);
  text-transform: uppercase;
}
.title {
  font-family: "Press Start 2P", system-ui, sans-serif;
  font-size: clamp(24px, 4vw, 40px);
  margin: 0;
  text-shadow: 0 0 12px rgba(0, 255, 185, 0.35);
}
.divider {
  width: 100%;
  max-width: 520px;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0.8;
}

/* Content cards */
.card {
  width: min(100%, 860px);
  border: 2px solid #1a1a1a;
  box-shadow: 0 0 0 3px #0a0a0a inset;
  padding: clamp(16px, 2.5vw, 24px);
  border-radius: 16px;
  background: radial-gradient(
    150% 150% at 50% 0%,
    #0b0b0b 0%,
    #050505 60%,
    #020202 100%
  );
}
.card h2 {
  font-family: "Press Start 2P", system-ui, sans-serif;
  font-size: clamp(16px, 2.2vw, 20px);
  color: var(--accent);
  margin: 0 0 12px;
}
.card p,
.card li {
  font-size: clamp(16px, 2.2vw, 22px);
  color: var(--fg);
  margin: 8px 0;
}
.muted {
  color: var(--muted);
}

/* Game area */
#game {
  width: min(100%, 960px);
  padding: 0; /* override .card padding */
  display: flex; /* flex so we can center the canvas */
  align-items: center; /* vertical center */
  justify-content: center; /* horizontal center */
  border: 2px solid #1a1a1a;
  border-radius: 16px;
  overflow: hidden;
  background: #000;
  box-shadow: 0 0 0 3px #0a0a0a inset;
  position: relative;
}

#game canvas {
  image-rendering: pixelated;
  width: auto !important; /* let Phaser size it */
  max-width: 100%;
  height: auto !important;
  display: block;
  margin: 0; /* no stray margins */
}

/* CRT scanline effect */
.crt::after {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.04) 0px,
    rgba(255, 255, 255, 0.04) 1px,
    transparent 2px,
    transparent 4px
  );
  mix-blend-mode: overlay;
  pointer-events: none;
}

/* Button */
.btn {
  display: inline-block;
  font-family: "Press Start 2P", system-ui, sans-serif;
  font-size: clamp(12px, 1.8vw, 14px);
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #001b14;
  background: var(--accent);
  padding: 12px 18px;
  border-radius: 12px;
  border: 0;
  cursor: pointer;
  transition: transform 120ms ease;
}
.btn:hover {
  transform: translateY(-1px);
}
.btn:active {
  transform: translateY(0);
}

footer {
  margin-top: 8px;
  font-size: 14px;
  color: var(--muted);
}
a {
  color: var(--accent-2);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

/* ===== Retro Start Overlay ===== */
#start-overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: radial-gradient(120% 120% at 50% 40%, #0b0b0b 0%, #000 70%);
  z-index: 9999;
}
#start-inner {
  text-align: center;
  padding: 28px clamp(20px, 4vw, 36px);
  border-radius: 18px;
  border: 2px solid #1a1a1a;
  box-shadow: 0 0 0 3px #0a0a0a inset;
  background: radial-gradient(
    160% 160% at 50% 0%,
    #0b0b0b 0%,
    #050505 60%,
    #020202 100%
  );
  width: min(92vw, 700px);
}
#start-title {
  font-family: "Press Start 2P", system-ui, sans-serif;
  font-size: clamp(22px, 4vw, 38px);
  margin: 0 0 12px;
  color: var(--accent);
  text-shadow: 0 0 10px rgba(0, 255, 185, 0.35);
}
#start-sub {
  font-family: "VT323", monospace;
  font-size: clamp(18px, 2.4vw, 26px);
  color: var(--fg);
  margin: 4px 0 18px;
}
#start-tip {
  color: var(--muted);
  font-size: clamp(16px, 2.2vw, 22px);
  margin-top: 10px;
}

/* ===== INSERT COIN blink ===== */
@keyframes coin-blink {
  0%,
  49% {
    opacity: 1;
  }
  50%,
  100% {
    opacity: 0;
  }
}
.insert-coin {
  display: inline-block;
  margin-top: 10px;
  font-family: "Press Start 2P", system-ui, sans-serif;
  font-size: clamp(14px, 2.4vw, 18px);
  color: var(--accent-2);
  letter-spacing: 2px;
  text-shadow: 0 0 8px rgba(0, 102, 255, 0.35);
  animation: coin-blink 1s steps(2, jump-none) infinite;
  cursor: pointer;
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  .insert-coin {
    animation: none;
  }
}

/* Hide overlay once started */
body.started #start-overlay {
  display: none;
}
