/* CSS Variables */
:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --secondary: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --dark: #1e1e2e;
    --darker: #11111b;
    --light: #cdd6f4;
    --muted: #6c7086;
    --surface: #313244;
    --overlay: #45475a;
}

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

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: linear-gradient(135deg, var(--darker) 0%, var(--dark) 100%);
    min-height: 100vh;
    color: var(--light);
    padding: 20px;
}

h1 {
    text-align: center;
    font-size: 2.5rem;
    margin-bottom: 30px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

h2 {
    color: var(--light);
    margin-bottom: 20px;
}

h3 {
    color: var(--light);
    margin-bottom: 15px;
}

#game-container {
    position: relative;
    max-width: 900px;
    margin: 0 auto;
    background: var(--surface);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

/* Screens */
.screen {
    display: none;
}

.screen.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

.screen.hidden {
    display: none;
}

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

/* Buttons */
.button {
    display: inline-block;
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.button.primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
}

.button.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(99, 102, 241, 0.3);
}

.button.secondary {
    background: var(--overlay);
    color: var(--light);
}

.button.secondary:hover {
    background: var(--muted);
}

.button.large {
    padding: 16px 32px;
    font-size: 18px;
}

.button.small {
    padding: 8px 16px;
    font-size: 14px;
}

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

/* Input Groups */
.input-group {
    margin-bottom: 20px;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--muted);
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.input-group input {
    width: 100%;
    padding: 14px 18px;
    border: 2px solid var(--overlay);
    border-radius: 10px;
    background: var(--dark);
    color: var(--light);
    font-size: 16px;
    transition: border-color 0.2s;
}

.input-group input:focus {
    outline: none;
    border-color: var(--primary);
}

.input-group input::placeholder {
    color: var(--muted);
}

/* Button Group */
.button-group {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
}


.hidden {
    display: none !important;
}

/* Sign-in (only shown when the server requires it) */
.auth-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin: 10px 0 20px;
}

.auth-hint {
    color: var(--muted);
    margin: 0;
}

.sign-out {
    position: absolute;
    top: 14px;
    right: 18px;
    color: var(--muted);
    font-size: 0.85rem;
    text-decoration: none;
}

.sign-out:hover {
    color: var(--light);
    text-decoration: underline;
}

body.mode-screen .sign-out {
    display: none;
}


.error {
    color: var(--danger);
    padding: 10px;
    background: rgba(239, 68, 68, 0.1);
    border-radius: 8px;
    margin-top: 15px;
}

.info {
    color: var(--muted);
    font-style: italic;
}

/* Room Code Display */
.room-code-display {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 20px;
    padding: 20px;
    background: var(--dark);
    border-radius: 15px;
    margin-bottom: 30px;
}

.room-code-text {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

/* Join QR code: white quiet zone so phones can read it on the dark lobby; bigger on a TV. */
.room-qr {
    width: 180px;
    height: 180px;
    background: #fff;
    border-radius: 12px;
}

@media (min-width: 1000px) {
    .room-qr {
        width: 260px;
        height: 260px;
    }
}

.room-code-display .code {
    font-size: 2rem;
    font-weight: 700;
    font-family: 'Courier New', monospace;
    color: var(--secondary);
    letter-spacing: 4px;
}

/* Players List */
.players-list {
    background: var(--dark);
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 30px;
}

.players-list ul {
    list-style: none;
}

.players-list li {
    padding: 12px 16px;
    background: var(--surface);
    border-radius: 8px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.players-list li.disconnected {
    opacity: 0.5;
}

/* Game Screen */
#game-screen {
    display: grid;
    grid-template-columns: 1fr 200px;
    gap: 20px;
}

#game-screen.active {
    display: grid;
}

#game-header {
    grid-column: 1 / -1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: var(--dark);
    border-radius: 12px;
}

#current-phase {
    font-weight: 600;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

#timer-display {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--secondary);
}

#timer-display.warning {
    color: var(--warning);
}

#timer-display.danger {
    color: var(--danger);
    animation: pulse 0.5s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

#money-display {
    font-weight: 600;
    color: var(--secondary);
}

#game-content {
    background: var(--dark);
    border-radius: 15px;
    padding: 25px;
    min-height: 400px;
}

#players-sidebar {
    background: var(--dark);
    border-radius: 15px;
    padding: 20px;
}

#players-sidebar h4 {
    margin-bottom: 15px;
    color: var(--muted);
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 1px;
}

#game-players-list {
    list-style: none;
}

#game-players-list li {
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 8px;
    background: var(--surface);
    font-size: 14px;
}

#game-players-list li.safe {
    border-left: 3px solid var(--secondary);
}

#game-players-list .player-name {
    display: block;
    font-weight: 600;
}

#game-players-list .player-money {
    color: var(--secondary);
    font-size: 12px;
}

#game-players-list .badge {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    margin-top: 5px;
}

