:root {
  --bg-dark: #070b14;
  --gold: #facc15;
  --orange: #f97316;
  --red: #ef4444;
  --cyan: #38bdf8;
  --panel: rgba(15, 23, 42, 0.92);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}

input, textarea, select {
  user-select: text;
  -webkit-user-select: text;
}

@supports (-webkit-touch-callout: none) {
  input, textarea, select {
    font-size: 16px !important;
  }
}

html, body {
  position: fixed;
  inset: 0;
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-text-size-adjust: 100%;
  background: #050811;
  color: #f8fafc;
  font-family: 'Segoe UI', Roboto, system-ui, -apple-system, sans-serif;
  touch-action: none;
}

#app {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: radial-gradient(circle at 50% 30%, #1e1b4b 0%, #050811 80%);
  touch-action: manipulation;
}

#screen-fight,
#game-canvas,
.touch-layer,
.touch-layer * {
  touch-action: none !important;
  -webkit-user-select: none !important;
  user-select: none !important;
  -webkit-touch-callout: none !important;
}

.dojo-row,
.dojo-row * {
  touch-action: pan-x !important;
  -webkit-overflow-scrolling: touch;
}

.modal-card,
.modal-card * {
  touch-action: pan-y !important;
  -webkit-overflow-scrolling: touch;
}

.modal-card input[type="range"] {
  touch-action: pan-x !important;
}

.screen {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: env(safe-area-inset-top, 8px) env(safe-area-inset-right, 12px) env(safe-area-inset-bottom, 8px) env(safe-area-inset-left, 12px);
}

.screen.active {
  display: flex;
}

/* --- TITLE SCREEN --- */
#screen-title {
  background:
    radial-gradient(circle at 50% 25%, rgba(249, 115, 22, 0.25), transparent 55%),
    radial-gradient(circle at 20% 80%, rgba(56, 189, 248, 0.16), transparent 45%),
    linear-gradient(180deg, #0b1120 0%, #050811 100%);
  gap: 10px;
  padding-top: 34px;
}

.title-top-bar {
  position: absolute;
  top: 6px;
  right: 12px;
  display: flex;
  gap: 6px;
  z-index: 5;
}

.title-hero-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(10px, 2.8vw, 32px);
  max-width: 96vw;
}

.title-side-fighter {
  height: clamp(82px, 22vh, 152px);
  width: auto;
  object-fit: contain;
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.8));
  pointer-events: none;
  user-select: none;
  animation: titleFighterStance 2.2s ease-in-out infinite;
}

.title-side-fighter.right {
  animation-delay: -1.1s;
}

@keyframes titleFighterStance {
  0%, 100% { transform: translateY(0) scaleY(1); }
  50% { transform: translateY(-4px) scaleY(1.02); }
}

.arcade-logo {
  text-align: center;
  line-height: 0.95;
  margin-bottom: 2px;
}

.arcade-logo .sub-top {
  display: inline-block;
  background: #dc2626;
  color: #fff;
  font-weight: 900;
  font-size: clamp(10px, 1.8vw, 13px);
  letter-spacing: 3px;
  padding: 3px 10px;
  border-radius: 4px;
  border: 2px solid #facc15;
  margin-bottom: 6px;
}

.arcade-logo h1 {
  margin: 0;
  font-family: 'Arial Black', Impact, sans-serif;
  font-size: clamp(34px, 7.2vw, 68px);
  font-style: italic;
  letter-spacing: 2px;
  background: linear-gradient(180deg, #fef08a 0%, #facc15 45%, #ef4444 95%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 4px 0 #09090b) drop-shadow(0 0 18px rgba(250, 204, 21, 0.45));
}

.arcade-logo .edition {
  font-size: clamp(11px, 1.8vw, 16px);
  font-weight: 800;
  letter-spacing: 5px;
  color: #38bdf8;
  text-shadow: 0 2px 6px #000;
}

.roster-strip {
  display: flex;
  gap: 6px;
  justify-content: center;
  flex-wrap: nowrap;
  max-width: 94vw;
  overflow: hidden;
  padding: 4px 8px;
}

.roster-strip img {
  width: clamp(32px, 4.8vw, 50px);
  height: clamp(32px, 4.8vw, 50px);
  object-fit: contain;
  background: rgba(30, 41, 59, 0.7);
  border: 2px solid #facc15;
  border-radius: 8px;
  padding: 2px;
}

.menu-buttons {
  display: grid;
  grid-template-columns: repeat(4, minmax(118px, 162px));
  justify-content: center;
  gap: 8px;
  width: auto;
  max-width: 94vw;
}

@media (max-width: 680px) {
  .menu-buttons {
    grid-template-columns: repeat(2, minmax(126px, 175px));
    width: auto;
    max-width: 94vw;
  }
}

.btn-arcade.net-accent {
  border-color: #38bdf8;
  background: linear-gradient(180deg, rgba(14, 116, 144, 0.45), rgba(15, 23, 42, 0.92));
}

.net-room-bar {
  width: min(96vw, 940px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 5px 10px;
  border-radius: 10px;
  background: rgba(14, 116, 144, 0.25);
  border: 1.5px solid #38bdf8;
  font-size: 12px;
  flex-wrap: wrap;
}

.net-badge {
  font-weight: 900;
  letter-spacing: 0.5px;
  color: #facc15;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid #facc15;
  border-radius: 6px;
  padding: 2px 8px;
}

.net-status-text {
  flex: 1;
  text-align: center;
  color: #e0f2fe;
  font-weight: 700;
}

.net-mini-btn {
  padding: 3px 9px !important;
  font-size: 11px !important;
}

.net-role-pill {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 15;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(2, 6, 23, 0.85);
  border: 1.5px solid #38bdf8;
  color: #bae6fd;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
  pointer-events: none;
}

.net-lobby-card {
  width: min(94vw, 560px) !important;
  max-height: 92dvh;
  overflow-y: auto;
  padding: 14px 16px !important;
}

.net-lobby-card h3 {
  margin: 0 0 4px;
  color: #38bdf8;
}

.net-lobby-sub {
  margin: 0 0 10px;
  font-size: 12px;
  color: #cbd5e1;
}

.net-lan-box {
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid #334155;
  border-radius: 8px;
  padding: 8px 10px;
  margin-bottom: 10px;
  text-align: left;
}

.net-lan-label {
  font-size: 11px;
  color: #94a3b8;
  margin-bottom: 4px;
}

.net-lan-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.net-lan-row code {
  font-size: 12.5px;
  font-weight: 800;
  color: #facc15;
  word-break: break-all;
}

.net-lobby-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.net-create-btn {
  flex: 1 1 180px;
  padding: 8px 12px !important;
  font-size: 13px !important;
}

.net-join-row {
  flex: 1 1 200px;
  display: flex;
  gap: 6px;
}

.net-join-row input {
  flex: 1;
  min-width: 90px;
  background: #0f172a;
  color: #fff;
  border: 1.5px solid #475569;
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 13px;
  font-weight: 800;
  text-align: center;
}

.net-join-btn {
  white-space: nowrap;
  border-color: #22c55e !important;
}

.net-rooms-wrap {
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid #334155;
  border-radius: 8px;
  padding: 8px 10px;
  margin-bottom: 8px;
}

.net-rooms-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 700;
  color: #cbd5e1;
  margin-bottom: 6px;
}

.net-rooms-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 120px;
  overflow-y: auto;
}

