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

:root {
  --bg: #050510;
  --panel: #0d0d24;
  --border: #2a2a5a;
  --accent: #00ffcc;
  --accent-dim: #00aa88;
  --text: #e8e8ff;
  --muted: #8888bb;
  --glow: #00ffcc44;
}

html {
  font-size: 16px;
}

body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: "Press Start 2P", monospace;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow-x: hidden;
  position: relative;
  touch-action: manipulation;
}

.scanlines {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 100;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.15) 2px,
    rgba(0, 0, 0, 0.15) 4px
  );
}

.crt-vignette {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 99;
  background: radial-gradient(ellipse at center, transparent 50%, rgba(0, 0, 0, 0.6) 100%);
}

.page {
  width: min(100%, 640px);
  padding: 2rem 1.25rem 2.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.75rem;
  position: relative;
  z-index: 1;
}

.header {
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.header__tag {
  font-size: 0.55rem;
  color: var(--muted);
  letter-spacing: 0.15em;
}

.header__title {
  font-size: clamp(0.85rem, 4vw, 1.25rem);
  color: var(--accent);
  text-shadow:
    0 0 10px var(--glow),
    0 0 30px var(--glow),
    2px 2px 0 #004433;
  line-height: 1.6;
}

.header__subtitle {
  font-size: clamp(0.45rem, 2.5vw, 0.6rem);
  color: var(--muted);
  line-height: 1.8;
}

.accent {
  color: var(--accent);
}

.blink {
  animation: blink 1.2s step-end infinite;
}

@keyframes blink {
  50% { opacity: 0; }
}

.arcade {
  position: relative;
  width: 100%;
  max-width: 480px;
}

.arcade__screen {
  position: relative;
}

#game {
  display: block;
  width: 100%;
  height: auto;
  cursor: grab;
  touch-action: none;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  background: #000;
  border: 4px solid var(--border);
  box-shadow:
    0 0 0 2px #000,
    0 0 20px var(--glow),
    inset 0 0 40px rgba(0, 255, 204, 0.05);
}

#game:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.game-overlay {
  position: absolute;
  inset: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(5, 5, 16, 0.72);
  z-index: 2;
}

.game-overlay[hidden] {
  display: none;
}

.game-panel {
  width: min(88%, 280px);
  padding: 1.25rem 1rem 1.1rem;
  text-align: center;
  background: var(--panel);
  border: 3px solid var(--accent-dim);
  box-shadow:
    0 0 24px var(--glow),
    inset 0 0 0 2px rgba(0, 255, 204, 0.08);
}

.game-panel__tag {
  font-size: clamp(0.42rem, 2vw, 0.5rem);
  color: var(--muted);
  letter-spacing: 0.12em;
  margin-bottom: 0.85rem;
}

.game-panel__title {
  font-size: clamp(0.55rem, 2.8vw, 0.72rem);
  color: var(--accent);
  line-height: 1.7;
  margin-bottom: 0.75rem;
  text-shadow: 0 0 12px var(--glow);
}

.game-panel__hint {
  font-size: clamp(0.38rem, 1.8vw, 0.45rem);
  color: var(--muted);
  line-height: 1.9;
  margin-bottom: 1.1rem;
}

.game-panel__score {
  font-size: clamp(0.4rem, 1.9vw, 0.48rem);
  color: var(--text);
  line-height: 1.9;
  margin-bottom: 1rem;
}

.game-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  width: 100%;
  max-width: 220px;
  padding: 0.9rem 1rem;
  font-family: "Press Start 2P", monospace;
  font-size: clamp(0.5rem, 2.4vw, 0.62rem);
  color: #041a14;
  background: linear-gradient(180deg, var(--accent) 0%, var(--accent-dim) 100%);
  border: 3px solid #aaffee;
  box-shadow:
    0 0 16px var(--glow),
    0 5px 0 #004433,
    inset 0 -3px 0 rgba(0, 0, 0, 0.15);
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.1s, filter 0.1s;
  animation: btn-glow 2.4s ease-in-out infinite;
}

.game-btn__icon {
  font-size: 0.55em;
}

.game-btn:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

.game-btn:active {
  transform: translateY(3px);
  box-shadow:
    0 0 10px var(--glow),
    0 2px 0 #004433,
    inset 0 -1px 0 rgba(0, 0, 0, 0.15);
}

@keyframes btn-glow {
  0%, 100% { box-shadow: 0 0 16px var(--glow), 0 5px 0 #004433, inset 0 -3px 0 rgba(0, 0, 0, 0.15); }
  50% { box-shadow: 0 0 28px rgba(0, 255, 204, 0.55), 0 5px 0 #004433, inset 0 -3px 0 rgba(0, 0, 0, 0.15); }
}

.arcade__frame {
  position: absolute;
  inset: -8px;
  bottom: auto;
  height: calc(100% - 4.5rem);
  border: 2px solid var(--accent-dim);
  pointer-events: none;
  opacity: 0.4;
}

.controls {
  display: none;
  margin-top: 1rem;
  gap: 0.75rem;
  align-items: center;
  justify-content: center;
}

.controls__hint {
  display: none;
  font-size: 0.42rem;
  color: var(--muted);
  line-height: 1.6;
  text-align: center;
}

.control-btn {
  font-family: "Press Start 2P", monospace;
  font-size: 0.55rem;
  min-width: 3.5rem;
  min-height: 3.5rem;
  padding: 0.75rem;
  background: var(--panel);
  color: var(--accent);
  border: 2px solid var(--border);
  box-shadow: 0 3px 0 #000;
  cursor: pointer;
  user-select: none;
  touch-action: none;
}

.control-btn:active,
.control-btn.is-active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #000;
  background: #12222a;
}

.control-btn--fire {
  min-width: 5.5rem;
  color: #ffff88;
  border-color: #665500;
}

.info {
  width: 100%;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.info__text {
  font-size: clamp(0.45rem, 2.2vw, 0.55rem);
  line-height: 2;
  color: var(--muted);
}

.info__controls,
.info__status {
  font-size: clamp(0.4rem, 2vw, 0.48rem);
  line-height: 1.8;
  color: var(--muted);
}

.info__stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
}

.stat {
  background: var(--panel);
  border: 2px solid var(--border);
  padding: 0.75rem 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.stat__label {
  font-size: 0.4rem;
  color: var(--muted);
}

.stat__value {
  font-size: clamp(0.35rem, 1.8vw, 0.45rem);
  color: var(--accent);
  word-break: break-all;
}

.footer {
  font-size: 0.4rem;
  color: var(--muted);
  text-align: center;
  line-height: 1.8;
}

@media (max-width: 768px), (hover: none) {
  .controls {
    display: flex;
  }

  .controls__hint {
    display: block;
    margin-top: 0.5rem;
  }

  .arcade__frame {
    height: calc(100% - 5.5rem);
  }
}

@media (max-width: 480px) {
  .info__stats {
    grid-template-columns: 1fr;
  }

  .page {
    padding-top: 1.5rem;
  }
}
