:root {
  --bg: #0d0d0d;
  --text: #eee;
  --dim: #888;
  --dimmer: #555;
  --purple: #9b59b6;
  --blue: #3498db;
  --green: #2ecc71;
  --grad: linear-gradient(90deg, var(--purple), var(--blue));
}

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

html, body {
  background: var(--bg);
  overflow-x: hidden;
}

body {
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  min-height: 100vh;
}

.landing {
  width: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* === HERO (left on desktop) === */
.hero {
  padding: 40px 24px 28px;
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
  overflow: hidden;
  min-height: 280px;
}
.hero-bg {
  position: absolute; inset: 0;
  background: url('/static/mixer.png') center/cover;
  filter: brightness(0.3) saturate(0.7);
}
.hero-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(13,13,13,0.65) 0%, rgba(26,10,46,0.55) 50%, rgba(10,22,40,0.65) 100%);
}
.hero-content { position: relative; }

.logo { width: 70px; height: auto; margin-bottom: 8px; opacity: 0.9; }
.brand {
  color: #fff; font-size: 10px; font-weight: 700;
  letter-spacing: 3px; margin-bottom: 20px; opacity: 0.5;
}
.headline {
  color: #fff; font-size: 24px; font-weight: 300;
  line-height: 1.35; margin-bottom: 14px;
}
.gradient-text {
  background: var(--grad);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text; font-weight: 600;
}
.subtitle {
  color: rgba(255,255,255,0.45); font-size: 13px;
  line-height: 1.7; max-width: 360px;
}

/* === RIGHT PANEL === */
.right-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  background: #0d0d0f;
}

.return-pill {
  position: absolute; top: 14px; right: 16px;
  font-size: 10px; color: rgba(155,89,182,0.75);
  background: rgba(155,89,182,0.08);
  border: 1px solid rgba(155,89,182,0.18);
  padding: 5px 14px; border-radius: 20px;
  cursor: pointer; transition: all 0.3s; z-index: 10;
}
.return-pill:hover {
  background: rgba(155,89,182,0.2);
  border-color: rgba(155,89,182,0.35);
}

/* === PLAYER === */
.player-section { padding: 44px 24px 12px; }
.player-divider { height: 1px; background: #161619; margin-top: 12px; }

.live-indicator {
  display: flex; align-items: center; gap: 6px; margin-bottom: 10px;
}
.live-dot {
  width: 7px; height: 7px; background: var(--green);
  border-radius: 50%; animation: pulse 2s infinite;
}
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } }
.live-text { color: var(--green); font-size: 10px; font-weight: 500; letter-spacing: 1px; }

