:root {
  --bg: #07090f;
  --cabinet: #151822;
  --cabinet-dark: #0e1018;
  --cabinet-edge: #2c354c;
  --t-molding: #46b8d6;
  --bezel: #0b0d14;
  --bezel-lip: #202738;
  --amber: #ffbe3b;
  --amber-deep: #9c6208;
  --ice: #6be8f2;
  --ice-deep: #184a7c;
  --p2-red: #f05252;
  --p2-deep: #7a1822;
  --text: #eaf0f8;
  --muted: #8a9bb5;
  --font-arcade: "Press Start 2P", "Courier New", monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  min-height: 100%;
  background:
    radial-gradient(ellipse at 50% 18%, rgba(42, 74, 128, 0.16) 0%, rgba(7, 9, 15, 0) 62%),
    var(--bg);
  color: var(--text);
  font-family: var(--font-arcade);
  -webkit-font-smoothing: none;
  user-select: none;
}

body {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 12px;
}

/* Upright 1990 Arcade Cabinet Shell */
.cabinet {
  position: relative;
  width: min(100%, 840px);
  background: linear-gradient(180deg, #1b202d 0%, var(--cabinet) 16%, #11141d 100%);
  border: 3px solid var(--cabinet-edge);
  outline: 2px solid #090b10;
  border-radius: 8px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    inset 0 0 0 2px #0b0e16,
    0 24px 64px rgba(0, 0, 0, 0.86),
    0 0 42px rgba(40, 120, 170, 0.08);
  padding: 12px 14px 13px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Side T-molding accent strips */
.cabinet::before,
.cabinet::after {
  content: "";
  position: absolute;
  top: 14px;
  bottom: 14px;
  width: 3px;
  background: linear-gradient(180deg, var(--t-molding) 0%, #245b78 50%, var(--t-molding) 100%);
  opacity: 0.72;
  pointer-events: none;
}

.cabinet::before {
  left: 3px;
}

.cabinet::after {
  right: 3px;
}

/* Illuminated Backlit Marquee Header */
.marquee {
  background: #0b0d14;
  border: 2px solid #2b344a;
  border-radius: 4px;
  padding: 4px;
  box-shadow:
    inset 0 2px 4px rgba(0, 0, 0, 0.85),
    0 2px 0 rgba(255, 255, 255, 0.05);
}

.marquee-retainer {
  position: relative;
  border: 2px solid #1e2536;
  background: #090c14;
  padding: 2px;
}

/* Corner retainer screws */
.marquee-retainer::before,
.marquee-retainer::after {
  content: "";
  position: absolute;
  top: 5px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #7c8aa6, #283044);
  box-shadow: 0 calc(100% + 26px) 0 #283044;
  z-index: 2;
  pointer-events: none;
}

.marquee-retainer::before {
  left: 5px;
}

.marquee-retainer::after {
  right: 5px;
}

.marquee-glass {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 9px 16px;
  background:
    repeating-linear-gradient(
      to bottom,
      rgba(255, 255, 255, 0.025) 0px,
      rgba(255, 255, 255, 0.025) 1px,
      transparent 1px,
      transparent 4px
    ),
    radial-gradient(ellipse at 25% 50%, rgba(107, 232, 242, 0.16) 0%, transparent 55%),
    radial-gradient(ellipse at 82% 50%, rgba(255, 190, 59, 0.13) 0%, transparent 52%),
    linear-gradient(180deg, #10192b 0%, #0b1120 55%, #0e1626 100%);
  border: 1px solid #385074;
  box-shadow:
    inset 0 0 18px rgba(107, 232, 242, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.18),
    inset 0 -2px 6px rgba(0, 0, 0, 0.7);
}

.marquee-brand {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.marquee-kicker {
  font-size: 7px;
  letter-spacing: 1.5px;
  color: var(--amber);
  text-shadow: 0 0 6px rgba(255, 190, 59, 0.4);
}

.marquee-title {
  font-size: clamp(15px, 2.3vw, 22px);
  line-height: 1.1;
  color: #e8fcff;
  letter-spacing: 2.5px;
  text-shadow:
    0 1px 0 var(--ice),
    2px 2px 0 #1f629c,
    3px 3px 0 #0d274d,
    0 0 14px rgba(107, 232, 242, 0.45);
}

.marquee-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 5px;
  text-align: right;
}

.marquee-sub {
  font-size: clamp(7px, 1vw, 9px);
  color: var(--amber);
  letter-spacing: 0.8px;
  text-shadow: 1px 1px 0 #3f2600;
}

.marquee-coin {
  font-size: 7px;
  color: #b7d7e8;
  background: rgba(10, 16, 28, 0.82);
  border: 1px solid #35506e;
  padding: 3px 6px;
  letter-spacing: 1px;
}

/* Recessed CRT Monitor Housing */
.bezel {
  background: linear-gradient(180deg, #10131c 0%, var(--bezel) 100%);
  border: 3px solid var(--bezel-lip);
  border-radius: 6px;
  padding: 10px 12px 7px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  box-shadow:
    inset 0 4px 12px rgba(0, 0, 0, 0.9),
    inset 0 0 0 2px #06070c,
    0 1px 0 rgba(255, 255, 255, 0.06);
}

.bezel-well {
  width: 100%;
  display: flex;
  justify-content: center;
  padding: 5px;
  background: #05060a;
  border: 2px solid #1a2030;
  border-radius: 6px;
  box-shadow:
    inset 0 6px 16px rgba(0, 0, 0, 0.95),
    0 1px 0 rgba(255, 255, 255, 0.05);
}

.screen-frame {
  position: relative;
  width: min(100%, 740px, calc((100vh - 235px) * 4 / 3));
  min-width: 280px;
  aspect-ratio: 4 / 3;
  background: #000;
  border: 3px solid #090b10;
  border-radius: 6px;
  overflow: hidden;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.06),
    0 0 24px rgba(0, 0, 0, 0.9);
}

#game {
  width: 100%;
  height: 100%;
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

#crt-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease;
}

#crt-overlay.crt-on {
  opacity: 1;
  background:
    repeating-linear-gradient(
      to bottom,
      rgba(0, 0, 0, 0) 0px,
      rgba(0, 0, 0, 0) 2px,
      rgba(0, 0, 0, 0.24) 3px,
      rgba(0, 0, 0, 0.24) 4px
    ),
    repeating-linear-gradient(
      to right,
      rgba(255, 0, 0, 0.02) 0px,
      rgba(0, 255, 0, 0.02) 1px,
      rgba(0, 120, 255, 0.02) 2px,
      transparent 3px
    ),
    radial-gradient(circle at center, transparent 64%, rgba(0, 0, 0, 0.44) 100%);
}

/* Subtle recessed CRT glass depth */
.crt-glass {
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: 6px;
  box-shadow:
    inset 0 0 16px rgba(0, 0, 0, 0.65),
    inset 0 2px 3px rgba(255, 255, 255, 0.06);
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.04) 0%,
    rgba(255, 255, 255, 0) 14%,
    rgba(0, 0, 0, 0) 86%,
    rgba(0, 0, 0, 0.14) 100%
  );
}

