:root {
    --primary: #ff0055;
    --primary-dark: #cc0044;
    --secondary: #2b1055;
    --accent: #00d4ff;
    --success: #3b82f6;
    --danger: #ff3333;
    --text: #ffffff;
    --bg-gradient: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    --card-bg: rgba(255, 255, 255, 0.1);
    --font-main: 'Poppins', sans-serif;
}

* {
    box-sizing: border-box;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

body {
    margin: 0;
    padding: 0;
    font-family: var(--font-main);
    background: var(--bg-gradient);
    color: var(--text);
    min-height: 100vh;
    min-height: 100dvh; /* Dynamic viewport height for mobile */
    overflow-x: hidden;
    overflow-y: auto;
}

#app {
    min-height: 100vh;
    min-height: 100dvh;
    width: 100%;
    position: relative;
}

.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    display: none;
    flex-direction: column;
    align-items: center;
    padding: clamp(15px, 4vw, 30px);
    padding-top: clamp(15px, 3vh, 30px);
    opacity: 0;
    transition: opacity 0.3s ease;
    overflow-y: auto;
    box-sizing: border-box;
}

.screen.active {
    display: flex;
    opacity: 1;
}

/* --- Shared UI --- */
.logo {
    font-size: clamp(2rem, 6vw, 3rem);
    font-weight: 800;
    text-transform: uppercase;
    background: linear-gradient(to right, #ff0055, #ffcc00);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: clamp(8px, 2vw, 15px);
    text-shadow: 0 0 20px rgba(255, 0, 85, 0.5);
}

.btn-primary, .btn-secondary, .btn-success, .btn-danger {
    border: none;
    border-radius: 50px;
    padding: clamp(10px, 2.5vw, 14px) clamp(20px, 5vw, 35px);
    font-weight: 800;
    font-size: clamp(1rem, 3vw, 1.2rem);
    cursor: pointer;
    transition: transform 0.1s, filter 0.2s;
    text-transform: uppercase;
    color: white;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.btn-primary { background: linear-gradient(45deg, #ff0055, #ff4444); }
.btn-secondary { background: rgba(255,255,255,0.2); }
.btn-success { background: linear-gradient(45deg, #00b09b, #96c93d); }
.btn-danger { background: linear-gradient(45deg, #ff416c, #ff4b2b); }

.btn-primary:active, .btn-success:active, .btn-danger:active {
    transform: scale(0.95);
}

.hidden { display: none !important; }

/* --- Lobby --- */
#screen-lobby {
    justify-content: flex-start;
    padding-top: clamp(20px, 4vh, 40px);
    gap: clamp(15px, 3vh, 25px);
}

.room-code-display {
    font-size: clamp(1.1rem, 3.5vw, 1.5rem);
    background: rgba(255,255,255,0.1);
    padding: clamp(8px, 2vw, 12px) clamp(15px, 4vw, 25px);
    border-radius: 15px;
    margin-bottom: clamp(15px, 3vh, 30px);
    border: 1px solid rgba(255,255,255,0.2);
}

.player-list-container {
    width: 100%;
    max-width: 600px;
}

.player-list-container h2 {
    font-size: clamp(1.1rem, 3vw, 1.4rem);
    margin-bottom: clamp(10px, 2vh, 15px);
    text-align: center;
}

.player-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    max-width: 600px;
    width: 100%;
}

.player-tag {
    background: rgba(255,255,255,0.15);
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 600;
    animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    align-items: center;
    gap: 6px;
}

.player-tag.kickable {
    padding: 6px 8px 6px 14px;
    transition: background 0.2s;
}

.player-tag.kickable:hover {
    background: rgba(255, 255, 255, 0.22);
}

.player-tag-name {
    flex: 1;
}

.kick-btn {
    background: rgba(255, 50, 50, 0.25);
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: rgba(255, 150, 150, 0.9);
    font-size: 0.7rem;
    font-weight: 900;
    line-height: 1;
    transition: background 0.15s, color 0.15s;
    flex-shrink: 0;
    font-family: var(--font-main);
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    /* Larger invisible tap area for mobile */
    position: relative;
}

.kick-btn:hover {
    background: rgba(255, 50, 50, 0.7);
    color: #fff;
}

/* --- Lobby settings summary (host view) --- */
.lobby-settings-summary {
    width: 100%;
    max-width: 600px;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    padding: 14px 18px 16px;
}

.summary-label {
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: rgba(255, 255, 255, 0.45);
    margin: 0 0 12px 0;
}

.selected-cat-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-start;
}

.selected-cat-tag {
    background: rgba(0, 212, 255, 0.15);
    border: 1px solid rgba(0, 212, 255, 0.3);
    color: rgba(255, 255, 255, 0.9);
    padding: 5px 14px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
}

@keyframes popIn {
    from { transform: scale(0); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(clamp(120px, 30vw, 150px), 1fr));
    gap: clamp(8px, 2vw, 12px);
    margin: clamp(10px, 2vh, 15px) 0;
    max-width: 600px;
    width: 100%;
}

.category-checkbox {
    display: flex;
    align-items: center;
    gap: clamp(6px, 1.5vw, 10px);
    padding: clamp(8px, 2vw, 12px);
    background: rgba(255,255,255,0.1);
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.2s;
}

.category-checkbox:hover {
    background: rgba(255,255,255,0.2);
}

.category-checkbox input[type="checkbox"] {
    width: clamp(18px, 4vw, 22px);
    height: clamp(18px, 4vw, 22px);
    cursor: pointer;
    flex-shrink: 0;
}

.category-checkbox span {
    color: white;
    font-weight: 500;
    font-size: clamp(0.85rem, 2.5vw, 1rem);
}

.settings-group {
    width: 100%;
    max-width: 600px;
}

.settings-group h3 {
    color: white;
    margin-bottom: clamp(8px, 2vw, 12px);
    font-size: clamp(0.95rem, 2.8vw, 1.1rem);
}

.host-controls {
    width: 100%;
    max-width: 600px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
}

.player-msg {
    background: rgba(0, 212, 255, 0.15);
    border: 2px solid rgba(0, 212, 255, 0.3);
    color: rgba(255, 255, 255, 0.9);
    padding: clamp(15px, 3vw, 25px) clamp(20px, 4vw, 35px);
    border-radius: 15px;
    font-size: clamp(1rem, 3vw, 1.3rem);
    font-weight: 600;
    text-align: center;
    animation: pulseGlow 2s ease-in-out infinite;
}

@keyframes pulseGlowMsg {
    0%, 100% { box-shadow: 0 0 10px rgba(0, 212, 255, 0.2); }
    50% { box-shadow: 0 0 20px rgba(0, 212, 255, 0.4); }
}

/* --- Music Toggle Button --- */
.music-toggle-row {
    display: flex;
    justify-content: center;
    margin-top: 4px;
}

.music-toggle-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 30px;
    padding: 9px 20px;
    color: rgba(255, 255, 255, 0.85);
    font-family: var(--font-main);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, opacity 0.2s;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.music-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.15);
}

.music-toggle-btn.music-on {
    border-color: rgba(0, 212, 255, 0.5);
    background: rgba(0, 212, 255, 0.1);
    color: #fff;
}

.music-toggle-btn.music-off {
    opacity: 0.55;
    border-color: rgba(255, 255, 255, 0.1);
}

/* --- Multiple Choice Buttons --- */
.choices-section {
    width: 100%;
    max-width: 500px;
    margin: clamp(15px, 3vh, 25px) auto;
}

.choices-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: clamp(10px, 2vw, 15px);
}

.choice-btn {
    padding: clamp(15px, 3vw, 22px) clamp(12px, 2.5vw, 18px);
    background: linear-gradient(145deg, rgba(255,255,255,0.15), rgba(255,255,255,0.05));
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 15px;
    color: white;
    font-size: clamp(0.9rem, 2.5vw, 1.1rem);
    font-weight: 600;
    font-family: var(--font-main);
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    min-height: clamp(60px, 12vw, 80px);
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

@media (hover: hover) {
    .choice-btn:hover {
        background: linear-gradient(145deg, rgba(0,212,255,0.3), rgba(0,212,255,0.15));
        border-color: var(--accent);
        transform: scale(1.02);
    }
}

.choice-btn:active {
    transform: scale(0.98);
}

.choice-btn.selected {
    background: linear-gradient(145deg, var(--primary), var(--primary-dark));
    border-color: var(--primary);
    box-shadow: 0 0 20px rgba(255, 0, 85, 0.4);
}

.choice-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.choice-btn.correct {
    background: linear-gradient(145deg, rgba(255,255,255,0.95), rgba(230,230,230,0.9));
    border-color: white;
    color: #1a1a2e;
}

.choice-btn.wrong {
    background: linear-gradient(145deg, var(--danger), #cc2222);
    border-color: var(--danger);
}

/* --- OFF THE DOME Overlay --- */
.off-the-dome-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    animation: fadeIn 0.5s ease-out;
}

.off-the-dome-text {
    font-size: clamp(2.5rem, 10vw, 5rem);
    font-weight: 900;
    text-transform: uppercase;
    background: linear-gradient(135deg, #ff0055, #ffcc00, #00d4ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-align: center;
    animation: none;
    margin-bottom: 20px;
}

.off-the-dome-subtitle {
    font-size: clamp(1rem, 3vw, 1.5rem);
    color: rgba(255,255,255,0.8);
    text-align: center;
    animation: fadeInUp 0.5s ease-out 0.3s both;
}

@keyframes offTheDomePulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 0 rgba(255, 80, 120, 0);
    }
    30% {
        transform: scale(1.008);
        box-shadow: 0 0 6px rgba(255, 80, 120, 0.08);
    }
    50% {
        transform: scale(1.015);
        box-shadow: 0 0 10px rgba(255, 80, 120, 0.12);
    }
    70% {
        transform: scale(1.008);
        box-shadow: 0 0 6px rgba(255, 80, 120, 0.08);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- OFF THE DOME indicator badge --- */
.off-the-dome-badge {
    display: inline-block;
    background: linear-gradient(135deg, #ff0055, #ffcc00);
    color: white;
    padding: clamp(6px, 1.5vw, 10px) clamp(12px, 3vw, 20px);
    border-radius: 25px;
    font-size: clamp(0.75rem, 2vw, 0.9rem);
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: clamp(10px, 2vh, 15px);
    vertical-align: middle;
    transform-origin: center;
    will-change: transform, box-shadow;
}

#host-category .off-the-dome-badge {
    animation: none;
}

#player-category .off-the-dome-badge {
    animation: offTheDomePulse 2.8s cubic-bezier(0.45, 0.05, 0.55, 0.95) infinite;
}

.otd-category-label {
    display: inline-block;
    font-size: clamp(0.65rem, 1.6vw, 0.8rem);
    font-weight: 600;
    color: rgba(255,255,255,0.6);
    margin-left: 10px;
    padding: 4px 12px;
    background: rgba(255,255,255,0.1);
    border-radius: 20px;
    vertical-align: middle;
    letter-spacing: 0.5px;
    margin-bottom: clamp(10px, 2vh, 15px);
}

.question-count-control {
    display: flex;
    flex-direction: column;
    gap: clamp(8px, 2vw, 12px);
    align-items: center;
    margin: clamp(10px, 2vh, 15px) 0;
    width: 100%;
}

.question-count-control input[type="range"] {
    width: 100%;
    max-width: 400px;
    height: clamp(6px, 1.5vw, 10px);
    border-radius: 5px;
    background: rgba(255,255,255,0.2);
    outline: none;
    -webkit-appearance: none;
}

.question-count-control input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: clamp(22px, 5vw, 28px);
    height: clamp(22px, 5vw, 28px);
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
}

.question-count-control input[type="range"]::-moz-range-thumb {
    width: clamp(22px, 5vw, 28px);
    height: clamp(22px, 5vw, 28px);
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    border: none;
}

.question-count-display {
    font-size: clamp(1rem, 3vw, 1.2rem);
    font-weight: 600;
    color: white;
}

.answer-section {
    width: 100%;
    max-width: 500px;
    margin: 15px auto;
    padding: clamp(15px, 3vw, 20px);
    background: rgba(0,212,255,0.15);
    border: 2px solid var(--accent);
    border-radius: 15px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

@keyframes pulseGlow {
    0%, 100% { box-shadow: 0 0 10px rgba(0,212,255,0.3); }
    50% { box-shadow: 0 0 20px rgba(0,212,255,0.5); }
}

/* Compact answer section for host playing mode */
.host-playing .answer-section {
    max-width: 100%;
    margin: 10px auto;
    padding: clamp(12px, 2vw, 15px);
}

.answer-section h3 {
    color: white;
    margin: 0;
    font-size: 1.2rem;
}

.answer-section input[type="text"] {
    width: 100%;
    padding: 15px;
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 10px;
    background: rgba(255,255,255,0.1);
    color: white;
    font-size: 1.1rem;
    font-family: var(--font-main);
}

.answer-section input[type="text"]:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(255,255,255,0.15);
}

.answer-section input[type="text"]::placeholder {
    color: rgba(255,255,255,0.5);
}

.btn-primary.large {
    font-size: clamp(1.1rem, 3.5vw, 1.5rem);
    padding: clamp(12px, 3vw, 18px) clamp(25px, 6vw, 45px);
}

.info-text {
    color: white;
    font-size: 1.1rem;
    text-align: center;
    margin: 20px 0;
}

.host-control-panel {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 20px;
    padding: 20px;
}

.host-control-panel button {
    padding: 12px 24px;
    font-size: 1rem;
}

#countdown-display {
    animation: countdownPulse 1s infinite;
    transition: opacity 0.3s;
}

@keyframes countdownPulse {
    0%, 100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
    50% {
        transform: translate(-50%, -50%) scale(1.15);
        opacity: 0.9;
    }
}

@keyframes pqcBeat {
    0% { transform: scale(1.5); opacity: 0.5; }
    100% { transform: scale(1); opacity: 1; }
}

/* --- Game Screen Layout --- */
#screen-game {
    flex-direction: column;
    gap: 0;
    padding: clamp(10px, 2vw, 20px);
    padding-top: clamp(60px, 10vh, 80px); /* Space for admin menu */
    overflow-y: auto;
}

