:root {
  --bg: #030307;
  --panel: rgba(10, 12, 18, .78);
  --panel-strong: rgba(10, 12, 18, .94);
  --line: rgba(255,255,255,.13);
  --text: #fff;
  --muted: rgba(255,255,255,.68);
  --accent: #e50914;
  --accent2: #2dd4bf;
  --danger: #fb7185;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-family: Inter, ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif; overflow: hidden; }
button, select, input { font: inherit; }
.player-shell, .player-root { width: 100vw; height: 100vh; background: #000; }
.player-root { position: relative; overflow: hidden; }
.video-surface { position: absolute; inset: 0; width: 100%; height: 100%; background: #000; object-fit: contain; }
.overlay, .error-overlay { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; padding: 28px; z-index: 10; background: radial-gradient(circle at 50% 40%, rgba(30,41,59,.86), rgba(0,0,0,.96)); opacity: 0; pointer-events: none; transition: opacity .25s ease; }
.overlay.visible, .error-overlay:not([hidden]) { opacity: 1; pointer-events: auto; }
.overlay h1, .error-overlay h2 { margin: 18px 0 8px; font-size: clamp(1.5rem, 4vw, 3rem); }
.overlay p, .error-overlay p { max-width: 680px; margin: 0 auto; color: var(--muted); line-height: 1.55; }
.spinner { width: 74px; height: 74px; margin: 0 auto; border-radius: 999px; border: 4px solid rgba(255,255,255,.18); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.controls { position: absolute; inset: 0; pointer-events: none; z-index: 6; transition: opacity .25s ease; }
.controls.hidden { opacity: 0; }
.topbar, .bottombar { position: absolute; left: 0; right: 0; display: flex; align-items: center; gap: 14px; pointer-events: auto; }
.topbar { top: 0; padding: max(18px, env(safe-area-inset-top)) 24px 18px; background: linear-gradient(180deg, rgba(0,0,0,.74), rgba(0,0,0,0)); }
.bottombar { bottom: 0; padding: 20px 24px max(20px, env(safe-area-inset-bottom)); background: linear-gradient(0deg, rgba(0,0,0,.82), rgba(0,0,0,0)); }
.title { font-weight: 800; font-size: clamp(1rem, 2vw, 1.28rem); letter-spacing: .01em; }
.subtitle { color: var(--muted); font-size: .92rem; margin-top: 4px; max-width: 78vw; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.round, .control-btn, .error-actions button, .multi-toolbar button { border: 1px solid var(--line); color: var(--text); background: rgba(255,255,255,.11); border-radius: 999px; min-width: 44px; min-height: 44px; padding: 0 16px; cursor: pointer; backdrop-filter: blur(14px); transition: transform .16s ease, background .16s ease; }
.round { width: 50px; padding: 0; font-size: 24px; }
.round:hover, .control-btn:hover, .error-actions button:hover, .multi-toolbar button:hover { background: rgba(255,255,255,.2); transform: translateY(-1px); }
.control-btn[data-action="play"] { background: var(--accent); border-color: rgba(255,255,255,.2); font-weight: 800; }
#seek { flex: 1; accent-color: var(--accent); min-width: 80px; }
select, .multi-toolbar input { color: var(--text); background: var(--panel-strong); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; min-height: 42px; outline: none; }
.live-badge { margin-left: auto; background: var(--accent); color: #fff; font-weight: 900; border-radius: 999px; padding: 7px 12px; letter-spacing: .05em; box-shadow: 0 0 22px rgba(229,9,20,.38); }
.error-overlay { background: radial-gradient(circle at 50% 40%, rgba(127,29,29,.48), rgba(0,0,0,.96)); }
.error-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-top: 22px; }
.error-actions button:first-child { background: var(--accent); }
.error-actions button:nth-child(2) { background: rgba(45,212,191,.22); border-color: rgba(45,212,191,.42); }
.diagnostics { position: absolute; top: 86px; right: 22px; bottom: 94px; width: min(620px, calc(100vw - 44px)); background: rgba(3,7,18,.9); border: 1px solid var(--line); border-radius: 18px; z-index: 12; backdrop-filter: blur(18px); box-shadow: 0 20px 90px rgba(0,0,0,.62); overflow: hidden; }
.diagnostics header { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.diagnostics button { background: transparent; border: 0; color: white; font-size: 26px; cursor: pointer; }
.diagnostics pre { margin: 0; padding: 16px; height: calc(100% - 57px); overflow: auto; color: #b9f6ca; font-size: 12px; line-height: 1.42; white-space: pre-wrap; }
.multiscreen-shell { display: flex; flex-direction: column; width: 100vw; height: 100vh; background: #000; }
.multi-toolbar { min-height: 68px; display: flex; gap: 10px; align-items: center; padding: 10px; background: #08080b; border-bottom: 1px solid var(--line); }
.multi-toolbar input { flex: 1; min-width: 260px; }
.multi-grid { flex: 1; display: grid; gap: 3px; background: #111; min-height: 0; }
.multi-grid.layout-2 { grid-template-columns: 1fr 1fr; }
.multi-grid.layout-3 { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.multi-grid.layout-3 .multi-cell:first-child { grid-row: span 2; }
.multi-grid.layout-4 { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.multi-cell { position: relative; background: #000; min-height: 0; overflow: hidden; }
.multi-cell video { width: 100%; height: 100%; object-fit: contain; background: #000; }
.multi-label { position: absolute; top: 10px; left: 10px; z-index: 3; background: rgba(0,0,0,.62); border: 1px solid var(--line); border-radius: 999px; padding: 6px 10px; font-weight: 700; }
@media (max-width: 760px) {
  .topbar, .bottombar { padding-inline: 12px; gap: 8px; }
  .bottombar { flex-wrap: wrap; }
  #seek { order: -1; flex-basis: 100%; }
  select { max-width: 104px; }
  .subtitle { display: none; }
  .multi-toolbar { flex-wrap: wrap; height: auto; }
  .multi-grid.layout-2, .multi-grid.layout-3, .multi-grid.layout-4 { grid-template-columns: 1fr; grid-template-rows: repeat(4, minmax(0, 1fr)); }
  .multi-grid.layout-3 .multi-cell:first-child { grid-row: auto; }
}
@media (pointer: coarse) { .round, .control-btn { min-width: 54px; min-height: 54px; } }
