/* ==========================================================================
   NEON DOJO — 2D Pixel Fighting Arena
   Design System & Stylesheet (MacBook Retina Optimized)
   Pure CSS3 — Zero External Fonts / Zero Remote Dependencies
   ========================================================================== */

/* --------------------------------------------------------------------------
   0. Mandatory Overlay Rule (Per API_CONTRACT.md)
   -------------------------------------------------------------------------- */
[hidden] {
  display: none !important;
}

/* Accessibility screen-reader only utility */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* --------------------------------------------------------------------------
   1. Theme Variables & Color Palette
   -------------------------------------------------------------------------- */
:root {
  /* Color Palette matching Canvas Renderer in game.js */
  --bg-dark: #070913;
  --bg-cabinet: #0d111d;
  --bg-surface: #14192b;
  --bg-overlay: rgba(8, 12, 24, 0.92);
  --border-subtle: #242c48;
  --border-neon: #3a4770;

  /* Fighter 1 (Shadow - Cyan / Ninja) */
  --p1-primary: #00f0ff;
  --p1-gradient: linear-gradient(90deg, #00b4d8, #00f0ff);
  --p1-glow: rgba(0, 240, 255, 0.45);
  --p1-dark: #123749;

  /* Fighter 2 (Synth-X - Crimson / Mecha AI) */
  --enemy-primary: #ff0055;
  --enemy-gradient: linear-gradient(270deg, #c55269, #ff0055);
  --enemy-glow: rgba(255, 0, 85, 0.45);
  --enemy-dark: #4a1928;

  /* 4 Original Roster Colors */
  --fire-primary: #ff783d;
  --fire-secondary: #ffcf67;
  --fire-dark: #792d35;
  --fire-glow: rgba(255, 120, 61, 0.5);

  --lightning-primary: #b493ff;
  --lightning-secondary: #f2f6ff;
  --lightning-dark: #37366b;
  --lightning-glow: rgba(180, 147, 255, 0.5);

  --ice-primary: #69d9f5;
  --ice-secondary: #deffff;
  --ice-dark: #244e78;
  --ice-glow: rgba(105, 217, 245, 0.5);

  --earth-primary: #d3a96a;
  --earth-secondary: #a8dfad;
  --earth-dark: #454536;
  --earth-glow: rgba(211, 169, 106, 0.5);

  /* HUD & Accents */
  --timer-gold: #ffbe0b;
  --timer-glow: rgba(255, 190, 11, 0.5);
  --accent-amber: #ebbd86;
  --text-main: #f1f5f9;
  --text-muted: #8896b3;
  --guard-blue: #38bdf8;

  /* Layout & Geometry */
  --canvas-aspect: 16 / 9;
  --bezel-radius: 12px;
  --cabinet-max-width: 1280px;

  /* System Monospace Typography Stack */
  --font-retro: ui-monospace, "SF Mono", Menlo, Monaco, Consolas, "Courier New", monospace;
  --font-ui: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", system-ui, sans-serif;
}

/* --------------------------------------------------------------------------
   2. Base & Reset
   -------------------------------------------------------------------------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  height: 100%;
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: var(--font-retro);
  overflow-x: hidden;
  user-select: none;
  -webkit-user-select: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 8px 16px;
  background-image:
    radial-gradient(ellipse at 50% 0%, rgba(26, 32, 60, 0.45) 0%, transparent 70%),
    linear-gradient(to bottom, #070913 0%, #0a0e1c 100%);
}

/* --------------------------------------------------------------------------
   3. Arcade Enclosure & Layout (Tailored for MacBook Screens)
   -------------------------------------------------------------------------- */
.arcade-app {
  width: 100%;
  max-width: var(--cabinet-max-width);
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0 auto;
}

/* Top Marquee Header Bar */
.cabinet-marquee {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 14px;
  background: var(--bg-cabinet);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.marquee-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.arcade-pill {
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  font-weight: 800;
  color: var(--bg-dark);
  background: var(--p1-primary);
  padding: 2px 8px;
  border-radius: 4px;
  text-shadow: none;
  box-shadow: 0 0 10px var(--p1-glow);
}

.game-title {
  font-size: 1.15rem;
  font-weight: 900;
  letter-spacing: 0.18em;
  color: #fff;
  text-shadow: 0 0 8px rgba(0, 240, 255, 0.6), 0 0 16px rgba(0, 240, 255, 0.2);
}

.edition-tag {
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  border-left: 1px solid var(--border-subtle);
  padding-left: 12px;
  display: none;
}

@media (min-width: 768px) {
  .edition-tag {
    display: inline-block;
  }
}

.cabinet-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.control-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.control-label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}

/* Select Control */
.select-wrapper {
  position: relative;
}

.arcade-select {
  appearance: none;
  -webkit-appearance: none;
  background: var(--bg-surface);
  border: 1px solid var(--border-neon);
  border-radius: 4px;
  color: var(--timer-gold);
  font-family: var(--font-retro);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 4px 24px 4px 10px;
  cursor: pointer;
  outline: none;
  transition: all 0.2s ease;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23ffbe0b'%3e%3cpath d='M7 10l5 5 5-5z'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 4px center;
  background-size: 16px 16px;
}

.arcade-select:hover, .arcade-select:focus {
  border-color: var(--timer-gold);
  box-shadow: 0 0 8px var(--timer-glow);
}

/* Mini Buttons in Header */
.arcade-btn-mini {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-surface);
  border: 1px solid var(--border-neon);
  border-radius: 4px;
  color: var(--text-main);
  font-family: var(--font-retro);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 4px 10px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.arcade-btn-mini:hover:not(:disabled) {
  border-color: var(--p1-primary);
  color: var(--p1-primary);
  box-shadow: 0 0 10px var(--p1-glow);
  transform: translateY(-1px);
}

.arcade-btn-mini:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  border-color: var(--border-subtle);
}

.arcade-btn-mini kbd {
  font-size: 0.6rem;
  padding: 1px 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  color: var(--text-muted);
}

/* Mute Toggle Button */
.mute-btn[aria-pressed="true"] {
  border-color: #ff0055;
  color: #ff99bb;
  background: rgba(255, 0, 85, 0.15);
  box-shadow: 0 0 8px rgba(255, 0, 85, 0.3);
}

.mute-btn[aria-pressed="false"] {
  border-color: #10b981;
  color: #a7f3d0;
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.25);
}

