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

body, html {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #070810;
  font-family: 'Segoe UI', Impact, system-ui, -apple-system, sans-serif;
  color: #ffffff;
}

#canvas-container {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 1;
}

.hidden {
  display: none !important;
}

/* ==========================================
   PER-VIEWPORT FX & SPLIT SCREEN
   ========================================== */
#viewport-fx-container {
  position: fixed;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  display: flex;
  flex-direction: row;
}

.vp-fx {
  position: relative;
  flex: 1;
  height: 100%;
  overflow: hidden;
}

#split-divider {
  width: 4px;
  height: 100%;
  background: linear-gradient(180deg, #00f0ff, #ff00aa, #ffe600);
  box-shadow: 0 0 18px rgba(0, 240, 255, 0.9);
  z-index: 6;
}

/* Speedlines when dashing */
.speedlines {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.12s ease;
  background: repeating-conic-gradient(
    from 0deg at 50% 50%,
    rgba(255, 255, 255, 0.14) 0deg 1.5deg,
    transparent 1.5deg 7deg
  );
  mix-blend-mode: screen;
}

.vp-fx.dashing .speedlines {
  opacity: 1;
  animation: spinLines 0.25s linear infinite;
}

@keyframes spinLines {
  from { transform: scale(1.05) rotate(0deg); }
  to { transform: scale(1.15) rotate(5deg); }
}

/* Michi.png Deep-Fried Meme Overlay */
.deep-fried-overlay {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 45% 42%, rgba(255, 0, 0, 0.85) 0%, transparent 12%),
    radial-gradient(circle at 55% 42%, rgba(255, 30, 0, 0.85) 0%, transparent 12%),
    linear-gradient(135deg, rgba(255, 90, 0, 0.38), rgba(255, 0, 80, 0.42));
  mix-blend-mode: hard-light;
  transition: opacity 0.15s ease;
}

.vp-fx.deep-fried .deep-fried-overlay {
  opacity: 1;
  animation: deepFryFlicker 0.08s infinite alternate;
}

@keyframes deepFryFlicker {
  0% { filter: contrast(300%) saturate(800%) hue-rotate(-10deg); transform: scale(1.01); }
  100% { filter: contrast(500%) saturate(1200%) hue-rotate(15deg); transform: scale(0.99); }
}

/* La Inamovible Celestial Overlay */
.celestial-overlay {
  position: absolute;
  inset: 0;
  opacity: 0;
  background: radial-gradient(circle at 50% 50%, rgba(255, 230, 120, 0.25), rgba(10, 5, 25, 0.78));
  box-shadow: inset 0 0 90px rgba(255, 215, 0, 0.75);
  transition: opacity 0.2s ease;
}

.vp-fx.celestial .celestial-overlay {
  opacity: 1;
}

/* Ape-X Cyberpunk 67x5 Overlay */
.cyber-overlay {
  position: absolute;
  inset: 0;
  opacity: 0;
  background:
    repeating-linear-gradient(0deg, rgba(0, 255, 255, 0.12) 0px, rgba(255, 0, 220, 0.12) 2px, transparent 2px, transparent 6px);
  box-shadow: inset 0 0 70px rgba(0, 255, 255, 0.65), inset 0 0 120px rgba(255, 0, 180, 0.55);
  transition: opacity 0.15s ease;
}

.vp-fx.cyber-storm .cyber-overlay {
  opacity: 1;
}

/* Lock-on Reticle */
.lockon-reticle {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 66px;
  height: 66px;
  transform: translate(-50%, -50%);
  pointer-events: none;
  opacity: 0.85;
}

.reticle-ring {
  width: 100%;
  height: 100%;
  border: 2px dashed #00f0ff;
  border-radius: 50%;
  box-shadow: 0 0 12px rgba(0, 240, 255, 0.6);
  animation: rotateReticle 4s linear infinite;
}

.reticle-dist {
  position: absolute;
  bottom: -20px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 11px;
  font-weight: 800;
  color: #00f0ff;
  text-shadow: 0 0 6px #000;
  background: rgba(0, 10, 24, 0.75);
  padding: 1px 6px;
  border-radius: 4px;
}