/* When both views are shown (host playing) */
#screen-game.host-playing {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: auto auto;
    gap: clamp(10px, 2vh, 20px);
    align-items: start;
}

@media (min-width: 900px) {
    #screen-game.host-playing {
        grid-template-columns: 1fr 300px;
        grid-template-rows: 1fr;
        align-items: start;
    }
}

/* --- Host View --- */
.game-view {
    position: relative;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

#view-host {
    max-height: none;
}

#view-player {
    max-height: none;
}

/* Host panel card - wraps all host controls into a cohesive sidebar */
.host-panel-card {
    width: 100%;
    background: rgba(0, 0, 0, 0.45);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    backdrop-filter: blur(10px);
}

/* Host card (answer reveal) — compact in the sidebar */
#screen-game.host-playing .host-card {
    padding: 12px 14px;
    margin: 0;
    border-radius: 12px;
    box-shadow: none;
}

#screen-game.host-playing .host-card h2 {
    font-size: 0.85rem;
    margin-bottom: 8px;
    line-height: 1.4;
    color: #333;
}

#screen-game.host-playing .host-answer-box {
    font-size: 0.9rem;
    padding: 8px 10px;
    margin-top: 8px;
}

/* Buzz/status area — no min-height, clean */
#screen-game.host-playing #host-buzz-area {
    min-height: unset;
    margin: 0;
    font-size: 1rem;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

