/* ============================================================
   PIXEL ARENA — '90s ARCADE CABINET UI
   Palette: charcoal plastic, warm cream text, muted red/amber/blue/green
============================================================ */
:root {
    --chassis-1: #1a1815;
    --chassis-2: #252220;
    --chassis-3: #0e0d0c;
    --metal-1: #6a6863;
    --metal-2: #48463f;
    --metal-3: #2a2824;
    --screen-bg: #0c1210;
    --screen-ink: #efe6d1;
    --screen-dim: #9a9079;
    --red: #c13a2a;
    --red-glow: #e85540;
    --amber: #d89b2a;
    --amber-glow: #ffc04a;
    --blue: #2d7fb8;
    --blue-glow: #5cbaf0;
    --green: #6a9c3a;
    --green-glow: #9ee04a;
    --label: #b8ad93;
    --line: #0a0908;
    /* Aliases for game code compatibility */
    --bg: var(--screen-bg);
    --ink: var(--screen-ink);
    --accent: var(--red-glow);
    --accent2: var(--amber-glow);
    --ok: var(--green-glow);
    --danger: var(--red-glow);
    --muted: var(--screen-dim);
}

/* Themed scrollbars */
.panel::-webkit-scrollbar,
.players::-webkit-scrollbar { width: 6px; }
.panel::-webkit-scrollbar-track,
.players::-webkit-scrollbar-track { background: var(--chassis-3); }
.panel::-webkit-scrollbar-thumb,
.players::-webkit-scrollbar-thumb { background: var(--metal-2); border-radius: 3px; }
.panel::-webkit-scrollbar-thumb:hover,
.players::-webkit-scrollbar-thumb:hover { background: var(--amber-glow); }
.panel, .players { scrollbar-width: thin; scrollbar-color: var(--metal-2) var(--chassis-3); }

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    height: 100%;
    background: #0a0908;
    color: var(--screen-ink);
    overflow: hidden;
    font-family: 'Barlow', 'Barlow Condensed', system-ui, sans-serif;
}

button,
input {
    font: inherit;
    color: inherit;
}

/* ===== CABINET CHASSIS ===== */
#app {
    position: fixed;
    inset: 0;
    display: grid;
    grid-template-columns: 220px 1fr 220px;
    grid-template-rows: 1fr minmax(140px, 160px);
    gap: 0;
    background:
        repeating-linear-gradient(
            92deg,
            rgba(255, 255, 255, 0.015) 0 1px,
            transparent 1px 4px
        ),
        repeating-linear-gradient(
            0deg,
            rgba(0, 0, 0, 0.1) 0 1px,
            transparent 1px 3px
        ),
        linear-gradient(180deg, #211e1b 0%, #1a1815 45%, #14110f 100%);
    padding: 14px;
    overflow: hidden;
}
#app::before {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(
        180deg,
        rgba(255, 240, 200, 0.06) 0%,
        transparent 22%
    );
    z-index: 1;
}
#app::after {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: radial-gradient(
        140% 90% at 50% 110%,
        rgba(0, 0, 0, 0.55),
        transparent 60%
    );
    z-index: 1;
}

/* ===== SIDE PANELS ===== */
.side {
    position: relative;
    z-index: 2;
    background: linear-gradient(180deg, #2a2724 0%, #1a1815 50%, #100e0d 100%);
    border: 1px solid #000;
    border-radius: 6px;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.06),
        inset 0 -2px 0 rgba(0, 0, 0, 0.55),
        inset 2px 0 0 rgba(0, 0, 0, 0.4),
        inset -2px 0 0 rgba(0, 0, 0, 0.4);
    padding: 18px 16px;
    display: flex;
    flex-direction: column;
    gap: 18px;
    grid-row: 1/3;
    overflow: hidden;
}
.side::before,
.side::after {
    content: '';
    position: absolute;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: radial-gradient(
        circle at 35% 30%,
        #7a7670,
        #3a3632 55%,
        #0e0c0b 100%
    );
    box-shadow:
        inset 0 -1px 1px rgba(0, 0, 0, 0.6),
        0 1px 0 rgba(255, 255, 255, 0.04);
}
.side::before {
    top: 8px;
    left: 8px;
}
.side::after {
    top: 8px;
    right: 8px;
}
.side .screws-bottom {
    position: absolute;
    left: 8px;
    right: 8px;
    bottom: 8px;
    display: flex;
    justify-content: space-between;
    pointer-events: none;
}
.screw {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: radial-gradient(
        circle at 35% 30%,
        #7a7670,
        #3a3632 55%,
        #0e0c0b 100%
    );
    box-shadow:
        inset 0 -1px 1px rgba(0, 0, 0, 0.6),
        0 1px 0 rgba(255, 255, 255, 0.04);
    position: relative;
}
.screw::after {
    content: '';
    position: absolute;
    inset: 3px;
    border-top: 1px solid rgba(0, 0, 0, 0.55);
    transform: rotate(28deg);
}
.side.left {
    grid-column: 1;
}
.side.right {
    grid-column: 3;
}

/* Speaker grille */
.speaker {
    position: relative;
    height: 130px;
    background: #0a0908;
    border: 1px solid #000;
    border-radius: 4px;
    box-shadow:
        inset 0 2px 4px rgba(0, 0, 0, 0.8),
        inset 0 -1px 0 rgba(255, 255, 255, 0.04);
    background-image: radial-gradient(
        circle at 50% 50%,
        #1c1a18 1.6px,
        transparent 1.8px
    );
    background-size: 8px 8px;
    background-position: 4px 4px;
}
.speaker .ring {
    position: absolute;
    inset: 10px;
    border-radius: 3px;
    border: 1px solid rgba(255, 255, 255, 0.03);
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.8);
}

