/* ============================================================
   BAD TRIP COMBAT — STYLES
   Psychedelic / Heavy Metal / Wonderland / Bat Country
   ============================================================ */

:root{
  --acid-pink: #ff2bd6;
  --acid-cyan: #00f0ff;
  --acid-yellow: #ffe600;
  --acid-violet: #b400ff;
  --acid-lime: #adff2f;
  --acid-orange: #ff7a00;
  --acid-blood: #d40000;
  --void: #08000f;
  --bone: #f4ead5;
  --glow: 0 0 20px var(--acid-pink), 0 0 40px var(--acid-violet);
}

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

html, body {
  width:100%;
  height: 100vh;
  height: 100dvh;
  background: var(--void);
  color: var(--bone);
  font-family: 'VT323', monospace;
  overflow:hidden;
  position: fixed;
  inset: 0;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  cursor: crosshair;
  touch-action: manipulation;
  overscroll-behavior: none;
}

button {
  cursor: crosshair;
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
  -webkit-appearance: none;
  appearance: none;
  touch-action: manipulation;
}

/* SCREEN MANAGEMENT */
.screen{
  position: fixed; inset:0;
  display:none;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  padding:
    max(2vh, env(safe-area-inset-top))
    max(2vw, env(safe-area-inset-right))
    max(2vh, env(safe-area-inset-bottom))
    max(2vw, env(safe-area-inset-left));
}
.screen.active{ display:flex; }
.screen.overlay{ background: rgba(0,0,0,0.7); backdrop-filter: blur(6px); z-index: 50; }