#screen-game.host-playing .host-header {
    margin-bottom: 0;
    padding: 10px 14px;
    border-radius: 12px;
}

#screen-game.host-playing .host-actions {
    width: 100%;
}

#screen-game.host-playing .phase-controls {
    width: 100%;
    display: flex;
    justify-content: center;
}

#screen-game.host-playing .phase-controls .btn-primary {
    width: 100%;
    text-align: center;
    padding: 14px 20px;
    font-size: 1rem;
    border-radius: 12px;
}

#screen-game.host-playing .info-text {
    font-size: 0.85rem;
    opacity: 0.7;
    margin: 6px 0;
    text-align: center;
}

/* Timer row in host panel */
.host-timer-row {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
}

.host-timer-num {
    font-size: 1.3rem;
    font-weight: 900;
    min-width: 36px;
}

.host-timer-track {
    flex: 1;
    height: 6px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 3px;
    overflow: hidden;
}

.host-answered-badge {
    font-size: 0.8rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.7);
    white-space: nowrap;
}

/* Status pill for waiting/loading state */
.host-status-pill {
    text-align: center;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.5);
    padding: 6px 0;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.host-no-answers {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.4);
    font-style: italic;
}

/* --- Mini Leaderboard rows --- */
.lb-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    font-size: 0.85rem;
}

.lb-row:last-child {
    border-bottom: none;
}

.lb-rank {
    min-width: 24px;
    font-size: 0.9rem;
}

.lb-name {
    flex: 1;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.lb-score {
    font-weight: 700;
    color: var(--accent);
    white-space: nowrap;
}

#screen-game.host-playing .mini-leaderboard {
    margin-top: 4px;
    padding: 10px 12px;
    border-radius: 12px;
}

