/* style-host-display.css — host big-screen scoreboards + live-answer tiles + live-players list.
   Split VERBATIM out of style.css (2026-06-27), loaded in original order between style.css and
   style-misc.css so the cascade is byte-identical. */

/* ========== Mini-Scoreboard Styles ========== */

#mini-scoreboard {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-top: 3px solid #007bff;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    display: none;
    transition: transform 0.3s ease-in-out;
    max-height: 25vh;
    overflow-y: auto;
}

.mini-scoreboard-header {
    padding: 8px 15px;
    background: linear-gradient(135deg, #007bff, #0056b3);
    color: white;
    font-weight: 600;
    font-size: 0.9rem;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.mini-scores-list {
    padding: 10px 15px;
    max-height: 150px;
    overflow-y: auto;
}

.mini-score-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    border-bottom: 1px solid #e9ecef;
    font-size: 0.85rem;
}

.mini-score-item:last-child {
    border-bottom: none;
}

.mini-position {
    font-weight: 600;
    min-width: 30px;
    text-align: center;
    font-size: 0.9rem;
}

.mini-team {
    flex: 1;
    margin: 0 10px;
    font-weight: 500;
    color: #495057;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mini-score {
    font-weight: 700;
    color: #007bff;
    min-width: 40px;
    text-align: right;
}

/* Smooth scrollbar for scores list */
.mini-scores-list::-webkit-scrollbar {
    width: 4px;
}

.mini-scores-list::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.mini-scores-list::-webkit-scrollbar-thumb {
    background: #007bff;
    border-radius: 2px;
}

.mini-scores-list::-webkit-scrollbar-thumb:hover {
    background: #0056b3;
}

/* Mobile optimizations for mini-scoreboard */
@media (max-width: 768px) {
    #mini-scoreboard {
        max-height: 20vh;
    }
    
    .mini-scoreboard-header {
        padding: 6px 10px;
        font-size: 0.8rem;
    }
    
    .mini-scores-list {
        padding: 8px 10px;
        max-height: 120px;
    }
    
    .mini-score-item {
        padding: 4px 0;
        font-size: 0.8rem;
    }
    
    .mini-position {
        min-width: 25px;
        font-size: 0.8rem;
    }
    
    .mini-team {
        margin: 0 8px;
    }
    
    .mini-score {
        min-width: 35px;
    }
}

@media (max-width: 480px) {
    #mini-scoreboard {
        max-height: 18vh;
    }
    
    .mini-scoreboard-header {
        font-size: 0.75rem;
        padding: 5px 8px;
    }
    
    .mini-scores-list {
        padding: 6px 8px;
        max-height: 100px;
    }
    
    .mini-score-item {
        font-size: 0.75rem;
        padding: 3px 0;
    }
    
    .mini-position {
        min-width: 20px;
        font-size: 0.75rem;
    }
    
    .mini-team {
        margin: 0 6px;
    }
    
    .mini-score {
        min-width: 30px;
    }
}

/* ========== Full-Screen Scoreboard Styles ========== */

.full-scoreboard-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f0f23 100%);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: scale(0.9);
    transition: all 0.5s ease-in-out;
}

.full-scoreboard-overlay.visible {
    opacity: 1;
    transform: scale(1);
}

.full-scoreboard-container {
    max-width: 90vw;
    max-height: 90vh;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    overflow: hidden;
    position: relative;
}

.full-scoreboard-header {
    background: linear-gradient(135deg, #007bff, #0056b3);
    color: white;
    text-align: center;
    padding: 30px 20px;
    border-bottom: 3px solid #ffd700;
}

.full-scoreboard-title {
    font-size: 3.5rem;
    font-weight: 900;
    margin: 0;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    animation: pulse-glow 2s infinite alternate;
}

.full-scoreboard-subtitle {
    font-size: 1.5rem;
    margin-top: 10px;
    opacity: 0.9;
    font-weight: 500;
}

@keyframes pulse-glow {
    0% { text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3); }
    100% { text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3), 0 0 20px rgba(255, 215, 0, 0.5); }
}

.full-scoreboard-scores {
    padding: 30px;
    max-height: 60vh;
    overflow-y: auto;
}

.full-scoreboard-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 25px;
    margin-bottom: 15px;
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border: 2px solid #dee2e6;
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    animation: slideInFromRight 0.6s ease-out both;
}

