:root {
    /* Core Brand Colors used as bright accents */
    --lego-yellow: #FFED00; 
    --lego-red: #E3000B; 
    --lego-blue: #006CB7;
    --lego-green: #00A651; 
    --lego-orange: #FF8C00;
    
    /* Studio Dark Theme */
    --studio-bg: #0b0f19;
    --studio-panel: rgba(22, 28, 45, 0.85);
    --studio-border: rgba(255, 255, 255, 0.08);
    --text-main: #FFFFFF;
    --text-muted: #8A95A5;
    
    /* Gameshow Glows */
    --glow-blue: 0 0 20px rgba(0, 108, 183, 0.4);
    --glow-yellow: 0 0 20px rgba(255, 237, 0, 0.3);
    --glow-red: 0 0 20px rgba(227, 0, 11, 0.4);
    
    --brick-radius: 16px;
}

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

body { 
    font-family: 'Nunito', sans-serif; 
    background: radial-gradient(circle at center top, #1a233a 0%, var(--studio-bg) 100%);
    color: var(--text-main); 
    min-height: 100vh; 
    display: flex; 
    flex-direction: column; 
    overflow-x: hidden; 
}

/* Studio Lighting Background */
.brick-bg { 
    position: fixed; top: 0; left: 0; right: 0; bottom: 0; 
    opacity: 0.02; 
    background-image: url('../images/baseplate.jpg'); 
    background-size: 600px; 
    background-repeat: repeat; 
    z-index: -2; 
    pointer-events: none; 
    filter: invert(1);
}
.studio-lights {
    position: fixed; top: 0; left: 0; right: 0; height: 50vh;
    background: radial-gradient(ellipse at 50% 0%, rgba(0, 108, 183, 0.15) 0%, transparent 70%);
    z-index: -1; pointer-events: none;
}

.header { 
    padding: 32px 48px; 
    text-align: center; 
    position: relative; 
    z-index: 10; 
    display: flex; 
    justify-content: center; 
    align-items: center; 
    border-bottom: 1px solid var(--studio-border);
    background: linear-gradient(180deg, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0) 100%);
}
.header h1 { 
    font-size: 2.8rem; 
    font-weight: 900; 
    text-transform: uppercase; 
    letter-spacing: 4px; 
    color: var(--text-main);
    text-shadow: 0 4px 16px rgba(0,0,0,0.8), var(--glow-blue);
}
.header h1 span { color: var(--lego-yellow); }

.presentation-container { flex: 1; display: flex; padding: 48px; gap: 40px; max-width: 1800px; margin: 0 auto; width: 100%; align-items: stretch; }

/* Glassmorphism Panels */
.section-box { 
    background: var(--studio-panel); 
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: var(--brick-radius); 
    box-shadow: 0 24px 48px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.1); 
    padding: 32px; 
    display: flex; 
    flex-direction: column; 
    border: 1px solid var(--studio-border); 
    min-width: 0; 
}
.section-box-header { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    margin-bottom: 24px; 
    border-bottom: 1px solid var(--studio-border); 
    padding-bottom: 20px; 
}
.section-box-header h2 { font-size: 1.6rem; color: var(--text-main); text-transform: uppercase; letter-spacing: 2px; text-shadow: 0 2px 8px rgba(0,0,0,0.5); }

/* Screen Controls */
.screen-tabs { display: flex; gap: 12px; }
.screen-tab { 
    padding: 10px 24px; 
    background: rgba(0,0,0,0.4); 
    border: 1px solid var(--studio-border); 
    border-radius: 8px; 
    font-weight: 800; 
    cursor: pointer; 
    transition: all 0.3s; 
    font-family: 'Nunito', sans-serif; 
    font-size: 0.9rem; 
    color: var(--text-muted); 
    text-transform: uppercase;
    letter-spacing: 1px;
}
.screen-tab:hover { color: var(--text-main); background: rgba(255,255,255,0.05); }
.screen-tab.active { 
    background: rgba(0, 108, 183, 0.2); 
    color: var(--lego-blue); 
    border-color: var(--lego-blue); 
    box-shadow: var(--glow-blue);
}

