:root {
  color-scheme: light;
  --paper: #f4f0e8;
  --paper-deep: #e9e2d6;
  --surface: #fffdf9;
  --ink: #18201f;
  --muted: #69716e;
  --line: rgba(24, 32, 31, .12);
  --red: #c5272d;
  --red-dark: #9e1d22;
  --red-soft: #f5dcda;
  --teal: #175f5b;
  --teal-soft: #dcebe7;
  --shadow: 0 22px 60px rgba(54, 44, 34, .14);
  --ease-out: cubic-bezier(.23, 1, .32, 1);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  font-optical-sizing: auto;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--paper); }
body { margin: 0; min-height: 100dvh; color: var(--ink); background: radial-gradient(circle at 78% 8%, rgba(197,39,45,.08), transparent 27rem), var(--paper); }
button, select { font: inherit; }
button, a, select { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
svg { display: block; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.topbar {
  position: sticky; top: 0; z-index: 20; height: 68px; padding: 0 max(20px, env(safe-area-inset-left));
  display: flex; align-items: center; justify-content: space-between;
  background: rgba(244,240,232,.78); backdrop-filter: blur(22px) saturate(140%);
  transition: box-shadow 180ms var(--ease-out), background-color 180ms var(--ease-out);
}
.topbar.scrolled { box-shadow: 0 1px 0 var(--line); background: rgba(244,240,232,.92); }
.brand { display: inline-flex; align-items: center; gap: 11px; color: var(--ink); text-decoration: none; font-size: 16px; font-weight: 720; letter-spacing: -.02em; }
.brand-mark { width: 32px; height: 32px; color: var(--red); stroke: none; }
.header-actions { display: flex; align-items: center; gap: 10px; }
.signal { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 12px; border-radius: 999px; background: rgba(255,253,249,.72); color: var(--muted); font-size: 13px; font-weight: 600; }
.signal[data-state="live"] { color: var(--red-dark); background: var(--red-soft); }
.signal[data-state="error"] { color: #765b14; background: #f4e8bd; }
.signal-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 4px color-mix(in srgb, currentColor 13%, transparent); }
.signal[data-state="live"] .signal-dot { animation: pulse 2.2s infinite; }
.icon-button, .share-button { border: 0; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 14px; border-radius: 999px; background: var(--ink); color: #fff; font-size: 13px; font-weight: 650; transition: transform 140ms var(--ease-out), background-color 180ms var(--ease-out); }
.icon-button svg, .share-button svg { width: 18px; height: 18px; }
.icon-button:active, .share-button:active, .start-button:active, .control-row:active { transform: scale(.97); }

.layout { width: min(1380px, calc(100% - 48px)); margin: 34px auto 0; display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 28px; align-items: start; }
.watch-column { min-width: 0; }
.player-shell { position: relative; overflow: hidden; aspect-ratio: 16 / 9; border-radius: 18px; background: #111515; box-shadow: var(--shadow); isolation: isolate; }
.player-backdrop { position: absolute; inset: 0; display: grid; place-items: center; background: radial-gradient(circle at 72% 18%, rgba(197,39,45,.48), transparent 48%), linear-gradient(145deg,#111817,#26302e); color: var(--red); }
.player-backdrop::after { content: ""; position: absolute; inset: 0; opacity: .28; background: repeating-linear-gradient(-12deg,transparent 0 108px,rgba(255,255,255,.12) 109px,transparent 110px 218px); }
.backdrop-mark { position: absolute; z-index: 1; top: 10%; left: 7%; width: clamp(58px,8vw,92px); height: auto; filter: drop-shadow(0 16px 28px rgba(0,0,0,.22)); }
.pip-note { position: absolute; z-index: 1; left: 50%; bottom: 15%; width: max-content; max-width: 80%; padding: 9px 13px; border-radius: 999px; background: rgba(255,255,255,.12); color: #fff; backdrop-filter: blur(12px); font-size: 13px; font-weight: 650; opacity: 0; transform: translate(-50%,8px); transition: opacity 180ms var(--ease-out), transform 180ms var(--ease-out); }
.player-shell video { position: relative; z-index: 1; width: 100%; height: 100%; display: block; object-fit: contain; background: transparent; transition: opacity 160ms var(--ease-out); }
.player-shell.pip-active video { opacity: 0; }
.player-shell.pip-active .pip-note { opacity: 1; transform: translate(-50%,0); }
.start-button { position: absolute; z-index: 2; inset: 0; width: 100%; border: 0; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 16px; background: linear-gradient(180deg, rgba(12,16,16,.08), rgba(12,16,16,.54)); color: #fff; text-align: left; transition: opacity 180ms var(--ease-out), transform 140ms var(--ease-out); }
.start-button[hidden] { display: none; }
.start-icon { width: 58px; height: 58px; display: grid; place-items: center; border: 1px solid rgba(255,255,255,.35); border-radius: 50%; background: rgba(255,255,255,.17); backdrop-filter: blur(14px); box-shadow: 0 10px 28px rgba(0,0,0,.18); }
.start-icon svg { width: 25px; height: 25px; margin-left: 3px; fill: currentColor; stroke: none; }
.start-button strong, .start-button small { display: block; }
.start-button strong { font-size: clamp(18px, 2vw, 24px); letter-spacing: -.025em; }
.start-button small { margin-top: 4px; color: rgba(255,255,255,.75); font-size: 13px; }
.player-message { position: absolute; z-index: 3; inset: 0; padding: 24px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px; color: #fff; text-align: center; background: rgba(12,16,16,.88); backdrop-filter: blur(12px); }
.player-message[hidden] { display: none; }
.player-message strong { font-size: 20px; letter-spacing: -.02em; }
.player-message span { color: rgba(255,255,255,.68); font-size: 14px; }
.player-message button { margin-top: 12px; min-height: 42px; padding: 0 18px; border: 0; border-radius: 999px; background: #fff; color: var(--ink); font-weight: 700; cursor: pointer; }

.now-playing { padding: 24px 4px 0; display: flex; align-items: flex-start; justify-content: space-between; gap: 28px; }
.eyebrow { display: flex; align-items: center; gap: 11px; color: var(--muted); font-size: 13px; font-weight: 600; }
.live-pill { display: inline-flex; align-items: center; min-height: 24px; padding: 0 9px; border-radius: 999px; background: var(--red-soft); color: var(--red-dark); font-size: 11px; font-weight: 760; letter-spacing: .04em; text-transform: uppercase; }
h1 { margin: 8px 0 4px; font-size: clamp(34px, 5vw, 58px); line-height: 1.02; letter-spacing: -.055em; }
.now-playing p { margin: 0; max-width: 620px; color: var(--muted); font-size: 15px; line-height: 1.55; }
.share-button { flex: 0 0 auto; margin-top: 10px; background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }

.control-panel { overflow: hidden; border: 1px solid rgba(24,32,31,.09); border-radius: 18px; background: rgba(255,253,249,.82); box-shadow: 0 16px 42px rgba(54,44,34,.08); backdrop-filter: blur(16px); }
.mobile-action-grid { display: contents; }
.panel-heading { min-height: 58px; padding: 0 18px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); font-size: 13px; font-weight: 720; }
.connection-label { color: var(--teal); font-size: 12px; }
.quality-row, .control-row { position: relative; width: 100%; min-height: 72px; padding: 12px 17px; display: grid; grid-template-columns: 40px minmax(0,1fr) auto; align-items: center; gap: 12px; border: 0; border-bottom: 1px solid var(--line); background: transparent; text-align: left; text-decoration: none; cursor: pointer; transition: background-color 160ms var(--ease-out), transform 120ms var(--ease-out); }
.row-icon { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 11px; background: var(--teal-soft); color: var(--teal); }
.row-icon svg { width: 20px; height: 20px; }
.row-copy { min-width: 0; }
.row-copy strong, .row-copy small { display: block; }
.row-copy strong { font-size: 14px; line-height: 1.25; }
.row-copy small { margin-top: 3px; color: var(--muted); font-size: 12px; line-height: 1.25; }
.chevron { width: 18px; height: 18px; color: #9ca29f; }
.quality-row select { max-width: 84px; min-height: 36px; padding: 0 26px 0 10px; border: 0; border-radius: 9px; color: var(--ink); background: var(--paper-deep); font-size: 12px; font-weight: 650; cursor: pointer; }
.switch { width: 42px; height: 25px; padding: 3px; border-radius: 99px; background: #c9cdca; transition: background-color 180ms var(--ease-out); }
.switch span { display: block; width: 19px; height: 19px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.18); transition: transform 180ms var(--ease-out); }
.control-row[aria-pressed="true"] .switch { background: var(--teal); }
.control-row[aria-pressed="true"] .switch span { transform: translateX(17px); }
footer { width: min(1380px, calc(100% - 48px)); min-height: 88px; margin: 26px auto 0; padding: 22px 4px max(22px, env(safe-area-inset-bottom)); display: flex; justify-content: space-between; gap: 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.shortcuts { text-align: right; }
.toast { position: fixed; z-index: 50; left: 50%; bottom: max(24px, env(safe-area-inset-bottom)); max-width: calc(100% - 32px); padding: 11px 15px; border-radius: 999px; background: var(--ink); color: #fff; box-shadow: 0 10px 30px rgba(0,0,0,.18); font-size: 13px; font-weight: 650; opacity: 0; pointer-events: none; transform: translate(-50%, 10px) scale(.97); transition: opacity 180ms var(--ease-out), transform 180ms var(--ease-out); }
.toast.visible { opacity: 1; transform: translate(-50%, 0) scale(1); }

:focus-visible { outline: 3px solid color-mix(in srgb, var(--teal) 70%, white); outline-offset: 3px; }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 3px rgba(197,39,45,.13); } 50% { box-shadow: 0 0 0 7px rgba(197,39,45,0); } }

@media (hover:hover) and (pointer:fine) {
  .icon-button:hover { background: #303837; }
  .share-button:hover, .control-row:hover, .quality-row:hover { background: rgba(23,95,91,.065); }
  .start-button:hover .start-icon { transform: scale(1.05); }
}
@media (max-width: 980px) {
  .layout { grid-template-columns: 1fr; width: min(900px, calc(100% - 36px)); margin-top: 24px; }
  .control-panel { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); }
  .panel-heading { grid-column: 1 / -1; }
  .quality-row, .control-row { border-right: 1px solid var(--line); }
  footer { width: calc(100% - 36px); }
}
@media (max-width: 640px) {
  .topbar { height: 60px; padding-inline: 14px; }
  .signal { min-height: 32px; padding-inline: 10px; }
  .signal { width: 32px; padding: 0; justify-content: center; background: transparent; }
  .signal #signalText { display: none; }
  .install-button span { display: none; }
  .install-button { width: 38px; min-height: 38px; padding: 0; }
  .layout { width: 100%; margin-top: 0; gap: 14px; }
  .player-shell { border-radius: 0; box-shadow: none; }
  .now-playing { padding: 16px 16px 0; align-items: center; }
  .now-playing h1 { margin-block: 6px 0; font-size: 34px; }
  .now-playing p { display: none; }
  .share-button { width: 42px; height: 42px; padding: 0; }
  .share-button span { display: none; }
  .control-panel { display: block; overflow: visible; margin: 0 12px; border: 0; border-radius: 0; background: transparent; box-shadow: none; backdrop-filter: none; }
  .panel-heading { display: none; }
  .quality-row { min-height: 64px; border: 1px solid var(--line); border-radius: 15px; background: var(--surface); box-shadow: 0 8px 24px rgba(54,44,34,.06); }
  .mobile-action-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; margin-top: 10px; }
  .mobile-action-grid .control-row { min-height: 96px; padding: 13px; grid-template-columns: 1fr auto; grid-template-rows: 40px auto; gap: 8px; border: 1px solid var(--line); border-radius: 15px; background: var(--surface); box-shadow: 0 8px 24px rgba(54,44,34,.06); }
  .mobile-action-grid .row-icon { grid-column: 1; grid-row: 1; }
  .mobile-action-grid .row-copy { grid-column: 1 / -1; grid-row: 2; }
  .mobile-action-grid .row-copy small, .mobile-action-grid .chevron { display: none; }
  .mobile-action-grid .switch { grid-column: 2; grid-row: 1; align-self: center; }
  footer { display: none; }
  .shortcuts { display: none; }
  .start-button { gap: 12px; }
  .start-icon { width: 50px; height: 50px; }
}
@media (max-width: 370px) {
  .brand span { font-size: 14px; }
  .now-playing { gap: 12px; }
  .start-button small { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition-duration: .01ms !important; }
}
@media (prefers-reduced-transparency: reduce) {
  .topbar, .control-panel { background: var(--surface); backdrop-filter: none; }
}
@media (prefers-contrast: more) {
  :root { --line: rgba(24,32,31,.28); }
  .control-panel { background: var(--surface); border-color: var(--ink); }
}
