/* qtv.css – unified dark/light skin, fixed background, responsive header/menu */

/* ── Tokens ───────────────────────────────────────────── */
:root{
  --bg:#0b0f14;
  --panel:#0f1418;
  --panel-2:#0b1216;
  --muted:#98a8b6;
  --text:#dfe7f0;
  --accent:linear-gradient(90deg,#43c6ff,#7e5cff);
  --glass:rgba(11,15,20,0.6);
  --max-w:1280px;

  --ring:rgba(67,198,255,.6);
  --hair:rgba(255,255,255,0.06);

  /* Primary button (QTV + Chat) */
  --btn-primary-bg:linear-gradient(90deg,#14314c,#1b2e48);
  --btn-primary-fg:#eaf2ff;
  --btn-primary-border:#2a3c56;

  /* Background bloom (DARK) */
  --bg-bloom:#122032;      /* inner glow color */
  --bg-spot:80% -10%;      /* focal point */
  --bg-size:1200px 600px;  /* ellipse size */
}

:root[data-theme="light"]{
  --bg:#f5f7fa;
  --panel:#ffffff;
  --panel-2:#f2f6fb;
  --muted:#4b5563;
  --text:#0b1826;
  --glass:rgba(255,255,255,.8);
  --hair:rgba(0,0,0,.08);

  --ring:rgba(126,92,255,.55);

  --btn-primary-bg:linear-gradient(90deg,#e8f1ff,#dfe8ff);
  --btn-primary-fg:#0b1826;
  --btn-primary-border:rgba(0,0,0,.12);

  /* Background bloom (LIGHT) – subtler and pushed out */
  --bg-bloom:color-mix(in oklab, #122032 30%, white);
  --bg-spot:80% -95%;
  --bg-size:1200px 600px;
}

/* ── Base + FROZEN background (no scroll seam) ───────── */
*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0; color:var(--text);
  font-family:Inter,ui-sans-serif,system-ui,-apple-system,Segoe UI,Roboto,Helvetica,Arial;
  background:transparent; /* gradient lives on ::before */
}
body::before{
  content:"";
  position:fixed; inset:0; z-index:-1;
  background:radial-gradient(var(--bg-size) at var(--bg-spot), var(--bg-bloom), var(--bg));
  will-change:transform;
}
a{color:inherit; text-decoration:none}

/* Reduce heavy effects for users that prefer it */
@media (prefers-reduced-motion: reduce){
  *{scroll-behavior:auto !important; transition:none !important}
}

/* ── Header ───────────────────────────────────────────── */
.topbar{
  position:sticky; top:0; z-index:40;
  display:flex; align-items:center; justify-content:space-between;
  padding:10px 18px;
  background:linear-gradient(180deg,var(--panel),rgba(0,0,0,0));
  border-bottom:1px solid var(--hair);
  backdrop-filter:saturate(1.1) blur(6px);
}
.brand{font-weight:600; display:flex; align-items:center; gap:10px}
.brand .dot{width:10px; height:10px; border-radius:50%; background:#ff5252; display:inline-block}
.top-actions{display:flex; align-items:center; gap:10px}
.only-mobile{display:none}

/* ── Layout ───────────────────────────────────────────── */
.container{max-width:var(--max-w); margin:18px auto; padding:0 12px 60px}

/* ── Buttons / Controls ───────────────────────────────── */
.btn{
  background:transparent; color:var(--text);
  border:1px solid var(--hair);
  padding:8px 12px; border-radius:10px; cursor:pointer;
  transition:border-color .15s ease, box-shadow .15s ease, transform .05s ease, filter .15s ease;
}
.btn:hover{border-color:rgba(255,255,255,0.18)}
:root[data-theme="light"] .btn:hover{border-color:rgba(0,0,0,0.12)}
.btn:active{transform:translateY(1px)}
.btn:focus-visible{outline:none; box-shadow:0 0 0 3px var(--ring)}
.btn.small{padding:6px 8px; font-size:14px}
.btn.block{width:100%}

/* Primary style (used by Go Live & Send) */
.btn.primary,
#send,
#btn-go-live{
  border:1px solid var(--btn-primary-border);
  background:var(--btn-primary-bg);
  color:var(--btn-primary-fg);
  box-shadow:0 1px 0 rgba(0,0,0,.15) inset;
}
#send:hover,
#btn-go-live:hover{ filter:brightness(1.06) }

/* Segmented select */
.segmented select{
  background:transparent; color:var(--text);
  border:1px solid var(--hair);
  padding:6px 8px; border-radius:8px;
}
.segmented select:focus-visible{outline:none; box-shadow:0 0 0 3px var(--ring)}

/* ── Stage (16:9) ─────────────────────────────────────── */
.stage{
  width:100%; max-width:var(--max-w);
  margin:10px auto 0;
  position:relative; overflow:hidden;
  border-radius:12px; border:1px solid var(--hair);
  background:#000;
}
.stage::before{content:""; display:block; padding-top:56.25%} /* 16:9 */
.stage > video, .stage > iframe, .stage > canvas {
  position:absolute; inset:0; width:100%; height:100%;
  object-fit:contain; background:#000; border:0;
}
.stage > video{ z-index:1 }
.stage > iframe{ z-index:2 }
.stage > canvas{ z-index:3; pointer-events:none }
.stage > canvas.hidden{ display:none }
.stage > video[style*="visibility: hidden"]{ visibility:hidden }

/* Interact pill */
.stage .shield-btn{
  position:absolute; right:12px; bottom:12px; z-index:9;
  display:flex; align-items:center; gap:8px;
  padding:6px 10px; border-radius:999px;
  background:rgba(0,0,0,.55); color:#eaf2ff; border:1px solid var(--hair);
  font:500 13px/1 Inter,ui-sans-serif,system-ui; cursor:pointer;
  user-select:none; pointer-events:auto;
  backdrop-filter:saturate(1.1) blur(4px);
}
:root[data-theme="light"] .stage .shield-btn{ background:rgba(255,255,255,.72); color:#0b1826 }
.stage .shield-btn .dot{ width:6px; height:6px; border-radius:50%; background:#4bd37b; box-shadow:0 0 0 2px rgba(75,211,123,.25) inset }
.stage .shield-btn:focus-visible{ outline:none; box-shadow:0 0 0 3px var(--ring) }
.stage .shield-btn.hidden{ display:none }

/* ── Chat + Controls (under stage) ────────────────────── */
.controls{ max-width:var(--max-w); margin:14px auto; display:flex; gap:16px; align-items:flex-start }
.controls .left{ flex:0 0 300px }
.beta-card{
  margin-bottom:10px;
  border:1px solid var(--hair);
  border-radius:14px;
  background:linear-gradient(180deg,rgba(255,255,255,.035),rgba(255,255,255,.012));
  padding:14px;
}
.beta-card .eyebrow{
  color:#f6c90e;
  font-size:11px;
  font-weight:800;
  text-transform:uppercase;
  letter-spacing:.04em;
}
.beta-card h1{
  margin:6px 0 6px;
  font-size:22px;
  line-height:1.08;
}
.beta-card p{
  margin:0 0 10px;
  color:var(--muted);
  font-size:13px;
  line-height:1.45;
}
.beta-pills,
.quick-row{
  display:flex;
  flex-wrap:wrap;
  gap:6px;
}
.beta-pills{ margin-bottom:10px; }
.beta-pills span{
  min-height:26px;
  display:inline-flex;
  align-items:center;
  border:1px solid color-mix(in oklab,#28d6c6 40%,transparent);
  background:color-mix(in oklab,#28d6c6 10%,transparent);
  border-radius:999px;
  padding:0 8px;
  font-size:11px;
  font-weight:800;
}
.chat-panel{
  flex:1; background:linear-gradient(180deg,rgba(255,255,255,0.01),transparent);
  border-radius:12px; padding:12px; border:1px solid var(--hair)
}
.chat-panel h3{ margin:6px 0 12px; color:var(--muted); font-size:14px }

.log{ max-height:320px; overflow:auto; display:flex; flex-direction:column; gap:10px; padding:6px }
.bubble{
  background:linear-gradient(180deg,rgba(255,255,255,0.01),rgba(255,255,255,0.02));
  padding:12px; border-radius:12px; border:1px solid var(--hair)
}
.bubble.me{ align-self:flex-end; background:rgba(255,255,255,0.02); border-color:var(--hair) }

.composer{ display:flex; gap:8px; margin-top:10px; align-items:flex-end }
textarea#msg{
  flex:1; min-height:44px; border-radius:10px; padding:10px;
  background:var(--panel-2); border:1px solid var(--hair);
  color:var(--text); resize:vertical
}
textarea#msg:focus-visible{ outline:none; box-shadow:0 0 0 3px var(--ring) }
#send{ min-width:110px }

/* ── Zoe Vision Orb (left column) ─────────────────────── */
.orb-card{
  margin-top:12px;
  border:1px solid var(--hair);
  border-radius:14px;
  background: linear-gradient(180deg, rgba(255,255,255,.02), transparent);
  padding:10px;
  display:grid;
  gap:8px;
}
.orb-head{
  display:flex; align-items:center; justify-content:space-between;
  gap:8px;
}
.orb-head .title{ font-weight:600; letter-spacing:.2px }
.orb-head .readout{ font:600 12px/1 Inter, ui-sans-serif, system-ui; color:var(--muted) }
.orb-wrap{
  position:relative;
  width:100%;
  aspect-ratio:1 / 1;
  border-radius:12px;
  overflow:hidden;
  background:#05060a;
  border:1px solid color-mix(in oklab, var(--hair) 70%, transparent);
}
canvas#ai-orb{
  position:absolute; inset:0; width:100%; height:100%;
  display:block;
  filter: saturate(1.2) contrast(1.05);
}
.orb-foot{
  display:flex; align-items:center; justify-content:space-between; gap:8px;
  color:var(--muted); font-size:12px;
}
.orb-meter{
  height:6px; border-radius:999px; width:100%;
  background: color-mix(in oklab, var(--panel) 85%, transparent);
  overflow:hidden;
}
.orb-meter > i{
  display:block; height:100%;
  width:0%;
  background: radial-gradient(120% 100% at 0% 50%, #8af, #74f, #f5f 85%);
  transition: width .18s ease;
}

/* ── Search results ───────────────────────────────────── */
.search-results{ max-height:600px; overflow-y:auto; margin-top:10px; }
.result-card{
  display:flex; gap:12px; padding:10px 4px;
  border-bottom:1px solid var(--hair);
  transition:background .12s;
}
.result-card:last-child{ border-bottom:none; }
.result-card:hover{ background: color-mix(in oklab,var(--panel-2) 60%,transparent); border-radius:8px; }
.result-thumb-wrap{
  flex:0 0 90px; width:90px; height:130px;
  border-radius:6px; overflow:hidden; background:var(--panel);
  display:flex; align-items:center; justify-content:center;
  font-size:2.5rem; color:var(--muted);
  transition:opacity .12s;
}
.result-thumb-wrap:hover{ opacity:.85; }
.result-thumb-wrap img{ width:100%; height:100%; object-fit:cover; display:block; }
.result-info{ flex:1; min-width:0; display:flex; flex-direction:column; gap:3px; }
.result-title{
  font-weight:700; font-size:13.5px;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
  transition:color .12s;
}
.result-title:hover{ color: var(--accent, #74f); }
.result-meta{ font-size:11px; color:var(--muted); text-transform:uppercase; letter-spacing:.03em; }
.result-desc{
  font-size:11.5px; color:var(--muted); margin:0;
  display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden;
}
.result-actions{ display:flex; flex-wrap:wrap; gap:5px; margin-top:4px; align-items:center; }
.result-info-links{ display:flex; flex-wrap:wrap; gap:4px; margin-top:2px; }
/* source version buttons — prominent, Primewire-style */
.src-btn{
  background: color-mix(in oklab,var(--accent,#5b8fff) 22%,var(--panel));
  border: 1px solid color-mix(in oklab,var(--accent,#5b8fff) 50%,transparent);
  color: var(--text);
  font-size:12px; font-weight:600; padding:4px 10px;
  border-radius:6px; cursor:pointer; white-space:nowrap;
  transition: background .12s, transform .1s;
}
.src-btn:hover{
  background: color-mix(in oklab,var(--accent,#5b8fff) 40%,var(--panel));
  transform: translateY(-1px);
}
.no-stream-msg{ font-size:11px; color:var(--muted); font-style:italic; }
.btn.secondary{ background:transparent; border:1px solid color-mix(in oklab,var(--hair) 80%,transparent); font-size:11px; }
.btn.secondary:hover{ background:var(--panel); }
.search-spinner{ text-align:center; padding:14px; color:var(--muted); font-size:12px; }
.source-safe-label{
  color:#28d6c6;
  font-weight:800;
}

/* ── Airing schedule discovery rail ───────────────────── */
.airing-section{
  max-width:var(--max-w);
  margin:8px auto 24px;
  padding:0 12px;
}
.airing-head{
  display:flex;
  align-items:center;
  gap:12px;
  margin-bottom:12px;
}
.airing-head h2{
  margin:0;
  font-size:17px;
}
#airing-status{
  color:var(--muted);
  font-size:12px;
}
.airing-day-tabs{
  display:flex;
  flex-wrap:wrap;
  gap:6px;
  margin-bottom:12px;
}
.airing-day-tab{
  border:1px solid var(--hair);
  border-radius:999px;
  background:var(--panel-2);
  color:var(--muted);
  min-height:30px;
  padding:0 12px;
  cursor:pointer;
  font-weight:700;
}
.airing-day-tab.active{
  border-color:#f6c90e;
  background:#f6c90e;
  color:#0a0d11;
}
.airing-rail{
  display:flex;
  gap:12px;
  overflow-x:auto;
  padding-bottom:10px;
}
.air-card{
  flex:0 0 132px;
  border:1px solid var(--hair);
  border-radius:10px;
  overflow:hidden;
  background:var(--panel);
  cursor:pointer;
}
.air-card:hover{ border-color:#28d6c6; }
.air-thumb{
  width:100%;
  aspect-ratio:2/3;
  object-fit:cover;
  display:block;
  background:var(--panel-2);
}
.air-info{ padding:8px; }
.air-title{
  font-size:12px;
  font-weight:800;
  line-height:1.25;
  display:-webkit-box;
  -webkit-line-clamp:2;
  -webkit-box-orient:vertical;
  overflow:hidden;
}
.air-meta{
  margin-top:4px;
  color:var(--muted);
  font-size:10px;
  line-height:1.3;
}
.air-badge-new{
  display:inline-block;
  margin-bottom:4px;
  padding:1px 5px;
  border-radius:4px;
  background:#f6c90e;
  color:#0a0d11;
  font-size:9px;
  font-weight:900;
}

/* ── PiP (floating player) ────────────────────────────── */
.stage{ position:relative; }
.pip-toggle{
  position:absolute; top:8px; left:8px; z-index:10;
  width:26px; height:26px; border-radius:50%; padding:0;
  background:rgba(0,0,0,.55); border:1px solid rgba(255,255,255,.18);
  color:#fff; font-size:12px; cursor:pointer; line-height:1;
  display:flex; align-items:center; justify-content:center;
  opacity:.55; transition:opacity .15s;
}
.pip-toggle:hover{ opacity:1; }
.pip-bar{
  display:none; position:absolute; top:0; left:0; right:0; height:26px;
  background:rgba(0,0,0,.72); z-index:11; user-select:none;
  align-items:center; padding:0 6px; gap:4px; cursor:grab;
}
.pip-bar:active{ cursor:grabbing; }
.pip-bar-title{ flex:1; font-size:11px; color:#bbb; pointer-events:none; }
.pip-bar-btns{ display:flex; gap:3px; }
.pip-bar-btns button{
  background:rgba(255,255,255,.14); border:none; color:#fff;
  width:20px; height:20px; border-radius:4px; font-size:10px; cursor:pointer; padding:0;
}
.pip-bar-btns button:hover{ background:rgba(255,255,255,.28); }
.pip-bar-btns button.active{ background:rgba(100,200,100,.35); }
.stage.pip-mode{
  position:fixed; z-index:9000;
  border-radius:12px;
  box-shadow:0 8px 40px rgba(0,0,0,.75),0 0 0 1px rgba(255,255,255,.07);
  overflow:hidden; width:280px; height:158px; top:16px; left:16px;
}
.stage.pip-mode .pip-bar{ display:flex; }
.stage.pip-mode .pip-toggle{ display:none; }
.stage.pip-mode video{ width:100%; height:100%; object-fit:contain; }
.stage.pip-mode canvas#fx{ display:none; }
.stage.pip-mode q-seed{ display:none; }
.stage.pip-size-m{ width:360px!important; height:203px!important; }
.stage.pip-size-l{ width:480px!important; height:270px!important; }

/* ── Footer ───────────────────────────────────────────── */
.footer{ max-width:var(--max-w); margin:20px auto; color:var(--muted); text-align:center; padding-bottom:40px }

/* ── Mobile menu sheet ────────────────────────────────── */
.mobile-menu{
  position:fixed; inset:auto 0 0 0; z-index:50;
  background:color-mix(in oklab, var(--panel) 92%, transparent);
  border-top:1px solid var(--hair); padding:10px 12px; display:grid; gap:8px;
  box-shadow:0 -8px 24px rgba(0,0,0,.35);
}
.mobile-menu.hidden{ display:none }
.mobile-menu .row{ display:flex; gap:8px; align-items:center }
.mobile-menu select{
  background:transparent; color:var(--text);
  border:1px solid var(--hair); padding:6px 8px; border-radius:8px
}

/* ── A11y helper ──────────────────────────────────────── */
.sr-only{
  position:absolute !important; width:1px; height:1px; padding:0; margin:-1px;
  overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0
}

/* ── Responsive ───────────────────────────────────────── */
@media (max-width:900px){
  .controls{ flex-direction:column }
  .controls .left{ width:100% }
  .btn.block{ width:100% }
}
@media (max-width:740px){
  .top-actions{ display:none }
  .only-mobile{ display:inline-flex }
}