/* Content Views */
.screen-view { display: none; flex: 1; flex-direction: column; min-width: 0; }
.screen-view.active { display: flex; animation: slideUp 0.5s cubic-bezier(0.2, 0.8, 0.2, 1); }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

.main-content { flex: 2.5; }

/* Picture Round Carousel */
.picture-carousel { position: relative; flex: 1; width: 100%; min-height: 500px; border-radius: 12px; overflow: hidden; background: #000; box-shadow: inset 0 0 40px rgba(0,0,0,0.8), 0 10px 30px rgba(0,0,0,0.5); border: 1px solid #333; }
.picture-item { position: absolute; top: 0; left: 0; width: 100%; height: 100%; opacity: 0; transition: opacity 0.8s ease-in-out; display: flex; align-items: center; justify-content: center; }
.picture-item.active { opacity: 1; z-index: 1; }
.picture-item img { width: 100%; height: 100%; object-fit: contain; }
.picture-number { position: absolute; top: 24px; left: 24px; background: var(--lego-yellow); color: #000; padding: 10px 24px; border-radius: 30px; font-weight: 900; font-size: 1.8rem; box-shadow: 0 4px 16px rgba(0,0,0,0.5), var(--glow-yellow); z-index: 2; }

/* Family Fortunes Board */
.ff-board { background: #050a14; border-radius: 16px; padding: 40px; display: flex; flex-direction: column; gap: 16px; flex: 1; box-shadow: inset 0 0 60px rgba(0, 108, 183, 0.15), 0 10px 30px rgba(0,0,0,0.5); border: 1px solid #1a2639; position: relative; }
.ff-header-area { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 32px; gap: 24px; }
.ff-question { flex: 1; text-align: center; color: var(--text-main); font-size: 1.6rem; font-weight: 900; text-transform: uppercase; letter-spacing: 2px; text-shadow: 0 4px 12px rgba(0,0,0,0.8); }
.ff-strikes-display { display: flex; gap: 8px; font-size: 2.5rem; background: rgba(0,0,0,0.5); padding: 12px 24px; border-radius: 12px; border: 1px solid #334; }
.strike-mark { opacity: 0.1; transition: opacity 0.2s, transform 0.2s; filter: grayscale(1); }
.strike-mark.active { opacity: 1; filter: grayscale(0); transform: scale(1.1); text-shadow: var(--glow-red); animation: strikePop 0.4s cubic-bezier(0.2, 0.8, 0.2, 1); }
@keyframes strikePop { 0% { transform: scale(0); opacity: 0; } 50% { transform: scale(1.5); } 100% { transform: scale(1.1); opacity: 1; } }

.ff-row { position: relative; background: linear-gradient(90deg, #0f172a 0%, #16223b 100%); border: 2px solid #2a3f63; border-radius: 8px; height: 80px; display: flex; align-items: center; overflow: hidden; cursor: pointer; box-shadow: 0 8px 16px rgba(0,0,0,0.4); transition: all 0.3s; }
.ff-row:hover { transform: scale(1.02); border-color: var(--lego-blue); box-shadow: var(--glow-blue); }
.ff-answer { flex: 1; padding: 0 32px; color: var(--lego-yellow); font-size: 2rem; font-weight: 900; text-transform: uppercase; display: flex; justify-content: space-between; align-items: center; letter-spacing: 2px; text-shadow: 0 2px 8px rgba(0,0,0,0.8); }
.ff-score { background: #000; padding: 8px 24px; border-radius: 8px; border: 2px solid var(--lego-yellow); box-shadow: inset 0 0 10px rgba(255,237,0,0.2); }
.ff-cover { position: absolute; top: 0; left: 0; right: 0; bottom: 0; background: linear-gradient(180deg, #00508c 0%, #002b4d 100%); display: flex; align-items: center; justify-content: center; z-index: 2; transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1); transform-origin: center top; border: 2px solid #006CB7; border-radius: 6px; }
.ff-cover-number { background: #000; color: var(--text-main); width: 56px; height: 56px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 2rem; font-weight: 900; box-shadow: 0 4px 8px rgba(0,0,0,0.5), inset 0 2px 0 rgba(255,255,255,0.2); border: 2px solid var(--lego-blue); }
.ff-row.revealed .ff-cover { transform: scaleY(0); opacity: 0; }
.ff-controls { display: flex; justify-content: space-between; align-items: center; margin-top: auto; padding-top: 24px; }
.ff-controls-group { display: flex; gap: 12px; }

/* Giant Strike Overlay (for impact) */
.big-strike-overlay { position: absolute; top: 0; left: 0; right: 0; bottom: 0; z-index: 100; pointer-events: none; display: flex; align-items: center; justify-content: center; opacity: 0; transform: scale(0.5); transition: all 0.3s; }
.big-strike-overlay.show { opacity: 1; transform: scale(1); animation: fadeOutStrike 1.5s forwards; }
.big-strike-overlay span { font-size: 15rem; filter: drop-shadow(0 0 50px rgba(227, 0, 11, 0.8)); text-shadow: 0 10px 30px rgba(0,0,0,0.8); }
@keyframes fadeOutStrike { 0% { opacity: 0; transform: scale(0.5); } 15% { opacity: 1; transform: scale(1.1); } 30% { opacity: 1; transform: scale(1); } 80% { opacity: 1; transform: scale(1); } 100% { opacity: 0; transform: scale(1.2); } }

/* Higher or Lower Game Board */
.hl-board { position: relative; flex: 1; display: flex; flex-direction: column; min-width: 0; }
.hl-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 32px; background: rgba(0,0,0,0.3); border-radius: 12px; padding: 20px 32px; border: 1px solid var(--studio-border); }

.hl-status { display: flex; flex-direction: column; gap: 4px; justify-content: center; }
.hl-announce { font-weight: 900; font-size: 1.4rem; color: var(--text-main); text-transform: uppercase; letter-spacing: 1px; display: flex; align-items: baseline; gap: 8px; }
.hl-announce-team { color: var(--lego-yellow); font-size: 1.8rem; }
.hl-question { color: var(--text-muted); font-weight: 700; font-size: 0.95rem; letter-spacing: 2px; text-transform: uppercase; }

.hl-score-banner { display: flex; gap: 16px; font-weight: 900; font-size: 1.5rem; align-items: center; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; }
.hl-points { background: transparent; color: var(--lego-yellow); text-shadow: var(--glow-yellow); font-size: 2.2rem; }

.hl-cards-container { display: flex; flex: 1; gap: 20px; align-items: stretch; position: relative; min-height: 420px; min-width: 0; }
.hl-card-slot { flex: 1; position: relative; min-width: 0; } 

.hl-card { background: linear-gradient(180deg, #1e2433 0%, #0f1522 100%); border: 2px solid #2a364f; border-radius: 16px; padding: 24px 16px; display: flex; flex-direction: column; align-items: center; gap: 16px; text-align: center; box-shadow: 0 16px 32px rgba(0,0,0,0.6); height: 100%; transition: all 0.6s cubic-bezier(0.34, 1.56, 0.64, 1); transform-style: preserve-3d; position: relative; min-width: 0; }
.hl-card.active-target { border-color: var(--lego-yellow); box-shadow: 0 16px 40px rgba(0,0,0,0.8), var(--glow-yellow); transform: translateY(-10px); }
.hl-card img { max-width: 100%; height: 160px; object-fit: cover; border-radius: 8px; filter: drop-shadow(0 8px 16px rgba(0,0,0,0.5)); border: 1px solid rgba(255,255,255,0.1); }
.hl-card-title { font-weight: 800; font-size: 0.95rem; line-height: 1.2; color: var(--text-main); min-height: 3em; display: flex; align-items: center; justify-content: center; word-wrap: break-word; overflow-wrap: break-word; hyphens: auto; }
.hl-card-value { background: #000; color: var(--lego-yellow); padding: 12px; border-radius: 12px; font-weight: 900; font-size: 1.4rem; margin-top: auto; letter-spacing: 1px; width: 100%; border: 1px solid #333; box-shadow: inset 0 0 15px rgba(255,237,0,0.1); word-wrap: break-word; line-height: 1.2;}

.hl-card.hidden { opacity: 0; transform: translateY(40px) rotateX(-20deg); pointer-events: none; }
.hl-card.revealed { opacity: 1; transform: translateY(0) rotateX(0deg); }

.hl-reveal-overlay { position: absolute; top: 0; left: 0; right: 0; bottom: 0; background: linear-gradient(180deg, #0b111d 0%, #05080e 100%); border-radius: 16px; border: 2px solid #1a2538; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; color: var(--text-main); z-index: 10; font-weight: 900; transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.4s; box-shadow: inset 0 0 40px rgba(0,0,0,0.8); }
.hl-row.revealed .hl-reveal-overlay { transform: scaleY(0); opacity: 0; }
.hl-card-number { width: 80px; height: 80px; border-radius: 50%; background: #000; color: var(--text-main); display: flex; align-items: center; justify-content: center; font-size: 2.5rem; box-shadow: inset 0 2px 0 rgba(255,255,255,0.1), 0 8px 16px rgba(0,0,0,0.5); border: 2px solid #333; }
.hl-status-text { text-transform: uppercase; font-size: 1rem; text-align: center; padding: 0 16px; color: var(--lego-orange); letter-spacing: 2px; }

.hl-trigger-area { position: absolute; bottom: -90px; left: 50%; transform: translateX(-50%); display: flex; gap: 24px; z-index: 100; }
.hl-btn { padding: 18px 48px; border: none; border-radius: 50px; font-family: 'Nunito', sans-serif; font-weight: 900; font-size: 1.4rem; cursor: pointer; text-transform: uppercase; letter-spacing: 2px; color: white; transition: all 0.2s; position: relative; overflow: hidden; }
.hl-btn::after { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 40%; background: linear-gradient(180deg, rgba(255,255,255,0.2) 0%, transparent 100%); }
.hl-btn:hover { transform: translateY(-4px); }
.hl-btn:active { transform: translateY(2px); }
.hl-btn-higher { background: var(--lego-green); box-shadow: 0 10px 30px rgba(0, 166, 81, 0.4), inset 0 -4px 0 rgba(0,0,0,0.3); }
.hl-btn-lower { background: var(--lego-red); box-shadow: 0 10px 30px rgba(227, 0, 11, 0.4), inset 0 -4px 0 rgba(0,0,0,0.3); }

.hl-results-overlay { position: absolute; top: 0; left: 0; right: 0; bottom: 0; background: rgba(5, 8, 14, 0.95); border-radius: 20px; z-index: 110; display: none; flex-direction: column; align-items: center; justify-content: center; gap: 24px; color: white; animation: fadeIn 0.4s; text-align: center; backdrop-filter: blur(10px); }
.hl-results-overlay.show { display: flex; }
.hl-icon-lg { font-size: 7rem; filter: drop-shadow(0 10px 20px rgba(0,0,0,0.8)); margin: 0; }
.hl-results-overlay h2 { font-size: 4rem; text-transform: uppercase; letter-spacing: 4px; text-shadow: 0 4px 16px rgba(0,0,0,0.8); margin: 0; }
.hl-results-score { font-size: 4rem; font-weight: 900; color: var(--lego-yellow); text-shadow: var(--glow-yellow); margin: 0; }

.leaderboard { flex: 1; display: flex; flex-direction: column; min-width: 0; }
#leaderboardList { flex: 1; overflow-y: auto; padding-right: 16px; margin-bottom: 24px; min-width: 0; }
#leaderboardList::-webkit-scrollbar { width: 8px; }
#leaderboardList::-webkit-scrollbar-track { background: rgba(0,0,0,0.2); border-radius: 4px; }
#leaderboardList::-webkit-scrollbar-thumb { background: #334; border-radius: 4px; }

.leaderboard-row { display: flex; justify-content: space-between; align-items: center; padding: 20px 0; border-bottom: 1px solid var(--studio-border); }
.leaderboard-row:last-child { border-bottom: none; }
.leaderboard-rank { font-weight: 900; font-size: 1.5rem; width: 40px; text-align: center; flex-shrink: 0; }
.leaderboard-team { font-weight: 800; font-size: 1.2rem; flex: 1; padding: 0 10px; text-transform: uppercase; letter-spacing: 1px; white-space: normal; word-wrap: break-word; }
.leaderboard-score { 
    font-weight: 900; font-size: 1.5rem; 
    color: var(--text-main); 
    background: rgba(0,0,0,0.5); 
    padding: 10px 20px; 
    border-radius: 8px; 
    border: 1px solid #334;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.8);
    min-width: 80px;
    text-align: center;
    flex-shrink: 0;
}

.cta-btn { padding: 16px 24px; border: none; border-radius: 12px; font-family: 'Nunito', sans-serif; font-weight: 900; font-size: 1.2rem; cursor: pointer; text-transform: uppercase; letter-spacing: 2px; transition: all 0.3s; display: flex; align-items: center; justify-content: center; gap: 12px; width: 100%; box-shadow: 0 8px 24px rgba(0,0,0,0.4); }
.cta-btn:hover { transform: translateY(-3px); }
.cta-orange { background: linear-gradient(135deg, var(--lego-orange) 0%, #cc7000 100%); color: white; border: 1px solid #ffaa44; text-shadow: 0 2px 4px rgba(0,0,0,0.3); }
.cta-orange:hover { box-shadow: 0 12px 32px rgba(255, 140, 0, 0.4); }

.cta-red { background: linear-gradient(135deg, var(--lego-red) 0%, #a00008 100%); color: white; border: 1px solid #ff3333; text-shadow: 0 2px 4px rgba(0,0,0,0.3); }
.cta-red:hover { box-shadow: 0 12px 32px rgba(227, 0, 11, 0.4); }

.cta-blue { background: linear-gradient(135deg, var(--lego-blue) 0%, #004d80 100%); color: white; border: 1px solid #3399ff; text-shadow: 0 2px 4px rgba(0,0,0,0.3); }
.cta-blue:hover { box-shadow: 0 12px 32px rgba(0, 108, 183, 0.4); }

.cta-gray { background: transparent; color: var(--text-muted); border: 1px solid var(--text-muted); box-shadow: none; width: auto; font-size: 1rem; padding: 10px 24px; }
.cta-gray:hover { background: rgba(255,255,255,0.1); color: white; }

.loading-spinner { text-align: center; padding: 40px; color: var(--text-muted); font-size: 1.2rem; font-weight: 700; text-transform: uppercase; letter-spacing: 2px; }
.loading-spinner::after { content: ''; display: block; width: 48px; height: 48px; margin: 24px auto 0; border: 4px solid var(--studio-border); border-top-color: var(--lego-blue); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Hide the giant strike by default */
.ff-big-strike {
    opacity: 0;
    transform: scale(0);
    pointer-events: none;
    transition: all 0.3s ease;
}

/* Class added by JS to trigger the animation */
.ff-big-strike.show {
    opacity: 1;
    transform: scale(1);
}

/* Dim the smaller strike trackers until activated */
.strike-mark {
    opacity: 0.2;
    filter: grayscale(100%);
    transition: all 0.3s ease;
}

.strike-mark.active {
    opacity: 1;
    filter: grayscale(0%);
}