/* === Design Tokens === */
:root {
  --bg: #060a14;
  --surface: #0b1222;
  --surface-alt: #111a2e;
  --text: #e4e8f0;
  --text-muted: #7a8ba8;
  --accent: #5a8fbe;
  --accent-glow: rgba(90, 143, 190, 0.3);
  --red: #e74c3c;
  --green: #2ecc71;
  --radius: 12px;
  --font: 'Inter', system-ui, sans-serif;
  --font-display: 'Space Grotesk', sans-serif;
}

/* === Reset === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
}

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

/* === Topbar === */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 2rem;
  background: var(--surface);
  border-bottom: 1px solid rgba(255,255,255,0.05);
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.brand-logo {
  font-size: 0.6rem;
  letter-spacing: 0.15em;
  opacity: 0.5;
  text-transform: uppercase;
}

.brand-name {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
}

.brand-ai {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent);
  background: rgba(90, 143, 190, 0.15);
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
}

.mode-switch {
  display: flex;
  gap: 0.25rem;
  background: var(--bg);
  padding: 0.25rem;
  border-radius: 20px;
}

.mode-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 0.85rem;
  padding: 0.4rem 1rem;
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.2s;
}

.mode-btn.active {
  background: var(--accent);
  color: #fff;
}

.mode-btn:hover:not(.active) {
  color: var(--text);
}

.topbar-live {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.live-pulse {
  width: 8px;
  height: 8px;
  background: var(--red);
  border-radius: 50%;
  animation: pulse 2s ease-in-out infinite;
}

.live-text {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--red);
  letter-spacing: 0.05em;
}

@keyframes pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(231, 76, 60, 0.7); }
  50% { opacity: 0.7; box-shadow: 0 0 0 6px rgba(231, 76, 60, 0); }
}

/* === Player === */
.player {
  text-align: center;
  padding: 3rem 2rem;
  position: relative;
  overflow: hidden;
}

.player-glow {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 400px;
  height: 400px;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, var(--accent-glow) 0%, transparent 70%);
  pointer-events: none;
  opacity: 0.4;
}

.player-content {
  position: relative;
  z-index: 1;
}

/* Visualizer bars */
.player-viz {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 3px;
  height: 50px;
  margin-bottom: 1.5rem;
}

.viz-bar {
  width: 3px;
  height: 8px;
  background: var(--accent);
  border-radius: 2px;
  opacity: 0.3;
  transition: height 0.1s;
}

.player-viz.active .viz-bar {
  animation: vizBounce 0.8s ease-in-out infinite alternate;
  opacity: 0.8;
}

.player-viz.active .viz-bar:nth-child(1) { animation-delay: 0s; }
.player-viz.active .viz-bar:nth-child(2) { animation-delay: 0.1s; }
.player-viz.active .viz-bar:nth-child(3) { animation-delay: 0.2s; }
.player-viz.active .viz-bar:nth-child(4) { animation-delay: 0.05s; }
.player-viz.active .viz-bar:nth-child(5) { animation-delay: 0.15s; }
.player-viz.active .viz-bar:nth-child(6) { animation-delay: 0.25s; }
.player-viz.active .viz-bar:nth-child(7) { animation-delay: 0.3s; }
.player-viz.active .viz-bar:nth-child(8) { animation-delay: 0.08s; }
.player-viz.active .viz-bar:nth-child(9) { animation-delay: 0.18s; }
.player-viz.active .viz-bar:nth-child(10) { animation-delay: 0.28s; }
.player-viz.active .viz-bar:nth-child(11) { animation-delay: 0.12s; }
.player-viz.active .viz-bar:nth-child(12) { animation-delay: 0.22s; }
.player-viz.active .viz-bar:nth-child(13) { animation-delay: 0.02s; }
.player-viz.active .viz-bar:nth-child(14) { animation-delay: 0.16s; }
.player-viz.active .viz-bar:nth-child(15) { animation-delay: 0.26s; }

@keyframes vizBounce {
  0% { height: 8px; }
  100% { height: 40px; }
}

.player-badge {
  display: inline-block;
  background: var(--red);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.2rem 0.8rem;
  border-radius: 4px;
  letter-spacing: 0.1em;
  margin-bottom: 0.75rem;
}