/* Coin slot */
.coin-slot {
    position: relative;
    height: 70px;
    background: linear-gradient(180deg, #3a3632 0%, #22201d 40%, #0d0c0a 100%);
    border: 1px solid #000;
    border-radius: 3px;
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.1),
        inset 0 -2px 0 rgba(0, 0, 0, 0.6);
}
.coin-slot::before {
    content: '';
    position: absolute;
    left: 50%;
    bottom: 14px;
    transform: translateX(-50%);
    width: 48%;
    height: 6px;
    background: #000;
    border-radius: 1px;
    box-shadow:
        inset 0 2px 2px rgba(80, 60, 40, 0.3),
        0 1px 0 rgba(255, 255, 255, 0.05);
}
.coin-slot .lbl {
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 800;
    font-size: 11px;
    letter-spacing: 0.12em;
    color: var(--label);
    text-transform: uppercase;
}
.coin-slot .val {
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 700;
    font-size: 10px;
    letter-spacing: 0.06em;
    color: #9a8f79;
    position: relative;
    z-index: 1;
}

/* LED indicators */
.led-stack {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.led-row {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 700;
    font-size: 11px;
    letter-spacing: 0.14em;
    color: var(--label);
    text-transform: uppercase;
}
.led {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
    background: #0a0908;
    box-shadow:
        inset 0 1px 2px rgba(0, 0, 0, 0.9),
        inset 0 -1px 0 rgba(255, 255, 255, 0.04);
    position: relative;
}
.led.on-red {
    background: var(--red-glow);
    box-shadow:
        inset 0 1px 2px rgba(0, 0, 0, 0.5),
        0 0 6px var(--red-glow),
        0 0 12px rgba(232, 85, 64, 0.4);
}
.led.on-amber {
    background: var(--amber-glow);
    box-shadow:
        inset 0 1px 2px rgba(0, 0, 0, 0.5),
        0 0 6px var(--amber-glow),
        0 0 12px rgba(255, 192, 74, 0.4);
}
.led.on-green {
    background: var(--green-glow);
    box-shadow:
        inset 0 1px 2px rgba(0, 0, 0, 0.5),
        0 0 6px var(--green-glow),
        0 0 12px rgba(158, 224, 74, 0.4);
}
.led.on-blue {
    background: var(--blue-glow);
    box-shadow:
        inset 0 1px 2px rgba(0, 0, 0, 0.5),
        0 0 6px var(--blue-glow),
        0 0 12px rgba(92, 186, 240, 0.4);
}
.led.blink {
    animation: blink 1.4s steps(2, end) infinite;
}
@keyframes blink {
    0%,
    50% {
        opacity: 1;
    }
    50.01%,
    100% {
        opacity: 0.35;
    }
}

/* Plate label */
.plate {
    background: linear-gradient(180deg, #4a463f 0%, #2a2824 100%);
    border: 1px solid #000;
    border-radius: 2px;
    padding: 6px 10px;
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 800;
    font-size: 12px;
    letter-spacing: 0.16em;
    color: #e6d9b6;
    text-transform: uppercase;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.08),
        0 1px 0 rgba(0, 0, 0, 0.6);
    text-shadow: 0 1px 0 rgba(0, 0, 0, 0.5);
}

/* Cabinet logo marquee */
.marquee {
    margin-top: auto;
    padding: 10px;
    background: #0a0908;
    border: 1px solid #000;
    border-radius: 3px;
    text-align: center;
    box-shadow: inset 0 0 8px rgba(255, 180, 60, 0.08);
}
.marquee .title-mini {
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 900;
    font-size: 22px;
    line-height: 1;
    letter-spacing: 0.04em;
    color: var(--amber-glow);
    text-shadow:
        0 0 4px rgba(255, 192, 74, 0.5),
        0 0 12px rgba(255, 140, 40, 0.3);
    text-transform: uppercase;
}
.marquee .title-mini .ar {
    color: var(--red-glow);
    text-shadow: 0 0 4px rgba(232, 85, 64, 0.5);
}
.marquee .sub {
    margin-top: 4px;
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 700;
    font-size: 9px;
    letter-spacing: 0.3em;
    color: #7a715e;
    text-transform: uppercase;
}

/* Joystick */
.joystick-plate {
    position: relative;
    height: 140px;
    background: linear-gradient(180deg, #3a3632, #1c1a18);
    border: 1px solid #000;
    border-radius: 6px;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.06),
        inset 0 -2px 0 rgba(0, 0, 0, 0.5);
    display: grid;
    place-items: center;
}
.joystick-plate .base {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: radial-gradient(circle at 40% 30%, #2a2824, #0a0908 70%);
    box-shadow:
        inset 0 0 0 2px #000,
        inset 0 2px 4px rgba(0, 0, 0, 0.9),
        0 2px 0 rgba(255, 255, 255, 0.04);
    position: relative;
}
.joystick-plate .stick {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -70%);
    width: 8px;
    height: 34px;
    background: linear-gradient(90deg, #2a2824, #5a5652 50%, #1a1815);
    border-radius: 2px;
}
.joystick-plate .ball {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -120%);
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: radial-gradient(
        circle at 35% 30%,
        #e85540,
        #9c2a1d 60%,
        #3a0f08 100%
    );
    box-shadow:
        inset -2px -2px 6px rgba(0, 0, 0, 0.6),
        0 3px 0 rgba(0, 0, 0, 0.5);
}
.joystick-plate .lbl {
    position: absolute;
    bottom: 6px;
    left: 0;
    right: 0;
    text-align: center;
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 800;
    font-size: 10px;
    letter-spacing: 0.2em;
    color: var(--label);
    text-transform: uppercase;
}

/* ===== CRT SCREEN AREA ===== */
.crt-bezel {
    position: relative;
    z-index: 2;
    grid-column: 2;
    grid-row: 1;
    margin: 0 10px 10px;
    background: linear-gradient(180deg, #1a1815 0%, #0e0c0b 100%);
    border: 1px solid #000;
    border-radius: 14px;
    padding: 22px;
    box-shadow:
        inset 0 2px 0 rgba(255, 255, 255, 0.07),
        inset 0 -3px 0 rgba(0, 0, 0, 0.7),
        inset 0 0 0 2px #000,
        0 10px 40px rgba(0, 0, 0, 0.6);
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}
.crt-bezel::before {
    content: '';
    position: absolute;
    inset: 12px;
    border-radius: 8px;
    pointer-events: none;
    background:
        repeating-linear-gradient(
            90deg,
            rgba(255, 255, 255, 0.02) 0 1px,
            transparent 1px 2px
        ),
        linear-gradient(180deg, #3a3632, #1c1a18);
    border: 1px solid #000;
    box-shadow:
        inset 0 2px 2px rgba(255, 255, 255, 0.05),
        inset 0 -2px 4px rgba(0, 0, 0, 0.7);
    z-index: -1;
}
.crt {
    position: relative;
    flex: 1;
    background: radial-gradient(
        120% 80% at 50% 45%,
        #14201a 0%,
        #0a110d 70%,
        #050806 100%
    );
    border-radius: 22px / 18px;
    border: 1px solid #000;
    box-shadow:
        inset 0 0 0 3px #0a0908,
        inset 0 0 60px rgba(0, 0, 0, 0.8),
        inset 0 8px 30px rgba(0, 0, 0, 0.9);
    overflow: hidden;
    padding: 36px 42px;
}
.crt::before {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 2;
    background: repeating-linear-gradient(
        0deg,
        rgba(0, 0, 0, 0.22) 0 1px,
        transparent 1px 3px
    );
    mix-blend-mode: multiply;
}
.crt::after {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 2;
    background:
        radial-gradient(
            110% 70% at 50% 50%,
            transparent 55%,
            rgba(0, 0, 0, 0.5) 100%
        ),
        linear-gradient(180deg, rgba(255, 240, 200, 0.025), transparent 30%);
    animation: crt-breathe 5.5s ease-in-out infinite;
}
@keyframes crt-breathe {
    0%,
    100% {
        filter: brightness(1);
    }
    50% {
        filter: brightness(1.05);
    }
}
.crt .flicker {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 2;
    background: rgba(255, 255, 255, 0.02);
    animation: flick 7s infinite;
}
@keyframes flick {
    0%,
    94%,
    100% {
        opacity: 0;
    }
    95% {
        opacity: 1;
    }
    96% {
        opacity: 0;
    }
    97% {
        opacity: 0.6;
    }
    98% {
        opacity: 0;
    }
}

/* Screen content wrapper */
.screen {
    position: relative;
    z-index: 10;
    height: 100%;
    min-height: 0;
    display: flex;
    flex-direction: column;
    font-family: 'Barlow Condensed', sans-serif;
    color: var(--screen-ink);
    overflow: hidden;
}
.screen.hide {
    display: none !important;
}

/* ===== START SCREEN ===== */
#startScreen {
    justify-content: center;
}
#startScreen .crt-footer {
    margin-top: auto;
}

/* ===== JOIN SCREEN ===== */
#joinScreen {
    justify-content: center;
    align-items: center;
}
#joinScreen .crt-header {
    width: 100%;
    flex-shrink: 0;
}
#joinScreen .crt-footer {
    width: 100%;
    margin-top: auto;
    flex-shrink: 0;
}
.join-form {
    width: 100%;
    max-width: 440px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 16px 0 0;
}
.join-form .field-block {
    margin-bottom: 14px;
}
.join-form .row {
    flex-wrap: nowrap;
}

