/* =============================================================================
   Baloo Bingo - CSS Styles
   ============================================================================= */

/* CSS Variables - Baloo Bar Branding */
:root {
    /* Primary */
    --baloo-orange: #D35400;
    --baloo-orange-hover: #E67E22;

    /* Gradients */
    --gradient-teal: linear-gradient(135deg, #5DADE2 0%, #1ABC9C 100%);
    --gradient-terracotta: linear-gradient(135deg, #E67E22 0%, #C0392B 100%);
    --gradient-sand: linear-gradient(180deg, #F4D03F 0%, #F39C12 100%);

    /* Pride rainbow */
    --pride-stripe: linear-gradient(90deg,
        #E40303 0%, #FF8C00 16.67%, #FFED00 33.33%,
        #008026 50%, #24408E 66.67%, #732982 83.33%, #732982 100%);

    /* Neutrals */
    --dark-bg: #1A252F;
    --card-bg: #FFFFFF;
    --text-dark: #2C3E50;
    --text-light: #FFFFFF;
    --text-muted: #7F8C8D;

    /* Bingo ball colors */
    --ball-yellow: #F1C40F;
    --ball-pink: #E91E63;
    --ball-green: #2ECC71;
    --ball-blue: #3498DB;
    --ball-purple: #9B59B6;

    /* Vintage board colors */
    --wood-dark: #5D4037;
    --wood-medium: #8D6E63;
    --cell-bg: #F5E6C8;
    --cell-border: #5D4037;
    --cell-text: #4A3728;

    /* Sizes */
    --header-height: 80px;
    --border-radius: 16px;
    --border-radius-sm: 8px;
}

/* =============================================================================
   Base Styles
   ============================================================================= */

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

html, body {
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--dark-bg);
    color: var(--text-light);
    overflow: hidden;
}

/* Pride Stripe */
.pride-stripe {
    height: 4px;
    background: var(--pride-stripe);
    width: 100%;
    position: relative;
    z-index: 200;
}

/* =============================================================================
   Header Styles
   ============================================================================= */

.tv-header, .spectator-header, .host-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 32px;
    background: rgba(0, 0, 0, 0.3);
    position: relative;
    z-index: 200;
}

/* Bright warm header for TV */
.tv-page .tv-header {
    background: linear-gradient(180deg, rgba(139, 69, 19, 0.6) 0%, rgba(139, 69, 19, 0.3) 100%);
}

.tv-page .tv-header h1 {
    color: #5c3a21;
    text-shadow: 1px 1px 2px rgba(255,255,255,0.5);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-logo {
    height: 48px;
    width: auto;
}

.header-left h1 {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: 2px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 24px;
}

.live-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #E74C3C;
    font-weight: 700;
    font-size: 1.2rem;
}

.tv-page .live-indicator {
    color: #c0392b;
    text-shadow: 0 1px 2px rgba(255,255,255,0.3);
}

/* Game Status Boxes (Line/Bingo) */
.game-status-boxes {
    display: flex;
    gap: 16px;
    margin-right: 24px;
}

.status-box {
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 1.5rem;
    font-weight: 900;
    letter-spacing: 2px;
    text-transform: uppercase;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3), inset 0 2px 4px rgba(255,255,255,0.3);
    transition: all 0.5s ease;
    min-width: 140px;
    text-align: center;
}

.line-box {
    background: linear-gradient(180deg, #ffd700 0%, #f1c40f 50%, #d4a600 100%);
    color: #5c3a21;
    border: 3px solid #b8860b;
}

.bingo-box {
    background: linear-gradient(180deg, #2ecc71 0%, #27ae60 50%, #1e8449 100%);
    color: #fff;
    border: 3px solid #1a5e2f;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}

.status-box.won {
    background: linear-gradient(180deg, #95a5a6 0%, #7f8c8d 50%, #6c7a7b 100%);
    color: #4a5657;
    border-color: #5d6d6e;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2), inset 0 1px 2px rgba(255,255,255,0.2);
    text-shadow: none;
}

.live-dot {
    width: 12px;
    height: 12px;
    background: #E74C3C;
    border-radius: 50%;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.1); }
}

.header-qr {
    display: none;
}

/* Language Dropdown */
.lang-dropdown {
    padding: 8px 12px;
    border-radius: var(--border-radius-sm);
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(0, 0, 0, 0.3);
    color: var(--text-light);
    font-size: 0.9rem;
    cursor: pointer;
}

/* Warm theme language dropdown for TV and spectator */
.tv-page .lang-dropdown,
.spectator-page .lang-dropdown {
    border: 1px solid rgba(139, 69, 19, 0.4);
    background: rgba(255, 255, 255, 0.6);
    color: #5c3a21;
}

.language-selector {
    position: absolute;
    bottom: 16px;
    right: 16px;
}

.language-selector.game-lang {
    z-index: 100;
}

/* =============================================================================
   Ball Styles
   ============================================================================= */

.ball {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, #fff 0%, var(--ball-yellow) 50%, #000 150%);
    box-shadow:
        inset -20px -20px 40px rgba(0, 0, 0, 0.4),
        inset 10px 10px 20px rgba(255, 255, 255, 0.3),
        0 10px 30px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.ball-number {
    font-size: clamp(32px, 8vmin, 72px);
    font-weight: 900;
    color: #fff;
    text-shadow: 2px 2px 0 #000, -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000;
}

/* Ball Colors by Range */
.ball[data-range="1"] { background: radial-gradient(circle at 30% 30%, #fff 0%, var(--ball-yellow) 50%, #000 150%); }
.ball[data-range="2"] { background: radial-gradient(circle at 30% 30%, #fff 0%, var(--ball-blue) 50%, #000 150%); }
.ball[data-range="3"] { background: radial-gradient(circle at 30% 30%, #fff 0%, var(--ball-pink) 50%, #000 150%); }
.ball[data-range="4"] { background: radial-gradient(circle at 30% 30%, #fff 0%, var(--ball-green) 50%, #000 150%); }
.ball[data-range="5"] { background: radial-gradient(circle at 30% 30%, #fff 0%, var(--ball-purple) 50%, #000 150%); }

.spectator-ball {
    width: 120px;
    height: 120px;
}

.spectator-ball .ball-number {
    font-size: 56px;
}

/* =============================================================================
   TV Page Styles
   ============================================================================= */

.tv-page {
    overflow: hidden;
    background: radial-gradient(circle at 50% 30%, #e8d5b5 0%, #dcc098 60%, #c4a47c 100%);
}

.tv-page .game-screen {
    background: transparent;
}

/* Pairing Screen */
.pairing-screen {
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 48px;
}

.pairing-content {
    max-width: 600px;
}

.logo-container {
    margin-bottom: 32px;
}

.logo {
    height: 100px;
    margin-bottom: 16px;
}

.brand-title {
    font-size: 4rem;
    font-weight: 900;
    letter-spacing: 8px;
}

.pairing-instructions {
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius);
    padding: 32px;
    margin: 32px 0;
}

.pairing-title {
    font-size: 1.5rem;
    margin-bottom: 8px;
}

.pairing-instruction {
    color: var(--text-muted);
    margin-bottom: 24px;
}

.pairing-code {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin: 24px 0;
}

.code-digit {
    width: 80px;
    height: 100px;
    background: var(--card-bg);
    color: var(--text-dark);
    font-size: 48px;
    font-weight: 900;
    border-radius: var(--border-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
}

.pairing-valid {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.spectator-section {
    margin-top: 48px;
}

.qr-code {
    width: 150px;
    height: 150px;
    margin: 16px auto;
    background: white;
    border-radius: var(--border-radius-sm);
    padding: 8px;
}

/* Game Screen */
.game-screen {
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.tv-main {
    flex: 1;
    display: flex;
    padding: 2vmin;
    gap: 2vmin;
    overflow: hidden;
}

/* Lottery Machine */
.machine-area {
    flex: 0 0 35%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 280px;
    padding: 16px;
}

.lottery-machine {
    position: relative;
    width: 280px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.machine-cap {
    width: 100%;
    height: 32px;
    background: linear-gradient(90deg, #b8860b 0%, #daa520 50%, #b8860b 100%);
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.3);
    z-index: 20;
}

.glass-chamber {
    position: relative;
    width: 100%;
    height: 350px;
    background: linear-gradient(90deg,
        rgba(255,248,220,0.3) 0%,
        rgba(255,248,220,0.6) 30%,
        rgba(255,248,220,0.4) 50%,
        rgba(255,248,220,0.3) 100%);
    border-left: 2px solid rgba(218,165,32,0.5);
    border-right: 2px solid rgba(218,165,32,0.5);
    box-shadow: inset 0 0 30px rgba(255, 215, 0, 0.2);
    overflow: hidden;
}

.suction-pipe {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    top: 0;
    bottom: 60px;
    width: 60px;
    background: rgba(255,248,220,0.2);
    border-left: 1px solid rgba(218,165,32,0.4);
    border-right: 1px solid rgba(218,165,32,0.4);
}

.decorative-balls {
    position: absolute;
    inset: 0;
    padding: 16px;
}

.deco-ball {
    position: absolute;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--color);
    box-shadow: inset -4px -4px 8px rgba(0,0,0,0.3), inset 2px 2px 4px rgba(255,255,255,0.3);
    left: var(--left);
    bottom: 10%;
    animation: chaoticBounce 1.5s ease-in-out infinite alternate;
    animation-delay: var(--delay);
}

.deco-ball::after {
    content: '';
    position: absolute;
    top: 4px;
    left: 6px;
    width: 10px;
    height: 6px;
    background: rgba(255,255,255,0.4);
    border-radius: 50%;
    transform: rotate(-45deg);
}

@keyframes chaoticBounce {
    0% { transform: translate(0, 0); }
    25% { transform: translate(10px, -40px); }
    50% { transform: translate(-5px, -20px); }
    75% { transform: translate(15px, -60px); }
    100% { transform: translate(0, -30px); }
}

.lottery-machine.spinning .deco-ball {
    animation-duration: 0.2s;
}

.rising-ball {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ff8c00 0%, #cd5c00 100%);
    box-shadow: 0 4px 15px rgba(0,0,0,0.4);
    z-index: 30;
}

@keyframes suckUp {
    0% { bottom: 10%; transform: translateX(-50%) scale(0.5); opacity: 0; }
    20% { opacity: 1; }
    80% { bottom: 75%; transform: translateX(-50%) scale(0.6); }
    100% { bottom: 75%; transform: translateX(-50%) scale(1); }
}

.rising-ball.animating {
    animation: suckUp 1.5s ease-in-out forwards;
}

.display-ball {
    position: absolute;
    left: calc(50% - 60px);
    top: 60px;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, #fff 0%, var(--ball-yellow) 50%, #000 150%);
    box-shadow:
        inset -15px -15px 30px rgba(0, 0, 0, 0.4),
        inset 8px 8px 15px rgba(255, 255, 255, 0.3),
        0 10px 30px rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 40;
}

.display-ball-number {
    font-size: 56px;
    font-weight: 900;
    color: #fff;
    text-shadow: 2px 2px 0 #000, -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000;
}

/* Display ball colors by range */
.display-ball[data-range="1"] { background: radial-gradient(circle at 30% 30%, #fff 0%, var(--ball-yellow) 50%, #000 150%); }
.display-ball[data-range="2"] { background: radial-gradient(circle at 30% 30%, #fff 0%, var(--ball-blue) 50%, #000 150%); }
.display-ball[data-range="3"] { background: radial-gradient(circle at 30% 30%, #fff 0%, var(--ball-pink) 50%, #000 150%); }
.display-ball[data-range="4"] { background: radial-gradient(circle at 30% 30%, #fff 0%, var(--ball-green) 50%, #000 150%); }
.display-ball[data-range="5"] { background: radial-gradient(circle at 30% 30%, #fff 0%, var(--ball-purple) 50%, #000 150%); }

.ball-shine {
    display: none; /* No longer needed with radial gradient */
}

.display-ball.bounce-in {
    animation: bounceIn 0.8s ease-out;
}

.machine-base {
    width: 320px;
    height: 80px;
    background: #5c3a21;
    border-radius: 0 0 12px 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.4);
    border-top: 8px solid #b8860b;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 12px;
    z-index: 20;
}

.air-vents {
    display: flex;
    gap: 8px;
}

.vent {
    width: 50px;
    height: 6px;
    background: rgba(0,0,0,0.3);
    border-radius: 3px;
}

/* Previous balls shown in machine base - same style as spectator balls */
.previous-ball {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, #fff 0%, var(--ball-yellow) 50%, #000 150%);
    box-shadow:
        inset -8px -8px 16px rgba(0, 0, 0, 0.4),
        inset 4px 4px 8px rgba(255, 255, 255, 0.3),
        0 4px 12px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    flex-shrink: 0;
}

.previous-ball .ball-number {
    font-size: 22px;
    font-weight: 900;
    color: #fff;
    text-shadow: 1px 1px 0 #000, -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000;
}

/* Previous ball colors by range */
.previous-ball[data-range="1"] { background: radial-gradient(circle at 30% 30%, #fff 0%, var(--ball-yellow) 50%, #000 150%); }
.previous-ball[data-range="2"] { background: radial-gradient(circle at 30% 30%, #fff 0%, var(--ball-blue) 50%, #000 150%); }
.previous-ball[data-range="3"] { background: radial-gradient(circle at 30% 30%, #fff 0%, var(--ball-pink) 50%, #000 150%); }
.previous-ball[data-range="4"] { background: radial-gradient(circle at 30% 30%, #fff 0%, var(--ball-green) 50%, #000 150%); }
.previous-ball[data-range="5"] { background: radial-gradient(circle at 30% 30%, #fff 0%, var(--ball-purple) 50%, #000 150%); }

.ball-info {
    text-align: center;
    margin-top: 24px;
}

.balls-remaining {
    font-size: 1.4rem;
    color: #5c3a21;
    font-weight: 700;
}

/* Number Grid */
.grid-container {
    flex: 1;
    display: flex;
    align-items: stretch;
    justify-content: stretch;
    overflow: visible;
    padding: 16px;
}

.number-grid {
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    grid-template-rows: repeat(9, 1fr);
    gap: clamp(3px, 0.5vmin, 8px);
    width: 100%;
    height: 100%;
    max-height: calc(100vh - 140px);
    background: linear-gradient(90deg, #8b4513 0%, #a0522d 20%, #8b4513 50%, #5c3a21 100%);
    padding: clamp(12px, 2vmin, 24px);
    border-radius: 12px;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.5), 0 8px 20px rgba(0,0,0,0.4);
}

.grid-cell {
    background: #fdf5e6;
    border: 1px solid #dcc098;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(1.2rem, 3.5vmin, 2.5rem);
    font-weight: 900;
    color: #5c3a21;
    transition: all 0.3s ease;
    box-shadow: inset 0 0 5px rgba(139, 69, 19, 0.2), 0 2px 2px rgba(0,0,0,0.1);
}

.grid-cell.called {
    background: radial-gradient(circle, #ffaa00 0%, #ff8800 100%);
    color: #fff;
    border: 2px solid #ffd700;
    transform: scale(1.1);
    box-shadow: 0 0 15px #ffaa00, inset 0 0 5px #fff;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
    z-index: 10;
}

.grid-cell.latest {
    animation: highlightPulse 1s ease-in-out;
}

@keyframes highlightPulse {
    0%, 100% { box-shadow: 0 0 15px #ffaa00, inset 0 0 5px #fff; }
    50% { box-shadow: 0 0 25px 10px #ffaa00, inset 0 0 5px #fff; }
}

/* Ball bounceIn animation */
@keyframes bounceIn {
    0% { opacity: 0; transform: scale3d(.3, .3, .3); }
    20% { transform: scale3d(1.1, 1.1, 1.1); }
    40% { transform: scale3d(.9, .9, .9); }
    60% { opacity: 1; transform: scale3d(1.03, 1.03, 1.03); }
    80% { transform: scale3d(.97, .97, .97); }
    100% { opacity: 1; transform: scale3d(1, 1, 1); }
}

.ball.bounce-in {
    animation: bounceIn 0.8s ease-out;
}

/* Idle Overlay */
.idle-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at 50% 30%, #e8d5b5 0%, #dcc098 60%, #c4a47c 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 300;
}

.idle-background {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 0.85;
}

.idle-content {
    position: relative;
    z-index: 1;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.idle-logo {
    position: absolute;
    top: 24px;
    left: 48px;
    height: clamp(120px, 20vh, 240px);
}

.idle-text {
    font-size: clamp(2rem, 6vmin, 4rem);
    color: #FFFFFF;
    text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.9);
    animation: rainbowCycle 6s linear infinite;
    font-weight: 900;
}

@keyframes rainbowCycle {
    0%, 100% { color: #E40303; }
    16% { color: #FF8C00; }
    33% { color: #FFED00; }
    50% { color: #008026; }
    66% { color: #24408E; }
    83% { color: #732982; }
}

.idle-content h2 {
    font-size: 5rem;
    font-weight: 900;
    letter-spacing: 8px;
    margin-bottom: 16px;
}

.idle-content p:not(.idle-text) {
    font-size: 1.5rem;
    color: var(--text-muted);
}

/* =============================================================================
   Celebration Overlays
   ============================================================================= */

.celebration-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.line-celebration {
    background: rgba(241, 196, 15, 0.95);
}

.bingo-celebration {
    background: linear-gradient(45deg,
        #E40303, #FF8C00, #FFED00, #008026, #24408E, #732982);
    background-size: 400% 400%;
    animation: rainbowBg 2s ease infinite;
}

@keyframes rainbowBg {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.celebration-text {
    font-size: clamp(3rem, 12vmin, 8rem);
    font-weight: 900;
    color: var(--text-dark);
    text-shadow: 4px 4px 0 white;
}

.bingo-text {
    color: white;
    text-shadow: 4px 4px 0 rgba(0, 0, 0, 0.3);
    animation: bingoPulse 0.5s ease-in-out infinite alternate;
}

@keyframes bingoPulse {
    from { transform: scale(1); }
    to { transform: scale(1.1); }
}

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

.confetti {
    position: absolute;
    width: 10px;
    height: 20px;
    animation: confettiFall 3s linear forwards;
}

@keyframes confettiFall {
    0% { transform: translateY(-100vh) rotate(0deg); opacity: 1; }
    100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}

/* Fullscreen Prompt Overlay */
.fullscreen-prompt-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    cursor: pointer;
}

.fullscreen-prompt-content {
    text-align: center;
    color: white;
    animation: pulsePrompt 2s ease-in-out infinite;
}

.fullscreen-icon {
    font-size: 8rem;
    margin-bottom: 2rem;
}

.fullscreen-text {
    font-size: 3rem;
    font-weight: 700;
}

@keyframes pulsePrompt {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.05); opacity: 0.9; }
}

/* =============================================================================
   Spectator Page Styles
   ============================================================================= */

.spectator-page {
    height: 100%;
    overflow-y: auto;
    background: radial-gradient(circle at 50% 30%, #e8d5b5 0%, #dcc098 60%, #c4a47c 100%);
}

/* Warm header for spectator page (matching TV) */
.spectator-page .spectator-header {
    background: linear-gradient(180deg, rgba(139, 69, 19, 0.6) 0%, rgba(139, 69, 19, 0.3) 100%);
}

.spectator-page .spectator-header h1 {
    color: #5c3a21;
    text-shadow: 1px 1px 2px rgba(255,255,255,0.5);
}

.spectator-page .live-indicator {
    color: #c0392b;
    text-shadow: 0 1px 2px rgba(255,255,255,0.3);
}

.spectator-container {
    min-height: 100%;
    display: flex;
    flex-direction: column;
}

.last-ball-section {
    padding: 24px;
    text-align: center;
}

.section-label {
    font-size: 1.2rem;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.spectator-page .section-label {
    color: #5c3a21;
}

.last-ball-container {
    min-height: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.no-ball {
    font-size: 1.5rem;
    color: var(--text-muted);
}

.spectator-page .no-ball {
    color: #8b6914;
}

.previous-balls {
    margin-top: 16px;
    font-size: 1rem;
    color: var(--text-muted);
}

.spectator-page .previous-balls {
    color: #5c3a21;
}

.grid-section {
    flex: 1;
    padding: 16px;
}

.spectator-grid {
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    gap: clamp(2px, 1vw, 6px);
    width: 100%;
    max-width: min(95vw, 500px);
    margin: 0 auto;
    padding: 0 2vw;
    box-sizing: border-box;
}

.spectator-grid .grid-cell {
    width: auto;
    aspect-ratio: 1.2;
    min-height: 28px;
    font-size: clamp(0.7rem, 3vw, 1rem);
}

.spectator-footer {
    padding: 16px;
    text-align: center;
    background: rgba(0, 0, 0, 0.2);
}

.spectator-page .spectator-footer {
    background: linear-gradient(180deg, rgba(139, 69, 19, 0.2) 0%, rgba(139, 69, 19, 0.4) 100%);
}

.spectator-page .connection-status {
    color: #5c3a21;
}

/* Status boxes above the grid for spectator */
.spectator-page .status-row {
    display: flex;
    flex-flow: row nowrap;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    max-width: min(95vw, 500px);
    margin: 0 auto 8px auto;
    padding: 0 2vw;
    box-sizing: border-box;
}

.spectator-page .status-row .status-box {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 20px;
    font-size: 0.8rem;
    font-weight: bold;
    border-radius: 6px;
}

.connection-status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.status-dot.connected {
    background: var(--ball-green);
}

.status-dot.disconnected {
    background: #E74C3C;
}

.waiting-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(26, 37, 47, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.waiting-overlay p {
    font-size: 1.2rem;
    color: var(--text-muted);
}

.spectator-page .waiting-overlay {
    background: radial-gradient(circle at 50% 30%, rgba(232, 213, 181, 0.98) 0%, rgba(220, 192, 152, 0.98) 60%, rgba(196, 164, 124, 0.98) 100%);
}

.spectator-page .waiting-overlay p {
    color: #5c3a21;
    font-weight: 600;
}

/* Spectator Celebration */
.spectator-celebration {
    background: rgba(241, 196, 15, 0.95);
}

.spectator-celebration .celebration-text {
    font-size: 4rem;
}

/* =============================================================================
   Host Page Styles
   ============================================================================= */

.host-page {
    height: 100%;
    overflow-y: auto;
}

.host-container {
    max-width: 600px;
    margin: 0 auto;
    padding-bottom: 32px;
}

.host-main {
    padding: 24px;
}

/* Cards */
.card {
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--border-radius);
    padding: 24px;
    margin-bottom: 24px;
}

.card h2 {
    font-size: 1.2rem;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.divider {
    border: none;
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin: 24px;
}

/* Pairing Form */
.pairing-form p {
    margin-bottom: 16px;
    color: var(--text-muted);
}

.code-input-container {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-bottom: 16px;
}

.code-digit-input {
    width: 60px;
    height: 70px;
    text-align: center;
    font-size: 2rem;
    font-weight: 700;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--border-radius-sm);
    background: rgba(0, 0, 0, 0.3);
    color: var(--text-light);
}

.code-digit-input:focus {
    outline: none;
    border-color: var(--baloo-orange);
}

/* Collapsible Section */
.collapsible {
    padding: 0;
    margin-top: 24px;
}

.collapsible-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 16px 20px;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-light);
    text-align: left;
}

.collapsible-toggle:hover {
    background: rgba(255, 255, 255, 0.05);
}

.collapsible-toggle .icon {
    font-size: 1.2rem;
}

.toggle-indicator {
    margin-left: auto;
    transition: transform 0.3s ease;
    font-size: 0.8rem;
    opacity: 0.7;
}

.collapsible.open .toggle-indicator {
    transform: rotate(180deg);
}

.collapsible-content {
    padding: 0 20px 20px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* Paired TVs List */
.paired-tvs-list {
    margin-top: 16px;
}

.paired-tv-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: rgba(46, 204, 113, 0.15);
    border: 1px solid rgba(46, 204, 113, 0.3);
    border-radius: var(--border-radius-sm);
    margin-bottom: 8px;
}

.tv-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.tv-icon {
    font-size: 1.2rem;
}

.tv-label {
    font-weight: 600;
    color: var(--ball-green);
}

.tv-expiry {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-left: 8px;
}

.tv-actions {
    display: flex;
    gap: 8px;
}

.btn-small {
    padding: 6px 12px;
    font-size: 0.85rem;
}

.paired-status {
    text-align: center;
}

.success-message {
    color: var(--ball-green);
    font-weight: 600;
    margin-bottom: 8px;
}

.error-message {
    color: #E74C3C;
    font-size: 0.9rem;
    margin-top: 8px;
}

/* Status Section */
.status-section {
    padding: 0 24px;
    margin-bottom: 24px;
}

.status-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.status-label {
    color: var(--text-muted);
}

.status-value {
    font-weight: 600;
}

/* Control Buttons */
.controls-section {
    padding: 0 24px;
}

.button-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin: 16px 0;
}

.options-row {
    display: flex;
    justify-content: center;
    margin: 12px 0;
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius-sm);
    transition: background 0.2s ease;
}

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

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

.toggle-text {
    font-size: 0.9rem;
    color: var(--text);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    border: none;
    border-radius: var(--border-radius-sm);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

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

.btn-primary {
    background: var(--baloo-orange);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: var(--baloo-orange-hover);
}

.btn-secondary {
    background: var(--gradient-teal);
    color: white;
}

.btn-warning {
    background: var(--ball-yellow);
    color: var(--text-dark);
}

.btn-warning.active {
    background: #e67e22;
    color: white;
    box-shadow: 0 0 15px rgba(230, 126, 34, 0.6), inset 0 0 10px rgba(0,0,0,0.2);
    animation: pulse-pause 1.5s ease-in-out infinite;
}

@keyframes pulse-pause {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.btn-success {
    background: var(--ball-green);
    color: white;
}

.btn-danger {
    background: #E74C3C;
    color: white;
}

.btn-outline {
    background: transparent;
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: var(--text-light);
}

.btn-outline:hover {
    border-color: rgba(255, 255, 255, 0.5);
}

.btn-large {
    padding: 16px 32px;
    font-size: 1.2rem;
    width: 100%;
}

.btn-huge {
    padding: 32px;
    font-size: 1.5rem;
    width: 100%;
}

/* History Section */
.history-section {
    padding: 24px;
    text-align: center;
}

.history-label {
    color: var(--text-muted);
    margin-bottom: 12px;
}

.ball-history {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}

.history-ball {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--baloo-orange);
    color: white;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Login Section */
.login-section {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 120px);
    padding: 24px;
}

.login-card {
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--border-radius);
    padding: 48px;
    text-align: center;
    width: 100%;
    max-width: 400px;
}

.login-card h2 {
    margin-bottom: 24px;
}

.pin-input-container {
    margin-bottom: 24px;
}

.pin-input-container input {
    width: 100%;
    padding: 16px;
    font-size: 2rem;
    text-align: center;
    letter-spacing: 8px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--border-radius-sm);
    background: rgba(0, 0, 0, 0.3);
    color: var(--text-light);
}

.pin-input-container input:focus {
    outline: none;
    border-color: var(--baloo-orange);
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: var(--dark-bg);
    border-radius: var(--border-radius);
    padding: 32px;
    max-width: 400px;
    text-align: center;
}

.modal-content p {
    margin-bottom: 24px;
    font-size: 1.1rem;
}

.modal-buttons {
    display: flex;
    gap: 16px;
    justify-content: center;
}

.modal-buttons .btn {
    flex: 1;
}

/* =============================================================================
   Responsive Styles
   ============================================================================= */

@media (max-width: 768px) {
    .tv-main {
        flex-direction: column;
        padding: 2vmin;
        gap: 2vmin;
    }

    .ball-area {
        flex: 0 0 auto;
        min-width: unset;
    }

    .ball-container {
        width: min(40vw, 200px);
        height: min(40vw, 200px);
    }

    .number-grid {
        grid-template-columns: repeat(10, 1fr);
        max-width: 95vw;
    }

    .grid-cell {
        font-size: clamp(0.7rem, 2.5vw, 1rem);
    }

    .celebration-text {
        font-size: 4rem;
    }

    .code-digit {
        width: 60px;
        height: 80px;
        font-size: 36px;
    }
}

@media (max-width: 480px) {
    .spectator-grid .grid-cell {
        min-height: 24px;
        font-size: clamp(0.65rem, 2.5vw, 0.85rem);
    }

    .spectator-ball {
        width: min(25vw, 100px);
        height: min(25vw, 100px);
    }

    .spectator-ball .ball-number {
        font-size: clamp(24px, 10vw, 48px);
    }

    .last-ball-section {
        padding: 12px;
    }
}

/* Landscape orientation for mobile */
@media (max-width: 900px) and (orientation: landscape) {
    .spectator-container {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .spectator-header {
        width: 100%;
        flex-shrink: 0;
    }

    .last-ball-section {
        width: 30%;
        padding: 8px;
        display: flex;
        flex-direction: column;
        justify-content: center;
    }

    .last-ball-container {
        margin: 8px 0;
    }

    .spectator-ball {
        width: min(15vh, 80px);
        height: min(15vh, 80px);
    }

    .spectator-ball .ball-number {
        font-size: clamp(20px, 8vh, 36px);
    }

    .previous-balls {
        font-size: 0.8rem;
    }

    .grid-section {
        width: 70%;
        padding: 8px;
        display: flex;
        align-items: center;
    }

    .spectator-grid {
        max-width: 100%;
        padding: 0 1vw;
    }

    .spectator-grid .grid-cell {
        min-height: 20px;
        aspect-ratio: 1.5;
        font-size: clamp(0.6rem, 2vh, 0.9rem);
    }

    .spectator-footer {
        width: 100%;
        padding: 8px;
    }
}

@media (max-width: 480px) {
    .code-digit-input {
        width: 50px;
        height: 60px;
        font-size: 1.5rem;
    }

    .btn-huge {
        padding: 24px;
        font-size: 1.2rem;
    }
}