.player-title {
  font-family: var(--font-display);
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.player-subtitle {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 1.5rem;
}

/* Player controls */
.player-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  max-width: 500px;
  margin: 0 auto;
  background: var(--surface);
  padding: 0.75rem 1.25rem;
  border-radius: 30px;
  border: 1px solid rgba(255,255,255,0.08);
}

.play-btn, .vol-btn {
  background: none;
  border: none;
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  transition: color 0.2s;
}

.play-btn:hover, .vol-btn:hover { color: var(--accent); }

.play-btn svg, .vol-btn svg {
  width: 20px;
  height: 20px;
}

.player-time {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  min-width: 35px;
}

.player-progress {
  flex: 1;
  height: 4px;
  appearance: none;
  background: rgba(255,255,255,0.1);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}

.player-progress::-webkit-slider-thumb {
  appearance: none;
  width: 12px;
  height: 12px;
  background: var(--accent);
  border-radius: 50%;
  cursor: pointer;
}

/* === Transcript === */
.transcript {
  max-width: 800px;
  margin: 2rem auto;
  padding: 0 2rem;
}

.section-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}

.live-dot {
  width: 6px;
  height: 6px;
  background: var(--green);
  border-radius: 50%;
  animation: pulse 2s ease-in-out infinite;
}

.transcript-content {
  background: var(--surface);
  border: 1px solid rgba(255,255,255,0.05);
  border-radius: var(--radius);
  padding: 1.5rem;
  max-height: 200px;
  overflow-y: auto;
  scroll-behavior: smooth;
}

.transcript-content p {
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.7;
  margin-bottom: 0.5rem;
}

.transcript-placeholder, .articles-placeholder {
  color: var(--text-muted);
  opacity: 0.5;
  font-style: italic;
}

/* === Articles === */
#articles-section {
  max-width: 800px;
  margin: 3rem auto;
  padding: 0 2rem;
}

.section-title h2 {
  font-family: var(--font-display);
  font-size: 1.8rem;
  margin-bottom: 0.25rem;
}

.section-title p {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 2rem;
}

.articles-feed {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Article card */
.article-card {
  background: var(--surface);
  border: 1px solid rgba(255,255,255,0.05);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform 0.2s, border-color 0.2s;
}

.article-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255,255,255,0.1);
}

.article-img {
  position: relative;
  background: var(--surface-alt);
  padding: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 160px;
}

.article-img img {
  width: 80px;
  height: 80px;
  opacity: 0.6;
}

.article-badge {
  position: absolute;
  top: 1rem;
  left: 1rem;
  background: var(--accent);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  letter-spacing: 0.08em;
}

.article-body {
  padding: 1.25rem 1.5rem;
}

.article-body h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  line-height: 1.4;
}

.article-body p {
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.6;
  margin-bottom: 0.75rem;
}

.article-body time {
  font-size: 0.75rem;
  color: var(--text-muted);
  opacity: 0.6;
}

/* === Disclaimer === */
.disclaimer {
  max-width: 800px;
  margin: 2rem auto;
  padding: 1rem 2rem;
  text-align: center;
}

.disclaimer p {
  color: var(--text-muted);
  font-size: 0.8rem;
  opacity: 0.5;
}

/* === Footer === */
.footer {
  text-align: center;
  padding: 2rem;
  border-top: 1px solid rgba(255,255,255,0.05);
  margin-top: 2rem;
}

.footer p {
  color: var(--text-muted);
  font-size: 0.8rem;
  opacity: 0.5;
  line-height: 1.8;
}

/* === Scrollbar === */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }

/* === Responsive === */
@media (max-width: 768px) {
  .topbar { padding: 0.5rem 1rem; }
  .topbar-brand .brand-logo { display: none; }
  .mode-btn { padding: 0.3rem 0.75rem; font-size: 0.8rem; }
  .player-title { font-size: 1.8rem; }
  .player { padding: 2rem 1rem; }
  .transcript, #articles-section, .disclaimer { padding: 0 1rem; }
  .player-controls { max-width: 100%; }
}