/* ===== START SCREEN ===== */
.crt-title {
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 900;
    font-size: clamp(48px, 7vw, 92px);
    line-height: 0.9;
    letter-spacing: -0.01em;
    margin: 0;
    color: var(--screen-ink);
    text-shadow:
        2px 0 0 rgba(193, 58, 42, 0.55),
        -2px 0 0 rgba(45, 127, 184, 0.5),
        0 0 18px rgba(255, 240, 200, 0.15);
}
.crt-title .ar {
    color: var(--amber-glow);
    text-shadow:
        2px 2px 0 rgba(193, 58, 42, 0.9),
        0 0 18px rgba(255, 192, 74, 0.35);
}
.crt-sub {
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 700;
    font-size: 14px;
    letter-spacing: 0.3em;
    margin: 6px 0 0;
    color: var(--screen-dim);
    text-transform: uppercase;
}
.insert-coin {
    margin-top: 18px;
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 900;
    font-size: 22px;
    letter-spacing: 0.3em;
    color: var(--amber-glow);
    text-transform: uppercase;
    animation: insert 1.1s steps(2, end) infinite;
    text-shadow: 0 0 10px rgba(255, 192, 74, 0.4);
}
@keyframes insert {
    0%,
    50% {
        opacity: 1;
    }
    50.01%,
    100% {
        opacity: 0.15;
    }
}
.menu-stack {
    margin-top: 26px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    max-width: 420px;
}
.menu-item {
    display: flex;
    align-items: center;
    gap: 14px;
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 900;
    font-size: 28px;
    letter-spacing: 0.05em;
    color: var(--screen-ink);
    text-transform: uppercase;
    cursor: pointer;
    padding: 6px 0;
    background: transparent;
    border: 0;
    text-align: left;
}
.menu-item .arrow {
    color: var(--amber-glow);
    opacity: 0;
    transform: translateX(-6px);
    transition: all 0.1s;
}
.menu-item:hover {
    color: var(--amber-glow);
    text-shadow: 0 0 10px rgba(255, 192, 74, 0.4);
}
.menu-item:hover .arrow {
    opacity: 1;
    transform: translateX(0);
}
.menu-item .hotkey {
    font-size: 12px;
    color: var(--screen-dim);
    letter-spacing: 0.2em;
    margin-left: auto;
    font-weight: 700;
}
.crt-footer {
    margin-top: auto;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 700;
    font-size: 12px;
    letter-spacing: 0.22em;
    color: var(--screen-dim);
    text-transform: uppercase;
}
.crt-footer .credits {
    color: var(--amber-glow);
}

