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

.hidden {
  display: none !important;
}

* { box-sizing: border-box; }

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: 960px;
  padding: 1rem;
}

.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  gap: 1rem;
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.brand-title {
  font-family: "Press Start 2P", system-ui;
  font-size: 0.85rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  text-shadow:
    0 0 4px rgba(0,245,160,0.7),
    0 0 10px rgba(0,245,160,0.6);
}

.brand-sub {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
}

.top-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.top-right-controls {
  text-align: right;
}

.wallet-box {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.25rem;
}

.wallet-btn {
  padding: 0.25rem 0.6rem;
  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.6rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
}

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

.wallet-status {
  font-size: 0.65rem;
  font-family: "Press Start 2P", system-ui;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

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

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

.crt-shell {
  position: relative;
  border-radius: 18px;
  padding: 0.75rem;
  background: radial-gradient(circle at top, #283a5b 0, #05060b 55%);
  box-shadow:
    0 0 18px rgba(0, 0, 0, 0.8),
    0 0 40px rgba(0, 245, 160, 0.4);
  border: 2px solid rgba(0, 245, 160, 0.25);

  /* KEY CHANGE */
  overflow: visible;
}

/* Scanlines */
.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 / CRT 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;
}

canvas {
  display: block;
  margin: 0 auto;
  width: 100%;
  max-width: 640px;
  background: #020309;
  image-rendering: pixelated;
  position: relative;
  z-index: 1;
}

.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: none;
  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 table 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);
}

/* Show mobile controls only on small screens */
@media (max-width: 640px) {
  .mobile-controls {
    display: flex;
  }

  .brand-title {
    font-size: 0.75rem;
  }
  .brand-sub {
    font-size: 0.65rem;
  }
  .hud-overlay {
    font-size: 0.5rem;
  }

  .top-bar {
    flex-direction: column;
    align-items: flex-start;
  }

  .top-right {
    width: 100%;
    justify-content: space-between;
  }

  .top-right-controls {
    text-align: left;
  }
}

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

/* ----------------------------------------
   Cabinet strip (escape hatch)
-----------------------------------------*/
.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;
}

/* ----------------------------------------
   Mobile joystick (copied from Invaders)
---------------------------------------- */

.mobile-controls {
  display: none; /* your media query already turns this on */
  justify-content: space-between;
  align-items: center;
  gap: 0.8rem;
  pointer-events: none; /* children decide */
}

.mobile-actions {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  pointer-events: auto;
}

/* Joystick container */
.joystick {
  width: 92px;
  height: 92px;
  position: relative;
  pointer-events: auto;
  touch-action: none;
  user-select: none;
}

/* Base circle */
.joystick-base {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(circle at top,
    rgba(0, 245, 160, 0.25),
    rgba(3, 6, 14, 0.95)
  );
  border: 2px solid rgba(0, 245, 160, 0.6);
  box-shadow:
    0 0 12px rgba(0, 245, 160, 0.7),
    inset 0 0 10px rgba(0, 0, 0, 0.9);
}

/* Handle */
.joystick-handle {
  position: absolute;
  width: 44px;
  height: 44px;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle at top,
    rgba(255, 255, 255, 0.22),
    rgba(0, 245, 160, 0.18)
  );
  border: 2px solid rgba(0, 245, 160, 0.55);
  box-shadow: 0 0 10px rgba(0, 245, 160, 0.7);
}

/* Bigger action buttons like Invaders */
.mobile-btn.mobile-btn-fire,
.mobile-btn.mobile-btn-thrust {
  min-width: 96px;
  min-height: 56px;
  pointer-events: auto;
}

/* ----------------------------------------
   Mobile controls (Asteroids)
---------------------------------------- */

.mobile-controls {
  display: none;
  position: absolute;
  left: 0;
  right: 0;
  bottom: 8px;
  padding: 0 12px;
  pointer-events: none;
}

.mobile-controls * {
  pointer-events: auto;
}

@media (max-width: 768px) {
  .mobile-controls {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    z-index: 30;
  }
}

/* ================================
   MOBILE LAYOUT FIX (Asteroids)
================================ */

@media (max-width: 768px) {

  /* Reduce dead space above the game */
  .frame {
    padding-top: 4px;
  }

  /* Keep CRT tight and centered */
  .crt-shell {
    margin: 0 auto;
  }

  /* Controls live clearly BELOW the game */
  .mobile-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;

    width: 100%;
    max-width: 360px;
    margin: 10px auto 0;
    padding: 0 12px;
  }

  .mobile-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }
}

/* --- Match Space Invaders MOBILE header (Asteroids) --- */
@media (max-width: 640px) {
  body { padding-top: 60px; }
  .cabinet-strip { height: 56px; padding: 0 0.75rem; }
  .cabinet-strip__title { display: none; }   /* keep it clean on phones */
  .cabinet-strip__status { display: none; }  /* hide wallet status text */
}