/* Touch Toggle Button in Header */
#touchToggleButton[aria-pressed="true"] {
  border-color: var(--p1-primary);
  color: #a4ffff;
  background: rgba(0, 240, 255, 0.15);
  box-shadow: 0 0 8px var(--p1-glow);
}

/* --------------------------------------------------------------------------
   4. Arena Enclosure, Bezel & Canvas Viewport
   -------------------------------------------------------------------------- */
.arena-enclosure {
  position: relative;
  width: 100%;
  display: flex;
  justify-content: center;
}

.stage-viewport {
  position: relative;
  width: min(100%, calc(min(720px, calc(100vh - 145px)) * (16 / 9)));
  max-width: var(--cabinet-max-width);
  max-height: min(720px, calc(100vh - 145px));
  aspect-ratio: var(--canvas-aspect);
  background: #080e24;
  border: 2px solid var(--border-subtle);
  border-radius: var(--bezel-radius);
  overflow: hidden;
  box-shadow:
    0 0 0 1px rgba(0, 240, 255, 0.1),
    0 12px 36px rgba(0, 0, 0, 0.7),
    0 0 40px rgba(0, 240, 255, 0.06);
}

/* Game Canvas: scales fluidly while preserving 16:9 ratio */
#gameCanvas {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  background-color: #080e24;
}

/* Visual Effects Overlay Canvas */
#effectsCanvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  z-index: 5;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

/* --------------------------------------------------------------------------
   5. In-Game Fighting HUD Layer
   -------------------------------------------------------------------------- */
.fighting-hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  min-height: 80px;
  height: auto;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: flex-start;
  gap: 16px;
  padding: 8px 24px 10px;
  pointer-events: none;
  z-index: 10;
  background: linear-gradient(to bottom, rgba(5, 7, 15, 0.85) 0%, rgba(5, 7, 15, 0) 100%);
}

/* Fighter HUD (P1 and Enemy) */
.fighter-hud {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.fighter-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 0 4px;
}

.fighter-tag {
  display: flex;
  align-items: center;
  gap: 6px;
}

.p-indicator {
  font-size: 0.65rem;
  font-weight: 900;
  padding: 1px 5px;
  border-radius: 2px;
  letter-spacing: 0.06em;
}

.p1-indicator {
  background: var(--p1-primary);
  color: var(--bg-dark);
}

.cpu-indicator {
  background: var(--enemy-primary);
  color: #fff;
}

.fighter-codename {
  font-size: 0.85rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: #fff;
  text-shadow: 0 0 6px rgba(0, 0, 0, 0.8);
}

/* Status Badges in HUD */
.fighter-status-badge {
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  padding: 1px 6px;
  border-radius: 3px;
  empty-cells: hide;
}

.fighter-status-badge:empty {
  display: none;
}

.fighter-status-badge.status-shield {
  background: rgba(168, 223, 173, 0.2);
  color: #a8dfad;
  border: 1px solid #a8dfad;
  box-shadow: 0 0 6px rgba(168, 223, 173, 0.4);
}

.fighter-status-badge.status-slow {
  background: rgba(105, 217, 245, 0.2);
  color: #69d9f5;
  border: 1px solid #69d9f5;
  box-shadow: 0 0 6px rgba(105, 217, 245, 0.4);
}

