/* onair-v1 — self-contained. List view + viewer view (toggled via URL ?live=ID). */

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font-sans); -webkit-font-smoothing: antialiased; }
img, svg { display: block; max-width: 100%; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }
input, textarea { font: inherit; color: inherit; background: none; border: 0; outline: 0; resize: none; }

/* ============ APP SHELL ============ */
.app-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 680px) 320px;
  gap: 24px;
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px;
}

/* ============ SIDEBAR ============ */
.sidebar { position: sticky; top: 24px; height: calc(100vh - 48px); display: flex; flex-direction: column; justify-content: space-between; }
.brand { display: flex; align-items: center; gap: 14px; font-size: 32px; font-weight: 800; margin-bottom: 36px; color: var(--text); }
.brand img { width: 42px; height: 42px; object-fit: contain; }
.sidebar nav { display: flex; flex-direction: column; gap: 8px; }
.sidebar nav a {
  padding: 14px 18px; color: var(--text-soft); border-radius: 999px; font-weight: 600; font-size: 16px;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}
.sidebar nav a.active, .sidebar nav a:hover { background: var(--surface); color: var(--text); box-shadow: var(--shadow-card); }
.new-post { border-radius: 999px; background: var(--cta-bg); color: var(--cta-text); font-weight: 700; padding: 14px 22px; font-size: 16px; }

/* ============ MAIN ============ */
.main { min-width: 0; display: flex; flex-direction: column; gap: 14px; }

.topbar {
  display: flex; align-items: center; gap: 10px; justify-content: space-between;
  min-height: 44px;
}
.topbar h1 {
  font-size: 22px; margin: 0; font-weight: 800; letter-spacing: -0.01em;
  display: inline-flex; align-items: center; gap: 8px;
}
.topbar h1 .onair-pill {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--error);
  color: white;
  font-size: 10px; font-weight: 800;
  padding: 3px 8px; border-radius: 999px;
  letter-spacing: 0.06em;
}
.topbar h1 .onair-pill::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: white;
  animation: onair-pulse 1.6s ease-in-out infinite;
}
@keyframes onair-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.55; transform: scale(0.85); }
}

.topbar-brand { display: none; align-items: center; gap: 8px; color: var(--text); font-weight: 800; font-size: 22px; letter-spacing: -0.01em; }
.topbar-brand img { width: 24px; height: 24px; object-fit: contain; }

.topbar .back {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: grid; place-items: center;
  color: var(--text-soft);
  transition: background 0.15s, color 0.15s;
}
.topbar .back:hover { background: var(--surface-soft); color: var(--text); }

.topbar-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.wallet-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary-dark);
  font-weight: 700; font-size: 13px;
  font-variant-numeric: tabular-nums;
  border: 1px solid transparent;
  transition: background 0.15s, transform 0.15s, border-color 0.15s;
}
.wallet-chip:hover { background: var(--surface); border-color: var(--primary); transform: translateY(-1px); }
.wallet-chip .ic { display: inline-flex; align-items: center; line-height: 1; }
.wallet-chip .ic svg { display: block; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md); box-shadow: var(--shadow-card); }