.net-room-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: #1e293b;
  border: 1px solid #475569;
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 12px;
}

.net-empty {
  font-size: 12px;
  color: #94a3b8;
  padding: 6px 0;
}

.net-lobby-status {
  min-height: 18px;
  font-size: 12px;
  font-weight: 700;
  color: #facc15;
  margin-bottom: 6px;
}

.btn-arcade {
  cursor: pointer;
  border: 2.5px solid #facc15;
  border-radius: 10px;
  background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
  color: #fff;
  padding: 8px 10px;
  text-align: center;
  font-weight: 900;
  transition: transform 0.1s, box-shadow 0.15s;
  box-shadow: 0 4px 0 #854d0e, 0 6px 14px rgba(0, 0, 0, 0.6);
}

.btn-arcade:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 #854d0e;
}

.btn-arcade.primary {
  background: linear-gradient(180deg, #dc2626 0%, #991b1b 100%);
  border-color: #fef08a;
}

.btn-arcade .btn-title {
  display: block;
  font-size: clamp(12px, 1.8vw, 15px);
  letter-spacing: 0.4px;
}

.btn-arcade .btn-desc {
  display: block;
  font-size: clamp(9.5px, 1.15vw, 10.5px);
  font-weight: 500;
  color: #cbd5e1;
  margin-top: 2px;
  line-height: 1.25;
}

.title-footer-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
}

