:root {
  --bg-1: #06111f;
  --bg-2: #0b1628;
  --bg-3: #111827;
  --panel: rgba(9, 15, 27, 0.74);
  --panel-strong: rgba(11, 18, 34, 0.9);
  --border: rgba(148, 163, 184, 0.16);
  --text: #f8fafc;
  --muted: #cbd5e1;
  --accent: #f59e0b;
  --accent-2: #7dd3fc;
  --danger: #f87171;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  color: var(--text);
  background: radial-gradient(circle at top left, rgba(245, 158, 11, 0.18), transparent 22%),
    radial-gradient(circle at top right, rgba(125, 211, 252, 0.18), transparent 26%),
    linear-gradient(180deg, var(--bg-1), var(--bg-2) 45%, var(--bg-3));
  min-height: 100vh;
}

.aurora {
  position: fixed;
  inset: auto;
  width: 32vw;
  height: 32vw;
  border-radius: 999px;
  filter: blur(70px);
  opacity: 0.45;
  pointer-events: none;
}

.aurora-a {
  top: 6vh;
  left: -8vw;
  background: rgba(125, 211, 252, 0.18);
}

.aurora-b {
  bottom: 12vh;
  right: -10vw;
  background: rgba(245, 158, 11, 0.16);
}

.shell-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.4rem;
  backdrop-filter: blur(18px);
  background: rgba(6, 17, 31, 0.58);
  border-bottom: 1px solid var(--border);
}

.shell-header-compact {
  padding: 0.7rem 0.95rem;
}

.eyebrow {
  margin: 0 0 0.35rem;
  color: var(--accent-2);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
}

.shell-header h1 {
  margin: 0;
  font-size: clamp(1.5rem, 2.8vw, 2.4rem);
}

.header-copy {
  margin: 0.35rem 0 0;
  color: var(--muted);
}

.header-chips,
.meta-topline,
.pill-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.chip,
.style-pill,
.score-pill,
.duration-pill {
  border-radius: 999px;
  padding: 0.42rem 0.8rem;
  border: 1px solid rgba(125, 211, 252, 0.18);
  background: rgba(15, 23, 42, 0.55);
  color: #dbeafe;
}

.feed {
  height: 100svh;
  overflow-y: auto;
  scroll-snap-type: y mandatory;
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
}

.clip-card {
  min-height: 100svh;
  height: 100svh;
  display: grid;
  place-items: center;
  padding: 0;
  scroll-snap-align: start;
  scroll-snap-stop: always;
}

.clip-frame,
.panel,
.stat-card,
.dashboard-login-shell {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 28px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.32);
  backdrop-filter: blur(18px);
}

.clip-frame {
  overflow: hidden;
  padding: 0;
  width: min(100vw, 540px);
  height: 100svh;
  border-radius: 0;
  border-inline: 1px solid var(--border);
}

.clip-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 0;
  background: black;
  position: relative;
  z-index: 1;
}

.clip-gradient {
  position: absolute;
  inset: auto 0 0 0;
  height: 38%;
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.62));
  z-index: 2;
  pointer-events: none;
}

.mini-controls {
  position: absolute;
  top: max(68px, env(safe-area-inset-top, 0px) + 8px);
  right: 12px;
  z-index: 4;
}

.mini-button {
  padding: 0.36rem 0.62rem;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.68);
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.clip-meta {
  position: absolute;
  left: 16px;
  right: 84px;
  bottom: 18px;
  z-index: 3;
}

.clip-summary {
  margin: 0.5rem 0 0;
  max-width: 22rem;
  color: #e2e8f0;
  line-height: 1.35;
  font-size: 0.92rem;
}

.clip-controls {
  position: absolute;
  right: 10px;
  bottom: max(18px, env(safe-area-inset-bottom, 0px) + 8px);
  z-index: 4;
  display: grid;
  justify-items: end;
  gap: 0.42rem;
}

.rating-strip {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.35rem;
}