#game-players-list .badge.safe {
    background: var(--secondary);
    color: var(--dark);
}

/* Player Turn */
.player-turn {
    text-align: center;
    padding: 40px 20px;
}

.player-turn p {
    color: var(--muted);
    margin-bottom: 15px;
}

/* Trivia */
.trivia-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.money-earned {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--secondary);
}

/* Questions */
.question-container {
    margin-bottom: 20px;
}

.question-text {
    font-size: 1.25rem;
    margin-bottom: 25px;
    line-height: 1.6;
}

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

.option-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: var(--surface);
    border: 2px solid var(--overlay);
    border-radius: 12px;
    color: var(--light);
    font-size: 15px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
}

.option-btn:hover:not(:disabled) {
    border-color: var(--primary);
    background: var(--overlay);
}

.option-btn:disabled {
    cursor: default;
}

.option-btn.selected {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.2);
}

.option-btn.correct {
    border-color: var(--secondary);
    background: rgba(16, 185, 129, 0.2);
}

.option-btn.wrong {
    border-color: var(--danger);
    background: rgba(239, 68, 68, 0.2);
}

.option-letter {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: var(--overlay);
    border-radius: 8px;
    font-weight: 700;
    flex-shrink: 0;
}

.option-text {
    flex: 1;
}

/* Answer Reveal */
.answer-reveal {
    padding: 20px;
    background: var(--surface);
    border-radius: 12px;
    text-align: center;
}

.answer-reveal.correct {
    border: 2px solid var(--secondary);
}

.answer-reveal.wrong {
    border: 2px solid var(--danger);
}

.correct-answer {
    color: var(--secondary);
    font-weight: 600;
    margin-top: 10px;
}

/* Escape Options */
.escape-options {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-top: 30px;
}

.escape-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 25px 20px;
    border: 2px solid var(--overlay);
    border-radius: 15px;
    background: var(--surface);
    color: var(--light);
    cursor: pointer;
    transition: all 0.2s;
}

.escape-btn:hover {
    transform: translateY(-5px);
}

.escape-btn.low:hover {
    border-color: var(--secondary);
    box-shadow: 0 10px 30px rgba(16, 185, 129, 0.2);
}

.escape-btn.mid:hover {
    border-color: var(--warning);
    box-shadow: 0 10px 30px rgba(245, 158, 11, 0.2);
}

.escape-btn.high:hover {
    border-color: var(--danger);
    box-shadow: 0 10px 30px rgba(239, 68, 68, 0.2);
}

.escape-btn .steps {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 10px;
}

.escape-btn .money {
    font-size: 1.25rem;
    color: var(--secondary);
    margin-bottom: 5px;
}

.escape-btn .risk {
    font-size: 12px;
    color: var(--muted);
    text-transform: uppercase;
}

/* Escape Board */
.escape-board {
    text-align: center;
}

.race-track {
    margin: 30px 0;
}

.track-labels {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-size: 14px;
    color: var(--muted);
}

.track {
    display: flex;
    gap: 5px;
}

.track-cell {
    flex: 1;
    height: 60px;
    background: var(--surface);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    border: 2px solid var(--overlay);
}

.track-cell.home {
    background: rgba(16, 185, 129, 0.2);
    border-color: var(--secondary);
}

.track-cell.has-player {
    background: rgba(99, 102, 241, 0.2);
    border-color: var(--primary);
}

.track-cell.has-chaser {
    background: rgba(239, 68, 68, 0.2);
    border-color: var(--danger);
}

.escape-info {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin-bottom: 30px;
}

.escape-info p {
    color: var(--muted);
}

.escape-info strong {
    color: var(--light);
}

/* Phase Results */
.phase-result {
    text-align: center;
    padding: 40px 20px;
}

.phase-result.success h2 {
    color: var(--secondary);
}

.phase-result.failure h2 {
    color: var(--danger);
}

.phase-result p {
    color: var(--muted);
    margin-bottom: 10px;
}

.phase-result strong {
    color: var(--secondary);
}

/* Team Chase */
.team-chase {
    text-align: center;
}

.team-progress {
    margin: 30px 0;
}

.progress-bar {
    height: 30px;
    background: var(--overlay);
    border-radius: 15px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-bar .progress {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    transition: width 0.5s ease;
    border-radius: 15px;
}

#team-steps {
    color: var(--muted);
}

/* Chaser Chase */
.chaser-chase {
    text-align: center;
}

.chase-progress {
    margin: 40px 0;
}

.progress-track {
    position: relative;
    height: 60px;
    background: var(--overlay);
    border-radius: 30px;
    margin: 0 50px;
}

.progress-line {
    position: absolute;
    top: 50%;
    left: 10px;
    right: 10px;
    height: 4px;
    background: var(--muted);
    transform: translateY(-50%);
}

.team-marker, .chaser-marker {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    transition: left 0.5s ease;
}

