/* ============================================================
   H4KKEN - Global Styles
   ============================================================ */

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

:root {
  --primary: #00f0ff;
  --primary-dark: #007a82;
  --secondary: #ff2d6a;
  --warning: #ffaa00;
  --bg-dark: #0a0a0f;
  --bg-panel: rgba(10, 10, 20, 0.85);
  --text: #e8e8f0;
  --p1-color: #00c8ff;
  --p2-color: #ff3366;
  --health-green: #00ff88;
  --health-yellow: #ffcc00;
  --health-red: #ff2244;
  --health-bg: #1a1a2e;
  --font-main: 'Orbitron', sans-serif;
  --font-body: 'Rajdhani', sans-serif;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg-dark);
  color: var(--text);
  font-family: var(--font-body);
  touch-action: none;
  overscroll-behavior: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

#game-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}

/* ============================================================
   Screens
   ============================================================ */

.screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 100;
  background: linear-gradient(135deg, rgba(5,5,15,0.97), rgba(10,10,30,0.95));
}

.screen.active {
  display: flex;
}

/* ============================================================
   Game Title
   ============================================================ */

.game-title {
  font-family: var(--font-main);
  font-size: 6rem;
  font-weight: 900;
  letter-spacing: 0.15em;
  color: var(--primary);
  text-shadow:
    0 0 20px rgba(0,240,255,0.5),
    0 0 60px rgba(0,240,255,0.2);
  margin-bottom: 0.5rem;
  user-select: none;
}

/* Glitch Effect */
.glitch {
  position: relative;
  animation: glitch-skew 4s infinite linear alternate-reverse;
}

.glitch::before,
.glitch::after {
  content: attr(data-text);
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.glitch::before {
  color: var(--secondary);
  animation: glitch-left 3s infinite linear alternate-reverse;
  clip-path: polygon(0 0, 100% 0, 100% 45%, 0 45%);
  z-index: -1;
}

.glitch::after {
  color: var(--primary);
  animation: glitch-right 2s infinite linear alternate-reverse;
  clip-path: polygon(0 60%, 100% 60%, 100% 100%, 0 100%);
  z-index: -1;
}

@keyframes glitch-left {
  0%, 90% { transform: translate(0); }
  91% { transform: translate(-3px, 1px); }
  93% { transform: translate(2px, -1px); }
  95% { transform: translate(-1px, 2px); }
  100% { transform: translate(0); }
}

@keyframes glitch-right {
  0%, 88% { transform: translate(0); }
  89% { transform: translate(3px, -1px); }
  92% { transform: translate(-2px, 1px); }
  96% { transform: translate(1px, -2px); }
  100% { transform: translate(0); }
}

@keyframes glitch-skew {
  0%, 95% { transform: skew(0deg); }
  96% { transform: skew(1deg); }
  98% { transform: skew(-0.5deg); }
  100% { transform: skew(0deg); }
}

.menu-subtitle {
  font-family: var(--font-main);
  font-size: 1.2rem;
  letter-spacing: 0.5em;
  color: var(--secondary);
  margin-bottom: 3rem;
  text-align: center;
}

/* ============================================================
   Loading Screen
   ============================================================ */

.loading-content {
  text-align: center;
}

.loading-bar-container {
  width: 400px;
  height: 6px;
  background: var(--health-bg);
  border-radius: 3px;
  margin: 2rem auto;
  overflow: hidden;
}

.loading-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  border-radius: 3px;
  transition: width 0.3s ease;
}

.loading-text {
  font-family: var(--font-body);
  font-size: 1rem;
  color: rgba(255,255,255,0.5);
}

/* ============================================================
   Menu
   ============================================================ */

.menu-content {
  text-align: center;
}

.menu-buttons {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.menu-input {
  font-family: var(--font-main);
  font-size: 1rem;
  padding: 0.8rem 2rem;
  width: 300px;
  background: rgba(0,240,255,0.05);
  border: 1px solid rgba(0,240,255,0.3);
  border-radius: 4px;
  color: var(--primary);
  text-align: center;
  outline: none;
  transition: border-color 0.3s;
  letter-spacing: 0.1em;
}

.menu-input::placeholder {
  color: rgba(0,240,255,0.3);
}

.menu-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 15px rgba(0,240,255,0.15);
}

.menu-btn {
  font-family: var(--font-main);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  padding: 0.9rem 3rem;
  width: 300px;
  border: 1px solid rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.03);
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s;
  text-transform: uppercase;
  position: relative;
  overflow: hidden;
}