.host-card {
    background: linear-gradient(145deg, #ffffff, #f5f5f5);
    color: #222;
    width: 100%;
    max-width: 650px;
    padding: clamp(25px, 5vw, 40px);
    border-radius: 24px;
    text-align: center;
    margin: clamp(10px, 2vh, 20px) 0;
    box-shadow: 0 15px 40px rgba(0,0,0,0.4);
    display: flex;
    flex-direction: column;
    justify-content: center;
    border: 1px solid rgba(255,255,255,0.2);
}

.host-card h2 {
    font-size: clamp(1.3rem, 4.5vw, 2rem);
    margin-bottom: clamp(15px, 3vh, 25px);
    line-height: 1.5;
    color: #1a1a2e;
}

.host-answer-box {
    margin-top: auto;
    font-weight: 700;
    color: #444;
    font-size: clamp(1rem, 3vw, 1.3rem);
    padding: clamp(15px, 3vw, 20px);
    border-top: 2px solid #eee;
    background: rgba(0, 212, 255, 0.08);
    border-radius: 12px;
    margin-top: 15px;
}

.host-answer-box.hidden-answer {
    background: rgba(0, 0, 0, 0.05);
    color: #999;
}

.host-answer-box.revealed {
    background: linear-gradient(135deg, rgba(0, 255, 136, 0.15), rgba(0, 212, 255, 0.15));
    color: var(--success);
    border: 2px solid var(--success);
}

.buzz-status-area {
    margin: 20px 0;
    font-size: 1.5rem;
    font-weight: bold;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.buzzed-alert {
    font-size: 2rem;
    color: var(--accent);
    margin-bottom: 20px;
    animation: flash 0.5s infinite alternate;
}

@keyframes flash {
    from { opacity: 1; }
    to { opacity: 0.5; }
}

.judge-buttons {
    display: flex;
    gap: 20px;
}

/* --- Host Header --- */
.host-header {
    width: 100%;
    max-width: 650px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: clamp(20px, 5vw, 48px);
    padding: clamp(12px, 2.5vw, 18px) clamp(18px, 3.5vw, 30px);
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    margin-bottom: clamp(15px, 3vh, 25px);
    border: 1px solid rgba(255,255,255,0.1);
}

.question-counter {
    font-size: clamp(1rem, 2.5vw, 1.2rem);
    font-weight: 700;
    color: white;
}

.category-badge {
    background: var(--primary);
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.9rem;
}

.player-header {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 10px 10px 54px; /* left indent keeps content clear of the fixed back arrow */
    background: rgba(0,0,0,0.3);
    border-radius: 10px;
}

.question-display {
    background: rgba(255,255,255,0.1);
    padding: clamp(15px, 3vw, 25px);
    border-radius: 15px;
    margin: 15px 0;
    width: 100%;
    text-align: center;
    border: 1px solid rgba(255,255,255,0.15);
}

.question-display p {
    font-size: clamp(1rem, 3vw, 1.3rem);
    line-height: 1.5;
    margin: 0;
}

/* Compact question display for host playing mode */
.host-playing .question-display {
    padding: clamp(12px, 2vw, 18px);
    margin: 10px 0;
}

.host-playing .question-display p {
    font-size: clamp(0.95rem, 2.5vw, 1.1rem);
}

.cat-label {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--accent);
    margin-bottom: 5px;
}

.buzzer-container {
    flex-grow: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    position: relative;
    min-height: clamp(180px, 30vh, 280px);
}

/* Compact buzzer for host playing mode */
.host-playing .buzzer-container {
    min-height: clamp(150px, 22vh, 200px);
}

.host-playing .buzzer-btn {
    width: clamp(160px, 28vw, 200px);
    height: clamp(90px, 14vw, 110px);
    font-size: clamp(1.2rem, 2.8vw, 1.5rem);
    padding: clamp(15px, 3vw, 20px) clamp(25px, 5vw, 35px);
}

.buzzer-btn {
    width: clamp(220px, 45vw, 320px);
    height: auto;
    min-height: clamp(100px, 18vw, 140px);
    border-radius: 20px;
    border: none;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    background: linear-gradient(145deg, #ff0055, #cc0044);
    box-shadow:
        0 8px 0 #990033,
        0 15px 30px rgba(255, 0, 85, 0.4),
        inset 0 2px 10px rgba(255,255,255,0.3);
    color: white;
    font-size: clamp(1.4rem, 4vw, 2rem);
    font-weight: 900;
    cursor: pointer;
    transition: transform 0.1s, box-shadow 0.2s;
    text-shadow: 0 2px 8px rgba(0,0,0,0.4);
    padding: clamp(20px, 4vw, 30px) clamp(35px, 7vw, 60px);
    text-transform: uppercase;
    letter-spacing: 3px;
    position: relative;
    overflow: hidden;
}

.buzzer-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.buzzer-btn:hover::before {
    left: 100%;
}

.buzzer-btn:hover {
    box-shadow:
        0 6px 0 #990033,
        0 20px 40px rgba(255, 0, 85, 0.5),
        inset 0 2px 10px rgba(255,255,255,0.3);
    transform: translateY(2px);
}

.buzzer-btn:active {
    transform: translateY(8px);
    box-shadow:
        0 0 0 #990033,
        0 8px 15px rgba(255, 0, 85, 0.3),
        inset 0 2px 10px rgba(255,255,255,0.3);
}

.buzzer-btn:disabled {
    background: linear-gradient(145deg, #555, #333);
    box-shadow:
        0 4px 0 #222,
        0 8px 15px rgba(0, 0, 0, 0.3);
    cursor: not-allowed;
    opacity: 0.7;
}

.buzzer-status {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: auto;
    padding: 15px 25px;
    border-radius: 25px;
    background: rgba(0,0,0,0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(1rem, 3vw, 1.3rem);
    font-weight: 700;
    color: #aaa;
    backdrop-filter: blur(5px);
    white-space: nowrap;
    z-index: 10;
}

.feedback-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.8);
    z-index: 100;
    animation: fadeIn 0.2s;
}

.feedback-content {
    font-size: 3rem;
    font-weight: 900;
    text-transform: uppercase;
}

/* --- Timer Display --- */
.timer-display-host {
    text-align: center;
    margin: 15px 0;
}

.timer-number {
    font-size: 3rem;
    font-weight: 900;
}

.timer-bar-container {
    width: 100%;
    max-width: 400px;
    height: 10px;
    background: rgba(255,255,255,0.2);
    border-radius: 5px;
    overflow: hidden;
    margin: 10px auto;
}

.timer-bar {
    height: 100%;
    border-radius: 5px;
    transition: width 1s linear, background 0.3s;
}

.answered-status {
    font-size: 1.2rem;
    color: rgba(255,255,255,0.8);
    margin: 10px 0;
}

/* --- Timer Duration Control (Lobby) --- */
.timer-duration-control {
    display: flex;
    flex-direction: column;
    gap: clamp(8px, 2vw, 12px);
    align-items: center;
    margin: clamp(10px, 2vh, 15px) 0;
    width: 100%;
}

.timer-duration-control input[type="range"] {
    width: 100%;
    max-width: 400px;
    height: clamp(6px, 1.5vw, 10px);
    border-radius: 5px;
    background: rgba(255,255,255,0.2);
    outline: none;
    -webkit-appearance: none;
}

.timer-duration-control input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: clamp(22px, 5vw, 28px);
    height: clamp(22px, 5vw, 28px);
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
}

.timer-duration-control input[type="range"]::-moz-range-thumb {
    width: clamp(22px, 5vw, 28px);
    height: clamp(22px, 5vw, 28px);
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    border: none;
}

.timer-duration-display {
    font-size: clamp(1rem, 3vw, 1.2rem);
    font-weight: 600;
    color: white;
}

/* --- Buzzed Players List --- */
.buzzed-players-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin: 10px 0;
}

