/* ==========================================================================
   AUDIO ORCHESTRA - Dark Obsidian Aesthetic Design System
   ========================================================================== */

:root {
  --bg-space: #07080C;
  --bg-surface: #0E1017;
  --bg-card: #151824;
  --bg-card-hover: #1C2030;
  --bg-glass: rgba(21, 24, 36, 0.75);
  
  --gold-primary: #E5B869;
  --gold-glow: rgba(229, 184, 105, 0.35);
  --gold-subtle: rgba(229, 184, 105, 0.12);
  
  --emerald-queen: #38E5B8;
  --emerald-glow: rgba(56, 229, 184, 0.35);
  --emerald-subtle: rgba(56, 229, 184, 0.12);

  --caesar-glow: rgba(229, 90, 60, 0.4);
  --caesar-accent: #E55A3C;

  --text-pure: #FFFFFF;
  --text-sand: #E6E8EE;
  --text-muted: #8E95A5;
  --text-dim: #585F70;

  --border-light: rgba(255, 255, 255, 0.08);
  --border-gold: rgba(229, 184, 105, 0.3);
  
  --font-serif: 'Cinzel', Georgia, serif;
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;
  
  --shadow-card: 0 10px 30px -10px rgba(0, 0, 0, 0.7);
  --shadow-glow-gold: 0 0 25px rgba(229, 184, 105, 0.25);
  --transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Reset & Basics */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  color-scheme: dark;
  scroll-behavior: smooth;
}

body {
  background-color: var(--bg-space);
  color: var(--text-sand);
  font-family: var(--font-sans);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  background-image: 
    radial-gradient(circle at 20% 15%, rgba(229, 184, 105, 0.05) 0%, transparent 40%),
    radial-gradient(circle at 80% 85%, rgba(56, 229, 184, 0.04) 0%, transparent 45%);
  background-attachment: fixed;
}

/* Typography Utilities */
h1, h2, h3, h4, .brand-title {
  font-family: var(--font-serif);
  letter-spacing: 0.02em;
}

a {
  color: inherit;
  text-decoration: none;
}

/* Top Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(7, 8, 12, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-light);
}

.header-container {
  max-width: 1440px;
  margin: 0 auto;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-icon {
  font-size: 24px;
  background: var(--bg-card);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-size: 18px;
  font-weight: 900;
  color: var(--text-pure);
  letter-spacing: 0.12em;
  background: linear-gradient(135deg, #FFF 20%, var(--gold-primary) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-subtitle {
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.live-pill {
  font-size: 11px;
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--gold-primary);
  background: var(--gold-subtle);
  border: 1px solid var(--border-gold);
  padding: 4px 10px;
  border-radius: var(--radius-full);
}

.header-link {
  font-size: 12px;
  color: var(--text-muted);
  transition: var(--transition);
}

.header-link:hover {
  color: var(--gold-primary);
}

/* ==========================================================================
   Main Arena Layout (7:3 Two-Column Grid)
   ========================================================================== */

.arena-container {
  max-width: 1440px;
  margin: 0 auto;
  padding: 28px 24px 60px;
}

.arena-grid {
  display: grid;
  grid-template-columns: 7fr 3fr;
  gap: 28px;
  align-items: start;
}

/* LEFT COLUMN: Stage (70%) */
.stage-column {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.episode-hero-header {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.hero-badges {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.badge-ep {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: var(--bg-space);
  background: var(--gold-primary);
  padding: 3px 8px;
  border-radius: 4px;
}

.badge-category {
  font-size: 12px;
  color: var(--text-muted);
  background: var(--bg-card);
  padding: 3px 10px;
  border-radius: 4px;
  border: 1px solid var(--border-light);
}

.badge-duration {
  font-size: 12px;
  color: var(--text-dim);
}

.hero-title {
  font-size: clamp(24px, 3vw, 34px);
  font-weight: 800;
  color: var(--text-pure);
  line-height: 1.25;
}

.hero-topic {
  font-size: 15px;
  color: var(--text-muted);
  font-weight: 400;
}

/* ==========================================================================
   VS Battle Arena Card
   ========================================================================== */

.vs-arena-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  display: grid;
  grid-template-columns: 180px 1fr 180px;
  gap: 20px;
  align-items: center;
  position: relative;
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.vs-arena-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--caesar-accent), transparent 50%, var(--emerald-queen));
  opacity: 0.6;
}

