/* ==========================================================================
   Y3K MARKETS & UNYKORN // NEURAL AUDIO STORYTELLER
   White Liquid Glass 3D Edition — Neural MP3 Masters (Atlas, Orion, Eve)
   ========================================================================== */

#y3k-storyteller {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 10000;
  width: min(420px, calc(100vw - 32px));
  font-family: var(--font-primary, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif);
  color: var(--text-heading, #0f172a);
  pointer-events: none;
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

#y3k-storyteller * {
  box-sizing: border-box;
}

#y3k-storyteller .story-card {
  pointer-events: auto;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.94) 0%, rgba(248, 250, 252, 0.88) 100%);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255, 255, 255, 0.95);
  border-radius: 20px;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.05), 0 20px 48px -10px rgba(15, 23, 42, 0.12), inset 0 2px 0 0 #ffffff, inset 0 -1.5px 2px 0 rgba(15, 23, 42, 0.03);
  padding: 18px 20px 16px;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

#y3k-storyteller.collapsed {
  width: auto;
}

#y3k-storyteller.collapsed .story-card {
  padding: 8px 14px;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 8px 24px rgba(37, 99, 235, 0.15), 0 2px 0 #ffffff;
}

#y3k-storyteller.collapsed .story-body {
  display: none;
}

#y3k-storyteller .story-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

#y3k-storyteller .story-mark {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono, monospace);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-blue, #2563eb);
}

#y3k-storyteller .story-pulse {
  width: 8px;
  height: 8px;
  background: #2563eb;
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(37, 99, 235, 0.8);
}

#y3k-storyteller.playing .story-pulse {
  animation: pulseGlow 1.4s ease-in-out infinite;
}

@keyframes pulseGlow {
  0%, 100% { transform: scale(1); opacity: 0.7; }
  50% { transform: scale(1.35); opacity: 1; filter: drop-shadow(0 0 6px #3b82f6); }
}

#y3k-storyteller .story-toggle-btn {
  background: #ffffff;
  border: 1px solid rgba(203, 213, 225, 0.8);
  color: var(--text-body, #334155);
  font-size: 0.76rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  transition: all 0.2s ease;
}

#y3k-storyteller .story-toggle-btn:hover {
  background: #f8fafc;
  color: var(--accent-blue, #2563eb);
  border-color: var(--accent-blue, #2563eb);
}

/* 3D Neural Voice Selector Tabs */
#y3k-storyteller .story-voices {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin: 14px 0 12px;
}

#y3k-storyteller .voice-tab {
  background: #ffffff;
  border: 1px solid rgba(226, 232, 240, 0.9);
  color: var(--text-body, #334155);
  font-size: 0.84rem;
  font-weight: 700;
  padding: 8px 6px;
  border-radius: 10px;
  cursor: pointer;
  text-align: center;
  box-shadow: 0 2px 5px rgba(15, 23, 42, 0.03), inset 0 1px 0 #ffffff;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

#y3k-storyteller .voice-tab small {
  display: block;
  color: var(--text-muted, #64748b);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  margin-top: 2px;
}

#y3k-storyteller .voice-tab:hover {
  border-color: var(--accent-blue, #2563eb);
  color: var(--accent-blue, #2563eb);
  transform: translateY(-1px);
}

#y3k-storyteller .voice-tab.active {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  border-color: #1d4ed8;
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3), inset 0 1px 1px rgba(255, 255, 255, 0.4);
}

#y3k-storyteller .voice-tab.active small {
  color: rgba(255, 255, 255, 0.85);
}

/* 3D Waveform Visualizer */
#y3k-storyteller .story-wave {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 26px;
  margin: 10px 0 12px;
  background: rgba(241, 245, 249, 0.6);
  border-radius: 8px;
  padding: 3px 8px;
  border: 1px solid rgba(226, 232, 240, 0.6);
}

#y3k-storyteller .story-wave i {
  display: block;
  flex: 1;
  height: 4px;
  background: linear-gradient(180deg, #3b82f6 0%, #2563eb 100%);
  border-radius: 2px;
  opacity: 0.3;
  transition: height 0.15s ease, opacity 0.15s ease;
}

#y3k-storyteller.playing .story-wave i {
  animation: waveBar 1s ease-in-out infinite;
}

#y3k-storyteller.playing .story-wave i:nth-child(2n) { animation-delay: 0.1s; }
#y3k-storyteller.playing .story-wave i:nth-child(3n) { animation-delay: 0.22s; }
#y3k-storyteller.playing .story-wave i:nth-child(4n) { animation-delay: 0.35s; }
#y3k-storyteller.playing .story-wave i:nth-child(5n) { animation-delay: 0.18s; }

@keyframes waveBar {
  0%, 100% { height: 4px; opacity: 0.3; }
  50% { height: 20px; opacity: 1; }
}

/* Track Title & Persona Subtitle */
#y3k-storyteller .story-title {
  font-size: 0.96rem;
  font-weight: 800;
  color: var(--text-heading, #0f172a);
  margin-bottom: 2px;
  line-height: 1.3;
}

#y3k-storyteller .story-persona {
  font-size: 0.78rem;
  color: var(--text-muted, #64748b);
  margin-bottom: 12px;
}

/* 3D Play / Pause Controls & Time */
#y3k-storyteller .story-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