.pill-btn {
  cursor: pointer;
  background: rgba(30, 41, 59, 0.85);
  border: 2px solid #475569;
  color: #e2e8f0;
  border-radius: 999px;
  padding: 6px 13px;
  font-size: 12px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.pill-btn.active {
  border-color: #38bdf8;
  color: #38bdf8;
}

/* --- CHARACTER & STAGE SELECT --- */
#screen-select {
  justify-content: space-between;
  padding: 8px 14px;
  background: linear-gradient(180deg, #090d16 0%, #111827 100%);
}

.select-header {
  width: 100%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.select-header h2 {
  margin: 0;
  font-size: clamp(12px, 2.2vw, 22px);
  font-family: 'Arial Black', sans-serif;
  color: #facc15;
  text-shadow: 0 2px 0 #000;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
}

.select-body {
  width: 100%;
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.8fr) minmax(0, 0.95fr);
  gap: 8px;
  align-items: stretch;
  margin: 4px 0;
  overflow: hidden;
}

.fighter-preview {
  background: var(--panel);
  border: 2px solid #334155;
  border-radius: 12px;
  padding: 7px 9px;
  height: 100%;
  min-height: 0;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 4px;
  overflow-x: hidden;
  overflow-y: auto;
}

.fighter-preview.p1 { border-color: #38bdf8; }
.fighter-preview.p2 { border-color: #ef4444; }

.preview-top {
  display: flex;
  gap: 7px;
  align-items: center;
  min-width: 0;
}

.preview-top img {
  width: clamp(40px, 6.2vw, 64px);
  height: clamp(60px, 9.4vw, 96px);
  object-fit: cover;
  object-position: center top;
  border-radius: 6px;
  border: 2px solid #facc15;
  flex-shrink: 0;
}

.preview-meta {
  flex: 1;
  min-width: 0;
}

.preview-stage-btn {
  display: inline-block;
  margin-top: 3px;
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid rgba(250, 204, 21, 0.5);
  background: rgba(15, 23, 42, 0.9);
  color: #fde68a;
  font-size: clamp(8.5px, 1.05vw, 10px);
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
}

.preview-stage-btn.active {
  border-color: #22c55e;
  background: rgba(20, 83, 45, 0.55);
  color: #86efac;
}

.preview-stage-btn:disabled {
  cursor: default;
  opacity: 0.92;
}

.preview-meta h3 {
  margin: 0;
  font-size: clamp(13px, 1.9vw, 18px);
  color: #facc15;
}

.preview-meta .role {
  font-size: clamp(10px, 1.25vw, 12px);
  color: #94a3b8;
  font-weight: 700;
}

.stat-row {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  margin: 2px 0;
}

.stat-row span { width: 32px; font-weight: 700; color: #cbd5e1; }
.stat-bar {
  flex: 1;
  height: 6px;
  background: #1e293b;
  border-radius: 3px;
  overflow: hidden;
}
.stat-bar i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #facc15, #f97316);
}

.special-box {
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid #475569;
  border-radius: 8px;
  padding: 4px 6px;
  font-size: clamp(9.5px, 1.2vw, 11.5px);
}

.special-box strong { color: #fb923c; display: block; }
.quote-line {
  font-size: clamp(9.5px, 1.2vw, 11.5px);
  font-style: italic;
  color: #bae6fd;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.roster-panel {
  background: var(--panel);
  border: 2px solid #facc15;
  border-radius: 12px;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  container-type: size;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  box-shadow: inset 0 0 18px rgba(2, 6, 23, 0.7);
}

.roster-grid {
  display: grid;
  grid-template-columns: repeat(7, auto);
  grid-template-rows: repeat(3, auto);
  gap: 5px;
  place-content: center;
  place-items: center;
  padding: 6px 8px;
}

.char-card {
  position: relative;
  cursor: pointer;
  border-radius: 6px;
  overflow: hidden;
  border: 2px solid #334155;
  background: #0f172a;
  width: min(92px, calc((100cqw - 50px) / 7), calc((100cqh - 26px) / 3 * 0.66));
  aspect-ratio: 171 / 259;
  transition: transform 0.1s;
}

.char-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  display: block;
}

.char-card.sel-p1 {
  border-color: #38bdf8;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.85);
  transform: scale(1.03);
  z-index: 2;
}

.char-card.sel-p2 {
  border-color: #ef4444;
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.85);
  transform: scale(1.03);
  z-index: 2;
}

.char-card.sel-both {
  border-color: #facc15;
  box-shadow: 0 0 12px rgba(250, 204, 21, 0.9);
  transform: scale(1.03);
  z-index: 2;
}

.char-badge {
  position: absolute;
  bottom: 2px;
  padding: 1px 4px;
  font-size: 8.5px;
  font-weight: 900;
  border-radius: 4px;
  color: #fff;
}
.char-badge.b1 { left: 2px; background: #0284c7; }
.char-badge.b2 { right: 2px; background: #dc2626; }

.select-footer {
  width: 100%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: nowrap;
  padding-top: 2px;
}

.stage-picker {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(15, 23, 42, 0.9);
  border: 1.5px solid #475569;
  border-radius: 10px;
  padding: 4px 8px;
  max-width: 480px;
}

.stage-picker-label {
  font-size: clamp(10px, 1.3vw, 12px);
  font-weight: 900;
  color: #facc15;
  white-space: nowrap;
  flex-shrink: 0;
}

.stage-select {
  flex: 1;
  min-width: 0;
  cursor: pointer;
  background: #1e293b;
  border: 1.5px solid #64748b;
  color: #f8fafc;
  border-radius: 7px;
  padding: 4px 8px;
  font-size: clamp(11px, 1.4vw, 13px);
  font-weight: 800;
  outline: none;
}

.stage-select:focus {
  border-color: #facc15;
}

.stage-select:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.stage-rand-btn {
  padding: 4px 8px;
  font-size: 13px;
  line-height: 1;
  flex-shrink: 0;
  border-color: #facc15;
  color: #fde047;
}

.stage-arcade-hint {
  font-size: clamp(10.5px, 1.35vw, 12.5px);
  font-weight: 700;
  color: #bae6fd;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.start-fight-btn {
  cursor: pointer;
  padding: 7px 18px;
  border-radius: 10px;
  border: 3px solid #fef08a;
  background: linear-gradient(180deg, #ef4444 0%, #b91c1c 100%);
  color: #fff;
  font-family: 'Arial Black', sans-serif;
  font-size: clamp(13px, 2vw, 16px);
  box-shadow: 0 4px 0 #7f1d1d;
}

.start-fight-btn:active { transform: translateY(2px); }

/* --- ARCADE COMPANY ROUTE MAP (ISOMETRIC 20-DEPARTMENT CUTAWAY) --- */
#screen-arcade-map {
  justify-content: center;
  align-items: center;
  padding: clamp(4px, 1dvh, 10px) clamp(6px, 1.4vw, 14px);
  background: radial-gradient(circle at 50% 45%, #0f172a 0%, #030712 85%);
}

.arcade-map-board {
  position: relative;
  width: min(98vw, calc(96dvh * 16 / 9));
  aspect-ratio: 16 / 9;
  max-height: 96dvh;
  margin: auto;
  border-radius: 12px;
  border: 2.5px solid #475569;
  background: #090d16 url('assets/stages/arcade_map_bg.jpg?v=72') center / 100% 100% no-repeat;
  box-shadow: 0 12px 38px rgba(0, 0, 0, 0.85), inset 0 0 24px rgba(2, 6, 23, 0.55);
  overflow: hidden;
  user-select: none;
}

.arcade-map-hud {
  position: absolute;
  top: 1.4%;
  left: 1.4%;
  right: 1.4%;
  display: grid;
  grid-template-columns: 1fr 1.65fr 1fr;
  gap: clamp(6px, 1vw, 14px);
  align-items: stretch;
  z-index: 6;
  pointer-events: none;
}

.map-hud-p1,
.map-hud-center,
.map-hud-right {
  background: rgba(15, 23, 42, 0.92);
  border-radius: 8px;
  padding: clamp(3px, 0.6dvh, 7px) clamp(6px, 0.9vw, 11px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.7);
}

.map-hud-p1 {
  border: 2px solid #38bdf8;
  display: flex;
  align-items: center;
  gap: clamp(5px, 0.8vw, 9px);
}

.map-hud-p1 img {
  width: clamp(24px, 3.6vw, 42px);
  height: clamp(24px, 3.6vw, 42px);
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #ef4444;
  background: #1e293b;
  flex-shrink: 0;
}

.map-p1-info {
  flex: 1;
  min-width: 0;
}

.map-p1-name {
  font-size: clamp(8.5px, 1.05vw, 12.5px);
  font-weight: 900;
  color: #facc15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.map-p1-bar {
  margin-top: 3px;
  height: clamp(6px, 0.9dvh, 10px);
  background: #1e293b;
  border: 1px solid #64748b;
  border-radius: 4px;
  overflow: hidden;
}

.map-p1-bar i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #22c55e, #4ade80);
  transition: width 0.35s ease;
}

.map-hud-center {
  border: 2.5px solid #facc15;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.map-title {
  font-family: 'Arial Black', Impact, sans-serif;
  font-size: clamp(11px, 1.9vw, 22px);
  color: #facc15;
  letter-spacing: 1.5px;
  line-height: 1.05;
  text-shadow: 0 2px 0 #000;
}

.map-dest {
  margin-top: 2px;
  font-size: clamp(8px, 1.05vw, 12px);
  font-weight: 900;
  color: #f8fafc;
  letter-spacing: 0.4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.map-hud-right {
  border: 2px solid #facc15;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  gap: 2px;
  pointer-events: auto;
}

.map-score-line {
  font-size: clamp(9px, 1.1vw, 13px);
  font-weight: 900;
  color: #facc15;
  line-height: 1.1;
}

.map-goal-line {
  font-size: clamp(7.5px, 0.9vw, 10.5px);
  font-weight: 800;
  color: #e2e8f0;
  line-height: 1.1;
}

.map-go-btn {
  margin-top: 2px;
  padding: clamp(2px, 0.4dvh, 5px) clamp(8px, 1vw, 12px);
  font-size: clamp(8.5px, 1vw, 11.5px);
  border-width: 2px;
  border-radius: 6px;
}

.arcade-map-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2;
}

.arcade-map-nodes {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
}

.map-node {
  position: absolute;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  transition: transform 0.18s ease, filter 0.18s ease;
}

.map-node-medallion {
  position: relative;
  width: clamp(28px, 4.3vw, 54px);
  height: clamp(28px, 4.3vw, 54px);
  border-radius: 50%;
  border: 2.5px solid #38bdf8;
  background: radial-gradient(circle at 50% 35%, #1e293b 0%, #0f172a 100%);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.85), 0 0 8px rgba(56, 189, 248, 0.45);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.map-node-medallion img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  border-radius: 50%;
}

.map-node .node-stage {
  background: rgba(9, 13, 22, 0.92);
  border: 1px solid #475569;
  border-radius: 4px;
  padding: 1px clamp(4px, 0.5vw, 6px);
  font-size: clamp(6.5px, 0.78vw, 10px);
  font-weight: 900;
  color: #f8fafc;
  text-align: center;
  line-height: 1.15;
  white-space: nowrap;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.8);
}

/* Roulette flashing state (Street Fighter randomizer) */
.map-node.roulette-active {
  transform: translate(-50%, -50%) scale(1.24);
  z-index: 8;
}

.map-node.roulette-active .map-node-medallion {
  border-color: #fde047;
  box-shadow: 0 0 0 3px #f97316, 0 0 22px rgba(250, 204, 21, 0.98);
}

.map-node.roulette-active .node-stage {
  background: #facc15;
  color: #09090b;
  border-color: #fef08a;
}

/* Defeated opponent (K.O. stamp) */
.map-node.done {
  opacity: 0.88;
}

.map-node.done .map-node-medallion {
  border-color: #991b1b;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.85);
}

.map-node.done .map-node-medallion img {
  filter: grayscale(0.85) brightness(0.55);
}

.map-node-ko {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Arial Black', Impact, sans-serif;
  font-size: clamp(9px, 1.35vw, 16px);
  font-weight: 900;
  color: #fef2f2;
  text-shadow: 0 1px 3px #000, 0 0 6px #dc2626;
  background:
    linear-gradient(45deg, transparent 43%, rgba(220, 38, 38, 0.85) 44%, rgba(220, 38, 38, 0.85) 56%, transparent 57%),
    linear-gradient(-45deg, transparent 43%, rgba(220, 38, 38, 0.85) 44%, rgba(220, 38, 38, 0.85) 56%, transparent 57%);
  pointer-events: none;
}

/* Locked-on current opponent (★ NEXT FIGHT ★ / VS) */
.map-node.current {
  transform: translate(-50%, -50%) scale(1.22);
  z-index: 9;
}

.map-node.current .map-node-medallion {
  border: 3px solid #facc15;
  box-shadow: 0 0 0 3px #ea580c, 0 0 24px rgba(249, 115, 22, 0.95);
  animation: mapPulseRing 0.9s infinite alternate;
}

.map-node.current .node-stage {
  border-color: #facc15;
  color: #fef08a;
  background: rgba(23, 15, 10, 0.96);
}

.map-node-next-banner {
  position: absolute;
  top: -15px;
  left: 50%;
  transform: translateX(-50%);
  background: #09090b;
  border: 1.5px solid #facc15;
  border-radius: 4px;
  padding: 1px 5px;
  font-size: clamp(6px, 0.72vw, 9px);
  font-weight: 900;
  color: #facc15;
  white-space: nowrap;
  letter-spacing: 0.4px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.9);
  z-index: 4;
}

.map-node-vs-tag {
  position: absolute;
  bottom: 13px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(180deg, #ef4444 0%, #b91c1c 100%);
  border: 1.5px solid #fef08a;
  border-radius: 4px;
  padding: 0 4px;
  font-family: 'Arial Black', Impact, sans-serif;
  font-size: clamp(6.5px, 0.8vw, 10px);
  color: #fff;
  line-height: 1.1;
  text-shadow: 0 1px 2px #000;
  z-index: 4;
}

/* Final Boss Ron node */
.map-node.boss .map-node-medallion {
  width: clamp(34px, 5.2vw, 66px);
  height: clamp(34px, 5.2vw, 66px);
  border: 3px solid #facc15;
  box-shadow: 0 0 0 2.5px #a855f7, 0 0 18px rgba(168, 85, 247, 0.8);
}

.map-node.boss .node-stage {
  border-color: #facc15;
  color: #facc15;
}

@keyframes mapPulseRing {
  from {
    box-shadow: 0 0 0 2px #ea580c, 0 0 14px rgba(250, 204, 21, 0.8);
  }
  to {
    box-shadow: 0 0 0 5px #ef4444, 0 0 28px rgba(250, 204, 21, 1);
  }
}

.arcade-map-truck {
  position: absolute;
  width: clamp(28px, 4.2vw, 52px);
  height: clamp(21px, 3.1vw, 39px);
  transform: translate(-50%, -50%);
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.9));
  transition: left 1.2s cubic-bezier(0.35, 0, 0.2, 1), top 1.2s cubic-bezier(0.35, 0, 0.2, 1);
  z-index: 7;
  pointer-events: none;
}

.arcade-map-truck.flip-left svg {
  transform: scaleX(-1);
}

/* --- VS SCREEN --- */
#screen-vs {
  background: radial-gradient(circle at center, #7c2d12 0%, #090d16 75%);
  gap: 14px;
}

.vs-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(16px, 4vw, 48px);
  width: 92vw;
}

.vs-card {
  text-align: center;
  max-width: 240px;
}

.vs-card img {
  width: clamp(92px, 16vw, 150px);
  height: auto;
  border-radius: 10px;
  border: 4px solid #facc15;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8);
}

.vs-card h3 { margin: 6px 0 2px; color: #facc15; font-size: clamp(16px, 3vw, 24px); }
.vs-card p { margin: 0; font-size: clamp(11px, 1.5vw, 13px); color: #bae6fd; font-style: italic; }

.vs-bolt {
  font-family: 'Arial Black', Impact, sans-serif;
  font-size: clamp(40px, 8vw, 76px);
  font-style: italic;
  color: #facc15;
  text-shadow: 0 5px 0 #dc2626, 0 0 25px #f97316;
}

/* --- FIGHT SCREEN & CANVAS --- */
#screen-fight {
  padding: 0;
  background: #000;
}

#fight-stage-wrap {
  position: relative;
  width: min(100vw, calc(100dvh * 16 / 9));
  height: min(100dvh, calc(100vw * 9 / 16));
  display: flex;
  align-items: center;
  justify-content: center;
}

#game-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.fight-top-controls {
  position: absolute;
  top: 11.8%;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
  z-index: 15;
  opacity: 0.78;
}

