.battle-score-board {
    display: flex; justify-content: space-around; align-items: center;
    padding: 20px 10px; background: rgba(255,255,255,0.03);
    border-bottom: 2px solid rgba(255,255,255,0.1);
}

.p1-stats, .p2-stats { text-align: center; width: 30%; }
.p-avatar { 
    width: 50px; height: 50px; border-radius: 50%; border: 2px solid; 
    margin: 0 auto 5px; display: flex; align-items: center; justify-content: center;
}
.p-name { font-size: 12px; color: #8899a6; overflow: hidden; text-overflow: ellipsis; }
.p-score { font-size: 28px; font-weight: 900; color: #fff; }

.vs-center { text-align: center; }
.vs-text { font-style: italic; font-weight: 900; color: #ffcc00; font-size: 18px; }
#battle-timer-text { 
    font-size: 20px; color: #ff0055; font-weight: bold; 
    background: rgba(255,0,85,0.1); padding: 5px 10px; border-radius: 10px;
}

.battle-question-container { padding: 20px; margin-top: 20px; }
.q-header { color: #00e5ff; font-weight: bold; margin-bottom: 10px; font-size: 14px; }
.battle-q-text { font-size: 20px; line-height: 1.4; margin-bottom: 30px; font-weight: 600; }

.battle-options-grid { display: grid; gap: 12px; }
.battle-opt {
    background: #111420; border: 1px solid rgba(255,255,255,0.1);
    padding: 15px; border-radius: 12px; font-size: 16px;
    transition: all 0.2s; cursor: pointer;
}
.battle-opt:active {
    transform: scale(0.96);
    background: #1c2238;
}

.battle-opt:hover {
    border-color: #00e5ff;
    box-shadow: 0 0 10px rgba(0,229,255,0.4);
}

.battle-opt.selected {
    border-color: #ffcc00;
    background: rgba(255,204,0,0.1);
    color: #ffcc00;
}

.battle-progress-wrap {
    position: fixed; bottom: 0; left: 0; width: 100%; height: 6px; background: #222;
}
.battle-progress-fill {
    width: 0%; height: 100%; background: linear-gradient(90deg, #00e5ff, #00e676);
    transition: width 0.3s;
}

/* ── BATTLE ARENA SCORE ANIMATION ── */
#arena-p1-score, #arena-p2-score {
    transition: transform 0.3s, color 0.3s;
}

/* ── BATTLE RESULT SCREEN ── */
#screen-battle-result {
    background: #0a0a12;
    color: white;
}

/* ── BATTLE LOBBY CARD ── */
.battle-entry-card {
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
}
.battle-entry-card:active {
    transform: scale(0.98);
}

/* ══════════════════════════════════════════════
   ROOM SYSTEM — CSS
   Room Create, Join screens + OTP input
══════════════════════════════════════════════ */

/* ── Room Screens base ── */
#screen-room-create,
#screen-room-join {
    background: #0a0a12;
    color: white;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}

/* ── Room Code Display ── */
#room-code-display {
    font-size: 48px;
    font-weight: 900;
    color: #00ff88;
    letter-spacing: 10px;
    font-family: 'Baloo 2', cursive;
    text-shadow: 0 0 30px rgba(0, 255, 136, 0.5),
                 0 0 60px rgba(0, 255, 136, 0.2);
    animation: code-glow 2s ease-in-out infinite alternate;
}

@keyframes code-glow {
    from { text-shadow: 0 0 20px rgba(0,255,136,0.4); }
    to   { text-shadow: 0 0 40px rgba(0,255,136,0.8), 0 0 80px rgba(0,255,136,0.3); }
}

/* ── OTP Input Boxes ── */
#screen-room-join input[type="text"] {
    width: 58px;
    height: 64px;
    background: #0d1117;
    border: 2px solid #30363d;
    border-radius: 14px;
    color: #00ff88;
    font-size: 30px;
    font-weight: 900;
    text-align: center;
    font-family: 'Baloo 2', cursive;
    transition: border-color 0.2s, box-shadow 0.2s;
    -webkit-appearance: none;
}

#screen-room-join input[type="text"]:focus {
    border-color: #00e5ff;
    box-shadow: 0 0 0 3px rgba(0, 229, 255, 0.2);
    outline: none;
}

#screen-room-join input[type="text"].filled {
    border-color: #00ff88;
    box-shadow: 0 0 0 3px rgba(0, 255, 136, 0.15);
}