/* ===== JOIN / LOBBY ===== */
.crt-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    border-bottom: 2px solid rgba(239, 230, 209, 0.18);
    padding-bottom: 10px;
    margin-bottom: 12px;
    flex-shrink: 0;
}
.crt-h2 {
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 900;
    font-size: 44px;
    line-height: 1;
    letter-spacing: 0.02em;
    margin: 0;
    text-transform: uppercase;
    color: var(--screen-ink);
}
.crt-h2 .ar {
    color: var(--amber-glow);
}
.crt-kicker {
    font-weight: 700;
    font-size: 12px;
    letter-spacing: 0.25em;
    color: var(--screen-dim);
    text-transform: uppercase;
    margin: 0 0 2px;
}
.field-block {
    margin-bottom: 18px;
}
.field-block > .label {
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 800;
    font-size: 12px;
    letter-spacing: 0.24em;
    color: var(--label);
    text-transform: uppercase;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.field-block > .label::before {
    content: '';
    width: 6px;
    height: 6px;
    background: var(--amber-glow);
    display: inline-block;
}
.input {
    width: 100%;
    background: #07100c;
    border: 1px solid #000;
    border-radius: 2px;
    padding: 10px 12px;
    font-family: 'VT323', 'Courier New', monospace;
    font-size: 22px;
    letter-spacing: 0.12em;
    color: var(--amber-glow);
    box-shadow:
        inset 0 2px 0 rgba(0, 0, 0, 0.7),
        inset 0 -1px 0 rgba(255, 255, 255, 0.03),
        inset 0 0 14px rgba(0, 60, 30, 0.3);
    outline: none;
    caret-color: var(--amber-glow);
}
.input::placeholder {
    color: #5a5346;
}
.input:focus {
    box-shadow:
        inset 0 2px 0 rgba(0, 0, 0, 0.7),
        inset 0 0 0 1px var(--amber-glow),
        inset 0 0 14px rgba(255, 192, 74, 0.2);
}
.roomcode {
    background: #07100c;
    border: 1px solid #000;
    padding: 18px 20px;
    text-align: center;
    font-family: 'VT323', 'Courier New', monospace;
    font-size: clamp(44px, 7vw, 80px);
    letter-spacing: 0.2em;
    color: var(--amber-glow);
    text-shadow:
        0 0 12px rgba(255, 192, 74, 0.5),
        0 0 22px rgba(255, 140, 40, 0.25);
    box-shadow:
        inset 0 2px 0 rgba(0, 0, 0, 0.8),
        inset 0 -2px 0 rgba(255, 255, 255, 0.03),
        inset 0 0 22px rgba(0, 60, 30, 0.4);
    user-select: all;
}
.lobby-grid {
    display: grid;
    grid-template-columns: 1fr 1.1fr;
    gap: 16px;
    flex: 1;
    min-height: 0;
    overflow: visible;
}
.panel {
    background: rgba(10, 18, 14, 0.55);
    border: 1px solid rgba(239, 230, 209, 0.15);
    border-radius: 3px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
}
.panel .phead {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 800;
    font-size: 13px;
    letter-spacing: 0.26em;
    color: var(--label);
    text-transform: uppercase;
    margin-bottom: 12px;
}
.panel .phead .dot {
    width: 8px;
    height: 8px;
    background: var(--green-glow);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--green-glow);
    animation: blink 1.2s steps(2, end) infinite;
}
.avatar-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 6px;
    margin: 4px 0 2px;
}
.avatar-btn {
    aspect-ratio: 1/1;
    background: #07100c;
    border: 1px solid #000;
    border-radius: 2px;
    color: var(--screen-ink);
    font-family: 'VT323', monospace;
    font-size: 26px;
    display: grid;
    place-items: center;
    cursor: pointer;
    box-shadow:
        inset 0 2px 0 rgba(0, 0, 0, 0.7),
        inset 0 -1px 0 rgba(255, 255, 255, 0.03);
    transition: all 0.08s;
}
.avatar-btn:hover {
    color: var(--amber-glow);
}
.avatar-btn.sel {
    background: #1a1410;
    color: var(--amber-glow);
    box-shadow:
        inset 0 0 0 2px var(--amber-glow),
        inset 0 0 10px rgba(255, 192, 74, 0.25);
}
.players {
    display: flex;
    flex-direction: column;
    gap: 6px;
    overflow: auto;
    min-height: 0;
}
.player {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #07100c;
    border: 1px solid #000;
    padding: 8px 10px;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.04),
        inset 0 -1px 0 rgba(0, 0, 0, 0.6);
}
.player .avatar {
    width: 32px;
    height: 32px;
    background: #1a1410;
    border: 1px solid #000;
    display: grid;
    place-items: center;
    font-family: 'VT323', monospace;
    font-size: 20px;
    box-shadow: inset 0 0 0 1px rgba(239, 230, 209, 0.06);
}
.player .name {
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 800;
    font-size: 17px;
    letter-spacing: 0.04em;
    color: var(--screen-ink);
    text-transform: uppercase;
    line-height: 1;
}
.player .host-tag {
    display: inline-block;
    margin-top: 3px;
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 800;
    font-size: 9px;
    letter-spacing: 0.22em;
    color: var(--amber-glow);
    text-transform: uppercase;
}
.player .ready {
    margin-left: auto;
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 800;
    font-size: 11px;
    letter-spacing: 0.2em;
    color: var(--red-glow);
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 6px;
}
.player .ready::before {
    content: '';
    width: 7px;
    height: 7px;
    background: var(--red-glow);
    border-radius: 50%;
    box-shadow: 0 0 6px var(--red-glow);
}
.player.ready .ready {
    color: var(--green-glow);
}
.player.ready .ready::before {
    background: var(--green-glow);
    box-shadow: 0 0 6px var(--green-glow);
}
.code-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 20px;
    align-items: center;
    margin-bottom: 20px;
}
.code-row.hide {
    display: none !important;
}
.code-meta .kicker {
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 800;
    font-size: 12px;
    letter-spacing: 0.26em;
    color: var(--label);
    text-transform: uppercase;
    margin-bottom: 4px;
}
.roomcode-row {
    display: flex;
    align-items: stretch;
    gap: 0;
}
.roomcode-row .roomcode {
    flex: 1;
    border-right: none;
}
.copy-btn {
    background: linear-gradient(180deg, #2a4a38 0%, #162a20 100%);
    border: 1px solid #000;
    border-left: 1px solid rgba(158, 224, 74, 0.15);
    color: var(--green-glow);
    font-size: 13px;
    letter-spacing: 0.18em;
    padding: 0 16px;
    flex-shrink: 0;
    white-space: nowrap;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.06),
        inset 0 -2px 0 rgba(0, 0, 0, 0.6),
        0 2px 0 rgba(0, 0, 0, 0.7);
}
.copy-btn:hover {
    background: linear-gradient(180deg, #3a6048 0%, #1e3a2a 100%);
    color: #fff;
}
.copy-btn.copied {
    color: var(--amber-glow);
    background: linear-gradient(180deg, #3a3010 0%, #1e1a08 100%);
}
.hint {
    font-size: 12px;
    color: var(--screen-dim);
    line-height: 1.4;
    margin-top: 10px;
    max-width: 360px;
}
.net-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 800;
    font-size: 11px;
    letter-spacing: 0.22em;
    color: var(--label);
    text-transform: uppercase;
    background: #07100c;
    border: 1px solid #000;
    padding: 6px 10px;
}
.net-status .led {
    width: 8px;
    height: 8px;
}
.hint-line {
    margin-top: 10px;
    font-size: 12px;
    color: var(--screen-dim);
}

/* ===== MODE PICKER (host only) ===== */
.mode-picker {
    margin-top: 14px;
}
.mode-picker > .label {
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 800;
    font-size: 11px;
    letter-spacing: 0.24em;
    color: var(--label);
    text-transform: uppercase;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.mode-picker > .label::before {
    content: '';
    width: 6px; height: 6px;
    background: var(--amber-glow);
    display: inline-block;
}
.mode-btns {
    display: flex;
    gap: 8px;
}
.mode-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 10px 8px;
    background: #07100c;
    border: 1px solid #1a2418;
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.1s;
}
.mode-btn:hover {
    border-color: var(--amber);
}
.mode-btn.active {
    background: #1a1410;
    border-color: var(--amber-glow);
    box-shadow: inset 0 0 10px rgba(255,192,74,0.15);
}
.mode-btn .mode-icon {
    font-size: 18px;
    line-height: 1;
    color: var(--screen-dim);
}
.mode-btn.active .mode-icon {
    color: var(--amber-glow);
}
.mode-btn .mode-name {
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 900;
    font-size: 14px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--screen-ink);
}
.mode-btn .mode-desc {
    font-family: 'Barlow Condensed', sans-serif;
    font-size: 10px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--screen-dim);
}

