:root {
  --bg: #0B0E14;
  --bg-alt: #10141d;
  --surface: rgba(255,255,255,0.04);
  --surface-border: rgba(255,255,255,0.09);
  --text: #F1F5F9;
  --text-muted: #94A3B8;
  --violet: #7C5CFF;
  --violet-soft: rgba(124,92,255,0.18);
  --cyan: #22D3EE;
  --cyan-soft: rgba(34,211,238,0.18);
  --amber: #FBBF24;
  --danger: #F87171;

  --font-display: 'Space Grotesk', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --radius-lg: 28px;
  --radius-md: 18px;
  --radius-sm: 10px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }
.mono { font-family: var(--font-mono); }
.muted { color: var(--text-muted); }

h1, h2, h3 { font-family: var(--font-display); margin: 0; letter-spacing: -0.01em; }

#bg-glow {
  position: fixed; inset: 0; z-index: -1;
  background:
    radial-gradient(600px circle at 15% 10%, var(--violet-soft), transparent 60%),
    radial-gradient(700px circle at 85% 30%, var(--cyan-soft), transparent 60%),
    var(--bg);
}

.glass {
  background: var(--surface);
  border: 1px solid var(--surface-border);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

/* ---------- Buttons ---------- */
.btn {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.9rem;
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.65rem 1.2rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.btn-primary { background: linear-gradient(135deg, var(--violet), #5B3FE0); color: white; box-shadow: 0 8px 24px -8px rgba(124,92,255,0.6); }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 12px 28px -8px rgba(124,92,255,0.75); }
.btn-ghost { background: var(--surface); color: var(--text); border: 1px solid var(--surface-border); }
.btn-ghost:hover { background: rgba(255,255,255,0.08); }
.btn-text { background: none; color: var(--cyan); padding: 0.65rem 0; }
.btn-lg { padding: 0.85rem 1.6rem; font-size: 1rem; border-radius: var(--radius-md); }

/* ---------- Nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.9rem 2rem;
  margin: 0;
}
.brand { display: flex; align-items: center; gap: 0.6rem; text-decoration: none; color: var(--text); }
.brand-mark {
  width: 34px; height: 34px; border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--violet), var(--cyan));
  display: flex; align-items: center; justify-content: center; color: white; font-size: 0.9rem;
}
.brand-name { font-family: var(--font-display); font-weight: 700; font-size: 1.05rem; }
.nav-links { display: flex; align-items: center; gap: 1.4rem; }
.nav-links a { color: var(--text-muted); text-decoration: none; font-size: 0.9rem; }
.nav-links a:hover { color: var(--text); }
.nav-icon-btn {
  background: none; border: none; color: var(--text-muted); cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 0.2rem; font-size: 0.7rem;
  font-family: var(--font-body);
}
.nav-icon-btn i { font-size: 1rem; }
.nav-icon-btn:hover, .nav-icon-btn.active { color: var(--cyan); }

/* ---------- Hero ---------- */
.hero {
  max-width: 1200px; margin: 0 auto;
  padding: 5rem 2rem 6rem;
  display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 3rem; align-items: center;
}
.eyebrow {
  display: inline-flex; align-items: center; gap: 0.5rem;
  color: var(--cyan); font-size: 0.85rem; font-weight: 600;
  margin: 0 0 1.2rem;
}
.hero h1 { font-size: 3.2rem; line-height: 1.08; font-weight: 700; }
.accent-text {
  background: linear-gradient(135deg, var(--violet), var(--cyan));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero-sub { color: var(--text-muted); font-size: 1.05rem; max-width: 46ch; margin: 1.4rem 0 2rem; }
.hero-actions { display: flex; align-items: center; gap: 1.5rem; }

.hero-demo { display: flex; flex-direction: column; align-items: center; gap: 1rem; }
.demo-panel {
  width: 100%; max-width: 380px; height: 220px;
  border-radius: var(--radius-lg);
  padding: 1.6rem;
  display: flex; align-items: center; justify-content: center;
  position: relative; overflow: hidden;
}
.demo-stage { width: 100%; }
.demo-label { display: block; font-size: 0.75rem; color: var(--text-muted); margin-bottom: 0.8rem; }
.demo-input {
  display: flex; align-items: center; gap: 0.6rem;
  background: rgba(255,255,255,0.06); border: 1px solid var(--surface-border);
  border-radius: 999px; padding: 0.8rem 1.2rem; color: var(--cyan); font-family: var(--font-mono); font-size: 0.85rem;
}
.demo-cursor { width: 2px; height: 1em; background: var(--cyan); animation: blink 1s step-end infinite; }
@keyframes blink { 50% { opacity: 0; } }
.demo-player { width: 100%; }
.demo-player-bars { display: flex; align-items: flex-end; gap: 4px; height: 60px; margin-bottom: 1rem; }
.demo-player-bars span {
  flex: 1; background: linear-gradient(180deg, var(--violet), var(--cyan));
  border-radius: 3px; animation: eq 1.2s ease-in-out infinite;
}
.demo-player-bars span:nth-child(1) { height: 40%; animation-delay: 0s; }
.demo-player-bars span:nth-child(2) { height: 80%; animation-delay: 0.15s; }
.demo-player-bars span:nth-child(3) { height: 55%; animation-delay: 0.3s; }
.demo-player-bars span:nth-child(4) { height: 90%; animation-delay: 0.45s; }
.demo-player-bars span:nth-child(5) { height: 35%; animation-delay: 0.6s; }
@keyframes eq { 0%, 100% { transform: scaleY(0.6); } 50% { transform: scaleY(1); } }
.demo-player-controls { display: flex; align-items: center; gap: 0.8rem; color: var(--text-muted); font-size: 0.8rem; }
.demo-scrub { flex: 1; height: 4px; background: rgba(255,255,255,0.1); border-radius: 2px; overflow: hidden; }
.demo-scrub-fill { width: 38%; height: 100%; background: var(--cyan); }
.demo-caption { color: var(--text-muted); font-size: 0.8rem; text-align: center; }

/* ---------- Sections ---------- */
.section-eyebrow {
  text-align: center; color: var(--text-muted); font-size: 0.8rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.12em; margin: 0 0 1.6rem;
}
.platforms, .features, .how { max-width: 1200px; margin: 0 auto; padding: 3rem 2rem; }
.platform-strip { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.8rem; }
.platform-chip {
  display: flex; align-items: center; gap: 0.5rem;
  background: var(--surface); border: 1px solid var(--surface-border);
  border-radius: 999px; padding: 0.6rem 1.1rem; font-size: 0.85rem; color: var(--text-muted);
}
.platform-chip i { color: var(--cyan); }

.feature-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.2rem; }
.feature-card {
  border-radius: var(--radius-md); padding: 1.6rem;
  transition: transform 0.2s ease, border-color 0.2s ease;
}
.feature-card:hover { transform: translateY(-4px); border-color: var(--violet); }
.feature-card i { font-size: 1.4rem; color: var(--violet); margin-bottom: 0.9rem; display: block; }
.feature-card h3 { font-size: 1.05rem; margin-bottom: 0.5rem; }
.feature-card p { color: var(--text-muted); font-size: 0.88rem; margin: 0; }

.how-steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.6rem; }
.how-step { text-align: center; padding: 1rem; }
.how-num { display: block; color: var(--violet); font-size: 1.6rem; margin-bottom: 0.6rem; }
.how-step h3 { margin-bottom: 0.5rem; }
.how-step p { color: var(--text-muted); font-size: 0.9rem; }

.footer { max-width: 1200px; margin: 2rem auto 0; padding: 2rem; border-top: 1px solid var(--surface-border); }
.footer-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.footer-social { display: flex; gap: 1rem; }
.footer-social a { color: var(--text-muted); font-size: 1.1rem; text-decoration: none; }
.footer-social a:hover { color: var(--cyan); }
.footer-copy { color: var(--text-muted); font-size: 0.8rem; margin: 0; }

/* ---------- App shell ---------- */
#app { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.sidebar { padding: 1.5rem 1rem; display: flex; flex-direction: column; gap: 0.3rem; border-right: 1px solid var(--surface-border); }
.sidebar-item {
  display: flex; align-items: center; gap: 0.7rem;
  background: none; border: none; color: var(--text-muted);
  padding: 0.7rem 0.9rem; border-radius: var(--radius-sm); cursor: pointer; text-align: left; font-size: 0.9rem;
  font-family: var(--font-body);
}
.sidebar-item:hover { background: var(--surface); color: var(--text); }
.sidebar-item.active { background: var(--violet-soft); color: var(--cyan); }
.app-main { padding: 2rem; max-width: 1100px; }

.link-intake {
  display: flex; align-items: center; gap: 0.8rem;
  padding: 0.5rem 0.6rem 0.5rem 1.2rem; border-radius: 999px; margin-bottom: 1rem;
}
.link-intake i { color: var(--cyan); }
.link-intake input {
  flex: 1; background: none; border: none; color: var(--text); font-size: 0.95rem; padding: 0.6rem 0;
  outline: none; font-family: var(--font-body);
}
.link-intake input::placeholder { color: var(--text-muted); }

.resolve-status { padding: 0.9rem 1.2rem; border-radius: var(--radius-sm); background: var(--surface); border: 1px solid var(--surface-border); margin-bottom: 1rem; font-size: 0.9rem; }
.resolve-status.error { border-color: var(--danger); color: var(--danger); }
.resolve-status.loading { border-color: var(--violet); color: var(--text-muted); }

.player-wrap { border-radius: var(--radius-lg); padding: 1.4rem; }
.video-shell { position: relative; border-radius: var(--radius-md); overflow: hidden; background: #000; aspect-ratio: 16/9; }
.video-shell video, .video-shell iframe { width: 100%; height: 100%; display: block; object-fit: contain; background: #000; }
.video-controls {
  position: absolute; bottom: 0; left: 0; right: 0;
  display: flex; align-items: center; gap: 0.8rem;
  padding: 0.8rem 1rem; background: linear-gradient(0deg, rgba(0,0,0,0.75), transparent);
}
.video-controls button { background: none; border: none; color: white; cursor: pointer; font-size: 0.95rem; padding: 0.3rem; }
.video-controls button:hover { color: var(--cyan); }
.scrub-bar { flex: 1; }
.scrub-track { height: 5px; background: rgba(255,255,255,0.25); border-radius: 3px; cursor: pointer; }
.scrub-fill { height: 100%; width: 0%; background: var(--cyan); border-radius: 3px; }
.player-meta { display: flex; justify-content: space-between; align-items: center; padding-top: 1rem; }
.player-meta-actions { display: flex; gap: 0.6rem; }

.view h2 { margin-bottom: 1.2rem; }
.library-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1rem; }
.library-card { border-radius: var(--radius-md); overflow: hidden; cursor: pointer; }
.library-card .thumb { aspect-ratio: 16/9; background: #000 center/cover; display: flex; align-items: center; justify-content: center; color: var(--text-muted); }
.library-card .info { padding: 0.8rem; }
.library-card .info h4 { margin: 0 0 0.3rem; font-size: 0.9rem; font-family: var(--font-body); font-weight: 600; }
.library-card .info span { font-size: 0.75rem; color: var(--text-muted); }

.settings-card { border-radius: var(--radius-md); padding: 1.6rem; max-width: 480px; }
.settings-field { display: flex; flex-direction: column; gap: 0.4rem; margin: 1rem 0; font-size: 0.85rem; color: var(--text-muted); }
.settings-field input {
  background: rgba(255,255,255,0.05); border: 1px solid var(--surface-border); border-radius: var(--radius-sm);
  padding: 0.7rem 0.9rem; color: var(--text); font-family: var(--font-body); outline: none;
}
.settings-field input:focus { border-color: var(--violet); }

/* ---------- Auth modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(4,6,10,0.7);
  display: flex; align-items: center; justify-content: center; z-index: 100;
}
.modal { width: 100%; max-width: 380px; border-radius: var(--radius-lg); padding: 2rem; position: relative; }
.modal-close { position: absolute; top: 1.2rem; right: 1.2rem; background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 1.1rem; }
.auth-error { color: var(--danger); font-size: 0.85rem; margin-bottom: 0.8rem; }
.auth-switch { text-align: center; margin-top: 1.2rem; font-size: 0.85rem; color: var(--text-muted); }
.auth-switch button { background: none; border: none; color: var(--cyan); cursor: pointer; font-weight: 600; font-size: 0.85rem; }
#auth-form { display: flex; flex-direction: column; }
#auth-submit { margin-top: 0.5rem; justify-content: center; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; padding-top: 3rem; }
  .hero h1 { font-size: 2.3rem; }
  .feature-grid { grid-template-columns: repeat(2, 1fr); }
  .how-steps { grid-template-columns: 1fr; }
  .nav-links a, .nav-links span { display: none; }
  #app { grid-template-columns: 72px 1fr; }
  .sidebar-item span, .sidebar-item { font-size: 0; gap: 0; }
  .sidebar-item i { font-size: 1.1rem; }
}
@media (max-width: 600px) {
  .feature-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}