/* ── Room Buttons ── */
.room-btn-create {
    flex: 1;
    padding: 15px;
    border-radius: 14px;
    background: linear-gradient(135deg, #0d2b0d, #0f3d0f);
    color: #00ff88;
    border: 2px solid #00ff88;
    font-weight: 900;
    font-size: 15px;
    cursor: pointer;
    font-family: 'Baloo 2', cursive;
    transition: all 0.2s;
    box-shadow: 0 4px 15px rgba(0, 255, 136, 0.15);
}
.room-btn-create:active { transform: scale(0.96); }

.room-btn-join {
    flex: 1;
    padding: 15px;
    border-radius: 14px;
    background: linear-gradient(135deg, #0d1a2b, #0d243d);
    color: #00e5ff;
    border: 2px solid #00e5ff;
    font-weight: 900;
    font-size: 15px;
    cursor: pointer;
    font-family: 'Baloo 2', cursive;
    transition: all 0.2s;
    box-shadow: 0 4px 15px rgba(0, 229, 255, 0.15);
}
.room-btn-join:active { transform: scale(0.96); }

/* ── Room Card (players list) ── */
.room-player-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: #0d1117;
    border-radius: 12px;
    border: 1px solid #30363d;
    margin-bottom: 8px;
    transition: border-color 0.3s;
}
.room-player-card.joined {
    border-color: #00ff88;
    background: rgba(0, 255, 136, 0.05);
}

/* ── Start Game Button (disabled state) ── */
#btn-start-room-game:disabled {
    background: #1a1a1a !important;
    color: #444 !important;
    border: 2px solid #2a2a2a !important;
    cursor: not-allowed;
    box-shadow: none;
}
#btn-start-room-game:not(:disabled) {
    animation: pulse-btn 1.5s ease-in-out infinite;
}
@keyframes pulse-btn {
    0%, 100% { box-shadow: 0 5px 20px rgba(248,81,73,0.3); }
    50%       { box-shadow: 0 5px 35px rgba(248,81,73,0.6); }
}

/* ── Room Join Button ── */
#btn-join-room {
    transition: all 0.2s;
}
#btn-join-room:active  { transform: scale(0.97); }
#btn-join-room:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ── Searching animation (already exists, but ensure) ── */
@keyframes pulse-search {
    0%   { opacity: 1; transform: scale(1); }
    100% { opacity: 0.5; transform: scale(0.92); }
}
.searching-anim {
    animation: pulse-search 1s ease-in-out infinite alternate;
}

/* ── Room tip box ── */
.room-tip-box {
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 14px;
    padding: 16px;
    font-size: 12px;
    color: #8b949e;
    text-align: center;
    line-height: 2;
    margin-top: 16px;
}

/* ── Back button in dark screens ── */
#screen-room-create .back-dark,
#screen-room-join .back-dark {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

/* ── Room error message ── */
#room-join-error {
    color: #f85149;
    font-size: 13px;
    margin-bottom: 14px;
    padding: 8px 14px;
    background: rgba(248, 81, 73, 0.1);
    border-radius: 8px;
    border: 1px solid rgba(248, 81, 73, 0.3);
}

/* ── Room loading message ── */
#room-join-loading {
    color: #8b949e;
    font-size: 13px;
    margin-bottom: 14px;
    padding: 8px 14px;
    background: rgba(255,255,255,0.04);
    border-radius: 8px;
}

/* ── Copy code button ── */
.copy-code-btn {
    margin-top: 14px;
    padding: 10px 24px;
    border-radius: 10px;
    background: rgba(0, 255, 136, 0.12);
    border: 1px solid #00ff88;
    color: #00ff88;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.2s;
}
.copy-code-btn:active {
    background: rgba(0, 255, 136, 0.25);
    transform: scale(0.96);
}

/* ── Mobile: screens stack full height on small devices ── */
@media (max-height: 700px) {
    #screen-room-create,
    #screen-room-join {
        padding: 20px 16px;
    }
    #room-code-display { font-size: 38px; letter-spacing: 6px; }
    #screen-room-join input[type="text"] { width: 50px; height: 56px; font-size: 26px; }
}

#screen-battle-arena .battle-opt,
#screen-battle-arena .battle-opt * {
    color: #ffffff !important;
}

.battle-opt {
    display: flex;
    align-items: center;
    gap: 10px;
}

.battle-opt strong {
    margin-right: 10px;
}