.mini-icon-btn {
  cursor: pointer;
  background: rgba(15, 23, 42, 0.85);
  border: 1.5px solid #64748b;
  color: #fff;
  border-radius: 8px;
  padding: 3px 8px;
  font-size: 12px;
  font-weight: 700;
}

/* --- DOJO TEST MODE PANEL (SLEEK 1-LINE TOOLBAR BY DEFAULT) --- */
.dojo-panel {
  position: absolute;
  top: 16.2%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 25;
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  width: min(94%, 860px);
  padding: 3px 6px;
  border-radius: 9px;
  background: rgba(2, 6, 23, 0.68);
  backdrop-filter: blur(4px);
  border: 1px solid rgba(56, 189, 248, 0.45);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.42);
  pointer-events: auto;
}

.dojo-panel.visible {
  display: flex;
}

.dojo-panel.minimized {
  display: none !important;
}

.dojo-panel.collapsed .dojo-moves-row {
  display: none;
}

.dojo-row {
  display: flex;
  flex-wrap: nowrap;
  justify-content: flex-start;
  align-items: center;
  gap: 3px;
  width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.dojo-row::-webkit-scrollbar {
  display: none;
}

.dojo-btn,
.dojo-select {
  cursor: pointer;
  flex-shrink: 0;
  white-space: nowrap;
  background: rgba(15, 23, 42, 0.88);
  border: 1px solid #475569;
  color: #e2e8f0;
  border-radius: 5px;
  padding: 2px 6px;
  font-size: 10.5px;
  font-weight: 700;
  line-height: 1.15;
}

.dojo-select {
  max-width: 112px;
  text-overflow: ellipsis;
}

.dojo-btn:hover {
  border-color: #38bdf8;
  color: #fff;
}

.dojo-btn.active {
  background: #0284c7;
  border-color: #7dd3fc;
  color: #fff;
}

.dojo-btn.dojo-special {
  border-color: #f59e0b;
  color: #fde047;
}

/* --- MOBILE TOUCH CONTROLS --- */
.touch-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 20;
  display: none;
}

