:root {
  --bg: #05060b;
  --accent: #00f5a0;
  --accent2: #ff2fd4;
  --accent3: #ffd54a;
  --text-main: #f5f5f5;
  --text-muted: #a3b0c2;
}

* {
  box-sizing: border-box;
}

/* -------------------------------------------------
   PAGE + LAYOUT
------------------------------------------------- */

html,
body {
  margin: 0;
  padding: 0;
  background: radial-gradient(circle at top, #101530 0, #020309 55%);
  font-family: "Roboto", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  color: var(--text-main);
  height: 100%;
}

body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

.frame {
  width: 100%;
  max-width: 1100px;
  padding: 1rem;
  margin: 0 auto;
  padding-top: 64px;
}

/* -------------------------------------------------
   TOP BAR
------------------------------------------------- */
.cabinet-strip {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1rem;
  z-index: 999;

  background: linear-gradient(to bottom, rgba(5, 6, 11, 0.92), rgba(5, 6, 11, 0.55));
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.cabinet-strip__title {
  font-family: "Press Start 2P", system-ui;
  font-size: 0.62rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-muted);
  text-shadow: 0 0 8px rgba(0, 245, 160, 0.35);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  user-select: none;
}

.cabinet-strip__dot {
  color: var(--accent2);
  opacity: 0.9;
}

.cabinet-strip__btn {
  font-family: "Press Start 2P", system-ui;
  font-size: 0.55rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;

  padding: 0.42rem 0.7rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(5, 6, 12, 0.85);
  color: var(--text-main);
  text-decoration: none;

  box-shadow: 0 0 10px rgba(0, 0, 0, 0.35);
}

.cabinet-strip__btn.sound-muted {
  border-color: rgba(255, 90, 90, 0.65);
  background: rgba(255, 90, 90, 0.12);
  color: rgba(255, 140, 140, 0.95);
}

.cabinet-strip__btn:hover {
  background: rgba(0, 245, 160, 0.14);
  border-color: rgba(0, 245, 160, 0.55);
}

.cabinet-strip__btn--primary {
  border-color: transparent;
  background: rgba(0, 245, 160, 0.18);
  color: var(--accent);
  box-shadow: 0 0 12px rgba(0, 245, 160, 0.22);
}

.cabinet-strip__right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.cabinet-strip__status {
  font-family: "Press Start 2P", system-ui;
  font-size: 0.55rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
  opacity: 0.9;
}

.wallet-status.ok {
  color: #72ff9f;
}

.wallet-status.err {
  color: #ff7b7b;
}

/* -------------------------------------------------
   CRT CABINET SHELL (MATCHES SPACE INVADERS STYLE)
------------------------------------------------- */

.crt-shell {
  position: relative;
  margin: 32px auto 56px;
  padding: 32px 64px;
  border-radius: 32px;
  background:
    radial-gradient(circle at top, rgba(0, 255, 180, 0.07), transparent 55%),
    radial-gradient(circle at bottom, rgba(0, 255, 180, 0.08), transparent 60%),
    #050910;
  box-shadow:
    0 0 30px rgba(0, 255, 180, 0.35),
    0 0 120px rgba(0, 255, 180, 0.18),
    0 0 0 1px rgba(0, 255, 180, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 1100px;
  /* allow content to expand normally */
  overflow: visible;
}

/* Scanlines over the whole cabinet */
.crt-shell::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: linear-gradient(
    transparent 0,
    rgba(255, 255, 255, 0.06) 1px,
    transparent 2px
  );
  background-size: 100% 3px;
  opacity: 0.3;
  mix-blend-mode: screen;
  pointer-events: none;
  animation: scanWobble 4s infinite linear;
}

/* Vignette / glow */
.crt-shell::after {
  content: "";
  position: absolute;
  inset: -10%;
  pointer-events: none;
  background:
    radial-gradient(circle at center, rgba(0, 255, 160, 0.05) 0, transparent 40%),
    radial-gradient(
      circle at center,
      transparent 55%,
      rgba(0, 0, 0, 0.5) 80%,
      rgba(0, 0, 0, 0.9) 100%
    );
  mix-blend-mode: multiply;
}

/* -------------------------------------------------
   FROGGER SCREEN (3:4) INSIDE CABINET
------------------------------------------------- */

.frogger-screen {
  position: relative;
  width: min(60vw, 520px);  /* keeps it nice and big but centred */
  aspect-ratio: 3 / 4;
  border-radius: 18px;
  background: #000;
  box-shadow:
    0 0 18px rgba(0, 255, 140, 0.8) inset,
    0 0 24px rgba(0, 255, 140, 0.4);
  overflow: hidden;
  z-index: 1;
}

/* Stack both canvases perfectly */
.frogger-screen canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  image-rendering: pixelated;
  background: transparent;
}