/* Fighter Panels */
.fighter-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  transition: var(--transition);
  opacity: 0.75;
}

.fighter-panel.active-speaking {
  opacity: 1;
  transform: scale(1.03);
}

.avatar-wrapper {
  position: relative;
  width: 140px;
  height: 140px;
  border-radius: 50%;
  padding: 4px;
  margin-bottom: 12px;
}

.fighter-avatar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  border: 2px solid var(--border-light);
  transition: var(--transition);
}

.fighter-left .avatar-wrapper {
  border: 2px solid rgba(229, 90, 60, 0.4);
}

.fighter-right .avatar-wrapper {
  border: 2px solid rgba(56, 229, 184, 0.4);
}

.fighter-panel.active-speaking.fighter-left .fighter-avatar {
  border-color: var(--caesar-accent);
  box-shadow: 0 0 30px var(--caesar-glow);
}

.fighter-panel.active-speaking.fighter-right .fighter-avatar {
  border-color: var(--emerald-queen);
  box-shadow: 0 0 30px var(--emerald-glow);
}

/* Sound Wave bars indicator over speaking avatar */
.speaking-indicator {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 3px;
  height: 16px;
  padding: 2px 8px;
  background: rgba(0, 0, 0, 0.75);
  border-radius: var(--radius-full);
  opacity: 0;
  transition: var(--transition);
}

.active-speaking .speaking-indicator {
  opacity: 1;
}

.speaking-indicator .bar {
  width: 3px;
  height: 100%;
  background: var(--gold-primary);
  border-radius: 2px;
  animation: barBounce 0.6s infinite ease-in-out alternate;
}

.fighter-right .speaking-indicator .bar {
  background: var(--emerald-queen);
}

.speaking-indicator .bar:nth-child(2) { animation-delay: 0.2s; }
.speaking-indicator .bar:nth-child(3) { animation-delay: 0.4s; }

@keyframes barBounce {
  0% { height: 20%; }
  100% { height: 100%; }
}

.fighter-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-pure);
  margin-bottom: 2px;
}

.fighter-title {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Center Audio Stage */
.center-audio-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  width: 100%;
}

.clash-icon {
  font-family: var(--font-serif);
  font-size: 15px;
  font-weight: 900;
  color: var(--gold-primary);
  background: var(--bg-card);
  padding: 4px 14px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-gold);
  letter-spacing: 0.15em;
  box-shadow: 0 0 15px var(--gold-subtle);
}

.waveform-container {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 10px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  cursor: pointer;
}

#waveform-canvas {
  width: 100%;
  height: 60px;
  display: block;
}

.wave-hover-hint {
  font-size: 10px;
  color: var(--text-dim);
  margin-top: 4px;
  letter-spacing: 0.03em;
}

/* Scrub Bar */
.scrub-container {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
}

.time-readout {
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
  font-weight: 600;
  min-width: 44px;
}

.progress-bar-wrap {
  flex-grow: 1;
  height: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-full);
  position: relative;
  cursor: pointer;
  outline: none;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

.progress-bar-wrap::before {
  content: '';
  position: absolute;
  top: -14px;
  bottom: -14px;
  left: 0;
  right: 0;
  cursor: pointer;
}

.progress-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--caesar-accent), var(--gold-primary), var(--emerald-queen));
  border-radius: var(--radius-full);
  position: relative;
  transition: width 0.08s linear;
  pointer-events: none;
}

.progress-bar-wrap.is-scrubbing .progress-bar-fill,
.progress-bar-wrap.is-scrubbing .progress-handle {
  transition: none !important;
}