/* ============ AVATAR ============ */
.avatar { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; color: white; font-weight: 800; flex-shrink: 0; user-select: none; }
.avatar.g1 { background: linear-gradient(135deg, var(--primary), var(--ai)); }
.avatar.g2 { background: linear-gradient(135deg, var(--ai), var(--info)); }
.avatar.g3 { background: linear-gradient(135deg, var(--success), var(--ai)); }
.avatar.g4 { background: linear-gradient(135deg, var(--accent), var(--accent-warm)); }
.avatar.g5 { background: linear-gradient(135deg, var(--primary), var(--accent)); }
.avatar.gx { background: linear-gradient(135deg, #94a3b8, #64748b); }

/* ============ MOBILE: auto-hide topbar + nav on scroll down ============ */
/* Smooth transitions for the scroll-hide behavior */
.topbar,
.mobile-nav,
.viewer .video-card {
  transition: transform 0.25s ease, top 0.25s ease;
}
/* Force GPU compositing so repeated transitions stay stable (no flicker / stuck states) */
.topbar,
.mobile-nav {
  will-change: transform;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}
@media (max-width: 980px) {
  .topbar.scrolled-hidden {
    transform: translate3d(0, -100%, 0);
    pointer-events: none;
  }
  .mobile-nav.scrolled-hidden {
    transform: translate3d(0, calc(100% + 24px), 0);
    pointer-events: none;
  }
}

/* ============ FULLSCREEN HINT + INVISIBLE TAP-TRIGGER ============ */
.fs-hint, .fs-trigger { display: none; }

@media (orientation: landscape) and (pointer: coarse) and (max-height: 500px) {
  /* Invisible full-viewport tap target — any touch enters fullscreen */
  .fs-trigger {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 10002;
    background: transparent;
    cursor: pointer;
  }
  :fullscreen .fs-trigger,
  :-webkit-full-screen .fs-trigger { display: none !important; }

  .fs-hint {
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    top: 12px;
    left: 50%;
    z-index: 10003;     /* above the tap trigger so it's visible */
    background: rgba(0, 0, 0, 0.72);
    color: white;
    padding: 9px 18px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 700;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    pointer-events: none;
    animation: fs-hint-pulse 2.4s ease-in-out infinite;
  }
  /* Once true fullscreen engages, hide the hint */
  :fullscreen .fs-hint,
  :-webkit-full-screen .fs-hint {
    display: none !important;
  }
}
@keyframes fs-hint-pulse {
  0%, 100% { opacity: 0.78; transform: translate(-50%, 0); }
  50%      { opacity: 1;    transform: translate(-50%, -3px); }
}

/* ============ MOBILE LANDSCAPE → FULLSCREEN VIDEO ============ */
/* When user rotates phone to landscape, video auto-takes the whole viewport.
   Detection: landscape orientation + coarse pointer (touch) + short viewport (excludes tablets). */
@media (orientation: landscape) and (pointer: coarse) and (max-height: 500px) {
  /* Override the mobile sticky video (and any JS-set inline `top`) */
  .viewer .video-card {
    position: fixed !important;
    inset: 0 !important;
    top: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    height: 100dvh !important;     /* modern: handles dynamic browser chrome */
    aspect-ratio: unset !important;
    z-index: 9999;
    margin: 0;
    border-radius: 0;
    border: 0;
  }

  /* Stop body from scrolling underneath the fullscreen video */
  body { overflow: hidden; background: #000; }

  /* Hide all our UI chrome — video owns the whole viewport */
  .mobile-nav { display: none !important; }
  .topbar { display: none !important; }

  /* Larger overlay UI for fullscreen feel */
  .video-card .vbadge {
    top: 14px; left: 14px;
    font-size: 12px; padding: 5px 11px;
  }
  .video-card .vviewers {
    top: 14px; right: 14px;
    font-size: 13px; padding: 6px 12px;
  }
  /* Floating Tip button (bottom-right) — only shown in landscape/fullscreen */
  .video-card .vtip-fs {
    display: inline-flex !important;
  }
}

/* Hidden by default (portrait / desktop) — landscape media query above flips display */
.video-card .vtip-fs {
  display: none;
  position: absolute;
  bottom: 18px;
  right: 18px;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.55);
  -webkit-backdrop-filter: blur(10px);
          backdrop-filter: blur(10px);
  color: white;
  font-weight: 700;
  font-size: 15px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  z-index: 10;
  transition: transform 0.12s, background 0.15s;
}
.video-card .vtip-fs:active { transform: scale(0.92); }
.video-card .vtip-fs:hover { background: rgba(0, 0, 0, 0.7); }

/* 粉絲視訊 Window 全螢幕掣（左下）— 只喺 onair-v1 觀眾側，主播 (live-room-v1) 冇 */
.video-card .vfs-btn {
  position: absolute; bottom: 12px; left: 12px;
  z-index: 10;
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.55);
  -webkit-backdrop-filter: blur(10px);
          backdrop-filter: blur(10px);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  transition: transform 0.12s, background 0.15s;
}
.video-card .vfs-btn svg { display: block; }
.video-card .vfs-btn:active { transform: scale(0.92); }
.video-card .vfs-btn:hover { background: rgba(0, 0, 0, 0.7); }
.video-card .vfs-btn .fs-exit { display: none; }

/* CSS-based 全螢幕（iPhone 都 work，唔靠 Fullscreen API）：video-card 填滿畫面 */
.video-card.fs {
  position: fixed !important;
  top: 0 !important; left: 0 !important; right: 0 !important; bottom: 0 !important;
  z-index: 9999 !important;
  width: 100vw !important; height: 100dvh !important;
  margin: 0 !important;
  aspect-ratio: auto;
  border-radius: 0; border: 0;
  /* 放大 150%：兩軸都有裁切位，先有得按住拖睇唔同位置（background-position 由 JS 拖動控制，唔可以 !important）*/
  background-size: 150% 150% !important;
  background-position: center;
  cursor: grab;
  touch-action: none;
}
.video-card.fs.panning { cursor: grabbing; }
.video-card.fs .fs-enter { display: none; }
.video-card.fs .fs-exit { display: block; }
/* 全螢幕（唔理打橫定打直）都要見到打賞掣：直向時下方 broadcaster-card 被冚，
   淨返 video-card，唔顯示浮動 Tip 就冇得打賞 */
.video-card.fs .vtip-fs { display: inline-flex !important; }
body.video-fs-open { overflow: hidden; }

/* ============ TIP EASTER EGG ============ */
.tip-coin,
.tip-amount {
  position: fixed;
  z-index: 10020;   /* above the landscape fullscreen private room (10010) */
  pointer-events: none;
  user-select: none;
  will-change: transform, opacity;
}
.tip-coin {
  width: 26px;
  height: 26px;
  line-height: 0;          /* no text baseline gap */
  animation: tip-fall 1.3s cubic-bezier(0.4, 0, 0.6, 1) forwards;
}
.tip-coin svg { display: block; }
.tip-amount {
  font-size: 14px;
  font-weight: 800;
  color: var(--success);
  background: rgba(255, 255, 255, 0.96);
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid var(--success);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  animation: tip-fall-soft 1.5s cubic-bezier(0.4, 0, 0.6, 1) forwards;
}
@keyframes tip-fall {
  0%   { transform: translate(0, 0) rotate(0deg) scale(0.6); opacity: 0; }
  22%  { transform: translate(calc(var(--drift, 0) * 0.35), -90px) rotate(220deg) scale(1); opacity: 1; }
  100% { transform: translate(var(--drift, 0), 360px) rotate(900deg) scale(0.8); opacity: 0; }
}
/* "+5 PULSE" pills don't rotate (rotating text looks awkward) */
@keyframes tip-fall-soft {
  0%   { transform: translate(0, 0) scale(0.7); opacity: 0; }
  22%  { transform: translate(calc(var(--drift, 0) * 0.35), -100px) scale(1.05); opacity: 1; }
  100% { transform: translate(var(--drift, 0), 340px) scale(0.9); opacity: 0; }
}
#v-tip { transition: transform 0.15s, background 0.15s; }
#v-tip:active { transform: scale(0.93); }

/* ============ HIDDEN OVERRIDES ============
   These elements have explicit display:flex which would otherwise
   bypass the [hidden] attribute (display:none). */
.list-view[hidden],
.viewer[hidden],
.live-chat[hidden] { display: none !important; }

/* Mobile chat lives inside .viewer (main column) — hide it on desktop.
   Compound selector (2 classes) beats the later `.live-chat { display: flex }` rule. */
.live-chat.live-chat-mobile { display: none; }

/* Mobile-only swipeable panels container (chat ↔ leaderboard) */
.mobile-panels { display: none; }

/* 1-on-1 private booking flow — shown on both mobile and desktop */
.private-flow {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}
.pf-head {
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}
.pf-head h3 { margin: 0; font-size: 16px; font-weight: 800; }
.pf-head small { display: block; color: var(--text-soft); font-size: 12px; margin-top: 4px; }

.rate-options {
  list-style: none;
  padding: 0;
  margin: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.rate-card {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.15s;
}
.rate-card:hover { background: var(--primary-soft); border-color: var(--primary); transform: translateY(-1px); }
.rate-card:active { transform: translateY(0); }
.rate-card .duration { font-weight: 800; font-size: 16px; }
.rate-card .price {
  font-weight: 800; font-size: 14px;
  color: var(--text-soft);
  font-variant-numeric: tabular-nums;
}
.rate-card .price b { color: var(--primary-dark); font-size: 18px; margin-right: 3px; }
.rate-card.popular { border-color: var(--primary); }
.rate-card.popular::after {
  content: "熱門";
  position: absolute;
  top: -8px; right: 14px;
  background: var(--primary);
  color: white;
  font-size: 10px; font-weight: 800;
  padding: 2px 8px; border-radius: 999px;
  letter-spacing: 0.04em;
}

.pf-rules {
  list-style: none;
  padding: 0;
  margin: 0 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  color: var(--text-soft);
  line-height: 1.5;
}
.pf-rules li::before { content: "· "; font-weight: 800; color: var(--primary); }

.pf-perf {
  margin: 0 16px 14px;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--primary-soft);
  border: 1px solid var(--line);
}
.pf-perf[hidden] { display: none !important; }
.pf-perf h4 {
  margin: 0 0 6px;
  font-size: 12px;
  font-weight: 800;
  color: var(--primary-dark);
  letter-spacing: 0.02em;
}
.pf-perf p {
  margin: 0;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text);
  white-space: pre-wrap;
}