/* Ensure there is colour behind the board image */
#background-canvas {
  background: #020309;
}

/* -------------------------------------------------
   HUD / OVERLAYS
------------------------------------------------- */

.hud-overlay {
  position: absolute;
  inset: 0.75rem;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  font-family: "Press Start 2P", system-ui;
  font-size: 0.55rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-main);
  z-index: 2;
}

.hud-row {
  display: flex;
  justify-content: space-between;
}

.hud-bottom {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
}

.hud-col {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.hud-label {
  color: var(--text-muted);
}

.hud-value {
  color: var(--accent3);
}

.center-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  z-index: 3;
}

.panel {
  padding: 1.25rem 1.5rem;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: radial-gradient(circle at top, rgba(0, 245, 160, 0.18), rgba(2, 3, 10, 0.96));
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.8);
  text-align: center;
  max-width: 340px;
  pointer-events: auto;
}

.panel h1 {
  font-family: "Press Start 2P", system-ui;
  font-size: 0.9rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin: 0 0 0.9rem;
}

.panel p {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin: 0 0 0.75rem;
}

.panel .highlight {
  color: var(--accent3);
}

.panel small {
  display: block;
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 0.45rem;
}

.hidden {
  display: none;
}

.btn-inline {
  display: inline-block;
  margin-top: 0.8rem;
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.4);
  background: rgba(5, 6, 12, 0.95);
  color: var(--accent3);
  text-decoration: none;
  font-family: "Press Start 2P", system-ui;
  font-size: 0.55rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  cursor: pointer;
  pointer-events: auto;
}

.btn-inline:hover {
  background: rgba(0, 245, 160, 0.18);
}

/* -------------------------------------------------
   SCORE LEGEND ON ATTRACT SCREEN
------------------------------------------------- */

.score-legend {
  margin: 0.75rem 0 0.5rem;
  padding: 0.6rem 0.8rem;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: radial-gradient(circle at top, rgba(0, 245, 160, 0.12), rgba(2, 3, 10, 0.9));
  font-family: "Press Start 2P", system-ui;
  font-size: 0.55rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-align: left;
}

.score-legend-title {
  text-align: center;
  color: var(--accent3);
  margin-bottom: 0.4rem;
}

.score-line {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.15rem 0;
}

.score-icon {
  display: inline-block;
  width: 18px;
  text-align: center;
}

.score-saucer::before {
  content: "≡";
  color: #ff5555;
}

.score-top::before {
  content: "Λ";
  color: #39ff14;
}

.score-mid::before {
  content: "Ξ";
  color: #aaff00;
}

.score-bottom::before {
  content: "Π";
  color: #39ff14;
}

.score-points {
  width: 32px;
  color: var(--accent3);
}

.score-desc {
  flex: 1;
  color: var(--text-muted);
}

.controls-line {
  margin-top: 0.75rem;
}

/* -------------------------------------------------
   MOBILE CONTROLS
------------------------------------------------- */

.mobile-controls {
  margin-top: 0.6rem;
  display: none;
  justify-content: center;
  gap: 0.8rem;
  z-index: 4;
  position: relative;
}

.mobile-btn {
  min-width: 64px;
  min-height: 48px;
  padding: 0.4rem 0.8rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(5, 6, 12, 0.95);
  color: var(--accent3);
  font-family: "Press Start 2P", system-ui;
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  cursor: pointer;
}

.mobile-btn:active {
  transform: translateY(1px);
  background: rgba(0, 245, 160, 0.18);
}

.initials-block {
  margin-top: 0.75rem;
  padding-top: 0.4rem;
  border-top: 1px dashed rgba(255, 255, 255, 0.25);
  font-size: 0.7rem;
}