@keyframes rotateReticle {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Floating Status Toast per Viewport */
.status-toast {
  position: absolute;
  bottom: 18%;
  left: 50%;
  transform: translateX(-50%);
  font-size: 22px;
  font-weight: 900;
  font-style: italic;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: #ffe600;
  text-shadow: 0 0 12px #ff0066, 2px 2px 0 #000;
  opacity: 0;
  transition: opacity 0.15s ease, transform 0.15s ease;
  text-align: center;
  white-space: nowrap;
}

.status-toast.visible {
  opacity: 1;
  transform: translateX(-50%) scale(1.08);
}

/* ==========================================
   COMBAT HUD
   ========================================== */
#combat-hud {
  position: fixed;
  inset: 0;
  z-index: 10;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 14px 20px;
}

.hud-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
}

.hud-top.single-hud {
  justify-content: space-between;
}

.hud-top.single-hud #hud-card-p1 {
  width: 52%;
  max-width: 640px;
}

.hud-top.single-hud .hud-center {
  align-items: flex-end;
}

.fighter-hud {
  position: relative;
  width: 42%;
  max-width: 540px;
  background: linear-gradient(135deg, rgba(10, 14, 28, 0.86), rgba(20, 24, 45, 0.72));
  border: 2px solid rgba(0, 240, 255, 0.45);
  border-radius: 12px;
  padding: 10px 14px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(6px);
}

.p2-hud {
  border-color: rgba(255, 60, 140, 0.5);
}

.fighter-hud.sparking-active {
  border-color: #ffe600;
  box-shadow: 0 0 28px rgba(255, 230, 0, 0.8), inset 0 0 18px rgba(255, 0, 128, 0.45);
  animation: hudPulse 0.4s infinite alternate;
}

@keyframes hudPulse {
  from { transform: scale(1); }
  to { transform: scale(1.012); }
}