.team-marker {
    background: var(--primary);
    color: white;
}

.chaser-marker {
    background: var(--danger);
    color: white;
}

.thinking {
    color: var(--muted);
    font-style: italic;
    animation: pulse 1s infinite;
}

.bonus-chance {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid var(--overlay);
}

.bonus-chance h3 {
    color: var(--secondary);
}

/* Results Screen */
#results-screen {
    text-align: center;
}

.results {
    padding: 40px 20px;
}

.results.victory h2 {
    color: var(--secondary);
    font-size: 2rem;
    margin-bottom: 30px;
}

.results.defeat h2 {
    color: var(--danger);
    font-size: 2rem;
    margin-bottom: 30px;
}

.prize {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    padding: 30px;
    border-radius: 20px;
    margin-bottom: 30px;
}

.prize .label {
    display: block;
    font-size: 14px;
    text-transform: uppercase;
    opacity: 0.8;
    margin-bottom: 10px;
}

.prize .amount {
    font-size: 3rem;
    font-weight: 700;
}

.winners {
    text-align: left;
    max-width: 300px;
    margin: 0 auto;
}

.winners ul {
    list-style: none;
}

.winners li {
    padding: 12px 16px;
    background: var(--surface);
    border-radius: 8px;
    margin-bottom: 8px;
}

.final-score {
    background: var(--surface);
    padding: 20px;
    border-radius: 12px;
    margin: 20px 0;
}

.final-score p {
    margin-bottom: 10px;
}

/* Spectator Note */
.spectator-note {
    color: var(--muted);
    font-style: italic;
    margin-top: 20px;
}

/* Responsive */
@media (max-width: 768px) {
    #game-screen, #game-screen.active {
        grid-template-columns: 1fr;
    }
    
    #players-sidebar {
        order: -1;
    }
    
    #game-players-list {
        display: flex;
        flex-wrap: wrap;
        gap: 10px;
    }
    
    #game-players-list li {
        flex: 1;
        min-width: 120px;
    }
    
    .options-grid {
        grid-template-columns: 1fr;
    }
    
    .escape-options {
        grid-template-columns: 1fr;
    }
    
    .escape-info {
        flex-direction: column;
        gap: 10px;
    }
    
    .button-group {
        flex-direction: column;
    }
    
    .lobby-content {
        flex-direction: column;
    }
    
    .games-grid {
        grid-template-columns: 1fr;
    }
}

/* ================================
   Lobby & Game Selector
   ================================ */

.lobby-content {
    display: flex;
    gap: 30px;
    margin-bottom: 30px;
}

.players-section {
    flex: 1;
    min-width: 200px;
}

.game-section {
    flex: 2;
}

#game-selector h3 {
    margin-bottom: 20px;
    color: var(--muted);
    text-transform: uppercase;
    font-size: 14px;
    letter-spacing: 1px;
}

.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.game-card {
    background: var(--dark);
    border: 2px solid var(--overlay);
    border-radius: 15px;
    padding: 20px;
    text-align: center;
    transition: all 0.2s ease;
}

.game-card.clickable {
    cursor: pointer;
}

.game-card.clickable:hover {
    border-color: var(--primary);
    transform: translateY(-3px);
}

.game-card.selected {
    border-color: var(--secondary);
    background: rgba(16, 185, 129, 0.1);
}

.game-card .game-icon {
    font-size: 3rem;
    display: block;
    margin-bottom: 15px;
}

.game-card h4 {
    color: var(--light);
    margin-bottom: 10px;
    font-size: 1.1rem;
}

.game-card p {
    color: var(--muted);
    font-size: 13px;
    margin-bottom: 15px;
    line-height: 1.4;
}

.game-card .player-count {
    display: inline-block;
    padding: 4px 10px;
    background: var(--overlay);
    border-radius: 12px;
    font-size: 12px;
    color: var(--light);
}

/* ================================
   Mode Picker Styles
   ================================ */

#mode-picker {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid var(--overlay);
}

#mode-picker h3 {
    text-align: center;
    margin-bottom: 20px;
    color: var(--light);
}

.modes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px;
}

.mode-card {
    background: var(--dark);
    border: 2px solid var(--overlay);
    border-radius: 15px;
    padding: 20px;
    text-align: center;
    transition: all 0.2s ease;
    cursor: pointer;
    position: relative;
}

.mode-card:hover {
    border-color: var(--primary);
    transform: translateY(-3px);
}

.mode-card.selected {
    border-color: var(--secondary);
    background: rgba(16, 185, 129, 0.1);
}

.mode-card.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.mode-card.disabled:hover {
    transform: none;
    border-color: var(--overlay);
}

.mode-card .mode-icon {
    font-size: 2.5rem;
    display: block;
    margin-bottom: 12px;
}

.mode-card h4 {
    color: var(--light);
    margin-bottom: 8px;
    font-size: 1rem;
}