.fighter-hp-val {
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.hp-label {
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  color: var(--accent-amber);
  text-shadow: 0 0 6px rgba(235, 189, 134, 0.4);
}

.hp-number {
  font-size: 0.92rem;
  font-weight: 900;
  letter-spacing: 0.05em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.player-hud .hp-number {
  color: #e0f9ff;
  text-shadow: 0 0 10px var(--p1-glow);
}

.enemy-hud .hp-number {
  color: #ffe6ed;
  text-shadow: 0 0 10px var(--enemy-glow);
}

/* Slanted Arcade Health Gauges (Upgraded 300 HP Edition) */
.health-gauge {
  position: relative;
  width: 100%;
  height: 28px;
  background: linear-gradient(180deg, rgba(32, 14, 24, 0.92) 0%, rgba(14, 18, 32, 0.96) 100%);
  border: 2px solid #2e3d68;
  border-radius: 4px;
  overflow: hidden;
  box-shadow:
    inset 0 2px 8px rgba(0, 0, 0, 0.9),
    0 2px 8px rgba(0, 0, 0, 0.5),
    0 0 1px rgba(255, 255, 255, 0.15);
  transform: skewX(-14deg);
}

.enemy-gauge {
  transform: skewX(14deg);
  display: flex;
  justify-content: flex-end;
}

/* Health Bar Fills with Smooth Damage Decrease Transition */
.health-fill {
  height: 100%;
  transition: width 0.38s cubic-bezier(0.22, 1, 0.36, 1);
  position: relative;
}

.health-fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 38%;
  background: linear-gradient(to bottom, rgba(255, 255, 255, 0.42) 0%, rgba(255, 255, 255, 0.05) 100%);
  pointer-events: none;
}

.player-fill {
  background: linear-gradient(180deg, #7df9ff 0%, #00f0ff 40%, #0096c7 100%);
  box-shadow: 0 0 18px var(--p1-glow), inset 0 -1px 3px rgba(0, 0, 0, 0.4);
  border-right: 3px solid rgba(255, 255, 255, 0.95);
  transform-origin: left center;
}

.enemy-fill {
  background: linear-gradient(180deg, #ff7397 0%, #ff0055 40%, #a50036 100%);
  box-shadow: 0 0 18px var(--enemy-glow), inset 0 -1px 3px rgba(0, 0, 0, 0.4);
  border-left: 3px solid rgba(255, 255, 255, 0.95);
  transform-origin: right center;
  margin-left: auto;
}

/* Fighter Sub-Meta (Energy Labels and Values) */
.fighter-sub-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 0 4px;
  margin-top: 1px;
}

.enemy-sub-meta {
  justify-content: space-between;
}

.energy-label {
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: #7dd3fc;
}

.enemy-sub-meta .energy-label {
  color: #d8b4fe;
}

.energy-number {
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.05em;
  font-variant-numeric: tabular-nums;
  color: #38bdf8;
  text-shadow: 0 0 6px rgba(56, 189, 248, 0.5);
}

.enemy-sub-meta .energy-number {
  color: #c084fc;
  text-shadow: 0 0 6px rgba(192, 132, 252, 0.5);
}

/* Slanted Energy Gauges */
.energy-gauge {
  position: relative;
  width: 100%;
  height: 10px;
  background: rgba(12, 16, 28, 0.88);
  border: 1px solid #2a3b63;
  border-radius: 2px;
  overflow: hidden;
  box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.8);
  transform: skewX(-14deg);
}

.energy-gauge.enemy-gauge {
  transform: skewX(14deg);
  display: flex;
  justify-content: flex-end;
}

.energy-fill {
  height: 100%;
  transition: width 0.12s cubic-bezier(0.2, 0.8, 0.4, 1);
  position: relative;
}

.player-energy-fill {
  background: linear-gradient(90deg, #0284c7 0%, #38bdf8 100%);
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.6);
  transform-origin: left center;
}

.enemy-energy-fill {
  background: linear-gradient(270deg, #9333ea 0%, #c084fc 100%);
  box-shadow: 0 0 10px rgba(192, 132, 252, 0.6);
  transform-origin: right center;
  margin-left: auto;
}

/* Center Timer & Match VS */
.hud-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
}

.round-indicator {
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  color: var(--accent-amber);
  margin-bottom: 2px;
  text-shadow: 0 0 6px rgba(235, 189, 134, 0.4);
}

.timer-box {
  background: rgba(12, 16, 30, 0.9);
  border: 2px solid var(--timer-gold);
  border-radius: 6px;
  padding: 4px 14px;
  box-shadow: 0 0 16px var(--timer-glow), inset 0 0 8px rgba(255, 190, 11, 0.2);
}

.timer-digits {
  font-size: 1.85rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  color: var(--timer-gold);
  line-height: 1;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 12px var(--timer-glow);
}

.vs-emblem {
  position: absolute;
  bottom: -16px;
  font-size: 0.7rem;
  font-weight: 900;
  font-style: italic;
  letter-spacing: 0.08em;
  color: #fff;
  background: #ff0055;
  padding: 1px 6px;
  border-radius: 3px;
  box-shadow: 0 0 8px rgba(255, 0, 85, 0.6);
}

/* --------------------------------------------------------------------------
   5b. Combat Skills Dock (Left-Side ASDF Cards & JJK Combo)
   -------------------------------------------------------------------------- */
.combat-skills-dock {
  position: absolute;
  bottom: 12px;
  left: 16px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  pointer-events: none;
  z-index: 10;
}

/* Combo Indicator */
.combo-indicator {
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: rgba(10, 15, 28, 0.9);
  border: 1px solid var(--border-neon);
  border-radius: 6px;
  padding: 5px 10px;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.6);
  transition: all 0.2s cubic-bezier(0.2, 0.8, 0.4, 1);
}

