:root {
  --bg: #090a0f;
  --surface: #12141d;
  --surface-elevated: #191c28;
  --border: rgba(255, 255, 255, 0.1);
  --border-strong: rgba(255, 255, 255, 0.18);
  --fg: #f8fafc;
  --muted: #94a3b8;
  --primary: #be123c;
  --primary-hover: #9f1239;
  --primary-fg: #ffffff;
  --success: #34d399;
  --warning: #fbbf24;
  --error: #f43f5e;
}

* {
  box-sizing: border-box;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid #fda4af;
  outline-offset: 2px;
}

body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  background: radial-gradient(circle at top center, rgba(244, 63, 94, 0.08), transparent 45%), var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, sans-serif;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
}

.hidden {
  display: none !important;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.strong {
  font-weight: 700;
  color: var(--fg);
}

.muted {
  color: var(--muted);
}

.container {
  max-width: 1152px;
  width: 100%;
  margin: 0 auto;
  padding: 0 16px;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(9, 10, 15, 0.82);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 12px;
  padding-bottom: 12px;
}

.brand-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  padding: 0;
}

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: linear-gradient(135deg, #f43f5e, #d946ef, #6366f1);
  color: #fff;
  font-weight: 800;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 18px rgba(244, 63, 94, 0.3);
}

.brand-title-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-name {
  font-weight: 800;
  font-size: 17px;
  letter-spacing: -0.02em;
}

.brand-pill {
  font-size: 12px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  border: 1px solid var(--border);
}

.nav-pills {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
}

.nav-btn {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.18s ease;
}

.nav-btn:hover {
  color: var(--fg);
}

.nav-btn.active {
  background: var(--primary);
  color: var(--primary-fg);
  box-shadow: 0 4px 12px rgba(244, 63, 94, 0.35);
}

.header-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.live-users-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 11px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 12px;
  font-weight: 600;
  color: var(--fg);
  white-space: nowrap;
}

.live-user-dot {
  flex-shrink: 0;
}

.session-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
}

.session-handle {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  font-weight: 600;
  color: var(--fg);
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--success);
  display: inline-block;
  flex-shrink: 0;
}

.status-dot.warn {
  background: var(--warning);
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  padding: 9px 18px;
  border-radius: 999px;
  border: none;
  background: var(--primary);
  color: var(--primary-fg);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(190, 18, 60, 0.35);
  transition: transform 0.15s ease, opacity 0.15s ease;
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
}

.btn-primary:active:not(:disabled) {
  transform: scale(0.96);
}

.btn-primary:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 9px 18px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--fg);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.consent-actions .btn-primary,
.consent-actions .btn-secondary,
.studio-footer .btn-primary,
.studio-footer .btn-secondary,
.empty-actions .btn-primary {
  min-height: 44px;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 700;
}

.btn-secondary:hover {
  background: var(--surface-elevated);
}

/* Main */
.main-content {
  flex: 1;
  padding-top: 20px;
  padding-bottom: max(96px, calc(84px + env(safe-area-inset-bottom)));
}

.feed-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  max-width: 400px;
  width: 100%;
  margin: 0 auto 18px auto;
}

.shared-banner {
  max-width: 400px;
  width: 100%;
  margin: 0 auto 18px auto;
  padding: 10px 14px;
  border-radius: 16px;
  background: rgba(244, 63, 94, 0.12);
  border: 1px solid rgba(244, 63, 94, 0.35);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.shared-banner-text {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--fg);
  min-width: 0;
}

.segmented-control {
  display: inline-flex;
  padding: 4px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
}

.seg-btn {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  padding: 7px 16px;
  border-radius: 999px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.18s ease;
}

.seg-btn:hover {
  color: var(--fg);
}

.seg-btn.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 4px 12px rgba(244, 63, 94, 0.3);
}

.feed-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
}

.feed-status strong {
  color: var(--fg);
}

/* Single-File Story Feed */
.story-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 22px;
  max-width: 400px;
  width: 100%;
  margin: 0 auto;
}