.touch-layer.visible {
  display: block;
}

.dpad-zone {
  position: absolute;
  bottom: max(12px, env(safe-area-inset-bottom, 12px));
  left: max(14px, env(safe-area-inset-left, 14px));
  width: clamp(116px, 18vw, 152px);
  height: clamp(116px, 18vw, 152px);
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.42);
  border: 3px solid rgba(255, 255, 255, 0.32);
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(2px);
}

.dpad-knob {
  width: 44%;
  height: 44%;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #f8fafc, #64748b);
  border: 2px solid #09090b;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.6);
  pointer-events: none;
}

.action-pad {
  position: absolute;
  bottom: max(12px, env(safe-area-inset-bottom, 12px));
  right: max(12px, env(safe-area-inset-right, 12px));
  width: clamp(176px, 26vw, 232px);
  height: clamp(146px, 22vw, 190px);
  pointer-events: none;
}

.arc-btn {
  position: absolute;
  pointer-events: auto;
  width: clamp(46px, 6.8vw, 58px);
  height: clamp(46px, 6.8vw, 58px);
  border-radius: 50%;
  border: 2.5px solid rgba(255, 255, 255, 0.82);
  color: #fff;
  font-weight: 900;
  font-size: clamp(8.5px, 1.05vw, 10.5px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1.05;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.55);
  opacity: 0.88;
  transition: transform 0.06s;
}

.arc-btn span.ico { font-size: clamp(14px, 2vw, 19px); }
.arc-btn.pressed { transform: scale(0.9); opacity: 1; filter: brightness(1.25); }

/* Sega Mega Drive 6-Button Slanted Layout (2 - 2 - 2 diagonal) */
/* Columna 1 (izquierda: arriba Superpuñetazo, abajo Puño) */
.btn-hpunch {
  left: 0%;
  top: 28%;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.94), rgba(29, 78, 216, 0.94));
  border-color: #93c5fd;
}
.btn-punch { left: 0%; top: 66%; background: rgba(37, 99, 235, 0.88); }

/* Columna 2 (centro: arriba Patada Aérea en picado, abajo Patada) */
.btn-divekick {
  left: 34%;
  top: 14%;
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.94), rgba(2, 132, 199, 0.94));
  border-color: #7dd3fc;
}
.btn-kick { left: 34%; top: 52%; background: rgba(220, 38, 38, 0.88); }