.mode-card p {
    color: var(--muted);
    font-size: 12px;
    margin-bottom: 12px;
    line-height: 1.4;
}

.mode-card .mode-slots {
    display: inline-block;
    padding: 4px 10px;
    background: var(--overlay);
    border-radius: 12px;
    font-size: 11px;
    color: var(--light);
}

.mode-card .mode-check {
    position: absolute;
    top: 10px;
    right: 10px;
    background: var(--secondary);
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

/* Member mode indicator in players list */
.member-mode {
    font-size: 0.9em;
    margin-left: 5px;
}

/* Body mode classes for different interfaces */
body.mode-screen #game-container {
    max-width: 100%;
    height: 100vh;
    border-radius: 0;
    padding: 0;
}

body.mode-screen #game-screen {
    height: 100vh;
    display: flex;
    flex-direction: column;
}

body.mode-screen #game-content {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

body.mode-screen #players-sidebar {
    display: none;
}

body.mode-chaser #game-container {
    border-color: var(--danger);
    box-shadow: 0 0 30px rgba(239, 68, 68, 0.3);
}

/* ================================
   Game Config Styles
   ================================ */

#game-config {
    margin-top: 25px;
    padding: 20px;
    background: var(--dark);
    border-radius: 12px;
    border: 1px solid var(--overlay);
}

#game-config h3 {
    text-align: center;
    margin-bottom: 20px;
    color: var(--light);
    font-size: 1.1rem;
}

.config-options {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.config-option {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
}

.config-option label {
    color: var(--light);
    font-size: 0.95rem;
    flex: 1;
}

.config-select,
.config-input {
    background: var(--surface);
    border: 1px solid var(--overlay);
    border-radius: 8px;
    padding: 10px 15px;
    color: var(--light);
    font-size: 0.9rem;
    min-width: 180px;
    cursor: pointer;
    transition: border-color 0.2s;
}

.config-select:hover:not(:disabled),
.config-input:hover:not(:disabled) {
    border-color: var(--primary);
}

.config-select:focus,
.config-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.config-select:disabled,
.config-input:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.config-checkbox-wrapper {
    justify-content: flex-start;
}

.config-checkbox-wrapper label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.config-checkbox {
    width: 20px;
    height: 20px;
    accent-color: var(--primary);
    cursor: pointer;
}

.config-checkbox:disabled {
    cursor: not-allowed;
}

.config-note {
    text-align: center;
    color: var(--muted);
    font-size: 0.85rem;
    margin-top: 15px;
    font-style: italic;
}

/* Responsive config */
@media (max-width: 500px) {
    .config-option {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    
    .config-select,
    .config-input {
        min-width: 100%;
    }
}

/* ================================
   Trivia Quiz Styles
   ================================ */

.quiz-start {
    text-align: center;
    padding: 40px 20px;
}

.quiz-start .countdown {
    font-size: 1.5rem;
    color: var(--secondary);
    margin-top: 30px;
    animation: pulse 1s infinite;
}

.quiz-question {
    padding: 20px 0;
}

.question-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
}

.question-number {
    color: var(--muted);
    font-size: 14px;
}

.question-category {
    background: var(--primary);
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

#answer-feedback {
    margin-top: 20px;
}

.my-feedback {
    padding: 15px 20px;
    border-radius: 10px;
    font-weight: 600;
    text-align: center;
}

.my-feedback.correct {
    background: rgba(16, 185, 129, 0.2);
    color: var(--secondary);
}

.my-feedback.wrong {
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger);
}

.reveal-info {
    text-align: center;
    padding: 15px;
    background: var(--surface);
    border-radius: 10px;
}

/* Scoreboard */
.scoreboard {
    list-style: none;
}

.scoreboard li {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: var(--surface);
    border-radius: 8px;
    margin-bottom: 8px;
}

.scoreboard li.leader {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(16, 185, 129, 0.2));
    border: 1px solid var(--primary);
}

.scoreboard li.me {
    border-left: 3px solid var(--secondary);
}

.scoreboard .rank {
    color: var(--muted);
    font-weight: 600;
    width: 24px;
}

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

.scoreboard .player-score {
    font-weight: 700;
    color: var(--secondary);
}

/* Final Scores */
.final-scores {
    margin: 30px 0;
}

.scores-list {
    list-style: none;
    max-width: 400px;
    margin: 0 auto;
}

.scores-list li {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px 20px;
    background: var(--surface);
    border-radius: 10px;
    margin-bottom: 10px;
}

.scores-list li.winner {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
}

.scores-list li.me {
    border: 2px solid var(--secondary);
}

.scores-list .rank {
    font-size: 1.5rem;
    font-weight: 700;
    width: 40px;
}

.scores-list .name {
    flex: 1;
    font-weight: 600;
}

.scores-list .score {
    font-weight: 700;
    font-size: 1.2rem;
}