.progress-handle {
  position: absolute;
  top: 50%;
  left: 0%;
  width: 14px;
  height: 14px;
  background: var(--text-pure);
  border: 2px solid var(--gold-primary);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 10px rgba(229, 184, 105, 0.8);
  pointer-events: none;
  transition: left 0.08s linear;
}

/* Playback Controls */
.playback-controls {
  display: flex;
  align-items: center;
  gap: 18px;
}

.btn-control {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  color: var(--text-muted);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}

.btn-control:hover {
  color: var(--text-pure);
  border-color: var(--gold-primary);
  transform: translateY(-2px);
}

.btn-play-hero {
  background: linear-gradient(135deg, var(--gold-primary) 0%, #B88E3E 100%);
  color: #07080C;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(229, 184, 105, 0.4);
  transition: var(--transition);
}

.btn-play-hero:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 28px rgba(229, 184, 105, 0.6);
}

.btn-speed {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  color: var(--text-muted);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
}

.btn-speed:hover {
  color: var(--gold-primary);
  border-color: var(--border-gold);
}

.hidden {
  display: none !important;
}

/* ==========================================================================
   Transcript Box Section (Live Synchronized Dialogue)
   ========================================================================== */

.transcript-section {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.transcript-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-light);
}

.transcript-heading {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-pure);
}

.transcript-hint {
  font-size: 12px;
  color: var(--text-dim);
  margin-left: 10px;
}

.sync-badge {
  font-size: 11px;
  color: var(--emerald-queen);
  background: var(--emerald-subtle);
  border: 1px solid rgba(56, 229, 184, 0.3);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-weight: 600;
}

.transcript-box {
  max-height: 420px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-right: 8px;
}

/* Custom Sleek Scrollbar */
.transcript-box::-webkit-scrollbar,
.episodes-list::-webkit-scrollbar {
  width: 6px;
}

.transcript-box::-webkit-scrollbar-track,
.episodes-list::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 4px;
}

.transcript-box::-webkit-scrollbar-thumb,
.episodes-list::-webkit-scrollbar-thumb {
  background: var(--bg-card-hover);
  border-radius: 4px;
}

.transcript-box::-webkit-scrollbar-thumb:hover,
.episodes-list::-webkit-scrollbar-thumb:hover {
  background: var(--gold-primary);
}

/* Transcript Lines */
.transcript-line {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border-left: 3px solid transparent;
  cursor: pointer;
  transition: var(--transition);
}

.transcript-line:hover {
  background: var(--bg-card-hover);
  transform: translateX(3px);
}

.transcript-line.active-line {
  background: rgba(229, 184, 105, 0.08);
  border-left-color: var(--gold-primary);
}

.transcript-line.active-line.speaker-cleopatra {
  background: rgba(56, 229, 184, 0.08);
  border-left-color: var(--emerald-queen);
}

.transcript-line.active-line.speaker-caesar {
  background: rgba(229, 90, 60, 0.08);
  border-left-color: var(--caesar-accent);
}

.line-meta {
  display: flex;
  align-items: center;
  gap: 8px;
}

.line-timestamp {
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  color: var(--text-dim);
  font-weight: 600;
}

.speaker-tag {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 6px;
  border-radius: 4px;
}

.tag-narrator {
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.05);
}

.tag-caesar {
  color: var(--caesar-accent);
  background: rgba(229, 90, 60, 0.15);
}

.tag-cleopatra {
  color: var(--emerald-queen);
  background: var(--emerald-subtle);
}

.tag-churchill {
  color: var(--gold-primary);
  background: var(--gold-subtle);
}

.tag-napoleon {
  color: #4A90E2;
  background: rgba(74, 144, 226, 0.15);
}

.dialogue-text {
  font-size: 14px;
  color: var(--text-sand);
  line-height: 1.55;
  font-style: normal;
}

.active-line .dialogue-text {
  color: var(--text-pure);
  font-weight: 600;
}

/* ==========================================================================
   RIGHT COLUMN: Sidebar & Episodes Archive (30%)
   ========================================================================== */

.sidebar-column {
  position: sticky;
  top: 90px;
}

.sidebar-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: var(--shadow-card);
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-light);
}