/* Make left panel's fighter picker flex-grow so avatar grid is always visible */
.fighter-block {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    margin-bottom: 0;
}
.fighter-block .avatar-grid {
    flex-shrink: 0;
}

/* Lobby action bar — always visible at bottom of lobby screen */
.lobby-actions {
    display: flex;
    gap: 10px;
    flex-shrink: 0;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(239, 230, 209, 0.08);
}
.lobby-actions .crt-btn {
    flex: 1;
    text-align: center;
    padding: 10px;
}

/* Mode badge (visible to all players in lobby) */
.mode-badge-row {
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.mode-badge-row.hide { display: none !important; }
.mode-badge {
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 900;
    font-size: 13px;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    padding: 4px 12px;
    border-radius: 2px;
    background: #1a1410;
    border: 1px solid var(--amber-glow);
    color: var(--amber-glow);
    box-shadow: 0 0 8px rgba(255,192,74,0.2);
}
.mode-badge.survival {
    border-color: var(--red-glow);
    color: var(--red-glow);
    background: #1a0808;
    box-shadow: 0 0 8px rgba(232,85,64,0.2);
}

/* Spectate overlay */
#spectateOverlay {
    position: fixed;
    inset: 0;
    z-index: 28;
    pointer-events: none;
    display: none;
}
#spectateOverlay.active { display: block; }
#spectateBar {
    position: absolute;
    bottom: 60px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(10,9,8,0.88);
    border: 1px solid #6a6863;
    padding: 10px 20px;
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 800;
    font-size: 15px;
    letter-spacing: 0.2em;
    color: var(--screen-ink);
    text-transform: uppercase;
    text-align: center;
    border-radius: 3px;
    pointer-events: all;
    display: flex;
    align-items: center;
    gap: 16px;
}
#spectateBar button {
    background: #2a2724;
    border: 1px solid #6a6863;
    color: var(--screen-ink);
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 900;
    font-size: 18px;
    padding: 2px 12px;
    cursor: pointer;
    border-radius: 2px;
}
#spectateBar button:hover { background: #3a3632; }
#spectateLives {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 36px;
    letter-spacing: 6px;
    pointer-events: none;
}

/* Lives display in HUD */
#livesDisplay {
    font-size: 18px;
    letter-spacing: 4px;
    margin-top: 4px;
}
.err-line {
    color: var(--red-glow);
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 700;
    font-size: 12px;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    margin-top: 8px;
    min-height: 14px;
}
.kbd {
    display: inline-block;
    background: #1a1410;
    border: 1px solid #000;
    padding: 1px 6px;
    font-family: 'VT323', monospace;
    font-size: 14px;
    color: var(--amber-glow);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.04),
        0 1px 0 rgba(0, 0, 0, 0.7);
}
.small {
    font-size: 12px;
    color: var(--screen-dim);
    line-height: 1.5;
}

