/* tiktok-swipe v2 — design tokens copied from ai-content-pipeline */
:root {
  --bg: #0e0613;
  --bg-2: #16091e;
  --panel: #1a0e23;
  --panel-2: #221031;
  --line: #2a1638;
  --text: #f3e7ff;
  --muted: #a387b6;
  --accent: #ff3ea5;
  --accent-2: #c7259f;
  --good: #4ade80;
  --warn: #fbbf24;
  --bad: #f87171;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; padding: 0; }
body {
  background: radial-gradient(ellipse at 15% -10%, #2a0d3a 0%, var(--bg) 55%);
  color: var(--text);
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  font-size: 14px;
  min-height: 100vh;
}

.hidden { display: none !important; }

/* === Topbar ============================================================ */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(14, 6, 19, 0.7);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 10;
  gap: 14px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  letter-spacing: 0.2px;
}
.brand .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent);
}
.badge {
  font-size: 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--muted);
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: 1px;
}
.stats { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.pill {
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--panel);
  border: 1px solid var(--line);
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.pill.up   { color: var(--good); border-color: rgba(74, 222, 128, 0.3); }
.pill.down { color: var(--bad);  border-color: rgba(248, 113, 113, 0.3); }
.pill.skip { color: var(--muted); }
.pill.buffer { color: var(--text); }

/* === Layout ============================================================ */
main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 22px;
  padding: 22px;
  max-width: 1180px;
  margin: 0 auto;
  align-items: start;
}
@media (max-width: 900px) {
  main { grid-template-columns: 1fr; padding: 14px; }
  .panel-side { display: none; }
}
.stage {
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

/* === Name gate ========================================================= */
.name-gate {
  position: fixed;
  inset: 0;
  background: rgba(14, 6, 19, 0.92);
  backdrop-filter: blur(6px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  z-index: 200;
}
.name-gate label { color: var(--muted); font-size: 13px; }
.name-gate input {
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--text);
  font: inherit;
  font-size: 16px;
  padding: 10px 14px;
  border-radius: 10px;
  min-width: 260px;
  text-align: center;
  color-scheme: dark;
}
.name-gate input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(255, 62, 165, 0.18);
}

/* === Card / video frame =============================================== */
.card {
  width: 100%;
  max-width: 440px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: relative;
}
.frame {
  position: relative;
  aspect-ratio: 9 / 16;
  width: 100%;
  background: #000;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  box-shadow:
    0 24px 60px -20px rgba(255, 62, 165, 0.35),
    0 0 0 1px rgba(255, 62, 165, 0.1) inset;
}
.frame video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
  display: block;
}

.tap-flash {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s ease;
}
.tap-flash span {
  font-size: 56px;
  color: white;
  background: rgba(0,0,0,0.5);
  border-radius: 50%;
  width: 92px;
  height: 92px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.tap-flash.show { opacity: 1; }

/* Audio pill */
.audio-pill {
  position: absolute;
  bottom: 10px;
  left: 10px;
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(14, 6, 19, 0.7);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 8px;
  backdrop-filter: blur(10px);
}
.pill-btn {
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}
.pill-btn:hover { background: var(--panel); }
.vol {
  width: 84px;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  margin-left: 4px;
}
.vol::-webkit-slider-runnable-track {
  height: 3px;
  background: var(--line);
  border-radius: 2px;
}
.vol::-webkit-slider-thumb {
  -webkit-appearance: none;
  height: 12px;
  width: 12px;
  border-radius: 50%;
  background: var(--accent);
  margin-top: -4.5px;
  box-shadow: 0 0 8px var(--accent);
}
.vol::-moz-range-thumb {
  height: 12px;
  width: 12px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
}

.meta-overlay {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 56px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  text-shadow: 0 1px 4px rgba(0,0,0,0.8);
}
.author {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  text-decoration: none;
  pointer-events: auto;
}
.author img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  object-fit: cover;
  background: var(--panel);
}
.author strong {
  font-size: 14px;
  display: block;
  line-height: 1.15;
}
.author small { color: var(--muted); font-size: 11px; }
.vid-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: rgba(255, 255, 255, 0.95);
}
.vid-stats b { color: var(--accent); font-weight: 700; }
.desc {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.92);
  max-height: 48px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

/* Empty state */
.empty {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  gap: 6px;
  background: rgba(14, 6, 19, 0.7);
  backdrop-filter: blur(6px);
}
.empty.hidden { display: none; }
.empty-title { font-size: 18px; color: var(--accent); font-weight: 600; }

/* === Modifier row ====================================================== */
.modifiers {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 0 2px;
}
.frame-pick {
  display: flex;
  align-items: center;
  gap: 6px;
}
.frame-pick .muted { color: var(--muted); font-size: 12px; }
.frame-pick input {
  width: 56px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  padding: 5px 6px;
  font: inherit;
  font-size: 13px;
  text-align: center;
  -moz-appearance: textfield;
  color-scheme: dark;
}
.frame-pick input::-webkit-outer-spin-button,
.frame-pick input::-webkit-inner-spin-button {
  -webkit-appearance: none; margin: 0;
}
.toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
  font-size: 13px;
}
.toggle input { accent-color: var(--accent); }

/* === Buttons (matched to pipeline .btn) ================================ */
.btn {
  border: 1px solid var(--line);
  background: var(--bg-2);
  color: var(--text);
  padding: 10px 16px;
  border-radius: 10px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.05s;
}
.btn:hover { background: var(--panel-2); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.btn.ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--muted);
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 500;
  border-radius: 8px;
}
.btn.ghost:hover { color: var(--text); border-color: var(--accent); }
.btn.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border: none;
  color: #170018;
  box-shadow: 0 6px 24px -8px var(--accent);
}
.btn.primary:hover { filter: brightness(1.05); }
.btn.danger {
  border-color: rgba(248, 113, 113, 0.5);
  color: var(--bad);
}
.btn.danger:hover { background: rgba(248, 113, 113, 0.12); }

/* === Vote row ========================================================== */
.votes {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
}
.votes .btn {
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 13px;
  padding: 14px 0;
}

.hint {
  color: var(--muted);
  text-align: center;
  font-size: 11px;
  margin-top: 2px;
  letter-spacing: 0.02em;
}

/* === Side panel ======================================================== */
.panel-side {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  position: sticky;
  top: 78px;
}
.panel-side h3 {
  margin: 0 0 8px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  font-weight: 700;
}
.panel-side h3:not(:first-child) { margin-top: 18px; }
.rank {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.rank li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  padding: 5px 8px;
  border-radius: 6px;
  border: 1px solid transparent;
}
.rank li:hover {
  background: var(--panel-2);
  border-color: var(--line);
}
.rank .name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
  color: var(--text);
}
.rank .w {
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  font-size: 11px;
  font-weight: 600;
}
.rank .empty-rank {
  color: var(--muted);
  font-size: 11px;
  text-align: center;
  padding: 8px;
  font-style: italic;
}