.bezel-plate {
  width: 100%;
  max-width: 740px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 4px;
}

.bezel-vent {
  flex: 1;
  height: 4px;
  background: repeating-linear-gradient(
    to right,
    #1c2233 0px,
    #1c2233 5px,
    #06080d 5px,
    #06080d 9px
  );
  opacity: 0.9;
}

.bezel-spec {
  font-size: 7px;
  color: #5c6b88;
  letter-spacing: 1px;
  white-space: nowrap;
}

/* Tactile Control Deck */
.control-deck {
  display: flex;
  flex-direction: column;
  gap: 9px;
  background: linear-gradient(180deg, #161b29 0%, #10141f 100%);
  border: 2px solid #2b344b;
  border-radius: 5px;
  padding: 10px 12px 9px;
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.06),
    inset 0 -3px 6px rgba(0, 0, 0, 0.5);
}

.deck-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  justify-content: center;
  align-items: center;
}

/* 3D Beveled Arcade Push-Buttons */
.arc-btn {
  font-family: var(--font-arcade);
  font-size: 9px;
  line-height: 1;
  padding: 10px 12px;
  background: linear-gradient(180deg, #2b354e 0%, #1d2436 100%);
  color: var(--text);
  border: 2px solid #495a80;
  border-radius: 4px;
  cursor: pointer;
  letter-spacing: 0.6px;
  text-shadow: 1px 1px 0 #090c14;
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.2),
    inset 0 -2px 0 rgba(0, 0, 0, 0.35),
    0 4px 0 #0c101a,
    0 6px 8px rgba(0, 0, 0, 0.55);
  transition: transform 0.06s ease, box-shadow 0.06s ease, border-color 0.12s ease, color 0.12s ease;
}

.arc-btn:hover {
  border-color: var(--ice);
  color: #ffffff;
}

.arc-btn:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
}