.hud-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.portrait-box {
  width: 46px;
  height: 46px;
  border-radius: 10px;
  background: radial-gradient(circle, #2a3560, #0d1124);
  border: 2px solid #00f0ff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  flex-shrink: 0;
  box-shadow: 0 0 12px rgba(0, 240, 255, 0.45);
  overflow: hidden;
}

.portrait-box img,
.char-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.p2-hud .portrait-box {
  border-color: #ff3c8c;
  box-shadow: 0 0 12px rgba(255, 60, 140, 0.45);
}

.name-block {
  flex: 1;
}

.right-align {
  text-align: right;
}

.fighter-tag {
  font-size: 11px;
  font-weight: 800;
  color: #88aaff;
  letter-spacing: 1px;
}

.sparking-badge {
  background: linear-gradient(90deg, #ff0055, #ffe600);
  color: #000;
  font-weight: 900;
  padding: 1px 6px;
  border-radius: 4px;
  margin-left: 5px;
  font-size: 10px;
  animation: badgeFlash 0.25s infinite alternate;
}

@keyframes badgeFlash {
  from { filter: brightness(1); }
  to { filter: brightness(1.4); }
}

.fighter-name {
  font-size: 18px;
  font-weight: 900;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: #ffffff;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.9);
}

.hp-Readout {
  font-size: 13px;
  font-weight: 900;
  color: #7fffaf;
  font-variant-numeric: tabular-nums;
}

/* Health Bar */
.hp-bar-outer {
  position: relative;
  height: 16px;
  background: rgba(0, 0, 0, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 6px;
  overflow: hidden;
  transform: skewX(-14deg);
  margin-bottom: 8px;
}

.hp-bar-damage {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 100%;
  background: #ff2a4b;
  transition: width 0.55s ease-out;
}

.hp-bar-fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #00e676, #aeea00);
  box-shadow: 0 0 10px rgba(0, 230, 118, 0.7);
  transition: width 0.1s linear;
}

.hp-bar-outer.reverse .hp-bar-damage,
.hp-bar-outer.reverse .hp-bar-fill {
  left: auto;
  right: 0;
}

/* Double Aura Bars */
.aura-bars-wrapper {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.aura-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.reverse-row {
  flex-direction: row-reverse;
}

.aura-label {
  font-size: 10px;
  font-weight: 900;
  width: 96px;
  letter-spacing: 0.5px;
  color: #c2d6ff;
}

.reverse-row .aura-label {
  text-align: right;
}

.aura-bar-outer {
  flex: 1;
  height: 10px;
  background: rgba(0, 0, 0, 0.8);
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  overflow: hidden;
  transform: skewX(-14deg);
  position: relative;
}

.aura-bar-fill {
  height: 100%;
  width: 0%;
  transition: width 0.08s linear;
}

.basic-aura .aura-bar-fill {
  background: linear-gradient(90deg, #00b4ff, #00ffcc);
  box-shadow: 0 0 10px #00f0ff;
}

.ult-aura .aura-bar-fill {
  background: linear-gradient(90deg, #ff00aa, #ffe600, #ff3300);
  box-shadow: 0 0 14px #ff00aa;
}

.aura-bar-outer.reverse .aura-bar-fill {
  margin-left: auto;
}

.moves-hint {
  margin-top: 6px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 11px;
  color: #b5c6e8;
}

.moves-hint.right-align {
  justify-content: flex-end;
}

.ult-hint {
  color: #ffe600;
  opacity: 0.35;
}

.ult-hint.ready {
  opacity: 1;
  text-shadow: 0 0 8px #ff0055;
  animation: badgeFlash 0.3s infinite alternate;
}

/* Combo Counter */
.combo-box {
  position: absolute;
  bottom: -66px;
  left: 12px;
  background: linear-gradient(135deg, rgba(255, 0, 100, 0.88), rgba(255, 140, 0, 0.88));
  padding: 6px 14px;
  border-radius: 8px;
  transform: skewX(-10deg);
  border: 2px solid #ffe600;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.6);
}

.combo-box.right-combo {
  left: auto;
  right: 12px;
}

.combo-num {
  font-size: 28px;
  font-weight: 900;
  line-height: 1;
  color: #fff;
  text-shadow: 2px 2px 0 #000;
}

.combo-lbl {
  font-size: 10px;
  font-weight: 900;
  color: #ffe600;
}

/* Center HUD */
.hud-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  pointer-events: auto;
}

.vs-emblem {
  font-size: 16px;
  font-weight: 900;
  text-align: center;
  line-height: 1.05;
  padding: 6px 12px;
  border-radius: 10px;
  background: linear-gradient(135deg, #ff0066, #7928ca);
  border: 2px solid #ffe600;
  box-shadow: 0 0 18px rgba(255, 0, 102, 0.7);
}

.destruction-counter {
  font-size: 11px;
  font-weight: 800;
  background: rgba(0, 0, 0, 0.75);
  padding: 3px 9px;
  border-radius: 99px;
  border: 1px solid rgba(255, 165, 0, 0.5);
  color: #ffbb55;
}

.hud-mini-btn {
  background: rgba(15, 22, 42, 0.85);
  color: #fff;
  border: 1px solid #00f0ff;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.15s;
}

.hud-mini-btn:hover {
  background: #00f0ff;
  color: #000;
}

/* ==========================================
   CINEMATIC CUT-IN BANNER
   ========================================== */
#cinematic-banner {
  position: fixed;
  top: 36%;
  left: 0;
  width: 100vw;
  z-index: 25;
  pointer-events: none;
  animation: bannerSlideIn 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.banner-slash {
  background: linear-gradient(90deg, rgba(0,0,0,0.95) 0%, rgba(255,0,100,0.92) 35%, rgba(255,215,0,0.95) 100%);
  border-top: 4px solid #fff;
  border-bottom: 4px solid #00f0ff;
  padding: 18px 8vw;
  transform: skewY(-3.5deg);
  box-shadow: 0 0 50px rgba(255, 0, 100, 0.9);
}

.banner-char {
  font-size: 18px;
  font-weight: 900;
  color: #00f0ff;
  letter-spacing: 3px;
  text-transform: uppercase;
  text-shadow: 2px 2px 0 #000;
}

.banner-move {
  font-size: 40px;
  font-weight: 900;
  font-style: italic;
  color: #ffffff;
  text-transform: uppercase;
  text-shadow: 0 0 18px #000, 4px 4px 0 #000;
}

@keyframes bannerSlideIn {
  from { transform: translateX(-100%) scaleY(0.4); opacity: 0; }
  to { transform: translateX(0) scaleY(1); opacity: 1; }
}

/* ==========================================
   MAIN MENU & CHARACTER SELECT
   ========================================== */
.menu-overlay {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: radial-gradient(circle at 50% 20%, rgba(22, 16, 52, 0.88), rgba(5, 6, 14, 0.96));
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  overflow-y: auto;
}

.menu-container {
  width: 100%;
  max-width: 1180px;
  background: rgba(12, 16, 32, 0.92);
  border: 2px solid rgba(0, 240, 255, 0.4);
  border-radius: 18px;
  padding: 20px 24px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.85), 0 0 35px rgba(0, 240, 255, 0.2);
}

.game-header {
  text-align: center;
  margin-bottom: 14px;
}

.subtitle-pill {
  display: inline-block;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 2px;
  padding: 3px 12px;
  border-radius: 99px;
  background: linear-gradient(90deg, #00f0ff, #ff00aa);
  color: #000;
  margin-bottom: 4px;
}

.game-title {
  font-size: 38px;
  font-weight: 900;
  font-style: italic;
  letter-spacing: 2px;
  color: #ffe600;
  text-shadow: 0 0 20px rgba(255, 0, 128, 0.8), 3px 3px 0 #000;
}

.game-title span {
  display: block;
  font-size: 15px;
  color: #ffffff;
  letter-spacing: 4px;
  margin-top: 2px;
}

/* Mode Bar */
.mode-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 18px;
  margin-bottom: 16px;
  padding: 10px 14px;
  background: rgba(0, 0, 0, 0.45);
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

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

.group-label {
  font-size: 12px;
  font-weight: 900;
  color: #9ab4e8;
}

.mode-btn, .diff-btn {
  background: rgba(25, 34, 64, 0.85);
  color: #d6e4ff;
  border: 1px solid rgba(0, 240, 255, 0.35);
  padding: 7px 14px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.15s ease;
}

.mode-btn:hover, .diff-btn:hover {
  border-color: #00f0ff;
  transform: translateY(-1px);
}

.mode-btn.active, .diff-btn.active {
  background: linear-gradient(135deg, #00f0ff, #0077ff);
  color: #000;
  border-color: #fff;
  box-shadow: 0 0 14px rgba(0, 240, 255, 0.65);
}

/* Roster Selection */
.roster-selection {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-bottom: 14px;
}

.player-select-col {
  background: rgba(6, 9, 20, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  padding: 12px;
}

.col-title {
  font-size: 15px;
  font-weight: 900;
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.col-title small {
  font-size: 12px;
  color: #ffe600;
}

.p1-color { color: #00f0ff; }
.p2-color { color: #ff3c8c; }

.char-cards {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.char-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(20, 26, 48, 0.78);
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
}

.char-card:hover {
  background: rgba(32, 42, 74, 0.92);
  transform: translateX(3px);
}

#p1-char-cards .char-card.selected {
  border-color: #00f0ff;
  background: linear-gradient(135deg, rgba(0, 240, 255, 0.18), rgba(20, 26, 48, 0.95));
  box-shadow: 0 0 16px rgba(0, 240, 255, 0.35);
}

#p2-char-cards .char-card.selected {
  border-color: #ff3c8c;
  background: linear-gradient(135deg, rgba(255, 60, 140, 0.18), rgba(20, 26, 48, 0.95));
  box-shadow: 0 0 16px rgba(255, 60, 140, 0.35);
}

.char-icon {
  font-size: 32px;
  width: 58px;
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 10px;
  flex-shrink: 0;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.char-icon img,
.portrait-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.char-info h3 {
  font-size: 14px;
  font-weight: 900;
  color: #fff;
  margin-bottom: 3px;
}

.char-info p {
  font-size: 11.5px;
  color: #b4c5e4;
  line-height: 1.35;
  margin-bottom: 4px;
}

.ult-tag {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 800;
  color: #ffe600;
  background: rgba(255, 0, 100, 0.25);
  padding: 2px 7px;
  border-radius: 4px;
}

/* Controls Reference */
.controls-panel {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(0, 240, 255, 0.25);
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 14px;
}

.controls-col h4 {
  font-size: 12px;
  color: #ffe600;
  margin-bottom: 6px;
}

.controls-col ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11.5px;
  color: #d0deff;
}

.controls-col small {
  display: block;
  color: #88a4d4;
  font-size: 10.5px;
  margin-top: 1px;
}

kbd {
  display: inline-block;
  padding: 1px 5px;
  font-size: 10.5px;
  font-weight: 800;
  color: #00f0ff;
  background: #141c34;
  border: 1px solid #00f0ff;
  border-radius: 4px;
  margin: 0 1px;
}

.start-row {
  text-align: center;
}

.btn-start {
  background: linear-gradient(90deg, #ff0066, #ff9900, #ffe600);
  color: #000;
  font-size: 18px;
  font-weight: 900;
  letter-spacing: 1px;
  padding: 12px 36px;
  border: 2px solid #fff;
  border-radius: 12px;
  cursor: pointer;
  box-shadow: 0 0 28px rgba(255, 0, 102, 0.8);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn-start:hover {
  transform: scale(1.04);
  box-shadow: 0 0 42px rgba(255, 230, 0, 0.95);
}

/* Result Modal */
.result-card {
  background: rgba(12, 16, 34, 0.96);
  border: 3px solid #ffe600;
  border-radius: 18px;
  padding: 32px 44px;
  text-align: center;
  max-width: 560px;
  box-shadow: 0 0 60px rgba(255, 230, 0, 0.45);
}

.result-subtitle {
  font-size: 14px;
  font-weight: 900;
  color: #00f0ff;
  letter-spacing: 2px;
  margin-bottom: 6px;
}

.result-title {
  font-size: 36px;
  font-weight: 900;
  color: #ffe600;
  text-shadow: 0 0 18px #ff0066;
  margin-bottom: 10px;
}

.result-desc {
  font-size: 14px;
  color: #c6d6f5;
  margin-bottom: 24px;
}

.result-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
}

/* ==========================================
   SMASH BROS ULTIMATE STAGE SELECT SCREEN
   ========================================== */
.stage-select-container {
  width: 100%;
  max-width: 1240px;
  background: radial-gradient(circle at 60% 30%, rgba(20, 24, 48, 0.95), rgba(8, 10, 22, 0.98));
  border: 2px solid rgba(255, 230, 0, 0.5);
  border-radius: 20px;
  padding: 24px 28px;
  box-shadow: 0 25px 70px rgba(0, 0, 0, 0.9), 0 0 45px rgba(255, 215, 0, 0.25);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.stage-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid rgba(255, 255, 255, 0.12);
  padding-bottom: 12px;
}

.stage-main-title {
  font-size: 28px;
  font-weight: 900;
  font-style: italic;
  letter-spacing: 2px;
  color: #ffe600;
  text-shadow: 0 0 16px rgba(255, 0, 102, 0.7), 2px 2px 0 #000;
}

.matchup-pill {
  font-size: 13px;
  font-weight: 900;
  color: #00f0ff;
  background: rgba(0, 240, 255, 0.12);
  border: 1px solid #00f0ff;
  border-radius: 99px;
  padding: 6px 16px;
  text-shadow: 0 0 10px rgba(0, 240, 255, 0.6);
}

.smash-stage-layout {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 24px;
  align-items: start;
}

/* LEFT: Big Stage Preview */
.stage-preview-pane {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.stage-preview-box {
  background: rgba(10, 14, 28, 0.85);
  border: 2px solid rgba(0, 240, 255, 0.4);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.7);
}

.stage-preview-canvas-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  overflow: hidden;
}

#stage-preview-canvas {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.25s ease;
}

.stage-hazard-badge {
  position: absolute;
  top: 12px;
  right: 14px;
  font-size: 10.5px;
  font-weight: 900;
  letter-spacing: 1px;
  padding: 4px 10px;
  border-radius: 6px;
  background: linear-gradient(90deg, #ff0055, #ff5500);
  color: #fff;
  border: 1px solid #ffe600;
  box-shadow: 0 0 14px rgba(255, 0, 85, 0.8);
}

.stage-preview-diagonal-banner {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(90deg, rgba(0, 0, 0, 0.94) 0%, rgba(20, 10, 40, 0.88) 60%, rgba(0, 0, 0, 0) 100%);
  border-top: 3px solid #ffe600;
  padding: 12px 18px;
  backdrop-filter: blur(4px);
}

.stage-series-tag {
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 2px;
  color: #00f0ff;
  text-transform: uppercase;
  display: block;
  margin-bottom: 2px;
}

.stage-big-title {
  font-size: 26px;
  font-weight: 900;
  font-style: italic;
  color: #ffffff;
  letter-spacing: 1px;
  text-shadow: 2px 2px 0 #000, 0 0 16px rgba(255, 230, 0, 0.6);
}

.stage-preview-info {
  padding: 12px 16px;
}

.stage-preview-desc {
  font-size: 13px;
  color: #cbd5e1;
  line-height: 1.45;
}

.stage-actions-row {
  display: flex;
  gap: 14px;
  align-items: center;
}

.btn-back {
  flex: 0 0 auto;
  padding: 12px 18px;
}

.btn-fight {
  flex: 1;
  font-size: 17px;
  padding: 12px 24px;
}

/* RIGHT: Stage Squares Grid */
.stage-grid-pane {
  background: rgba(8, 12, 26, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.stage-grid-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 8px;
}

.stage-grid-header span {
  font-size: 13px;
  font-weight: 900;
  color: #ffe600;
  letter-spacing: 1px;
}

.stage-grid-header small {
  font-size: 11px;
  color: #94a3b8;
}

.stage-squares-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

.stage-card-square {
  background: rgba(22, 28, 52, 0.85);
  border: 3px solid rgba(255, 255, 255, 0.18);
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
}

.stage-card-square:hover {
  transform: translateY(-4px) scale(1.02);
  border-color: #00f0ff;
  box-shadow: 0 8px 24px rgba(0, 240, 255, 0.45);
}

.stage-card-square.selected {
  border-color: #ffe600;
  background: linear-gradient(135deg, rgba(255, 230, 0, 0.18), rgba(22, 28, 52, 0.95));
  box-shadow: 0 0 28px rgba(255, 230, 0, 0.65), inset 0 0 16px rgba(255, 230, 0, 0.25);
  animation: stagePulse 1.8s infinite alternate;
}

@keyframes stagePulse {
  from { border-color: #ffe600; }
  to { border-color: #ff00aa; }
}

.stage-thumb-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  background: #000;
  overflow: hidden;
}

.stage-thumb-canvas {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.random-thumb {
  background: radial-gradient(circle, #7928ca 0%, #1e1b4b 100%);
}

.stage-square-badge {
  position: absolute;
  top: 6px;
  left: 6px;
  font-size: 9.5px;
  font-weight: 900;
  background: rgba(0, 0, 0, 0.8);
  color: #00f0ff;
  border: 1px solid #00f0ff;
  border-radius: 4px;
  padding: 1px 6px;
}

.stage-square-footer {
  padding: 8px 10px;
  background: rgba(10, 14, 28, 0.95);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.stage-square-name {
  font-size: 13px;
  font-weight: 900;
  color: #fff;
  letter-spacing: 0.5px;
}

.stage-card-square.selected .stage-square-name {
  color: #ffe600;
}

.stage-square-sub {
  font-size: 10.5px;
  color: #94a3b8;
  margin-top: 2px;
}

.stage-help-tip {
  font-size: 11.5px;
  color: #cbd5e1;
  background: rgba(0, 0, 0, 0.4);
  border-radius: 8px;
  padding: 8px 12px;
  border-left: 3px solid #00f0ff;
}

@media (max-width: 900px) {
  .smash-stage-layout {
    grid-template-columns: 1fr;
  }
}

/* ==========================================
   TITLE / WELCOME SCREEN
   ========================================== */
.title-container {
  width: 100%;
  max-width: 760px;
  background: rgba(10, 14, 28, 0.94);
  border: 2px solid rgba(0, 240, 255, 0.45);
  border-radius: 20px;
  padding: 32px 36px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.9), 0 0 45px rgba(0, 240, 255, 0.25);
  text-align: center;
  animation: titleFadeIn 0.35s ease;
}

@keyframes titleFadeIn {
  from { opacity: 0; transform: scale(0.96) translateY(12px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.title-header {
  margin-bottom: 28px;
}

.title-logo {
  font-size: 46px;
  font-weight: 900;
  font-style: italic;
  letter-spacing: 2px;
  color: #ffe600;
  text-shadow: 0 0 24px rgba(255, 0, 128, 0.85), 4px 4px 0 #000;
  margin: 6px 0 4px;
}

.title-logo span {
  display: block;
  font-size: 18px;
  color: #ffffff;
  letter-spacing: 5px;
  margin-top: 4px;
}

.title-tagline {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 1.5px;
  color: #00f0ff;
  text-shadow: 0 0 10px rgba(0, 240, 255, 0.5);
  margin-top: 6px;
}

.title-menu-options {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 0;
}

.title-btn {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 16px 22px;
  border-radius: 14px;
  background: rgba(20, 28, 54, 0.85);
  border: 2px solid rgba(255, 255, 255, 0.12);
  color: #fff;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s cubic-bezier(0.2, 0.9, 0.3, 1.2);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.title-btn:hover {
  transform: translateY(-3px) scale(1.01);
}

.title-btn-icon {
  font-size: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 54px;
  height: 54px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.45);
  flex-shrink: 0;
}

.title-btn-content {
  flex: 1;
}

.title-btn-name {
  display: block;
  font-size: 18px;
  font-weight: 900;
  letter-spacing: 0.8px;
  margin-bottom: 3px;
}

.title-btn-desc {
  display: block;
  font-size: 12px;
  color: #94a3b8;
  font-weight: 600;
}

.title-btn-arrow {
  font-size: 22px;
  font-weight: 900;
  color: #64748b;
  transition: transform 0.2s ease, color 0.2s ease;
}

.title-btn:hover .title-btn-arrow {
  transform: translateX(4px);
  color: #fff;
}

/* Distinctive Button Accents */
.title-btn-local {
  border-color: rgba(0, 240, 255, 0.35);
}
.title-btn-local:hover {
  border-color: #00f0ff;
  background: linear-gradient(90deg, rgba(0, 240, 255, 0.18), rgba(20, 28, 54, 0.95));
  box-shadow: 0 10px 30px rgba(0, 240, 255, 0.25);
}
.title-btn-local .title-btn-name { color: #38bdf8; }

.title-btn-create {
  border-color: rgba(255, 0, 170, 0.35);
}
.title-btn-create:hover {
  border-color: #ff00aa;
  background: linear-gradient(90deg, rgba(255, 0, 170, 0.18), rgba(20, 28, 54, 0.95));
  box-shadow: 0 10px 30px rgba(255, 0, 170, 0.25);
}
.title-btn-create .title-btn-name { color: #f43f5e; }

.title-btn-join {
  border-color: rgba(255, 230, 0, 0.35);
}
.title-btn-join:hover {
  border-color: #ffe600;
  background: linear-gradient(90deg, rgba(255, 230, 0, 0.18), rgba(20, 28, 54, 0.95));
  box-shadow: 0 10px 30px rgba(255, 230, 0, 0.25);
}
.title-btn-join .title-btn-name { color: #fbbf24; }

.title-footer-hint {
  font-size: 11.5px;
  color: #64748b;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.btn-back-title {
  margin-bottom: 12px;
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.08);
}

/* ==========================================
   ONLINE MODALS (CREAR & UNIRSE A SALA)
   ========================================== */
.modal-card {
  width: 100%;
  max-width: 540px;
  background: rgba(11, 15, 30, 0.96);
  border: 2px solid rgba(0, 240, 255, 0.5);
  border-radius: 18px;
  padding: 28px 30px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.9), 0 0 35px rgba(0, 240, 255, 0.2);
  text-align: center;
  animation: titleFadeIn 0.25s ease;
}

.modal-badge {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 900;
  letter-spacing: 2px;
  padding: 3px 10px;
  border-radius: 99px;
  background: linear-gradient(90deg, #ff00aa, #00f0ff);
  color: #000;
  margin-bottom: 8px;
}

.modal-title {
  font-size: 24px;
  font-weight: 900;
  letter-spacing: 1px;
  color: #fff;
  margin-bottom: 6px;
}

.modal-subtitle {
  font-size: 13px;
  color: #94a3b8;
  line-height: 1.4;
  margin-bottom: 20px;
}

.room-code-box {
  background: rgba(0, 0, 0, 0.65);
  border: 2px dashed #00f0ff;
  border-radius: 14px;
  padding: 18px;
  margin-bottom: 18px;
  box-shadow: inset 0 0 20px rgba(0, 240, 255, 0.15);
}

.code-sub {
  display: block;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 2px;
  color: #94a3b8;
  margin-bottom: 6px;
}

.code-val {
  display: block;
  font-size: 38px;
  font-weight: 900;
  letter-spacing: 8px;
  color: #ffe600;
  text-shadow: 0 0 18px rgba(255, 230, 0, 0.8), 2px 2px 0 #000;
  font-family: monospace, monospace;
}

.modal-actions-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 20px;
}

.modal-btn-action {
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 12.5px;
  font-weight: 800;
  cursor: pointer;
  background: rgba(25, 34, 64, 0.85);
  color: #fff;
  border: 1px solid rgba(0, 240, 255, 0.4);
  transition: all 0.15s ease;
}

.modal-btn-action:hover {
  background: #00f0ff;
  color: #000;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 240, 255, 0.4);
}

.modal-btn-action.highlight {
  background: linear-gradient(135deg, #00f0ff, #0077ff);
  color: #000;
  border: none;
}

.waiting-box {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 12px;
  background: rgba(0, 240, 255, 0.08);
  border-radius: 10px;
  border: 1px solid rgba(0, 240, 255, 0.2);
  margin-bottom: 20px;
  font-size: 12.5px;
  font-weight: 700;
  color: #38bdf8;
}

.radar-spinner {
  width: 18px;
  height: 18px;
  border: 3px solid rgba(0, 240, 255, 0.2);
  border-top-color: #00f0ff;
  border-radius: 50%;
  animation: radarSpin 0.8s linear infinite;
}

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

.join-input-wrap {
  margin-bottom: 18px;
}

.join-input-wrap input {
  width: 100%;
  max-width: 320px;
  padding: 14px 20px;
  font-size: 28px;
  font-weight: 900;
  letter-spacing: 6px;
  text-align: center;
  text-transform: uppercase;
  color: #ffe600;
  background: rgba(0, 0, 0, 0.65);
  border: 2px solid #00f0ff;
  border-radius: 12px;
  outline: none;
  font-family: monospace, monospace;
  box-shadow: 0 0 20px rgba(0, 240, 255, 0.25);
  transition: all 0.2s ease;
}

.join-input-wrap input:focus {
  border-color: #ff00aa;
  box-shadow: 0 0 25px rgba(255, 0, 170, 0.4);
}

.room-status-alert {
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 16px;
  background: rgba(239, 68, 68, 0.2);
  border: 1px solid #ef4444;
  color: #fca5a5;
}

.modal-actions-row {
  display: flex;
  justify-content: center;
  gap: 14px;
}

/* ==========================================
   ONLINE CHARACTER SELECT MENU
   ========================================== */
.online-select-container {
  max-width: 980px;
}

.online-header-top {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 8px;
}

.room-badge-pill {
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 1.5px;
  padding: 3px 12px;
  border-radius: 99px;
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid #ffe600;
  color: #ffe600;
}

.online-status-badge {
  font-size: 11.5px;
  font-weight: 800;
  padding: 3px 12px;
  border-radius: 99px;
  background: rgba(34, 197, 94, 0.18);
  border: 1px solid #22c55e;
  color: #4ade80;
}

.online-main-title {
  font-size: 32px;
  font-weight: 900;
  letter-spacing: 2px;
  color: #fff;
  text-shadow: 0 0 15px rgba(0, 240, 255, 0.6);
  margin-bottom: 4px;
}

.online-select-hint {
  font-size: 12.5px;
  color: #94a3b8;
}

.online-roster-layout {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 24px;
  margin-bottom: 20px;
}

.secret-rival-card {
  background: rgba(14, 18, 38, 0.88);
  border: 2px solid rgba(255, 0, 170, 0.4);
  border-radius: 14px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  height: 100%;
  justify-content: center;
  box-shadow: inset 0 0 25px rgba(255, 0, 170, 0.1);
}

.secret-avatar-wrap {
  position: relative;
  width: 90px;
  height: 90px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.secret-avatar-icon {
  font-size: 48px;
  font-weight: 900;
  color: #ff00aa;
  text-shadow: 0 0 20px #ff00aa;
  z-index: 2;
}

.secret-pulse-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid #ff00aa;
  animation: pulseRing 1.8s infinite;
}

@keyframes pulseRing {
  0% { transform: scale(0.85); opacity: 0.8; }
  50% { transform: scale(1.15); opacity: 0.2; }
  100% { transform: scale(0.85); opacity: 0.8; }
}

.secret-rival-name {
  font-size: 20px;
  font-weight: 900;
  color: #fff;
  margin-bottom: 6px;
}

.secret-rival-desc {
  font-size: 12px;
  color: #94a3b8;
  line-height: 1.4;
  margin-bottom: 18px;
}

.rival-ready-status-box {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 99px;
  background: rgba(255, 230, 0, 0.12);
  border: 1px solid #ffe600;
  color: #ffe600;
  font-size: 12.5px;
  font-weight: 800;
}

.rival-ready-status-box.ready {
  background: rgba(34, 197, 94, 0.2);
  border-color: #22c55e;
  color: #4ade80;
}

.online-actions-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-online-ready {
  min-width: 260px;
  font-size: 16px;
}

.btn-online-ready.is-ready {
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: #fff;
  box-shadow: 0 0 25px rgba(34, 197, 94, 0.5);
}

/* ==========================================
   ONLINE STAGE TURN BANNER
   ========================================== */
.online-turn-banner {
  margin: 0 auto 12px;
  padding: 10px 24px;
  border-radius: 99px;
  background: linear-gradient(90deg, rgba(0, 240, 255, 0.2), rgba(255, 0, 170, 0.2));
  border: 2px solid #00f0ff;
  color: #fff;
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 1px;
  text-align: center;
  box-shadow: 0 0 20px rgba(0, 240, 255, 0.3);
  animation: pulseTurn 2s infinite alternate;
}

@keyframes pulseTurn {
  from { border-color: #00f0ff; box-shadow: 0 0 15px rgba(0, 240, 255, 0.25); }
  to { border-color: #ff00aa; box-shadow: 0 0 25px rgba(255, 0, 170, 0.4); }
}

.btn-fight.disabled-turn {
  opacity: 0.45;
  pointer-events: none;
  filter: grayscale(80%);
}