/* ---------------- BOOT / TITLE ---------------- */
#screen-boot{
  background:
    radial-gradient(ellipse at 50% 30%, rgba(255,43,214,0.25), transparent 60%),
    radial-gradient(ellipse at 80% 80%, rgba(0,240,255,0.2), transparent 50%),
    radial-gradient(ellipse at 10% 80%, rgba(180,0,255,0.3), transparent 50%),
    var(--void);
  overflow:hidden;
}
.boot-stars{
  position:absolute; inset:0;
  background-image:
    radial-gradient(circle 1px at 20% 30%, #fff, transparent 2px),
    radial-gradient(circle 1px at 60% 70%, #fff, transparent 2px),
    radial-gradient(circle 2px at 80% 20%, #ffe600, transparent 3px),
    radial-gradient(circle 1px at 30% 80%, #00f0ff, transparent 2px),
    radial-gradient(circle 1px at 90% 50%, #ff2bd6, transparent 2px),
    radial-gradient(circle 1px at 15% 60%, #fff, transparent 2px),
    radial-gradient(circle 1px at 70% 40%, #fff, transparent 2px),
    radial-gradient(circle 2px at 45% 15%, #adff2f, transparent 3px);
  background-size: 100% 100%;
  animation: drift 20s linear infinite;
  opacity:0.7;
}
@keyframes drift {
  from{ transform: translate(0,0); }
  to{ transform: translate(-100px, -100px); }
}

.boot-eye{
  filter: drop-shadow(0 0 30px var(--acid-pink));
  animation: float 4s ease-in-out infinite, hueRot 8s linear infinite;
  margin-bottom: 1vh;
}
@keyframes float { 0%,100%{ transform: translateY(0); } 50%{ transform: translateY(-20px); } }
@keyframes hueRot { from{ filter: hue-rotate(0) drop-shadow(0 0 30px var(--acid-pink)); } to{ filter: hue-rotate(360deg) drop-shadow(0 0 30px var(--acid-pink)); } }

.title-glitch{
  font-family: 'Bungee Shade', cursive;
  font-size: clamp(36px, 8vw, 96px);
  letter-spacing: 0.02em;
  background: linear-gradient(90deg, var(--acid-yellow), var(--acid-pink), var(--acid-cyan), var(--acid-lime), var(--acid-yellow));
  background-size: 300% 100%;
  -webkit-background-clip: text;
  background-clip:text;
  color: transparent;
  text-shadow: 0 0 40px rgba(255,43,214,0.5);
  animation: rainbow 4s linear infinite;
  position:relative;
  text-align:center;
  line-height:1;
}
@keyframes rainbow { from { background-position: 0% 50%; } to { background-position: 300% 50%; } }
.title-glitch::before, .title-glitch::after{
  content: attr(data-text);
  position:absolute; left:0; top:0;
  width:100%;
  background: linear-gradient(90deg, var(--acid-yellow), var(--acid-pink), var(--acid-cyan), var(--acid-lime), var(--acid-yellow));
  background-size: 300% 100%;
  -webkit-background-clip: text;
  background-clip:text;
  color: transparent;
  pointer-events: none;
}
.title-glitch::before{
  animation: glitch1 3s infinite linear alternate-reverse, rainbow 4s linear infinite;
  clip-path: polygon(0 0, 100% 0, 100% 33%, 0 33%);
}
.title-glitch::after{
  animation: glitch2 2.5s infinite linear alternate-reverse, rainbow 4s linear infinite;
  clip-path: polygon(0 66%, 100% 66%, 100% 100%, 0 100%);
}
@keyframes glitch1 { 0%,90%,100%{ transform: translate(0,0); } 92%{ transform: translate(-3px,1px); } 95%{ transform: translate(2px,-1px); } }
@keyframes glitch2 { 0%,90%,100%{ transform: translate(0,0); } 93%{ transform: translate(2px,2px); } 96%{ transform: translate(-2px,-1px); } }

.subtitle{
  font-family:'Cinzel Decorative', serif;
  color: var(--acid-cyan);
  font-style:italic;
  margin: 1vh 0 3vh;
  text-shadow: 0 0 10px var(--acid-cyan);
  font-size: clamp(14px, 1.8vw, 22px);
}

.boot-menu{
  display:flex; flex-direction:column; gap:12px;
  align-items:center;
}
.menu-btn{
  font-family: 'Rubik Mono One', sans-serif;
  background: linear-gradient(180deg, #1a0033, #3d0066);
  color: var(--acid-yellow);
  border: 3px solid var(--acid-pink);
  padding: 14px 36px;
  font-size: clamp(16px, 2vw, 22px);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  box-shadow:
    0 0 0 3px var(--void),
    0 0 0 6px var(--acid-cyan),
    0 0 30px rgba(255,43,214,0.5);
  transition: transform 0.15s, filter 0.15s;
  position:relative;
}
.menu-btn:hover, .menu-btn:focus{
  transform: scale(1.05) rotate(-1deg);
  filter: hue-rotate(60deg) brightness(1.2);
  outline: none;
}
.menu-btn.ghost{
  background: transparent;
  border-color: var(--acid-cyan);
  color: var(--acid-cyan);
  box-shadow: none;
}
.menu-btn:disabled{
  opacity: 0.3; cursor: not-allowed;
  filter: grayscale(0.7);
}

.boot-foot{
  position:absolute; bottom:14px; left:0; right:0;
  text-align:center;
  font-size: 14px;
  color: var(--acid-lime);
  opacity:0.7;
  letter-spacing: 0.2em;
}

/* ---------------- HOW TO ---------------- */
.howto-wrap{
  background: rgba(10,0,30,0.8);
  border: 3px solid var(--acid-violet);
  padding: 30px;
  max-width: 900px;
  width: 95%;
  box-shadow: var(--glow);
  max-height: 90vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.howto-wrap h2{
  font-family:'Bungee Shade', cursive;
  font-size: clamp(28px, 5vw, 56px);
  background: linear-gradient(90deg, var(--acid-yellow), var(--acid-pink));
  -webkit-background-clip: text; background-clip:text; color: transparent;
  text-align:center; margin-bottom: 20px;
}
.howto-grid{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}
.howto-card{
  border: 2px solid var(--acid-cyan);
  padding: 16px;
  background: rgba(0,240,255,0.05);
}
.howto-card.wide{ grid-column: 1 / -1; }
.howto-card h3{
  font-family:'Rubik Mono One',sans-serif;
  color: var(--acid-pink);
  margin-bottom: 10px;
  letter-spacing:0.1em;
}
.howto-card ul{ list-style:none; }
.howto-card li{ font-size: 20px; padding: 4px 0; }
.howto-card li b{ color: var(--acid-yellow); display:inline-block; min-width: 70px; }
.howto-card p{ font-size: 18px; line-height:1.4; color: #ddd; margin-bottom: 8px; }

/* ---------------- CHARACTER SELECT ---------------- */
#screen-select{
  background:
    radial-gradient(ellipse at 50% 50%, rgba(180,0,255,0.2), transparent 70%),
    repeating-linear-gradient(45deg, #0a0014 0 20px, #14002a 20px 40px);
  justify-content: flex-start;
  padding-top: 20px;
}
.select-header{
  text-align:center;
  margin-bottom: 10px;
}
.select-header h2{
  font-family:'Bungee Shade', cursive;
  font-size: clamp(24px, 4vw, 44px);
  background: linear-gradient(90deg, var(--acid-pink), var(--acid-yellow), var(--acid-cyan));
  -webkit-background-clip: text; background-clip:text; color:transparent;
}
.select-sub{
  color: var(--acid-lime); font-size: 18px; letter-spacing:0.1em;
}
.roster{
  display:grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  width: 95%;
  max-width: 1100px;
  margin: 12px 0;
  max-height: 60vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 4px;
}
.roster-cell{
  position:relative;
  aspect-ratio: 1;
  background: linear-gradient(135deg, #1a0033, #08000f);
  border: 2px solid #444;
  cursor: crosshair;
  overflow:hidden;
  transition: transform 0.15s, border-color 0.15s;
}
.roster-cell:hover, .roster-cell.focused{
  transform: scale(1.06) rotate(-2deg);
  border-color: var(--acid-pink);
  box-shadow: 0 0 20px var(--acid-pink);
  z-index: 5;
}
.roster-cell.selected{
  border-color: var(--acid-yellow);
  box-shadow: 0 0 25px var(--acid-yellow), inset 0 0 25px rgba(255,230,0,0.3);
}
.roster-cell.locked{ filter: grayscale(0.8) brightness(0.5); }
.roster-cell.locked::after{
  content: '?';
  position:absolute; inset:0;
  display:flex; align-items:center; justify-content:center;
  font-size: 60px; color: var(--acid-blood);
  font-family:'Bungee Shade', cursive;
  text-shadow: 0 0 20px red;
}
.roster-cell svg{ width:100%; height:100%; }
.roster-cell .roster-name{
  position:absolute; bottom:4px; left:4px; right:4px;
  text-align:center;
  font-family:'Rubik Mono One', sans-serif;
  font-size: 11px;
  color: var(--acid-yellow);
  text-shadow: 1px 1px 0 #000, -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000;
  letter-spacing: 0.05em;
}

.select-detail{
  display:flex;
  align-items:center;
  gap: 30px;
  background: rgba(0,0,0,0.5);
  border: 2px solid var(--acid-cyan);
  padding: 16px 24px;
  width: 95%;
  max-width: 1100px;
}
.detail-portrait{
  width: 140px; height: 140px;
  background: radial-gradient(circle, rgba(180,0,255,0.3), transparent);
  flex-shrink:0;
  display:flex; align-items:center; justify-content:center;
}
.detail-portrait svg{ width: 100%; height:100%; }
.detail-info{ flex: 1; }
.detail-info h3{
  font-family:'Bungee Shade', cursive;
  font-size: clamp(22px, 3vw, 36px);
  color: var(--acid-pink);
  text-shadow: 0 0 10px var(--acid-pink);
}
.detail-tag{
  font-family:'Cinzel Decorative', serif;
  color: var(--acid-cyan);
  font-style:italic;
  font-size: 16px;
  margin: 4px 0;
}
.detail-bio{
  color: var(--bone);
  font-size: 18px;
  line-height: 1.3;
  max-width: 600px;
  margin-bottom: 8px;
}
.detail-stats{
  display:flex; gap: 12px;
  flex-wrap:wrap;
}
.stat{
  font-size:14px;
  color: var(--acid-lime);
  text-transform:uppercase;
}
.stat-bar{
  display:inline-block;
  width: 80px; height:8px;
  background: #222;
  border:1px solid var(--acid-cyan);
  vertical-align: middle;
  margin-left:6px;
}
.stat-bar > span{
  display:block; height:100%;
  background: linear-gradient(90deg, var(--acid-yellow), var(--acid-pink));
}

.select-actions{
  display:flex; gap:14px;
  margin-top:14px;
}

/* ---------------- STAGE SELECT ---------------- */
#screen-stage{
  background: radial-gradient(ellipse at center, rgba(0,240,255,0.15), transparent 70%), var(--void);
}
#screen-stage h2{
  font-family:'Bungee Shade', cursive;
  font-size: clamp(28px, 5vw, 56px);
  background: linear-gradient(90deg, var(--acid-cyan), var(--acid-lime));
  -webkit-background-clip: text; background-clip:text; color:transparent;
  margin-bottom: 16px;
}
.stage-grid{
  display:grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  width:95%;
  max-width: 1000px;
  margin-bottom: 16px;
  max-height: 60vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 4px;
}
.stage-cell{
  aspect-ratio: 16/10;
  border: 2px solid #444;
  position:relative;
  overflow:hidden;
  cursor: crosshair;
  transition: transform 0.15s, border-color 0.15s;
}
.stage-cell:hover{
  transform: scale(1.05);
  border-color: var(--acid-pink);
  z-index: 3;
}
.stage-cell svg{ width:100%; height:100%; display:block; }
.stage-name{
  position:absolute; bottom:0; left:0; right:0;
  background: linear-gradient(180deg, transparent, rgba(0,0,0,0.85));
  color: var(--acid-yellow);
  font-family:'Rubik Mono One', sans-serif;
  font-size: 11px;
  padding: 14px 6px 4px;
  text-align:center;
  letter-spacing: 0.05em;
}

/* ---------------- VS SPLASH ---------------- */
#screen-vs{
  background: var(--void);
  flex-direction:row;
  position:relative;
  overflow:hidden;
}
.vs-bg{
  position:absolute; inset:0;
  background:
    repeating-linear-gradient(90deg, var(--acid-pink) 0 30px, transparent 30px 60px),
    repeating-linear-gradient(0deg, var(--acid-cyan) 0 30px, transparent 30px 60px);
  opacity:0.1;
  animation: vsScroll 1s linear infinite;
}
@keyframes vsScroll{ to{ background-position: 60px 60px, 60px 60px; } }
.vs-side{
  flex:1;
  display:flex; flex-direction:column;
  align-items:center; justify-content:center;
  position:relative; z-index:1;
}
.vs-left{ transform: skewX(-8deg); background: linear-gradient(90deg, rgba(255,43,214,0.5), transparent); }
.vs-right{ transform: skewX(-8deg); background: linear-gradient(270deg, rgba(0,240,255,0.5), transparent); }
.vs-portrait{
  width: min(40vw, 380px); height: min(40vw, 380px);
  transform: skewX(8deg);
}
.vs-portrait svg{ width:100%; height:100%; filter: drop-shadow(0 0 30px currentColor); }
.vs-name{
  font-family:'Bungee Shade', cursive;
  font-size: clamp(24px, 4vw, 48px);
  margin-top: 10px;
  transform: skewX(8deg);
  text-align:center;
}
.vs-vs{
  font-family:'Bungee Shade', cursive;
  font-size: clamp(60px, 12vw, 160px);
  color: var(--acid-yellow);
  text-shadow: 0 0 40px var(--acid-pink);
  z-index: 2;
  animation: vsPulse 1s ease-in-out infinite;
  position:absolute; left:50%; top:50%;
  transform: translate(-50%,-50%);
}
@keyframes vsPulse{ 0%,100%{ transform: translate(-50%,-50%) scale(1); } 50%{ transform: translate(-50%,-50%) scale(1.15); } }
.vs-round{
  position:absolute; bottom: 8%; left:0; right:0;
  text-align:center;
  font-family:'Rubik Mono One',sans-serif;
  font-size: clamp(20px, 3vw, 36px);
  color: var(--acid-cyan);
  letter-spacing: 0.3em;
  z-index: 3;
  text-shadow: 0 0 15px var(--acid-cyan);
}

/* ---------------- FIGHT HUD ---------------- */
#screen-fight{
  padding:0;
  background: var(--void);
  display:none;
  flex-direction:column;
  align-items: stretch;
  justify-content: flex-start;
}
#screen-fight.active{ display:flex; }

.hud{
  display:flex;
  width: 100%;
  align-self: stretch;
  justify-content:space-between;
  align-items:flex-start;
  padding: max(10px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) 10px max(10px, env(safe-area-inset-left));
  background: linear-gradient(180deg, rgba(0,0,0,0.85), transparent);
  position: relative;
  z-index: 30;
}
.hud-side{ flex: 1; max-width: 45%; }
.hud-left{ }
.hud-right{ text-align:right; }
.hud-name{
  font-family:'Rubik Mono One', sans-serif;
  color: var(--acid-yellow);
  font-size: 18px;
  letter-spacing: 0.1em;
  margin-bottom: 4px;
  text-shadow: 0 0 10px var(--acid-pink);
}
.hud-bar{
  height: 22px;
  background: #1a0033;
  border: 2px solid var(--acid-cyan);
  position:relative;
  overflow:hidden;
}
.hud-hp{
  height:100%;
  width: 100%;
  background: linear-gradient(90deg, var(--acid-lime), var(--acid-yellow), var(--acid-orange));
  transition: width 0.2s;
  box-shadow: inset 0 0 10px rgba(255,255,255,0.5);
}
.hud-hp.right{
  background: linear-gradient(270deg, var(--acid-lime), var(--acid-yellow), var(--acid-orange));
  float: right;
}
.hud-meter{
  height: 8px;
  background: #1a0033;
  border: 1px solid var(--acid-pink);
  margin-top: 4px;
  overflow:hidden;
}
.hud-meter-fill{
  height:100%; width: 0;
  background: linear-gradient(90deg, var(--acid-pink), var(--acid-violet), var(--acid-cyan));
  transition: width 0.2s;
}
.hud-meter-fill.right{ float:right; background: linear-gradient(270deg, var(--acid-pink), var(--acid-violet), var(--acid-cyan)); }
.hud-rounds{
  margin-top:6px;
  font-size: 24px;
  color: var(--acid-yellow);
}
.hud-rounds.right{ }
.hud-rounds .rd{
  display:inline-block; width: 18px; height:18px;
  margin: 0 4px;
  border: 2px solid var(--acid-yellow);
  border-radius:50%;
}
.hud-rounds .rd.win{
  background: var(--acid-yellow);
  box-shadow: 0 0 10px var(--acid-yellow);
}
.hud-center{
  width: 200px;
  text-align:center;
  flex-shrink:0;
}
.hud-timer{
  font-family:'Bungee Shade', cursive;
  font-size: 56px;
  background: linear-gradient(180deg, var(--acid-yellow), var(--acid-orange));
  -webkit-background-clip:text; background-clip:text; color:transparent;
  text-shadow: 0 0 20px var(--acid-orange);
  line-height:1;
}
.hud-tournament{
  font-size: 14px;
  color: var(--acid-cyan);
  letter-spacing: 0.1em;
}

.stage{
  flex: 1;
  width: 100%;
  align-self: stretch;
  position: relative;
  overflow: hidden;
  background: #000;
}
.stage svg.bg{
  position:absolute; inset:0;
  width:100%; height:100%;
}
.stage svg.fg{
  position:absolute; inset:0;
  width:100%; height:100%;
}

.announcer{
  position:absolute; top: 30%; left:0; right:0;
  text-align:center;
  font-family:'Bungee Shade', cursive;
  font-size: clamp(40px, 10vw, 130px);
  color: var(--acid-yellow);
  text-shadow:
    0 0 20px var(--acid-pink),
    0 0 40px var(--acid-violet),
    4px 4px 0 var(--acid-blood);
  pointer-events:none;
  opacity: 0;
  z-index: 40;
  letter-spacing: 0.05em;
}
.announcer.show{
  animation: announce 1.4s ease-out;
}
@keyframes announce{
  0% { opacity:0; transform: scale(3) rotate(-15deg); }
  20% { opacity:1; transform: scale(1) rotate(0); }
  80% { opacity:1; transform: scale(1) rotate(0); }
  100% { opacity:0; transform: scale(0.8) rotate(15deg); }
}

/* ---------------- ROUND END ---------------- */
.roundend-card{
  background: rgba(10,0,30,0.95);
  border: 4px solid var(--acid-pink);
  padding: 30px;
  text-align:center;
  max-width: 700px;
  width: 90%;
  box-shadow: var(--glow);
}
.roundend-card h2{
  font-family:'Bungee Shade', cursive;
  font-size: clamp(40px, 7vw, 84px);
  background: linear-gradient(90deg, var(--acid-yellow), var(--acid-pink), var(--acid-yellow));
  background-size: 200% 100%;
  -webkit-background-clip:text; background-clip:text; color:transparent;
  animation: rainbow 2s linear infinite;
}
.roundend-cutscene{
  width:100%; aspect-ratio: 16/9;
  margin: 16px 0;
  background: #000;
  border: 2px solid var(--acid-cyan);
  position:relative;
  overflow:hidden;
}
.roundend-cutscene svg{ width:100%; height:100%; }
.roundend-text{
  font-family:'Cinzel Decorative', serif;
  font-style:italic;
  color: var(--acid-cyan);
  font-size: 20px;
  margin-bottom: 16px;
  min-height: 50px;
}

/* ---------------- TOURNAMENT BRACKET ---------------- */
#screen-bracket{
  background:
    radial-gradient(ellipse at top, rgba(255,122,0,0.15), transparent 60%),
    var(--void);
}
#screen-bracket h2{
  font-family:'Bungee Shade', cursive;
  font-size: clamp(28px, 5vw, 56px);
  background: linear-gradient(90deg, var(--acid-yellow), var(--acid-orange), var(--acid-blood));
  -webkit-background-clip:text; background-clip:text; color:transparent;
  margin-bottom: 16px;
}
.bracket{
  display:flex;
  flex-direction:row;
  gap: 12px;
  flex-wrap:wrap;
  justify-content:center;
  width: 95%; max-width: 1100px;
  margin-bottom: 16px;
}
.bracket-fight{
  width: 90px; height: 110px;
  border: 2px solid #444;
  background: rgba(0,0,0,0.6);
  display:flex; flex-direction:column;
  align-items:center; justify-content:center;
  font-family:'Rubik Mono One',sans-serif;
  font-size: 12px;
  position:relative;
  padding: 4px;
  text-align:center;
}
.bracket-fight .num{
  position:absolute; top:2px; left:4px;
  color: var(--acid-cyan);
  font-size: 14px;
}
.bracket-fight .opp-icon{
  width: 60px; height: 60px;
}
.bracket-fight .opp-icon svg{ width:100%; height:100%; }
.bracket-fight .opp-name{
  font-size: 9px; color: var(--bone);
  margin-top: 4px;
  letter-spacing: 0.05em;
}
.bracket-fight.done{
  border-color: var(--acid-lime);
  filter: brightness(0.7);
}
.bracket-fight.done::after{
  content: '✓'; position:absolute;
  top: 50%; left:50%; transform: translate(-50%,-50%);
  font-size: 50px; color: var(--acid-lime);
  text-shadow: 0 0 20px var(--acid-lime);
}
.bracket-fight.current{
  border-color: var(--acid-pink);
  box-shadow: 0 0 20px var(--acid-pink);
  animation: pulse 1.2s ease-in-out infinite;
}
@keyframes pulse{ 0%,100%{ box-shadow: 0 0 20px var(--acid-pink); } 50%{ box-shadow: 0 0 35px var(--acid-pink), 0 0 50px var(--acid-yellow); } }
.bracket-fight.boss{
  border-color: var(--acid-blood);
  background: linear-gradient(135deg, #2a0000, #4d0000);
}
.bracket-foot{
  display:flex; flex-direction:column; align-items:center; gap:10px;
}
.bracket-info{
  font-family:'Cinzel Decorative', serif;
  font-style:italic;
  color: var(--acid-cyan);
  font-size: 18px;
  text-align:center;
  max-width: 700px;
}

/* ---------------- ENDING ---------------- */
#screen-ending{
  background: #000;
  padding: 0;
}
.ending-stage{
  width:100%; flex: 1;
  display:flex;
  align-items:center; justify-content:center;
  position:relative;
  overflow:hidden;
}
.ending-stage svg{ width:100%; height:100%; }
.ending-text{
  position:absolute; bottom: 100px; left: 0; right: 0;
  text-align:center;
  font-family:'Cinzel Decorative', serif;
  color: var(--acid-yellow);
  font-size: clamp(18px, 2.5vw, 28px);
  text-shadow: 0 0 15px #000, 2px 2px 0 #000;
  padding: 20px;
  max-width: 900px;
  margin: 0 auto;
  font-style:italic;
  line-height: 1.5;
}
.ending-actions{
  position:absolute; bottom: 20px; left:0; right:0;
  display:flex; justify-content:center; gap: 20px;
}

/* ---------------- CREDITS ---------------- */
#screen-credits{
  background:
    radial-gradient(ellipse at center, rgba(180,0,255,0.2), transparent 70%),
    var(--void);
  overflow:hidden;
}
.credits-scroll{
  text-align:center;
  width: 90%; max-width: 700px;
  height: 70vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: var(--acid-pink) transparent;
}
.credits-scroll::-webkit-scrollbar{ width: 6px; }
.credits-scroll::-webkit-scrollbar-thumb{ background: var(--acid-pink); }
.credits-scroll h1{
  font-family:'Bungee Shade', cursive;
  font-size: clamp(32px, 5vw, 60px);
  background: linear-gradient(90deg, var(--acid-pink), var(--acid-yellow), var(--acid-cyan));
  -webkit-background-clip:text; background-clip:text; color:transparent;
  margin-bottom: 8px;
}
.credit-tag{
  font-family:'Cinzel Decorative', serif;
  font-style:italic;
  color: var(--acid-cyan);
  margin-bottom: 30px;
}
.credits-scroll h3{
  font-family:'Rubik Mono One', sans-serif;
  color: var(--acid-pink);
  margin-top: 24px;
  letter-spacing: 0.2em;
  font-size: 18px;
}
.credits-scroll p{
  color: var(--bone);
  font-size: 18px;
  margin: 6px 0;
}

/* ---------------- AUDIO TOGGLE ---------------- */
#audio-toggle{
  position: fixed;
  top: max(10px, env(safe-area-inset-top));
  right: max(10px, env(safe-area-inset-right));
  z-index: 1000;
  width: 44px; height: 44px;
  background: rgba(0,0,0,0.5);
  border: 2px solid var(--acid-cyan);
  color: var(--acid-cyan);
  font-size: 22px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
#track-name{
  position:fixed;
  top: 10px; left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  background: rgba(0,0,0,0.6);
  border: 1px solid var(--acid-pink);
  padding: 4px 16px;
  color: var(--acid-pink);
  font-family:'Rubik Mono One',sans-serif;
  font-size: 11px;
  letter-spacing: 0.2em;
  opacity: 0;
  transition: opacity 0.4s;
  pointer-events:none;
}
#track-name.show{ opacity:1; }

/* ---------------- TOUCH ---------------- */
.touch-pad{
  position: fixed;
  bottom: 0; left:0; right:0;
  display:none;
  justify-content:space-between;
  align-items: flex-end;
  padding:
    0
    max(10px, env(safe-area-inset-right))
    max(10px, env(safe-area-inset-bottom))
    max(10px, env(safe-area-inset-left));
  pointer-events:none;
  z-index: 100;
}
.touch-side{
  display:flex;
  gap:8px;
  pointer-events:auto;
  align-items: flex-end;
}
.touch-right{ flex-direction: row-reverse; }

/* by default in vsCPU/tournament, hide P2 side */
.touch-pad.p1only #touch-p2 { display: none; }

.touch-dpad{
  position: relative;
  width: 150px; height: 150px;
  pointer-events:auto;
}
.touch-dpad .tbtn.dir{
  position: absolute;
  width: 50px; height: 50px;
}
.touch-dpad .up    { top: 0; left: 50%; transform: translateX(-50%); }
.touch-dpad .down  { bottom: 0; left: 50%; transform: translateX(-50%); }
.touch-dpad .left  { left: 0; top: 50%; transform: translateY(-50%); }
.touch-dpad .right { right: 0; top: 50%; transform: translateY(-50%); }

.touch-actions{
  display: flex;
  flex-direction: column-reverse;
  gap: 8px;
  align-items: center;
}
.p2-actions{ flex-direction: column-reverse; }

.tbtn{
  width: 56px; height: 56px;
  background: rgba(0,0,0,0.55);
  border: 2px solid var(--acid-cyan);
  color: var(--acid-cyan);
  font-size: 22px;
  font-family:'Rubik Mono One',sans-serif;
  cursor:pointer;
  border-radius:50%;
  -webkit-user-select:none;
  user-select:none;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  touch-action: none;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
  text-shadow: 0 0 10px currentColor;
  box-shadow: 0 0 12px rgba(0,240,255,0.3), inset 0 0 8px rgba(0,0,0,0.4);
  transition: transform 0.05s, background-color 0.05s;
}
.tbtn.ab{
  border-color: var(--acid-pink);
  color: var(--acid-pink);
  box-shadow: 0 0 12px rgba(255,43,214,0.4), inset 0 0 8px rgba(0,0,0,0.4);
}
.tbtn.special{
  border-color: var(--acid-yellow);
  color: var(--acid-yellow);
  width: 64px; height: 64px;
  font-size: 28px;
  box-shadow: 0 0 16px rgba(255,230,0,0.5), inset 0 0 8px rgba(0,0,0,0.4);
}
.tbtn:active, .tbtn.held{
  background: var(--acid-cyan);
  color:#000 !important;
  transform: scale(0.92);
}
.tbtn.ab:active, .tbtn.ab.held{ background: var(--acid-pink); }
.tbtn.special:active, .tbtn.special.held{ background: var(--acid-yellow); }
.tbtn.dir:active, .tbtn.dir.held{ transform: scale(0.92) translate(0,0); }
/* preserve dir centering when active */
.touch-dpad .up:active, .touch-dpad .up.held       { transform: translateX(-50%) scale(0.92); }
.touch-dpad .down:active, .touch-dpad .down.held   { transform: translateX(-50%) scale(0.92); }
.touch-dpad .left:active, .touch-dpad .left.held   { transform: translateY(-50%) scale(0.92); }
.touch-dpad .right:active, .touch-dpad .right.held { transform: translateY(-50%) scale(0.92); }

/* ---------------- ORIENTATION PROMPT ---------------- */
#orient-prompt{
  display: none;
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse at 50% 30%, rgba(255,43,214,0.3), transparent 60%),
    radial-gradient(ellipse at 50% 70%, rgba(0,240,255,0.2), transparent 50%),
    var(--void);
  z-index: 9999;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 20px;
}
.orient-inner{
  max-width: 320px;
}
.orient-icon{
  font-size: 80px;
  margin-bottom: 20px;
  animation: orientSpin 2s ease-in-out infinite;
  display: inline-block;
}
@keyframes orientSpin{
  0%,100% { transform: rotate(0deg); }
  50%     { transform: rotate(90deg); }
}
#orient-prompt h2{
  font-family: 'Bungee Shade', cursive;
  font-size: 28px;
  color: var(--acid-yellow);
  margin-bottom: 14px;
  text-shadow: 0 0 12px var(--acid-pink);
}
#orient-prompt p{
  font-family: 'VT323', monospace;
  font-size: 20px;
  color: var(--bone);
  margin: 8px 0;
}
.orient-sub{
  color: var(--acid-cyan) !important;
  font-style: italic;
}