/* ===== CONTROL PANEL (bottom) ===== */
.control-panel {
    position: relative;
    z-index: 2;
    grid-column: 2;
    grid-row: 2;
    margin: 0 10px;
    background:
        repeating-linear-gradient(
            90deg,
            rgba(255, 255, 255, 0.02) 0 1px,
            transparent 1px 2px
        ),
        linear-gradient(180deg, #3a3632 0%, #1a1815 100%);
    border: 1px solid #000;
    border-radius: 8px;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.08),
        inset 0 -2px 0 rgba(0, 0, 0, 0.6),
        0 6px 20px rgba(0, 0, 0, 0.5);
    padding: 18px 24px;
    display: flex;
    align-items: center;
    gap: 18px;
}
.control-panel::before,
.control-panel::after {
    content: '';
    position: absolute;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    top: 8px;
    background: radial-gradient(
        circle at 35% 30%,
        #7a7670,
        #3a3632 55%,
        #0e0c0b 100%
    );
    box-shadow: inset 0 -1px 1px rgba(0, 0, 0, 0.6);
}
.control-panel::before {
    left: 8px;
}
.control-panel::after {
    right: 8px;
}

/* Physical arcade buttons */
.arc-btn {
    position: relative;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    background: transparent;
    border: 0;
    cursor: pointer;
    padding: 0;
    font-family: 'Barlow Condensed', sans-serif;
}
.arc-btn[disabled] {
    opacity: 0.45;
    cursor: not-allowed;
}
.arc-btn .cap {
    width: 62px;
    height: 62px;
    border-radius: 50%;
    background: radial-gradient(
        circle at 35% 28%,
        #f0c062 0%,
        #d89b2a 40%,
        #7a5410 100%
    );
    box-shadow:
        inset 0 -6px 8px rgba(0, 0, 0, 0.5),
        inset 0 4px 6px rgba(255, 255, 255, 0.35),
        0 4px 0 #2a1f0a,
        0 6px 10px rgba(0, 0, 0, 0.5);
    border: 1px solid #000;
    transition:
        transform 0.05s,
        box-shadow 0.05s;
    position: relative;
}
.arc-btn .cap::before {
    content: '';
    position: absolute;
    top: 8px;
    left: 14px;
    width: 18px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.35);
    filter: blur(2px);
}
.arc-btn.red .cap {
    background: radial-gradient(
        circle at 35% 28%,
        #f27060 0%,
        #c13a2a 40%,
        #5a1008 100%
    );
    box-shadow:
        inset 0 -6px 8px rgba(0, 0, 0, 0.5),
        inset 0 4px 6px rgba(255, 255, 255, 0.3),
        0 4px 0 #2a0804,
        0 6px 10px rgba(0, 0, 0, 0.5);
}
.arc-btn.blue .cap {
    background: radial-gradient(
        circle at 35% 28%,
        #6bc4f0 0%,
        #2d7fb8 40%,
        #0a3a5a 100%
    );
    box-shadow:
        inset 0 -6px 8px rgba(0, 0, 0, 0.5),
        inset 0 4px 6px rgba(255, 255, 255, 0.3),
        0 4px 0 #041830,
        0 6px 10px rgba(0, 0, 0, 0.5);
}
.arc-btn.go .cap,
.arc-btn.green .cap {
    background: radial-gradient(
        circle at 35% 28%,
        #b8e06a 0%,
        #6a9c3a 40%,
        #2a4010 100%
    );
    box-shadow:
        inset 0 -6px 8px rgba(0, 0, 0, 0.5),
        inset 0 4px 6px rgba(255, 255, 255, 0.3),
        0 4px 0 #10200a,
        0 6px 10px rgba(0, 0, 0, 0.5);
}
.arc-btn.gray .cap {
    background: radial-gradient(
        circle at 35% 28%,
        #a8a49d 0%,
        #5a5750 40%,
        #1a1815 100%
    );
    box-shadow:
        inset 0 -6px 8px rgba(0, 0, 0, 0.5),
        inset 0 4px 6px rgba(255, 255, 255, 0.2),
        0 4px 0 #0a0908,
        0 6px 10px rgba(0, 0, 0, 0.5);
}
.arc-btn:hover:not([disabled]) .cap {
    filter: brightness(1.08);
}
.arc-btn:active:not([disabled]) .cap {
    transform: translateY(3px);
    box-shadow:
        inset 0 -3px 6px rgba(0, 0, 0, 0.6),
        inset 0 3px 5px rgba(255, 255, 255, 0.2),
        0 1px 0 rgba(0, 0, 0, 0.6);
}
.arc-btn .lbl {
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 900;
    font-size: 11px;
    letter-spacing: 0.18em;
    color: #d6c9a6;
    text-transform: uppercase;
    text-shadow: 0 1px 0 rgba(0, 0, 0, 0.8);
}

