/* ── Live webcam show ──────────────────────────────────────────────────────────
   Fills #chat-area in place of the normal text chat. Video on top, then a split
   panel: the actions Lily can do (left) and the simulated stream chat (right).
   Uses the site's theme variables so it matches everything else. */

#stream-view { display: none; flex-direction: column; height: 100%; min-height: 0; background: var(--bg); }
#stream-view.sv-on { display: flex; }

/* ── Video stage ── */
.sv-video-wrap {
  position: relative; flex: 1 1 auto; min-height: 180px;
  background: #05070c; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
.sv-video {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: contain; background: #05070c;
  opacity: 0; transition: opacity 0.18s ease; pointer-events: none;
}
.sv-video.sv-video-on { opacity: 1; }
.sv-glitch { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; opacity: 0; pointer-events: none; z-index: 3; }

.sv-topbar {
  position: absolute; top: 0; left: 0; right: 0; z-index: 5;
  display: flex; align-items: center; gap: 9px; padding: 10px 12px;
  background: linear-gradient(to bottom, rgba(3,5,10,0.72), transparent);
  font-size: 0.78rem;
}
.sv-badge { display: inline-flex; align-items: center; gap: 6px; font-weight: 800; letter-spacing: 0.04em; color: #fff; background: var(--coral); padding: 3px 9px; border-radius: 999px; font-size: 0.68rem; }
.sv-dot { width: 7px; height: 7px; border-radius: 50%; background: #fff; animation: sv-pulse 1.4s infinite; }
@keyframes sv-pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.35; } }
.sv-viewers { color: var(--bright); font-weight: 600; text-shadow: 0 1px 3px rgba(0,0,0,0.7); }
.sv-spacer { flex: 1; }
.sv-mute { background: rgba(3,5,10,0.5); border: 1px solid rgba(255,255,255,0.14); color: #fff; width: 30px; height: 30px; border-radius: 8px; cursor: pointer; font-size: 0.9rem; }

.sv-bottom-row {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 5;
  display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; padding: 12px;
  background: linear-gradient(to top, rgba(3,5,10,0.8), transparent);
}
.sv-streamer { display: flex; align-items: center; gap: 9px; min-width: 0; }
.sv-streamer img { width: 38px; height: 38px; border-radius: 50%; object-fit: cover; border: 2px solid rgba(255,255,255,0.25); }
.sv-streamer strong { display: block; color: var(--bright); font-size: 0.9rem; line-height: 1.2; text-shadow: 0 1px 4px rgba(0,0,0,0.8); }
.sv-streamer span { display: block; color: var(--dim); font-size: 0.72rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 40vw; }

/* Private-show CTA. Lives at the top of the actions panel (not over the video), so
   it's full-width and sits in the same column as the tier action groups. */
.sv-private-cta {
  width: 100%; display: flex; align-items: center; gap: 9px; text-align: left;
  padding: 11px 13px; border-radius: 11px; cursor: pointer; border: 1px solid var(--gold);
  background: linear-gradient(135deg, rgba(232,189,90,0.22), rgba(232,189,90,0.06));
  color: var(--bright); font-weight: 700; font-size: 0.8rem;
  position: relative; overflow: hidden; margin-bottom: 4px;
  transition: border-color 0.15s, transform 0.1s;
}
.sv-private-cta:hover { transform: translateY(-1px); border-color: #f3d98c; }
.sv-private-cta:disabled { opacity: 0.5; cursor: not-allowed; }
.sv-private-cta-emoji { font-size: 1.1rem; flex: none; }
.sv-private-cta-text { min-width: 0; }
.sv-private-cta small { display: block; color: var(--gold); font-size: 0.64rem; font-weight: 600; margin-top: 1px; }
/* Already redeemed — calmer, it's no longer selling anything. */
.sv-private-cta--on { background: linear-gradient(135deg, rgba(232,189,90,0.13), rgba(232,189,90,0.03)); }

/* Overlays */
.sv-overlay {
  position: absolute; inset: 0; z-index: 6; display: none;
  flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  background: rgba(4,6,11,0.72); color: var(--bright); text-align: center; padding: 20px;
  backdrop-filter: blur(2px); font-size: 0.85rem;
}
.sv-overlay.sv-show { display: flex; }
.sv-spinner { width: 34px; height: 34px; border: 3px solid rgba(255,255,255,0.18); border-top-color: var(--teal); border-radius: 50%; animation: sv-spin 0.8s linear infinite; }
@keyframes sv-spin { to { transform: rotate(360deg); } }
.sv-count { font-weight: 800; color: var(--teal); font-size: 1.1rem; }
.sv-noticed { position: absolute; z-index: 6; left: 50%; bottom: 74px; transform: translateX(-50%); display: none; align-items: center; gap: 8px; padding: 7px 14px; border-radius: 999px; background: rgba(4,6,11,0.8); color: var(--bright); font-size: 0.8rem; }
.sv-noticed.sv-show { display: inline-flex; }
.sv-coming { max-width: 320px; line-height: 1.5; }
.sv-coming .sv-coming-emoji { font-size: 2rem; }

/* ── Lower panel: actions + chat ── */
.sv-panel { flex: 0 0 auto; display: flex; border-top: 1px solid var(--border); min-height: 0; height: 46%; max-height: 340px; }
.sv-actions { flex: 1 1 44%; min-width: 0; display: flex; flex-direction: column; border-right: 1px solid var(--border); background: var(--surface); }
.sv-actions-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 9px 12px; border-bottom: 1px solid var(--border); }
.sv-pos { font-weight: 700; color: var(--bright); font-size: 0.82rem; }
.sv-tierhint { font-size: 0.68rem; color: var(--muted); }
.sv-actions-scroll { flex: 1; overflow-y: auto; padding: 10px 12px; }
.sv-group-label { font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin: 8px 0 6px; font-weight: 700; }
.sv-group-label:first-child { margin-top: 0; }

/* Level group headers — every row of actions sits under the pledge tier that opens
   it, colour-matched to the per-action level chips below (.sv-tier-1/2/3). */
.sv-act-group {
  display: flex; align-items: baseline; justify-content: space-between; gap: 8px;
  margin: 15px 0 7px; padding-bottom: 5px; border-bottom: 1px solid var(--border);
}
.sv-act-group:first-child { margin-top: 0; }
.sv-act-group-name { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.05em; font-weight: 800; color: var(--bright); }
.sv-act-group-note { font-size: 0.63rem; font-weight: 700; color: var(--teal); white-space: nowrap; }
.sv-act-group--t1 { border-bottom-color: rgba(79,209,224,0.35); }
.sv-act-group--t1 .sv-act-group-name { color: var(--teal); }
.sv-act-group--t2 { border-bottom-color: rgba(181,144,240,0.35); }
.sv-act-group--t2 .sv-act-group-name { color: var(--purple); }
.sv-act-group--t3 { border-bottom-color: rgba(232,189,90,0.35); }
.sv-act-group--t3 .sv-act-group-name { color: var(--gold); }
.sv-act-group--priv { border-bottom-color: rgba(232,189,90,0.5); }
.sv-act-group--priv .sv-act-group-name { color: var(--gold); }
/* Locked group: still fully legible — it's the upsell, not an error state. */
.sv-act-group--locked { opacity: 0.85; }
.sv-act-group--locked .sv-act-group-note { color: var(--gold); }

.sv-act-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.sv-act {
  display: flex; flex-direction: column; align-items: flex-start; gap: 3px;
  padding: 9px 10px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--raised); color: var(--text); cursor: pointer; text-align: left;
  transition: border-color 0.15s, transform 0.1s; position: relative; min-height: 56px;
}
.sv-act:hover:not(:disabled) { border-color: var(--teal-dim); transform: translateY(-1px); }
.sv-act:disabled { cursor: not-allowed; }
.sv-act-emoji { font-size: 1.1rem; }
.sv-act-label { font-size: 0.78rem; font-weight: 600; line-height: 1.2; }
.sv-act--locked { opacity: 0.72; }
.sv-act--locked .sv-act-label { color: var(--dim); }
.sv-act-lock { margin-top: 2px; font-size: 0.62rem; font-weight: 700; padding: 2px 7px; border-radius: 999px; }
.sv-act--pending { border-color: var(--teal); }
.sv-act-spinner { width: 15px; height: 15px; border: 2px solid rgba(79,209,224,0.3); border-top-color: var(--teal); border-radius: 50%; animation: sv-spin 0.8s linear infinite; display: inline-block; }
.sv-noactions { color: var(--muted); font-size: 0.78rem; padding: 12px 4px; }
.sv-act-soon { color: var(--muted); font-size: 0.72rem; font-style: italic; padding: 4px 2px 2px; }
/* Shown to free / Micro Bubble members: they get the full room, none of the buttons. */
.sv-watchonly {
  color: var(--gold); font-size: 0.72rem; font-weight: 600; line-height: 1.45;
  background: rgba(232,189,90,0.09); border: 1px solid rgba(232,189,90,0.28);
  border-radius: 9px; padding: 8px 10px; margin-bottom: 4px;
}

/* tier lock colours mirror the site's char-tier badges */
.sv-tier-1 { background: rgba(79,209,224,0.14); color: var(--teal); }
.sv-tier-2 { background: rgba(181,144,240,0.16); color: var(--purple); }
.sv-tier-3 { background: rgba(232,189,90,0.16); color: var(--gold); }

/* ── Chat ── */
.sv-chat { flex: 1 1 56%; min-width: 0; display: flex; flex-direction: column; background: var(--bg); }
.sv-chat-head { display: flex; align-items: center; justify-content: space-between; padding: 9px 12px; border-bottom: 1px solid var(--border); }
.sv-chat-head strong { color: var(--bright); font-size: 0.82rem; }
.sv-chat-head span { color: var(--muted); font-size: 0.7rem; }
.sv-chat-msgs { flex: 1; overflow-y: auto; padding: 8px 12px; display: flex; flex-direction: column; gap: 5px; }
.sv-msg { font-size: 0.78rem; line-height: 1.4; word-break: break-word; }
.sv-msg .sv-name { font-weight: 700; color: var(--dim); margin-right: 5px; }
.sv-msg--creator .sv-name { color: var(--coral); }
.sv-msg--creator .sv-badge-mini { margin-right: 3px; }
.sv-msg--self .sv-name { color: var(--teal); }
.sv-msg--system { color: var(--muted); font-style: italic; font-size: 0.74rem; text-align: center; padding: 3px 0; }
.sv-chat-input { display: flex; gap: 7px; padding: 9px 12px; border-top: 1px solid var(--border); }
.sv-chat-input input { flex: 1; min-width: 0; padding: 8px 11px; border-radius: 9px; border: 1px solid var(--border); background: var(--surface); color: var(--bright); font-size: 0.8rem; }
.sv-chat-input input:focus { outline: none; border-color: var(--teal-dim); }
.sv-chat-input button { flex: none; padding: 8px 15px; border: none; border-radius: 9px; background: var(--teal); color: #05262d; font-weight: 800; cursor: pointer; font-size: 0.8rem; }
.sv-chat-input button:disabled { opacity: 0.5; cursor: default; }

.sv-toast { position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); z-index: 20; background: rgba(4,6,11,0.94); border: 1px solid var(--border); color: var(--bright); padding: 9px 15px; border-radius: 999px; font-size: 0.78rem; box-shadow: var(--shadow-md); max-width: 90%; text-align: center; }

/* ── Sidebar LIVE list ── */
#live-list { margin-bottom: 6px; }
.live-card {
  display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 12px; cursor: pointer;
  border: 1px solid rgba(242,103,79,0.35); background: linear-gradient(135deg, rgba(242,103,79,0.10), rgba(242,103,79,0.02));
  margin-bottom: 8px; transition: border-color 0.15s, transform 0.1s;
}
.live-card:hover { border-color: var(--coral); transform: translateY(-1px); }
.live-card.active { border-color: var(--coral); box-shadow: 0 0 0 1px var(--coral) inset; }
.live-card-avatar { width: 44px; height: 44px; border-radius: 50%; overflow: hidden; flex: none; position: relative; background: var(--raised); }
.live-card-avatar img { width: 100%; height: 100%; object-fit: cover; }
.live-card-avatar .live-ring { position: absolute; inset: -2px; border-radius: 50%; border: 2px solid var(--coral); animation: sv-pulse 1.6s infinite; }
.live-card-info { min-width: 0; flex: 1; }
.live-card-name { font-weight: 700; color: var(--bright); font-size: 0.9rem; display: flex; align-items: center; gap: 6px; }
.live-card-live { font-size: 0.58rem; font-weight: 800; letter-spacing: 0.05em; color: #fff; background: var(--coral); padding: 2px 6px; border-radius: 999px; display: inline-flex; align-items: center; gap: 4px; }
.live-card-title { color: var(--dim); font-size: 0.74rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Modals (private-show redeem) ── */
.sv-modal { position: fixed; inset: 0; z-index: 200; display: flex; align-items: center; justify-content: center; background: rgba(3,5,10,0.72); backdrop-filter: blur(3px); padding: 20px; }
.sv-modal-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--gold); border-radius: 16px; padding: 22px; box-shadow: var(--shadow-lg); }
.sv-modal-card h3 { color: var(--bright); font-size: 1.05rem; margin-bottom: 8px; }
.sv-modal-card p { color: var(--dim); font-size: 0.82rem; line-height: 1.55; margin-bottom: 12px; }
/* ── Pre-release countdown ──
   Covers the whole stage until the show's releaseAt passes. Opaque on purpose:
   the server sends no clips before then, so there is nothing behind it to reveal. */
.sv-release {
  flex-direction: column; gap: 10px; text-align: center; padding: 22px 18px;
  background: radial-gradient(circle at 50% 35%, rgba(79,209,224,0.13), rgba(3,5,10,0.97) 68%), #05070c;
  z-index: 8;
}
.sv-release-emoji { font-size: 2.1rem; line-height: 1; }
.sv-release h3 { color: var(--bright); font-size: 1.12rem; font-weight: 800; margin: 0; }
.sv-release-date { color: var(--teal); font-size: 0.86rem; font-weight: 700; margin: 0; text-transform: capitalize; }
.sv-release-note { color: var(--muted); font-size: 0.72rem; line-height: 1.5; margin: 4px 0 0; max-width: 30ch; }

.sv-cd { display: flex; gap: 7px; margin-top: 4px; }
.sv-cd > div {
  min-width: 56px; padding: 9px 6px; border-radius: 11px;
  background: rgba(255,255,255,0.05); border: 1px solid var(--border);
}
.sv-cd strong {
  display: block; color: var(--bright); font-size: 1.32rem; font-weight: 800; line-height: 1.1;
  font-variant-numeric: tabular-nums; /* stops the digits jittering each tick */
}
.sv-cd span { display: block; margin-top: 2px; color: var(--muted); font-size: 0.6rem; text-transform: uppercase; letter-spacing: 0.07em; }
@media (max-width: 420px) {
  .sv-cd > div { min-width: 46px; padding: 7px 4px; }
  .sv-cd strong { font-size: 1.08rem; }
}

/* "SOON" reuses the LIVE pill but drops the urgency of the coral. Both rules must
   stay after their base classes — same specificity, so source order decides. */
.sv-badge--soon { background: var(--teal); }
.live-card-live--soon { background: var(--teal); }
.live-card--soon .live-card-avatar .live-ring { border-color: var(--teal); animation: none; opacity: 0.5; }

/* "What's inside" — the private show's contents, shown before the code input.
   Scrolls internally so a long list can't push the redeem button off-screen. */
.sv-incl {
  border: 1px solid var(--border); border-radius: 11px;
  padding: 11px 13px; margin-bottom: 13px; background: var(--bg);
  max-height: 34vh; overflow-y: auto;
}
.sv-incl-head {
  display: block; color: var(--gold); font-size: 0.62rem; font-weight: 800;
  text-transform: uppercase; letter-spacing: 0.07em; margin-bottom: 7px;
}
.sv-incl ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.sv-incl li {
  color: var(--dim); font-size: 0.76rem; line-height: 1.35;
  padding-left: 17px; position: relative;
}
.sv-incl li::before { content: '🫧'; position: absolute; left: 0; top: 0; font-size: 0.66rem; }

.sv-modal-card p strong { color: var(--bright); }
.sv-modal-card .sv-modal-store { display: inline-block; color: var(--gold); font-weight: 700; text-decoration: none; }
.sv-modal-card .sv-modal-store:hover { text-decoration: underline; }
.sv-modal-row { display: flex; gap: 8px; margin-bottom: 8px; }
.sv-modal-row input { flex: 1; min-width: 0; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--bg); color: var(--bright); font: 700 0.8rem monospace; text-transform: uppercase; }
.sv-modal-row input:focus { outline: none; border-color: var(--gold); }
.sv-modal-status { min-height: 1em; font-size: 0.76rem; margin-bottom: 12px; }
.sv-modal-status.error { color: #ff9c8a; }
.sv-modal-status.success { color: var(--teal); }
.sv-modal-btns { display: flex; gap: 9px; justify-content: flex-end; }
.sv-btn { padding: 9px 16px; border-radius: 10px; border: none; cursor: pointer; font-weight: 800; font-size: 0.82rem; }
.sv-btn--ghost { background: transparent; border: 1px solid var(--border); color: var(--dim); }
.sv-btn--gold { background: linear-gradient(135deg, var(--gold), #d4a838); color: #2a1e05; }
.sv-btn:disabled { opacity: 0.55; cursor: default; }

/* ── Narrow / mobile: stack the panel under the video, tab between actions & chat ── */
@media (max-width: 720px) {
  .sv-panel { height: 50%; max-height: none; flex-direction: column; }
  .sv-actions, .sv-chat { flex: 1 1 auto; border-right: none; }
  .sv-actions[hidden], .sv-chat[hidden] { display: none; }
  .sv-mobile-tabs { display: flex; }
}
.sv-mobile-tabs { display: none; flex: none; border-top: 1px solid var(--border); background: var(--surface); }
.sv-mobile-tabs button { flex: 1; padding: 10px; background: none; border: none; color: var(--muted); font-weight: 700; font-size: 0.8rem; cursor: pointer; }
.sv-mobile-tabs button.sv-mtab-on { color: var(--teal); box-shadow: inset 0 -2px 0 var(--teal); }