.initials-label {
  margin: 0 0 0.35rem;
  color: var(--text-muted);
}

.initials-input-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 0.3rem;
}

.initials-input {
  width: 70px;
  padding: 0.25rem 0.4rem;
  text-align: center;
  font-family: "Press Start 2P", system-ui;
  font-size: 0.8rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.6);
  background: rgba(0, 0, 0, 0.85);
  color: var(--accent3);
  outline: none;
}

.initials-input:focus {
  border-color: var(--accent3);
  box-shadow: 0 0 8px rgba(255, 213, 74, 0.5);
}

.initials-btn {
  font-size: 0.55rem;
  padding: 0.35rem 0.7rem;
}

#initialsHint {
  display: block;
  margin-top: 0.1rem;
  font-size: 0.65rem;
  color: var(--text-muted);
}

/* -------------------------------------------------
   RESPONSIVE
------------------------------------------------- */

@media (max-width: 640px) {
  .frame {
    padding: 0.75rem;
    padding-top: 72px; /* room for fixed header */
  }

  /* Match Space Invaders mobile header */
  .cabinet-strip {
    height: 56px;
    padding: 0 0.75rem;
  }
  .cabinet-strip__title { display: none; }
  .cabinet-strip__status { display: none; }

  .crt-shell {
    padding: 20px 20px 28px;
    border-radius: 24px;
    flex-direction: column;
    gap: 14px;
  }

  .frogger-screen {
    width: 100%;
  }

  .mobile-controls {
    display: flex;
    width: 100%;
  }

  .hud-overlay {
    font-size: 0.5rem;
  }
}

/* -------------------------------------------------
   INSERT COIN OVERLAY (FROGGER)
------------------------------------------------- */

/* Start overlay – cabinet only (NOT full screen) */
.insert-coin {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.65); /* same dimmer, but inside cabinet only */
  z-index: 5;
  pointer-events: auto;
}

/* Match Meteor-style panel */
.insert-coin-box {
  width: 480px;
  max-width: 90vw;
  padding: 32px 40px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background:
    radial-gradient(circle at top, rgba(0, 245, 160, 0.2), rgba(2, 3, 10, 0.96));
  box-shadow:
    0 0 24px rgba(0, 0, 0, 0.9),
    0 0 24px rgba(0, 255, 160, 0.25);
  text-align: center;
  font-family: "Press Start 2P", system-ui;
}

.insert-title {
  font-size: 1rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  margin: 0 0 16px;
  color: var(--accent);
}

.insert-desc {
  font-family: "Roboto", system-ui;
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--text-muted);
  margin: 0 0 18px;
}

.insert-controls {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--text-main);
  margin-bottom: 18px;
}

.insert-controls .highlight {
  color: var(--accent3);
}

.insert-btn {
  margin-top: 6px;
  padding: 10px 26px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.4);
  background: rgba(5, 6, 12, 0.95);
  color: var(--accent3);
  font-family: "Press Start 2P", system-ui;
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  cursor: pointer;
}

.insert-btn:hover {
  background: rgba(0, 245, 160, 0.18);
}

/* .hidden is already defined above as display:none; we reuse that */

/* Subtle scanline wobble */
@keyframes scanWobble {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(0.6px);
  }
}

/* Make sure hidden actually hides both overlays */
.insert-coin.hidden,
.gameover.hidden {
  display: none;
}

/* -------------------------------------------------
   GAME OVER OVERLAY
------------------------------------------------- */

.gameover {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.78);
  z-index: 999;
}

.gameover-box {
  width: 480px;
  max-width: 90vw;
  padding: 32px 40px;
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,0.22);
  background:
    radial-gradient(circle at top, rgba(0,245,160,0.2), rgba(2,3,10,0.96));
  box-shadow: 0 0 24px rgba(0, 255, 160, 0.25);
  text-align: center;
  font-family: "Press Start 2P", system-ui;
}

.gameover-title {
  font-size: 1rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  margin: 0 0 16px;
  color: var(--accent2);
}

.gameover-desc {
  font-family: "Roboto", system-ui;
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--text-muted);
  margin-bottom: 20px;
}

.submit-status {
  font-family: "Roboto", system-ui;
  font-size: 0.75rem;
  color: var(--accent3);
  margin-top: 12px;
}