/* Columna 3 (derecha: arriba Magia/EX/Súper, abajo Agarre) */
.btn-special {
  left: 68%;
  top: 0%;
  background: linear-gradient(135deg, rgba(249, 115, 22, 0.92), rgba(220, 38, 38, 0.92));
  border-color: #fed7aa;
}
.btn-special.ex-ready,
.mini-act-btn.ex-ready {
  border-color: #fbbf24;
  box-shadow: 0 0 12px rgba(251, 146, 60, 0.85);
}
.btn-special.super-ready,
.mini-act-btn.super-ready {
  background: linear-gradient(135deg, rgba(250, 204, 21, 0.96), rgba(234, 88, 12, 0.96)) !important;
  border-color: #fef08a;
  box-shadow: 0 0 16px rgba(250, 204, 21, 0.95);
  color: #fff;
}
.btn-throw { left: 68%; top: 38%; background: rgba(168, 85, 247, 0.90); border-color: #e9d5ff; }

@keyframes pulseSuper {
  from { transform: scale(1); }
  to { transform: scale(1.09); }
}

/* 2P Split Touch Controls */
.touch-layer.mode-2p .dpad-zone {
  width: 98px;
  height: 98px;
  bottom: 10px;
  left: 8px;
}
.touch-layer.mode-2p .p1-mini-actions {
  position: absolute;
  bottom: 10px;
  left: 112px;
  display: grid;
  grid-auto-flow: column;
  grid-template-rows: repeat(2, 42px);
  gap: 5px;
  pointer-events: auto;
}
.touch-layer.mode-2p .p2-dpad {
  position: absolute;
  bottom: 10px;
  right: 150px;
  width: 98px;
  height: 98px;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.42);
  border: 3px solid rgba(239, 68, 68, 0.55);
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: center;
}
.touch-layer.mode-2p .p2-mini-actions {
  position: absolute;
  bottom: 10px;
  right: 8px;
  display: grid;
  grid-auto-flow: column;
  grid-template-rows: repeat(2, 42px);
  gap: 5px;
  pointer-events: auto;
}
.p1-mini-actions .mini-act-btn:nth-child(3),
.p1-mini-actions .mini-act-btn:nth-child(4),
.p2-mini-actions .mini-act-btn:nth-child(3),
.p2-mini-actions .mini-act-btn:nth-child(4) {
  transform: translateY(-6px);
}
.p1-mini-actions .mini-act-btn:nth-child(5),
.p1-mini-actions .mini-act-btn:nth-child(6),
.p2-mini-actions .mini-act-btn:nth-child(5),
.p2-mini-actions .mini-act-btn:nth-child(6) {
  transform: translateY(-12px);
}
.mini-act-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 2px solid #fff;
  color: #fff;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.9;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.5);
}

.pause-movelist-box {
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid #334155;
  border-radius: 8px;
  padding: 6px 10px;
  margin: 4px auto 6px;
  font-size: 11.5px;
  line-height: 1.42;
  color: #e2e8f0;
  text-align: left;
  max-width: 460px;
}
.pause-keybind-box {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin: 4px auto 6px;
  font-size: 11px;
}
.keybind-title {
  color: #94a3b8;
  font-weight: 800;
  margin-right: 2px;
}
.keybind-btn {
  cursor: pointer;
  background: #1e293b;
  border: 1px solid #475569;
  color: #f8fafc;
  border-radius: 6px;
  padding: 2px 6px;
  font-size: 11px;
  font-weight: 800;
}
.keybind-btn.listening {
  border-color: #facc15;
  background: #854d0e;
  color: #fef08a;
}

.audio-mixer-box {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 8px auto 10px;
  padding: 8px 12px;
  max-width: 340px;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.72);
  border: 1px solid #334155;
}
.mixer-row {
  display: grid;
  grid-template-columns: 78px 1fr 38px;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  color: #e2e8f0;
  text-align: left;
}
.mixer-row input[type="range"] {
  width: 100%;
  accent-color: #facc15;
  cursor: pointer;
}
.mixer-val {
  text-align: right;
  font-family: monospace;
  color: #fde047;
  font-size: 11px;
}

/* --- MODALS & RESULT --- */
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 23, 0.82);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 40;
  padding: 16px;
}

.modal-backdrop.open { display: flex; }

.modal-card {
  background: #0f172a;
  border: 3px solid #facc15;
  border-radius: 14px;
  padding: 16px 20px;
  width: min(92vw, 560px);
  max-height: 90dvh;
  overflow-y: auto;
  text-align: center;
}

.modal-card h2 { margin: 0 0 10px; color: #facc15; font-family: 'Arial Black', sans-serif; }

.result-grid {
  display: flex;
  gap: 14px;
  align-items: center;
  justify-content: center;
  margin: 10px 0;
}

.result-grid img {
  width: 96px;
  border-radius: 8px;
  border: 3px solid #facc15;
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 12px;
}

/* --- ARCADE ENDING --- */
#screen-ending {
  background: #050811;
  overflow: hidden;
}

#screen-ending.active {
  animation: endingScreenFadeIn 0.55s ease-out;
}

@keyframes endingScreenFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.ending-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  filter: blur(8px) brightness(0.32) saturate(1.2);
  transform: scale(1.08);
  z-index: 0;
}

.ending-wrap {
  position: relative;
  z-index: 1;
  width: min(95vw, 920px);
  max-height: 96dvh;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ending-gallery-bar {
  background: rgba(15, 23, 42, 0.94);
  border: 2px solid #38bdf8;
  border-radius: 10px;
  padding: 6px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.7);
}

.ending-gallery-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  flex-wrap: wrap;
}

.ending-gallery-badge {
  font-size: 11px;
  font-weight: 900;
  color: #38bdf8;
  letter-spacing: 0.8px;
}

.ending-nav-btn {
  padding: 4px 10px;
  font-size: 11px;
}

.ending-gallery-heads {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: thin;
}

.ending-head-btn {
  cursor: pointer;
  flex: 0 0 auto;
  width: clamp(26px, 3.3vw, 34px);
  height: clamp(26px, 3.3vw, 34px);
  border-radius: 50%;
  border: 2px solid #334155;
  background: #0f172a;
  padding: 0;
  overflow: hidden;
  transition: transform 0.15s, border-color 0.15s;
}

