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

* { 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;
  padding-top: 56px;
}

.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;
}

/* ----------------------------------------
   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: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;
}

@media (max-width: 640px) {
  .cabinet-strip__status {
    display: none;
  }
}

@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 */
}

.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-btn--secondary {
  font-size: 0.55rem;
  color: var(--text-muted);
  border-color: rgba(255,255,255,0.25);
}

.wallet-btn--secondary.sound-muted {
  color: var(--accent3);
  border-color: rgba(255, 213, 74, 0.7);
  box-shadow: 0 0 8px rgba(255, 213, 74, 0.4);
}

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

.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);
  overflow: hidden;
}

/* 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: auto;
  z-index: 3;
}

.panel {
  background: rgba(1, 4, 10, 0.94);      /* darker */
  border: 1px solid rgba(0, 255, 163, .45);
  box-shadow:
    0 0 40px rgba(0, 255, 163, 0.3),
    0 0 80px rgba(0, 0, 0, 0.9);
  border-radius: 16px;
  padding: 32px 28px;
  text-align: center;
}

/* Lighter attract-mode panel for the start screen */
.panel--start {
  background: radial-gradient(
    circle at top,
    rgba(0, 255, 163, 0.18),
    rgba(0, 20, 20, 0.85)
  );
  border: 1px solid rgba(0,255,163,0.35);
  box-shadow:
    0 0 22px rgba(0,255,163,0.25),
    0 0 42px rgba(0,255,163,0.18);
}

.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;
}

#panelStart {
  max-width: 420px !important;     /* ← restores narrow width */
  width: 100%;
  padding: 26px 24px 22px !important;
  margin: 0 auto;
}

.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 container (inside CRT) */
.mobile-controls {
  position: absolute;
  left: 50%;
  bottom: 0.7rem;
  transform: translateX(-50%);
  width: calc(100% - 2rem);
  display: none;               /* shown via media query */
  justify-content: space-between;
  align-items: center;
  z-index: 4;
  pointer-events: none;        /* children decide */
}

/* Retro thumb joystick */
.joystick {
  position: relative;
  width: 96px;
  height: 96px;
  pointer-events: auto;
  touch-action: none; /* we handle the drag ourselves */
}

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

.joystick-handle {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle at top,
    #ffffff,
    #ffd54a 35%,
    #b8860b 80%
  );
  box-shadow:
    0 0 10px rgba(255, 213, 74, 0.7),
    inset 0 0 6px rgba(0, 0, 0, 0.7);
  border: 1px solid rgba(0, 0, 0, 0.7);
  transition: transform 60ms linear;
}

/* Small indicator line */
.joystick-handle::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 24%;
  width: 40%;
  height: 2px;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.7);
  border-radius: 999px;
}

.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.mobile-btn-fire {
  min-width: 74px;
  min-height: 74px;
  pointer-events: auto;
}

/* Classic arcade fire button (robust across Edge/Safari/Chrome) */
.mobile-btn-fire{
  width: 74px;
  height: 74px;
  border-radius: 50%;
  border: 3px solid #2a0000;
  background: #b00000;           /* solid fallback */
  position: relative;
  overflow: hidden;              /* clip the glow */
  padding: 0;
  cursor: pointer;
  box-shadow:
    inset 0 -6px 10px rgba(0,0,0,0.6),
    inset 0 4px 6px rgba(255,255,255,0.25),
    0 8px 14px rgba(0,0,0,0.6);
  transition: transform 0.05s ease, box-shadow 0.05s ease;
  -webkit-appearance: none;
  appearance: none;
}

/* The glossy dome */
.mobile-btn-fire::before{
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #ff6b6b, #b00000 60%, #5a0000 100%);
  display: block;
}

/* Pressed state */
.mobile-btn-fire:active {
  transform: translateY(3px);
  box-shadow:
    inset 0 -2px 4px rgba(0,0,0,0.7),
    inset 0 2px 3px rgba(255,255,255,0.15),
    0 4px 8px rgba(0,0,0,0.6);
}

.mobile-btn-fire:active::before{
  filter: brightness(0.92);
}

/* Normalize button rendering (helps Edge) */
.mobile-btn {
  -webkit-appearance: none;
  appearance: none;
  background-clip: padding-box;
}

.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) {

  /* Stop vertical centering so content can flow downward */
  body {
    align-items: flex-start;
  }

  /* Mobile controls live UNDER the game, not over it */
  .mobile-controls {
    display: flex;
    position: relative;
    left: auto;
    bottom: auto;
    transform: none;
    width: 100%;
    margin-top: 0.75rem;
    padding: 0 0.75rem 0.75rem;
  }

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

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

  /* --- Mobile: shrink start overlay --- */
  #panelStart {
    max-width: 340px !important;
    padding: 18px 16px 16px !important;
  }

  .panel h1 {
    font-size: 0.7rem;
    margin-bottom: 0.6rem;
  }

  .panel p {
    font-size: 0.65rem;
    line-height: 1.45;
  }

  .score-legend {
    font-size: 0.5rem;
    padding: 0.45rem 0.6rem;
  }

  .btn-inline {
    font-size: 0.5rem;
    padding: 0.4rem 0.75rem;
  }

}

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