.player-card {
  background: rgba(255,255,255,0.03);
  border-radius: 10px; padding: 14px;
  border: 1px solid #1a1a1a;
}
.player-row { display: flex; align-items: center; gap: 12px; }
.play-btn {
  background: #eee; color: #111;
  width: 44px; height: 44px; border-radius: 50%;
  border: none; display: flex; align-items: center;
  justify-content: center; font-size: 14px;
  flex-shrink: 0; cursor: pointer;
  min-width: 44px; min-height: 44px;
}
.track-info { flex: 1; min-width: 0; }
.track-name {
  color: #eee; font-size: 13px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.track-meta { color: #666; font-size: 11px; margin-top: 2px; }
.persona-pill {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 2px 7px; background: rgba(155,89,182,0.12);
  border: 1px solid rgba(155,89,182,0.25);
  border-radius: 8px; margin-top: 5px;
}
.persona-icon { font-size: 9px; }
.persona-name { font-size: 9px; color: var(--purple); }

.progress-rail {
  margin-top: 12px; background: #1a1a1a;
  border-radius: 4px; height: 3px; overflow: hidden;
}
.progress-bar {
  background: var(--grad); height: 100%; width: 0%;
  border-radius: 4px; transition: width 1s linear;
}
.volume-row {
  display: flex; align-items: center; gap: 8px; margin-top: 10px;
}
.vol-icon { color: var(--dimmer); font-size: 10px; }
.vol-slider {
  flex: 1; -webkit-appearance: none; appearance: none;
  height: 3px; background: #1a1a1a; border-radius: 3px;
  outline: none; cursor: pointer;
}
.vol-slider::-webkit-slider-thumb {
  -webkit-appearance: none; width: 14px; height: 14px;
  border-radius: 50%; background: #888; cursor: pointer;
}
.vol-slider::-moz-range-thumb {
  width: 14px; height: 14px;
  border-radius: 50%; background: #888;
  border: none; cursor: pointer;
}

/* === DISCOVERY === */
.discovery-section {
  flex: 1; padding: 20px 24px;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
}
.discovery-prompt {
  font-size: 12px; color: rgba(255,255,255,0.2);
  font-style: italic; letter-spacing: 0.5px;
  margin-bottom: 16px; text-align: center;
}
.discovery-field {
  display: flex; flex-wrap: wrap; gap: 11px;
  justify-content: center; max-width: 400px;
}
.oval {
  width: 76px; height: 76px; border-radius: 50%;
  overflow: hidden; border: 2px solid rgba(255,255,255,0.06);
  cursor: pointer; transition: border-color 0.3s, box-shadow 0.3s; flex-shrink: 0;
}
.oval:hover {
  border-color: rgba(155,89,182,0.4);
  transform: scale(1.06);
  box-shadow: 0 0 16px rgba(155,89,182,0.12);
}
.oval img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  -webkit-user-drag: none; user-select: none; pointer-events: none;
}
.oval { -webkit-touch-callout: none; user-select: none; }
.pill {
  padding: 12px 20px; border-radius: 14px;
  background: rgba(110,130,200,0.10);
  border: 1px solid rgba(110,130,200,0.18);
  font-size: 11px; color: rgba(180,190,230,0.75); line-height: 1.2;
  letter-spacing: 0.3px; font-weight: 500;
  cursor: pointer; transition: border-color 0.3s, background 0.3s, color 0.3s;
  display: flex; align-items: center; justify-content: center;
  text-align: center; white-space: nowrap;
}
.pill:hover {
  border-color: rgba(130,100,200,0.4);
  background: rgba(130,100,200,0.16); color: rgba(220,220,245,0.95);
}
/* News topic pills: teal/green tint, equal-width grid */
.pill.news-pill {
  background: rgba(100,180,160,0.08);
  border-color: rgba(100,180,160,0.15);
  color: rgba(160,210,190,0.7);
}
.pill.news-pill:hover {
  background: rgba(100,180,160,0.14);
  border-color: rgba(100,180,160,0.35);
  color: rgba(190,230,210,0.9);
}
/* News round: equal-width pill grid */
.discovery-field.news-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  max-width: 420px;
}
.discovery-field.news-grid .pill {
  white-space: normal;
  padding: 10px 12px;
}
.discovery-field.news-grid .news-go-row {
  grid-column: 1 / -1;
}
@media (max-width: 767px) {
  .discovery-field.news-grid {
    grid-template-columns: repeat(2, 1fr);
    max-width: 320px;
  }
}

/* Staggered pulse: breathing glow to nudge users to click */
@keyframes subtlePulse {
  0%,100% { opacity: 0.75; transform: scale(0.98); box-shadow: 0 0 0 rgba(130,100,200,0); }
  50% { opacity: 1; transform: scale(1.04); box-shadow: 0 0 10px rgba(130,100,200,0.12); }
}
.discovery-field > :nth-child(1) { animation: subtlePulse 3s ease-in-out infinite 0.0s; }
.discovery-field > :nth-child(2) { animation: subtlePulse 3s ease-in-out infinite 0.5s; }
.discovery-field > :nth-child(3) { animation: subtlePulse 3s ease-in-out infinite 1.0s; }
.discovery-field > :nth-child(4) { animation: subtlePulse 3s ease-in-out infinite 1.5s; }
.discovery-field > :nth-child(5) { animation: subtlePulse 3s ease-in-out infinite 2.0s; }
.discovery-field > :nth-child(6) { animation: subtlePulse 3s ease-in-out infinite 2.5s; }
.discovery-field > :nth-child(7) { animation: subtlePulse 3s ease-in-out infinite 3.0s; }

.round-dots {
  display: flex; gap: 6px; justify-content: center; margin-top: 14px;
}
.dot {
  width: 5px; height: 5px; border-radius: 50%; background: #1a1a1f;
}
.dot.active { background: var(--purple); }

