:root {
  --red: #e50914;
  --red-glow: rgba(229, 9, 20, 0.45);
  --cyan: #22d3ee;
  --violet: #a78bfa;
  --bg: #050508;
  --surface: rgba(12, 12, 18, 0.72);
  --border: rgba(255, 255, 255, 0.08);
  --text: #f4f4f5;
  --muted: #a1a1aa;
  --font: "Outfit", system-ui, sans-serif;
  --mono: "IBM Plex Mono", monospace;
  --display: "Bebas Neue", Impact, sans-serif;
  --radius: 14px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.5;
}

.hero-backdrop {
  position: fixed;
  inset: 0;
  z-index: 0;
  background-size: cover;
  background-position: center 20%;
  filter: blur(48px) saturate(1.2) brightness(0.28);
  transform: scale(1.08);
  opacity: 0;
  transition: opacity 1.2s ease;
  pointer-events: none;
}

.hero-backdrop.loaded {
  opacity: 1;
}

.mono { font-family: var(--mono); font-size: 0.8em; letter-spacing: 0.04em; }

#grid-canvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.55;
}

#cursor-glow {
  position: fixed;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(229, 9, 20, 0.12), transparent 65%);
  pointer-events: none;
  z-index: 1;
  transform: translate(-50%, -50%);
  transition: opacity 0.3s;
  opacity: 0;
}

@media (hover: hover) and (pointer: fine) {
  body:hover #cursor-glow { opacity: 1; }
}

@media (hover: none) {
  #cursor-glow { display: none; }
}

.noise {
  position: fixed;
  inset: 0;
  opacity: 0.035;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  z-index: 2;
}

.vignette {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse 80% 60% at 50% 0%, transparent 0%, var(--bg) 75%);
  z-index: 2;
}

.gradient-text {
  background: linear-gradient(120deg, var(--red), #ff6b6b, var(--cyan));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  background-size: 200% auto;
  animation: shimmer 6s linear infinite;
}

@keyframes shimmer {
  to { background-position: 200% center; }
}

/* Nav */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem clamp(1rem, 4vw, 3rem);
  background: rgba(5, 5, 8, 0.6);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  color: inherit;
}

.brand-mark {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  background: var(--red);
  box-shadow: 0 0 20px var(--red-glow);
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  50% { transform: scale(1.15); opacity: 0.85; }
}

.brand-text {
  font-family: var(--display);
  font-size: 1.5rem;
  letter-spacing: 0.12em;
  color: var(--red);
}

.nav-actions { display: flex; gap: 0.5rem; align-items: center; }

/* Buttons */
.btn-primary,
.btn-primary-sm {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.85rem 1.35rem;
  background: linear-gradient(135deg, var(--red), #b91c1c);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.2s var(--ease), box-shadow 0.2s;
  box-shadow: 0 4px 24px var(--red-glow);
  width: 100%;
}

.btn-primary-sm {
  width: auto;
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
}

.btn-primary:hover,
.btn-primary-sm:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 32px var(--red-glow);
}

.btn-primary:disabled { opacity: 0.55; cursor: wait; transform: none; }

.btn-ghost {
  display: inline-flex;
  align-items: center;
  padding: 0.5rem 1rem;
  color: var(--text);
  text-decoration: none;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 0.85rem;
  background: rgba(255, 255, 255, 0.02);
  transition: border-color 0.2s, background 0.2s;
}

.btn-ghost:hover {
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.06);
}

/* Hero */
.hero {
  position: relative;
  z-index: 3;
  display: grid;
  grid-template-columns: 1fr;
  gap: 2.5rem;
  max-width: 1200px;
  margin: 0 auto;
  padding: 3rem clamp(1rem, 4vw, 3rem) 4rem;
  align-items: start;
}

@media (min-width: 900px) {
  .hero {
    grid-template-columns: 1.1fr 0.9fr;
    gap: 3rem;
    padding-top: 4rem;
  }
}

.eyebrow {
  color: var(--cyan);
  text-transform: uppercase;
  font-size: 0.7rem;
  margin-bottom: 1rem;
}

.hero-title {
  font-size: clamp(2.5rem, 6vw, 4rem);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.03em;
  margin-bottom: 1.25rem;
}

.hero-title .line { display: block; }

.hero-desc {
  color: var(--muted);
  max-width: 32rem;
  margin-bottom: 1.75rem;
  font-size: 1.05rem;
}

.hero-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 2.5rem;
}

.hero-cta .btn-primary { width: auto; }