.arc-btn:active {
  transform: translateY(3px);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.14),
    inset 0 -1px 0 rgba(0, 0, 0, 0.35),
    0 1px 0 #0c101a,
    0 2px 3px rgba(0, 0, 0, 0.5);
}

.arc-btn-primary {
  background: linear-gradient(180deg, #21619e 0%, #15406e 100%);
  border-color: var(--ice);
  color: #ffffff;
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.32),
    inset 0 -2px 0 rgba(0, 0, 0, 0.35),
    0 4px 0 #0b223d,
    0 6px 10px rgba(0, 0, 0, 0.6);
}

.arc-btn-primary:active {
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.2),
    0 1px 0 #0b223d,
    0 2px 4px rgba(0, 0, 0, 0.5);
}

.arc-btn-p2 {
  background: linear-gradient(180deg, #a62b36 0%, #6d1922 100%);
  border-color: var(--p2-red);
  color: #ffffff;
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.28),
    inset 0 -2px 0 rgba(0, 0, 0, 0.35),
    0 4px 0 #3b0b10,
    0 6px 10px rgba(0, 0, 0, 0.6);
}

.arc-btn-p2:hover {
  border-color: #ff9a9a;
}

.arc-btn-p2:active {
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.18),
    0 1px 0 #3b0b10,
    0 2px 4px rgba(0, 0, 0, 0.5);
}

.arc-btn-pause {
  background: linear-gradient(180deg, #755014 0%, #4d3309 100%);
  border-color: var(--amber);
  color: #fff6db;
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.25),
    inset 0 -2px 0 rgba(0, 0, 0, 0.35),
    0 4px 0 #2b1b02,
    0 6px 10px rgba(0, 0, 0, 0.6);
}

.arc-btn-pause:hover {
  border-color: #ffe08a;
}

.arc-btn-pause:active {
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.18),
    0 1px 0 #2b1b02,
    0 2px 4px rgba(0, 0, 0, 0.5);
}

/* Printed Control Panel Decal */
.controls-legend {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 8px 10px;
  background: #0a0d15;
  border: 1px solid #222a3d;
  border-radius: 3px;
  font-size: 7.5px;
  line-height: 1.5;
  color: var(--muted);
}

.ctrl-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 12px;
}

.ctrl-tag {
  display: inline-block;
  min-width: 68px;
  padding: 2px 5px;
  border-radius: 2px;
  font-size: 7px;
  text-align: center;
  color: #0b0d14;
  font-weight: bold;
}

.ctrl-solo {
  background: var(--amber);
}

.ctrl-p1 {
  background: var(--ice);
}

.ctrl-p2 {
  background: var(--p2-red);
  color: #ffffff;
}

.ctrl-keys {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #cfd8e8;
}

.ctrl-keys kbd {
  font-family: var(--font-arcade);
  font-size: 7px;
  padding: 2px 5px;
  background: #1a2133;
  color: #ffffff;
  border: 1px solid #3c4a6b;
  border-bottom-width: 2px;
  border-radius: 2px;
}

/* Touch Controls */
.touch-controls {
  display: none;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding-top: 2px;
}

.touch-group {
  display: flex;
  gap: 10px;
}

.touch-btn {
  font-family: var(--font-arcade);
  font-size: 11px;
  min-width: 58px;
  height: 50px;
  padding: 0 12px;
  background: linear-gradient(180deg, #27314a 0%, #1a2133 100%);
  color: #fff;
  border: 2px solid #48587d;
  border-radius: 6px;
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.2),
    0 4px 0 #0a0e18;
  touch-action: manipulation;
}

.touch-btn.active {
  transform: translateY(2px);
  background: #2b4c9b;
  border-color: var(--ice);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.2),
    0 2px 0 #0a0e18;
}

.touch-jump {
  border-color: var(--amber);
  color: var(--amber);
}

.touch-shoot {
  border-color: var(--ice);
  color: var(--ice);
}

@media (max-width: 680px) {
  body {
    padding: 6px;
  }

  .cabinet {
    padding: 8px;
    gap: 8px;
  }

  .marquee-glass {
    flex-direction: column;
    align-items: flex-start;
    padding: 8px 12px;
    gap: 6px;
  }

  .marquee-meta {
    align-items: flex-start;
    text-align: left;
  }

  .screen-frame {
    width: 100%;
  }

  .bezel {
    padding: 6px;
  }

  .arc-btn {
    font-size: 8px;
    padding: 8px 9px;
  }
}

@media (pointer: coarse) {
  .touch-controls {
    display: flex;
  }

  .controls-legend {
    display: none;
  }
}