.buzzed-tag {
    display: inline-block;
    padding: 6px 14px;
    margin: 3px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
}

.buzzed-tag.waiting {
    background: var(--accent);
    color: #1a1a2e;
}

.buzzed-tag.answered {
    background: var(--success);
    color: #1a1a2e;
}

/* --- Player Timer --- */
.player-timer {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 10px 20px;
    background: rgba(0,0,0,0.3);
    border-radius: 10px;
    margin-bottom: 15px;
}

.player-timer .timer-bar-container {
    flex-grow: 1;
    margin: 0;
}

.player-timer .timer-text {
    font-size: 1.5rem;
    font-weight: 800;
    min-width: 60px;
    text-align: right;
}

/* --- Results Overlay --- */
.results-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.3s;
    cursor: default;
}
.results-overlay.host-clickable { cursor: pointer; }

.results-card {
    position: relative; /* needed for any absolutely-positioned children */
    background: white;
    border-radius: 20px;
    padding: 30px;
    max-width: 500px;
    width: 90%;
    color: #333;
    text-align: center;
    max-height: 80vh;
    overflow-y: auto;
}

.results-card h2 {
    margin: 0 0 20px 0;
    color: var(--primary);
    font-size: 1.8rem;
}

.correct-answer {
    background: #f5f5f5;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 20px;
    font-size: 1.1rem;
}

.correct-answer strong {
    color: #1a1a2e;
}

.results-list {
    text-align: left;
}

.result-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    margin: 8px 0;
    border-radius: 10px;
    gap: 10px;
}

.result-item.correct {
    background: rgba(59,130,246,0.12);
    border-left: 4px solid var(--success);
}

.result-item.wrong {
    background: rgba(255,51,51,0.1);
    border-left: 4px solid var(--danger);
}

.result-item.first {
    background: linear-gradient(90deg, rgba(255,204,0,0.2), rgba(59,130,246,0.2));
    border: 2px solid gold;
}

.result-name {
    font-weight: 600;
    flex-shrink: 0;
}

.result-answer {
    flex-grow: 1;
    text-align: center;
    font-style: italic;
    color: #666;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.first-badge {
    background: linear-gradient(45deg, gold, #ffcc00);
    color: #333;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 700;
    white-space: nowrap;
}

.correct-badge {
    background: var(--success);
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 700;
}

/* --- Results Leaderboard (animated standings) --- */
.results-leaderboard {
    margin-top: 18px;
    padding-top: 14px;
    border-top: 2px solid #eee;
    text-align: left;
}

.results-lb-title {
    font-weight: 800;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: #aaa;
    margin-bottom: 10px;
}

.lb-result-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 4px;
    border-bottom: 1px solid #f0f0f0;
    animation: slideInRow 0.35s ease-out both;
    font-size: 0.92rem;
}

.lb-result-row:last-child { border-bottom: none; }

@keyframes slideInRow {
    from { transform: translateX(-16px); opacity: 0; }
    to   { transform: translateX(0);    opacity: 1; }
}

