.tv-page, .tv-page * { box-sizing: border-box; }
.tv-page { margin: 0; color: var(--color-text); color-scheme: dark; }
.tv-page main { width: 100%; max-width: none; margin: 0; padding: 0; border: 0; overflow: visible; background: transparent; box-shadow: none; }
.tv-page main::before, .tv-page main::after { display: none; }
.tv-page [hidden] { display: none !important; }
.tv-page a { color: var(--color-gold); }
.tv-pair-actions button, .tv-start-panel button, .tv-watch-help button, .tv-button { min-height: 58px; padding: 14px 24px; border: 2px solid var(--color-gold); border-radius: var(--radius-sm); color: #000; background: var(--color-gold); font: inherit; font-weight: 900; line-height: 1; text-align: center; text-decoration: none; text-transform: uppercase; cursor: pointer; }
.tv-page .tv-button-secondary { color: var(--color-text); background: var(--color-panel-soft); border-color: var(--color-line); }
.tv-pair-actions button:hover, .tv-pair-actions button:focus-visible, .tv-start-panel button:hover, .tv-start-panel button:focus-visible, .tv-watch-help button:hover, .tv-watch-help button:focus-visible, .tv-page .tv-button-secondary:hover, .tv-page .tv-button-secondary:focus-visible { color: #000; background: var(--color-text); border-color: var(--color-text); }
.tv-page button:focus-visible, .tv-page a:focus-visible, .tv-page input:focus-visible, .tv-page select:focus-visible { outline: 4px solid var(--color-gold-bright); outline-offset: 5px; }
.tv-page button:disabled { opacity: .65; cursor: default; }
.tv-brand { display: block; width: clamp(120px, 14vw, 200px); max-height: 72px; object-fit: contain; object-position: left; filter: drop-shadow(0 0 8px rgba(216, 185, 90, .28)); }
.tv-page main.tv-pairing { min-height: 100vh; min-height: 100dvh; max-width: 1440px; margin: auto; padding: clamp(24px, 5vw, 76px); display: flex; flex-direction: column; justify-content: center; gap: 28px; }
.tv-pairing h1 { max-width: 22ch; margin: 0; font-size: clamp(1.8rem, 3.4vw, 3.8rem); font-weight: 900; line-height: 1.15; text-transform: uppercase; }
.tv-pairing > header { display: grid; gap: 18px; padding-bottom: 12px; border-bottom: 3px solid var(--color-gold); }
.tv-pairing > header p { margin: 0; font-size: clamp(1rem, 1.5vw, 1.45rem); line-height: 1.35; color: var(--color-muted); }
.tv-pair-grid { display: grid; grid-template-columns: minmax(220px, .75fr) minmax(0, 1.4fr); gap: clamp(28px, 5vw, 72px); align-items: center; }
.tv-qr-panel { max-width: 400px; width: 100%; padding: 18px; border: 2px solid var(--color-gold); border-radius: var(--radius-lg); background: var(--color-text); color: #000; text-align: center; }
.tv-qr-panel img { display: block; width: 100%; aspect-ratio: 1; object-fit: contain; }
.tv-qr-panel p { margin: 8px 0 0; font-size: .95rem; font-weight: 800; }
.tv-pair-instructions { min-width: 0; font-size: clamp(1.05rem, 1.6vw, 1.6rem); line-height: 1.35; }
.tv-pair-instructions ol { margin: 0 0 24px; padding-left: 1.4em; }
.tv-pair-instructions li + li { margin-top: 12px; }
.tv-pair-address { overflow-wrap: anywhere; color: var(--color-gold); font-weight: 800; }
.tv-pair-code { display: block; margin: 20px 0; font-family: ui-monospace, "Cascadia Code", monospace; font-size: clamp(2.4rem, 5vw, 5rem); font-weight: 800; line-height: 1.2; letter-spacing: .14em; }
.tv-expiry { margin: 0; color: var(--color-muted); }
.tv-pair-status { margin: 16px 0 0; padding: 14px 18px; border: 1px solid var(--color-line); border-left: 3px solid var(--color-gold); border-radius: var(--radius-md); background: var(--color-panel); box-shadow: var(--shadow-tight); font-size: clamp(1rem, 1.5vw, 1.45rem); line-height: 1.35; }
.tv-pair-status[data-error="true"] { color: var(--color-text); border-left-color: var(--color-red); }
.tv-pair-actions { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; }
.tv-support-note { margin: 0; color: var(--color-muted); font-size: .95rem; line-height: 1.35; }
.tv-pairing > .tv-pair-status, .tv-pairing > .tv-support-note { width: 100%; margin-left: 0; margin-right: 0; }
.tv-approval { max-width: 760px; margin: auto; }
.tv-approval h1 { margin-top: 0; font-weight: 900; text-transform: uppercase; }
.tv-approval .tv-confirm-code { font-family: ui-monospace, monospace; font-size: 2rem; font-weight: 800; letter-spacing: .12em; }
.tv-approval label { display: block; margin-bottom: 8px; font-weight: 800; }
.tv-approval select, .tv-approval input:not([type="checkbox"]) { width: 100%; min-height: 52px; margin-bottom: 20px; }
.tv-approval input[type="checkbox"] { width: 24px; height: 24px; margin: 0 8px 0 0; vertical-align: middle; }
.tv-approval button { min-height: 56px; width: 100%; }
.tv-approval .tv-approval-note { line-height: 1.6; }
.tv-selected-broadcast { margin: 20px 0; padding: 18px 20px; border: 1px solid var(--color-line); border-left: 3px solid var(--color-gold); border-radius: var(--radius-md); background: var(--color-panel-soft); }
.tv-selected-broadcast h2 { margin: 8px 0; color: var(--color-text); font-size: clamp(1.2rem, 3vw, 1.5rem); font-weight: 900; line-height: 1.2; text-transform: uppercase; }
.tv-selected-broadcast p { margin: 8px 0; line-height: 1.5; }

.tv-watch-page { background: var(--color-ink); }
.tv-watch { position: relative; min-height: 100vh; min-height: 100dvh; }
.tv-watch .ivs-player-card.stream-player-shell { margin: 0; width: 100%; }
.tv-watch .stream-player-shell .stream-video-frame { height: 100vh; height: 100dvh; min-height: 280px; width: 100%; aspect-ratio: auto; border: 0; border-radius: 0; box-shadow: none; }
.tv-watch .stream-video-frame video { width: 100%; height: 100%; max-height: none; object-fit: contain; background: #000; }
.tv-watch .stream-custom-controls { min-height: 78px; }
.tv-watch .stream-control-button { min-width: 54px; min-height: 54px; }
.tv-watch .stream-control-button:focus-visible, .tv-watch .stream-video-frame:focus-visible { outline: 4px solid var(--color-gold-bright); outline-offset: 3px; }
.tv-watch .stream-player-feedback { top: auto; bottom: 120px; left: 5vw; max-width: 90vw; font-size: 1.2rem; }
.tv-watch .ivs-player-status { font-size: clamp(1rem, 1.5vw, 1.35rem); }
.tv-watch .stream-retry-button, .tv-watch .stream-takeover-notice button { min-height: 56px; font-size: 1rem; }
.tv-watch .stream-takeover-notice { max-width: 700px; font-size: clamp(1rem, 1.4vw, 1.3rem); }
.tv-start-panel { position: absolute; z-index: 8; top: 5vh; left: 5vw; right: 5vw; max-width: 720px; padding: 20px 24px; border: 1px solid var(--color-line-strong); border-radius: var(--radius-lg); background: var(--color-panel-strong); box-shadow: var(--shadow-panel); }
.tv-start-panel h1 { margin: 0 0 8px; font-size: clamp(1.2rem, 2vw, 2rem); font-weight: 900; text-transform: uppercase; }
.tv-start-panel p { margin: 8px 0 14px; color: var(--color-muted); font-size: clamp(1rem, 1.4vw, 1.2rem); }
.tv-start-panel button { min-width: 240px; }
.tv-start-panel a { display: inline-block; margin-left: 18px; padding: 10px 0; }
.tv-watch-help { margin: 0; padding: 18px 5vw; color: var(--color-muted); font-size: 1rem; }
.tv-watch .stream-unavailable-card { min-height: 85vh; padding: 7vw; font-size: 1.3rem; }
.tv-watch .stream-unavailable-card h3 { font-size: clamp(1.8rem, 3vw, 3rem); }

@media (min-width: 900px) and (orientation: landscape) {
    .tv-page main.tv-pairing { padding: clamp(16px, 2vh, 28px); gap: clamp(10px, 1.5vh, 16px); }
    .tv-pairing > header { grid-template-columns: auto minmax(0, 1fr); align-items: center; column-gap: 24px; row-gap: 6px; }
    .tv-pairing > header .tv-brand { grid-row: 1 / 3; width: 150px; max-height: 44px; }
    .tv-pairing h1 { grid-column: 2; max-width: none; font-size: clamp(1.8rem, 3vw, 3rem); }
    .tv-pairing > header p { grid-column: 2; font-size: clamp(1rem, 1.3vw, 1.3rem); }
    .tv-pair-grid { gap: clamp(28px, 3vw, 48px); }
    .tv-qr-panel { width: clamp(200px, 36vh, 360px); max-width: 100%; padding: 12px; }
    .tv-pair-instructions { font-size: clamp(1.05rem, 1.4vw, 1.4rem); }
    .tv-pair-instructions ol { margin-bottom: 12px; }
    .tv-pair-instructions li + li { margin-top: 8px; }
    .tv-pair-code { margin: 12px 0; font-size: clamp(2.5rem, 6vh, 4.2rem); }
    .tv-pair-status { margin-top: 0; padding: 10px 16px; font-size: clamp(1rem, 1.3vw, 1.3rem); }
}

@media (max-width: 760px) {
    .tv-page main.tv-pairing { padding: 24px; }
    .tv-pair-grid { grid-template-columns: 1fr; gap: 24px; }
    .tv-qr-panel { width: min(100%, 280px); justify-self: center; }
    .tv-pair-actions > * { width: 100%; }
    .tv-start-panel { top: 18px; left: 18px; right: 18px; padding: 16px; }
    .tv-start-panel button { min-width: 0; width: 100%; }
    .tv-start-panel a { margin-left: 0; }
    .tv-watch .stream-player-feedback { bottom: 110px; }
}

@media (prefers-reduced-motion: reduce) {
    .tv-watch *, .tv-watch *::before, .tv-watch *::after { transition: none !important; }
}