/* ---------------- RESPONSIVE — TABLET / PHONE ---------------- */
@media (max-width: 1024px){
  .touch-pad{ display:flex; }
  .roster{ grid-template-columns: repeat(4, 1fr); gap: 6px; }
  .stage-grid{ grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .howto-grid{ grid-template-columns: 1fr 1fr; gap: 12px; }
  .detail-portrait{ width: 110px; height:110px; }
  .select-detail{ flex-direction:column; gap: 10px; padding: 12px; max-height: 30vh; overflow-y: auto; }
  .hud-name{ font-size: 13px; }
  .hud-timer{ font-size: 36px; }
}

@media (max-width: 820px){
  .roster{ grid-template-columns: repeat(4, 1fr); }
  .stage-grid{ grid-template-columns: repeat(3, 1fr); }
  .select-header h2{ font-size: 22px; }
  .select-detail{ padding: 8px; }
  .detail-portrait{ width: 80px; height: 80px; }
  .detail-info h3{ font-size: 18px; }
  .detail-bio{ font-size: 14px; line-height: 1.3; }
  .menu-btn{ font-size: 14px; padding: 10px 14px; }
  .title-glitch{ font-size: clamp(36px, 9vw, 80px); }
  .subtitle{ font-size: 14px; }
  .boot-eye{ width: 180px; height: 180px; }
  .boot-eye svg{ width: 180px; height: 180px; }
  .hud{ padding: 6px; }
  .hud-bar{ height: 14px; }
  .hud-meter{ height: 6px; }
  .hud-rounds .rd{ width: 10px; height: 10px; }
  .roundend-card{ width: 92%; padding: 14px; }
  .roundend-card h2{ font-size: 28px; }

  /* smaller dpad on phones */
  .touch-dpad{ width: 130px; height: 130px; }
  .touch-dpad .tbtn.dir{ width: 44px; height: 44px; font-size: 18px; }
  .tbtn{ width: 50px; height: 50px; font-size: 18px; }
  .tbtn.special{ width: 58px; height: 58px; font-size: 24px; }
}

@media (max-width: 600px){
  .roster{ grid-template-columns: repeat(3, 1fr); gap: 4px; }
  .stage-grid{ grid-template-columns: repeat(2, 1fr); gap: 6px; }
  .roster-cell .roster-name{ font-size: 11px; }
  .stage-name{ font-size: 12px; }
  .howto-grid{ grid-template-columns: 1fr; }
  .vs-vs{ font-size: 60px; }
  .vs-name{ font-size: 22px; }
  .ending-portrait{ left: 4%; bottom: 35%; width: 130px; height: 180px; }
  .ending-lines h2{ font-size: 18px; }
  .ending-line{ font-size: 13px; margin: 3px 0; }
  .ending-fin{ font-size: 18px; }
}

/* portrait phones — show rotate prompt only DURING fights */
@media (max-width: 900px) and (orientation: portrait){
  body.in-fight #orient-prompt{ display: flex; }
  body.in-fight .screen.active{ display: none !important; }
  body.in-fight #touch-pad{ display: none !important; }
}

/* iOS specific tweaks */
@supports (-webkit-touch-callout: none){
  /* hover pseudos don't fire on touch — make sure focus/active styles are visible */
  .roster-cell:hover{ transform: none; }
  .stage-cell:hover{ transform: none; }
  .menu-btn:hover{ background-position: initial; }
}

/* fighter layer */
.fighter{
  position:absolute;
  bottom: 0;
  width: 200px; height: 280px;
  pointer-events:none;
  transform-origin: 50% 100%;
  will-change: transform, left;
}
.fighter svg{ width:100%; height:100%; overflow:visible; }
.fighter.facing-left{ transform: scaleX(-1); }
.fighter.hit{ animation: hitFlash 0.25s; }
@keyframes hitFlash{
  0%,100%{ filter: none; }
  20%,60%{ filter: brightness(3) hue-rotate(-30deg); }
  40%,80%{ filter: brightness(0.5) saturate(0); }
}

.hit-spark{
  position:absolute;
  pointer-events:none;
  font-family:'Bungee Shade', cursive;
  color: var(--acid-yellow);
  font-size: 60px;
  text-shadow: 0 0 20px var(--acid-pink), 4px 4px 0 var(--acid-blood);
  animation: sparkPop 0.6s forwards;
  z-index: 25;
}
@keyframes sparkPop{
  0%{ transform: scale(0) rotate(-30deg); opacity:1; }
  30%{ transform: scale(1.3) rotate(0); }
  100%{ transform: scale(2) translateY(-60px) rotate(40deg); opacity:0; }
}

.hit-particle{
  position:absolute;
  pointer-events:none;
  border-radius:50%;
  z-index:24;
  color: var(--acid-yellow);
  box-shadow: 0 0 8px currentColor;
  transform: translate(0,0) scale(1);
  animation: particleFly 0.6s ease-out forwards;
}
@keyframes particleFly{
  0%{ transform: translate(0,0) scale(1); opacity:1; }
  100%{ transform: translate(var(--tx,0), var(--ty,0)) scale(0.15); opacity:0; }
}

.special-fx{
  position:absolute; pointer-events:none;
  z-index: 20;
}

/* ---------------- CUTSCENES ---------------- */
.cutscene{
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border-radius: 8px;
}
.cutscene svg{ width:100%; height:100%; display:block; }
.cutscene-portrait{
  position:absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%) scale(0.6);
  width: 200px; height: 280px;
  filter: drop-shadow(0 0 20px rgba(0,0,0,0.8));
}
.cutscene-portrait svg{ width:100%; height:100%; overflow:visible; }
.cutscene-portrait.lose{ filter: drop-shadow(0 0 20px #ff0033) grayscale(0.4); }

/* ---------------- ENDING INNER ---------------- */
.ending-inner{
  position:relative; width:100%; height:100%;
  display:flex; flex-direction:column; align-items:center; justify-content:center;
}
.ending-svg{
  position:absolute; inset:0; width:100% !important; height:100% !important;
}
.ending-portrait{
  position:absolute;
  left: 8%; bottom: 30%;
  width: 220px; height: 300px;
  z-index: 5;
  filter: drop-shadow(0 0 25px rgba(0,0,0,0.9));
}
.ending-portrait svg{ width:100%; height:100%; overflow:visible; }
.ending-lines{
  position:absolute;
  bottom: 80px;
  left: 0; right: 0;
  text-align:center;
  z-index: 6;
  padding: 0 30px;
}
.ending-lines h2{
  font-size: clamp(20px, 3vw, 36px);
  margin: 8px 0 18px;
  text-shadow: 0 0 20px #000, 3px 3px 0 #000;
  letter-spacing: 2px;
}
.ending-line{
  font-family: 'Cinzel Decorative', serif;
  font-size: clamp(16px, 2vw, 26px);
  color: #fff;
  text-shadow: 0 0 12px #000, 2px 2px 0 #000;
  margin: 6px 0;
  opacity: 0;
  font-style: italic;
  animation: endingLineIn 0.8s forwards;
}
@keyframes endingLineIn{
  from{ opacity:0; transform: translateY(20px); }
  to{ opacity:1; transform: translateY(0); }
}
.ending-fin{
  margin-top: 20px;
  font-family: 'Bungee Shade', cursive;
  font-size: clamp(20px, 3vw, 36px);
  letter-spacing: 6px;
  opacity: 0;
  animation: endingLineIn 1s 4s forwards;
}

/* roundend cutscene tweaks */
.roundend-cutscene{
  position: relative;
  overflow: hidden;
}

/* ---------------- MISC ---------------- */
@keyframes twinkle{
  from{ opacity:0.2; transform:scale(0.8); }
  to{ opacity:1; transform:scale(1.4); }
}