.lb-result-rank  { min-width: 28px; font-size: 0.9rem; }
.lb-result-name  { flex: 1; font-weight: 600; color: #222; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-result-score { font-weight: 700; color: #333; white-space: nowrap; }
.lb-result-delta { color: #3b82f6; font-weight: 800; font-size: 0.82rem; min-width: 36px; text-align: right; white-space: nowrap; }

/* Rank change indicators */
.lb-rank-change { font-size: 0.72rem; font-weight: 800; min-width: 26px; text-align: center; flex-shrink: 0; }
.lb-rank-change.up { color: #16a34a; }
.lb-rank-change.down { color: #dc2626; }
.lb-rank-change.same { color: #ccc; }

/* Rows where score increased */
.lb-result-row.gained { background: rgba(59,130,246,0.07); border-radius: 6px; }

/* Position-change animation: row slides from old rank to new rank */
@keyframes rankSlide {
    from {
        transform: translateY(calc(var(--rank-diff, 0) * 44px));
        opacity: 0.35;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}
.lb-result-row.rank-changed {
    animation: rankSlide 0.75s cubic-bezier(0.22, 1, 0.36, 1) both;
    position: relative;
    z-index: 5;
}

/* Allow rank animations to render outside card bounds */
.results-card.animating-lb { overflow: visible !important; }

/* Continue hint at bottom of results card */
.results-continue-hint {
    text-align: center;
    margin-top: 18px;
    padding: 10px 12px;
    font-size: 0.82rem;
    color: #aaa;
    font-weight: 600;
    letter-spacing: 0.4px;
    border-top: 1px solid #eee;
}
.results-continue-hint.host {
    color: #ff0055;
    cursor: pointer;
    animation: hintPulse 1.6s ease-in-out infinite;
}
@keyframes hintPulse {
    0%, 100% { opacity: 0.65; }
    50% { opacity: 1; }
}

.wrong-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: rgb(255, 70, 70);
    font-size: 0.9rem;
    font-weight: 900;
    flex-shrink: 0;
    font-family: var(--font-main);
}

.player-q-counter {
    font-size: 0.75rem;
    font-weight: 700;
    color: rgba(255,255,255,0.45);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    align-self: center;
}

.player-room-code {
    font-size: 0.65rem;
    font-weight: 700;
    color: rgba(255,255,255,0.28);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    align-self: center;
    white-space: nowrap;
}

/* --- Back Arrow — body-level fixed, always on top of game content --- */
/* z-index 2000: above results-overlay (1000) so it's tappable while leaderboard is showing,
   but below reconnecting (9000) and kicked (9999) overlays which must take full focus. */
.quit-game-btn {
    position: fixed;
    top: 14px;
    left: 14px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: rgba(255,255,255,0.55);
    font-size: 1.2rem;
    line-height: 1;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    z-index: 2000;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    font-family: var(--font-main);
}

.quit-game-btn:hover {
    background: rgba(255,50,50,0.2);
    color: rgba(255,130,130,0.95);
    border-color: rgba(255,50,50,0.35);
}

.quit-game-btn:active {
    transform: scale(0.92);
}

/* --- End Screen Actions --- */
.end-screen-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
    width: 100%;
    max-width: 400px;
}

.end-screen-actions .btn-primary {
    width: 100%;
}

.end-screen-actions .btn-secondary {
    width: 100%;
}

/* --- Play Again Modal --- */
.play-again-modal {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.85);
    display: flex;
    /* flex-start so the card always starts at the top — prevents iOS from hiding the
       top of the card when content overflows the viewport height */
    align-items: flex-start;
    justify-content: center;
    z-index: 5000;
    animation: fadeIn 0.2s;
    padding: 20px;
    padding-top: max(20px, env(safe-area-inset-top, 20px));
    box-sizing: border-box;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

.play-again-card {
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 20px;
    padding: clamp(20px, 5vw, 35px);
    max-width: 520px;
    width: 100%;
    color: white;
    font-family: var(--font-main);
    box-shadow: 0 20px 60px rgba(0,0,0,0.6);
    /* No auto margins — flex-start on the container handles top-alignment.
       Auto margins were causing the card top to be pushed off-screen on iOS
       when the card height exceeded the viewport. */
    margin: 0;
}

.play-again-card h2 {
    margin: 0 0 4px;
    font-size: clamp(1.4rem, 4vw, 1.8rem);
    background: linear-gradient(to right, #ff0055, #ffcc00);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.pa-section {
    margin-bottom: 18px;
}

.pa-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255,255,255,0.6);
    margin-bottom: 10px;
}

.pa-cat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 8px;
}

.pa-cat-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(255,255,255,0.07);
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: background 0.15s;
    user-select: none;
}

.pa-cat-item:hover { background: rgba(255,255,255,0.14); }

.pa-cat-item input[type="checkbox"] {
    width: 16px; height: 16px;
    flex-shrink: 0;
    accent-color: var(--primary);
    cursor: pointer;
}

.pa-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: rgba(255,255,255,0.07);
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.9rem;
    user-select: none;
}

.pa-toggle input[type="checkbox"] {
    width: 18px; height: 18px;
    accent-color: var(--primary);
    cursor: pointer;
}

.pa-actions {
    display: flex;
    gap: 12px;
    margin-top: 8px;
}

.pa-actions button {
    flex: 1;
}

input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    border-radius: 3px;
    background: rgba(255,255,255,0.2);
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px; height: 20px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
}

/* --- Points Animation --- */
.points-animation {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 4rem;
    font-weight: 900;
    color: var(--success);
    text-shadow: 0 0 30px rgba(59,130,246,0.6);
    animation: pointsPop 2s ease-out forwards;
    z-index: 1001;
    pointer-events: none;
}

@keyframes pointsPop {
    0% {
        transform: translate(-50%, -50%) scale(0);
        opacity: 0;
    }
    20% {
        transform: translate(-50%, -50%) scale(1.3);
        opacity: 1;
    }
    80% {
        transform: translate(-50%, -100%) scale(1);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -150%) scale(0.8);
        opacity: 0;
    }
}

/* --- Buzz Toast --- */
.buzz-toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--accent);
    color: #1a1a2e;
    padding: 12px 25px;
    border-radius: 25px;
    font-weight: 700;
    font-size: 1rem;
    z-index: 999;
    animation: toastSlide 0.3s ease-out;
    box-shadow: 0 5px 20px rgba(0,212,255,0.4);
}