.stats-bar {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

@media (min-width: 600px) {
  .stats-bar { grid-template-columns: repeat(3, 1fr); }
}

.stat {
  padding: 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
  backdrop-filter: blur(8px);
}

.stat-value {
  display: block;
  font-size: 1.75rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.stat-label {
  font-size: 0.72rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* Glass card */
.glass-card {
  position: relative;
  padding: 2rem;
  border-radius: calc(var(--radius) + 4px);
  background: var(--surface);
  border: 1px solid var(--border);
  backdrop-filter: blur(24px);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.04) inset,
    0 24px 80px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}

.card-glow {
  position: absolute;
  top: -50%;
  right: -30%;
  width: 280px;
  height: 280px;
  background: radial-gradient(circle, var(--red-glow), transparent 70%);
  pointer-events: none;
}

.card-header { margin-bottom: 1.5rem; }

.card-title {
  font-size: 1.5rem;
  font-weight: 600;
}

.card-sub {
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 1.25rem;
}

.card-hint {
  margin-top: 1rem;
  font-size: 0.8rem;
  color: var(--muted);
  text-align: center;
}

.invite-banner {
  margin-bottom: 1rem;
  padding: 0.65rem 0.85rem;
  border-radius: 8px;
  font-size: 0.85rem;
  background: rgba(34, 211, 238, 0.12);
  border: 1px solid rgba(34, 211, 238, 0.35);
  color: #a5f3fc;
}

.invite-banner--bad {
  background: rgba(229, 9, 20, 0.12);
  border-color: rgba(229, 9, 20, 0.4);
  color: #fca5a5;
}

.glass-card.shake {
  animation: shake 0.45s ease;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

.signin-panel,
.existing-panel { margin-bottom: 0; }

.signup-details {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.signup-details summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 0.8rem;
  list-style: none;
  transition: color 0.2s;
}

.signup-details summary:hover { color: var(--text); }

.signup-details summary::-webkit-details-marker { display: none; }

.signup-details[open] summary {
  color: var(--cyan);
  margin-bottom: 1rem;
}

.field { display: block; margin-bottom: 1rem; }

.field span {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
  margin-bottom: 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.field input {
  width: 100%;
  padding: 0.8rem 1rem;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-family: inherit;
  font-size: 1rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.field input:focus {
  outline: none;
  border-color: rgba(229, 9, 20, 0.5);
  box-shadow: 0 0 0 3px rgba(229, 9, 20, 0.15);
}

.error {
  color: #fca5a5;
  font-size: 0.85rem;
  margin-bottom: 0.75rem;
}

/* Catalog */
.catalog {
  position: relative;
  z-index: 3;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 clamp(1rem, 4vw, 3rem) 4rem;
}

.section-title {
  font-size: clamp(1.5rem, 4vw, 2rem);
  font-weight: 600;
  letter-spacing: -0.02em;
}

/* Catalog layout */
.catalog {
  margin-bottom: 2.5rem;
}

.catalog-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.row-fake {
  font-size: clamp(1.1rem, 3vw, 1.35rem);
  font-style: italic;
  color: var(--text);
}

.catalog-meta { color: var(--muted); font-size: 0.72rem; }

.posters {
  display: flex;
  gap: 0.75rem;
  overflow-x: auto;
  padding-bottom: 1rem;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}

.posters::-webkit-scrollbar { height: 4px; }
.posters::-webkit-scrollbar-thumb {
  background: linear-gradient(90deg, var(--red), var(--cyan));
  border-radius: 4px;
}

.poster {
  flex: 0 0 clamp(120px, 18vw, 170px);
  aspect-ratio: 2/3;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  position: relative;
  overflow: hidden;
  scroll-snap-align: start;
  text-decoration: none;
  color: inherit;
  border: 1px solid var(--border);
  transition: transform 0.35s var(--ease), box-shadow 0.35s;
}

.poster::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 40%, rgba(255, 255, 255, 0.08) 50%, transparent 60%);
  transform: translateX(-100%);
  transition: transform 0.6s;
}

.poster:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5), 0 0 30px var(--red-glow);
  z-index: 2;
}

.poster:hover::after { transform: translateX(100%); }

.poster img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.poster-skeleton {
  flex: 0 0 clamp(120px, 18vw, 170px);
  aspect-ratio: 2/3;
  border-radius: 10px;
  background: linear-gradient(90deg, #1a1a22 25%, #252530 50%, #1a1a22 75%);
  background-size: 200% 100%;
  animation: skeleton 1.2s ease-in-out infinite;
}

@keyframes skeleton {
  to { background-position: -200% 0; }
}

.poster-meta {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  display: flex;
  gap: 0.35rem;
  font-size: 0.62rem;
  font-family: var(--mono);
}

.poster-type,
.poster-year {
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(4px);
}

.poster-title {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 2.5rem 0.5rem 0.5rem;
  font-size: 0.72rem;
  font-weight: 500;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.95));
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.row-empty { color: var(--muted); font-size: 0.9rem; }

/* Reveal */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.8s var(--ease), transform 0.8s var(--ease);
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Modal */
.modal[hidden] { display: none !important; }

.modal:not([hidden]) {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
}

.modal-inner {
  text-align: center;
  max-width: 380px;
  width: 100%;
}

.modal-inner h2 {
  font-size: 1.75rem;
  margin-bottom: 0.5rem;
}

.modal-inner p {
  color: var(--muted);
  margin-bottom: 1.5rem;
}

/* Footer */
.footer {
  position: relative;
  z-index: 3;
  text-align: center;
  padding: 3rem 1rem 4rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.8rem;
}

.footer-tag {
  margin-top: 0.65rem;
  font-size: 0.72rem;
  opacity: 0.75;
}

@media (max-width: 640px) {
  .nav { padding: 0.75rem 1rem; }
  .hero { padding-top: 1.5rem; }
  .hero-cta .btn-primary,
  .hero-cta .btn-ghost {
    width: 100%;
    justify-content: center;
  }
  .btn-primary,
  .btn-primary-sm {
    min-height: 48px;
  }
  .field input {
    min-height: 48px;
    font-size: 16px;
  }
  .poster {
    flex: 0 0 130px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  .reveal { opacity: 1; transform: none; }
}