.pf-reviews { margin: 0 16px 14px; }
.pf-reviews[hidden] { display: none !important; }
.pf-rev-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 8px;
}
.pf-rev-head h4 {
  margin: 0;
  font-size: 12px; font-weight: 800;
  color: var(--primary-dark);
  letter-spacing: 0.02em;
}
.pf-rev-avg {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px; font-weight: 800;
  color: #f5b301;
}
.pf-rev-avg svg { flex: none; }
.pf-rev-list {
  list-style: none; padding: 0; margin: 0;
  display: flex; flex-direction: column; gap: 8px;
  max-height: 250px; overflow-y: auto;
}
.pf-rev-item {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
}
.pf-rev-item.mine { border-color: var(--primary); background: var(--primary-soft); }
.pf-rev-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.pf-rev-row .avatar { width: 26px; height: 26px; font-size: 11px; }
.pf-rev-name { font-size: 12.5px; font-weight: 800; color: var(--text); }
.pf-rev-stars { display: inline-flex; gap: 1px; }
.pf-rev-stars i { line-height: 0; color: var(--line); }
.pf-rev-stars i.on { color: #f5b301; }
.pf-rev-stars svg { display: block; }
.pf-rev-meta { margin-left: auto; font-size: 11px; color: var(--text-soft); white-space: nowrap; }
.pf-rev-note {
  margin: 6px 0 0;
  font-size: 12.5px; line-height: 1.55;
  color: var(--text);
}

.pf-back, .pf-cancel {
  display: block;
  width: calc(100% - 32px);
  margin: 8px 16px 16px;
  padding: 12px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--text);
  font-weight: 700;
  font-size: 14px;
  transition: background 0.15s;
}
.pf-back:hover, .pf-cancel:hover { background: var(--surface-soft); }
.pf-cancel { color: var(--error); border-color: rgba(239,68,68,0.3); }
.pf-cancel:hover { background: rgba(239,68,68,0.08); }

#pf-step-waiting { text-align: center; padding-bottom: 6px; }
#pf-step-waiting h3 { margin: 6px 16px 8px; font-size: 18px; font-weight: 800; }
.pf-line { margin: 6px 16px; color: var(--text); font-size: 14px; line-height: 1.55; }
.pf-line.subtle { color: var(--text-soft); font-size: 13px; margin-bottom: 18px; }
.pf-line b { color: var(--primary-dark); font-weight: 800; }

.waiting-dots {
  display: flex;
  justify-content: center;
  gap: 10px;
  padding: 32px 16px 8px;
}
.waiting-dots span {
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--primary);
  animation: wait-pulse 1.4s ease-in-out infinite;
}
.waiting-dots span:nth-child(2) { animation-delay: 0.2s; }
.waiting-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes wait-pulse {
  0%, 100% { opacity: 0.3; transform: scale(0.7); }
  50%      { opacity: 1;   transform: scale(1.2); }
}

/* Ringing phone icon in the waiting step */
.pf-ring {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 62px; height: 62px;
  margin: 24px auto 0;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary-dark);
  animation: pf-ring-shake 1.4s ease-in-out infinite;
}
@keyframes pf-ring-shake {
  0%, 100% { transform: rotate(0); }
  10%, 30% { transform: rotate(-12deg) scale(1.05); }
  20%, 40% { transform: rotate(12deg) scale(1.05); }
  50%      { transform: rotate(0); }
}

/* [hidden] needs explicit override because these elements have CSS display rules */
.mobile-panels[hidden],
.private-flow[hidden] { display: none !important; }

/* ============================================
   1對1 私訊聊天室 (fan side) — full-screen overlay at body level
   ============================================ */
.priv-room {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}
.priv-room[hidden] { display: none !important; }

.pr-topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  padding-top: max(10px, env(safe-area-inset-top));
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.pr-peer { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.pr-avatar {
  width: 38px; height: 38px;
  font-size: 15px; font-weight: 800;
  flex-shrink: 0;
}
.pr-peer-meta { min-width: 0; }
.pr-peer-meta b { display: block; font-size: 15px; font-weight: 800; line-height: 1.2; }
.pr-peer-meta small { display: block; color: var(--text-soft); font-size: 11px; margin-top: 2px; }
.pr-timer {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary-dark);
  font-weight: 800; font-size: 13px;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}
.pr-timer.urgent { background: rgba(239,68,68,0.12); color: var(--error); animation: pr-blink 1s step-end infinite; }
@keyframes pr-blink { 50% { opacity: 0.45; } }
.pr-end {
  flex-shrink: 0;
  padding: 7px 14px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid rgba(239,68,68,0.35);
  color: var(--error);
  font-weight: 800; font-size: 13px;
}
.pr-end:hover { background: rgba(239,68,68,0.08); }

