/* ===== FONTS ===== */
@font-face {
    font-family: 'BigNoodleTitling';
    src: url('assets/fonts/BigNoodleTitling.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Oswald';
    src: url('assets/fonts/Oswald-Regular.woff2') format('woff2'),
         url('assets/fonts/Oswald-Regular.woff') format('woff');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

/* ===== VARIABLES ===== */
:root {
    --bg-navy: #002844;
    --bg-black: #000000;
    --gold-1: #c8932c;
    --gold-2: #f8f2c8;
    --gold-3: #b78014;
    --gold-4: #f3d995;
    --gold-5: #b4781c;
    --gold-accent: #e3a942;
    --text-white: #ffffff;
    --font-main: 'BigNoodleTitling', 'Oswald', sans-serif;
}

/* ===== RESET ===== */
*, *::before, *::after { box-sizing: border-box; }
html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    font-family: var(--font-main);
    overflow: hidden;
}

body.app {
    background: var(--bg-navy);
    color: var(--text-white);
}

.app-shell {
    width: 100%;
    height: 100vh;
    position: relative;
    overflow: hidden;
}

/* ===== UTILITY ===== */
.hidden { display: none !important; }

/* ===== LANDING PAGE (Setup Connection) ===== */
.landing-page {
    width: 100%;
    height: 100vh;
    background: var(--bg-navy);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 30px;
}

.landing-logo {
    width: 200px;
    height: auto;
}

.landing-buttons {
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: 280px;
}

.btn-gold {
    display: block;
    padding: 14px 32px;
    font-family: var(--font-main);
    font-size: 40px;
    color: var(--text-white);
    background: linear-gradient(90deg, var(--gold-1), var(--gold-4), var(--gold-3));
    border: none;
    border-radius: 8px;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    letter-spacing: 2px;
    transition: filter 0.15s;
}
.btn-gold:hover { filter: brightness(1.1); }

/* ===== PAIRING SCREENS ===== */

/* --- Tablet Pairing --- */
.pairing-screen {
    width: 100%;
    height: 100vh;
    background: var(--bg-navy);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 24px;
    padding: 40px;
}

.pairing-screen .pairing-logo {
    width: 200px;
    height: auto;
    margin-bottom: 10px;
}

.pairing-screen .pairing-title {
    font-size: 40px;
    text-align: center;
    letter-spacing: 1px;
    max-width: 600px;
    line-height: 1.2;
}

.pairing-screen .pairing-input-row {
    display: flex;
    flex-direction: column;
    gap: 14px;
    width: 340px;
    align-items: stretch;
}

.pairing-screen .pairing-input {
    height: 60px;
    font-family: var(--font-main);
    font-size: 44px;
    letter-spacing: 8px;
    text-align: center;
    color: var(--gold-accent);
    background: transparent;
    border: 3px solid var(--gold-accent);
    border-radius: 8px;
    outline: none;
    padding: 0 16px;
}
.pairing-screen .pairing-input::placeholder {
    color: rgba(227, 169, 66, 0.4);
}

.pairing-screen .btn-pair {
    display: block;
    padding: 12px 32px;
    font-family: var(--font-main);
    font-size: 40px;
    color: var(--text-white);
    background: linear-gradient(90deg, var(--gold-1), var(--gold-4), var(--gold-3));
    border: none;
    border-radius: 8px;
    cursor: pointer;
    letter-spacing: 2px;
    text-align: center;
}

/* --- Screen/TV Pairing --- */
.screen-pairing {
    width: 100%;
    height: 100vh;
    background: var(--bg-navy);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
}

.screen-pairing .pairing-logo {
    width: 240px;
    height: auto;
}

.screen-pairing .pairing-instruction {
    font-size: 40px;
    letter-spacing: 1px;
    text-align: center;
}

.screen-pairing .pairing-code {
    font-size: 80px;
    font-weight: 700;
    color: var(--gold-accent);
    letter-spacing: 12px;
}

.screen-pairing .pairing-waiting {
    font-size: 29px;
    color: var(--text-white);
    opacity: 0.8;
    letter-spacing: 1px;
}

/* ========================================
   BUZZER SCREEN (Gold star landing)
   Shown after pairing, before game starts
   ======================================== */
.buzzer-screen {
    width: 100%;
    height: 100vh;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Gold background — wide soft metallic bands, scrolls along X axis */
.buzzer-screen .buzzer-bg-gold {
    position: absolute;
    inset: 0;
    z-index: 1;
    filter: blur(20px);
    /* Extend slightly to avoid blurred edges showing the background */
    margin: -30px;
    background: repeating-linear-gradient(
        90deg,
        #c4900e   0%,
        #d4a428   8%,
        #e8c850  18%,
        #f5e098  30%,
        #f8ebb0  42%,
        #f5e098  54%,
        #e4be40  66%,
        #d0a020  78%,
        #c4900e 100%
    );
    background-size: 1200px 100%;
    animation: scroll-gold-x 6s linear infinite;
}
@keyframes scroll-gold-x {
    0%   { background-position: 0 0; }
    100% { background-position: -1200px 0; }
}

/* Star pattern overlay (pulsating) */
.buzzer-screen .buzzer-star-pattern {
    position: absolute;
    z-index: 2;
    width: 120%;
    height: 120%;
    object-fit: contain;
}

@keyframes pulse-star {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.06); opacity: 0.88; }
}
.buzzer-screen .buzzer-star-pattern {
    animation: pulse-star 2s ease-in-out infinite;
}