.questions-stat {
    color: var(--muted);
    margin-top: 20px;
}

/* ================================
   Screen/Spectator Mode Styles
   ================================ */

.divider {
    display: flex;
    align-items: center;
    margin: 30px 0;
    color: var(--muted);
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--overlay);
}

.divider span {
    padding: 0 15px;
    font-size: 14px;
}

.screen-btn {
    background: var(--overlay);
    color: var(--light);
    width: 100%;
}

.screen-btn:hover {
    background: var(--surface);
}

.hint {
    font-size: 13px;
    color: var(--muted);
    margin-top: 10px;
}

.screen-indicator {
    background: var(--primary) !important;
    font-size: 13px;
}

/* Screen Mode - Full screen layout */
body.screen-mode {
    padding: 0;
    overflow: hidden;
}

body.screen-mode #game-container {
    max-width: 100%;
    height: 100vh;
    border-radius: 0;
    padding: 0;
}

body.screen-mode #game-header {
    padding: 20px 40px;
    font-size: 1.5rem;
}

body.screen-mode #game-content {
    padding: 0;
    height: calc(100vh - 80px);
    display: flex;
    flex-direction: column;
}

body.screen-mode #players-sidebar {
    display: none;
}

/* Screen Lobby */
#screen-lobby-screen {
    padding: 40px;
}

#screen-lobby-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 80vh;
}

.screen-room-info {
    text-align: center;
    margin-bottom: 60px;
}

.screen-room-code {
    font-size: 6rem;
    font-weight: 700;
    font-family: 'Courier New', monospace;
    letter-spacing: 10px;
    color: var(--secondary);
    text-shadow: 0 0 40px rgba(16, 185, 129, 0.3);
}

.screen-room-info p {
    font-size: 1.5rem;
    color: var(--muted);
    margin-top: 20px;
}

.screen-players {
    width: 100%;
    max-width: 800px;
    margin-bottom: 60px;
}

.screen-players h2 {
    text-align: center;
    margin-bottom: 30px;
}

.screen-players-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
}

.screen-player-card {
    background: var(--surface);
    border-radius: 15px;
    padding: 25px;
    text-align: center;
}

.screen-player-card .player-avatar {
    font-size: 3rem;
    display: block;
    margin-bottom: 10px;
}

.screen-player-card .player-name {
    font-size: 1.2rem;
    font-weight: 600;
}

.screen-player-card.empty {
    border: 2px dashed var(--overlay);
    background: transparent;
    opacity: 0.5;
}

.screen-selected-game {
    text-align: center;
}

.screen-selected-game .game-icon {
    font-size: 4rem;
    display: block;
    margin-bottom: 15px;
}

.screen-waiting {
    text-align: center;
    color: var(--muted);
    font-size: 1.5rem;
}

/* Screen Display Layout */
.screen-display {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.screen-main {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.screen-players-bar {
    display: flex;
    justify-content: center;
    gap: 20px;
    padding: 20px 40px;
    background: var(--darker);
}

.screen-player {
    background: var(--surface);
    padding: 15px 25px;
    border-radius: 10px;
    text-align: center;
    min-width: 120px;
}

.screen-player.active {
    border: 3px solid var(--primary);
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.3);
}

.screen-player.safe {
    border-left: 4px solid var(--secondary);
}

.screen-player .player-status {
    font-size: 1.5rem;
}

.screen-player .player-name {
    font-weight: 600;
    margin: 5px 0;
}

.screen-player .player-money {
    color: var(--secondary);
    font-size: 0.9rem;
}

/* Screen Announcements */
.screen-announcement {
    text-align: center;
    animation: fadeIn 0.5s ease;
}

.screen-announcement .announcement-icon {
    font-size: 6rem;
    margin-bottom: 20px;
}

.screen-announcement h1 {
    font-size: 4rem;
    margin-bottom: 15px;
    -webkit-text-fill-color: initial;
    background: none;
}

.screen-announcement h2 {
    font-size: 2rem;
    color: var(--muted);
}

.screen-announcement .subtitle {
    font-size: 1.5rem;
    color: var(--muted);
    margin-top: 20px;
}

.screen-announcement.success h1 {
    color: var(--secondary);
}

.screen-announcement.failure h1 {
    color: var(--danger);
}

.prize-won {
    font-size: 4rem;
    font-weight: 700;
    color: var(--secondary);
    margin: 30px 0;
}

.team-total {
    font-size: 1.5rem;
    color: var(--muted);
}

/* Screen Offers */
.screen-offers {
    display: flex;
    gap: 30px;
    justify-content: center;
    margin-top: 40px;
}

.offer {
    background: var(--surface);
    padding: 30px 50px;
    border-radius: 15px;
    text-align: center;
}

.offer .steps {
    display: block;
    font-size: 1.2rem;
    color: var(--muted);
    margin-bottom: 10px;
}

.offer .amount {
    font-size: 2rem;
    font-weight: 700;
}

.offer.low { border: 2px solid var(--secondary); }
.offer.mid { border: 2px solid var(--warning); }
.offer.high { border: 2px solid var(--danger); }

/* Screen Cash Builder */
.screen-cash-builder {
    width: 100%;
    max-width: 900px;
    text-align: center;
}

.cb-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.cb-header h2 {
    font-size: 2rem;
}

.cb-timer {
    font-size: 3rem;
    font-weight: 700;
    color: var(--secondary);
}

.cb-timer.warning { color: var(--warning); }
.cb-timer.danger { color: var(--danger); animation: pulse 0.5s infinite; }

.cb-money {
    font-size: 5rem;
    font-weight: 700;
    color: var(--secondary);
    margin-bottom: 40px;
    transition: all 0.3s;
}

.cb-money.correct-flash {
    color: var(--secondary);
    transform: scale(1.1);
}

.cb-money.wrong-flash {
    color: var(--danger);
}

.cb-question h3 {
    font-size: 2rem;
    margin-bottom: 30px;
    line-height: 1.4;
}

.cb-options, .escape-options, .team-options, .chaser-options, .bonus-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.screen-option {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 25px 30px;
    background: var(--surface);
    border: 2px solid var(--overlay);
    border-radius: 15px;
    font-size: 1.3rem;
    transition: all 0.3s;
}

.screen-option .option-letter {
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--overlay);
    border-radius: 10px;
    font-weight: 700;
    font-size: 1.5rem;
}