@keyframes toastSlide {
    from {
        transform: translateX(-50%) translateY(-20px);
        opacity: 0;
    }
    to {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* --- Kicked Overlay --- */
.kicked-card {
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    border: 1px solid rgba(255, 50, 50, 0.3);
    border-radius: 20px;
    padding: clamp(30px, 6vw, 50px) clamp(25px, 5vw, 45px);
    max-width: 420px;
    width: 100%;
    text-align: center;
    font-family: var(--font-main);
    color: white;
    box-shadow: 0 20px 60px rgba(0,0,0,0.6);
}

.kicked-icon {
    font-size: 3.5rem;
    margin-bottom: 16px;
}

.kicked-card h2 {
    font-size: clamp(1.4rem, 4vw, 1.8rem);
    font-weight: 800;
    margin: 0 0 10px;
    color: var(--danger);
}

.kicked-card p {
    color: rgba(255,255,255,0.65);
    margin: 0 0 8px;
    font-size: clamp(0.9rem, 2.5vw, 1rem);
}

.kicked-note {
    font-size: 0.85rem !important;
    color: rgba(255,255,255,0.4) !important;
    margin-bottom: 24px !important;
}

.kicked-btn {
    background: linear-gradient(45deg, #ff0055, #ff4444);
    border: none;
    border-radius: 50px;
    color: white;
    font-weight: 800;
    font-size: clamp(1rem, 3vw, 1.1rem);
    padding: 14px 35px;
    cursor: pointer;
    font-family: var(--font-main);
    touch-action: manipulation;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* --- End Screen --- */
#screen-end {
    padding-top: 80px; /* Space for admin menu */
    justify-content: flex-start;
}

#screen-end h1 {
    font-size: clamp(2rem, 6vw, 3rem);
    background: linear-gradient(to right, #ff0055, #ffcc00);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 30px;
}

.winner-podium {
    width: 100%;
    max-width: 500px;
    background: rgba(255,255,255,0.1);
    border-radius: 20px;
    padding: 25px;
    margin-bottom: 30px;
}

.podium-entry {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    background: rgba(255,255,255,0.05);
    border-radius: 12px;
    margin: 8px 0;
    animation: slideInRow 0.4s ease-out both;
    font-size: 1.1rem;
}

.podium-entry:first-child {
    background: linear-gradient(135deg, rgba(255,204,0,0.25), rgba(255,204,0,0.08));
    border: 2px solid gold;
}

.podium-rank { font-size: 1.4rem; min-width: 32px; }
.podium-name { flex: 1; font-weight: 700; font-size: 1.1rem; }
.podium-score { font-weight: 800; color: var(--accent); white-space: nowrap; }

/* --- Mini Leaderboard --- */
.mini-leaderboard {
    background: rgba(0,0,0,0.3);
    padding: 15px 20px;
    border-radius: 10px;
    margin-top: 15px;
    min-width: 200px;
    text-align: left;
}

.mini-leaderboard div {
    padding: 5px 0;
    font-size: 0.95rem;
}

/* --- Admin Hamburger Menu --- */
.admin-menu {
    position: fixed;
    top: 15px;
    right: 15px;
    z-index: 1000;
}

.admin-menu-btn-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
}

.admin-label {
    font-size: 0.55rem;
    font-weight: 800;
    letter-spacing: 2px;
    color: #ffffff;
    text-transform: uppercase;
    user-select: none;
}

.admin-menu-toggle {
    width: 48px;
    height: 48px;
    background: rgba(0, 0, 0, 0.75);
    border: 2px solid rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    padding: 10px;
    transition: background 0.2s, border-color 0.2s, transform 0.2s;
    backdrop-filter: blur(10px);
}

.admin-menu-toggle:hover {
    background: rgba(0, 0, 0, 0.8);
    border-color: var(--accent);
    transform: scale(1.05);
}

.admin-menu-toggle.active {
    background: var(--primary);
    border-color: var(--primary);
}

.admin-menu-toggle.active span {
    background: white;
}

.admin-menu-toggle span {
    display: block;
    width: 22px;
    height: 3px;
    background: #ffffff;
    border-radius: 2px;
    transition: transform 0.2s, opacity 0.2s, background 0.2s;
}

.admin-menu-toggle:hover span {
    background: white;
}

.admin-menu-toggle.active span:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
}

.admin-menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.admin-menu-toggle.active span:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
}

.admin-menu-dropdown {
    position: absolute;
    top: 55px;
    right: 0;
    background: rgba(30, 30, 50, 0.98);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 15px;
    padding: 10px;
    min-width: 200px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    animation: slideDown 0.2s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.admin-room-code {
    padding: 12px 15px;
    text-align: center;
    font-size: 0.9rem;
    color: rgba(255,255,255,0.7);
}

.admin-room-code span {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--accent);
    letter-spacing: 3px;
}

.admin-menu-divider {
    height: 1px;
    background: rgba(255,255,255,0.15);
    margin: 8px 0;
}

.admin-menu-item {
    width: 100%;
    padding: 12px 15px;
    background: transparent;
    border: none;
    border-radius: 10px;
    color: white;
    font-size: 1rem;
    font-weight: 600;
    font-family: var(--font-main);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: background 0.2s;
    text-align: left;
}

.admin-menu-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.admin-menu-item.danger {
    color: var(--danger);
}

.admin-menu-item.danger:hover {
    background: rgba(255, 51, 51, 0.2);
}

.admin-icon {
    font-size: 1.1rem;
    width: 24px;
    text-align: center;
}

/* --- Mobile Optimizations --- */
@media (max-width: 600px) {
    .timer-number { font-size: clamp(1.5rem, 6vw, 2rem); }
    .results-card { padding: clamp(15px, 4vw, 20px); }
    .results-card h2 { font-size: clamp(1.2rem, 4vw, 1.4rem); }
    .result-item { padding: clamp(8px, 2vw, 12px); font-size: clamp(0.8rem, 2.5vw, 0.9rem); }
    .points-animation { font-size: clamp(2.5rem, 10vw, 3rem); }

    .admin-menu {
        top: 10px;
        right: 10px;
    }

    .admin-menu-toggle {
        width: 40px;
        height: 40px;
    }

    .admin-label {
        font-size: 0.5rem;
    }

    .admin-menu-dropdown {
        min-width: 180px;
    }

    .admin-menu-item {
        padding: 10px 12px;
        font-size: 0.9rem;
    }

    .host-card {
        padding: clamp(15px, 4vw, 25px);
        margin: clamp(10px, 2vh, 15px) 0;
    }

    .host-header {
        padding: clamp(10px, 2.5vw, 15px);
        margin-bottom: clamp(10px, 2vh, 15px);
    }

    .player-header {
        padding: clamp(8px, 2vw, 12px);
    }

    /* On mobile, stack host panel below player view with tighter spacing */
    #screen-game.host-playing {
        gap: 12px;
    }

    .host-panel-card {
        padding: 14px;
        gap: 10px;
    }
}