/* TV buzzer screen - star is bigger */
.buzzer-screen-tv .buzzer-star-pattern {
    width: 70%;
    height: 80%;
}

/* Press Buzzer text (iPad only) */
.buzzer-screen .buzzer-text {
    position: relative;
    z-index: 3;
    font-size: 102px;
    color: var(--bg-navy);
    text-align: center;
    line-height: 1;
    letter-spacing: 3px;
}

/* ========================================
   GAME SCREEN (Navy bg + corners + frame)
   ======================================== */
.game-screen {
    width: 100%;
    height: 100vh;
    background: var(--bg-navy);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

/* Star decorations in corners — behind the golden frame, static position */
.game-screen .stars-top-right {
    position: absolute;
    top: -3%;
    right: -3%;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}
.game-screen .stars-bottom-left {
    position: absolute;
    bottom: -3%;
    left: -3%;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

/* iPad corner star sizes */
.tablet .game-screen .stars-top-right { width: 50%; }
.tablet .game-screen .stars-bottom-left { width: 60%; }

/* TV corner star sizes */
.screen .game-screen .stars-top-right { width: 32%; }
.screen .game-screen .stars-bottom-left { width: 38%; }

/* Shine sweep across each star */
@keyframes shine-sweep {
    0%   { left: -100%; }
    40%  { left: 100%; }
    100% { left: 100%; }
}
.game-screen .stars-top-right::after,
.game-screen .stars-bottom-left::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 60%;
    height: 100%;
    background: linear-gradient(
        105deg,
        transparent 30%,
        rgba(255,255,255,0.35) 50%,
        transparent 70%
    );
    animation: shine-sweep 3.5s ease-in-out infinite;
    pointer-events: none;
}
.game-screen .stars-bottom-left::after {
    animation-delay: 1.2s;
}

/* BGT Logo in bottom-right */
.game-screen .bgt-logo {
    position: absolute;
    z-index: 3;
    pointer-events: none;
}
.tablet .game-screen .bgt-logo {
    bottom: 12px;
    right: 12px;
    width: 90px;
}
.screen .game-screen .bgt-logo {
    bottom: 20px;
    right: 24px;
    width: 160px;
}

/* ========================================
   GOLDEN FRAME
   ======================================== */
.golden-frame {
    position: relative;
    z-index: 1;
    overflow: hidden;
    background: var(--bg-navy);
}

/* Gold border using pseudo-elements for smooth gradient animation */
.golden-frame::before {
    content: '';
    position: absolute;
    inset: 0;
    padding: 17px;
    background: linear-gradient(135deg, var(--gold-1), var(--gold-2), var(--gold-3), var(--gold-4), var(--gold-5));
    -webkit-mask:
        linear-gradient(#fff 0 0) content-box,
        linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    z-index: 10;
    pointer-events: none;
}

/* Animated shimmer on the gold border */
@keyframes shimmer-border {
    0%   { background-position: 0% 0%; }
    50%  { background-position: 100% 100%; }
    100% { background-position: 0% 0%; }
}
.golden-frame::before {
    background: linear-gradient(135deg,
        var(--gold-1), var(--gold-2), var(--gold-3),
        var(--gold-4), var(--gold-5), var(--gold-1),
        var(--gold-2), var(--gold-3));
    background-size: 300% 300%;
    animation: shimmer-border 4s ease-in-out infinite;
}

/* Top & bottom blur edges inside the frame — currently disabled
.golden-frame::after {
    content: '';
    position: absolute;
    inset: 17px;
    z-index: 6;
    pointer-events: none;
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    -webkit-mask-image: linear-gradient(
        180deg,
        rgba(0,0,0,1)  0%,
        rgba(0,0,0,0) 18%,
        rgba(0,0,0,0) 82%,
        rgba(0,0,0,1) 100%
    );
    mask-image: linear-gradient(
        180deg,
        rgba(0,0,0,1)  0%,
        rgba(0,0,0,0) 18%,
        rgba(0,0,0,0) 82%,
        rgba(0,0,0,1) 100%
    );
} */

/* iPad golden frame size */
.tablet .golden-frame {
    width: 76%;
    height: 66%;
}

/* TV golden frame size */
.screen .golden-frame {
    width: 60%;
    height: 70%;
}

/* Light streaks — 3 layers of vertical stripes moving independently on Y
   Container = warm tones (slowest), ::before = cool tones (mid), ::after = accents (fastest)
   Each layer is taller than visible and animates translateY with ease-in-out */
/* Light streaks — texture image tiled on Y, scrolls with slow→fast→slow timing */
.golden-frame .texture-container {
    position: absolute;
    inset: 0;
    z-index: 1;
    background-size: 250% auto;
    background-repeat: repeat-y;
    background-position: 0 0;
}

/* Single 5s cycle: slow start → speeds up → slow end.
   Uses cubic-bezier for gradual acceleration then deceleration. */
@keyframes streaks-scroll {
    0%   { background-position: 0 0; }
    100% { background-position: 0 -4000vh; }
}

.golden-frame .texture-container.animating {
    animation: streaks-scroll 5s linear infinite;
    opacity: 1;
    transition: opacity 0.3s ease-in;
}

/* Same animation, just much slower — browser blends from fast to slow seamlessly */
.golden-frame .texture-container.decelerating {
    animation: streaks-scroll 60s linear infinite;
    opacity: 0;
    transition: opacity 0.8s ease-out;
}

/* Text overlay inside golden frame */
.golden-frame .frame-text-overlay {
    position: absolute;
    inset: 17px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 5;
    text-align: center;
    padding: 20px;
}

/* iPad text sizes */
.golden-frame .frame-text-overlay .game-label {
    font-size: 54px;
    letter-spacing: 2px;
    margin-bottom: 10px;
}

.golden-frame .frame-text-overlay .game-name {
    font-size: 82px;
    letter-spacing: 3px;
    line-height: 1.15;
}

.golden-frame .frame-text-overlay .good-luck-text {
    font-size: 82px;
    letter-spacing: 3px;
}

/* TV text sizes (larger) */
.screen .golden-frame .frame-text-overlay .game-label {
    font-size: 54px;
}
.screen .golden-frame .frame-text-overlay .game-name {
    font-size: 113px;
    line-height: 1.1;
}
.screen .golden-frame .frame-text-overlay .good-luck-text {
    font-size: 113px;
}

/* Text scale animation (gets bigger while on screen) */
@keyframes text-grow {
    0%   { transform: scale(0.85); opacity: 0; }
    15%  { opacity: 1; }
    100% { transform: scale(1.1); }
}
.text-animate {
    animation: text-grow 5s ease-out forwards;
}
.text-animate-long {
    animation: text-grow 9s ease-out forwards;
}

/* ===== OVERLAY / MODAL ===== */
.overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 24px;
}

.overlay .modal {
    background: var(--bg-navy);
    color: var(--text-white);
    border: 2px solid var(--gold-accent);
    border-radius: 18px;
    padding: 28px 26px;
    min-width: 320px;
    max-width: 520px;
    width: 100%;
}

.overlay .modal h3 {
    margin: 0 0 10px 0;
    font-size: 28px;
    letter-spacing: 1px;
}
.overlay .modal p {
    margin: 0 0 18px 0;
    font-size: 20px;
    opacity: 0.85;
}
.overlay .modal .btn-gold {
    width: 100%;
    font-size: 30px;
}

/* ===== SCREEN OFFLINE BANNER ===== */
.screen-offline-banner {
    position: fixed;
    top: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(200, 50, 50, 0.9);
    color: white;
    padding: 10px 30px;
    border-radius: 8px;
    font-size: 22px;
    z-index: 10000;
    display: none;
    letter-spacing: 1px;
    font-family: var(--font-main);
}

/* ===== FADE TRANSITIONS ===== */
.fade-in {
    animation: fadeIn 0.5s ease-in forwards;
}
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