.ending-head-btn img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  display: block;
}

.ending-head-btn.active {
  border-color: #facc15;
  box-shadow: 0 0 10px rgba(250, 204, 21, 0.9);
  transform: scale(1.12);
}

.ending-stage-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: rgba(15, 23, 42, 0.94);
  border: 2.5px solid #facc15;
  border-radius: 12px;
  padding: 6px 8px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.8);
  flex: 1;
  min-height: 0;
}

.ending-canvas-wrap {
  position: relative;
  width: 100%;
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 8px;
  border: 2px solid #334155;
  background: #020617;
}

#ending-canvas {
  display: block;
  width: 100%;
  height: auto;
  max-height: 58dvh;
  aspect-ratio: 16 / 9;
  object-fit: contain;
}

.ending-subtitle-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 4px 6px;
  background: rgba(9, 13, 22, 0.9);
  border-radius: 8px;
  border: 1px solid #334155;
  flex-wrap: wrap;
}

.ending-subtitle-texts {
  flex: 1;
  min-width: 200px;
}

.ending-headline {
  margin: 0;
  font-family: 'Arial Black', Impact, sans-serif;
  font-size: clamp(12px, 1.8vw, 17px);
  color: #facc15;
  letter-spacing: 0.6px;
}

.ending-text {
  margin: 2px 0 0;
  font-size: clamp(11px, 1.45vw, 14px);
  line-height: 1.35;
  color: #f8fafc;
}

.ending-subtitle-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

/* --- RANKING / HIGH SCORES --- */
.ranking-card {
  max-width: 560px;
  width: 94vw;
}

.ranking-sub {
  text-align: center;
  font-size: 12px;
  color: #94a3b8;
  margin-bottom: 8px;
}

.ranking-list {
  max-height: 58dvh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-right: 2px;
}

.ranking-empty {
  text-align: center;
  color: #cbd5e1;
  font-size: 13px;
  padding: 14px 0;
}

.ranking-row {
  display: grid;
  grid-template-columns: 34px 32px 1fr auto;
  align-items: center;
  gap: 8px;
  background: rgba(15, 23, 42, 0.92);
  border: 1.5px solid #334155;
  border-radius: 8px;
  padding: 4px 8px;
}

.ranking-row.top1 { border-color: #facc15; box-shadow: 0 0 10px rgba(250, 204, 21, 0.45); }
.ranking-row.top2 { border-color: #cbd5e1; }
.ranking-row.top3 { border-color: #d97706; }
.ranking-row.mine { background: rgba(30, 58, 138, 0.85); border-color: #38bdf8; }

.ranking-pos {
  font-family: 'Arial Black', Impact, sans-serif;
  font-size: 15px;
  color: #facc15;
  text-align: center;
}

.ranking-row img {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center top;
  background: #1e293b;
  border: 1.5px solid #475569;
}

.ranking-name {
  min-width: 0;
  font-weight: 900;
  font-size: 13.5px;
  color: #f8fafc;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ranking-name small {
  display: block;
  font-weight: 700;
  font-size: 10.5px;
  color: #94a3b8;
}

.ranking-score {
  font-family: 'Arial Black', Impact, sans-serif;
  font-size: 14px;
  color: #fde047;
  text-align: right;
}

.save-score-points {
  text-align: center;
  font-family: 'Arial Black', Impact, sans-serif;
  font-size: 30px;
  color: #fde047;
  text-shadow: 0 2px 0 #000;
}

.save-score-meta {
  text-align: center;
  font-size: 12.5px;
  color: #bae6fd;
  margin-bottom: 10px;
}

.save-score-label {
  display: block;
  font-size: 12.5px;
  font-weight: 800;
  color: #e2e8f0;
  margin-bottom: 5px;
}

.save-score-input {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  font-size: 18px; /* >=16px avoids iOS auto-zoom */
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #fff;
  background: #0f172a;
  border: 2px solid #38bdf8;
  border-radius: 8px;
  outline: none;
}

.save-score-input:focus {
  border-color: #facc15;
}

.save-score-status {
  min-height: 18px;
  margin-top: 6px;
  font-size: 12.5px;
  font-weight: 800;
  color: #fca5a5;
  text-align: center;
}

/* --- PORTRAIT ORIENTATION WARNING --- */
#portrait-warning {
  position: fixed;
  inset: 0;
  background: #050811;
  z-index: 999;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
  gap: 14px;
}

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

/* --- APP INSTALL / APK DOWNLOAD MODAL --- */
.install-section {
  font-size: 13px;
  line-height: 1.5;
  color: #e2e8f0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.install-warning-box {
  background: rgba(245, 158, 11, 0.16);
  border: 1.5px solid #f59e0b;
  border-radius: 10px;
  padding: 9px 11px;
  color: #fef3c7;
  font-size: 12.5px;
}

.apk-download-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  text-decoration: none;
  background: linear-gradient(180deg, #16a34a 0%, #15803d 100%);
  border: 2.5px solid #fde047;
  border-radius: 12px;
  padding: 12px 14px;
  color: #ffffff;
  font-weight: 900;
  font-size: 15px;
  text-align: center;
  box-shadow: 0 4px 0 #14532d, 0 8px 18px rgba(0, 0, 0, 0.5);
  transition: transform 0.1s;
}

.apk-download-btn:active {
  transform: translateY(2px);
}

.apk-download-btn span {
  font-size: 11px;
  font-weight: 600;
  color: #dcfce7;
}

.install-status-text {
  margin: 0;
  min-height: 16px;
  font-size: 12px;
  font-weight: 700;
  color: #86efac;
  text-align: center;
}

.install-steps {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.install-step-box {
  background: rgba(15, 23, 42, 0.92);
  border-radius: 10px;
  padding: 9px 11px;
  border: 1.5px solid #475569;
}

.install-step-box.blue {
  border-color: #38bdf8;
}

.install-step-box.gold {
  border-color: #facc15;
}

.install-secondary-box {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: center;
  padding-top: 4px;
  border-top: 1px solid rgba(148, 163, 184, 0.25);
}

.install-hint {
  width: 100%;
  font-size: 11.5px;
  color: #94a3b8;
  text-align: center;
}

.result-name-gate {
  margin-top: 8px;
  padding: 10px 12px;
  background: rgba(15, 23, 42, 0.92);
  border: 2px solid #facc15;
  border-radius: 10px;
  text-align: left;
}

.result-name-gate .save-score-label {
  color: #fde047;
  margin-bottom: 6px;
}

.result-name-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.result-name-row .save-score-input {
  flex: 1;
  min-width: 0;
  padding: 8px 10px;
  font-size: 16px;
}

.result-name-row .start-fight-btn {
  flex-shrink: 0;
  padding: 8px 14px;
  font-size: 14px;
  white-space: nowrap;
}

#result-actions .start-fight-btn:disabled,
.result-name-row .start-fight-btn:disabled {
  opacity: 0.48;
  cursor: not-allowed;
  filter: grayscale(0.4);
  box-shadow: none;
  transform: none;
}

@media (max-height: 480px) {
  #modal-result .modal-card {
    padding: 10px 14px;
  }
  #modal-result .modal-card h2 {
    margin: 0 0 6px;
    font-size: 18px;
  }
  #modal-result .result-grid {
    gap: 10px;
    margin: 4px 0;
  }
  #modal-result .result-grid img {
    width: 68px;
  }
  #modal-result .result-name-gate {
    padding: 7px 10px;
    margin-top: 6px;
  }
  #modal-result .modal-actions {
    margin-top: 8px;
    gap: 8px;
  }
}