@keyframes slideInFromRight {
    0% {
        opacity: 0;
        transform: translateX(50px);
    }
    100% {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Optional animation for items when not using scroll reveal */
.full-scoreboard-item.score-item-animate {
    animation: slideInFromRight 0.6s ease-out both;
}

.full-scoreboard-item.position-1 {
    background: linear-gradient(135deg, #ffd700, #ffed4e);
    border-color: #ffbf00;
    transform: scale(1.05);
    box-shadow: 0 8px 25px rgba(255, 215, 0, 0.3);
}

.full-scoreboard-item.position-2 {
    background: linear-gradient(135deg, #c0c0c0, #d3d3d3);
    border-color: #a0a0a0;
    transform: scale(1.02);
}

.full-scoreboard-item.position-3 {
    background: linear-gradient(135deg, #cd7f32, #daa520);
    border-color: #b8860b;
    transform: scale(1.01);
}

.score-position {
    font-size: 2.5rem;
    font-weight: 900;
    min-width: 80px;
    text-align: center;
}

.score-team {
    flex: 1;
    font-size: 2rem;
    font-weight: 700;
    margin: 0 20px;
    color: #495057;
    text-align: center;
}

.score-points {
    font-size: 2.5rem;
    font-weight: 900;
    color: #007bff;
    min-width: 100px;
    text-align: center;
    background: rgba(0, 123, 255, 0.1);
    padding: 10px 15px;
    border-radius: 10px;
}

.full-scoreboard-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid white;
    color: white;
    font-size: 2rem;
    font-weight: bold;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.full-scoreboard-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

/* Smooth scrollbar for scores list */
.full-scoreboard-scores::-webkit-scrollbar {
    width: 8px;
}

.full-scoreboard-scores::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.full-scoreboard-scores::-webkit-scrollbar-thumb {
    background: #007bff;
    border-radius: 4px;
}

.full-scoreboard-scores::-webkit-scrollbar-thumb:hover {
    background: #0056b3;
}

/* Mobile responsive adjustments for full-screen scoreboard */
@media (max-width: 768px) {
    .full-scoreboard-title {
        font-size: 2.5rem;
    }
    
    .full-scoreboard-subtitle {
        font-size: 1.2rem;
    }
    
    .full-scoreboard-header {
        padding: 20px 15px;
    }
    
    .full-scoreboard-scores {
        padding: 20px 15px;
    }
    
    .full-scoreboard-item {
        padding: 15px 20px;
        margin-bottom: 10px;
    }
    
    .score-position {
        font-size: 2rem;
        min-width: 60px;
    }
    
    .score-team {
        font-size: 1.5rem;
        margin: 0 15px;
    }
    
    .score-points {
        font-size: 2rem;
        min-width: 80px;
        padding: 8px 12px;
    }
}

@media (max-width: 480px) {
    .full-scoreboard-title {
        font-size: 2rem;
    }
    
    .full-scoreboard-subtitle {
        font-size: 1rem;
    }
    
    .full-scoreboard-item {
        padding: 12px 15px;
        flex-direction: column;
        text-align: center;
    }
    
    .score-position {
        font-size: 1.8rem;
        margin-bottom: 8px;
    }
    
    .score-team {
        font-size: 1.3rem;
        margin: 8px 0;
    }
    
    .score-points {
        font-size: 1.8rem;
        margin-top: 8px;
    }
}

/* Enhanced Buzz Button Animations */
@keyframes pulse {
    0% {
        transform: scale(1.05);
        box-shadow: 0 12px 35px rgba(220, 53, 69, 0.9);
    }
    50% {
        transform: scale(1.1);
        box-shadow: 0 15px 45px rgba(220, 53, 69, 1);
    }
    100% {
        transform: scale(1.05);
        box-shadow: 0 12px 35px rgba(220, 53, 69, 0.9);
    }
}

@keyframes flash {
    0%, 50% {
        opacity: 1;
        color: #dc3545;
    }
    25%, 75% {
        opacity: 0.7;
        color: #ff1a1a;
    }
}

/* Buzz button enabled state with enhanced visibility */
.buzz-enabled {
    background-color: #dc3545 !important;
    border-color: #dc3545 !important;
    color: white !important;
    cursor: pointer !important;
    pointer-events: auto !important;
}

.buzz-enabled:hover {
    background-color: #bb2d3b !important;
    border-color: #bb2d3b !important;
}

/* Status text animation for enabled buzzers */
.buzzer-status-enabled {
    animation: flash 1s infinite;
    text-shadow: 0 0 5px rgba(220, 53, 69, 0.5);
}

/* ================================================
   LIVE ANSWER TILES STYLES
   ================================================ */

/* Player tile grid container */
.player-tile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 5px;
    padding: 5px;
    max-height: 350px;
    overflow-y: auto;
}

/* Individual player tile */
.player-tile {
    background: var(--surface-light, white);
    border: 2px solid var(--border-light, #dee2e6);
    border-radius: 6px;
    padding: 6px;
    position: relative;
    transition: all 0.3s ease;
    min-height: 70px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

/* Tile states */
.player-tile.pending {
    opacity: 0.4;
    background: var(--bg-light, #f8f9fa);
    border-color: #ced4da;
}

.player-tile.answered {
    opacity: 1;
    background: #fff3cd;
    border-color: #ffc107;
    box-shadow: 0 2px 4px rgba(255, 193, 7, 0.3);
}

.player-tile.correct {
    background: #d1e7dd;
    border-color: #198754;
    box-shadow: 0 2px 4px rgba(25, 135, 84, 0.3);
}

.player-tile.incorrect {
    background: #f8d7da;
    border-color: #dc3545;
    box-shadow: 0 2px 4px rgba(220, 53, 69, 0.3);
}

/* Stronger right/wrong readability (owner 2026-07-03: "more clearly show which players have
   gotten the question right"). A thick status edge + a bold corner glyph make correct vs
   incorrect readable at a glance across the rail, not just by pastel background. */
.player-tile.correct   { border-left: 6px solid #198754; }
.player-tile.incorrect { border-left: 6px solid #dc3545; }
.player-tile.partial   { background: #fff8e1; border-color: #ffc107; border-left: 6px solid #ffc107; }
.player-tile.correct::after,
.player-tile.incorrect::after {
    position: absolute;
    top: 2px;
    right: 6px;
    font-size: 1rem;
    font-weight: 900;
    line-height: 1;
    pointer-events: none;
}
.player-tile.correct::after   { content: '✓'; color: #198754; }
.player-tile.incorrect::after { content: '✗'; color: #dc3545; }

/* ⚡ Fast Track sneak-peek (owner 2026-07-03): once the answer is revealed and a fast-track is
   pending (server: fast_track_eligible — knowable only after the question closes), the affected
   player's tile PULSES blue until the host clicks Announce. After the announce
   (fast_track_pending) the pulse stops and the tile keeps a solid fast-track edge instead. */
@keyframes ftSneakPulse {
    0%, 100% { box-shadow: 0 0 6px rgba(13, 110, 253, 0.35); }
    50%      { box-shadow: 0 0 18px rgba(13, 110, 253, 0.85); }
}
.player-tile.ft-sneak-peek {
    animation: ftSneakPulse 0.9s ease-in-out infinite;
    border-color: #0d6efd;
}
.player-tile.fast-track {
    border-left: 6px solid #0d6efd;
    box-shadow: 0 0 10px rgba(13, 110, 253, 0.45);
}

.player-tile.disconnected {
    opacity: 0.3;
    background: #e9ecef;
    border-color: #adb5bd;
}

/* Player info within tile */
.player-tile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
}

.player-tile-name {
    font-weight: bold;
    font-size: 0.75rem;
    color: #212529;
    margin: 0;
    line-height: 1.1;
    max-width: 90px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.player-tile-score {
    font-size: 0.65rem;
    color: #495057;
    font-weight: 500;
    margin: 0;
}

.player-tile-answer {
    font-size: 0.7rem;
    color: #495057;
    margin: 2px 0;
    font-weight: 500;
    text-align: center;
    padding: 2px 4px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 3px;
    min-height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.player-tile-timestamp {
    font-size: 0.6rem;
    color: #6c757d;
    text-align: center;
    margin-top: 2px;
}

/* Distance indicator for numeric questions */
.player-tile-distance {
    font-size: 0.6rem;
    color: #6c757d;
    text-align: center;
    margin-top: 1px;
    font-style: italic;
}

/* Connection indicator */
.connect-indicator {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

.connect-indicator.connected {
    background-color: #198754;
    animation: pulse-green 2s infinite;
}

.connect-indicator.disconnected {
    background-color: #6c757d;
}

/* ===== Keyboard shortcut flash on Dynamic Flow button ===== */
@keyframes kb-flash {
    0%   { box-shadow: 0 0 0 3px rgba(255,193,7,0.0); }
    35%  { box-shadow: 0 0 0 5px rgba(255,193,7,0.9); }
    100% { box-shadow: 0 0 0 3px rgba(255,193,7,0.0); }
}
.keyboard-flash { animation: kb-flash 0.2s ease-out; }

/* ===== Soundboard key-assignment badge ===== */
.sound-key-badge { vertical-align: middle; transition: background .15s; }
.sound-key-badge:hover { filter: brightness(1.15); }
.sound-key-badge.assigned { background: #0d6efd !important; color: #fff !important; }

/* ===== Rank-ordered Live Players list (merged Live Answer Status + Live Answer Log) ===== */
.player-tile-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 4px;
    /* No inner scrollbar — the list grows downward into the empty space below it (the host asked for
       this; there was lots of unused room under the card + the answer-distribution chart). */
    max-height: none;
    overflow: visible;
}
.player-tile-list .player-tile {
    min-height: 0;
    height: auto;
    padding: 8px 26px 8px 10px; /* room for the connect dot on the right */
    flex-direction: column;
    justify-content: flex-start; /* stack line1/line2 at the top — never push line2 out of the box */
    gap: 4px;
    opacity: 1;
    border-width: 2px;
    overflow: visible;
}
/* Each answer line keeps its own row height so nothing collapses behind the next tile. */
.player-tile-line1, .player-tile-line2 { width: 100%; flex: 0 0 auto; min-height: 1.2em; }
.player-tile-list .player-tile.pending { opacity: 0.7; }
.player-tile-line1 {
    display: flex;
    align-items: baseline;
    gap: 8px;
}
.player-tile-line2 {
    display: flex;
    align-items: center;
    gap: 7px;
}
.player-tile-rank {
    font-weight: 800;
    font-size: 1.05rem;
    color: #0d6efd;
    min-width: 30px;
}
.player-tile-list .player-tile-name {
    flex: 1;
    min-width: 0;
    max-width: none;
    font-size: 1.1rem;
    font-weight: 700;
    color: #111;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.player-tile-list .player-tile-score {
    font-size: 1rem;
    font-weight: 800;
    color: #111;
    white-space: nowrap;
}
/* Result badge (✓/✗/◐%) — its own fixed item so it never overlaps the answer */
.player-tile-result {
    flex-shrink: 0;
    display: flex;
    gap: 3px;
    align-items: center;
}
.player-tile-list .player-tile-answer {
    margin: 0;
    text-align: left;
    justify-content: flex-start;
    background: transparent;
    padding: 0;
    flex: 1 1 auto;
    min-width: 0;
    min-height: 0;
    font-size: 1.05rem;
    font-weight: 600;
    color: #111;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.player-tile-list .player-tile-answer .text-muted { color: #555 !important; }
.player-tile-list .player-tile-time {
    flex-shrink: 0;
    color: #555;
    font-size: 0.85rem;
    white-space: nowrap;
}
.player-tile-list .player-tile-badges {
    display: flex;
    gap: 4px;
    align-items: center;
    flex-shrink: 0;
    flex-wrap: wrap;
    justify-content: flex-end;
}
.player-tile-list .player-tile-badges .badge,
.player-tile-result .badge { font-size: 0.85rem; }

/* In the merged list, "answered" = submitted but correctness not yet known
   (buzz / agree-disagree / numeric pre-reveal) — neutral blue, not amber. */
.player-tile-list .player-tile.answered {
    background: #cfe2ff;
    border-color: #0d6efd;
    box-shadow: none;
}
/* Stronger, higher-contrast state shades for the merged list */
.player-tile-list .player-tile.correct {
    background: #b6ecc8;
    border-color: #146c43;
}
.player-tile-list .player-tile.incorrect {
    background: #f5c2c7;
    border-color: #b02a37;
}
/* Partial credit (e.g. multi-tap < 100%) — amber */
.player-tile.partial,
.player-tile-list .player-tile.partial {
    background: #ffe69c;
    border-color: #cc8a00;
    box-shadow: 0 2px 4px rgba(253, 126, 20, 0.3);
}

/* Player avatar placeholder */
.player-tile-avatar {
    width: 18px;
    height: 18px;
    background: #e9ecef;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.55rem;
    font-weight: bold;
    color: #495057;
    margin-right: 4px;
}