/* Textual plate-style buttons (inside CRT) */
.crt-btn {
    position: relative;
    background: linear-gradient(180deg, #4a463f 0%, #2a2824 100%);
    border: 1px solid #000;
    padding: 10px 18px;
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 900;
    font-size: 14px;
    letter-spacing: 0.2em;
    color: #f0e5c8;
    text-transform: uppercase;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.12),
        inset 0 -2px 0 rgba(0, 0, 0, 0.6),
        0 2px 0 rgba(0, 0, 0, 0.7);
    cursor: pointer;
    text-shadow: 0 1px 0 rgba(0, 0, 0, 0.6);
    transition:
        transform 0.05s,
        box-shadow 0.05s;
}
.crt-btn:hover {
    background: linear-gradient(180deg, #58544a 0%, #32302c 100%);
    color: #fff;
}
.crt-btn:active {
    transform: translateY(2px);
    box-shadow:
        inset 0 2px 2px rgba(0, 0, 0, 0.6),
        0 0 0 rgba(0, 0, 0, 0);
}
.crt-btn[disabled] {
    opacity: 0.4;
    cursor: not-allowed;
}
.crt-btn.primary {
    background: linear-gradient(180deg, #e85540 0%, #9c2a1d 100%);
    color: #fff;
    border-color: #000;
}
.crt-btn.primary:hover {
    background: linear-gradient(180deg, #ff6850 0%, #b03020 100%);
}
.crt-btn.go {
    background: linear-gradient(180deg, #9ee04a 0%, #4a7020 100%);
    color: #0c1206;
    border-color: #000;
}
.crt-btn.go:hover {
    background: linear-gradient(180deg, #b4f060 0%, #5a8028 100%);
}

.row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}
.col {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.hide {
    display: none !important;
}

/* ===== GAME / HUD ===== */
#gameWrap {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #050302;
    z-index: 20;
}
#game {
    display: block;
    max-width: 100vw;
    max-height: 100vh;
    image-rendering: pixelated;
    cursor: crosshair;
    background: #0a110d;
}
#hud {
    position: fixed;
    top: 14px;
    left: 14px;
    right: 14px;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 14px;
    pointer-events: none;
    z-index: 3;
}
.hud-panel {
    background: linear-gradient(180deg, #2a2724 0%, #12100e 100%);
    border: 1px solid #000;
    border-radius: 4px;
    padding: 10px 14px;
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 800;
    font-size: 13px;
    letter-spacing: 0.18em;
    color: var(--screen-ink);
    text-transform: uppercase;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.08),
        inset 0 -2px 0 rgba(0, 0, 0, 0.6);
}
.hud-panel .sub {
    font-size: 9px;
    letter-spacing: 0.24em;
    color: var(--label);
    display: block;
    margin-bottom: 4px;
}
#timer {
    justify-self: center;
    min-width: 140px;
    text-align: center;
    font-family: 'VT323', monospace;
    font-size: 34px;
    letter-spacing: 0.2em;
    color: var(--amber-glow);
    text-shadow: 0 0 10px rgba(255, 192, 74, 0.4);
    padding: 6px 18px;
}
#scoreBoard .score-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 2px 0;
}
#scoreBoard .score-row .swatch {
    width: 10px;
    height: 10px;
}
#powerupPanel {
    position: fixed;
    bottom: 14px;
    left: 14px;
    background: linear-gradient(180deg, #2a2724 0%, #12100e 100%);
    border: 1px solid #000;
    border-radius: 4px;
    padding: 8px 12px;
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 800;
    font-size: 11px;
    letter-spacing: 0.18em;
    color: var(--screen-dim);
    text-transform: uppercase;
    pointer-events: none;
    z-index: 3;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.08),
        inset 0 -2px 0 rgba(0, 0, 0, 0.6);
}
#powerupPanel .pup-title {
    font-size: 9px;
    letter-spacing: 0.24em;
    color: var(--label);
    margin-bottom: 4px;
}
#powerupLegend {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

/* End screen */
#endScreen {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 25;
    background: rgba(5, 4, 3, 0.9);
}
.end-card {
    background: linear-gradient(180deg, #2a2724 0%, #12100e 100%);
    border: 1px solid #000;
    border-radius: 10px;
    padding: 32px 40px;
    min-width: 460px;
    text-align: center;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.08),
        inset 0 -3px 0 rgba(0, 0, 0, 0.7),
        0 20px 60px rgba(0, 0, 0, 0.7);
}
.winner {
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 900;
    font-size: 42px;
    letter-spacing: 0.04em;
    color: var(--amber-glow);
    text-transform: uppercase;
    margin: 0 0 8px;
    text-shadow: 2px 2px 0 rgba(193, 58, 42, 0.8);
}
.rank-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 18px 0 24px;
}
.rank-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 14px;
    background: #0a0908;
    border: 1px solid #000;
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 800;
    font-size: 16px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}
.rank-row .pos {
    width: 30px;
    color: var(--amber-glow);
    font-weight: 900;
    font-size: 20px;
}
.rank-row .sc {
    margin-left: auto;
    color: var(--amber-glow);
    font-family: 'VT323', monospace;
    font-size: 22px;
    letter-spacing: 0.12em;
}

/* CRT overlay during game */
#crtGameOverlay {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 4;
    background: repeating-linear-gradient(
        0deg,
        rgba(0, 0, 0, 0.18) 0 1px,
        transparent 1px 3px
    );
    -webkit-mask-image: radial-gradient(
        ellipse 90% 85% at 50% 50%,
        black 60%,
        transparent 100%
    );
    mask-image: radial-gradient(
        ellipse 90% 85% at 50% 50%,
        black 60%,
        transparent 100%
    );
}

/* Global subtle scanline overlay */
body::after {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 50;
    background: repeating-linear-gradient(
        0deg,
        rgba(0, 0, 0, 0.06) 0 1px,
        transparent 1px 3px
    );
    mix-blend-mode: multiply;
}

/* ===== MOBILE JOYSTICK ===== */
#mobileOverlay {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 10;
}
#joystickLeft,
#joystickRight {
    position: absolute;
    bottom: 24px;
    width: 130px;
    height: 130px;
    border-radius: 50%;
    background: rgba(10, 18, 14, 0.55);
    border: 2px solid rgba(239, 230, 209, 0.15);
    pointer-events: all;
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: none;
}
#joystickLeft {
    left: 24px;
}
#joystickRight {
    right: 24px;
}
#joystickLeftKnob,
#joystickRightKnob {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 30%, #4a463f, #1a1815 80%);
    border: 1px solid #000;
    box-shadow:
        inset 0 2px 4px rgba(255, 255, 255, 0.1),
        0 3px 8px rgba(0, 0, 0, 0.6);
    transform: translate(-50%, -50%);
    pointer-events: none;
}
#ultBtn {
    position: absolute;
    top: -64px;
    left: 50%;
    transform: translateX(-50%);
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: radial-gradient(
        circle at 35% 28%,
        #f27060 0%,
        #c13a2a 40%,
        #5a1008 100%
    );
    border: 1px solid #000;
    box-shadow:
        inset 0 -6px 8px rgba(0, 0, 0, 0.5),
        inset 0 4px 6px rgba(255, 255, 255, 0.3),
        0 4px 0 #2a0804,
        0 6px 10px rgba(0, 0, 0, 0.5);
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 900;
    font-size: 13px;
    letter-spacing: 0.18em;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: all;
    touch-action: none;
}