.ota-banner {
  position: fixed;
  top: max(8px, env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  z-index: 35;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: min(92vw, 460px);
  padding: 7px 14px;
  border-radius: 999px;
  border: 2px solid #facc15;
  background: rgba(15, 23, 42, 0.94);
  color: #fef08a;
  font-size: 12.5px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.55);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ota-banner.apk {
  border-color: #22c55e;
  color: #bbf7d0;
}

/* --- DESISTIMIENTO DE DERECHOS / LEGAL DISCLAIMER --- */
.title-legal-link {
  position: absolute;
  right: max(14px, env(safe-area-inset-right));
  bottom: max(8px, env(safe-area-inset-bottom));
  z-index: 6;
  background: rgba(2, 6, 23, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 6px;
  padding: 4px 10px;
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.2px;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
  transition: opacity 0.15s ease, border-color 0.15s ease;
}

.title-legal-link:hover,
.title-legal-link:active {
  border-color: #ffffff;
  background: rgba(15, 23, 42, 0.85);
}

@media (max-height: 460px) {
  #screen-title {
    gap: 7px;
    padding-bottom: calc(env(safe-area-inset-bottom, 6px) + 28px);
  }
  .title-legal-link {
    font-size: 10px;
    padding: 3px 8px;
    bottom: max(5px, env(safe-area-inset-bottom));
  }
}

.legal-card {
  width: min(94vw, 620px) !important;
  max-height: 88dvh;
  text-align: left !important;
}

.legal-card h2 {
  text-align: center;
  font-size: clamp(15px, 2.5vw, 19px);
  margin-bottom: 10px;
}

.legal-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 12.5px;
  line-height: 1.48;
  color: #e2e8f0;
}

.legal-section {
  background: rgba(30, 41, 59, 0.55);
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 8px;
  padding: 9px 11px;
}

.legal-section h4 {
  margin: 0 0 4px;
  color: #fef08a;
  font-size: 13px;
}

.legal-section p {
  margin: 0 0 6px;
}

.legal-section p:last-child {
  margin-bottom: 0;
}

/* --- ARCADE INTRO SHORT FILM --- */
#screen-arcade-intro {
  background: #000;
  padding: 0;
  overflow: hidden;
  z-index: 30;
  opacity: 1;
  transition: opacity 0.26s ease;
}

#screen-arcade-intro.active {
  animation: arcadeIntroFadeIn 0.36s ease-out;
}

#screen-arcade-intro.fading-out {
  opacity: 0;
}

@keyframes arcadeIntroFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.arcade-intro-video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
  display: block;
}

.arcade-intro-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding:
    max(12px, env(safe-area-inset-top, 12px))
    max(16px, env(safe-area-inset-right, 16px))
    max(16px, env(safe-area-inset-bottom, 16px))
    max(16px, env(safe-area-inset-left, 16px));
}

.arcade-intro-badge {
  align-self: flex-start;
  background: rgba(5, 8, 17, 0.62);
  border: 1px solid rgba(250, 204, 21, 0.45);
  color: #fde047;
  font-family: 'Arial Black', Impact, sans-serif;
  font-size: clamp(11px, 1.4vw, 14px);
  letter-spacing: 0.9px;
  padding: 5px 12px;
  border-radius: 999px;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.85);
}

.arcade-intro-skip-btn {
  pointer-events: auto;
  align-self: flex-end;
  min-height: 44px;
  padding: 9px 20px;
  border-radius: 999px;
  border: 2px solid #facc15;
  background: rgba(9, 13, 22, 0.78);
  color: #fef08a;
  font-family: 'Arial Black', Impact, sans-serif;
  font-size: clamp(12px, 1.5vw, 15px);
  letter-spacing: 0.8px;
  cursor: pointer;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.65);
  transition: transform 0.14s ease, background 0.14s ease, color 0.14s ease;
}

.arcade-intro-skip-btn:hover,
.arcade-intro-skip-btn:active {
  background: #facc15;
  color: #050811;
  transform: scale(1.04);
}

.arcade-intro-progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 4px;
  background: rgba(255, 255, 255, 0.14);
  pointer-events: none;
}

.arcade-intro-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #f97316, #facc15);
  transition: width 0.12s linear;
}

.title-bottom-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

.title-version-badge {
  background: rgba(15, 23, 42, 0.72);
  border: 1px solid rgba(148, 163, 184, 0.35);
  color: #94a3b8;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.4px;
  padding: 3px 10px;
  border-radius: 999px;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.title-version-badge:hover,
.title-version-badge:active {
  border-color: #facc15;
  color: #fde047;
}