.pr-stage {
  position: relative;
  aspect-ratio: 16 / 10;
  max-height: 42vh;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  background-size: cover;
  background-position: center;
  flex-shrink: 0;
}
.pr-badge {
  position: absolute; top: 12px; left: 12px;
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(0,0,0,0.5);
  color: #fff;
  font-size: 11px; font-weight: 800;
  letter-spacing: 0.04em;
  backdrop-filter: blur(4px);
}
.pr-badge::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%;
  background: #ef4444; box-shadow: 0 0 0 0 rgba(239,68,68,0.6);
  animation: pr-live-dot 1.6s ease-out infinite;
}
@keyframes pr-live-dot { 70%, 100% { box-shadow: 0 0 0 6px rgba(239,68,68,0); } }
.pr-hud {
  position: absolute; top: 12px; right: 12px;
  display: inline-flex; align-items: center; gap: 4px;
  padding: 5px 11px;
  border-radius: 999px;
  background: rgba(0,0,0,0.5);
  color: #fff;
  font-size: 12px; font-weight: 700;
  backdrop-filter: blur(4px);
}
.pr-hud b { color: #86efac; font-weight: 800; }
.pr-tip {
  position: absolute; bottom: 12px; right: 12px;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 16px;
  border-radius: 999px;
  background: rgba(0,0,0,0.55);
  -webkit-backdrop-filter: blur(10px);
          backdrop-filter: blur(10px);
  color: #fff;
  font-weight: 700; font-size: 14px;
  border: 1px solid rgba(255,255,255,0.18);
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  transition: transform 0.12s, background 0.15s;
}
.pr-tip:active { transform: scale(0.92); }
.pr-tip:hover { background: rgba(0,0,0,0.7); }
@keyframes pr-caption-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.pr-msgs {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--bg);
}
.pr-msg { max-width: 78%; display: flex; flex-direction: column; gap: 3px; }
.pr-msg.me { align-self: flex-end; align-items: flex-end; }
.pr-msg.peer { align-self: flex-start; align-items: flex-start; }
.pr-bubble {
  padding: 9px 13px;
  border-radius: 16px;
  font-size: 14px; line-height: 1.45;
  word-break: break-word;
}
.pr-msg.me .pr-bubble { background: var(--primary); color: #fff; border-bottom-right-radius: 5px; }
.pr-msg.peer .pr-bubble { background: var(--surface); border: 1px solid var(--line); border-bottom-left-radius: 5px; }
.pr-status {
  font-size: 11px; color: var(--text-soft);
  display: inline-flex; align-items: center; gap: 4px;
}
.pr-status.checking { color: var(--text-soft); }
.pr-status.pass { color: var(--success); }
.pr-status.block { color: var(--error); }
.pr-msg.blocked .pr-bubble { background: rgba(239,68,68,0.08); border: 1px dashed rgba(239,68,68,0.4); color: var(--text-soft); text-decoration: line-through; }
.pr-status .dot-anim { animation: pr-blink 1s step-end infinite; }

.pr-ending {
  padding: 9px 14px;
  text-align: center;
  background: rgba(245,158,11,0.14);
  color: var(--accent-warm, #b45309);
  font-size: 13px; font-weight: 700;
  border-top: 1px solid rgba(245,158,11,0.3);
}
.pr-ending[hidden] { display: none !important; }
.pr-ending b { font-variant-numeric: tabular-nums; }

.pr-composer {
  display: flex; gap: 8px;
  padding: 10px 12px;
  padding-bottom: max(10px, env(safe-area-inset-bottom));
  background: var(--surface);
  border-top: 1px solid var(--line);
}
.pr-composer input {
  flex: 1;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg);
  font-size: 14px;
}
.pr-composer input:focus { outline: none; border-color: var(--primary); }
.pr-composer button {
  padding: 0 18px;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  font-weight: 800; font-size: 14px;
}
.pr-composer button:disabled { opacity: 0.5; }
/* Quick-phrases kebab — overrides the generic composer-button look */
.pr-composer .pr-phrase-btn {
  flex-shrink: 0;
  padding: 0;
  width: 30px;
  border-radius: 10px;
  background: transparent;
  color: var(--text-soft);
  display: grid;
  place-items: center;
}
.pr-composer .pr-phrase-btn:hover { background: var(--surface-soft); color: var(--text); }

/* Quick-phrases library sheet (fan side) */
.pr-phrases {
  position: fixed;
  inset: 0;
  z-index: 10025;   /* above the private room in both portrait (1200) and landscape (10010) */
  display: grid;
  place-items: end center;
  padding: 24px 16px;
  padding-bottom: max(24px, env(safe-area-inset-bottom));
  background: rgba(15,23,42,0.35);
}
.pr-phrases[hidden] { display: none !important; }
.pr-phrases-card {
  width: 100%;
  max-width: 420px;
  min-width: 0;
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: 0 18px 48px rgba(15,23,42,0.22);
}
.pr-phrases-card header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px;
}
.pr-phrases-card header b { font-size: 15px; font-weight: 800; }
.pr-phrases-card header button {
  width: 30px; height: 30px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: transparent;
  color: var(--text-soft);
}
.pr-phrases-card header button:hover { background: var(--surface-soft); color: var(--text); }
.pr-phrases-card ul {
  list-style: none;
  margin: 0; padding: 0;
  max-height: 350px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.pr-phrases-card li { display: flex; align-items: center; gap: 6px; }
.pr-phrase-use {
  flex: 1;
  min-width: 0;
  cursor: pointer;
  text-align: left;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--surface-soft);
  font-size: 13px;
  line-height: 1.5;
  white-space: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
}
.pr-phrase-use::-webkit-scrollbar { display: none; }
.pr-phrase-use:hover { background: var(--primary-soft); color: var(--primary-dark); }
.pr-phrase-del {
  width: 28px; height: 28px;
  flex-shrink: 0;
  border-radius: 50%;
  display: grid; place-items: center;
  background: transparent;
  color: var(--text-muted);
}
.pr-phrase-del:hover { background: var(--surface-soft); color: var(--error); }
.pr-phrases-empty { font-size: 12px; color: var(--text-muted); text-align: center; padding: 14px 0; }
.pr-phrase-add {
  display: flex; gap: 8px;
  margin-top: 12px;
}
.pr-phrase-add input {
  flex: 1;
  min-width: 0;
  font: inherit;
  font-size: 13px;
  padding: 9px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
  color: var(--text);
  outline: none;
}
.pr-phrase-add input:focus { border-color: var(--primary); background: var(--surface); }
.pr-phrase-add button {
  padding: 9px 16px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  font-weight: 700;
  font-size: 13px;
}

.pr-summary {
  position: absolute; inset: 0;
  z-index: 5;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background: rgba(15,23,42,0.55);
  backdrop-filter: blur(4px);
}
.pr-summary[hidden] { display: none !important; }
.pr-summary-card {
  width: 100%; max-width: 340px;
  background: var(--surface);
  border-radius: 22px;
  padding: 30px 24px 24px;
  text-align: center;
  box-shadow: var(--shadow-card);
  animation: pr-caption-in 0.25s ease;
}
.pr-sum-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 58px; height: 58px;
  border-radius: 50%;
  background: rgba(34,197,94,0.14);
  color: var(--success);
  margin-bottom: 14px;
}
.pr-summary-card h3 { margin: 0 0 6px; font-size: 20px; font-weight: 800; }
.pr-sum-sub { margin: 0 0 16px; color: var(--text-soft); font-size: 14px; line-height: 1.5; }
.pr-sum-sub b { color: var(--text); font-weight: 800; }
.pr-sum-cost {
  padding: 12px;
  border-radius: 14px;
  background: var(--primary-soft);
  color: var(--primary-dark);
  font-size: 14px; font-weight: 700;
  margin-bottom: 18px;
}
.pr-sum-cost b { font-size: 18px; font-weight: 800; }
.pr-rate { margin-bottom: 18px; }
.pr-rate-q { margin: 0 0 10px; font-size: 14px; font-weight: 700; color: var(--text); }
.pr-rate-q b { font-weight: 800; }
.pr-stars { display: flex; justify-content: center; gap: 4px; margin-bottom: 12px; }
.pr-star { padding: 2px; line-height: 0; background: none; border: 0; color: var(--line); cursor: pointer; transition: transform 0.1s; }
.pr-star svg { display: block; fill: currentColor; }
.pr-star.on { color: #f5b301; }
.pr-star:active { transform: scale(0.88); }
.pr-rate-note {
  width: 100%; box-sizing: border-box;
  border: 1px solid var(--line); border-radius: 14px;
  padding: 10px 12px;
  font: inherit; font-size: 14px; line-height: 1.5; resize: none;
  background: var(--surface-soft); color: var(--text); outline: none;
}
.pr-rate-note:focus { border-color: var(--primary); background: var(--surface); }
.pr-sum-close {
  width: 100%;
  padding: 13px;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  font-weight: 800; font-size: 15px;
}

/* Desktop: center the room as a phone-sized panel over a dimmed page */
@media (min-width: 981px) {
  .priv-room {
    inset: 0;
    margin: auto;
    width: 440px;
    height: min(88vh, 820px);
    border-radius: 22px;
    overflow: hidden;
    box-shadow: 0 0 0 100vmax rgba(15,23,42,0.55), 0 24px 60px rgba(15,23,42,0.4);
  }
  .pr-topbar { padding-top: 12px; }
  .pr-composer { padding-bottom: 12px; }
}
body.priv-room-open { overflow: hidden; }

/* Mobile landscape → the private-room video also goes fullscreen (mirror the public video window).
   Hide the chat/composer chrome; keep only the video + the Tip button. */
@media (orientation: landscape) and (pointer: coarse) and (max-height: 500px) {
  /* Suppress the public video's fullscreen tap-target / hint while a private room is open */
  body.priv-room-open .fs-trigger,
  body.priv-room-open .fs-hint { display: none !important; }

  /* Sit above the public fullscreen video (z 9999) and its overlays (10002/10003) */
  .priv-room { z-index: 10010; }

  /* Everything except the video + Tip disappears in landscape */
  .priv-room .pr-topbar,
  .priv-room .pr-msgs,
  .priv-room .pr-ending,
  .priv-room .pr-composer { display: none !important; }

  .priv-room .pr-stage {
    position: fixed !important;
    inset: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    height: 100dvh !important;
    max-height: none !important;
    aspect-ratio: unset !important;
  }
  .priv-room .pr-badge { top: 14px; left: 14px; font-size: 12px; padding: 5px 11px; }
  .priv-room .pr-hud { top: 14px; right: 14px; font-size: 13px; padding: 6px 12px; }

  /* Tip stays — larger for the fullscreen feel */
  .priv-room .pr-tip {
    bottom: 18px; right: 18px;
    padding: 10px 18px; font-size: 15px;
  }
}

/* ============================================
   LIST VIEW
   ============================================ */
.list-view { display: flex; flex-direction: column; gap: 14px; }

.live-summary {
  display: flex; align-items: center; gap: 8px;
  padding: 0 4px 4px;
  color: var(--text-soft);
  font-size: 13px;
}
.live-summary b { color: var(--text); font-weight: 800; }

.follow-summary {
  display: flex; align-items: center; justify-content: flex-end; gap: 5px;
  padding: 0 4px 4px;
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.follow-summary .fs-num {
  padding: 2px 1px;
  font-weight: 800; color: inherit;
  text-decoration: none;
}
.follow-summary .fs-num:hover { text-decoration: underline; }
.follow-summary .fs-num.cur { text-decoration: underline; text-underline-offset: 3px; }
.follow-summary .online { color: var(--success); }

.live-summary .ls-link { color: inherit; text-decoration: none; }
.live-summary .ls-link b { color: var(--text); font-weight: 800; }
.live-summary .ls-link:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ============ FOLLOWING 未開播卡 ============ */
.stream-card.offair .thumb .init {
  font-size: 40px;
  font-weight: 800;
  color: rgba(255, 255, 255, 0.92);
}
.stream-card.offair .thumb .st-pill {
  position: absolute; top: 8px; left: 8px;
  font-size: 10px; font-weight: 800;
  padding: 3px 9px; border-radius: 999px;
  letter-spacing: 0.04em;
}
.stream-card.offair .thumb .st-pill.online { background: #d1fae5; color: #065f46; }
.stream-card.offair .thumb .st-pill.off { background: rgba(255, 255, 255, 0.85); color: #64748b; }

/* ============ 底部分頁 ============ */
.page-nav {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  padding: 18px 0 6px;
}
.page-nav[hidden] { display: none !important; }
.page-nav button {
  min-width: 30px;
  height: 30px;
  padding: 0 6px;
  border: 0;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  background: var(--surface);
  color: var(--text-soft);
  border: 1px solid var(--line);
  cursor: pointer;
}
.page-nav button:hover:not(:disabled):not(.on) { color: var(--text); border-color: var(--text-muted); }
.page-nav .pg-num.on { background: var(--primary); border-color: var(--primary); color: white; }
.page-nav .pg-arrow:disabled { opacity: 0.35; cursor: default; }

/* ============ 加入做主播 CTA — 靛紫脈衝光環入口 ============ */
.join-live {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  margin: 12px 0 4px;
  background: var(--surface);
  border: 1px solid rgba(99, 102, 241, 0.35);
  border-radius: var(--radius-md);
  color: inherit;
  text-decoration: none;
  transition: border-color 0.15s, background 0.15s;
  animation: join-glow 2.2s ease-in-out infinite;
}
.join-live:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
  animation: none;
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.12);
}
@keyframes join-glow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.35); border-color: rgba(99, 102, 241, 0.35); }
  50% { box-shadow: 0 0 0 6px rgba(99, 102, 241, 0); border-color: var(--primary); }
}
@media (prefers-reduced-motion: reduce) {
  .join-live { animation: none; border-color: var(--primary); }
}
.join-live .ic {
  width: 36px; height: 36px;
  border-radius: 10px;
  display: grid; place-items: center;
  flex-shrink: 0;
  background: var(--primary-soft);
  color: var(--primary);
}
.join-live .body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.join-live .body b { font-size: 13.5px; }
.join-live .body small { font-size: 12px; color: var(--text-soft); }
.join-live .arrow { color: var(--text-soft); }

/* Mobile: auto-fit by container width. Desktop: force 2 cols. */
.stream-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.stream-card {
  display: block;
  background: var(--surface);
  border-radius: 0;
  border: 1px solid var(--line);
  overflow: hidden;
  transition: transform 0.15s, box-shadow 0.15s;
  box-shadow: var(--shadow-card);
}
.stream-card:hover { transform: translateY(-2px); box-shadow: 0 24px 50px rgba(15, 23, 42, 0.12); }

.thumb {
  position: relative;
  aspect-ratio: 1 / 1;
  display: grid;
  place-items: center;
  color: white;
}
.thumb .play {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: rgba(0,0,0,0.45);
  backdrop-filter: blur(6px);
  display: grid; place-items: center;
  opacity: 0; transition: opacity 0.15s;
}
.stream-card:hover .thumb .play { opacity: 1; }
.thumb .play svg { width: 16px; height: 16px; margin-left: 2px; }
.thumb .badge {
  position: absolute; top: 8px; left: 8px;
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--error);
  color: white;
  font-size: 10px; font-weight: 800;
  padding: 3px 8px; border-radius: 999px;
  letter-spacing: 0.06em;
}
.thumb .badge::before {
  content: ""; width: 6px; height: 6px;
  border-radius: 50%; background: white;
  animation: onair-pulse 1.6s ease-in-out infinite;
}
.thumb .badge.adult {
  top: auto; bottom: 8px;
  background: rgba(0,0,0,0.65);
  color: #fbbf24;
}
.thumb .badge.adult::before { display: none; }
.stream-card .info {
  padding: 10px 12px;
  display: flex; flex-direction: column; gap: 5px;
}
.stream-card .info .name {
  font-weight: 700; font-size: 13px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.stream-card .info .meta {
  display: flex; align-items: center; gap: 12px;
  font-size: 11px; font-weight: 700;
  color: var(--text-soft);
  font-variant-numeric: tabular-nums;
}
.stream-card .info .meta span { display: inline-flex; align-items: center; gap: 4px; }

/* ============================================
   VIEWER VIEW
   ============================================ */
.viewer { display: flex; flex-direction: column; gap: 16px; }

.video-card {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-md);
  overflow: hidden;
  color: white;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
}
.video-card::after {
  content: "";
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at center, transparent 30%, rgba(0,0,0,0.4) 100%);
  pointer-events: none;
}
.video-card .vbadge {
  position: absolute; top: 12px; left: 12px;
  z-index: 2;
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--error); color: white;
  font-size: 11px; font-weight: 800;
  padding: 5px 10px; border-radius: 999px;
  letter-spacing: 0.06em;
}
.video-card .vbadge::before {
  content: ""; width: 7px; height: 7px;
  border-radius: 50%; background: white;
  animation: onair-pulse 1.6s ease-in-out infinite;
}
.video-card .vviewers {
  position: absolute; top: 12px; right: 12px;
  z-index: 2;
  background: rgba(0,0,0,0.55);
  color: white;
  font-size: 12px; font-weight: 700;
  padding: 5px 10px; border-radius: 999px;
  backdrop-filter: blur(6px);
  display: inline-flex; align-items: center; gap: 4px;
}
/* Broadcaster info row + actions */
.broadcaster-card {
  padding: 16px;
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
}
.broadcaster-card .avatar { width: 48px; height: 48px; font-size: 18px; }
.broadcaster-card .who { flex: 1; min-width: 0; }
.broadcaster-card .who b { display: block; font-weight: 800; font-size: 16px; }
.broadcaster-card .who small { display: block; color: var(--text-soft); font-size: 12px; margin-top: 2px; }
.broadcaster-card .followers { color: var(--text-soft); font-size: 12px; }
.broadcaster-card .followers b { color: var(--text); font-weight: 800; }
.broadcaster-card .actions {
  display: flex; gap: 8px; flex-wrap: wrap;
  width: 100%;
  margin-top: 4px;
}
.broadcaster-card .actions button,
.broadcaster-card .actions a {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 11px 16px;
  border-radius: 999px;
  font-weight: 700; font-size: 14px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  transition: background 0.15s, border-color 0.15s;
}
.broadcaster-card .actions button:hover,
.broadcaster-card .actions a:hover { background: var(--surface-soft); }
.broadcaster-card .actions .primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  border-color: transparent;
  flex: 1;
}
.broadcaster-card .actions .primary:hover { opacity: 0.92; background: linear-gradient(135deg, var(--primary), var(--primary-dark)); }
.broadcaster-card .actions .primary .price { font-size: 11px; opacity: 0.85; font-weight: 700; }
.broadcaster-card .actions .ghost { color: var(--text-soft); }

/* Live chat — desktop in right panel, mobile under viewer */
.live-chat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  display: flex; flex-direction: column;
  height: 480px;
  overflow: hidden;
}
.live-chat .lh {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  font-size: 13px; font-weight: 700;
  display: flex; align-items: center; gap: 6px;
}
.live-chat .lh::before {
  content: ""; width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--success);
}
.live-chat .stream-msgs { flex: 1; overflow-y: auto; padding: 12px 16px; display: flex; flex-direction: column; gap: 10px; }
.live-chat .smsg { display: flex; gap: 8px; align-items: flex-start; }
.live-chat .smsg .avatar { width: 24px; height: 24px; font-size: 10px; }
.live-chat .smsg .body { flex: 1; min-width: 0; font-size: 13px; line-height: 1.4; }
.live-chat .smsg .body b { font-weight: 700; margin-right: 5px; }
.live-chat .smsg .body small { color: var(--text-muted); font-size: 10px; margin-left: 4px; }
.live-chat .smsg.broadcaster .body b { color: var(--primary-dark); }

.live-chat .lcomposer {
  display: flex; gap: 8px; align-items: center;
  padding: 10px 12px;
  border-top: 1px solid var(--line);
  background: var(--surface);
}
.live-chat .lcomposer input {
  flex: 1;
  background: var(--surface-soft);
  border-radius: 999px;
  padding: 9px 14px;
  font-size: 13px;
}
.live-chat .lcomposer button {
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--cta-bg);
  color: var(--cta-text);
  font-weight: 700; font-size: 12px;
}

/* ============ LEADERBOARD (shared mobile + desktop) ============ */
.leaderboard-mobile,
.leaderboard-desktop {
  background: var(--surface);
}
.leaderboard-desktop {
  padding: 0;
  overflow: hidden;          /* clip the .card border-radius */
}
.lb-head {
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
  font-weight: 700;
}
.lb-total {
  color: var(--text-soft);
  font-weight: 600;
  margin-left: 4px;
}
.lb-list { list-style: none; padding: 0; margin: 0; }

/* === Desktop: max-height limit + hidden scrollbar (show on hover) === */
.leaderboard-desktop .lb-list {
  max-height: 360px;
  overflow-y: auto;
}
/* Hide scrollbars by default for chat msgs + leaderboard list */
.live-chat .stream-msgs,
.leaderboard-desktop .lb-list {
  scrollbar-width: none;        /* Firefox */
  -ms-overflow-style: none;     /* IE / legacy Edge */
  scrollbar-gutter: stable;     /* reserve space so content doesn't jump on hover */
}
.live-chat .stream-msgs::-webkit-scrollbar,
.leaderboard-desktop .lb-list::-webkit-scrollbar {
  width: 0;                     /* WebKit / Chrome / Safari */
}
/* Show thin scrollbar when user hovers the parent container */
.live-chat:hover .stream-msgs,
.leaderboard-desktop:hover .lb-list {
  scrollbar-width: thin;
}
.live-chat:hover .stream-msgs::-webkit-scrollbar,
.leaderboard-desktop:hover .lb-list::-webkit-scrollbar {
  width: 3px;
}
.live-chat:hover .stream-msgs::-webkit-scrollbar-thumb,
.leaderboard-desktop:hover .lb-list::-webkit-scrollbar-thumb {
  background: var(--text-muted);
  border-radius: 3px;
}
.live-chat:hover .stream-msgs::-webkit-scrollbar-thumb:hover,
.leaderboard-desktop:hover .lb-list::-webkit-scrollbar-thumb:hover {
  background: var(--text-soft);
}
.live-chat:hover .stream-msgs::-webkit-scrollbar-track,
.leaderboard-desktop:hover .lb-list::-webkit-scrollbar-track {
  background: transparent;
}
.lb-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  position: relative;
}
.lb-row:last-child { border-bottom: 0; }
.lb-row .avatar { width: 36px; height: 36px; font-size: 14px; }
.lb-row .name {
  flex: 1;
  font-weight: 700;
  font-size: 14px;
  display: inline-flex; align-items: center; gap: 6px;
  min-width: 0;
}
.lb-row .you-tag {
  background: var(--primary);
  color: white;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 999px;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: opacity 0.15s;
}
@media (hover: hover) {
  .lb-row .you-tag:hover { opacity: 0.85; }
}
.lb-row .amount {
  font-weight: 800;
  font-size: 14px;
  color: var(--success);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.lb-row .amount small {
  font-size: 10px;
  opacity: 0.7;
  margin-left: 3px;
  font-weight: 700;
}

/* Highlight viewer's own row only — top-3 styling removed for visual calm */
.lb-row.is-you {
  background: linear-gradient(90deg, var(--primary-soft), transparent 70%);
}
.lb-row .you-tag.anon { background: var(--text-soft); }
.lb-row .name.anon { color: var(--text-soft); font-style: italic; }
.lb-row.is-anon-public .avatar {
  background: var(--surface-soft) !important;
  color: var(--text-muted);
}

/* ============ TIP ANONYMITY MODAL ============ */
.tip-modal {
  position: fixed;
  inset: 0;
  z-index: 10030;   /* above the landscape fullscreen private room (10010) */
  display: grid;
  place-items: center;
  padding: 20px;
}
.tip-modal[hidden] { display: none !important; }
.tip-modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  -webkit-backdrop-filter: blur(2px);
          backdrop-filter: blur(2px);
}
.tip-modal-card {
  position: relative;
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border-radius: 22px;
  padding: 24px;
  box-shadow: 0 30px 80px rgba(15, 23, 42, 0.3);
  text-align: center;
  animation: tm-in 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes tm-in {
  from { opacity: 0; transform: translateY(12px) scale(0.96); }
  to   { opacity: 1; transform: none; }
}
.tm-icon {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary-dark);
  display: grid; place-items: center;
  margin: 0 auto 12px;
}
.tip-modal-card h3 { margin: 0 0 8px; font-size: 17px; }
.tm-desc {
  margin: 0 0 10px;
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
}
.tm-desc b { color: var(--primary-dark); }
.tm-note {
  background: var(--surface-soft);
  border-radius: 10px;
  padding: 10px 14px;
  margin: 0 0 14px;
  font-size: 12px;
  color: var(--text-soft);
  line-height: 1.6;
}
.tm-note b { color: var(--text); }
.tm-remember {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-soft);
  margin-bottom: 16px;
  cursor: pointer;
  user-select: none;
}
.tm-remember input { position: absolute; opacity: 0; pointer-events: none; }
.tm-remember .box {
  width: 16px; height: 16px;
  border: 1.5px solid var(--text-muted);
  border-radius: 4px;
  display: grid;
  place-items: center;
  background: transparent;
  transition: background 0.15s, border-color 0.15s;
}
.tm-remember input:checked + .box {
  background: var(--primary);
  border-color: var(--primary);
}
.tm-remember input:checked + .box::after {
  content: "✓";
  color: white;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
}
.tip-modal-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.tip-modal-actions button {
  flex: 1;
  min-width: 90px;
  padding: 10px 14px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 13px;
  transition: opacity 0.15s, transform 0.05s, background 0.15s;
}
.tip-modal-actions button:active { transform: translateY(0); }
.tm-cancel { background: var(--surface-soft); color: var(--text-soft); }
.tm-cancel:hover { background: var(--line); }
.tm-public {
  background: var(--text);
  color: white;
}
.tm-public:hover { opacity: 0.92; }
.tm-anon {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
}
.tm-anon:hover { opacity: 0.92; }

/* ============ RIGHT PANEL (list view) ============ */
.right-panel { display: flex; flex-direction: column; gap: 18px; }
.right-panel .card { padding: 18px; }
.right-panel h2 { font-size: 16px; margin: 0 0 12px; font-weight: 700; }

.howtocard { background: linear-gradient(180deg, var(--surface), var(--primary-soft)); }
.howtocard p { font-size: 13px; line-height: 1.6; color: var(--text); margin: 0 0 8px; }
.howtocard p:last-child { margin-bottom: 0; }
.howtocard b { color: var(--primary-dark); }

/* ============ MOBILE NAV ============ */
.mobile-nav { display: none; }

/* ============ RESPONSIVE ============ */
@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
    padding: 12px;
    padding-bottom: 96px;
    gap: 12px;
  }
  .sidebar, .right-panel { display: none; }

  .topbar {
    position: sticky; top: 0; z-index: 10;
    background: rgba(248, 250, 252, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    padding: 12px 4px; margin: 0;
  }
  .topbar h1 { display: none; }
  .topbar-brand { display: inline-flex; }

  .live-chat { height: 380px; }

  /* Desktop leaderboard hidden on mobile (mobile uses the swipeable panel instead) */
  .leaderboard-desktop { display: none; }

  /* private-flow base styles live at default scope now (apply to both mobile + desktop) */

  /* === MOBILE viewer view: sticky video + swipeable chat/leaderboard === */
  .mobile-panels {
    display: block;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--surface);
    box-shadow: var(--shadow-card);
  }

  .mobile-tabs {
    display: flex;
    border-bottom: 1px solid var(--line);
  }
  .mobile-tabs .mtab {
    flex: 1;
    padding: 14px 8px;
    text-align: center;
    color: var(--text-soft);
    font-weight: 700;
    font-size: 14px;
    transition: color 0.15s, background 0.15s;
  }
  .mobile-tabs .mtab.active {
    color: var(--text);
  }
  .mobile-tabs .mtab:hover:not(.active) { background: var(--surface-soft); }

  .mobile-swiper {
    display: flex;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    height: 480px;                  /* fixed panel height — content scrolls inside */
  }
  .mobile-swiper::-webkit-scrollbar { display: none; }
  .mobile-panel {
    flex: 0 0 100%;
    scroll-snap-align: start;
    min-width: 0;
    height: 100%;
    display: flex;                  /* let child fill height */
    flex-direction: column;
  }

  /* Chat inside swiper — flex column: lh fixed, msgs scrolls, composer fixed */
  .mobile-panel .live-chat.live-chat-mobile {
    display: flex;
    flex-direction: column;
    height: 100%;
    margin: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }
  .live-chat-mobile .lh { flex-shrink: 0; }
  .live-chat-mobile .stream-msgs {
    flex: 1;
    overflow-y: auto;
    min-height: 0;                  /* allow flex child to scroll */
  }
  .live-chat-mobile .lcomposer { flex-shrink: 0; }

  /* Leaderboard inside swiper — same pattern */
  .mobile-panel .leaderboard-mobile {
    display: flex;
    flex-direction: column;
    height: 100%;
  }
  .leaderboard-mobile .lb-head { flex-shrink: 0; }
  .leaderboard-mobile .lb-list {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
  }

  /* Mobile: simplify 1on1 button — drop the price chip, keep emoji + label */
  .broadcaster-card .actions .primary .price { display: none; }

  /* Kill the gap above the video on mobile viewer mode */
  .viewer {
    /* cancel the .main flex gap (14px) so video sits flush against topbar */
    margin-top: -14px;
  }

  /* Live video stays pinned below topbar while user scrolls the rest */
  .viewer .video-card {
    position: sticky;
    top: 56px;             /* JS overrides this with exact topbar height */
    z-index: 5;
    margin: 0 -12px;       /* edge-to-edge, cancels app-shell padding */
    border-radius: 0;
    border-left: 0; border-right: 0;
  }

  .mobile-nav {
    position: fixed;
    left: 12px; right: 12px;
    bottom: calc(12px + env(safe-area-inset-bottom));
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    align-items: center;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid var(--line);
    border-radius: 24px;
    box-shadow: var(--shadow-card);
    padding: 10px;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    z-index: 20;
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s;
  }
  .mobile-nav.nav-hidden {
    transform: translateY(calc(100% + 24px));
    opacity: 0;
    pointer-events: none;
  }
  .mobile-nav a { text-align: center; font-size: 12px; color: var(--text-soft); padding: 8px 4px; }
  .mobile-nav a.active { color: var(--text); font-weight: 600; }
  .mobile-nav .compose-btn {
    width: 46px; height: 46px;
    margin: auto; padding: 0;
    border-radius: 50%;
    background: var(--cta-bg); color: var(--cta-text);
    display: grid; place-items: center; line-height: 1;
  }
}