/* Portrait: show rotate hint, hide game */
#rotate-hint {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: #0a0908;
    align-items: center;
    justify-content: center;
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 900;
    font-size: 28px;
    letter-spacing: 0.3em;
    color: var(--amber-glow);
    text-transform: uppercase;
    text-shadow: 0 0 10px rgba(255, 192, 74, 0.4);
    animation: insert 1.1s steps(2, end) infinite;
}
@media (orientation: portrait) and (max-width: 1024px) {
    #rotate-hint {
        display: flex;
    }
    #app,
    #gameWrap {
        display: none !important;
    }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1200px) {
    #app {
        grid-template-columns: 160px 1fr 160px;
        grid-template-rows: 1fr minmax(110px, 140px);
    }
    .speaker {
        height: 100px;
    }
    .joystick-plate {
        height: 120px;
    }
}
@media (max-width: 1000px) {
    #app {
        grid-template-columns: 100px 1fr 100px;
        grid-template-rows: 1fr minmax(100px, 120px);
        padding: 8px;
    }
    .speaker {
        height: 80px;
    }
    .joystick-plate {
        height: 100px;
    }
    .marquee .title-mini {
        font-size: 16px;
    }
    .crt {
        padding: 18px 22px;
    }
    .crt-bezel {
        padding: 14px;
        margin: 0 6px 6px;
    }
    .arc-btn .cap {
        width: 48px;
        height: 48px;
    }
    .control-panel {
        padding: 12px 16px;
    }
}
@media (max-width: 700px) {
    #app {
        grid-template-columns: 52px 1fr 52px;
        grid-template-rows: 1fr minmax(80px, 96px);
        padding: 5px;
        gap: 4px;
    }
    .side > *:not(.screws-bottom) {
        display: none;
    }
    .side {
        padding: 8px 6px;
    }
    .joystick-plate,
    .speaker,
    .coin-slot,
    .led-stack,
    .plate,
    .marquee {
        display: none;
    }
    .arc-btn .cap {
        width: 40px;
        height: 40px;
    }
    .arc-btn .lbl {
        font-size: 9px;
    }
    .crt-title {
        font-size: 44px;
    }
    .crt-bezel {
        padding: 10px;
        margin: 0 3px 3px;
    }
    .crt {
        padding: 14px 16px;
    }
    .control-panel {
        padding: 8px 12px;
        gap: 12px;
    }
    /* Start screen compact */
    .insert-coin {
        margin-top: 10px;
        font-size: 18px;
    }
    .menu-stack {
        margin-top: 14px;
        gap: 8px;
    }
    .menu-item {
        font-size: 22px;
        padding: 4px 0;
    }
    /* Join screen compact */
    .crt-h2 {
        font-size: 34px;
    }
    .join-form {
        padding-top: 10px;
    }
    .join-form .field-block {
        margin-bottom: 10px;
    }
    .join-form .row {
        gap: 8px;
    }
}

/* Short landscape screens (phones in landscape) */
@media (max-height: 520px) and (orientation: landscape) {
    #app {
        grid-template-rows: 1fr 72px;
        padding: 4px;
    }
    .crt-bezel {
        margin-bottom: 4px;
        padding: 12px;
    }
    .control-panel {
        padding: 4px 12px;
    }
    .arc-btn .cap {
        width: 38px;
        height: 38px;
    }
    .arc-btn .lbl {
        display: none;
    }
    .speaker {
        height: 60px;
    }
    .joystick-plate {
        height: 80px;
    }
    .coin-slot {
        height: 50px;
    }
    .led-stack {
        gap: 4px;
    }
    .crt {
        padding: 8px 12px;
    }
    /* Start screen compact */
    .crt-title {
        font-size: clamp(32px, 5vw, 60px);
    }
    .insert-coin {
        margin-top: 6px;
        font-size: 15px;
    }
    .menu-stack {
        margin-top: 8px;
        gap: 6px;
    }
    .menu-item {
        font-size: 20px;
        padding: 2px 0;
    }
    /* Lobby compact */
    .crt-header {
        padding-bottom: 6px;
        margin-bottom: 8px;
    }
    .crt-h2 {
        font-size: 28px;
    }
    .crt-kicker {
        font-size: 10px;
    }
    .lobby-grid {
        gap: 8px;
    }
    .panel {
        padding: 8px;
    }
    .panel .phead {
        font-size: 11px;
        margin-bottom: 6px;
    }
    .field-block {
        margin-bottom: 8px;
    }
    .field-block > .label {
        font-size: 10px;
        margin-bottom: 3px;
    }
    .input {
        font-size: 16px;
        padding: 6px 8px;
    }
    .avatar-grid {
        gap: 4px;
    }
    .avatar-btn {
        font-size: 18px;
    }
    #charDesc {
        display: none;
    }
    .code-row {
        margin-bottom: 8px;
    }
    .roomcode {
        font-size: 32px;
        padding: 8px 12px;
    }
    .hint {
        display: none;
    }
    .hint-line {
        font-size: 10px;
        margin-top: 4px;
    }
    .crt-btn {
        padding: 6px 12px;
        font-size: 12px;
    }
    .player {
        padding: 4px 8px;
    }
    .player .name {
        font-size: 13px;
    }
    .net-status {
        font-size: 9px;
        padding: 4px 8px;
    }
}
