/* styles.css : Urithi · L'Arbre à Palabres (Real-Time 3D Storytelling Stage) */

:root {
  --bg-deep: #0b0713;
  --glass-bg: rgba(20, 14, 28, 0.76);
  --glass-bg-strong: rgba(16, 11, 24, 0.9);
  --glass-border: rgba(245, 158, 11, 0.24);
  --glass-border-strong: rgba(251, 191, 36, 0.52);
  --amber-gold: #fbbf24;
  --amber-warm: #f59e0b;
  --terracotta: #ea580c;
  --emerald-sage: #10b981;
  --text-cream: #fef7ea;
  --text-muted: #cbbba0;
  --text-dim: #8e7d67;
  --font-display: "Fraunces", "Georgia", serif;
  --font-sans: "Outfit", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: "JetBrains Mono", monospace;
}

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

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg-deep);
  color: var(--text-cream);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
}

/* Fullscreen 3D Canvas Stage */
#palabre-3d-stage {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 1;
  cursor: grab;
}

#palabre-3d-stage:active {
  cursor: grabbing;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

/* Top Navigation HUD */
.hud-topbar {
  position: fixed;
  top: 12px;
  left: 16px;
  right: 16px;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 16px;
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
  flex-wrap: nowrap;
}

.brand-cluster {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.brand-emblem {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, #f59e0b, #b45309);
  display: grid;
  place-items: center;
  font-size: 1.15rem;
  box-shadow: 0 0 16px rgba(245, 158, 11, 0.35);
}

.brand-titles {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.brand-name {
  font-family: var(--font-display);
  font-size: 1.08rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--amber-gold);
  white-space: nowrap;
}

.brand-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.hud-center-pills {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: nowrap;
  flex: 1 1 auto;
  min-width: 0;
}

.pill-group {
  display: flex;
  align-items: center;
  gap: 3px;
  background: rgba(0, 0, 0, 0.34);
  padding: 3px;
  border-radius: 11px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}

.hud-pill {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid transparent;
  padding: 5px 10px;
  border-radius: 8px;
  font-family: var(--font-sans);
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.hud-pill:hover {
  color: var(--text-cream);
  background: rgba(255, 255, 255, 0.08);
}

.hud-pill.active,
.hud-pill[aria-pressed="true"] {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.28), rgba(234, 88, 12, 0.28));
  color: var(--amber-gold);
  border-color: rgba(251, 191, 36, 0.42);
  box-shadow: 0 2px 10px rgba(245, 158, 11, 0.2);
}

.hud-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.action-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-cream);
  border: 1px solid rgba(255, 255, 255, 0.14);
  padding: 6px 11px;
  border-radius: 10px;
  font-family: var(--font-sans);
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.action-btn:hover {
  border-color: var(--amber-gold);
  background: rgba(245, 158, 11, 0.15);
  transform: translateY(-1px);
}

.action-btn.active {
  background: linear-gradient(135deg, #d97706, #b45309);
  border-color: var(--amber-gold);
  color: #fff;
}

/* Left Catalogue Drawer (24 African Tales) */
.tales-drawer {
  position: fixed;
  top: 86px;
  left: 20px;
  bottom: 24px;
  width: 350px;
  z-index: 18;
  display: flex;
  flex-direction: column;
  background: var(--glass-bg);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.55);
  transition: transform 0.32s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.28s ease;
  overflow: hidden;
}

.tales-drawer.collapsed {
  transform: translateX(-380px);
  opacity: 0;
  pointer-events: none;
}

.drawer-head {
  padding: 16px 16px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.drawer-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.drawer-title {
  font-family: var(--font-display);
  font-size: 1.02rem;
  color: var(--amber-gold);
}

.surprise-btn {
  background: rgba(245, 158, 11, 0.16);
  color: var(--amber-gold);
  border: 1px solid rgba(245, 158, 11, 0.38);
  border-radius: 8px;
  padding: 4px 10px;
  font-size: 0.74rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.surprise-btn:hover {
  background: rgba(245, 158, 11, 0.3);
}

.search-input {
  width: 100%;
  background: rgba(0, 0, 0, 0.36);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-cream);
  padding: 8px 12px;
  border-radius: 10px;
  font-family: var(--font-sans);
  font-size: 0.82rem;
}

.search-input:focus {
  outline: none;
  border-color: var(--amber-gold);
}

.region-filters {
  display: flex;
  gap: 5px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
}

.region-filters::-webkit-scrollbar {
  display: none;
}

.region-chip {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 0.71rem;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.18s ease;
}

.region-chip.active {
  background: var(--amber-warm);
  color: #140d06;
  border-color: var(--amber-gold);
  font-weight: 700;
}

.tales-list {
  flex: 1;
  overflow-y: auto;
  padding: 10px 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tales-list::-webkit-scrollbar {
  width: 5px;
}

.tales-list::-webkit-scrollbar-thumb {
  background: rgba(245, 158, 11, 0.3);
  border-radius: 99px;
}

.tale-card {
  text-align: left;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 11px 13px;
  color: var(--text-cream);
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  gap: 11px;
  align-items: flex-start;
}

.tale-card:hover {
  background: rgba(245, 158, 11, 0.1);
  border-color: rgba(245, 158, 11, 0.35);
  transform: translateX(3px);
}

.tale-card.active {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.22), rgba(180, 83, 9, 0.18));
  border-color: var(--amber-gold);
  box-shadow: 0 6px 20px rgba(245, 158, 11, 0.18);
}