/* --- Pause Overlay --- */
#pause-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.88);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5500;
    animation: fadeIn 0.3s ease-out;
}
.pause-content {
    text-align: center;
    color: white;
    font-family: var(--font-main);
}
.pause-icon {
    font-size: clamp(3rem, 10vw, 5rem);
    margin-bottom: 16px;
}
.pause-content h2 {
    font-size: clamp(1.8rem, 6vw, 2.8rem);
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 4px;
    margin: 0 0 12px;
    background: linear-gradient(to right, #ff0055, #ffcc00);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.pause-content p {
    font-size: clamp(0.9rem, 3vw, 1.1rem);
    color: rgba(255,255,255,0.65);
    margin: 0;
}

#pause-resume-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 28px rgba(255, 0, 85, 0.6) !important;
}
#pause-resume-btn:active {
    transform: scale(0.98);
}

/* --- Disconnected Players Indicator (host between-question display) --- */
.host-disconnected-row {
    margin-top: 10px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: rgba(255, 80, 0, 0.12);
    border: 1px solid rgba(255, 80, 0, 0.3);
    border-radius: 10px;
}

.disconnect-label {
    color: rgba(255, 140, 50, 0.9);
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-right: 4px;
}

.disconnect-tag {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 14px;
    background: rgba(255, 80, 0, 0.25);
    color: #ffaa66;
    font-size: 0.82rem;
    font-weight: 600;
    border: 1px solid rgba(255, 100, 0, 0.4);
}

/* ── True/False two-choice layout (Task 8) ── */
.choices-grid.two-choice {
    grid-template-columns: 1fr 1fr;
}

.choices-grid.two-choice .choice-btn {
    font-size: clamp(1.1rem, 4vw, 1.6rem);
    padding: 24px 16px;
    min-height: 90px;
}

/* ── Question image display — flag emoji/image ── */
.question-image-display {
    font-size: clamp(5rem, 22vw, 10rem);
    text-align: center;
    line-height: 1.1;
    margin-bottom: 12px;
    user-select: none;
}

.question-image-display .flag-img {
    display: block;
    width: clamp(120px, 40vw, 220px);
    height: auto;
    margin: 0 auto;
    border-radius: 6px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.35);
    object-fit: contain;
}

/* ── Round explanation (Task 5) ── */
.round-explanation {
    font-size: 0.85rem;
    color: #555;
    background: rgba(0, 0, 0, 0.04);
    border-left: 3px solid var(--accent);
    border-radius: 6px;
    padding: 8px 12px;
    margin: 8px 0 10px;
    line-height: 1.5;
    font-style: italic;
}

/* ── Answered players status (Task 3) ── */
.player-answered-status {
    margin-top: 14px;
    text-align: center;
    max-height: 100px;
    overflow-y: auto;
}

.answered-status-label {
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.55);
    margin-bottom: 6px;
}

.answered-names {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
}

.answered-tag {
    background: rgba(0, 200, 100, 0.18);
    border: 1px solid rgba(0, 200, 100, 0.4);
    color: #66ffb2;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 20px;
    padding: 3px 10px;
}

/* Large screens */
@media (min-width: 1200px) {
    #screen-lobby {
        padding-top: 5vh;
    }

    .host-controls {
        max-width: 700px;
    }

    .category-grid {
        max-width: 700px;
    }
}

/* ============================================================
   GROUP 2 ADDITIONS
   ============================================================ */

/* --- Player categories display in lobby (non-host players) --- */
.lobby-categories-player {
    width: 100%;
    max-width: 600px;
    background: rgba(0,0,0,0.2);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 14px;
    padding: 14px 18px 16px;
}

.lobby-cat-label {
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: rgba(255,255,255,0.4);
    margin: 0 0 12px 0;
}

.player-cat-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* --- Lobby leave button --- */
.lobby-leave-row {
    display: flex;
    justify-content: center;
    margin-top: 2px;
}

.lobby-leave-btn {
    background: transparent;
    border: none;
    color: rgba(255,255,255,0.3);
    font-family: var(--font-main);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    padding: 8px 16px;
    border-radius: 20px;
    transition: color 0.2s, background 0.2s;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.lobby-leave-btn:hover {
    color: rgba(255,255,255,0.65);
    background: rgba(255,255,255,0.06);
}

/* --- Persistent room code on end screen --- */
.end-room-code {
    font-size: 0.8rem;
    font-weight: 700;
    color: rgba(255,255,255,0.35);
    letter-spacing: 2px;
    text-transform: uppercase;
    margin: -6px 0 12px;
}

/* --- Replay guidance message (end screen, non-host players) --- */
.replay-guidance {
    width: 100%;
    max-width: 460px;
    background: rgba(0,212,255,0.08);
    border: 1px solid rgba(0,212,255,0.2);
    border-radius: 12px;
    padding: 12px 18px;
    color: rgba(255,255,255,0.7);
    font-size: 0.88rem;
    font-weight: 600;
    text-align: center;
    line-height: 1.5;
    margin-bottom: 8px;
}

/* --- Tie display on end screen --- */
.tie-notice {
    width: 100%;
    max-width: 460px;
    background: linear-gradient(135deg, rgba(255,204,0,0.12), rgba(255,0,85,0.1));
    border: 1px solid rgba(255,204,0,0.35);
    border-radius: 12px;
    padding: 10px 18px;
    color: #ffdd55;
    font-size: 0.9rem;
    font-weight: 700;
    text-align: center;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
}

.tie-badge {
    display: inline-block;
    background: rgba(255,204,0,0.25);
    border: 1px solid rgba(255,204,0,0.5);
    color: #ffdd55;
    font-size: 0.65rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    padding: 2px 7px;
    border-radius: 10px;
    margin-left: 7px;
    vertical-align: middle;
}

.podium-entry.tie-entry {
    border-color: rgba(255,204,0,0.4);
    background: linear-gradient(135deg,
        rgba(255,204,0,0.08) 0%,
        rgba(255,255,255,0.06) 100%);
}


