/* CSS resets and strict monochromatic styling with red accents */
        /* touch-action: manipulation kills iOS Safari's double-tap-to-zoom (taps still work;
           the touch fight buttons use touch-action: none which is stricter still) */
        * { margin: 0; padding: 0; box-sizing: border-box; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; touch-action: manipulation; }
        body { background: radial-gradient(circle at 50% 20%, #181818, #050505 58%, #000); color: #fff; font-family: 'Courier New', Courier, monospace; overflow: hidden; display: flex; justify-content: center; align-items: center; height: 100vh; height: 100dvh; /* dvh = the REAL visible height on iOS Safari (vh includes the collapsed toolbar) */ }
        #game-container { position: relative; width: 1024px; height: 576px; background: #000; box-shadow: 0 0 28px rgba(255, 255, 255, 0.12), 0 0 80px rgba(255, 0, 51, 0.08); border: 2px solid #333; overflow: hidden; }
        canvas { display: block; width: 100%; height: 100%; }
        
        /* UI Overlay System */
        .screen { position: absolute; top: 0; left: 0; width: 100%; height: 100%; display: flex; flex-direction: column; justify-content: center; align-items: center; background: rgba(0, 0, 0, 0.85); transition: opacity 0.3s; z-index: 10; }
        .hidden { opacity: 0; pointer-events: none; }
        #net-message { position: absolute; top: 0; left: 0; width: 100%; height: 100%; display: flex; flex-direction: column; justify-content: center; align-items: center; background: rgba(0, 0, 0, 0.92); transition: opacity 0.3s; z-index: 60; }
        #net-message h1 { color: #ff3355; text-shadow: 4px 4px 0 #300; }
        #net-message p { color: #ccc; font-size: 1.2rem; margin-top: 6px; }
        .btn:disabled { opacity: 0.4; cursor: default; border-color: #666; color: #888; }
        .btn:disabled:hover { background: transparent; color: #888; font-weight: normal; }
        
        h1 { font-size: 4rem; letter-spacing: 10px; color: #fff; text-transform: uppercase; margin-bottom: 10px; text-shadow: 4px 4px 0 #900; }
        h2 { font-size: 2rem; margin-bottom: 30px; }
        p.subtitle { color: #aaa; margin-bottom: 40px; }
        
        .btn { background: transparent; border: 2px solid #fff; color: #fff; padding: 15px 40px; font-size: 1.2rem; font-family: inherit; text-transform: uppercase; cursor: pointer; margin: 10px; transition: all 0.2s; min-width: 300px; }
        .btn:hover { background: #fff; color: #000; font-weight: bold; }

        /* ---- Dynamic Menu ---- */
        .menu-screen { overflow: hidden; background: radial-gradient(circle at 50% 42%, #181818 0%, #070707 38%, #000 74%); }
        .menu-screen::before { /* slow drifting radial glow */
            content: ""; position: absolute; inset: -30%; z-index: 0;
            background:
                conic-gradient(from 45deg at 50% 46%, transparent 0 18%, rgba(255,255,255,0.11) 20%, transparent 25% 48%, rgba(255,0,51,0.16) 50%, transparent 56% 100%),
                radial-gradient(circle at 50% 42%, rgba(255,0,51,0.2), rgba(0,0,0,0) 44%);
            animation: menuGlow 7s ease-in-out infinite alternate;
        }
        .menu-screen::after { /* faint scanlines */
            content: ""; position: absolute; inset: 0; z-index: 0; pointer-events: none;
            background:
                linear-gradient(90deg, rgba(255,255,255,0.06), transparent 18%, transparent 82%, rgba(255,255,255,0.06)),
                repeating-linear-gradient(0deg, rgba(255,255,255,0.035) 0 1px, transparent 1px 4px);
        }
        @keyframes menuGlow { from { transform: translateY(-12px) scale(1.0) rotate(-2deg); opacity: 0.76; } to { transform: translateY(12px) scale(1.08) rotate(2deg); opacity: 1; } }
        .menu-bg-streak { position: absolute; top: -22%; left: 50%; width: 210px; height: 150%; z-index: 0;
            background:
                linear-gradient(180deg, transparent, rgba(255,255,255,0.18), transparent),
                linear-gradient(90deg, transparent, rgba(255,0,51,0.45), transparent);
            clip-path: polygon(42% 0, 58% 0, 100% 100%, 0 100%);
            transform-origin: top center; transform: rotate(18deg); filter: blur(1px);
            animation: streakSweep 6s linear infinite; }
        @keyframes streakSweep { 0% { left: -30%; opacity: 0; } 30% { opacity: 1; } 70% { opacity: 1; } 100% { left: 110%; opacity: 0; } }
        .menu-screen > * { position: relative; z-index: 1; }
        .menu-version { position: absolute; left: 16px; bottom: 12px; z-index: 2; color: #666; font-size: 0.8rem; letter-spacing: 1px; font-family: inherit; }

        .title-glitch { position: relative; font-size: 4.7rem; letter-spacing: 12px; color: #fff; text-transform: uppercase;
            text-shadow: 5px 5px 0 #900, 0 0 36px rgba(255,0,51,0.45); margin-bottom: 6px; animation: titlePulse 3.5s ease-in-out infinite; }
        .title-glitch::before, .title-glitch::after { content: attr(data-text); position: absolute; left: 0; top: 0; width: 100%; }
        .title-glitch::before { color: #ff0033; opacity: 0.55; clip-path: inset(0 0 58% 0); animation: glitchShift 3s infinite steps(2); }
        .title-glitch::after { color: #777; opacity: 0.5; clip-path: inset(56% 0 0 0); animation: glitchShift 2.2s infinite reverse steps(2); }
        @keyframes titlePulse { 0%,100% { text-shadow: 5px 5px 0 #900; } 50% { text-shadow: 5px 5px 0 #900, 0 0 26px rgba(255,0,51,0.7); } }
        @keyframes glitchShift { 0%,92%,100% { transform: translate(0,0); } 94% { transform: translate(-4px,-2px); } 96% { transform: translate(4px,2px); } 98% { transform: translate(-3px,1px); } }

        .tagline { letter-spacing: 4px; text-transform: uppercase; font-size: 0.9rem; color: #ddd; margin-bottom: 34px; animation: fadePulse 4s ease-in-out infinite; }
        .tagline::before, .tagline::after { content: ""; display: inline-block; width: 72px; height: 1px; background: #ff0033; vertical-align: middle; margin: 0 14px; box-shadow: 0 0 12px #ff0033; }
        @keyframes fadePulse { 0%,100% { opacity: 0.55; } 50% { opacity: 1; } }
        .menu-sub-title { letter-spacing: 6px; text-transform: uppercase; margin-bottom: 28px; text-shadow: 0 0 16px rgba(255,0,51,0.4); }

        .menu-buttons { display: flex; flex-direction: column; align-items: center; gap: 4px; }
        .play-menu-panels { position: relative; width: 900px; max-width: 100%; min-height: 360px; display: flex; justify-content: center; align-items: flex-start; gap: 28px; }
        .play-choice-panel, .offline-panel, .versus-panel { transition: transform 0.28s ease, opacity 0.24s ease; }
        .offline-panel, .versus-panel { position: absolute; right: 28px; top: 0; opacity: 0; transform: translateX(70px); pointer-events: none; }
        #mode-screen.offline-open .play-choice-panel { transform: translateX(-250px); }
        #mode-screen.offline-open .offline-panel { opacity: 1; transform: translateX(0); pointer-events: auto; }
        #mode-screen.versus-open .offline-panel { transform: translateX(-250px); opacity: 0.45; pointer-events: none; }
        #mode-screen.solo-versus-open .solo-versus-panel,
        #mode-screen.team-versus-open .team-versus-panel { opacity: 1; transform: translateX(0); pointer-events: auto; }
        .offline-panel .menu-btn:not(.offline-choice) { display: none; }
        .menu-btn { position: relative; min-width: 380px; overflow: hidden; transition: transform 0.15s, background 0.2s, border-color 0.2s, box-shadow 0.2s; background: rgba(0,0,0,0.42); backdrop-filter: blur(2px); }
        .menu-btn::before { content: ""; position: absolute; left: -120%; top: 0; width: 60%; height: 100%; transform: skewX(-20deg);
            background: linear-gradient(90deg, transparent, rgba(255,255,255,0.25), transparent); transition: left 0.4s; }
        .menu-btn:hover { transform: translateX(8px) scale(1.02); border-color: #ff0033; box-shadow: -6px 0 0 #ff0033, 0 0 24px rgba(255,0,51,0.28); }
        .menu-btn:hover::before { left: 130%; }
        .menu-btn.primary { border-color: #ff0033; color: #fff; font-weight: bold; box-shadow: 0 0 18px rgba(255,0,51,0.4); }
        .menu-btn.primary:hover { background: #ff0033; color: #fff; }
        .menu-btn.ghost { opacity: 0.7; min-width: 200px; font-size: 1rem; }
        /* two-line mode buttons */
        .menu-btn span { display: block; }
        .menu-btn small { display: block; font-size: 0.7rem; letter-spacing: 1px; color: #999; text-transform: none; margin-top: 4px; }
        .menu-btn:hover small { color: #000; }
        .online-panel { width: 100%; max-width: 640px; display: grid; grid-template-columns: 130px 1fr; gap: 12px; align-items: center; margin-bottom: 18px; padding: 18px; border: 1px solid #444; background: rgba(0,0,0,0.52); }
        .online-panel label { color: #ccc; text-transform: uppercase; letter-spacing: 2px; font-size: 0.82rem; }
        .online-panel input { width: 100%; background: #08080c; border: 1px solid #555; color: #fff; padding: 12px 14px; font: inherit; text-transform: none; }
        .online-panel input:focus { outline: none; border-color: #ff0033; box-shadow: 0 0 12px rgba(255,0,51,0.28); }
        .online-actions { grid-column: 1 / -1; display: flex; justify-content: center; gap: 10px; }
        .online-actions .menu-btn { min-width: 220px; }
        /* Game-mode list is getting long — make those buttons a tighter, smaller list. */
        #mode-screen .menu-buttons { gap: 2px; }
        #mode-screen.offline-open .play-choice-panel .menu-btn { min-width: 300px; }
        #mode-screen .menu-btn { padding: 7px 28px; min-width: 430px; margin: 3px; font-size: 1rem; }
        #mode-screen .menu-btn small { font-size: 0.6rem; margin-top: 1px; letter-spacing: 0.5px; }
        #mode-screen .menu-btn.ghost { min-width: 200px; }
        #online-status { grid-column: 1 / -1; color: #aaa; font-size: 0.84rem; min-height: 1.2em; text-align: center; }

        /* Settings gear button */
        #settings-btn { position: absolute; top: 14px; right: 14px; z-index: 40; width: 44px; height: 44px; background: rgba(0,0,0,0.5); border: 2px solid #888; color: #fff; font-size: 1.4rem; line-height: 1; cursor: pointer; transition: 0.2s; }
        #settings-btn:hover { background: #fff; color: #000; transform: rotate(45deg); }
        #settings-btn.hidden { opacity: 0; pointer-events: none; }
        /* Settings screen */
        #settings-screen { justify-content: flex-start; padding: 26px 30px; overflow-y: auto; background: radial-gradient(circle at 50% 12%, rgba(80,0,12,0.4), rgba(0,0,0,0.96) 55%); z-index: 35; }
        .settings-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 26px; width: 100%; max-width: 820px; margin-bottom: 18px; align-items: start; }
        .settings-left { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
        .settings-block { border: 1px solid #444; background: #0d0d10; padding: 16px 18px; text-align: left; }
        .settings-block h3 { color: #ff3333; letter-spacing: 2px; margin-bottom: 14px; }
        .settings-block h3 small { color: #888; letter-spacing: 0; font-size: 0.65rem; text-transform: none; }
        .settings-toggle { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; color: #ccc; font-size: 0.82rem; text-transform: uppercase; letter-spacing: 1px; }
        .toggle-btn { min-width: 84px; padding: 6px 10px; background: #161620; border: 1px solid #555; color: #999; font-family: inherit; cursor: pointer; }
        .toggle-btn.on { color: #fff; border-color: #ff0033; box-shadow: 0 0 10px rgba(255,0,51,0.35); }
        .vol-row { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; font-size: 0.82rem; }
        .vol-row label { width: 84px; color: #ccc; text-transform: uppercase; letter-spacing: 1px; }
        .vol-row input[type=range] { flex: 1; accent-color: #ff0033; }
        .vol-row .vval { width: 38px; text-align: right; color: #fff; }
        .bind-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; font-size: 0.78rem; }
        .bind-row .bind-act { color: #ccc; }
        .bind-row .bind-grp { display: flex; gap: 6px; }
        .bind-key { min-width: 54px; padding: 4px 8px; background: #161620; border: 1px solid #555; color: #fff; font-family: inherit; font-size: 0.74rem; cursor: pointer; text-align: center; }
        .bind-key:hover { border-color: #fff; }
        .bind-key.listening { border-color: #ff0033; color: #ff6680; box-shadow: 0 0 8px rgba(255,0,51,0.6); }
        .bind-head { display: flex; justify-content: space-between; color: #8fd; font-size: 0.72rem; margin: 8px 0 4px; letter-spacing: 1px; }
        /* How To Play */
        #howto-screen { justify-content: flex-start; padding: 26px 30px; overflow-y: auto; background: radial-gradient(circle at 50% 12%, rgba(80,0,12,0.4), rgba(0,0,0,0.96) 55%); }
        .howto-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; width: 100%; max-width: 940px; margin-bottom: 18px; }
        .howto-card { border: 1px solid #444; background: #0d0d10; padding: 12px 14px; text-align: left; }
        .howto-card h3 { color: #ff3333; font-size: 0.95rem; letter-spacing: 1px; margin-bottom: 8px; }
        .howto-card p { font-size: 0.74rem; color: #ccc; line-height: 1.5; margin-bottom: 3px; }
        .howto-card p b { color: #fff; }
        
        #char-select-screen { justify-content: flex-start; padding: 24px 36px; background: radial-gradient(circle at 50% 16%, rgba(80, 0, 12, 0.45), rgba(0, 0, 0, 0.92) 42%, rgba(0, 0, 0, 0.96)); }
        #char-select-title { margin-bottom: 12px; letter-spacing: 4px; text-transform: uppercase; }
        .versus-preview { width: 100%; height: 190px; border-top: 2px solid #333; border-bottom: 2px solid #333; background: linear-gradient(90deg, rgba(255,255,255,0.04), rgba(255,0,51,0.08), rgba(255,255,255,0.04)); position: relative; margin-bottom: 18px; }
        #char-preview-canvas { width: 100%; height: 100%; display: block; }
        .selection-status { position: absolute; top: 12px; left: 0; width: 100%; display: flex; justify-content: space-between; padding: 0 28px; font-size: 0.95rem; color: #ccc; text-transform: uppercase; letter-spacing: 2px; pointer-events: none; }
        .selection-status strong { color: #fff; }
        /* Single row so the RANDOM card sits dead-centre of the roster */
        .char-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; width: 100%; max-width: 940px; margin-bottom: 14px; align-items: center; justify-items: center; }
        .char-card { border: 0; min-height: 128px; padding: 0; cursor: pointer; transition: 0.2s; background: transparent; position: relative; overflow: visible; display: flex; align-items: center; justify-content: center; }
        .char-card::after { content: ""; position: absolute; inset: auto 10px 0 10px; height: 4px; background: #ff0033; transform: scaleX(0); transform-origin: center; transition: transform 0.2s; }
        .char-card:hover, .char-card.selected { transform: translateY(-5px) scale(1.06); }
        .char-card:hover::after, .char-card.selected::after { transform: scaleX(1); }
        .char-card.locked { filter: drop-shadow(0 0 12px rgba(255, 0, 51, 0.8)); }
        /* Character icon buttons (PNGs live in textures/icons/) */
        .char-icon { width: 100%; max-width: 120px; height: auto; object-fit: contain; image-rendering: auto; pointer-events: none; filter: drop-shadow(0 12px 12px rgba(0,0,0,0.75)); }
        .random-card { order: 0; } /* centred via the markup order (4th of 7) */
        .random-mark { width: 84px; height: 84px; border: 2px solid #aaa; border-radius: 6px; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 3rem; background: radial-gradient(circle, #333, #050505 70%); box-shadow: 0 0 24px rgba(255,255,255,0.08); }
        /* Graceful fallback shown until each PNG is added */
        .char-card.no-icon::before { content: "?"; display: flex; align-items: center; justify-content: center; width: 90px; height: 90px; border: 2px dashed #555; color: #666; font-size: 2rem; }
        #stage-select-screen { justify-content: flex-start; padding: 36px; background: radial-gradient(circle at 50% 14%, rgba(180,180,180,0.12), rgba(0,0,0,0.94) 46%); }
        #stage-select-title { letter-spacing: 4px; text-transform: uppercase; margin-bottom: 30px; }
        .stage-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; width: 100%; max-width: 960px; }
        .stage-card { border: 1px solid #444; background: #070707; color: #fff; font-family: inherit; cursor: pointer; padding: 8px; transition: 0.2s; text-transform: uppercase; letter-spacing: 1px; font-size: 0.82rem; }
        .stage-card:hover, .stage-card.selected { border-color: #fff; transform: translateY(-4px); box-shadow: 0 0 22px rgba(255,255,255,0.12); }
        .stage-thumb { width: 100%; height: auto; border: 1px solid #222; margin-bottom: 7px; background: #000; }
        .random-stage-thumb { display: flex; align-items: center; justify-content: center; aspect-ratio: 2 / 1; font-size: 3rem; font-weight: bold; color: #888; background: repeating-linear-gradient(45deg, #0a0a0a, #0a0a0a 10px, #141414 10px, #141414 20px); }
        .random-stage-card:hover .random-stage-thumb { color: #fff; }
        
        /* In-Game HUD */
        #hud { position: absolute; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; padding: 20px; display: flex; justify-content: space-between; z-index: 5; }
        #hud .hidden { display: none !important; }
        .player-hud { width: 40%; display: flex; flex-direction: column; }
        #p2-hud { align-items: flex-end; }
        .solo-row { display: flex; align-items: center; gap: 8px; width: 100%; margin-bottom: 5px; }
        .solo-row-right { flex-direction: row-reverse; }
        .hud-icon { width: 34px; height: 34px; object-fit: cover; border: 2px solid #888; background: #111; flex: 0 0 auto; }
        #p2-hud .hud-icon, #p2-hud .team-icon { transform: scaleX(-1); }
        .solo-row .health-bar-bg { flex: 1 1 auto; margin-bottom: 0; }
        .health-bar-bg { width: 100%; height: 25px; background: #333; border: 2px solid #fff; margin-bottom: 5px; position: relative; }
        .health-bar-fill { height: 100%; background: #ff0033; transition: width 0.1s linear; width: 100%; }
        /* Ult-lethal threshold: at/below this HP an enemy ultimate is a guaranteed kill */
        .ult-threshold { position: absolute; top: -2px; bottom: -2px; width: 3px; margin-left: -1px; background: #ffd23f; box-shadow: 0 0 6px #ffd23f, 0 0 2px #000; z-index: 3; pointer-events: none; }
        .ult-threshold::after { content: ""; position: absolute; top: -4px; left: -2px; border-left: 3.5px solid transparent; border-right: 3.5px solid transparent; border-top: 5px solid #ffd23f; }
        .char-name { font-size: 1.2rem; font-weight: bold; }
        .hud-row { display: flex; align-items: center; gap: 12px; }
        #p2-hud .hud-row { justify-content: flex-end; }
        /* Best-of-3 round pips */
        .round-pips { display: flex; gap: 6px; }
        .round-pips .pip { width: 13px; height: 13px; border: 2px solid #888; border-radius: 50%; transition: 0.2s; }
        .round-pips .pip.won { background: #ff0033; border-color: #fff; box-shadow: 0 0 8px #ff0033; }
        /* Ultimate meter */
        .meter-bar-bg { width: 70%; height: 10px; background: #222; border: 1px solid #666; margin-bottom: 6px; position: relative; overflow: hidden; }
        .player-hud.team-mode .meter-bar-bg { margin-top: 2px; }
        #p2-hud .meter-bar-bg { align-self: flex-end; }
        .meter-bar-fill { height: 100%; width: 0%; background: linear-gradient(90deg, #6cf, #fff); transition: width 0.08s linear; }
        .meter-bar-bg.ready { border-color: #fff; box-shadow: 0 0 10px rgba(120,210,255,0.9); animation: meterPulse 0.7s infinite alternate; }
        .meter-bar-bg.ready .meter-bar-fill { background: linear-gradient(90deg, #ff0033, #fff, #ff0033); }
        /* 2v2 stacked per-character health bars */
        .team-hp { display: flex; flex-direction: column; gap: 6px; margin-bottom: 5px; width: 100%; }
        .team-row { display: flex; align-items: center; gap: 7px; opacity: 0.55; transition: opacity 0.15s; }
        .team-row.active { opacity: 1; }
        .team-row.downed { opacity: 0.28; }
        .team-hp-right .team-row { flex-direction: row-reverse; }
        .team-icon { width: 30px; height: 30px; object-fit: cover; border: 2px solid #888; background: #111; flex: 0 0 auto; }
        .team-row.active .team-icon { border-color: #fff; box-shadow: 0 0 8px rgba(255,255,255,0.6); }
        .team-hp .health-bar-bg.sm { height: 16px; margin-bottom: 0; flex: 1 1 auto; }
        .team-row.downed .health-bar-fill { background: #555; }
        .touch-tag { border-color: #6cf; color: #cfefff; }
        @keyframes meterPulse { from { box-shadow: 0 0 6px rgba(255,255,255,0.5); } to { box-shadow: 0 0 16px rgba(255,0,51,0.9); } }
        /* Training panel */
        /* Training controls live behind a dedicated button instead of cluttering the battle screen */
        #training-ui { position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%); z-index: 11; pointer-events: auto; display: flex; flex-direction: column; align-items: center; gap: 8px; }
        #dummy-settings-btn { background: rgba(0,0,0,0.6); border: 2px solid #6cf; color: #6cf; font-family: inherit; font-size: 0.85rem; padding: 8px 18px; cursor: pointer; letter-spacing: 1px; text-transform: uppercase; }
        #dummy-settings-btn:hover { background: #6cf; color: #000; }
        #training-panel { display: flex; flex-direction: column; align-items: center; gap: 8px; background: rgba(0,0,0,0.88); border: 1px solid #6cf; box-shadow: 0 0 18px rgba(0,0,0,0.6); padding: 12px 16px; }
        .dummy-title { color: #6cf; font-size: 0.9rem; letter-spacing: 2px; text-transform: uppercase; margin: 0; }
        .dummy-close { background: rgba(0,0,0,0.5); border: 1px solid #888; color: #ddd; font-family: inherit; font-size: 0.75rem; padding: 5px 18px; cursor: pointer; letter-spacing: 1px; text-transform: uppercase; }
        .dummy-close:hover { background: #fff; color: #000; }
        .train-toggle { background: rgba(0,0,0,0.6); border: 1px solid #888; color: #fff; font-family: inherit; font-size: 0.85rem; padding: 8px 16px; cursor: pointer; letter-spacing: 1px; text-transform: uppercase; }
        .train-toggle:hover { background: #fff; color: #000; }
        .train-toggle.on { border-color: #6cf; color: #6cf; box-shadow: 0 0 10px rgba(120,210,255,0.5); }
        #dummy-settings { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 5px; max-width: 680px; background: rgba(0,0,0,0.55); border: 1px solid #555; padding: 6px 8px; }
        #dummy-settings .dummy-label { color: #6cf; font-size: 0.72rem; letter-spacing: 1px; text-transform: uppercase; margin-right: 4px; }
        .dummy-btn { background: rgba(0,0,0,0.5); border: 1px solid #777; color: #ddd; font-family: inherit; font-size: 0.72rem; padding: 5px 9px; cursor: pointer; letter-spacing: 0.5px; text-transform: uppercase; }
        .dummy-btn:hover { background: #fff; color: #000; }
        .dummy-btn.on { border-color: #6cf; color: #6cf; box-shadow: 0 0 8px rgba(120,210,255,0.45); }
        #online-net-panel { position: absolute; bottom: 18px; left: 50%; transform: translateX(-50%); display: flex; gap: 10px; padding: 5px 10px; border: 1px solid rgba(255,255,255,0.22); background: rgba(0,0,0,0.62); color: #bbb; font-size: 0.68rem; letter-spacing: 1px; text-transform: uppercase; }
        #online-net-panel span { min-width: 74px; text-align: center; }
        #online-net-panel.good { border-color: rgba(120,255,190,0.45); color: #bfffe2; }
        #online-net-panel.warn { border-color: rgba(255,210,90,0.55); color: #ffd96d; }
        #online-net-panel.bad { border-color: rgba(255,0,51,0.65); color: #ff6680; }
        #touch-controls { position: absolute; inset: 0; z-index: 8; pointer-events: none; touch-action: none; }
        .touch-cluster { position: absolute; pointer-events: auto; }
        /* Virtual analog stick (movement) */
        .touch-stick { left: 24px; bottom: 24px; width: 180px; height: 180px; border-radius: 50%; border: 2px solid rgba(255,255,255,0.55); background: rgba(0,0,0,0.4); display: flex; justify-content: center; align-items: center; touch-action: none; -webkit-tap-highlight-color: transparent; box-shadow: 0 0 14px rgba(0,0,0,0.5); }
        .touch-stick-knob { width: 72px; height: 72px; border-radius: 50%; background: rgba(255,255,255,0.22); border: 2px solid rgba(255,255,255,0.75); pointer-events: none; box-shadow: 0 0 10px rgba(0,0,0,0.6); }
        .touch-stick.held { border-color: #fff; }
        .touch-stick.held .touch-stick-knob { background: rgba(255,0,51,0.6); border-color: #fff; }
        .touch-actions { right: 20px; bottom: 22px; width: 292px; display: grid; grid-template-columns: repeat(3, 92px); gap: 8px; align-items: center; }
        .touch-btn { border: 2px solid rgba(255,255,255,0.68); background: rgba(0,0,0,0.48); color: #fff; font-family: inherit; font-size: 0.68rem; letter-spacing: 1px; min-height: 54px; border-radius: 8px; touch-action: none; -webkit-tap-highlight-color: transparent; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; box-shadow: 0 0 14px rgba(0,0,0,0.5); }
        .touch-btn:active, .touch-btn.held { background: rgba(255,0,51,0.72); border-color: #fff; transform: scale(0.96); }
        /* Touch devices: the whole container is scaled down to fit the phone, which shrinks the
           buttons with it — so render them much larger inside the container to compensate. */
        @media (pointer: coarse) {
            .touch-stick { left: 18px; bottom: 18px; width: 252px; height: 252px; }
            .touch-stick-knob { width: 102px; height: 102px; }
            .touch-actions { right: 14px; bottom: 16px; width: 396px; grid-template-columns: repeat(3, 126px); gap: 10px; }
            .touch-btn { min-height: 76px; font-size: 0.95rem; border-radius: 12px; }
            /* HUD reads larger on small screens too */
            .health-bar-bg { height: 32px; }
            .char-name { font-size: 1.5rem; }
            .meter-bar-bg { height: 14px; }
            #timer { font-size: 3.1rem; }
        }
        .touch-ult { grid-column: span 2; border-color: #ff0033; color: #ffccd6; }
        
        #match-info { position: absolute; top: 20px; left: 50%; transform: translateX(-50%); text-align: center; }
        #timer { font-size: 2.5rem; font-weight: bold; }
        #wave-counter { font-size: 1.5rem; color: #ff3333; }

        .controls-info { position: absolute; bottom: 20px; text-align: center; width: 100%; font-size: 0.8rem; color: #777; }
        #pause-screen { background: rgba(0, 0, 0, 0.72); z-index: 12; }
        #pause-screen h2 { font-size: 3rem; letter-spacing: 8px; margin-bottom: 12px; text-transform: uppercase; }

        /* Character Info screen */
        #info-screen { justify-content: flex-start; padding: 22px 30px; overflow-y: auto; background: radial-gradient(circle at 50% 12%, rgba(80,0,12,0.4), rgba(0,0,0,0.95) 50%); }
        #info-screen h2 { font-size: 2rem; letter-spacing: 4px; margin-bottom: 6px; text-transform: uppercase; }
        #info-controls { font-size: 0.82rem; color: #9a9a9a; margin-bottom: 16px; text-align: center; max-width: 880px; line-height: 1.5; }
        .info-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; width: 100%; max-width: 900px; margin-bottom: 18px; }
        .info-card { border: 1px solid #555; background: #101013; padding: 14px 16px; text-align: left; }
        .info-card h3 { color: #ff3333; margin-bottom: 4px; letter-spacing: 2px; }
        .info-card .role { color: #ccc; font-size: 0.78rem; margin-bottom: 4px; font-style: italic; }
        .info-card .passive { color: #8fd; font-size: 0.78rem; margin-bottom: 10px; }
        .info-card ul { list-style: none; }
        .info-card li { font-size: 0.8rem; color: #ddd; margin-bottom: 6px; line-height: 1.4; }
        .info-card li b { color: #fff; }
        .info-card li .dir { display: inline-block; min-width: 60px; color: #ff6680; font-weight: bold; }

        /* ==================== UI OVERHAUL: FIGHT-POSTER MENUS ==================== */
        /* Type system: tall condensed display type for anything loud, a sharp
           athletic sans for everything readable. */
        body, button, input, select { font-family: 'Rajdhani', 'Courier New', monospace; }
        h1, h2, h3, .btn, .menu-btn, .train-toggle, .dummy-btn, #boot-enter, .char-name, #timer, .menu-sub-title { font-family: 'Bebas Neue', 'Courier New', monospace; letter-spacing: 3px; font-weight: normal; }

        /* Angular ticket-stub buttons: slanted ends, thick red spine, slide-fill hover */
        .btn { clip-path: polygon(14px 0, 100% 0, calc(100% - 14px) 100%, 0 100%); border: none; border-left: 5px solid #ff0033; background: #121212; color: #eee; padding: 10px 36px; font-size: 1.3rem; letter-spacing: 4px; transition: 0.14s; }
        .btn:hover { background: #ff0033; color: #000; transform: translateX(8px) skewX(-2deg); font-weight: normal; }
        .btn:disabled { background: #0c0c0c; border-left-color: #444; transform: none; }

        /* Section headers read like fight-card listings */
        h2 { letter-spacing: 6px; }
        h2::before { content: "// "; color: #ff0033; }
        h2::after { content: " //"; color: #ff0033; }

        /* MAIN MENU — left-aligned poster layout over the blood splatter */
        #menu-screen { align-items: flex-start; padding-left: 86px; background: linear-gradient(115deg, transparent 54%, rgba(255,0,51,0.08) 54%, rgba(255,0,51,0.08) 74%, transparent 74%), radial-gradient(circle at 32% 40%, #181818 0%, #070707 45%, #000 78%); }
        #menu-blood { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0.5; z-index: 0; pointer-events: none; }
        #menu-screen .title-glitch { font-size: 6.4rem; letter-spacing: 10px; line-height: 0.92; text-align: left; margin-bottom: 2px; text-shadow: 6px 6px 0 #ff0033; }
        #menu-screen .tagline { margin: 8px 0 34px 4px; font-size: 0.95rem; letter-spacing: 5px; }
        #menu-screen .tagline::before { width: 40px; margin: 0 12px 0 0; }
        #menu-screen .tagline::after { width: 40px; margin: 0 0 0 12px; }
        .menu-buttons { display: flex; flex-direction: column; gap: 12px; align-items: stretch; width: 360px; counter-reset: menuidx; }
        .menu-btn { counter-increment: menuidx; display: flex; align-items: baseline; text-align: left; font-size: 1.5rem; }
        .menu-btn::before { content: "0" counter(menuidx); color: #ff0033; font-size: 0.95rem; margin-right: 16px; letter-spacing: 1px; }
        .menu-btn:hover::before { color: #000; }
        .menu-btn.primary { font-size: 1.9rem; border-left-width: 8px; }
        .menu-version { font-family: 'Rajdhani', monospace; letter-spacing: 2px; }

        /* Cards get clipped corners + red glow (filter, so the glow survives the clip) */
        .char-card, .stage-card { clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 14px, 100% 100%, 14px 100%, 0 calc(100% - 14px)); transition: 0.15s; }
        .char-card:hover, .stage-card:hover, .char-card.selected, .stage-card.selected { transform: translateY(-4px); border-color: #ff0033; box-shadow: none; filter: drop-shadow(0 0 14px rgba(255,0,51,0.5)); }

        /* ==================== BOOT SEQUENCE ==================== */
        #boot-screen { position: absolute; inset: 0; z-index: 80; background: #040404; display: flex; align-items: center; justify-content: center; transition: opacity 0.7s ease 0.5s; }
        #boot-screen.revealing { opacity: 0; pointer-events: none; }
        #boot-screen.boot-done { display: none; }
        #boot-canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
        #boot-enter { position: relative; z-index: 2; font-size: 3rem; letter-spacing: 14px; padding: 18px 64px 14px 78px; background: transparent; color: #fff; border: 2px solid #fff; cursor: pointer; transition: 0.2s; animation: bootPulse 1.6s ease-in-out infinite; }
        #boot-enter:hover { background: #ff0033; border-color: #ff0033; color: #000; }
        #boot-enter.gone { opacity: 0; pointer-events: none; transition: opacity 0.25s; animation: none; }
        @keyframes bootPulse { 0%, 100% { box-shadow: 0 0 0 rgba(255,0,51,0); } 50% { box-shadow: 0 0 34px rgba(255,0,51,0.55); } }
        #boot-screen.punched { animation: bootShake 0.2s; }
        @keyframes bootShake { 0% { transform: translate(0, 0); } 25% { transform: translate(-13px, 9px); } 50% { transform: translate(10px, -7px); } 75% { transform: translate(-6px, 4px); } 100% { transform: translate(0, 0); } }
        #boot-screen.punched::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(circle at var(--fx, 50%) var(--fy, 50%), rgba(255,255,255,0.9), rgba(255,255,255,0) 42%); animation: bootFlash 0.24s forwards; }
        @keyframes bootFlash { to { opacity: 0; } }

        /* Fix: the legacy sheen effect also used .menu-btn::before (absolutely positioned
           off-screen) — fully reset it so the index number renders inline instead. */
        .menu-btn::before { position: static; left: auto; top: auto; width: auto; height: auto; transform: none; background: none; transition: none; }
        .menu-btn { min-width: 0; backdrop-filter: none; }

        /* tagline removed — keep a breath of space between the title and the menu */
        #menu-screen .menu-buttons { margin-top: 34px; }