.menu-btn::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(0,240,255,0.07), transparent);
  transition: left 0.4s;
}

.menu-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  text-shadow: 0 0 10px rgba(0,240,255,0.5);
}

.menu-btn:hover::after {
  left: 100%;
}

.menu-btn.primary {
  border-color: var(--primary);
  color: var(--primary);
  background: rgba(0,240,255,0.08);
}

.menu-btn.primary:hover {
  background: rgba(0,240,255,0.15);
  box-shadow: 0 0 30px rgba(0,240,255,0.15);
}

/* ============================================================
   Waiting Screen
   ============================================================ */

.waiting-content {
  text-align: center;
}

.waiting-content h2 {
  font-family: var(--font-main);
  font-size: 1.8rem;
  letter-spacing: 0.1em;
  color: var(--primary);
  margin-bottom: 2rem;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 3px solid rgba(0,240,255,0.15);
  border-top-color: var(--primary);
  border-radius: 50%;
  margin: 0 auto 2rem;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ============================================================
   Controls Screen
   ============================================================ */

.controls-content {
  text-align: center;
  max-width: 900px;
  padding: 2rem;
}

.controls-content h2 {
  font-family: var(--font-main);
  font-size: 2rem;
  color: var(--primary);
  margin-bottom: 2rem;
}

.controls-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
  margin-bottom: 2rem;
  text-align: left;
}

.control-section h3 {
  font-family: var(--font-main);
  font-size: 0.9rem;
  color: var(--secondary);
  margin-bottom: 0.8rem;
  letter-spacing: 0.1em;
}

.control-row {
  font-size: 0.95rem;
  margin-bottom: 0.5rem;
  color: rgba(255,255,255,0.7);
}

.key {
  display: inline-block;
  font-family: var(--font-main);
  font-size: 0.75rem;
  padding: 0.2rem 0.5rem;
  min-width: 1.8rem;
  text-align: center;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 3px;
  color: var(--primary);
  margin-right: 0.3rem;
}

.key.attack {
  border-color: var(--secondary);
  color: var(--secondary);
}

.control-layout {
  margin-bottom: 0.8rem;
}

.control-layout .label {
  display: block;
  font-size: 0.75rem;
  color: rgba(255,255,255,0.4);
  margin-top: 0.2rem;
}

/* ============================================================
   Fight HUD
   ============================================================ */

.hud {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 50;
  pointer-events: none;
}

.hud.hidden {
  display: none;
}

.health-bar-section {
  padding: 15px 30px 10px;
}

.player-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.player-info.p2-info {
  flex-direction: row-reverse;
}

.player-name {
  font-family: var(--font-main);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.p1-info .player-name { color: var(--p1-color); }
.p2-info .player-name { color: var(--p2-color); }

.win-indicators {
  display: flex;
  gap: 6px;
}

.win-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.3);
  background: transparent;
}

.win-dot.won {
  background: var(--warning);
  border-color: var(--warning);
  box-shadow: 0 0 8px rgba(255,170,0,0.5);
}

.health-bars {
  display: flex;
  align-items: center;
  gap: 0;
}

.health-bar-wrapper {
  flex: 1;
  height: 28px;
  position: relative;
}

.health-bar-bg {
  width: 100%;
  height: 100%;
  background: var(--health-bg);
  position: relative;
  overflow: hidden;
}

.p1-bar .health-bar-bg {
  clip-path: polygon(0 0, 100% 0, 97% 100%, 0 100%);
}

.p2-bar .health-bar-bg {
  clip-path: polygon(3% 0, 100% 0, 100% 100%, 0 100%);
}