.combo-badge-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.combo-tag {
  font-size: 0.6rem;
  font-weight: 900;
  letter-spacing: 0.14em;
  color: var(--accent-amber);
  text-shadow: 0 0 6px rgba(235, 189, 134, 0.4);
}

.combo-timer {
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
  color: var(--timer-gold);
}

.combo-steps {
  display: flex;
  align-items: center;
  gap: 5px;
}

.combo-step {
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: all 0.18s ease;
}

.combo-step .keycap {
  font-size: 0.58rem;
  min-width: 16px;
  height: 16px;
  padding: 0 3px;
}

.combo-sep {
  font-size: 0.7rem;
  color: var(--border-subtle);
}

.combo-step.is-completed {
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.15);
  border-color: rgba(56, 189, 248, 0.45);
  text-shadow: 0 0 6px rgba(56, 189, 248, 0.4);
}

.combo-step.is-active {
  color: #fff;
  background: rgba(255, 190, 11, 0.22);
  border-color: var(--timer-gold);
  box-shadow: 0 0 10px var(--timer-glow);
  transform: scale(1.05);
  animation: comboStepPulse 0.5s infinite alternate ease-in-out;
}

@keyframes comboStepPulse {
  from { box-shadow: 0 0 4px var(--timer-glow); }
  to { box-shadow: 0 0 14px rgba(255, 190, 11, 0.85); }
}

.combo-burst {
  animation: comboBurstPulse 0.4s ease-out;
}

