* {
    -webkit-box-sizing: border-box;
    box-sizing: border-box;
}

:root {
    --tv-bg: #2E4057;
    --tv-text: #FFFFFF;
    --tv-text-secondary: #CBD5E1;
    --tv-border: rgba(255,255,255,0.2);
    --tv-border-light: rgba(255,255,255,0.3);
    --tv-card-bg: rgba(255,255,255,0.08);
    --tv-btn-primary: #257ef4;
    --tv-btn-primary-hover: #1d5fd1;
    --tv-focus-amber: #fbbf24;
}

body {
    margin: 0;
    font-family: 'Space Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--tv-bg);
    color: var(--tv-text);
    overflow: hidden;
    -webkit-transition: background-color 0.3s, color 0.3s;
    transition: background-color 0.3s, color 0.3s;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Space Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* GLOBAL FOCUS FOR REMOTE NAVIGATION */
:focus {
    outline: 6px solid var(--tv-focus-amber) !important;
    outline-offset: 4px;
    -webkit-transform: scale(1.05);
    transform: scale(1.05);
    -webkit-transition: -webkit-transform 0.2s ease-in-out;
    transition: transform 0.2s ease-in-out;
    z-index: 100;
}

.tv-card {
    background: var(--tv-card-bg);
    border: 1px solid var(--tv-border);
    border-radius: 1rem;
    -webkit-transition: background-color 0.3s, border-color 0.3s;
    transition: background-color 0.3s, border-color 0.3s;
}

.tv-input {
    display: block;
    width: 100%;
    background: transparent;
    border: 2px solid var(--tv-border-light);
    border-radius: 0.75rem;
    color: var(--tv-text);
    font-size: 3rem;
    font-family: monospace;
    text-align: center;
    letter-spacing: 0.5em;
    padding: 1rem 0.5rem;
    text-transform: uppercase;
    outline: none;
    -webkit-transition: border-color 0.2s, background-color 0.2s, transform 0.2s;
    transition: border-color 0.2s, background-color 0.2s, transform 0.2s;
}

    .tv-input:focus {
        border-color: var(--tv-focus-amber);
        background: rgba(255, 255, 255, 0.15);
        color: #FFFFFF;
    }

/* PRIMARY BUTTONS */
.tv-btn-primary {
    display: block;
    width: 100%;
    padding: 1.1rem;
    background: var(--tv-btn-primary);
    color: white;
    font-size: 1.5rem;
    font-weight: 700;
    border: none;
    border-radius: 0.75rem;
    cursor: pointer;
    font-family: 'Space Grotesk', inherit;
    -webkit-transition: all 0.2s;
    transition: all 0.2s;
}

    .tv-btn-primary:hover,
    .tv-btn-primary:focus {
        opacity: 1;
        background: var(--tv-btn-primary-hover);
        -webkit-transform: scale(1.05);
        transform: scale(1.05);
    }

    .tv-btn-primary:disabled {
        opacity: 0.4;
        cursor: default;
        -webkit-transform: none !important;
        transform: none !important;
        outline: none !important;
    }

/* OUTLINE BUTTONS (e.g. Re-Pair) */
.tv-btn-outline {
    display: block;
    width: 100%;
    padding: 1rem;
    background: var(--tv-card-bg);
    color: var(--tv-text);
    font-size: 1.2rem;
    font-weight: 600;
    border: 1.5px solid var(--tv-border);
    border-radius: 0.75rem;
    cursor: pointer;
    font-family: 'Space Grotesk', inherit;
    -webkit-transition: all 0.2s;
    transition: all 0.2s;
}

    .tv-btn-outline:hover,
    .tv-btn-outline:focus {
        background: var(--tv-border);
        border-color: var(--tv-focus-amber);
        -webkit-transform: scale(1.05);
        transform: scale(1.05);
    }

.tv-muted {
    color: var(--tv-text-secondary);
}

.pair-columns {
    display: -webkit-flex;
    display: flex;
    gap: 2.5rem;
    width: 100%;
    max-width: 960px;
    -webkit-align-items: stretch;
    align-items: stretch;
}

.pair-col {
    -webkit-flex: 1;
    flex: 1;
}

@media (max-width: 700px) {
    .pair-columns {
        -webkit-flex-direction: column-reverse;
        flex-direction: column-reverse;
    }
}

.qr-nickname {
    font-family: monospace;
    font-size: 1.4rem;
    letter-spacing: 0.08em;
    color: #e2e8f0;
    margin: 0.75rem 0 0.25rem;
}

/* TICKER ANIMATIONS */
@-webkit-keyframes ticker-scroll {
    0% {
        -webkit-transform: translateX(100vw);
        transform: translateX(100vw);
    }

    100% {
        -webkit-transform: translateX(-100%);
        transform: translateX(-100%);
    }
}

@keyframes ticker-scroll {
    0% {
        transform: translateX(100vw);
    }

    100% {
        transform: translateX(-100%);
    }
}

.player-ticker-text {
    display: inline-block;
    white-space: nowrap;
    -webkit-animation: ticker-scroll linear infinite;
    animation: ticker-scroll linear infinite;
    line-height: 1;
    padding-top: 0.15em;
}

/* NETWORK SPINNER ANIMATION */
@-webkit-keyframes spinner-blink {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 1; }
}

@keyframes spinner-blink {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 1; }
}

.spinner-dot {
    display: inline-block;
    -webkit-animation: spinner-blink 1.4s infinite;
    animation: spinner-blink 1.4s infinite;
}

.spinner-dot:nth-child(2) {
    -webkit-animation-delay: 0.2s;
    animation-delay: 0.2s;
}

.spinner-dot:nth-child(3) {
    -webkit-animation-delay: 0.4s;
    animation-delay: 0.4s;
}

/* Manual retry control in the network overlay (RESIL-03). Inline styles cover the resting
   state; these cover the states inline styles cannot express. The focus ring uses the same
   amber the TV shells use for remote focus, so a D-pad user can see where they are. */
#network-retry:hover {
    background: rgba(255, 255, 255, 0.28);
}

#network-retry:focus {
    outline: 2px solid #fbbf24;
    outline-offset: 1px;
}