.sidebar-heading {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-pure);
}

.catalog-count {
  font-size: 11px;
  color: var(--text-dim);
}

/* Autoplay Toggle */
.autoplay-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}

.autoplay-label {
  font-size: 11px;
  color: var(--text-muted);
}

.autoplay-toggle input {
  display: none;
}

.toggle-switch {
  width: 32px;
  height: 18px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-full);
  position: relative;
  transition: var(--transition);
}

.toggle-switch::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 12px;
  height: 12px;
  background: var(--text-muted);
  border-radius: 50%;
  transition: var(--transition);
}

.autoplay-toggle input:checked + .toggle-switch {
  background: var(--gold-subtle);
  border-color: var(--gold-primary);
}

.autoplay-toggle input:checked + .toggle-switch::after {
  transform: translateX(14px);
  background: var(--gold-primary);
}

/* Episode Items List */
.episodes-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: calc(100vh - 220px);
  overflow-y: auto;
  padding-right: 4px;
}

.episode-item-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
}

.episode-item-card:hover {
  background: var(--bg-card-hover);
  border-color: rgba(229, 184, 105, 0.3);
  transform: translateY(-2px);
}

.episode-item-card.active-item {
  background: linear-gradient(145deg, var(--bg-card), rgba(229, 184, 105, 0.08));
  border: 1px solid var(--gold-primary);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.card-meta-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-ep-number {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--gold-primary);
}

.card-duration {
  font-size: 11px;
  color: var(--text-dim);
}

/* Mini Duel Avatars */
.mini-fighters {
  display: flex;
  align-items: center;
  gap: 6px;
}

.mini-avatar-wrap {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  overflow: hidden;
  border: 1px solid var(--border-light);
}

.mini-avatar {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.placeholder-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-surface);
  font-size: 14px;
}

.mini-vs {
  font-size: 12px;
}

.mini-speaker-names {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-sand);
  margin-left: 4px;
}

.card-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-pure);
  line-height: 1.35;
}

.card-topic {
  font-size: 12px;
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-status-bar {
  display: flex;
  align-items: center;
  margin-top: 4px;
}

.status-indicator {
  font-size: 11px;
  color: var(--text-dim);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}

.status-indicator.live {
  color: var(--gold-primary);
}

.status-indicator.live .dot {
  width: 6px;
  height: 6px;
  background: var(--gold-primary);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--gold-primary);
  animation: pulseDot 1.5s infinite;
}

@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.8); }
}

/* Teaser Card */
.teaser-card {
  opacity: 0.65;
  border-style: dashed;
  cursor: default;
}

.teaser-card:hover {
  transform: none;
  border-color: var(--border-light);
}

.teaser-badge {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-dim);
  background: rgba(255, 255, 255, 0.05);
  padding: 2px 6px;
  border-radius: 4px;
  align-self: flex-start;
}

/* Footer */
.site-footer {
  margin-top: auto;
  border-top: 1px solid var(--border-light);
  background: rgba(7, 8, 12, 0.95);
  padding: 24px;
  text-align: center;
  font-size: 12px;
  color: var(--text-dim);
}

.footer-container {
  max-width: 1440px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* ==========================================================================
   Responsive Adaptations
   ========================================================================== */

@media (max-width: 1024px) {
  .arena-grid {
    grid-template-columns: 1fr;
    gap: 32px;
  }

  .sidebar-column {
    position: static;
  }

  .vs-arena-card {
    grid-template-columns: 120px 1fr 120px;
    padding: 20px 16px;
  }

  .avatar-wrapper {
    width: 100px;
    height: 100px;
  }

  .fighter-name {
    font-size: 14px;
  }
}

@media (max-width: 640px) {
  .vs-arena-card {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .fighter-panel {
    flex-direction: row;
    justify-content: center;
    gap: 16px;
  }

  .avatar-wrapper {
    width: 72px;
    height: 72px;
    margin-bottom: 0;
  }

  .center-audio-stage {
    order: 3;
  }

  .fighter-left { order: 1; }
  .fighter-right { order: 2; }
}