@keyframes comboBurstPulse {
  0% { transform: scale(1); box-shadow: 0 0 20px #ffbe0b; }
  50% { transform: scale(1.06); box-shadow: 0 0 35px #ffbe0b; border-color: #ffbe0b; }
  100% { transform: scale(1); }
}

/* ASDF Skill Cards Dock (Left-Side) */
.skills-cards-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: auto;
}

.skill-card {
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid var(--border-neon);
  border-radius: 6px;
  background: rgba(12, 17, 32, 0.94);
  color: var(--text-main);
  font-family: var(--font-retro);
  padding: 5px 8px;
  min-width: 102px;
  min-height: 44px; /* Accessible 44px minimum touch target */
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: all 0.18s cubic-bezier(0.2, 0.8, 0.4, 1);
  position: relative;
  overflow: hidden;
  text-align: left;
  touch-action: none; /* Touch action none only on controls */
}

.skill-card:hover {
  transform: translateY(-2px);
}

.skill-card:focus-visible {
  outline: 2px solid var(--p1-primary);
  outline-offset: 2px;
}

.skill-card:active {
  transform: translateY(1px);
}

.skill-card-inner {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.skill-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.skill-kbd {
  font-size: 0.65rem;
  font-weight: 900;
  background: #1e2742;
  color: #fff;
  padding: 1px 5px;
  border-radius: 3px;
  border: 1px solid #3c496e;
  border-bottom: 2px solid #0f121d;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

.skill-cost {
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: #7dd3fc;
}

.skill-main {
  display: flex;
  align-items: center;
  gap: 6px;
}

.skill-icon {
  font-size: 1.05rem;
  line-height: 1;
}

.skill-info {
  display: flex;
  flex-direction: column;
}

.skill-title {
  font-size: 0.6rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  color: #fff;
  white-space: nowrap;
}

.cooldown-text {
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
}

/* Skill Card States: Ready, Cooldown, Insufficient Energy */
.skill-card.is-ready,
.skill-card[data-state="ready"] {
  border-color: #00f0ff;
  box-shadow: 0 0 12px rgba(0, 240, 255, 0.28);
}

.skill-card.is-ready .cooldown-text,
.skill-card[data-state="ready"] .cooldown-text {
  color: #10b981;
}

.skill-card.is-cooldown,
.skill-card[data-state="cooldown"] {
  border-color: rgba(136, 150, 179, 0.35);
  background: rgba(10, 13, 24, 0.88);
  opacity: 0.75;
}

.skill-card.is-cooldown .cooldown-text,
.skill-card[data-state="cooldown"] .cooldown-text {
  color: var(--timer-gold);
}

.skill-card.is-cooldown .skill-kbd,
.skill-card[data-state="cooldown"] .skill-kbd {
  opacity: 0.65;
}

.skill-card.is-low-energy,
.skill-card[data-state="insufficient-energy"],
.skill-card[data-state="low-energy"] {
  border-color: rgba(255, 0, 85, 0.5);
  background: rgba(24, 10, 18, 0.88);
  opacity: 0.82;
}

.skill-card.is-low-energy .cooldown-text,
.skill-card[data-state="insufficient-energy"] .cooldown-text,
.skill-card[data-state="low-energy"] .cooldown-text {
  color: #ff0055;
}

.skill-card.is-low-energy .skill-cost,
.skill-card[data-state="insufficient-energy"] .skill-cost,
.skill-card[data-state="low-energy"] .skill-cost {
  color: #ff0055;
  animation: costAlertPulse 0.9s infinite alternate ease-in-out;
}

@keyframes costAlertPulse {
  from { opacity: 0.65; }
  to { opacity: 1; text-shadow: 0 0 6px rgba(255, 0, 85, 0.8); }
}

/* Card Specific Element Highlights */
#skillA.is-ready { border-color: var(--fire-primary); box-shadow: 0 0 12px var(--fire-glow); }
#skillS.is-ready { border-color: var(--lightning-primary); box-shadow: 0 0 12px var(--lightning-glow); }
#skillD.is-ready { border-color: var(--ice-primary); box-shadow: 0 0 12px var(--ice-glow); }
#skillF.is-ready { border-color: var(--timer-gold); box-shadow: 0 0 14px var(--timer-glow); }

/* --------------------------------------------------------------------------
   5c. Coarse-Pointer / On-Screen Touch Controls (Right Side Dock)
   -------------------------------------------------------------------------- */
.touch-controls-dock {
  position: absolute;
  bottom: 12px;
  right: 16px;
  display: flex;
  align-items: flex-end;
  gap: 16px;
  z-index: 20; /* Lower than modal overlays (z-index: 50) */
  pointer-events: none;
}

.touch-combat-group, .touch-dpad-group {
  display: flex;
  gap: 8px;
  pointer-events: auto;
}

.touch-combat-group {
  align-items: flex-end;
}

/* Touch Buttons with 44px Minimum Comfortable Target Size */
.touch-btn {
  appearance: none;
  -webkit-appearance: none;
  min-width: 48px;
  min-height: 48px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2px solid var(--border-neon);
  background: rgba(14, 20, 38, 0.92);
  color: #fff;
  font-family: var(--font-retro);
  font-size: 0.72rem;
  font-weight: 900;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.6);
  transition: all 0.12s ease;
  touch-action: none; /* touch-action none only on controls */
  user-select: none;
  -webkit-user-select: none;
}

.touch-btn:hover {
  transform: scale(1.04);
}

.touch-btn:active, .touch-btn.is-active {
  transform: scale(0.95);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
}

.touch-btn-label {
  font-size: 0.52rem;
  letter-spacing: 0.04em;
}

.touch-keycap {
  font-size: 0.55rem;
  opacity: 0.75;
}

/* Combat Touch Buttons */
.touch-btn-attack[data-control="punch"] {
  border-color: #ff0055;
  color: #ff99bb;
  box-shadow: 0 0 10px rgba(255, 0, 85, 0.35);
}

.touch-btn-attack[data-control="kick"] {
  border-color: var(--timer-gold);
  color: #ffdf98;
  box-shadow: 0 0 10px var(--timer-glow);
}

.touch-btn-guard {
  border-color: #38bdf8;
  color: #bae6fd;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.35);
}

/* Directional D-Pad Layout */
.touch-dpad-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.dpad-horizontal-row {
  display: flex;
  align-items: center;
  gap: 4px;
}

.dpad-center-spacer {
  width: 48px;
  height: 48px;
  background: rgba(10, 15, 28, 0.4);
  border-radius: 6px;
  border: 1px dashed rgba(255, 255, 255, 0.08);
}

.touch-btn-dpad {
  border-radius: 8px;
  border-color: #3a4770;
  color: var(--p1-primary);
}

.touch-btn-dpad:active {
  background: var(--p1-primary);
  color: #070913;
  box-shadow: 0 0 12px var(--p1-glow);
}

.touch-dpad-icon {
  font-size: 0.9rem;
  line-height: 1;
}

/* Responsive coarse-pointer auto-display */
@media (pointer: coarse) {
  #touchControls {
    display: flex !important;
  }
}

/* --------------------------------------------------------------------------
   6. Overlays (Start/Character Select, Pause, Game Over)
   -------------------------------------------------------------------------- */
.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-overlay);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 50; /* Above HUD and touch controls */
  padding: 16px;
  box-sizing: border-box;
  animation: overlayFadeIn 0.25s ease-out;
  overflow-y: auto;
}

@keyframes overlayFadeIn {
  from { opacity: 0; transform: scale(0.98); }
  to { opacity: 1; transform: scale(1); }
}

.overlay-card {
  position: relative;
  width: 100%;
  max-width: 540px;
  background: rgba(16, 22, 38, 0.94);
  border: 2px solid var(--border-neon);
  border-radius: 12px;
  padding: 24px 28px;
  text-align: center;
  box-shadow:
    0 16px 48px rgba(0, 0, 0, 0.8),
    0 0 32px rgba(0, 240, 255, 0.15);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Character Selection Card Sizing for MacBook Window Safety */
.select-card {
  max-width: 820px;
  max-height: 100%;
  box-sizing: border-box;
  margin: auto;
  flex-shrink: 1;
  overflow-y: auto;
  padding: 18px 24px;
  gap: 14px;
}

/* Custom Scrollbar for Select Card */
.select-card::-webkit-scrollbar {
  width: 6px;
}

.select-card::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.3);
  border-radius: 3px;
}

.select-card::-webkit-scrollbar-thumb {
  background: var(--border-neon);
  border-radius: 3px;
}

.select-card::-webkit-scrollbar-thumb:hover {
  background: var(--p1-primary);
}