.screen-option.correct {
    border-color: var(--secondary);
    background: rgba(16, 185, 129, 0.2);
}

.screen-option.wrong {
    border-color: var(--danger);
    background: rgba(239, 68, 68, 0.2);
}

/* Screen Escape */
.screen-escape {
    width: 100%;
    max-width: 1000px;
    text-align: center;
}

.screen-escape h2 {
    font-size: 2.5rem;
    margin-bottom: 15px;
}

.screen-prize {
    font-size: 1.5rem;
    color: var(--secondary);
    margin-bottom: 40px;
}

.screen-track {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 40px;
}

.track-step {
    width: 80px;
    height: 100px;
    background: var(--surface);
    border: 2px solid var(--overlay);
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.track-step.home {
    background: rgba(16, 185, 129, 0.2);
    border-color: var(--secondary);
}

.track-step.has-player {
    background: rgba(99, 102, 241, 0.2);
    border-color: var(--primary);
}

.track-step.has-chaser {
    background: rgba(239, 68, 68, 0.2);
    border-color: var(--danger);
}

.step-number {
    font-size: 1.5rem;
    font-weight: 700;
}

.step-icons {
    font-size: 2rem;
}

.escape-result {
    margin-top: 30px;
}

.result-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    padding: 15px;
    margin-bottom: 10px;
    border-radius: 10px;
    font-size: 1.3rem;
}

.result-row.correct { background: rgba(16, 185, 129, 0.2); }
.result-row.wrong { background: rgba(239, 68, 68, 0.2); }

.result-row .icon {
    font-size: 1.5rem;
}

.correct-answer {
    font-size: 1.2rem;
    color: var(--muted);
    margin-top: 15px;
}

/* Screen Team Chase */
.screen-team-chase {
    width: 100%;
    max-width: 900px;
    text-align: center;
}

.tc-header h1 {
    font-size: 3rem;
    margin-bottom: 15px;
    -webkit-text-fill-color: initial;
    background: none;
}

.tc-prize {
    font-size: 2rem;
    color: var(--secondary);
    margin-bottom: 10px;
}

.tc-timer {
    font-size: 3rem;
    font-weight: 700;
    color: var(--secondary);
    margin-bottom: 30px;
}

.tc-progress {
    margin-bottom: 30px;
}

.tc-bar {
    height: 40px;
    background: var(--overlay);
    border-radius: 20px;
    overflow: hidden;
}

.tc-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    border-radius: 20px;
    transition: width 0.5s ease;
}

.tc-steps {
    font-size: 1.5rem;
    margin-top: 10px;
    color: var(--muted);
}

.tc-players {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-bottom: 40px;
}

.safe-player {
    background: var(--secondary);
    color: var(--dark);
    padding: 8px 20px;
    border-radius: 20px;
    font-weight: 600;
}

.team-q, .escape-q, .chaser-q {
    margin-top: 30px;
}

.team-q h3, .escape-q h3, .chaser-q h3 {
    font-size: 1.8rem;
    margin-bottom: 25px;
    line-height: 1.4;
}

.team-result, .chaser-result, .bonus-result {
    padding: 30px;
    border-radius: 15px;
    font-size: 1.5rem;
    margin-top: 20px;
}

.team-result.correct, .chaser-result.correct, .bonus-result.correct {
    background: rgba(16, 185, 129, 0.2);
}