.health-bar-fill {
  position: absolute;
  top: 0;
  height: 100%;
  width: 100%;
  background: linear-gradient(180deg, var(--health-green), #00cc66);
  transition: width 0.15s ease-out;
}

.health-bar-fill.medium {
  background: linear-gradient(180deg, var(--health-yellow), #cc9900);
}

.health-bar-fill.low {
  background: linear-gradient(180deg, var(--health-red), #cc1133);
  animation: health-pulse 0.5s ease-in-out infinite;
}

@keyframes health-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

.health-bar-damage {
  position: absolute;
  top: 0;
  height: 100%;
  width: 100%;
  background: var(--health-red);
  opacity: 0.6;
  transition: width 0.8s ease-out 0.4s;
}

.p1-bar .health-bar-fill,
.p1-bar .health-bar-damage {
  right: 0;
  left: auto;
}

.p2-bar .health-bar-fill,
.p2-bar .health-bar-damage {
  left: 0;
}

/* ── Super Meter Bars ──────────────────────────────────────────────────────── */

.super-bars {
  display: flex;
  align-items: center;
  margin-top: 3px;
}

.super-bar-wrapper {
  flex: 1;
  height: 6px;
}

.super-bar-bg {
  position: relative;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.45);
  overflow: hidden;
  border-radius: 2px;
}

.super-bar-fill {
  position: absolute;
  top: 0;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #0055cc, #00ccff);
  transition: width 0.08s linear;
}

.super-bar-fill.super-full {
  background: linear-gradient(90deg, #00aaff, #ffffff);
  animation: super-pulse 0.4s ease-in-out infinite;
}

@keyframes super-pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 6px #00ccff; }
  50%       { opacity: 0.75; box-shadow: 0 0 14px #00ccff; }
}

.p1-super-bar .super-bar-fill {
  right: 0;
  left: auto;
}

.p2-super-bar .super-bar-fill {
  left: 0;
  background: linear-gradient(90deg, #cc2200, #ff6622);
}

.p2-super-bar .super-bar-fill.super-full {
  background: linear-gradient(90deg, #ff3300, #ffaa44);
  animation: super-pulse-p2 0.4s ease-in-out infinite;
}

@keyframes super-pulse-p2 {
  0%, 100% { opacity: 1; box-shadow: 0 0 6px #ff6622; }
  50%       { opacity: 0.75; box-shadow: 0 0 14px #ff6622; }
}

.super-key-hint {
  display: none;
  font-size: 14px;
  text-align: center;
  letter-spacing: 2px;
  margin-top: 3px;
  font-weight: 900;
  text-shadow: 0 0 6px currentColor;
}

.super-bar-wrapper.super-ready .super-key-hint {
  display: block;
  animation: super-key-pulse 0.9s ease-in-out infinite;
}

.p1-super-bar.super-ready .super-key-hint {
  color: #66ddff;
}

.p2-super-bar.super-ready .super-key-hint {
  color: #ff8844;
}

@keyframes super-key-pulse {
  0%, 100% { opacity: 0.6; transform: scale(1); }
  50%       { opacity: 1;   transform: scale(1.15); }
}

.super-spacer {
  width: 70px;
  flex-shrink: 0;
}

/* ── Power Mode HUD highlighting ────────────────────────────────────────────── */

.health-bar-fill.power-active {
  background: linear-gradient(180deg, #ffdd00, #ff8800) !important;
  box-shadow: 0 0 8px #ffaa00, 0 0 20px #ff8800;
  animation: power-health-pulse 0.35s ease-in-out infinite;
}

@keyframes power-health-pulse {
  0%, 100% { box-shadow: 0 0 8px #ffaa00, 0 0 20px #ff8800; }
  50%       { box-shadow: 0 0 16px #ffdd00, 0 0 40px #ff8800; }
}

.p1-super-bar .super-bar-fill.power-active,
.p2-super-bar .super-bar-fill.power-active {
  background: linear-gradient(90deg, #ffaa00, #ffff44) !important;
  animation: power-super-pulse 0.35s ease-in-out infinite;
}

@keyframes power-super-pulse {
  0%, 100% { box-shadow: 0 0 6px #ffaa00; }
  50%       { box-shadow: 0 0 18px #ffff44; }
}

.timer-box {
  width: 70px;
  height: 55px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-panel);
  border: 2px solid rgba(255,255,255,0.15);
  flex-shrink: 0;
  z-index: 1;
}

.timer-box span {
  font-family: var(--font-main);
  font-size: 1.8rem;
  font-weight: 900;
  color: var(--text);
}

.timer-box span.urgent {
  color: var(--health-red);
  animation: timer-flash 0.5s ease-in-out infinite;
}

@keyframes timer-flash {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* ============================================================
   Combo Display
   ============================================================ */

.combo-display {
  position: fixed;
  top: 30%;
  padding: 10px 25px;
  background: rgba(0,0,0,0.7);
  border-left: 3px solid;
  animation: combo-pop 0.3s ease-out;
}

.combo-display.hidden { display: none; }

.combo-display.p1-combo {
  left: 40px;
  border-color: var(--p1-color);
}

.combo-display.p2-combo {
  right: 40px;
  border-color: var(--p2-color);
}

.combo-hits {
  font-family: var(--font-main);
  font-size: 2.5rem;
  font-weight: 900;
  display: block;
}

.p1-combo .combo-hits { color: var(--p1-color); }
.p2-combo .combo-hits { color: var(--p2-color); }

.combo-label {
  font-family: var(--font-main);
  font-size: 0.8rem;
  letter-spacing: 0.2em;
  color: rgba(255,255,255,0.6);
}

.combo-damage {
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--health-red);
  display: block;
  margin-top: 4px;
}

@keyframes combo-pop {
  from { transform: scale(1.3); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* ============================================================
   Announcements
   ============================================================ */

.announcement {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 200;
  pointer-events: none;
}

.announcement.hidden { display: none; }

.announce-text {
  font-family: var(--font-main);
  font-size: 5rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  color: white;
  text-shadow:
    0 0 30px rgba(0,240,255,0.8),
    0 0 80px rgba(0,240,255,0.3),
    3px 3px 0 rgba(255,45,106,0.6);
  animation: announce-in 0.5s ease-out;
}

.announce-sub {
  font-family: var(--font-main);
  font-size: 1.5rem;
  letter-spacing: 0.3em;
  color: var(--warning);
  margin-top: 0.5rem;
  animation: announce-in 0.5s ease-out 0.2s both;
}

@keyframes announce-in {
  from {
    transform: scale(2) translateY(-20px);
    opacity: 0;
  }
  to {
    transform: scale(1) translateY(0);
    opacity: 1;
  }
}

.announce-text.ko {
  font-size: 8rem;
  color: var(--health-red);
  text-shadow:
    0 0 40px rgba(255,34,68,0.8),
    0 0 100px rgba(255,34,68,0.4);
}

.announce-text.victory {
  color: var(--warning);
  text-shadow:
    0 0 30px rgba(255,170,0,0.8),
    0 0 80px rgba(255,170,0,0.3);
}

.announce-text.countdown {
  font-size: 14rem;
  line-height: 1;
  text-shadow:
    0 0 40px rgba(0,240,255,0.9),
    0 0 120px rgba(0,240,255,0.4),
    4px 4px 0 rgba(255,45,106,0.7);
}

/* ============================================================
   Input Display (debug, can be toggled)
   ============================================================ */

.input-display {
  position: fixed;
  bottom: 20px;
  padding: 10px;
  background: rgba(0,0,0,0.7);
  font-family: var(--font-body);
  font-size: 0.85rem;
  z-index: 60;
  border-radius: 4px;
}

.input-display.p1 { left: 20px; }
.input-display.p2 { right: 20px; }

/* ============================================================
   Responsive
   ============================================================ */

@media (max-width: 768px) {
  .game-title { font-size: 3.5rem; }
  .controls-grid { grid-template-columns: 1fr; }
  .menu-btn, .menu-input { width: 250px; }
}

/* ============================================================
   Mobile — Rotate Prompt
   ============================================================ */

#rotate-prompt {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 500;
  background: var(--bg-dark);
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  font-family: var(--font-main);
  text-align: center;
  gap: 1.2rem;
}

#rotate-prompt p {
  font-size: 1rem;
  letter-spacing: 0.08em;
  opacity: 0.85;
}

.rotate-icon {
  font-size: 4rem;
  animation: rotate-hint 2s ease-in-out infinite;
}

@keyframes rotate-hint {
  0%   { transform: rotate(0deg); }
  40%  { transform: rotate(90deg); }
  60%  { transform: rotate(90deg); }
  100% { transform: rotate(0deg); }
}

@media screen and (orientation: portrait) and (max-width: 900px) {
  #rotate-prompt { display: flex; }
}

/* ============================================================
   Mobile — Touch Controls Overlay
   ============================================================ */

#game-canvas { touch-action: none; }

#mobile-controls {
  position: fixed;
  inset: 0;
  z-index: 40;
  pointer-events: none; /* container passes through — only buttons capture events */
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  /* safe-area-inset-bottom keeps controls above the iOS home bar */
  padding: 0 20px max(28px, env(safe-area-inset-bottom, 0px));
}

#mobile-controls.hidden { display: none; }

/* D-pad: 3×3 grid, only 4 arrow cells occupied */
#dpad {
  pointer-events: auto;
  display: grid;
  grid-template-columns: repeat(3, 56px);
  grid-template-rows: repeat(3, 56px);
  gap: 4px;
}

#mb-up    { grid-column: 2; grid-row: 1; }
#mb-left  { grid-column: 1; grid-row: 2; }
#mb-down  { grid-column: 2; grid-row: 3; }
#mb-right { grid-column: 3; grid-row: 2; }

.dpad-btn {
  background: rgba(0, 240, 255, 0.1);
  border: 2px solid rgba(0, 240, 255, 0.35);
  border-radius: 10px;
  color: var(--primary);
  font-size: 1.3rem;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.04s;
}

.dpad-btn.pressed,
.dpad-btn:active {
  background: rgba(0, 240, 255, 0.32);
  border-color: rgba(0, 240, 255, 0.8);
}

/* Action buttons: 2-column, 3-row grid */
#action-btns {
  pointer-events: auto;
  display: grid;
  grid-template-columns: repeat(2, 64px);
  grid-template-rows: repeat(3, 56px);
  gap: 6px;
}

.action-btn {
  background: rgba(255, 45, 106, 0.12);
  border: 2px solid rgba(255, 45, 106, 0.45);
  border-radius: 10px;
  color: var(--secondary);
  font-family: var(--font-main);
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.04s;
}

.action-btn.pressed,
.action-btn:active {
  background: rgba(255, 45, 106, 0.38);
  border-color: rgba(255, 45, 106, 0.9);
}

.block-btn {
  border-color: rgba(255, 255, 255, 0.3);
  color: #fff;
  background: rgba(255, 255, 255, 0.07);
}
.block-btn.pressed,
.block-btn:active {
  background: rgba(255, 255, 255, 0.28);
}

.super-btn {
  border-color: rgba(255, 200, 0, 0.45);
  color: #ffc800;
  background: rgba(255, 200, 0, 0.08);
}
.super-btn.pressed,
.super-btn:active {
  background: rgba(255, 200, 0, 0.32);
}

/* Portrait mobile — compact HUD, compact controls */
@media screen and (max-width: 768px) {
  .health-bar-section { padding: 5px 10px 3px; }
  .health-bar-wrapper { height: 18px; }
  .player-info { margin-bottom: 2px; }
  .player-name { font-size: 0.68rem; }
  .super-bars { margin-top: 2px; }
  .win-dot { width: 9px; height: 9px; }
  .super-key-hint { display: none; }
  .timer-box { width: 46px; height: 36px; }
  .timer-box span { font-size: 1.2rem; }

  /* Controls sit closer to the edge */
  #mobile-controls { padding: 0 12px max(16px, env(safe-area-inset-bottom, 0px)); }

  /* 48 px = above Apple/Google 44 pt minimum, well below the original 56 px.
     Fighting game players navigate by thumb memory, not by button size. */
  #dpad {
    grid-template-columns: repeat(3, 48px);
    grid-template-rows: repeat(3, 48px);
    gap: 4px;
  }

  #action-btns {
    grid-template-columns: repeat(2, 54px);
    grid-template-rows: repeat(3, 48px);
    gap: 6px;
  }

  .action-btn { font-size: 0.55rem; border-radius: 8px; }
  .dpad-btn   { font-size: 1.1rem;  border-radius: 8px; }
}

/* Landscape mobile — even tighter, controls can't eat vertical space */
@media screen and (max-height: 500px) and (orientation: landscape) {
  /* HUD */
  .health-bar-section { padding: 4px 8px 2px; }
  .health-bar-wrapper { height: 14px; }
  .super-bar-bg  { height: 6px; }
  .timer-box { width: 40px; height: 30px; }
  .timer-box span { font-size: 1rem; }
  .player-name   { font-size: 0.58rem; }
  .super-key-hint { display: none; }
  .win-dot { width: 8px; height: 8px; }

  /* Controls */
  #mobile-controls { padding: 0 10px max(10px, env(safe-area-inset-bottom, 0px)); }
  #dpad {
    grid-template-columns: repeat(3, 44px);
    grid-template-rows: repeat(3, 44px);
    gap: 3px;
  }
  #action-btns {
    grid-template-columns: repeat(2, 50px);
    grid-template-rows: repeat(3, 44px);
    gap: 5px;
  }
  .action-btn { font-size: 0.5rem; border-radius: 7px; }
  .dpad-btn   { font-size: 1rem;   border-radius: 7px; }

  /* Menu — compress to fit ~390px viewport height */
  .game-title { font-size: 2rem; margin-bottom: 0.15rem; }
  .menu-subtitle { font-size: 0.7rem; letter-spacing: 0.25em; margin-bottom: 0.75rem; }
  .menu-buttons { gap: 0.5rem; }
  .menu-btn, .menu-input { padding: 0.55rem 2rem; font-size: 0.8rem; width: 260px; }
}