.kanji-emblem {
  font-size: 1.8rem;
  color: var(--accent-amber);
  margin-bottom: 2px;
  text-shadow: 0 0 14px rgba(235, 189, 134, 0.5);
  font-family: serif, var(--font-retro);
  letter-spacing: 0.2em;
}

.overlay-title {
  font-size: 1.6rem;
  font-weight: 900;
  letter-spacing: 0.16em;
  color: #fff;
  text-shadow: 0 0 16px var(--p1-glow), 0 0 32px rgba(0, 240, 255, 0.2);
}

.overlay-subtitle {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--text-muted);
  margin-top: 2px;
}

/* --------------------------------------------------------------------------
   6b. Character Select Grid & Cards
   -------------------------------------------------------------------------- */
.character-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  width: 100%;
}

.character-card {
  appearance: none;
  -webkit-appearance: none;
  background: rgba(10, 15, 28, 0.85);
  border: 2px solid var(--border-subtle);
  border-radius: 10px;
  padding: 10px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.2, 0.8, 0.4, 1);
  outline: none;
  position: relative;
  overflow: hidden;
}

.character-card:hover {
  transform: translateY(-3px);
  border-color: var(--p1-primary);
  box-shadow: 0 4px 16px rgba(0, 240, 255, 0.25);
}

.character-card:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

/* Selected Character Card */
.character-card.is-selected {
  border-color: var(--p1-primary);
  background: rgba(16, 28, 52, 0.92);
  box-shadow: 0 0 20px var(--p1-glow), inset 0 0 12px rgba(0, 240, 255, 0.15);
  transform: scale(1.03);
}

.character-card[data-character="hoa-quyen"].is-selected {
  border-color: var(--fire-primary);
  box-shadow: 0 0 20px var(--fire-glow), inset 0 0 12px rgba(255, 120, 61, 0.15);
}

.character-card[data-character="loi-anh"].is-selected {
  border-color: var(--lightning-primary);
  box-shadow: 0 0 20px var(--lightning-glow), inset 0 0 12px rgba(180, 147, 255, 0.15);
}

.character-card[data-character="bang-kiem"].is-selected {
  border-color: var(--ice-primary);
  box-shadow: 0 0 20px var(--ice-glow), inset 0 0 12px rgba(105, 217, 245, 0.15);
}

.character-card[data-character="thiet-giap"].is-selected {
  border-color: var(--earth-primary);
  box-shadow: 0 0 20px var(--earth-glow), inset 0 0 12px rgba(211, 169, 106, 0.15);
}

.card-portrait-wrap {
  position: relative;
  width: 72px;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.4);
  overflow: hidden;
}