.team-result.wrong, .chaser-result.wrong, .bonus-result.wrong {
    background: rgba(239, 68, 68, 0.2);
}

.verdict {
    font-size: 2rem;
    font-weight: 700;
    margin-top: 15px;
}

.thinking {
    color: var(--muted);
    font-style: italic;
    margin-top: 20px;
    animation: pulse 1s infinite;
}

/* Screen Chaser Chase */
.screen-chaser-chase {
    width: 100%;
    max-width: 900px;
    text-align: center;
}

.screen-chaser-chase h1 {
    font-size: 3rem;
    color: var(--danger);
    margin-bottom: 40px;
    -webkit-text-fill-color: initial;
    background: none;
}

.cc-track {
    position: relative;
    height: 100px;
    margin-bottom: 40px;
}

.cc-positions {
    position: relative;
    height: 60px;
}

.cc-team, .cc-chaser {
    position: absolute;
    top: 0;
    transform: translateX(-50%);
    padding: 10px 20px;
    border-radius: 25px;
    font-weight: 600;
    transition: left 0.5s ease;
    white-space: nowrap;
}

.cc-team {
    background: var(--primary);
}

.cc-chaser {
    background: var(--danger);
    top: 40px;
}

.cc-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 10px;
    background: var(--overlay);
    border-radius: 5px;
}

.bonus-q {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 2px solid var(--overlay);
}

.bonus-q h3 {
    color: var(--secondary);
    font-size: 1.5rem;
    margin-bottom: 20px;
}

/* Screen Final Results */
.screen-final {
    text-align: center;
    animation: fadeIn 0.5s ease;
}

.screen-final h1 {
    font-size: 4rem;
    margin-bottom: 30px;
    -webkit-text-fill-color: initial;
    background: none;
}

.screen-final.victory h1 {
    color: var(--secondary);
}

.screen-final.defeat h1 {
    color: var(--danger);
}

.final-prize {
    font-size: 6rem;
    font-weight: 700;
    color: var(--secondary);
    margin-bottom: 40px;
}

.winners-list {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px;
}

.winner {
    background: var(--surface);
    padding: 20px 40px;
    border-radius: 15px;
    text-align: center;
}

.winner .name {
    display: block;
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 10px;
}

.winner .share {
    color: var(--secondary);
    font-size: 1.2rem;
}

.final-stats {
    font-size: 1.5rem;
    margin: 30px 0;
}

.final-stats p {
    margin-bottom: 10px;
}

.better-luck {
    font-size: 1.5rem;
    color: var(--muted);
}

/* Confetti animation placeholder */
.confetti {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
}

/* ================================
   Chaser Mode UI Styles
   ================================ */

.chaser-ui {
    text-align: center;
    padding: 20px;
}

.chaser-header {
    margin-bottom: 30px;
}

.chaser-header h2 {
    font-size: 2rem;
    color: var(--danger);
    margin-bottom: 10px;
}

.chaser-avatar {
    font-size: 5rem;
    margin: 30px 0;
}

.chaser-avatar.pulse {
    animation: pulse 1s infinite;
}

.chaser-waiting,
.chaser-observing,
.chaser-escape-observing,
.chaser-team-waiting,
.chaser-team-observing,
.chaser-bonus-observing {
    padding: 40px 20px;
}

.chaser-waiting h3,
.chaser-escape-start h3,
.chaser-team-waiting h3 {
    font-size: 1.5rem;
    margin-bottom: 20px;
}

.chaser-question {
    background: var(--surface);
    border-radius: 15px;
    padding: 30px;
    max-width: 600px;
    margin: 0 auto;
}

.chaser-question.active {
    border: 2px solid var(--danger);
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.3);
}

.chaser-question.final {
    background: linear-gradient(135deg, var(--dark) 0%, #2a1a1a 100%);
}

.chaser-question h3 {
    color: var(--danger);
    font-size: 1.5rem;
    margin-bottom: 20px;
}

.chaser-question .question-text {
    font-size: 1.3rem;
    margin-bottom: 25px;
    line-height: 1.5;
}

.chaser-option {
    background: var(--overlay) !important;
    border: 2px solid transparent !important;
}

.chaser-option:hover {
    border-color: var(--danger) !important;
    background: rgba(239, 68, 68, 0.2) !important;
}

.escape-positions-mini,
.chase-progress-mini {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
    padding: 10px 20px;
    background: var(--dark);
    border-radius: 10px;
    font-size: 0.9rem;
}

.result-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin: 20px 0;
}

.result-item {
    padding: 15px;
    border-radius: 10px;
    background: var(--dark);
}

.result-item span {
    display: block;
}

.result-item.correct {
    border: 2px solid var(--secondary);
}

.result-item.wrong {
    border: 2px solid var(--danger);
}

.correct-answer {
    color: var(--secondary);
    font-weight: 600;
    margin-top: 15px;
}