/* === AUTH MODAL === */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.7);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; backdrop-filter: blur(4px);
}
.modal-overlay.hidden { display: none; }
.modal-card {
  background: #151518; border: 1px solid #2a2a2f;
  border-radius: 16px; padding: 32px; max-width: 380px;
  width: 90%; position: relative;
}
.modal-close {
  position: absolute; top: 12px; right: 16px;
  background: none; border: none; color: #666;
  font-size: 20px; cursor: pointer;
}
.modal-card h3 { font-size: 18px; font-weight: 400; margin-bottom: 8px; }
.modal-desc { font-size: 13px; color: #777; margin-bottom: 20px; }
.auth-btn {
  display: block; width: 100%; padding: 12px;
  border-radius: 10px; font-size: 14px; text-align: center;
  text-decoration: none; cursor: pointer; border: none;
  transition: opacity 0.2s;
}
.auth-btn:hover { opacity: 0.85; }
.google-btn {
  background: #fff; color: #333; font-weight: 500;
  margin-bottom: 12px;
}
.email-btn {
  background: var(--grad); color: #fff; font-weight: 500;
}
.auth-divider {
  text-align: center; color: #444; font-size: 11px;
  margin: 12px 0; position: relative;
}
.auth-divider::before, .auth-divider::after {
  content: ''; position: absolute; top: 50%;
  width: 40%; height: 1px; background: #222;
}
.auth-divider::before { left: 0; }
.auth-divider::after { right: 0; }
.magic-link-form { display: flex; flex-direction: column; gap: 10px; }
.magic-link-form input {
  background: #1a1a22; border: 1px solid #2a2a2f;
  border-radius: 10px; padding: 12px 16px; color: #eee;
  font-size: 13px; outline: none;
}

/* === MOBILE CTA (hidden by default, shown on mobile) === */
.mobile-cta {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 0 24px;
}
.cta-create {
  width: 100%;
  padding: 14px 20px;
  border-radius: 14px;
  background: var(--grad);
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  letter-spacing: 0.3px;
  transition: opacity 0.2s;
}
.cta-create:hover { opacity: 0.9; }
.cta-signin {
  color: var(--purple);
  font-size: 13px;
  cursor: pointer;
  text-decoration: none;
  transition: opacity 0.2s;
}
.cta-signin:hover { opacity: 0.75; }
.mobile-footer {
  display: none;
  text-align: center;
  font-size: 11px;
  color: rgba(255,255,255,0.25);
  padding: 8px 16px 12px;
  flex-shrink: 0;
}

/* === SHIMMER LOADING STATE === */
@keyframes shimmer {
  0% { background-position: -200px 0; }
  100% { background-position: calc(200px + 100%) 0; }
}
.shimmer-placeholder {
  background: linear-gradient(90deg, rgba(255,255,255,0.02) 0%, rgba(255,255,255,0.06) 50%, rgba(255,255,255,0.02) 100%);
  background-size: 200px 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: 8px;
}
.landing-content-loaded .hero-content,
.landing-content-loaded .player-section,
.landing-content-loaded .mobile-cta,
.landing-content-loaded .discovery-section {
  opacity: 1;
}
.landing:not(.landing-content-loaded) .hero-content,
.landing:not(.landing-content-loaded) .player-section,
.landing:not(.landing-content-loaded) .mobile-cta,
.landing:not(.landing-content-loaded) .discovery-section {
  opacity: 0;
  transition: opacity 0.4s ease;
}
.landing.landing-content-loaded .hero-content,
.landing.landing-content-loaded .player-section,
.landing.landing-content-loaded .mobile-cta,
.landing.landing-content-loaded .discovery-section {
  transition: opacity 0.4s ease;
}
/* Shimmer blocks shown while loading */
.shimmer-hero {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 40px 24px;
  gap: 12px;
}
.shimmer-hero .shimmer-block {
  background: linear-gradient(90deg, rgba(255,255,255,0.02) 0%, rgba(255,255,255,0.06) 50%, rgba(255,255,255,0.02) 100%);
  background-size: 200px 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: 6px;
}
.landing.landing-content-loaded .shimmer-hero {
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

/* === MOBILE === */
@media (max-width: 767px) {
  html, body {
    overflow: hidden;
    height: 100dvh;
    max-height: 100dvh;
  }
  .landing {
    min-height: 100dvh; max-height: 100dvh; overflow: hidden;
    display: flex; flex-direction: column;
  }
  .hero {
    padding: 24px 20px 16px; min-height: 0; flex: 0 0 auto;
    text-align: center;
  }
  .hero-content {
    display: flex; flex-direction: column; align-items: center;
  }
  .headline { font-size: 20px; margin-bottom: 6px; }
  .subtitle { font-size: 11px; line-height: 1.5; text-align: center; }
  .player-section { padding: 8px 16px 4px; }
  .player-card { padding: 10px; }
  .volume-row { margin-top: 6px; }
  .progress-rail { margin-top: 8px; }
  /* Discovery starts hidden on mobile; CTA is shown first */
  .discovery-section {
    padding: 8px 16px; flex: 1; min-height: 0;
    justify-content: flex-start; overflow-y: auto;
    display: none;
  }
  .discovery-section.mobile-active {
    display: flex;
  }
  .logo { width: 44px; margin-bottom: 2px; }
  .brand { margin-bottom: 6px; font-size: 9px; }
  .live-indicator { margin-bottom: 6px; }
  .player-divider { margin-top: 4px; }
  .oval { width: 28vw; height: 28vw; max-width: 120px; max-height: 120px; aspect-ratio: 1; }
  .discovery-field { gap: 8px; }
  .discovery-prompt { margin-bottom: 10px; font-size: 11px; }
  .round-dots { margin-top: 10px; }
  /* Mobile CTA visible, centered in remaining space */
  .mobile-cta {
    display: flex;
    flex: 1;
    justify-content: center;
    align-items: center;
    padding: 12px 24px;
  }
  .mobile-cta.hidden { display: none; }
  .mobile-footer { display: block; }
  .mobile-footer.hidden { display: none; }
  /* Return pill hidden on mobile (replaced by CTA) */
  .return-pill { display: none; }
  /* Inputs: prevent iOS zoom + overflow */
  input, select, textarea {
    font-size: 16px !important;
    max-width: 100%;
    box-sizing: border-box;
  }
  /* Mobile discovery: tag cloud (flex-wrap, mixed photo tiles + pills) */
  .discovery-field.mobile-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    align-content: center;
    max-width: 300px;
    margin: 0 auto;
  }
  .discovery-field.mobile-grid .oval {
    width: 70px;
    height: 70px;
    border-radius: 16px;
    flex-shrink: 0;
  }
  .discovery-field.mobile-grid .oval img {
    border-radius: 16px;
  }
  .discovery-field.mobile-grid .pill {
    height: 36px;
    display: flex;
    align-items: center;
    padding: 8px 16px;
    font-size: 13px;
  }
  .shimmer-hero { padding: 24px 20px; }

  /* === Auth modal: full-screen on mobile, dark theme === */
  .modal-overlay {
    align-items: stretch;
  }
  .modal-card {
    max-width: 100%; width: 100%; border-radius: 0;
    min-height: 100vh;
    display: flex; flex-direction: column;
    justify-content: center; align-items: center;
    padding: 24px;
    border: none;
  }
  .modal-card h3 { font-size: 20px; font-weight: 300; margin-bottom: 6px; }
  .modal-desc { margin-bottom: 24px; }
  .modal-close {
    position: absolute; top: 16px; right: 16px;
    font-size: 24px; z-index: 1;
  }
  .google-btn {
    background: #1a1a22; color: #ddd; border: 1px solid #2a2a30;
    font-weight: 400;
  }
  .auth-btn { border-radius: 12px; padding: 14px; }
  .magic-link-form input {
    font-size: 16px !important;
    padding: 14px 16px;
    border-radius: 12px;
  }
  .magic-link-form { width: 100%; max-width: 280px; }
  .auth-divider { width: 100%; max-width: 280px; }
  .google-btn, .email-btn { width: 100%; max-width: 280px; margin-left: auto; margin-right: auto; }
}
@media (max-width: 400px) {
  .hero { padding: 16px 16px 10px; }
  .headline { font-size: 18px; }
  .subtitle { display: none; }
}

/* Touch device force mobile layout */
@media (pointer: coarse) and (hover: none) {
  .landing {
    min-height: 100vh; max-height: 100vh; overflow: hidden;
    max-width: 100vw;
  }
  input, select, textarea {
    font-size: 16px !important;
    max-width: 100%;
    box-sizing: border-box;
  }
}

/* === DESKTOP: SPLIT LAYOUT === */
@media (min-width: 768px) {
  body { display: flex; justify-content: center; align-items: stretch; }
  .landing {
    width: 100%; max-width: 1100px; flex-direction: row; min-height: 100vh;
    margin: 0 auto;
  }
  .hero {
    flex: 1; padding: 60px 48px; min-height: auto;
  }
  .logo { width: 70px; }
  .headline { font-size: 32px; margin-bottom: 20px; }
  .subtitle { font-size: 14px; }
  .right-panel {
    width: 420px; flex-shrink: 0;
    border-left: 1px solid #1a1a1f;
  }
  .player-section { padding: 48px 28px 12px; }
  .discovery-section { padding: 20px 28px; }
  .oval { width: 78px; height: 78px; }

  /* === STATION MODE: Hero collapses, station expands === */
  .landing.station-mode {
    max-width: none;
    background: #0d0d0f;
  }
  .landing.station-mode .hero {
    width: 60px !important;
    flex: none !important;
    min-height: 0;
    padding: 16px 0;
    overflow: hidden;
    transition: width 0.8s ease, padding 0.8s ease, flex 0.8s ease;
  }
  .landing.station-mode .hero .hero-content,
  .landing.station-mode .hero .hero-bg,
  .landing.station-mode .hero .hero-overlay {
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
  }
  .landing.station-mode .hero .brand-strip {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 16px;
    gap: 8px;
    opacity: 0;
    transition: opacity 0.4s ease 0.5s;
  }
  .landing.station-mode .hero .brand-strip.visible {
    opacity: 1;
  }
  .landing.station-mode .right-panel {
    flex: 1;
    width: auto;
    transition: flex 0.8s ease;
  }
  .landing.station-mode .return-pill { display: none; }
  .landing.station-mode .player-divider { display: none; }
  .landing.station-mode .discovery-section {
    align-items: center;
    justify-content: flex-start;
    padding-top: 24px;
  }
  .landing.station-mode .discovery-field {
    max-width: 420px;
    width: 100%;
    flex-direction: column;
    align-items: center;
    gap: 12px;
  }
  /* No pulse animation in station mode */
  .landing.station-mode .discovery-field > * {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
  }
}

/* === STATION MODE: Mobile === */
@media (max-width: 767px) {
  .landing.station-mode { max-height: none; overflow: auto; }
  .landing.station-mode .hero { display: none; }
  .landing.station-mode .player-section { padding-top: 16px; }
  .landing.station-mode .discovery-section {
    justify-content: flex-start;
    padding-top: 12px;
    overflow-y: auto;
  }
  .landing.station-mode .discovery-field {
    max-width: 420px;
    width: 100%;
    flex-direction: column;
    align-items: center;
    gap: 10px;
  }
  .landing.station-mode .discovery-field > * {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
  }
  .landing.station-mode .return-pill { display: none; }
  .landing.station-mode .player-divider { display: none; }
}

/* === FOMO OVERLAY === */
.fomo-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999;
  opacity: 0; transition: opacity 0.3s ease;
  pointer-events: none;
}
.fomo-overlay.visible {
  opacity: 1; pointer-events: auto;
}
.fomo-card {
  background: #151518; border: 1px solid #2a2a2f;
  border-radius: 16px; padding: 28px; max-width: 320px;
  width: 90%; text-align: center;
}

/* === AUTOPLAY FALLBACK: pulse play button === */
@keyframes playPulse {
  0%,100% { box-shadow: 0 0 0 rgba(130,100,200,0); }
  50% { box-shadow: 0 0 16px rgba(130,100,200,0.4); }
}
.play-btn.needs-click {
  animation: playPulse 1.5s ease-in-out infinite;
  border: 2px solid rgba(130,100,200,0.5);
}
