/* TV (module broadcast): app skin. Rules moved verbatim from styles.css (C1); the variables are the app identity, posture themes re-map the shell only. */
/* P9 scheme tokens: light = the colours these rules always used, dark = the TV app (already dark) with dark page chrome. */
:root {
  --tv-blue-line: #cfe3ff;
  --tv-blue-text: #0a1a30;
  --tv-orange-text: #b71c1c;
  --tv-surface: #fff;
  --tv-surface-2: #f1f3f5;
  --tv-surface-3: #eaf3ff;
}
[data-scheme="dark"] {
  --tv-blue-line: #364150;
  --tv-blue-text: #d6e6fd;
  --tv-orange-text: #fc8174;
  --tv-surface: #16181c;
  --tv-surface-2: #222325;
  --tv-surface-3: #1f242b;
}
.module-body[data-module="broadcast"] {
  --app-font: "Roboto", "Open Sans", Arial, sans-serif;
  --app-accent: #c62828;
  --app-bg: #1e2a35;
  --app-surface: #263443;
  --app-radius: 6px;
}

/* ---------- Broadcast ---------- */
.app-broadcast { background: #c62828; }
.app-relay { background: #229ed9; }
.broadcast-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 18px; }
.tv-panel { background: #0b0f14; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; color: #fff; }
.tv-screen { position: relative; aspect-ratio: 16 / 9; min-height: 340px; display: grid; place-items: center; background: radial-gradient(70% 80% at 50% 40%, #1d3446, #0a1016 70%); }
.tv-scanlines { position: absolute; inset: 0; background: repeating-linear-gradient(0deg, rgba(255,255,255,0.05) 0 1px, transparent 1px 3px); opacity: 0.35; pointer-events: none; }
.tv-live { position: absolute; top: 14px; left: 14px; background: #c62828; color: #fff; font-size: 10px; font-weight: 700; letter-spacing: 0.1em; padding: 3px 8px; border-radius: 2px; }
.tv-live.off { background: #5b6770; }
.tv-center { position: relative; z-index: 1; text-align: center; }
.tv-play { width: 64px; height: 64px; margin: 0 auto; display: grid; place-items: center; color: #fff; background: rgba(255,255,255,0.12); border: 1px solid rgba(255,255,255,0.45); border-radius: 50%; }
.tv-play:hover { background: rgba(255,255,255,0.2); }
.tv-title { margin-top: 14px; font-size: 22px; font-weight: 700; color: #fff; }
.tv-meta { font-size: 12px; color: #b8c4cf; margin-top: 3px; }
.tv-bar { display: flex; align-items: center; gap: 10px; padding: 10px 16px; background: #111820; border-top: 1px solid #1e2a35; }
.tv-time { font-family: var(--font-mono); font-size: 10px; color: #b8c4cf; }
.tv-progress { flex: 1; height: 4px; background: #22303c; border-radius: 2px; overflow: hidden; }
.tv-progress span { display: block; height: 100%; background: #c62828; }
.tv-ticker { padding: 9px 16px; background: #0b0f14; border-top: 1px solid #1e2a35; font-size: 11.5px; color: #b8c4cf; overflow: hidden; white-space: nowrap; }
.tv-ticker span { display: inline-block; }
.tv-side { display: flex; flex-direction: column; gap: 12px; }
.tv-channel { width: 100%; display: flex; align-items: center; gap: 9px; padding: 9px; text-align: left; border-radius: 8px; border: 1px solid transparent; }
.tv-channel:hover { background: var(--tv-surface-2); }
.tv-channel.is-active { background: var(--tv-surface-3); border-color: var(--tv-blue-line); }
.tv-channel-dot { width: 7px; height: 7px; border-radius: 50%; background: #9aa6b2; flex: none; }
.tv-channel-dot.live { background: #c62828; box-shadow: 0 0 0 3px rgba(198,40,40,0.14); }
.tv-channel-copy { display: flex; flex-direction: column; line-height: 1.25; flex: 1; min-width: 0; }
.tv-channel-copy strong { font-size: 12px; }
.tv-channel-copy small { font-size: 10.5px; color: var(--muted); }
.tv-channel-time { font-family: var(--font-mono); font-size: 9.5px; color: var(--faint); }
.tv-schedule-row { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; font-size: 11.5px; color: var(--muted); border-bottom: 1px solid var(--border); }
.tv-schedule-row:last-child { border-bottom: none; }
.tv-schedule-row span:first-child { font-family: var(--font-mono); color: var(--accent); }

/* ---------- TV additions ---------- */
.tv-controls { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 9px 14px; background: #111820; border-top: 1px solid #1e2a35; }
.tv-control-group { display: flex; align-items: center; gap: 4px; }
.tv-control { min-width: 30px; height: 30px; padding: 0 8px; display: grid; place-items: center; color: #b8c4cf; background: #1b242d; border: 1px solid #26313b; border-radius: 6px; font-size: 10px; font-weight: 700; letter-spacing: 0.04em; }
.tv-control:hover { color: #fff; background: #24313c; }
.tv-control.is-on { color: #fff; border-color: #c62828; background: #3a1418; }
.tv-volume { font-size: 10px; color: #b8c4cf; font-family: var(--font-mono); min-width: 40px; text-align: center; }
.tv-captions { position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); max-width: 86%; padding: 6px 12px; font-size: 12px; color: #fff; background: rgba(0,0,0,0.76); border-radius: 4px; text-align: center; z-index: 2; }
.tv-side-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.tv-side-head h3 { margin: 0; }
.tv-next { color: var(--faint); font-size: 10.5px; }
.broadcast-layout.is-cinema .tv-panel { grid-column: 1 / -1; }
.broadcast-layout.is-cinema { grid-template-columns: 1fr; }
.broadcast-layout.is-cinema .tv-screen { min-height: 520px; }

/* --- C4 TV: playlist player, lower third, breaking banner, ticker items, EPG current row */
.tv-screen .tv-player, .tv-screen .tv-player video[data-tv-video] { position: absolute; inset: 0; width: 100%; height: 100%; }
.tv-screen video[data-tv-video] { object-fit: contain; background: #000; }
.tv-screen .tv-lower { position: absolute; left: 0; right: 0; bottom: 0; padding: 26px 16px 14px; background: linear-gradient(transparent, rgba(0,0,0,0.78)); z-index: 1; }
.tv-screen .tv-lower .tv-title { margin: 0; font-size: 15px; color: #fff; }
.tv-screen .tv-lower .tv-meta { margin: 2px 0 0; font-size: 10.5px; color: #c9d3dc; }
.tv-nowait { position: absolute; inset: 0; display: grid; place-items: center; color: #9fb0bf; font-size: 12px; letter-spacing: 0.04em; }
.tv-breaking { display: flex; align-items: center; gap: 10px; padding: 8px 14px; background: #b71c1c; color: #fff; font-size: 12px; border-radius: 6px 6px 0 0; animation: tv-breaking-in 0.35s ease-out; }
.tv-breaking strong { font-size: 10px; letter-spacing: 0.12em; padding: 2px 6px; background: var(--tv-surface); color: var(--tv-orange-text); border-radius: 3px; }
.tv-ticker { display: flex; gap: 28px; overflow: hidden; white-space: nowrap; }
.tv-ticker-item { display: inline-block; animation: tv-ticker-in 0.6s ease-out; }
.tv-schedule-row.is-now { color: #fff; font-weight: 700; }
@keyframes tv-ticker-in { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes tv-breaking-in { from { transform: translateY(-6px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .tv-ticker-item, .tv-breaking { animation: none; } }

/* --- T1 fidelity: news-channel chrome (logo bug, lower third, breaking ticker band) ----------------------------- */
.tv-bug { position: absolute; top: 12px; right: 14px; z-index: 2; padding: 3px 8px; border: 2px solid rgba(255,255,255,.85); border-radius: 4px; color: #fff; font: 800 13px/1 system-ui, sans-serif; letter-spacing: .04em; background: rgba(181,18,27,.75); opacity: .9; }
.tv-live { z-index: 2; }
.tv-screen .tv-lower { display: flex; align-items: stretch; gap: 0; padding: 0; bottom: 5.2%; left: 0; right: 3%; min-height: 17.6%; background: none; }
/* the clip carries its own (YouTube) lower third at 6-22 % from the bottom and a label top left: on TV the channel's
   lower third sits exactly over that band and a top scrim hides the label, so one lower third and one bug show */
.tv-screen::after { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 16%; background: linear-gradient(rgba(0,0,0,.92), rgba(0,0,0,.6) 70%, transparent); pointer-events: none; z-index: 1; }
.tv-lower-tag { display: grid; place-items: center; padding: 0 10px; background: #c62828; color: #fff; font: 800 12px/1 system-ui, sans-serif; letter-spacing: .06em; }
.tv-lower-copy { flex: 1; min-width: 0; padding: 7px 12px; background: rgba(10,26,48,.92); border-left: 3px solid #e53935; }
.tv-lower-clock { display: grid; place-items: center; padding: 0 10px; background: var(--tv-surface); color: var(--tv-blue-text); font: 700 12px/1 var(--font-mono, monospace); }
.tv-screen .tv-lower .tv-title { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tv-ticker-wrap { display: flex; align-items: stretch; background: #0b0f14; }
.tv-ticker-label { flex: none; display: grid; place-items: center; padding: 0 12px; background: #1f3a5f; color: #fff; font-size: 11px; letter-spacing: .08em; }
.tv-ticker-label.is-breaking { background: #c62828; }
.tv-ticker-wrap .tv-ticker { flex: 1; min-width: 0; color: #fff; font-weight: 600; background: #102236; }
@media (max-width: 600px) {
  .tv-screen .tv-lower { left: 0; right: 0; }
  .tv-lower-clock { display: none; }
  .tv-bug { font-size: 10px; top: 8px; right: 8px; }
}

/* P9 dark scheme: the module tokens above, the TV app (already dark) with dark page chrome */
[data-scheme="dark"] .module-body[data-module="broadcast"] {
  --app-accent: #f86b61;
}