.tale-symbol {
  font-size: 1.45rem;
  line-height: 1;
  padding-top: 2px;
}

.tale-card-body {
  flex: 1;
  min-width: 0;
}

.tale-card-meta {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  color: var(--amber-gold);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 3px;
}

.tale-card-title {
  font-family: var(--font-display);
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-cream);
  margin-bottom: 4px;
}

.tale-card-summary {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.35;
}

/* Right Interactive Village Action Dock */
.village-actions-dock {
  position: fixed;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 18;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.village-btn {
  display: flex;
  align-items: center;
  gap: 9px;
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  color: var(--text-cream);
  padding: 10px 14px;
  border-radius: 14px;
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.4);
  transition: all 0.2s ease;
}

.village-btn:hover {
  border-color: var(--amber-gold);
  background: rgba(245, 158, 11, 0.2);
  transform: translateX(-4px);
}

.village-btn .v-icon {
  font-size: 1.1rem;
}

/* Child Question Floating Bubble */
.child-question-bubble {
  position: fixed;
  top: 94px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 19;
  max-width: 560px;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.22), rgba(15, 23, 42, 0.9));
  backdrop-filter: blur(16px);
  border: 1px solid rgba(52, 211, 153, 0.55);
  border-radius: 16px;
  padding: 12px 20px;
  text-align: center;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
  animation: floatIn 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.child-question-bubble[hidden] {
  display: none;
}

.child-question-prefix {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #6ee7b7;
  display: block;
  margin-bottom: 4px;
}

.child-question-text {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 0.98rem;
  color: #ecfdf5;
}

/* Bottom Storyteller Teleprompter & Playback Console */
.story-console {
  position: fixed;
  bottom: 20px;
  left: 390px;
  right: 20px;
  z-index: 18;
  max-width: 880px;
  margin: 0 auto;
  background: var(--glass-bg-strong);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--glass-border);
  border-radius: 22px;
  padding: 16px 22px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.65);
  transition: left 0.32s cubic-bezier(0.22, 1, 0.36, 1);
}

body.drawer-closed .story-console {
  left: 20px;
}

.console-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.active-tale-info {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.active-tale-tradition {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--amber-gold);
  background: rgba(245, 158, 11, 0.14);
  border: 1px solid rgba(245, 158, 11, 0.35);
  padding: 3px 10px;
  border-radius: 999px;
}

.active-tale-title {
  font-family: var(--font-display);
  font-size: 1.16rem;
  font-weight: 700;
  color: var(--text-cream);
}

.beat-stepper {
  display: flex;
  align-items: center;
  gap: 6px;
}

.beat-dot {
  width: 28px;
  height: 7px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.16);
  border: none;
  cursor: pointer;
  transition: all 0.25s ease;
}

.beat-dot.active {
  width: 42px;
  background: var(--amber-gold);
  box-shadow: 0 0 12px rgba(251, 191, 36, 0.65);
}

.beat-dot.wisdom-dot.active {
  background: var(--emerald-sage);
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.65);
}

.beat-chapter-label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Word-by-word Live Teleprompter */
.teleprompter-box {
  min-height: 74px;
  max-height: 128px;
  overflow-y: auto;
  font-family: var(--font-display);
  font-size: 1.08rem;
  line-height: 1.62;
  color: rgba(254, 247, 234, 0.52);
  padding: 6px 2px;
  margin-bottom: 12px;
}

.teleprompter-box .word {
  transition: color 0.14s ease, text-shadow 0.14s ease;
}

.teleprompter-box .word.spoken {
  color: var(--text-cream);
}

.teleprompter-box .word.current {
  color: var(--amber-gold);
  text-shadow: 0 0 16px rgba(251, 191, 36, 0.65);
  font-weight: 600;
}

/* Highlighted Transmitted Knowledge / Proverb Card */
.wisdom-scroll-card {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.16), rgba(180, 83, 9, 0.12));
  border: 1px solid var(--glass-border-strong);
  border-radius: 14px;
  padding: 12px 16px;
  margin-bottom: 12px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.wisdom-scroll-card[hidden] {
  display: none;
}

.wisdom-icon {
  font-size: 1.5rem;
}