.chaser-result {
    padding: 40px;
    border-radius: 15px;
    margin: 20px 0;
}

.chaser-result.victory {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(16, 185, 129, 0.1));
    border: 2px solid var(--secondary);
}

.chaser-result.defeat {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.2), rgba(239, 68, 68, 0.1));
    border: 2px solid var(--danger);
}

.chaser-result .result-icon {
    font-size: 4rem;
    margin-bottom: 20px;
}

.chaser-answer-result {
    padding: 30px;
    border-radius: 15px;
    margin: 20px 0;
}

.chaser-answer-result.correct {
    background: rgba(16, 185, 129, 0.2);
}

.chaser-answer-result.wrong {
    background: rgba(239, 68, 68, 0.2);
}

.chaser-answer-result .result-icon {
    font-size: 3rem;
    margin-bottom: 10px;
}

.chaser-bonus-result {
    padding: 20px;
    border-radius: 10px;
    margin: 20px 0;
}

.chaser-bonus-result.good {
    background: rgba(16, 185, 129, 0.1);
}

.chaser-bonus-result.bad {
    background: rgba(239, 68, 68, 0.1);
}

.chaser-turn-start {
    padding: 40px;
}

.chaser-turn-start h3 {
    font-size: 2rem;
    color: var(--danger);
    margin-bottom: 20px;
}

.chase-progress {
    max-width: 400px;
    margin: 30px auto;
}

.chase-bar {
    height: 30px;
    background: var(--overlay);
    border-radius: 15px;
    position: relative;
}

.team-marker,
.chaser-marker {
    position: absolute;
    font-size: 1.5rem;
    top: 50%;
    transform: translate(-50%, -50%);
    transition: left 0.5s ease;
}

.chaser-victory,
.chaser-defeat {
    padding: 60px 40px;
    text-align: center;
}

.chaser-victory .victory-icon,
.chaser-defeat .defeat-icon {
    font-size: 5rem;
    margin-bottom: 30px;
}

.chaser-victory h2 {
    color: var(--secondary);
    font-size: 2.5rem;
    margin-bottom: 20px;
}

.chaser-defeat h2 {
    color: var(--danger);
    font-size: 2.5rem;
    margin-bottom: 20px;
}

.waiting-hint {
    color: var(--muted);
    font-style: italic;
    margin-top: 20px;
}

.question-preview {
    background: var(--dark);
    padding: 20px;
    border-radius: 10px;
    margin-top: 20px;
}

.question-preview .question-text {
    font-size: 1.1rem;
    color: var(--muted);
}

#party-notes-teams { margin-block: 1rem; }
#party-notes-teams h3 { margin-bottom: .6rem; }
.notes-team-row {
    --team-color: #729aff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .65rem;
    margin-block: .4rem;
    padding: .45rem .7rem;
    border-inline-start: 4px solid var(--team-color);
    border-radius: .4rem;
    background: #272b3b;
    overflow-wrap: anywhere;
}
.notes-team-row[data-team="1"] { --team-color: #ff7f87; }
.notes-team-row select {
    min-height: 44px;
    padding-inline: .6rem;
    color: #fff;
    background: #24283a;
    border: 1px solid var(--team-color);
    border-radius: .4rem;
    font: inherit;
}

/* Settings as read-only info for everyone except the host */
.config-readonly {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
    padding: 0.55rem 0;
    border-bottom: 1px solid var(--overlay);
}
.config-readonly:last-child { border-bottom: 0; }
.config-readonly-label { color: var(--muted); }
.config-readonly-value { color: var(--light); font-weight: 600; text-align: end; }

/* Shown when the server closed an unused connection, or while it hands over to a new version */
#idle-overlay,
#updating-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: grid;
    place-content: center;
    gap: 1.2rem;
    padding: 2rem;
    text-align: center;
    background: rgba(17, 17, 27, 0.92);
    color: var(--light);
    font-size: 1.3rem;
}

/* ---- Full-bleed games ----
   A game that draws its whole screen adds the class "full-bleed" to #game-content.
   The older frame (card, header, players list) steps aside and the game fills the page;
   the game's own stylesheet sets the background and everything inside. */
body:has(#game-screen.active #game-content.full-bleed) { padding: 0; background: #0B0B10; }
#game-container:has(#game-screen.active #game-content.full-bleed) {
    max-width: none; height: auto; margin: 0; padding: 0;
    background: none; border: 0; border-radius: 0; box-shadow: none;
}
#game-screen.active:has(#game-content.full-bleed) { display: block; height: auto; }
#game-screen:has(#game-content.full-bleed) > :is(#game-header, #players-sidebar) { display: none; }
#game-screen #game-content.full-bleed {
    display: block; box-sizing: border-box; width: 100%; max-width: none; height: auto;
    min-height: 100vh; min-height: 100dvh; margin: 0; padding: 0;
    background: none; border-radius: 0;
}