.story-card {
  position: relative;
  aspect-ratio: 9 / 16;
  border-radius: 24px;
  overflow: hidden;
  background: #000;
  border: 1px solid var(--border);
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.45);
  cursor: pointer;
  user-select: none;
}

.story-card.near-threshold {
  border-color: var(--error);
  box-shadow: 0 0 0 2px rgba(244, 63, 94, 0.35), 0 18px 36px rgba(0, 0, 0, 0.5);
}

.story-media {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.story-card:hover .story-media {
  transform: scale(1.03);
}

.story-open-btn {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
}

.story-open-btn:focus-visible {
  outline: 3px solid #fda4af;
  outline-offset: -3px;
  border-radius: 24px;
}

.story-open-pill {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  padding: 8px 16px;
  border-radius: 999px;
  background: rgba(9, 10, 15, 0.86);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  opacity: 0;
  transition: opacity 0.16s ease;
  pointer-events: none;
  white-space: nowrap;
}

.story-open-btn:hover .story-open-pill,
.story-open-btn:focus-visible .story-open-pill {
  opacity: 1;
}

.scrim-top {
  position: absolute;
  inset: 0 0 auto 0;
  z-index: 2;
  padding: 14px 14px 36px 14px;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0.25) 65%, transparent);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  pointer-events: none;
}

.scrim-top-meta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.lb-position-pill {
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.56);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: rgba(255, 255, 255, 0.92);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.author-block {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.avatar-orb {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.35);
}