button,
.secondary-button {
  border: 0;
  border-radius: 14px;
  padding: 0.48rem 0.68rem;
  cursor: pointer;
  color: #0f172a;
  font-weight: 700;
  background: linear-gradient(135deg, #fef3c7, #fdba74);
  font-size: 0.78rem;
}

.secondary-button {
  color: var(--text);
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid var(--border);
}

.rate-button {
  min-width: 4.2rem;
}

.rate-like {
  background: linear-gradient(135deg, #fef3c7, #fdba74);
}

.rate-pass {
  background: rgba(15, 23, 42, 0.82);
  color: var(--text);
  border: 1px solid var(--border);
}

button:hover,
.secondary-button:hover {
  transform: translateY(-1px);
}

.tag-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.28rem;
}

.tag-row-hidden {
  display: none;
}

.tag-button {
  padding: 0.36rem 0.58rem;
  border-radius: 999px;
  background: rgba(125, 211, 252, 0.14);
  color: #dbeafe;
  border: 1px solid rgba(125, 211, 252, 0.18);
  font-weight: 600;
  font-size: 0.68rem;
}

.tag-button.active {
  background: rgba(245, 158, 11, 0.2);
  border-color: rgba(245, 158, 11, 0.32);
}

.status-line,
.error-text {
  min-height: 1.2rem;
  color: #bfdbfe;
  max-width: 6rem;
  text-align: right;
  font-size: 0.7rem;
}

.error-text {
  color: var(--danger);
}

.dashboard-page .shell-header {
  position: static;
}

.download-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 3.8rem;
  border-radius: 999px;
  padding: 0.4rem 0.64rem;
  color: var(--text);
  text-decoration: none;
  border: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.72);
  font-size: 0.72rem;
}

.dashboard-grid {
  display: grid;
  gap: 1rem;
  padding: 1.2rem;
  grid-template-columns: repeat(12, minmax(0, 1fr));
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
  grid-column: 1 / -1;
}

.stat-card {
  padding: 1rem 1.1rem;
}

.stat-label {
  display: block;
  color: var(--muted);
  margin-bottom: 0.45rem;
}

.stat-value {
  font-size: 1.8rem;
}

.panel {
  padding: 1rem 1.1rem;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.8rem;
}

.settings-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem;
}

.settings-form label {
  display: grid;
  gap: 0.4rem;
  color: var(--muted);
}

input {
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.75);
  color: var(--text);
  padding: 0.8rem 0.9rem;
}

.panel-actions {
  margin-top: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.table-shell,
.event-list {
  display: grid;
  gap: 0.65rem;
}

.table-row,
.event-row {
  display: grid;
  gap: 0.35rem;
  padding: 0.8rem 0.9rem;
  border-radius: 18px;
  background: rgba(15, 23, 42, 0.58);
  border: 1px solid rgba(148, 163, 184, 0.1);
}

.event-row small,
.table-row small {
  color: var(--muted);
}

.code-panel {
  grid-column: span 12;
}

.code-panel pre {
  white-space: pre-wrap;
  color: #cbd5e1;
  max-height: 520px;
  overflow: auto;
}

.dashboard-login-shell {
  width: min(440px, calc(100vw - 2rem));
  margin: 12vh auto;
  padding: 2rem;
}

.dashboard-login-form {
  display: grid;
  gap: 0.75rem;
  margin-top: 1.2rem;
}

#rating-distribution .chip {
  background: rgba(245, 158, 11, 0.12);
}

@media (max-width: 980px) {
  .clip-card {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .settings-form {
    grid-template-columns: 1fr;
  }

  .shell-header h1 {
    font-size: 1.2rem;
  }

  .header-copy {
    display: none;
  }

  .chip,
  .style-pill,
  .score-pill,
  .duration-pill {
    padding: 0.3rem 0.55rem;
    font-size: 0.72rem;
  }
}

@media (max-width: 720px) {
  .shell-header {
    padding: 0.75rem 0.85rem;
  }

  .clip-meta {
    right: 78px;
  }

  .clip-summary {
    font-size: 0.86rem;
    max-width: 16rem;
  }

  .rating-strip {
    grid-template-columns: 1fr;
  }
}