.wisdom-label {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--amber-gold);
  margin-bottom: 3px;
}

.wisdom-proverb {
  font-family: var(--font-display);
  font-size: 1.02rem;
  font-weight: 600;
  color: #fffbeb;
}

/* Playback Controls & 32-Bar Voice Equalizer */
.console-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.transport-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.play-primary-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #140c04;
  border: none;
  padding: 10px 20px;
  border-radius: 12px;
  font-family: var(--font-sans);
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(245, 158, 11, 0.35);
  transition: all 0.2s ease;
}

.play-primary-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 28px rgba(245, 158, 11, 0.5);
}

.icon-step-btn {
  background: rgba(255, 255, 255, 0.07);
  color: var(--text-cream);
  border: 1px solid rgba(255, 255, 255, 0.14);
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.18s ease;
}

.icon-step-btn:hover {
  border-color: var(--amber-gold);
  background: rgba(245, 158, 11, 0.16);
}

.voice-visualizer {
  display: flex;
  align-items: center;
  gap: 3px;
  height: 26px;
}

.eq-bar {
  width: 3px;
  height: 4px;
  border-radius: 99px;
  background: var(--amber-gold);
  opacity: 0.75;
  transition: height 0.06s linear;
}

/* AI Voice Studio Modal (Gemini TTS & ElevenLabs) */
.voice-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(5, 3, 10, 0.72);
  backdrop-filter: blur(10px);
  display: grid;
  place-items: center;
  padding: 20px;
}

.voice-modal-backdrop[hidden] {
  display: none;
}

.voice-modal {
  width: 100%;
  max-width: 540px;
  background: #161021;
  border: 1px solid var(--glass-border-strong);
  border-radius: 22px;
  padding: 24px;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.8);
}

.voice-modal h2 {
  font-family: var(--font-display);
  color: var(--amber-gold);
  font-size: 1.25rem;
  margin-bottom: 8px;
}

.voice-modal p {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 16px;
}

.form-field {
  margin-bottom: 14px;
}

.form-field label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-cream);
  margin-bottom: 5px;
}

.form-field select,
.form-field input {
  width: 100%;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: var(--text-cream);
  padding: 9px 12px;
  border-radius: 10px;
  font-family: var(--font-sans);
  font-size: 0.84rem;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

@keyframes floatIn {
  from {
    opacity: 0;
    transform: translate(-50%, -10px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid var(--amber-gold);
  outline-offset: 2px;
}

/* 10 Floating Story Badges Positioned Directly Above Each Hut Roof (Max 10) */
.hut-labels-layer {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 10;
  pointer-events: none;
  overflow: hidden;
}

.hut-roof-card {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 185px;
  padding: 6px 11px 7px;
  background: rgba(34, 15, 6, 0.88);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1.5px solid rgba(245, 158, 11, 0.55);
  border-radius: 12px;
  color: var(--text-cream);
  cursor: pointer;
  text-align: center;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.65);
  transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  will-change: transform;
}

.hut-roof-card::after {
  content: "";
  position: absolute;
  bottom: -7px;
  left: 50%;
  transform: translateX(-50%);
  border-left: 7px solid transparent;
  border-right: 7px solid transparent;
  border-top: 7px solid rgba(245, 158, 11, 0.75);
}

.hut-roof-card:hover {
  background: rgba(146, 54, 14, 0.95);
  border-color: #fde68a;
  box-shadow: 0 0 22px rgba(251, 191, 36, 0.65);
  z-index: 15;
}

.hut-roof-card.active {
  background: linear-gradient(135deg, rgba(217, 119, 6, 0.96), rgba(154, 52, 18, 0.96));
  border-color: #fef08a;
  box-shadow: 0 0 26px rgba(251, 191, 36, 0.85);
  z-index: 14;
}

.hut-roof-header {
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-mono);
  font-size: 0.63rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--amber-gold);
  margin-bottom: 2px;
}

.hut-roof-card.active .hut-roof-header {
  color: #fef9c3;
}

.hut-roof-title {
  font-family: var(--font-display);
  font-size: 0.77rem;
  font-weight: 600;
  line-height: 1.22;
  color: #fffbeb;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.active-hut-badge {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  color: #1c0d04;
  background: linear-gradient(135deg, #fbbf24, #ea580c);
  padding: 3px 10px;
  border-radius: 999px;
  box-shadow: 0 2px 10px rgba(234, 88, 12, 0.4);
}

@media (max-width: 960px) {
  .tales-drawer {
    width: 300px;
  }
  .story-console {
    left: 20px;
  }
  .village-actions-dock {
    display: none;
  }
  .hud-center-pills {
    display: none;
  }
  .hut-roof-card {
    max-width: 135px;
    padding: 4px 8px;
  }
  .hut-roof-title {
    font-size: 0.68rem;
  }
}