#y3k-storyteller .play-btn {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  border: 1px solid rgba(255, 255, 255, 0.4);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35), 0 2px 0 #1d4ed8, inset 0 1px 1px rgba(255, 255, 255, 0.4);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  flex-shrink: 0;
}

#y3k-storyteller .play-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(37, 99, 235, 0.45), 0 2.5px 0 #1e40af;
}

#y3k-storyteller .play-btn:active {
  transform: translateY(1px);
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.3);
}

#y3k-storyteller .play-btn svg {
  width: 20px;
  height: 20px;
  stroke: #ffffff;
  fill: #ffffff;
}

#y3k-storyteller .story-time-block {
  flex: 1;
}

#y3k-storyteller .story-progress {
  width: 100%;
  height: 5px;
  background: #e2e8f0;
  border-radius: 9999px;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.08);
}

#y3k-storyteller .story-progress::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #2563eb;
  border: 2px solid #ffffff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  cursor: pointer;
  transition: transform 0.15s ease;
}

#y3k-storyteller .story-progress::-webkit-slider-thumb:hover {
  transform: scale(1.25);
}

#y3k-storyteller .story-time-row {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono, monospace);
  font-size: 0.72rem;
  color: var(--text-muted, #64748b);
  margin-top: 4px;
}

#y3k-storyteller .story-error {
  background: rgba(220, 38, 38, 0.1);
  border: 1px solid rgba(220, 38, 38, 0.3);
  color: #b91c1c;
  font-size: 0.76rem;
  padding: 6px 10px;
  border-radius: 6px;
  margin-top: 8px;
}

/* Dual Engine Mode Switcher */
.story-mode-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 12px;
  background: rgba(241, 245, 249, 0.9);
  padding: 4px;
  border-radius: 10px;
  border: 1px solid rgba(226, 232, 240, 0.9);
}

.story-mode-btn {
  background: transparent;
  border: none;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
  color: #64748b;
  transition: all 0.2s ease;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

.story-mode-btn.active {
  background: #ffffff;
  color: #2563eb;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.08);
}

/* 2,500 Donkeys Archive Notice Banner */
.story-archive-notice {
  background: linear-gradient(135deg, rgba(254, 243, 199, 0.85) 0%, rgba(254, 249, 195, 0.9) 100%);
  border: 1px solid rgba(245, 158, 11, 0.4);
  border-radius: 10px;
  padding: 8px 12px;
  margin-bottom: 10px;
  font-size: 0.70rem;
  line-height: 1.35;
  color: #92400e;
}

.story-archive-notice strong {
  display: block;
  font-weight: 800;
  color: #78350f;
  margin-bottom: 2px;
}

/* Live Page Reader Teleprompter */
.story-teleprompter {
  background: #ffffff;
  border: 1px solid rgba(226, 232, 240, 0.9);
  border-radius: 10px;
  padding: 8px 12px;
  margin-bottom: 12px;
  min-height: 48px;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.03);
}

.teleprompter-section {
  font-size: 0.68rem;
  font-weight: 800;
  color: #2563eb;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 2px;
}

.teleprompter-text {
  font-size: 0.75rem;
  line-height: 1.35;
  color: #334155;
  max-height: 52px;
  overflow-y: auto;
}

/* Live Reading Controls & Speed */
.story-tts-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
}

.story-step-btn, .story-speed-btn {
  background: #ffffff;
  border: 1px solid rgba(203, 213, 225, 0.9);
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  color: #475569;
  cursor: pointer;
  transition: all 0.15s ease;
}

.story-step-btn:hover, .story-speed-btn:hover {
  background: #f1f5f9;
  color: #2563eb;
}

.story-reading-highlight {
  outline: 2.5px solid #2563eb !important;
  background: rgba(37, 99, 235, 0.05) !important;
  border-radius: 8px;
  transition: all 0.3s ease;
}

#y3k-storyteller .story-footer-note {
  font-size: 0.68rem;
  color: var(--text-muted, #64748b);
  font-family: var(--font-mono, monospace);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 10px;
  text-align: right;
}

/* ==========================================================================
   INLINE AUDIO BRIEFING BANNER (HERO COMPONENT)
   ========================================================================== */
.hero-audio-briefing {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(248, 250, 252, 0.9) 100%);
  border: 1px solid rgba(226, 232, 240, 0.95);
  border-radius: 9999px;
  padding: 8px 20px 8px 10px;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.04), inset 0 1px 0 #ffffff;
  margin-top: 0.5rem;
  margin-bottom: 2.5rem;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.hero-audio-briefing:hover {
  border-color: rgba(37, 99, 235, 0.4);
  box-shadow: 0 8px 24px rgba(37, 99, 235, 0.12), inset 0 1.5px 0 #ffffff;
  transform: translateY(-2px);
}

.briefing-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--accent-blue-gradient, linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.35);
  flex-shrink: 0;
}

.briefing-btn svg {
  width: 14px;
  height: 14px;
  fill: #ffffff;
}

.briefing-info {
  display: flex;
  flex-direction: column;
  text-align: left;
}

.briefing-label {
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--text-heading, #0f172a);
  line-height: 1.2;
}

.briefing-sub {
  font-size: 0.72rem;
  color: var(--accent-blue, #2563eb);
  font-weight: 600;
}

@media (max-width: 640px) {
  #y3k-storyteller {
    right: 12px;
    bottom: 12px;
  }
}
