/* Watch-first layout: one video stage, one directory, no floating page chrome. */
* { box-sizing: border-box; }
html { height: 100%; overflow: hidden; background: var(--bg); }
body.watch-page { height: 100dvh; overflow: hidden; display: flex; flex-direction: column; margin: 0; color: var(--text); background: var(--bg); font-family: var(--font-body); -webkit-font-smoothing: antialiased; }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
button svg, a svg { flex-shrink: 0; }
button { color: inherit; }
.hidden, [hidden] { display: none !important; }
ul { margin: 0; padding: 0; list-style: none; }
svg { display: block; }
kbd { font: 10px ui-monospace, monospace; border: 1px solid var(--line); border-radius: 4px; padding: 2px 5px; color: var(--text-faint); }
.site-header { height: 72px; flex: 0 0 72px; padding: 0 24px; display: flex; align-items: center; gap: 32px; border-bottom: 1px solid #ffffff0b; }
.wordmark { display: inline-flex; align-items: center; gap: 8px; flex-shrink: 0; }
.wordmark > span { font-size: 24px; font-weight: 700; letter-spacing: -.8px; }
.primary-nav { display: flex; align-items: stretch; align-self: stretch; gap: 32px; }
.primary-nav a, .primary-nav button { position: relative; display: flex; align-items: center; gap: 8px; padding: 0; border: none; background: none; color: var(--text-faint); font-weight: 600; font-size: 14px; white-space: nowrap; }
.primary-nav .nav-current { color: var(--text); }
.nav-current::after { content: ''; position: absolute; bottom: -1px; height: 3px; background: var(--accent); left: 0; right: 0; border-radius: 3px 3px 0 0; }
.primary-nav button:hover { color: var(--text); }
.sports-count { display: inline-grid; place-items: center; min-width: 18px; height: 18px; background: #2c2639; color: var(--accent); border-radius: 5px; font-size: 10px; }
.header-actions { margin-left: auto; display: flex; align-items: center; gap: 24px; }
.header-search { display: flex; align-items: center; gap: 10px; width: 260px; height: 44px; padding: 0 13px; background: #1e1c22; border: 1px solid #ffffff08; border-radius: 8px; color: var(--text-faint); font-size: 14px; }
.header-search svg { width: 17px; height: 17px; }
.header-search kbd { margin-left: auto; }
.header-search:hover { border-color: var(--line); }
.remote-link { display: inline-flex; align-items: center; gap: 9px; font-size: 14px; font-weight: 600; white-space: nowrap; }
.remote-link svg { width: 19px; height: 19px; color: var(--text-dim); }
.remote-link:hover { color: var(--accent); }
.watch-layout { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; padding: 16px 24px; }
.watch-column { min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.eyebrow { font: 500 10px ui-monospace, monospace; letter-spacing: 1.6px; color: var(--text-faint); }
#player-container { position: relative; width: 100%; flex: 1; min-height: 0; isolation: isolate; border-radius: 12px; background: #050505; overflow: hidden; box-shadow: 0 12px 40px #0003; }
.player-wrapper, .hls-player { position: absolute; inset: 0; width: 100%; height: 100%; }
.hls-player { object-fit: contain; background: #050505; }
#dock { position: absolute; z-index: 20; bottom: 0; left: 0; right: 0; padding: 44px 16px 10px; background: linear-gradient(transparent, #000b); pointer-events: none; transition: opacity 180ms; }
#transport { display: flex; align-items: center; gap: 6px; padding: 0; background: transparent; border: 0; box-shadow: none; border-radius: 0; pointer-events: auto; }
.ctrl-btn { display: inline-grid; place-items: center; width: 44px; height: 44px; min-width: 44px; min-height: 44px; padding: 0; border: 0; border-radius: 6px; background: none; color: #fff; flex-shrink: 0; }
.ctrl-btn svg { width: 21px; height: 21px; }
.ctrl-btn:hover { background: #ffffff20; }
.ctrl-btn:active { background: #ffffff30; }
.ctrl-btn[aria-pressed='true'] { color: var(--accent); }
#volume-slider { width: 65px; flex-shrink: 0; }
#seek-bar { flex: 1; min-width: 24px; margin-inline: 12px; }
.scrub { appearance: none; -webkit-appearance: none; height: 24px; background: transparent; cursor: pointer; margin: 0; }
.scrub:disabled { opacity: .4; cursor: default; }
.scrub::-webkit-slider-runnable-track { height: 3px; background: linear-gradient(90deg, var(--accent) var(--fill, 0%), #ffffff40 var(--fill, 0%)); border-radius: 2px; }
.scrub::-webkit-slider-thumb { appearance: none; -webkit-appearance: none; height: 11px; width: 11px; background: white; border: 0; border-radius: 50%; margin-top: -4px; }
.scrub::-moz-range-track { height: 3px; background: #ffffff40; border-radius: 2px; }
.scrub::-moz-range-progress { height: 3px; background: var(--accent); }
.scrub::-moz-range-thumb { height: 11px; width: 11px; background: white; border: 0; border-radius: 50%; }
.live-button { display: flex; align-items: center; flex-shrink: 0; gap: 6px; border: 0; background: transparent; color: white; padding: 0 8px; font-size: 12px; font-weight: 700; letter-spacing: .4px; min-height: 40px; }
.live-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--live); }
.live-button.behind { color: #bbb; }
.live-button.behind .live-dot { background: #aaa; }
.live-offset { font: 12px ui-monospace, monospace; }
.live-offset:empty { display: none; }
.hud > * { pointer-events: auto; }
body[data-idle="true"] .hud { opacity: 0; pointer-events: none; }
body[data-idle='true'] #dock * { pointer-events: none; }
#dock:focus-within { opacity: 1; }
.now-playing { display: flex; align-items: center; gap: 12px; flex: 0 0 72px; padding: 12px 0 0; }
.now-logo { width: 44px; height: 44px; flex-shrink: 0; border-radius: 12px; background: #f5f3f6; padding: 8px; object-fit: contain; }
.now-copy { min-width: 0; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.now-copy .eyebrow { font: 12px var(--font-body); letter-spacing: 0; color: var(--text-faint); order: 1; }
.now-copy h1 { margin: 0; font-size: 22px; font-weight: 700; letter-spacing: -1px; line-height: 1.2; overflow-wrap: anywhere; }
.now-copy p { display: none; }
.viewing-note { margin-left: auto; display: flex; gap: 18px; white-space: nowrap; }
.shortcut-pair { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--text-faint); }
/* The channel directory stays visible while watching, with an independent scroll. */
.channel-directory { display: flex; flex-direction: column; min-height: 0; border: 1px solid #ffffff0c; border-radius: 14px; background: #1a181d; overflow: hidden; }
.directory-list { flex: 1; min-height: 0; overscroll-behavior: contain; overflow-y: auto; scrollbar-width: thin; scrollbar-color: #39323f transparent; padding: 8px; }
.directory-channel { display: flex; align-items: center; gap: 12px; min-height: 74px; padding: 10px; margin-block: 2px; border: 1px solid transparent; border-radius: 8px; }
.directory-channel img { width: 40px; height: 36px; object-fit: contain; border-radius: 6px; background: #f5f3f6; padding: 4px; flex-shrink: 0; }
.directory-channel-copy { display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 0; }
.directory-channel-copy strong { font-weight: 650; font-size: 16px; }
.directory-channel-copy > span { font-size: 14px; color: var(--text-faint); }
.directory-channel:hover { background: #242029; }
.directory-channel.active { background: #2a2333; border-color: #b097d033; }
.directory-channel.active strong { color: #deceff; }
.channel-play { width: 16px; height: 16px; color: #93859e; opacity: 0; }
.directory-channel:hover .channel-play { opacity: 1; }

/* Compact empty/loading states live inside the picture, never replace the page. */
.player-placeholder, #tuning-overlay { position: absolute; inset: 0; display: grid; place-items: center; background: #100e14; color: var(--text); }
.player-placeholder { background: radial-gradient(ellipse at 50% 120%, #34253d, transparent 80%), #100e14; }
.ph-inner { text-align: center; padding: 24px; }
.ph-inner h2 { font-size: 24px; font-weight: 650; letter-spacing: -.8px; margin: 0 0 10px; }
.ph-inner p { color: var(--text-faint); font-size: 16px; margin: 0 0 24px; }
.browse-button { display: inline-flex; align-items: center; gap: 20px; border: 0; padding: 12px 16px; border-radius: 7px; background: var(--accent); color: #21172e; font-weight: 650; font-size: 15px; }
.browse-button:hover { background: #ddcbff; }
#tuning-overlay { z-index: 5; background: #100e14; transition: opacity 200ms; }
#tuning-overlay.fading { opacity: 0; pointer-events: none; }
.tuning-content { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.tuning-spinner { width: 26px; height: 26px; margin-bottom: 6px; border: 2px solid #44364e; border-top-color: var(--accent); border-radius: 50%; animation: spin 900ms linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
#tuning-title { font-size: 18px; font-weight: 650; }
.tuning-label { font-size: 15px; color: var(--text-faint); letter-spacing: 0; }
.channel-link.loading { opacity: .65; cursor: wait; }

/* Same searchable guide and sports interactions, styled as a compact directory. */
dialog { color: var(--text); border: 1px solid var(--line); background: #1a171e; padding: 0; box-shadow: 0 24px 80px #0008; }
dialog::backdrop { background: #09070cd1; }
#guide { width: min(900px, calc(100vw - 32px)); height: min(84dvh, 760px); border-radius: 16px; margin: auto; flex-direction: column; overflow: hidden; }
#guide[open] { display: flex; }
.guide-head { display: flex; align-items: center; gap: 12px; padding: 18px 20px; background: #1a171e; border-bottom: 1px solid #ffffff0c; flex-shrink: 0; }
.guide-head > svg { width: 20px; height: 20px; color: var(--accent); flex-shrink: 0; }
#search-input { flex: 1; min-width: 0; background: none; border: 0; outline: 0; color: var(--text); font-size: 16px; }
#search-input::placeholder { color: var(--text-faint); }
.guide-esc { font: 12px ui-monospace, monospace; color: var(--text-faint); }
.icon-btn { display: inline-grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 1px solid #ffffff0a; border-radius: 8px; background: #28222e; color: var(--text-dim); flex-shrink: 0; }
.icon-btn svg { width: 19px; height: 19px; }
.guide-subhead { padding: 16px 20px 0; }
.guide-tabs { display: inline-flex; flex-wrap: wrap; max-width: 100%; gap: 5px; padding: 4px; background: #100e14; border-radius: 8px; }
.guide-tab { padding: 9px 20px; border: 0; border-radius: 5px; background: none; color: var(--text-faint); font-size: 15px; font-weight: 600; }
.guide-tab[aria-selected='true'] { background: #3b2f4c; color: #e3d3ff; }
#guide:has(#search-input:not(:placeholder-shown)) .guide-subhead { display: none; }
.guide-body { min-height: 0; flex: 1; padding: 20px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
#channel-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.guide-card { display: flex; align-items: center; gap: 12px; padding: 16px 12px; min-height: 76px; border: 1px solid #ffffff0b; border-radius: 8px; background: #211d27; }
.guide-card img { width: 42px; height: 38px; object-fit: contain; border-radius: 6px; padding: 4px; background: #f5f3f6; flex-shrink: 0; }
.card-title { font-size: 16px; font-weight: 650; }
.guide-card:hover { background: #2c2534; }
.channel-link.active .guide-card { border-color: #bca2e766; color: var(--accent); }
#nba-channel-list, #guide-results { display: flex; flex-direction: column; gap: 6px; }
.nba-cat-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; margin-top: 14px; background: #24202b; border-radius: 6px; font-size: 16px; color: var(--text-dim); }
.nba-cat-head:first-child { margin-top: 0; }
.cat-label { display: flex; gap: 8px; align-items: center; }
.cat-count { color: var(--text-faint); font: 13px ui-monospace, monospace; }
.game-row, .palette-row { display: flex; align-items: center; gap: 12px; border: 1px solid transparent; border-radius: 8px; padding: 12px; cursor: pointer; }
.game-row:hover, .palette-row.highlighted { background: #2c2534; border-color: #c4aff533; }
.channel-link.active .game-row { background: #32263f; }
.channel-link.unstarted { opacity: .5; pointer-events: none; }
.game-meta { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 6px; }
.game-title-row { display: flex; align-items: center; gap: 8px; overflow: hidden; min-width: 0; font-size: 17px; }
.game-status { font-size: 14px; color: var(--text-faint); }
.game-status.live, .row-kind.live { color: var(--live); }
.ping { flex-shrink: 0; width: 5px; height: 5px; border-radius: 50%; background: var(--live); }
.hover-marquee { display: inline-block; white-space: normal; line-height: 1.5; }
.is-marquee { animation: marquee 5s linear infinite alternate; }
@keyframes marquee { 85%,100% { transform: translateX(calc(-100% + 140px)); } }
.palette-row img, .row-emoji { flex-shrink: 0; width: 38px; height: 34px; padding: 3px; object-fit: contain; border-radius: 5px; background: #f5f3f6; }
.row-emoji { display: grid; place-items: center; background: #32263f; }
.row-title { font-size: 16px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-kind { font-size: 13px; color: var(--text-faint); }
.rail-note { padding: 24px; text-align: center; color: var(--text-faint); font-size: 16px; }
.rail-note.error { color: var(--live); }


/* Pointer-opened dialogs restore focus without a new ring. Tab restores normal focus styling. */
.pointer-restored:focus { outline: none; }
.sports-live-heading { color: var(--live); background: #382429; font-weight: 700; }
.game-row { min-height: 78px; border-color: #ffffff0a; background: #211d27; }
.channel-link.unstarted { opacity: .7; }
#guide-results .row-emoji { color: var(--accent); }

/* Collapse the one directory; keep the player inside the same page frame. */
body[data-theater='true'] .watch-layout { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); }
body[data-theater='true'] .channel-directory { display: none; }
html:fullscreen #player-container { position: fixed; inset: 0; z-index: 50; width: 100%; height: 100dvh; border-radius: 0; }
html:fullscreen #dock { padding: 60px 24px 20px; }
html:fullscreen .site-header { position: fixed; inset: 0 0 auto; z-index: 60; background: linear-gradient(#000c, transparent); border: 0; }
html:fullscreen body[data-idle='true'] .site-header { opacity: 0; pointer-events: none; }
html:fullscreen body[data-idle='true'] #player-container { cursor: none; }

@media (max-width: 1150px) {
    .header-search { width: 44px; justify-content: center; padding: 0; }
    .header-search span, .header-search kbd { display: none; }
    .header-actions { gap: 16px; }
    .watch-layout { grid-template-columns: minmax(0,1fr) 320px; gap: 16px; padding: 16px; }
    .viewing-note { display: none; }
    #volume-slider { display: none; }
}
@media (max-width: 900px) and (orientation: portrait) {
    .site-header { padding-inline: 16px; gap: 20px; height: 64px; flex-basis: 64px; }
    .watch-layout { grid-template-columns: minmax(0,1fr); grid-template-rows: min(46dvh, calc(56.25vw + 50px)) minmax(0,1fr); gap: 12px; padding: 12px; }
    .now-playing { flex-basis: 60px; padding-top: 8px; }
    .directory-list { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); align-content: start; gap: 4px; }
    .primary-nav { gap: 20px; }
    .remote-link span { display: none; }
    .remote-link { display: grid; place-items: center; width: 44px; height: 44px; }
}
@media (max-width: 600px) {
    .site-header { padding: 8px 12px; gap: 4px 12px; height: 88px; flex-basis: 88px; display: grid; grid-template-columns: 1fr auto; }
    .wordmark > span { font-size: 20px; letter-spacing: -.5px; }
    .primary-nav { grid-row: 2; grid-column: 1 / -1; gap: 24px; }
    .primary-nav .nav-current { display: none; }
    .primary-nav button { font-size: 14px; }
    .sports-count { display: none; }
    .header-actions { grid-row: 1; grid-column: 2; margin-left: 0; gap: 4px; }
    .header-search { width: 36px; border: 0; background: none; }
    .remote-link { width: 36px; }
    .now-logo { width: 36px; height: 36px; padding: 4px; border-radius: 6px; }
    .now-copy { gap: 5px 10px; }
    .now-copy h1 { font-size: 19px; letter-spacing: -.5px; }
    .now-copy .eyebrow { font-size: 12px; }
    .directory-list { display: flex; flex-direction: column; gap: 0; }
    .directory-channel { min-height: 68px; }
    .directory-channel-copy > span { font-size: 13px; }
    #dock { padding: 30px 6px 4px; }
    #transport { gap: 0; }
    .ctrl-btn { min-width: 36px; width: 36px; }
    .ctrl-btn svg { width: 20px; height: 20px; }
    #seek-bar { margin-inline: 4px; min-width: 20px; }
    .live-button { font-size: 11px; padding-inline: 4px; gap: 4px; }
    .live-offset { display: none; }
    .ph-inner { padding: 12px; }
    .ph-inner h2 { font-size: 20px; margin-bottom: 12px; }
    #guide { width: calc(100vw - 16px); height: 90dvh; border-radius: 12px; }
    .guide-head { padding: 12px; gap: 8px; }
    .guide-esc { display: none; }
    .guide-body { padding: 12px; }
    .guide-subhead { padding: 12px 12px 0; }
    .guide-tab { padding-inline: 16px; }
    #channel-list { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
    .guide-card { flex-direction: column; text-align: center; padding: 12px 8px; gap: 10px; }
    .card-title { font-size: 14px; }
    .row-kind { display: none; }
    .game-title-row { font-size: 16px; }
    html:fullscreen #dock { padding: 30px 8px max(8px, env(safe-area-inset-bottom)); }
}
@media (max-height: 500px) and (orientation: landscape) {
    .site-header { height: 56px; flex-basis: 56px; padding-inline: 16px; gap: 20px; }
    .watch-layout { padding: 8px 12px; gap: 12px; grid-template-columns: minmax(0,1fr) 280px; }
    .now-playing { flex-basis: 48px; padding-top: 6px; }
    .now-logo { width: 34px; height: 34px; padding: 4px; }
    .now-copy h1 { font-size: 18px; }
    .now-copy .eyebrow { display: none; }
    .directory-channel { min-height: 64px; }
    .remote-link span { display: none; }
    .primary-nav { gap: 16px; }
    .live-offset { display: none; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }
