* { box-sizing: border-box; margin: 0; padding: 0; }
/* CRITICAL: HTML `hidden` attribute must beat author-CSS display rules.
   Without this, .modal/.error-overlay/.intro/.app/.tour/.viewer flash on
   page load and stay visible because their `display: flex` wins over the
   user-agent `[hidden] { display: none }` rule on tied specificity. */
[hidden] { display: none !important; }
html, body {
  height: 100%;
  width: 100%;
  background: #0a0a0a;
  color: #fff;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  overscroll-behavior: none;
}
body { font-size: 14px; }
button { font: inherit; color: inherit; cursor: pointer; -webkit-appearance: none; }

/* ───────────── INTRO ───────────── */
.intro {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: radial-gradient(circle at 50% 0%, #1a1a1a 0%, #050505 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow-y: auto;
  padding-top: max(24px, env(safe-area-inset-top));
  padding-bottom: max(24px, env(safe-area-inset-bottom));
}
.intro-card {
  width: 100%;
  max-width: 460px;
}
.intro-logo {
  display: flex;
  justify-content: center;
  margin-bottom: 16px;
}
.logo-circle {
  width: 80px;
  height: 80px;
  border-radius: 22px;
  background: linear-gradient(135deg, #ff8a00, #e52e71);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 12px 40px rgba(229, 46, 113, 0.35);
}
.intro-title {
  font-size: 28px;
  font-weight: 800;
  text-align: center;
  letter-spacing: -0.02em;
}
.intro-title em {
  font-style: normal;
  background: linear-gradient(135deg, #ff8a00, #e52e71);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.intro-sub {
  text-align: center;
  font-size: 14px;
  color: #999;
  margin: 8px 0 24px;
  line-height: 1.5;
}
.intro-features {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 20px;
}
.feat {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.feat span { font-size: 22px; }
.feat b { font-size: 13px; font-weight: 700; }
.feat i { font-size: 11px; font-style: normal; color: #888; line-height: 1.4; }
.intro-start {
  width: 100%;
  height: 56px;
  border: 0;
  border-radius: 16px;
  background: linear-gradient(135deg, #ff8a00, #e52e71);
  color: #fff;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.01em;
  box-shadow: 0 8px 24px rgba(229, 46, 113, 0.35);
  transition: transform 0.05s;
}
.intro-start:active { transform: scale(0.98); }
.intro-hint {
  text-align: center;
  font-size: 12px;
  color: #666;
  margin: 10px 0 18px;
}
.intro-help {
  background: rgba(255, 255, 255, 0.03);
  border-radius: 12px;
  padding: 12px 14px;
}
.intro-help summary {
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  list-style: none;
}
.intro-help summary::-webkit-details-marker { display: none; }
.intro-help[open] summary { margin-bottom: 12px; }
.intro-help ol {
  padding-left: 18px;
  font-size: 13px;
  line-height: 1.7;
  color: #bbb;
}
.intro-help ol li b { color: #fff; }
.intro-help .warn {
  margin-top: 10px;
  font-size: 11px;
  color: #ff8a00;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding-top: 8px;
}

/* ───────────── APP ───────────── */
.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  /* Use small-vh fallback for older iOS that doesn't grok dvh */
  min-height: -webkit-fill-available;
  padding-top: env(safe-area-inset-top);
}
@supports (height: 100dvh) { .app { height: 100dvh; } }

/* Header */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  background: rgba(10, 10, 10, 0.95);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  z-index: 5;
  flex-shrink: 0;
}
.brand {
  font-size: 15px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}
.brand em {
  font-style: normal;
  background: linear-gradient(135deg, #ff8a00, #e52e71);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin-left: 4px;
}
.brand .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ff8a00, #e52e71);
  box-shadow: 0 0 8px rgba(255, 138, 0, 0.6);
}
.help-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Stage */
.stage {
  flex: 1 1 auto;
  position: relative;
  background: #000;
  overflow: hidden;
  min-height: 200px;
}
#src {
  position: absolute;
  visibility: hidden;
  width: 1px;
  height: 1px;
  pointer-events: none;
}
#preview {
  /* WYSIWYG: preview shows the EXACT frame that's broadcast (no crop).
     'contain' letterboxes if aspect doesn't match the stage. */
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  background: #000;
}
.overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.status-pill {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(12px);
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  pointer-events: none;
  white-space: nowrap;
  transition: opacity 0.6s ease;
}
.rec-indicator, .bcast-indicator {
  position: absolute;
  top: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(12px);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
}
.rec-indicator { left: 12px; color: #ff5252; }
.bcast-indicator { right: 12px; color: #4caf50; }
.rec-dot, .bcast-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  animation: pulse 1.4s ease-in-out infinite;
}
.rec-dot { background: #ff5252; box-shadow: 0 0 8px #ff5252; }
.bcast-dot { background: #4caf50; box-shadow: 0 0 8px #4caf50; }
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.8); }
}

/* Controls */
.controls {
  background: rgba(15, 15, 15, 0.97);
  backdrop-filter: blur(20px);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  padding: 8px 12px calc(10px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}
.row {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Toggle */
.toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
}
.toggle input { display: none; }
.toggle-track {
  width: 38px;
  height: 22px;
  border-radius: 999px;
  background: #333;
  position: relative;
  transition: background 0.2s;
}
.toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.2s;
}
.toggle input:checked ~ .toggle-track { background: linear-gradient(135deg, #ff8a00, #e52e71); }
.toggle input:checked ~ .toggle-track .toggle-thumb { transform: translateX(16px); }

/* Slider */
.slider-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}
.slider {
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.1);
  outline: none;
}
.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid #ff8a00;
  cursor: pointer;
}
.slider.beauty::-webkit-slider-thumb { border-color: #e52e71; }
.amount {
  font-size: 11px;
  font-weight: 700;
  color: #ff8a00;
  min-width: 28px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.slider.beauty + .amount { color: #e52e71; }
.intensity-label {
  font-size: 11px;
  color: #888;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  flex-shrink: 0;
  width: 90px;
}

/* Filter strip */
.filter-strip-wrap {
  margin: 0 -12px;
  padding: 4px 0 6px;
}
.strip-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #888;
  padding: 0 14px 4px;
}
.filter-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding: 0 12px 4px;
}
.filter-strip::-webkit-scrollbar { display: none; }
.filter-btn {
  flex: 0 0 auto;
  width: 60px;
  height: 60px;
  border-radius: 14px;
  border: 2px solid transparent;
  color: white;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  display: flex;
  align-items: end;
  justify-content: center;
  padding: 4px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7);
  background-position: center;
  background-size: cover;
  transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.filter-btn.active {
  border-color: #fff;
  transform: scale(1.08);
  box-shadow: 0 0 0 3px rgba(255, 138, 0, 0.45);
}

/* Action bar */
.action-bar {
  display: flex;
  align-items: center;
  gap: 8px;
}
.btn-icon, .btn-record, .btn-broadcast, .select-res {
  height: 44px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 14px;
  transition: background 0.15s, transform 0.05s;
}
.btn-icon:active, .btn-record:active, .btn-broadcast:active { transform: scale(0.96); }
.btn-icon { width: 44px; padding: 0; }
.select-res {
  -webkit-appearance: none;
  appearance: none;
  padding: 0 26px 0 12px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23999'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 6px center;
  background-size: 14px;
}
.btn-record {
  flex: 1;
  background: linear-gradient(135deg, #ff5252, #d32f2f);
  border: none;
}
.btn-record .rec-circle {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fff;
}
.btn-record.recording .rec-circle { border-radius: 3px; }
.btn-record.mode-fb {
  background: linear-gradient(135deg, #1877f2, #0a4ea8);
}
.btn-record.mode-fb .rec-circle {
  background: #fff;
}
.fb-default-badge {
  font-size: 10px;
  background: linear-gradient(135deg, #ff8a00, #e52e71);
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 700;
  margin-left: 6px;
  vertical-align: middle;
}
.btn-broadcast {
  flex: 0 0 auto;
  background: linear-gradient(135deg, #4caf50, #2e7d32);
  border: none;
}
.btn-broadcast.live { background: linear-gradient(135deg, #ff8a00, #e52e71); }

.btn-fblive {
  flex: 0 0 auto;
  background: linear-gradient(135deg, #1877f2, #0a4ea8);
  border: none;
  color: #fff;
  height: 48px;
  padding: 0 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
  border-radius: 12px;
}
.btn-fblive.live { background: linear-gradient(135deg, #ff8a00, #e52e71); }

/* Fullscreen toggle on preview — small button, top-right of stage */
.fullscreen-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 9;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  transition: background 0.15s, transform 0.15s;
}
.fullscreen-btn:active { transform: scale(0.94); background: rgba(0, 0, 0, 0.75); }
.fullscreen-btn .fs-icon-collapse { display: none; }
body.preview-fullscreen .fullscreen-btn .fs-icon-expand { display: none; }
body.preview-fullscreen .fullscreen-btn .fs-icon-collapse { display: block; }

/* When body has .preview-fullscreen, the stage takes the whole viewport
   and everything else (header, controls, filter strip) is hidden so the
   user can use the phone like a mirror while live. */
body.preview-fullscreen .header,
body.preview-fullscreen .controls,
body.preview-fullscreen .tour {
  display: none !important;
}
body.preview-fullscreen .stage {
  position: fixed;
  inset: 0;
  height: 100vh;
  height: 100dvh;
  width: 100vw;
  z-index: 60;
  background: #000;
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
}
body.preview-fullscreen #preview {
  /* Mirror-like fullscreen: cover the screen instead of letterbox so user
     sees themselves filling the phone. The captured/broadcast frame is
     unaffected — only the on-screen render uses cover. */
  object-fit: cover;
}
body.preview-fullscreen .fullscreen-btn {
  top: max(12px, env(safe-area-inset-top));
  right: max(12px, env(safe-area-inset-right));
}
body.preview-fullscreen .fb-hud {
  top: max(12px, env(safe-area-inset-top));
}

/* Floating live HUD on preview — Prism Live style */
.fb-hud {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 8;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 82, 82, 0.4);
  border-radius: 100px;
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3px;
  pointer-events: auto;
  cursor: pointer;
  max-width: 90vw;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  animation: fbHudPulse 2s ease-in-out infinite;
}
@keyframes fbHudPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 82, 82, 0.4); }
  50% { box-shadow: 0 0 0 6px rgba(255, 82, 82, 0); }
}
.fb-hud .rec-dot {
  width: 8px;
  height: 8px;
  background: #ff5252;
  border-radius: 50%;
  animation: blink 1.2s infinite;
  flex-shrink: 0;
}
@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}
.fb-hud-label {
  background: linear-gradient(135deg, #ff5252, #d32f2f);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.5px;
}
.fb-hud-page {
  color: #fff;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.fb-hud-time {
  color: #ffd54f;
  font-variant-numeric: tabular-nums;
}
.fb-hud-kbps {
  color: #80d8ff;
  font-variant-numeric: tabular-nums;
}
@media (max-width: 380px) {
  .fb-hud { font-size: 10px; padding: 5px 10px; gap: 5px; }
  .fb-hud-page { max-width: 80px; }
}

/* Header actions */
.header-actions { display: flex; gap: 6px; align-items: center; }
.settings-btn svg { display: block; }

/* FB Live + Settings modal */
.fb-step { display: flex; flex-direction: column; gap: 12px; }
#settingsToken {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 10px 12px;
  color: #fff;
  font-family: ui-monospace, 'SF Mono', Menlo, monospace;
  font-size: 12px;
  resize: vertical;
  width: 100%;
  min-height: 90px;
  margin-bottom: 8px;
}
#settingsToken:focus { outline: none; border-color: #1877f2; }
.fb-label {
  font-size: 12px;
  font-weight: 700;
  color: #aaa;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
#fbToken {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 10px 12px;
  color: #fff;
  font-family: ui-monospace, 'SF Mono', Menlo, monospace;
  font-size: 12px;
  resize: vertical;
  width: 100%;
  min-height: 70px;
}
#fbToken:focus { outline: none; border-color: #1877f2; }
.fb-helper {
  font-size: 11px;
  color: #888;
  line-height: 1.5;
}
.fb-helper a { color: #4faec0; text-decoration: none; }
.fb-helper code {
  background: rgba(255, 255, 255, 0.06);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 10px;
}
.fb-helper-tip { display: block; margin-top: 4px; }
.fb-btn-primary {
  width: 100%;
  height: 46px;
  border-radius: 12px;
  border: 0;
  background: linear-gradient(135deg, #1877f2, #0a4ea8);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
}
.fb-btn-back {
  width: 100%;
  height: 38px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: transparent;
  color: #aaa;
  font-size: 12px;
}
.fb-pages {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 240px;
  overflow-y: auto;
}
.fb-page-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  cursor: pointer;
  text-align: left;
  color: #fff;
}
.fb-page-item.selected {
  border-color: #1877f2;
  background: rgba(24, 119, 242, 0.15);
}
.fb-page-item .fb-page-name { font-weight: 600; font-size: 14px; }
.fb-page-item .fb-page-id   { font-size: 11px; color: #888; }
.fb-row input {
  width: 100%;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 10px 12px;
  color: #fff;
  font-size: 13px;
}
.fb-row input:focus { outline: none; border-color: #1877f2; }
.fb-live-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(135deg, #ff5252, #d32f2f);
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  padding: 10px;
  border-radius: 10px;
  letter-spacing: 0.5px;
}
.fb-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.fb-stats > div {
  background: rgba(255, 255, 255, 0.04);
  border-radius: 10px;
  padding: 10px;
}
.fb-stats label {
  display: block;
  font-size: 10px;
  color: #888;
  text-transform: uppercase;
  margin-bottom: 4px;
  letter-spacing: 0.5px;
}
.fb-stats b { font-size: 14px; color: #fff; }
.fb-link-view {
  display: block;
  text-align: center;
  padding: 10px;
  background: rgba(24, 119, 242, 0.15);
  color: #4faec0;
  border-radius: 10px;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
}
.fb-log {
  max-height: 100px;
  overflow-y: auto;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 8px;
  padding: 8px 10px;
  font-family: ui-monospace, 'SF Mono', Menlo, monospace;
  font-size: 10px;
  color: #aaa;
  line-height: 1.4;
}
.fb-log:empty { display: none; }

/* Tour bubble */
.tour {
  position: fixed;
  bottom: 200px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.92);
  border-radius: 16px;
  padding: 14px 18px;
  z-index: 30;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
  border: 1px solid rgba(255, 138, 0, 0.4);
  max-width: 90vw;
}
.tour-bubble { font-size: 13px; font-weight: 600; }
.tour-close {
  background: linear-gradient(135deg, #ff8a00, #e52e71);
  border: 0;
  border-radius: 8px;
  padding: 6px 18px;
  font-size: 12px;
  font-weight: 700;
}

/* ───────────── MODAL ───────────── */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.88);
  backdrop-filter: blur(20px);
  padding: 16px;
  overflow-y: auto;
}
.modal-content {
  background: #1a1a1a;
  border-radius: 16px;
  padding: 22px 18px;
  max-width: 420px;
  width: 100%;
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.06);
  margin: auto;
  max-height: 92vh;
  overflow-y: auto;
}
.help-content { max-width: 480px; }
.modal-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 0;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-size: 20px;
  line-height: 1;
}
.modal h2 {
  font-size: 18px;
  margin-bottom: 6px;
  padding-right: 32px;
}
.modal-desc {
  font-size: 12px;
  color: #aaa;
  margin-bottom: 16px;
  line-height: 1.5;
}
.help-section {
  background: rgba(255, 255, 255, 0.03);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 10px;
}
.help-section h3 {
  font-size: 14px;
  margin-bottom: 6px;
}
.help-section p, .help-section ul, .help-section ol {
  font-size: 12px;
  color: #bbb;
  line-height: 1.6;
}
.help-section ul, .help-section ol {
  padding-left: 18px;
  margin-top: 6px;
}
.help-section .tip {
  margin-top: 6px;
  padding: 6px 10px;
  background: rgba(255, 138, 0, 0.08);
  border-radius: 6px;
  font-size: 11px;
  color: #ffb060;
}
.help-section b { color: #fff; }

/* Broadcast modal */
.link-box {
  display: flex;
  gap: 6px;
  margin-bottom: 14px;
}
.link-box input {
  flex: 1;
  background: #000;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 10px 12px;
  color: #fff;
  font-family: ui-monospace, Menlo, monospace;
  font-size: 11px;
  -webkit-user-select: text;
  user-select: text;
}
.link-box button {
  padding: 0 14px;
  background: linear-gradient(135deg, #ff8a00, #e52e71);
  color: #fff;
  border: 0;
  border-radius: 8px;
  font-weight: 700;
}
.qr-box {
  display: flex;
  justify-content: center;
  margin-bottom: 14px;
  background: #fff;
  padding: 10px;
  border-radius: 12px;
}
.qr-box img { width: 180px; height: 180px; display: block; }
.modal-stats {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: #888;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.modal-stats b { color: #4caf50; font-size: 14px; }
.modal-stats code {
  background: rgba(255, 255, 255, 0.06);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 11px;
}
.btn-stop-broadcast {
  width: 100%;
  height: 44px;
  border-radius: 12px;
  border: 0;
  background: rgba(255, 82, 82, 0.15);
  color: #ff5252;
  font-weight: 700;
  font-size: 13px;
}

/* ───────────── ERROR OVERLAY ───────────── */
.error-overlay {
  position: fixed;
  inset: 0;
  z-index: 150;
  background: rgba(0, 0, 0, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.error-card {
  background: #1a1a1a;
  border: 1px solid rgba(255, 82, 82, 0.3);
  border-radius: 16px;
  padding: 24px;
  max-width: 400px;
  width: 100%;
  text-align: center;
}
.error-card h2 { font-size: 18px; margin-bottom: 8px; color: #ff5252; }
.error-card p { font-size: 13px; color: #bbb; margin-bottom: 18px; line-height: 1.6; }
.error-card button {
  width: 100%;
  height: 44px;
  border-radius: 12px;
  border: 0;
  background: linear-gradient(135deg, #ff8a00, #e52e71);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
}

/* ───────────── VIEWER ───────────── */
.viewer {
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 200;
}
.viewer video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}
.viewer-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  background: rgba(0, 0, 0, 0.6);
  transition: opacity 0.4s;
}
.viewer.connected .viewer-overlay { opacity: 0; }
.viewer-overlay h2 { font-size: 20px; margin-bottom: 6px; }
.viewer-overlay p { color: #888; font-size: 13px; }