.character-portrait {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.element-badge {
  position: absolute;
  bottom: 2px;
  right: 2px;
  font-size: 0.55rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  padding: 1px 4px;
  border-radius: 3px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

.element-fire { background: var(--fire-primary); color: #fff; }
.element-lightning { background: var(--lightning-primary); color: #0d0b1a; }
.element-ice { background: var(--ice-primary); color: #0e1f30; }
.element-earth { background: var(--earth-primary); color: #1a160d; }

.card-meta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.character-card-name {
  font-size: 0.85rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  color: #fff;
}

.character-card-type {
  font-size: 0.6rem;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}

/* --------------------------------------------------------------------------
   6c. Selected Character Detailed Preview Panel
   -------------------------------------------------------------------------- */
.preview-details-panel {
  background: rgba(8, 12, 24, 0.75);
  border: 1px solid var(--border-neon);
  border-radius: 8px;
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: left;
}

.preview-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.preview-name {
  font-size: 1.15rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  color: #fff;
}

.selection-status-badge {
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  padding: 3px 8px;
  border-radius: 4px;
  background: rgba(255, 190, 11, 0.15);
  border: 1px solid var(--timer-gold);
  color: var(--timer-gold);
}

.selection-status-badge.is-confirmed {
  background: rgba(16, 185, 129, 0.2);
  border-color: #10b981;
  color: #34d399;
}

.preview-desc {
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* 12-point Stat Budget Display */
.preview-stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.stat-bar-group {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.stat-label {
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: var(--accent-amber);
}

.stat-gauge {
  width: 100%;
  height: 8px;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid var(--border-subtle);
  border-radius: 2px;
  overflow: hidden;
}

.stat-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #0284c7 0%, #38bdf8 100%);
  border-radius: 2px;
  box-shadow: 0 0 6px rgba(56, 189, 248, 0.5);
  transition: width 0.2s ease;
}

.stat-value {
  font-size: 0.62rem;
  font-weight: 800;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

/* Preview Skills Grid (A, S, D, F) */
.preview-skills-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-top: 4px;
}

.preview-skill-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 6px;
  padding: 6px 10px;
}

.preview-skill-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 0.68rem;
}

.preview-skill-text strong {
  color: #fff;
  font-weight: 800;
}

.preview-skill-desc {
  font-size: 0.62rem;
  color: var(--text-muted);
  line-height: 1.3;
}

/* Action Buttons */
.selection-action-row, .gameover-actions-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

.arcade-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 28px;
  border-radius: 6px;
  font-family: var(--font-retro);
  font-size: 0.95rem;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.18s cubic-bezier(0.2, 0.8, 0.4, 1);
  outline: none;
  position: relative;
  overflow: hidden;
}

.arcade-btn:hover:not(:disabled) {
  transform: translateY(-2px);
}

.arcade-btn:active:not(:disabled) {
  transform: translateY(1px);
}

.arcade-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  filter: grayscale(0.6);
}

.arcade-btn-primary {
  background: #00f0ff;
  color: #070913;
  border: 2px solid #00f0ff;
  box-shadow: 0 0 20px var(--p1-glow), 0 6px 16px rgba(0, 0, 0, 0.5);
}

.arcade-btn-primary:hover:not(:disabled) {
  background: #fff;
  border-color: #fff;
  box-shadow: 0 0 28px rgba(0, 240, 255, 0.8), 0 8px 24px rgba(0, 0, 0, 0.6);
}

.arcade-btn-secondary {
  background: rgba(255, 190, 11, 0.15);
  color: var(--timer-gold);
  border: 2px solid var(--timer-gold);
  box-shadow: 0 0 16px var(--timer-glow);
}

.arcade-btn-secondary:hover:not(:disabled) {
  background: var(--timer-gold);
  color: #070913;
  box-shadow: 0 0 24px rgba(255, 190, 11, 0.8);
}

.arcade-btn-success {
  background: #10b981;
  color: #070913;
  border: 2px solid #10b981;
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.4);
}

.arcade-btn-success:hover:not(:disabled) {
  background: #34d399;
  border-color: #34d399;
  box-shadow: 0 0 28px rgba(16, 185, 129, 0.7);
}

.arcade-btn-warning {
  background: var(--timer-gold);
  color: #070913;
  border: 2px solid var(--timer-gold);
  box-shadow: 0 0 20px var(--timer-glow);
}

.arcade-btn-warning:hover:not(:disabled) {
  background: #fff;
  border-color: #fff;
  box-shadow: 0 0 28px rgba(255, 190, 11, 0.8);
}

.btn-bracket {
  opacity: 0.6;
}

.quick-tips, .hint-text {
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.hint-text kbd {
  display: inline-block;
  padding: 2px 6px;
  background: var(--bg-surface);
  border: 1px solid var(--border-neon);
  border-radius: 4px;
  color: #fff;
  font-weight: 700;
}

/* Status Badges */
.status-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  padding: 3px 10px;
  border-radius: 4px;
  margin-bottom: 8px;
}

.pause-badge {
  background: rgba(56, 189, 248, 0.2);
  color: #38bdf8;
  border: 1px solid #38bdf8;
}

.gameover-badge {
  background: rgba(255, 0, 85, 0.2);
  color: #ff0055;
  border: 1px solid #ff0055;
}

/* Result Text in Game Over Screen */
.result-text {
  font-size: 2.6rem;
  font-weight: 900;
  letter-spacing: 0.2em;
  color: #fff;
  text-shadow:
    0 0 20px rgba(255, 190, 11, 0.8),
    0 0 40px rgba(255, 190, 11, 0.4);
  margin-top: 4px;
}

/* --------------------------------------------------------------------------
   7. Arcade Control Deck & Controls Legend
   -------------------------------------------------------------------------- */
.arcade-deck {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 18px;
  background: var(--bg-cabinet);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  flex-wrap: wrap;
  gap: 12px;
}

.deck-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: var(--accent-amber);
}

.deck-keys {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.key-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.keycaps {
  display: flex;
  gap: 3px;
}

/* 3D Pixel Arcade Keycaps */
.keycap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  height: 24px;
  padding: 0 6px;
  background: linear-gradient(to bottom, #252e47 0%, #151a2a 100%);
  border: 1px solid #3c496e;
  border-bottom: 3px solid #0f121d;
  border-radius: 4px;
  font-family: var(--font-retro);
  font-size: 0.7rem;
  font-weight: 800;
  color: #fff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.nav-key {
  border-color: #38bdf8;
  color: #bae6fd;
  box-shadow: 0 0 6px rgba(56, 189, 248, 0.35);
  font-size: 0.82rem;
  line-height: 1;
}

.attack-key {
  border-color: #ff0055;
  color: #ff99bb;
  box-shadow: 0 0 6px rgba(255, 0, 85, 0.35);
}

.guard-key {
  border-color: var(--guard-blue);
  color: #b3edff;
  box-shadow: 0 0 6px rgba(56, 189, 248, 0.35);
}

.util-key {
  border-color: var(--timer-gold);
  color: #ffe699;
  font-size: 0.65rem;
}

.skill-key {
  border-color: #00f0ff;
  color: #a4ffff;
  box-shadow: 0 0 6px rgba(0, 240, 255, 0.35);
}

.combo-keycaps {
  display: flex;
  align-items: center;
  gap: 2px;
}

.combo-key {
  border-color: var(--accent-amber);
  color: #ffdfba;
}

.key-chain-arrow {
  font-size: 0.68rem;
  color: var(--border-neon);
  margin: 0 1px;
}

.key-label {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

/* --------------------------------------------------------------------------
   8. Reduced Motion & Responsive Adjustments
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .stage-viewport {
    transform: none !important;
  }
}

@media (max-width: 860px) {
  body {
    padding: 4px;
  }

  .cabinet-marquee {
    padding: 6px 10px;
  }

  .game-title {
    font-size: 1rem;
  }

  .fighting-hud {
    padding: 6px 12px;
    gap: 8px;
  }

  .health-gauge {
    height: 20px;
  }

  .energy-gauge {
    height: 8px;
  }

  .combat-skills-dock {
    bottom: 6px;
    left: 8px;
    gap: 6px;
  }

  .skill-card {
    min-width: 80px;
    padding: 3px 5px;
  }

  .skill-title {
    font-size: 0.52rem;
  }

  .skill-icon {
    font-size: 0.9rem;
  }

  .character-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .preview-stats-row {
    grid-template-columns: repeat(2, 1fr);
  }

  .preview-skills-grid {
    grid-template-columns: 1fr;
  }

  .combo-indicator {
    padding: 4px 8px;
  }

  .combo-step {
    font-size: 0.55rem;
    padding: 2px 4px;
  }

  .timer-box {
    padding: 2px 10px;
  }

  .timer-digits {
    font-size: 1.4rem;
  }

  .overlay-card {
    padding: 16px 20px;
    gap: 12px;
  }

  .overlay-title {
    font-size: 1.3rem;
  }

  .result-text {
    font-size: 2rem;
  }

  .arcade-btn {
    padding: 10px 20px;
    font-size: 0.85rem;
  }

  .deck-keys {
    gap: 8px;
  }
}

/* Keep confirmation outside the scrolling roster details. */
.start-overlay { display: block; }
.start-overlay .select-card { position: absolute; inset: 16px; height: auto; max-height: none; width: auto; margin: 0 auto; overflow: hidden; }
.select-card > .overlay-header, .select-card > .selection-action-row { flex-shrink: 0; }
.select-card > .overlay-body { flex: 1; min-height: 0; overflow-y: auto; padding: 4px; }
.select-card > .selection-action-row { padding-top: 6px; }
@media (max-width: 600px) {
  .start-overlay { position: fixed; inset: 0; padding: 8px; z-index: 100; }
  .start-overlay .select-card { max-width: none; inset: 8px; }
  .select-card .preview-header-row { flex-wrap: wrap; }
  .select-card .selection-status-badge { font-size: 0.55rem; }
  .select-card .selection-action-row { gap: 8px; }
  .select-card .arcade-btn { padding: 10px 8px; font-size: 0.7rem; letter-spacing: 0.04em; }
}

/* On narrow screens give touch targets their own panel below the 16:9 arena. */
@media (max-width: 860px) {
  .stage-viewport { width: 100%; max-height: none; aspect-ratio: auto; padding-top: 56.25%; padding-bottom: 250px; }
  #gameCanvas, #effectsCanvas { position: absolute; inset: 0 auto auto 0; width: 100%; height: auto; aspect-ratio: 16 / 9; }
  .combat-skills-dock { width: calc(50% - 16px); bottom: 12px; }
  .skills-cards-bar { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; gap: 6px; }
  .skill-card { min-width: 0; min-height: 66px; }
  .skill-main { gap: 3px; }
  .skill-icon { display: none; }
  .skill-title { overflow-wrap: anywhere; }
  .combo-indicator { width: 100%; }
  .combo-step { font-size: 0.45rem; }
  .touch-controls-dock { right: 8px; bottom: 12px; flex-direction: column; align-items: center; gap: 12px; }
  .touch-combat-group { gap: 5px; }
  .fighting-hud .fighter-name { font-size: 0.65rem; }
}

@media (max-width: 860px) {
  .cabinet-marquee, .cabinet-controls { flex-wrap: wrap; gap: 8px; }
  .cabinet-controls { justify-content: center; }
  .fighting-hud { grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); }
  .fighter-hud, .fighter-tag { min-width: 0; }
  .fighter-meta { flex-wrap: wrap; gap: 2px; }
  .fighter-codename { overflow-wrap: anywhere; }
}
@media (max-width: 600px) {
  .cabinet-marquee { justify-content: center; }
  .cabinet-controls { width: 100%; gap: 6px; }
  .control-label, .arcade-btn-mini kbd { display: none; }
  .arcade-btn-mini { min-height: 36px; padding: 4px 6px; font-size: 0.62rem; }
  .fighting-hud { padding: 6px; gap: 5px; }
  .fighter-meta { flex-direction: column; align-items: flex-start; padding: 0; }
  .enemy-hud .fighter-meta { flex-direction: column-reverse; align-items: flex-end; }
  .fighter-tag { gap: 3px; max-width: 100%; flex-wrap: wrap; }
  .fighter-codename { font-size: 0.65rem; letter-spacing: 0.02em; }
  .hp-number { font-size: 0.72rem; white-space: nowrap; }
  .hp-label, .energy-label { font-size: 0.5rem; }
  .p-indicator { font-size: 0.5rem; padding: 1px 3px; }
  .energy-number { font-size: 0.7rem; }
  .round-indicator { font-size: 0.5rem; }
  .timer-box { padding: 2px 6px; }
  .vs-emblem { font-size: 0.6rem; }
}