.grad-0 { background: linear-gradient(135deg, #f43f5e, #f59e0b); }
.grad-1 { background: linear-gradient(135deg, #06b6d4, #4f46e5); }
.grad-2 { background: linear-gradient(135deg, #d946ef, #7c3aed); }
.grad-3 { background: linear-gradient(135deg, #10b981, #0d9488); }
.grad-4 { background: linear-gradient(135deg, #f97316, #db2777); }

.author-text {
  min-width: 0;
}

.author-name {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.blur-badge {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 500;
  color: #6ee7b7;
}

.countdown-pill {
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.52);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #fff;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.pulse-dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: #34d399;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.threshold-alert {
  position: absolute;
  top: 64px;
  left: 14px;
  right: 14px;
  padding: 6px 10px;
  border-radius: 12px;
  background: rgba(225, 29, 72, 0.92);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  text-align: center;
}

.scrim-bottom {
  position: absolute;
  inset: auto 0 0 0;
  z-index: 2;
  padding: 52px 14px 14px 14px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.94), rgba(0, 0, 0, 0.6) 60%, transparent);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.card-caption {
  margin: 0;
  font-size: 12px;
  line-height: 1.4;
  color: rgba(255, 255, 255, 0.94);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-caption.empty {
  color: rgba(255, 255, 255, 0.55);
  font-style: italic;
}

.uid-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.uid-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.56);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: rgba(255, 255, 255, 0.85);
  font-size: 11px;
  letter-spacing: 0.02em;
}

.vote-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-actions-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.glass-pill-btn {
  flex: 1;
  min-height: 38px;
  padding: 8px 12px;
  border-radius: 999px;
  backdrop-filter: blur(14px);
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.16s ease;
}

.glass-util-btn {
  flex: 1;
  min-height: 34px;
  padding: 6px 10px;
  border-radius: 999px;
  backdrop-filter: blur(14px);
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: rgba(255, 255, 255, 0.9);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  transition: all 0.16s ease;
}

.glass-util-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.18);
}

.glass-util-btn.danger {
  border-color: rgba(244, 63, 94, 0.48);
  color: #fda4af;
}

.glass-util-btn.danger:hover {
  background: rgba(225, 29, 72, 0.35);
  color: #fff;
}

.glass-util-btn.flagged {
  border-color: rgba(251, 191, 36, 0.5);
  color: #fde68a;
  cursor: default;
}

.glass-pill-btn:hover {
  background: rgba(255, 255, 255, 0.24);
}

.glass-pill-btn.active-heart {
  background: #f43f5e;
  border-color: #fb7185;
  box-shadow: 0 0 18px rgba(244, 63, 94, 0.5);
}

.glass-pill-btn.active-downvote {
  background: #e11d48;
  border-color: #fb7185;
  box-shadow: 0 0 16px rgba(225, 29, 72, 0.5);
}

.card-progress-track {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 4px;
  background: rgba(255, 255, 255, 0.15);
}

.card-progress-fill {
  height: 100%;
  background: rgba(251, 191, 36, 0.9);
  transition: width 0.3s ease;
}

.card-progress-fill.danger {
  background: #f43f5e;
  box-shadow: 0 0 10px #f43f5e;
}

/* Empty & Docs */
.empty-card,
.doc-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 36px 28px;
}

.empty-card {
  text-align: center;
}

.empty-title {
  margin: 0 0 6px 0;
  font-size: 15px;
  font-weight: 600;
}

.empty-sub {
  margin: 0 0 16px 0;
  font-size: 12px;
  color: var(--muted);
}

.empty-actions {
  display: flex;
  justify-content: center;
  gap: 8px;
}

.doc-card {
  max-width: 840px;
  margin: 0 auto;
}

.doc-header {
  border-bottom: 1px solid var(--border);
  padding-bottom: 20px;
  margin-bottom: 22px;
}

.doc-eyebrow {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--primary);
}

.doc-header h1 {
  margin: 8px 0;
  font-size: 24px;
  letter-spacing: -0.02em;
}

.doc-lead {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.6;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(1, minmax(0, 1fr));
  gap: 14px;
}

@media (min-width: 768px) {
  .feature-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.feature-box {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 18px;
}

.feature-box h2,
.doc-body h2 {
  margin: 0 0 6px 0;
  font-size: 14px;
  color: var(--fg);
}

.feature-box p,
.doc-body p {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.65;
}

.doc-body {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  color: var(--fg);
}

/* Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(0, 0, 0, 0.84);
  backdrop-filter: blur(18px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.lb-close {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 20;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lb-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 15;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  background: rgba(9, 10, 15, 0.78);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.28);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lb-nav-prev {
  left: 10px;
}

.lb-nav-next {
  right: 10px;
}

.lb-nav:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

@media (min-width: 640px) {
  .lb-nav {
    position: static;
    transform: none;
    width: 44px;
    height: 44px;
    margin: 0 16px;
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.18);
  }
}

.lb-frame {
  position: relative;
  width: min(560px, calc(100vw - 140px), calc(96dvh * 9 / 16));
  aspect-ratio: 9 / 16;
  max-height: 96dvh;
  border-radius: 24px;
  overflow: hidden;
  background: #000;
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.75);
}

.lb-media {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.lb-caption {
  margin: 0;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.95);
  line-height: 1.45;
}

.lb-threshold {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.lb-threshold-meta {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.75);
}

.progress-track {
  width: 100%;
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--warning);
  transition: width 0.3s ease;
}

.progress-fill.danger {
  background: var(--error);
}

/* Studio Modal */
.studio-modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px;
  width: 100%;
  max-width: 480px;
  max-height: 94vh;
  overflow-y: auto;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.65);
}

.studio-header,
.studio-footer {
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.studio-header {
  border-bottom: 1px solid var(--border);
}

.studio-header h2 {
  margin: 0;
  font-size: 15px;
}

.studio-sub {
  margin: 2px 0 0 0;
  font-size: 12px;
  color: var(--muted);
}

.icon-close {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.studio-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.viewfinder-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.detection-status-bar {
  display: flex;
  justify-content: center;
  width: 100%;
}

.viewfinder-frame {
  position: relative;
  width: 100%;
  max-width: 340px;
  aspect-ratio: 9 / 16;
  border-radius: 24px;
  overflow: hidden;
  border: 1px solid var(--border-strong);
  background: #000;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.55);
}

.editor-canvas,
.camera-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.editor-canvas.draggable {
  cursor: grab;
  touch-action: none;
}

.editor-canvas.draggable:active {
  cursor: grabbing;
}

.reticle {
  position: absolute;
  width: 16px;
  height: 16px;
  pointer-events: none;
  border-color: rgba(255, 255, 255, 0.65);
  border-style: solid;
}

.reticle.tl { top: 12px; left: 12px; border-width: 2px 0 0 2px; border-top-left-radius: 6px; }
.reticle.tr { top: 12px; right: 12px; border-width: 2px 2px 0 0; border-top-right-radius: 6px; }
.reticle.bl { bottom: 12px; left: 12px; border-width: 0 0 2px 2px; border-bottom-left-radius: 6px; }
.reticle.br { bottom: 12px; right: 12px; border-width: 0 2px 2px 0; border-bottom-right-radius: 6px; }

.scan-beam {
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(to right, transparent, #34d399, transparent);
  box-shadow: 0 0 12px #34d399;
  animation: scanBeam 0.85s ease-in-out;
}

@keyframes scanBeam {
  0% { top: 0%; opacity: 0; }
  20% { opacity: 0.95; }
  80% { opacity: 0.95; }
  100% { top: 100%; opacity: 0; }
}

.detection-badge {
  padding: 5px 14px;
  border-radius: 999px;
  background: var(--bg);
  border: 1px solid var(--border-strong);
  color: var(--fg);
  font-size: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.viewfinder-controls {
  width: 100%;
  max-width: 340px;
  display: flex;
  gap: 8px;
}

.vf-pill {
  flex: 1;
  min-height: 40px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid var(--border-strong);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.vf-pill:hover {
  background: rgba(255, 255, 255, 0.2);
}

.vf-pill.dark {
  background: var(--bg);
}

.vf-pill.capture {
  background: var(--primary);
  border-color: #fb7185;
}

/* Live Full-Screen Camera Mode */
.camera-live-topbar {
  position: absolute;
  top: max(12px, env(safe-area-inset-top));
  left: 12px;
  right: 12px;
  z-index: 12;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.camera-back-btn {
  min-height: 40px;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(9, 10, 15, 0.72);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.28);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.camera-live-badge {
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(9, 10, 15, 0.72);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.camera-live-bottombar {
  position: absolute;
  bottom: max(16px, env(safe-area-inset-bottom));
  left: 16px;
  right: 16px;
  z-index: 12;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
}

.camera-gallery-btn {
  justify-self: start;
  min-height: 44px;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(9, 10, 15, 0.74);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.28);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.camera-shutter-btn {
  justify-self: center;
  width: 68px;
  height: 68px;
  padding: 5px;
  border-radius: 999px;
  border: 3px solid #fff;
  background: rgba(255, 255, 255, 0.16);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.55);
}

.camera-shutter-btn:active .shutter-inner {
  transform: scale(0.88);
}

.shutter-inner {
  width: 100%;
  height: 100%;
  border-radius: 999px;
  background: #fff;
  display: block;
  transition: transform 0.12s ease;
}

.camera-bar-spacer {
  justify-self: end;
}

.studio-modal.camera-live-mode {
  background: #000;
  border-color: rgba(255, 255, 255, 0.14);
  height: min(92dvh, 840px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.studio-modal.camera-live-mode .studio-header,
.studio-modal.camera-live-mode .studio-footer,
.studio-modal.camera-live-mode .detection-status-bar,
.studio-modal.camera-live-mode .viewfinder-controls,
.studio-modal.camera-live-mode #outline-toggle-label,
.studio-modal.camera-live-mode #crop-controls,
.studio-modal.camera-live-mode #verification-banner,
.studio-modal.camera-live-mode .caption-field {
  display: none !important;
}

.studio-modal.camera-live-mode .studio-body {
  padding: 0;
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.studio-modal.camera-live-mode .viewfinder-wrap {
  width: 100%;
  height: 100%;
  justify-content: center;
  gap: 0;
}

.studio-modal.camera-live-mode .viewfinder-frame {
  width: 100%;
  max-width: min(100%, calc(min(92dvh, 840px) * 9 / 16));
  max-height: 100%;
  border-radius: 0;
  border: none;
}

/* Crop & Framing Panel */
.crop-controls-panel {
  border-radius: 16px;
  padding: 12px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
}

.crop-controls-top {
  display: flex;
  align-items: center;
  gap: 12px;
}

.crop-minimap-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.crop-minimap-canvas {
  width: 108px;
  height: 81px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: #000;
  display: block;
}

.crop-minimap-label {
  font-size: 11px;
  color: var(--muted);
}

.crop-controls-actions {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.crop-mode-group {
  display: flex;
  gap: 6px;
}

.crop-mode-btn {
  flex: 1;
  min-height: 32px;
  padding: 5px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

.crop-mode-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--primary-fg);
}

.crop-sliders {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.crop-slider-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--muted);
}

.crop-slider-row span {
  width: 62px;
  flex-shrink: 0;
}

.crop-slider-row input[type="range"] {
  flex: 1;
  min-width: 0;
  accent-color: var(--primary);
}

.crop-reset-btn {
  align-self: flex-start;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

.crop-reset-btn:hover {
  color: var(--fg);
  border-color: var(--border-strong);
}

/* Blur Review Controls */
.blur-review-wrap {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.blur-review-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
}

.blur-review-meta {
  font-size: 12px;
  font-weight: 600;
  color: var(--fg);
}

.blur-review-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.blur-review-btn {
  min-height: 32px;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--fg);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

.blur-review-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.blur-review-btn.keep.active {
  background: #065f46;
  border-color: #34d399;
  color: #ecfdf5;
}

.toggle-outline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
}

.toggle-outline input {
  accent-color: var(--primary);
}

.preset-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
}

.preset-chip {
  padding: 5px 11px;
  border-radius: 999px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--fg);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
}

.preset-chip:hover {
  border-color: var(--primary);
}

.preset-chip.warn {
  border-color: var(--warning);
  color: var(--warning);
}

.verify-banner {
  border-radius: 16px;
  padding: 12px 14px;
  background: var(--bg);
  border: 1px solid var(--success);
  font-size: 12px;
  line-height: 1.5;
}

.verify-banner.warn {
  border-color: var(--warning);
}

.verify-msg {
  margin: 0;
  font-weight: 500;
}

.verify-banner.warn .verify-msg {
  color: var(--warning);
}

.override-wrap {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.caption-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.caption-label-row {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
}

.caption-input {
  width: 100%;
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--fg);
  font-size: 12px;
  outline: none;
}

.caption-input:focus {
  border-color: var(--primary);
}

.caption-input.input-error {
  border-color: var(--error);
}

.consent-handle-error {
  margin: 2px 0 0 0;
  font-size: 12px;
  font-weight: 500;
  color: var(--error);
}

.handle-input-row {
  display: flex;
  align-items: stretch;
  gap: 8px;
}

.handle-input-row .caption-input {
  flex: 1;
  min-width: 0;
}

.handle-regen-btn {
  flex-shrink: 0;
  white-space: nowrap;
  padding: 0 14px;
}

.studio-footer {
  border-top: 1px solid var(--border);
}

.footer-note {
  font-size: 12px;
  color: var(--muted);
}

.footer-btns {
  display: flex;
  gap: 8px;
}

/* Floating Demo Dock & Toasts */
.demo-dock {
  position: fixed;
  bottom: 16px;
  left: 16px;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(18, 20, 29, 0.92);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.5);
  font-size: 12px;
}

.demo-label {
  color: var(--muted);
  font-weight: 500;
  padding-left: 4px;
}

.demo-btn {
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--fg);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
}

.demo-btn.muted {
  color: var(--muted);
}

.demo-btn:hover {
  background: var(--surface-elevated);
  color: var(--fg);
}

.toast-container {
  position: fixed;
  bottom: 16px;
  right: 16px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 360px;
  pointer-events: none;
}

.toast-item {
  pointer-events: auto;
  background: rgba(18, 20, 29, 0.96);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  color: var(--fg);
  padding: 12px 16px;
  border-radius: 16px;
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.5);
  font-size: 12px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.toast-item.error { border-color: var(--error); }
.toast-item.success { border-color: var(--success); }
.toast-item.warning { border-color: var(--warning); }

.fade-in {
  animation: fadeIn 0.24s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.purge-out {
  animation: purgeOut 0.48s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes purgeOut {
  0% { opacity: 1; transform: scale(1); }
  45% { opacity: 0.65; transform: scale(0.96); filter: blur(3px); }
  100% { opacity: 0; transform: scale(0.88); filter: blur(12px); }
}

/* Report & Consent Modals */
.compact-modal {
  max-width: 440px;
}

.consent-backdrop {
  z-index: 80;
  background: rgba(5, 6, 10, 0.92);
}

.consent-modal {
  border-color: var(--border-strong);
}

.consent-list {
  margin: 0;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--muted);
}

.consent-list strong {
  color: var(--fg);
}

.consent-legal-preview {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 10px 12px;
  font-size: 12px;
  color: var(--muted);
}

.consent-legal-preview summary {
  cursor: pointer;
  color: var(--fg);
  font-weight: 600;
}

.consent-legal-preview p {
  margin: 8px 0 0 0;
  line-height: 1.55;
}

.inline-link-btn {
  background: none;
  border: none;
  padding: 0;
  color: #fda4af;
  font: inherit;
  font-weight: 600;
  text-decoration: underline;
  cursor: pointer;
}

.inline-link-btn:hover {
  color: var(--fg);
}

.consent-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding-top: 4px;
}

.report-target-preview {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border-radius: 14px;
  background: var(--bg);
  border: 1px solid var(--border);
}

.report-target-thumb {
  width: 48px;
  height: 85px;
  border-radius: 10px;
  object-fit: cover;
  background: #000;
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.report-target-meta {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.report-target-caption {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.report-reasons {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.reason-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  font-size: 12px;
  color: var(--fg);
  cursor: pointer;
}

.reason-option:has(input:checked) {
  border-color: var(--primary);
  background: rgba(244, 63, 94, 0.08);
}

.reason-option input {
  accent-color: var(--primary);
}

.report-textarea {
  resize: vertical;
  min-height: 74px;
  font-family: inherit;
}

.report-route-note {
  margin: 0;
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.45;
}

.inline-footer {
  padding: 12px 0 0 0;
  border-top: 1px solid var(--border);
  justify-content: flex-end;
}

/* Mobile Layout Optimizations */
@media (max-width: 640px) {
  .container {
    padding: 0 16px;
  }

  .header-inner {
    gap: 8px;
    padding-top: 10px;
    padding-bottom: 10px;
  }

  .nav-pills {
    order: 3;
    width: 100%;
    justify-content: space-between;
  }

  .nav-btn {
    flex: 1;
    padding: 7px 8px;
    text-align: center;
  }

  .header-actions {
    gap: 6px;
    width: 100%;
    justify-content: space-between;
  }

  .live-users-chip {
    padding: 5px 9px;
    font-size: 11px;
  }

  .session-handle {
    max-width: 126px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .story-card {
    border-radius: 20px;
  }

  .toast-container {
    top: 72px;
    bottom: auto;
    left: 12px;
    right: 12px;
    max-width: none;
  }

  .demo-dock {
    left: 50%;
    transform: translateX(-50%);
    bottom: max(12px, env(safe-area-inset-bottom));
    white-space: nowrap;
  }

  #lightbox-modal {
    padding: 48px 6px 8px 6px;
  }

  .lb-close {
    top: 6px;
    right: 10px;
  }

  .lb-frame {
    width: min(100%, calc((100dvh - 56px) * 9 / 16));
    max-width: 100%;
    max-height: calc(100dvh - 56px);
  }

  #upload-modal.camera-live-backdrop {
    padding: 0;
  }

  .studio-modal.camera-live-mode {
    max-width: 100%;
    width: 100%;
    height: 100dvh;
    max-height: 100dvh;
    border-radius: 0;
    border: none;
  }

  .studio-modal.camera-live-mode .viewfinder-frame {
    max-width: min(100%, calc(100dvh * 9 / 16));
  }

  .crop-controls-top {
    flex-direction: column;
    align-items: stretch;
  }
}
