/* ═══════════════════════════════════════════════
   VIDEO EXPERIENCE — Design System
   Based on hilel.link "Shira Purple" theme
   ═══════════════════════════════════════════════ */

:root {
  --bg-primary: #0a0118;
  --bg-secondary: #130826;
  --bg-card: rgba(28, 6, 52, 0.65);
  --purple: #8504a2;
  --purple-light: #c966e8;
  --purple-dark: #6a0380;
  --accent: #d97af5;
  --gold: #c9a84c;
  --gold-light: #e8d088;
  --text-primary: #fbf8fc;
  --text-secondary: rgba(251, 248, 252, 0.65);
  --text-muted: rgba(251, 248, 252, 0.45);
  --glass-bg: rgba(133, 4, 162, 0.08);
  --glass-border: rgba(201, 102, 232, 0.15);
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-pill: 50px;
  --shadow-purple: 0 8px 32px rgba(133, 4, 162, 0.2), 0 0 60px rgba(133, 4, 162, 0.08);
  --shadow-gold: 0 8px 32px rgba(201, 168, 76, 0.2), 0 0 60px rgba(201, 168, 76, 0.08);
  --shadow-glow: 0 0 50px rgba(201, 102, 232, 0.25), 0 0 100px rgba(201, 102, 232, 0.08);
}

/* ─── Reset ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: 'Noto Sans Hebrew', sans-serif;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  min-height: 100dvh;
  direction: rtl;
}

::selection { background: var(--purple); color: white; }

/* ─── Aurora Background ─── */
.aurora-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.aurora-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
}

.aurora-blob-1 {
  top: 15%;
  left: 25%;
  width: 500px;
  height: 500px;
  background: radial-gradient(ellipse, rgba(133, 4, 162, 0.12) 0%, transparent 65%);
  animation: portalAurora 22s ease-in-out infinite;
}

.aurora-blob-2 {
  bottom: 15%;
  right: 15%;
  width: 400px;
  height: 400px;
  background: radial-gradient(ellipse, rgba(201, 168, 76, 0.06) 0%, transparent 65%);
  animation: portalAurora 28s ease-in-out infinite reverse;
}

.aurora-blob-3 {
  top: 50%;
  left: 50%;
  width: 600px;
  height: 600px;
  transform: translate(-50%, -50%);
  background: radial-gradient(ellipse, rgba(133, 4, 162, 0.06) 0%, transparent 65%);
  animation: portalAurora 35s ease-in-out infinite;
  opacity: 0;
  transition: opacity 2s ease;
}

.aurora-enhanced .aurora-blob-1 {
  background: radial-gradient(ellipse, rgba(133, 4, 162, 0.25) 0%, transparent 65%);
}
.aurora-enhanced .aurora-blob-2 {
  background: radial-gradient(ellipse, rgba(201, 168, 76, 0.15) 0%, transparent 65%);
}
.aurora-enhanced .aurora-blob-3 {
  opacity: 1;
  background: radial-gradient(ellipse, rgba(201, 102, 232, 0.12) 0%, transparent 65%);
}

@keyframes portalAurora {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(30px, -25px) scale(1.04); }
  66% { transform: translate(-20px, 30px) scale(0.96); }
}

/* ─── Stars ─── */
.stars {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 2s ease;
}

.stars.visible { opacity: 1; }

.star {
  position: absolute;
  width: 2px;
  height: 2px;
  background: white;
  border-radius: 50%;
  animation: twinkle var(--dur, 3s) ease-in-out infinite;
  animation-delay: var(--delay, 0s);
}

@keyframes twinkle {
  0%, 100% { opacity: 0.2; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.5); }
}

/* ─── Screens ─── */
.screen {
  position: fixed;
  inset: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.8s ease;
  overflow-y: auto;
}

/* When content overflows, switch from center to start */
.screen > * {
  flex-shrink: 0;
}

.screen.active {
  opacity: 1;
  pointer-events: auto;
}

/* ═══════ FORM SCREEN ═══════ */
.form-container {
  width: min(480px, 90vw);
  padding: 40px 32px;
  background: var(--bg-card);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: var(--shadow-purple);
  text-align: center;
  animation: scaleIn 0.6s ease-out;
}

.form-logo {
  font-size: 48px;
  margin-bottom: 8px;
}

.form-logo-img {
  width: 120px;
  height: auto;
  margin-bottom: 12px;
  opacity: 0.9;
  filter: drop-shadow(0 0 20px rgba(201, 168, 76, 0.15));
}

.form-title {
  font-family: 'Rubik', sans-serif;
  font-size: clamp(1.5rem, 5vw, 2rem);
  background: linear-gradient(135deg, var(--purple-light), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 4px;
}

.form-subtitle {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-bottom: 28px;
}

.field {
  margin-bottom: 16px;
  text-align: right;
}

.field label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.field input[type="text"],
.field select {
  width: 100%;
  padding: 12px 16px;
  background: rgba(10, 1, 24, 0.6);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: 'Noto Sans Hebrew', sans-serif;
  font-size: 1rem;
  outline: none;
  transition: border-color 0.3s, box-shadow 0.3s;
}

.field input:focus,
.field select:focus {
  border-color: var(--purple-light);
  box-shadow: 0 0 0 3px rgba(201, 102, 232, 0.15);
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
}

.gender-row {
  display: flex;
  gap: 12px;
}

.gender-option input { display: none; }

.gender-chip {
  display: inline-block;
  padding: 10px 24px;
  background: rgba(10, 1, 24, 0.6);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: all 0.3s;
  font-size: 0.95rem;
}

.gender-option input:checked + .gender-chip {
  background: rgba(133, 4, 162, 0.3);
  border-color: var(--purple-light);
  box-shadow: 0 0 12px rgba(201, 102, 232, 0.2);
}

/* ─── Gold Button ─── */
.btn-gold {
  display: block;
  width: 100%;
  padding: 14px 24px;
  margin-top: 24px;
  background: linear-gradient(135deg, var(--gold), var(--gold-light));
  color: #1a0a2e;
  border: none;
  border-radius: var(--radius-pill);
  font-family: 'Rubik', sans-serif;
  font-size: 1.1rem;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  box-shadow: var(--shadow-gold);
  animation: pulseGlow 3s ease-in-out infinite;
  transition: transform 0.2s, box-shadow 0.2s;
}

.btn-gold:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 40px rgba(201, 168, 76, 0.4);
}

.btn-gold:active { transform: translateY(0); }

.form-privacy {
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-top: 16px;
}

/* ═══════ PROGRESS BAR ═══════ */
.progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  padding: 0;
}

.btn-mute {
  position: fixed;
  top: 38px;
  left: 12px;
  z-index: 11;
  background: rgba(28, 6, 52, 0.7);
  border: 1px solid var(--glass-border);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  font-size: 1.2rem;
  cursor: pointer;
  backdrop-filter: blur(8px);
  transition: background 0.3s;
  line-height: 1;
  padding: 0;
}

.btn-mute:hover {
  background: rgba(133, 4, 162, 0.3);
}

.progress-fill {
  height: 3px;
  background: linear-gradient(90deg, var(--purple-light), var(--gold));
  width: 0%;
  transition: width 1s ease;
}

.progress-steps {
  display: flex;
  justify-content: center;
  gap: 24px;
  padding: 10px 0;
  background: rgba(10, 1, 24, 0.8);
  backdrop-filter: blur(8px);
}

.progress-step {
  font-size: 0.75rem;
  color: var(--text-muted);
  transition: color 0.5s;
}

.progress-step.active {
  color: var(--gold);
  font-weight: 700;
}

.progress-step.done {
  color: var(--text-secondary);
}

/* ═══════ VIDEO SECTIONS ═══════ */
.video-section {
  position: relative;
  width: 100%;
  min-height: 100%;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 50px 24px 24px;
}

.video-section .section-content {
  margin: auto 0;
}

.section-content {
  position: relative;
  z-index: 2;
  text-align: center;
  max-width: 600px;
  width: 100%;
}

.section-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  letter-spacing: 2px;
  text-transform: uppercase;
  opacity: 0;
  margin-bottom: 12px;
}

.section-greeting {
  font-size: 1.1rem;
  color: var(--text-secondary);
  opacity: 0;
  margin-bottom: 20px;
}

/* ─── Number Reveal ─── */
.number-reveal {
  font-family: 'Rubik', sans-serif;
  font-size: clamp(4rem, 15vw, 7rem);
  line-height: 1;
  background: linear-gradient(135deg, var(--gold), var(--gold-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  opacity: 0;
  transform: scale(0.3);
  transition: none;
  margin: 12px 0;
  filter: drop-shadow(0 0 30px rgba(201, 168, 76, 0.4));
}

.number-reveal.revealed {
  animation: numberReveal 1.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.number-title {
  font-family: 'Rubik', sans-serif;
  font-size: clamp(1.2rem, 4vw, 1.6rem);
  background: linear-gradient(135deg, var(--purple-light), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  opacity: 0;
  margin-bottom: 12px;
}

.number-meaning {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.75;
  opacity: 0;
  max-height: 40vh;
  overflow-y: auto;
  padding: 0 8px;
  scrollbar-width: thin;
  scrollbar-color: var(--purple-dark) transparent;
  text-align: right;
}

.number-meaning p {
  margin-bottom: 12px;
}

.number-meaning p:last-child {
  margin-bottom: 0;
}

.bottom-line-message {
  margin-top: 16px !important;
  padding: 12px 16px;
  background: rgba(201, 168, 76, 0.08);
  border: 1px solid rgba(201, 168, 76, 0.2);
  border-radius: var(--radius-sm);
  color: var(--gold-light);
  font-weight: 500;
  font-size: 0.95rem;
  line-height: 1.6;
}

/* ─── Audio Consent Dialog ─── */
.audio-consent {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 1, 24, 0.85);
  backdrop-filter: blur(8px);
}

.consent-card {
  background: var(--bg-card);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 32px 28px;
  text-align: center;
  max-width: 360px;
  width: 90%;
  box-shadow: var(--shadow-purple);
}

.consent-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.consent-subtitle {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 24px;
}

.consent-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.consent-btn {
  padding: 14px 24px;
  border-radius: var(--radius-pill);
  font-family: 'Noto Sans Hebrew', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: transform 0.2s, box-shadow 0.2s;
}

.consent-btn:hover {
  transform: scale(1.03);
}

.consent-btn-secondary {
  background: transparent;
  border: 1px solid var(--glass-border);
  color: var(--text-secondary);
}

.consent-btn-secondary:hover {
  background: rgba(133, 4, 162, 0.1);
  color: var(--text-primary);
}

/* ─── Karaoke Highlight (all text visible, current sentence lit up) ─── */
.karaoke-line {
  color: var(--text-muted);
  transition: color 0.4s ease, text-shadow 0.4s ease;
  line-height: 1.8;
}

.karaoke-line.highlight {
  color: var(--text-primary);
  text-shadow: 0 0 12px rgba(201, 102, 232, 0.3);
}

.karaoke-line.done {
  color: var(--text-secondary);
  text-shadow: none;
}

/* ─── Reduced Motion (accessibility) ─── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .subtitle-line {
    animation: none;
    opacity: 1;
  }
}

.btn-continue {
  display: inline-block;
  padding: 12px 36px;
  margin-top: 20px;
  background: transparent;
  border: 1px solid var(--gold);
  color: var(--gold);
  border-radius: var(--radius-pill);
  font-family: 'Rubik', sans-serif;
  font-size: 1rem;
  cursor: pointer;
  opacity: 0;
  animation: fadeIn 0.5s ease forwards;
  transition: background 0.3s, color 0.3s, transform 0.2s;
}

.btn-continue:hover {
  background: rgba(201, 168, 76, 0.15);
  transform: translateY(-2px);
}

/* ─── Mandala Rings ─── */
.section-bg {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 1;
}

.mandala-ring {
  position: absolute;
  border-radius: 50%;
  border: 1px solid rgba(201, 102, 232, 0.1);
  opacity: 0;
  transition: opacity 2s ease;
}

.mandala-ring-1 {
  width: min(500px, 90vw);
  height: min(500px, 90vw);
  animation: mandalaRotate 40s linear infinite;
}

.mandala-ring-2 {
  width: min(350px, 65vw);
  height: min(350px, 65vw);
  animation: mandalaRotate 30s linear infinite reverse;
}

.mandala-ring-3 {
  width: min(200px, 40vw);
  height: min(200px, 40vw);
  border-color: rgba(201, 168, 76, 0.08);
  animation: mandalaRotate 20s linear infinite;
}

.video-section.active .mandala-ring { opacity: 1; }

.section-bg-2 .mandala-ring {
  border-color: rgba(201, 168, 76, 0.08);
}

.section-bg-3 .mandala-ring {
  border-color: rgba(232, 100, 124, 0.1);
}

@keyframes mandalaRotate {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* ═══════ INTRO VIDEO SCREEN ═══════ */
.intro-video-container {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
}

.intro-video-container video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.btn-skip-intro {
  position: absolute;
  top: 20px;
  left: 20px;
  padding: 8px 20px;
  font-family: 'Noto Sans Hebrew', sans-serif;
  font-size: 0.85rem;
  color: var(--text-secondary);
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-pill);
  cursor: pointer;
  z-index: 10;
  transition: all 0.3s ease;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.btn-skip-intro:hover {
  background: rgba(0, 0, 0, 0.7);
  color: var(--text-primary);
}

/* ═══════ CTA SCREEN ═══════ */
#screen-cta {
  background: var(--bg-primary);
}

.cta-container {
  position: relative;
  text-align: center;
  max-width: 520px;
  width: 90%;
  padding: 24px 24px;
  margin: auto;
  animation: scaleIn 0.8s ease-out;
}

.cta-glow {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 300px;
  height: 300px;
  background: radial-gradient(ellipse, rgba(201, 168, 76, 0.15) 0%, transparent 70%);
  border-radius: 50%;
  filter: blur(40px);
  pointer-events: none;
}

.cta-eyebrow {
  font-size: 0.9rem;
  color: var(--gold);
  font-weight: 500;
  margin-bottom: 12px;
}

.cta-title {
  font-family: 'Rubik', sans-serif;
  font-size: clamp(1.5rem, 5vw, 2.2rem);
  background: linear-gradient(135deg, var(--purple-light), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 12px;
}

.cta-subtitle {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.8;
  margin-bottom: 28px;
}

.btn-cta {
  font-size: 1.15rem;
  padding: 16px 32px;
}

.cta-secondary {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-top: 20px;
}

.btn-share,
.btn-replay {
  padding: 10px 20px;
  background: transparent;
  border: 1px solid var(--glass-border);
  color: var(--text-secondary);
  border-radius: var(--radius-pill);
  font-family: 'Noto Sans Hebrew', sans-serif;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.3s;
}

.btn-share:hover,
.btn-replay:hover {
  background: var(--glass-bg);
  border-color: var(--purple-light);
  color: var(--text-primary);
}

/* ─── Portal CTA ─── */
.cta-portal {
  margin-top: 28px;
  padding: 20px 24px;
  background: linear-gradient(135deg, rgba(201, 168, 76, 0.1), rgba(201, 168, 76, 0.05));
  border: 1px solid rgba(201, 168, 76, 0.25);
  border-radius: var(--radius-md);
  text-align: center;
}

.portal-text {
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin-bottom: 14px;
  line-height: 1.6;
}

.btn-portal {
  display: inline-block;
  padding: 12px 28px;
  font-family: 'Rubik', sans-serif;
  font-size: 1rem;
  font-weight: 500;
  color: var(--bg-primary);
  background: linear-gradient(135deg, var(--gold), var(--gold-light));
  border: none;
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: all 0.3s ease;
}

.btn-portal:hover {
  box-shadow: 0 4px 20px rgba(201, 168, 76, 0.4);
  transform: translateY(-1px);
}

/* ─── Consultation CTA ─── */
.cta-consult {
  margin-top: 28px;
  padding: 20px 24px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  text-align: center;
}

.consult-text {
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin-bottom: 14px;
  line-height: 1.6;
}

.btn-consult {
  display: inline-block;
  padding: 12px 28px;
  font-family: 'Rubik', sans-serif;
  font-size: 1rem;
  color: var(--text-primary);
  background: linear-gradient(135deg, var(--purple-dark), var(--purple-light));
  border: 1px solid var(--purple-light);
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: all 0.3s ease;
}

.btn-consult:hover {
  background: linear-gradient(135deg, var(--purple-light), #a020c0);
  box-shadow: 0 4px 20px rgba(133, 4, 162, 0.4);
  transform: translateY(-1px);
}

.cta-trust {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-top: 24px;
  flex-wrap: wrap;
}

.cta-trust span {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ═══════ ANIMATIONS ═══════ */
@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes numberReveal {
  0% { opacity: 0; transform: scale(0.3); filter: drop-shadow(0 0 0 transparent); }
  60% { opacity: 1; transform: scale(1.1); filter: drop-shadow(0 0 50px rgba(201, 168, 76, 0.6)); }
  100% { opacity: 1; transform: scale(1); filter: drop-shadow(0 0 30px rgba(201, 168, 76, 0.4)); }
}

@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 4px 24px rgba(201, 168, 76, 0.25); }
  50% { box-shadow: 0 8px 40px rgba(201, 168, 76, 0.55), 0 0 60px rgba(201, 168, 76, 0.15); }
}

@keyframes textReveal {
  from { opacity: 0; transform: translateY(15px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes numberPulse {
  0%, 100% { filter: drop-shadow(0 0 30px rgba(201, 168, 76, 0.4)); }
  50% { filter: drop-shadow(0 0 60px rgba(201, 168, 76, 0.7)); }
}

/* Utility: animate element */
.anim-fade-in { animation: fadeIn 0.8s ease forwards; }
.anim-slide-up { animation: slideUp 0.8s ease forwards; }
.anim-text-reveal { animation: textReveal 0.6s ease forwards; }
.anim-number-pulse { animation: numberPulse 2s ease-in-out infinite; }

/* ═══════ RESPONSIVE ═══════ */
@media (max-width: 600px) {
  .form-container {
    padding: 28px 20px;
    border-radius: var(--radius-md);
  }

  .form-logo { font-size: 36px; }
  .form-logo-img { width: 90px; }

  .field-row { gap: 6px; }

  .field input[type="text"],
  .field select {
    padding: 10px 12px;
    font-size: 0.9rem;
  }

  .gender-chip { padding: 8px 18px; font-size: 0.85rem; }

  .btn-gold { font-size: 1rem; padding: 12px 20px; }

  .progress-steps { gap: 12px; }
  .progress-step { font-size: 0.7rem; }

  .video-section { padding: 50px 16px 16px; }

  .number-meaning {
    font-size: 0.85rem;
    max-height: 35vh;
  }

  .cta-container { padding: 28px 16px; }
  .cta-secondary { flex-direction: column; align-items: center; }
  .cta-trust { flex-direction: column; gap: 6px; }
}

/* ─── Scrollbar for meaning text ─── */
.number-meaning::-webkit-scrollbar { width: 4px; }
.number-meaning::-webkit-scrollbar-track { background: transparent; }
.number-meaning::-webkit-scrollbar-thumb { background: var(--purple-dark); border-radius: 2px; }


/* ═══════════════════════════════════════════════
   ═══  STORY MODE — NEW (engine + choose)       ═══
   ═══════════════════════════════════════════════ */

/* ─── Choose Screen ─── */
.choose-container {
  width: min(960px, 92vw);
  padding: 40px 24px;
  text-align: center;
  margin: auto 0;
}

.choose-title {
  font-family: 'Rubik', sans-serif;
  font-size: clamp(1.6rem, 5vw, 2.4rem);
  background: linear-gradient(135deg, var(--purple-light), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 8px;
}

.choose-subtitle {
  color: var(--text-secondary);
  font-size: 1rem;
  margin-bottom: 32px;
}

.choose-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

@media (max-width: 767px) {
  .choose-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
}

.choose-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 20px 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  backdrop-filter: blur(12px);
  cursor: pointer;
  transition: transform 0.25s ease, border-color 0.3s, box-shadow 0.3s;
  color: var(--text-primary);
  font-family: inherit;
  text-align: center;
}

.choose-card:hover:not(.choose-card-locked) {
  transform: translateY(-4px);
  border-color: var(--purple-light);
  box-shadow: var(--shadow-purple);
}

.choose-card .choose-emoji {
  font-size: 2.4rem;
  line-height: 1;
  margin-bottom: 4px;
  filter: drop-shadow(0 0 12px rgba(201, 168, 76, 0.3));
}

.choose-card .choose-title {
  font-family: 'Rubik', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.choose-card .choose-sub {
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.choose-card .choose-meta {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 6px;
}

.choose-card .choose-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  font-size: 0.68rem;
  padding: 3px 10px;
  border-radius: 50px;
  background: linear-gradient(135deg, var(--gold), var(--gold-light));
  color: #1a0a2e;
  font-weight: 700;
}

.choose-card .choose-lock {
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 0.95rem;
  opacity: 0.5;
}

.choose-card-locked {
  opacity: 0.55;
  cursor: not-allowed;
  filter: saturate(0.55);
}

.choose-card-locked:hover {
  transform: none;
  border-color: var(--glass-border);
}

.choose-hint {
  margin-top: 24px;
  font-size: 0.8rem;
  color: var(--text-muted);
}


/* ─── Generic Story Stage ─── */
#screen-story {
  align-items: flex-start;
  padding-top: 60px;
}

.story-stage {
  position: relative;
  z-index: 2;
  width: min(640px, 92vw);
  min-height: 60vh;
  padding: 20px 24px 40px;
  text-align: center;
  margin: 0 auto;
}

.scene {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

.scene.active {
  opacity: 1;
  transform: translateY(0);
}

.scene .scene-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 12px;
  opacity: 0;
  transition: opacity 0.6s ease;
}

.scene .scene-label.visible { opacity: 1; }

.scene .scene-greeting {
  font-size: 1.1rem;
  color: var(--text-secondary);
  margin-bottom: 20px;
  min-height: 1.5em;
  opacity: 0;
  transition: opacity 0.6s ease;
}

.scene .scene-greeting.visible { opacity: 1; }

/* ─── Story progress bar (new engine) ─── */
#story-progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
}

#story-progress .progress-fill {
  height: 3px;
  background: linear-gradient(90deg, var(--purple-light), var(--gold));
  width: 0%;
  transition: width 1s ease;
}

#story-progress .progress-steps {
  display: flex;
  justify-content: center;
  gap: 24px;
  padding: 10px 0;
  background: rgba(10, 1, 24, 0.8);
  backdrop-filter: blur(8px);
}

#story-progress .progress-step {
  font-size: 0.75rem;
  color: var(--text-muted);
  transition: color 0.5s;
}

#story-progress .progress-step.active { color: var(--gold); font-weight: 700; }
#story-progress .progress-step.done { color: var(--text-secondary); }


/* ─── Gematria animation ─── */
.gematria-stage {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: center;
  gap: 6px;
  margin: 24px 0 16px;
  max-width: 100%;
  direction: rtl;
}

.gematria-letter {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  padding: 6px 4px;
  min-width: 34px;
  border-radius: 8px;
  opacity: 0;
  transform: translateY(12px) scale(0.6);
  transition: opacity 0.6s cubic-bezier(.2,.9,.3,1.3),
              transform 0.6s cubic-bezier(.2,.9,.3,1.3),
              background 0.3s ease,
              box-shadow 0.3s ease;
  background: rgba(133, 4, 162, 0.04);
}

.gematria-letter.lit {
  opacity: 1;
  transform: translateY(0) scale(1);
  background: rgba(201, 168, 76, 0.12);
  box-shadow: 0 0 20px rgba(201, 168, 76, 0.25);
}

.gematria-letter .gl-char {
  font-family: 'Rubik', sans-serif;
  font-size: clamp(1.5rem, 5vw, 2rem);
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.1;
}

.gematria-letter.lit .gl-char {
  background: linear-gradient(135deg, var(--gold), var(--gold-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: 0 0 18px rgba(201, 168, 76, 0.4);
}

.gematria-letter .gl-value {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 500;
  margin-top: 2px;
}

.gematria-letter.lit .gl-value {
  color: var(--gold);
}

.gematria-plus {
  align-self: center;
  color: var(--text-muted);
  font-weight: 300;
  font-size: 0.9rem;
  opacity: 0;
  transition: opacity 0.3s ease;
  padding: 0 2px;
}

.gematria-plus.lit { opacity: 1; color: var(--purple-light); }

.gematria-sum,
.gematria-reduction {
  margin-top: 12px;
  font-family: 'Rubik', sans-serif;
  font-size: 1.2rem;
  color: var(--text-secondary);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.gematria-sum.visible,
.gematria-reduction.visible {
  opacity: 1;
  transform: translateY(0);
}

.gematria-sum strong {
  background: linear-gradient(135deg, var(--gold), var(--gold-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-size: 1.6rem;
}

.gematria-reduction {
  font-size: 0.95rem;
  color: var(--purple-light);
}


/* ─── Chapter reveal (Tehilim) ─── */
.scroll-wrap {
  position: relative;
  display: inline-block;
  margin: 20px auto 16px;
  padding: 30px 40px;
  min-width: 220px;
  min-height: 180px;
  border-radius: 16px;
  background: radial-gradient(ellipse at center, rgba(201, 168, 76, 0.12), transparent 70%);
  animation: scrollOpen 1.2s cubic-bezier(.2,.9,.3,1) both;
}

.scroll-wrap::before,
.scroll-wrap::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  width: 14px;
  border-radius: 7px;
  background: linear-gradient(180deg, var(--gold) 0%, var(--gold-light) 50%, var(--gold) 100%);
  box-shadow: 0 0 20px rgba(201, 168, 76, 0.3);
}

.scroll-wrap::before { right: -6px; }
.scroll-wrap::after { left: -6px; }

@keyframes scrollOpen {
  0% { transform: scaleX(0.1); opacity: 0.2; }
  60% { transform: scaleX(1.05); opacity: 1; }
  100% { transform: scaleX(1); opacity: 1; }
}

.chapter-big {
  font-family: 'Rubik', sans-serif;
  font-size: clamp(4.5rem, 18vw, 8rem);
  line-height: 1;
  background: linear-gradient(135deg, var(--gold), var(--gold-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 0 30px rgba(201, 168, 76, 0.5));
  animation: chapterPulse 2.5s ease-in-out infinite;
}

@keyframes chapterPulse {
  0%, 100% { filter: drop-shadow(0 0 30px rgba(201, 168, 76, 0.45)); }
  50% { filter: drop-shadow(0 0 50px rgba(201, 168, 76, 0.75)); }
}

.chapter-title {
  font-family: 'Rubik', sans-serif;
  font-size: clamp(1.2rem, 4vw, 1.8rem);
  background: linear-gradient(135deg, var(--purple-light), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin: 12px 0 4px;
  opacity: 0;
  transition: opacity 0.8s ease 0.4s;
}

.chapter-title.visible { opacity: 1; }

.chapter-theme {
  color: var(--gold-light);
  font-size: 0.95rem;
  opacity: 0;
  transition: opacity 0.8s ease 0.8s;
}

.chapter-theme.visible { opacity: 1; }


/* ─── Verse karaoke (tehilim verse) ─── */
.verse-wrap {
  margin: 20px auto;
  padding: 18px 20px;
  border-radius: var(--radius-md);
  background: rgba(201, 168, 76, 0.06);
  border: 1px solid rgba(201, 168, 76, 0.18);
  max-width: 540px;
  font-family: 'Rubik', sans-serif;
  font-size: clamp(1.05rem, 3.5vw, 1.3rem);
  line-height: 1.9;
  opacity: 0;
  transition: opacity 0.8s ease;
}

.verse-wrap.visible { opacity: 1; }

.karaoke-line.verse {
  color: var(--text-muted);
  transition: color 0.4s ease, text-shadow 0.4s ease;
}

.karaoke-line.verse.highlight {
  color: var(--gold-light);
  text-shadow: 0 0 20px rgba(201, 168, 76, 0.45);
}

.karaoke-line.verse.done {
  color: var(--text-secondary);
}


/* ─── Bottom line card ─── */
.bottom-line-card {
  margin: 20px auto;
  padding: 22px 24px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(133, 4, 162, 0.15), rgba(201, 168, 76, 0.08));
  border: 1px solid rgba(201, 168, 76, 0.3);
  max-width: 500px;
  animation: scaleIn 0.8s ease-out;
}

.bottom-line-msg {
  font-size: 1.05rem;
  line-height: 1.7;
  color: var(--gold-light);
  font-weight: 500;
}


/* ─── Kavanah input scene ─── */
.kavanah-field {
  width: 100%;
  max-width: 480px;
  min-height: 100px;
  margin: 12px auto 0;
  padding: 14px 16px;
  background: rgba(10, 1, 24, 0.6);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: 'Noto Sans Hebrew', sans-serif;
  font-size: 1rem;
  resize: vertical;
  direction: rtl;
  outline: none;
  transition: border-color 0.3s, box-shadow 0.3s;
  display: block;
}

.kavanah-field:focus {
  border-color: var(--purple-light);
  box-shadow: 0 0 0 3px rgba(201, 102, 232, 0.15);
}

.scene-continue {
  display: inline-block;
  margin-top: 16px;
  width: auto;
  padding: 12px 36px;
}


/* ─── Hilel Built Badge ─── */
.hilel-built-badge {
  position: fixed;
  bottom: 10px;
  right: 10px;
  z-index: 50;
  font-size: 0.7rem;
  color: var(--text-muted);
  text-decoration: none;
  background: rgba(10, 1, 24, 0.6);
  padding: 4px 10px;
  border-radius: 50px;
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(8px);
  transition: color 0.3s, border-color 0.3s;
}

.hilel-built-badge:hover {
  color: var(--gold-light);
  border-color: rgba(201, 168, 76, 0.4);
}

.hilel-built-badge strong { color: var(--gold); }


/* ─── reduced motion accommodations ─── */
@media (prefers-reduced-motion: reduce) {
  .chapter-big { animation: none; }
  .scroll-wrap { animation: none; }
  .gematria-letter { transition: opacity 0.01ms, transform 0.01ms; }
}


/* ─── Mobile polish ─── */
@media (max-width: 767px) {
  .choose-card { padding: 16px 10px 12px; }
  .choose-card .choose-emoji { font-size: 2rem; }
  .choose-card .choose-title { font-size: 0.88rem; }
  .choose-card .choose-sub { font-size: 0.7rem; }

  .story-stage { padding: 20px 16px 40px; }
  .gematria-letter { min-width: 28px; padding: 4px 3px; }
  .gematria-letter .gl-char { font-size: 1.4rem; }
  .gematria-letter .gl-value { font-size: 0.68rem; }

  .scroll-wrap { padding: 24px 28px; min-width: 180px; }
  .chapter-big { font-size: clamp(4rem, 22vw, 6.5rem); }
  .verse-wrap { padding: 14px 16px; font-size: 1rem; }
}


/* ═══════════════════════════════════════════════
   ═══  SCENE CONTROLS & SETTINGS               ═══
   ═══════════════════════════════════════════════ */

/* פדינג תחתון ל-story screen כדי לפנות מקום לסרגל */
#screen-story {
  padding-bottom: 100px;
}

/* ─── סרגל כפתורים מתחת לטקסט ─── */
.scene-controls {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 20;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0));
  background: linear-gradient(180deg, transparent 0%, rgba(10, 1, 24, 0.75) 25%, rgba(10, 1, 24, 0.95) 100%);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--glass-border);
  flex-wrap: wrap;
}

.sc-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 44px;
  min-height: 44px;
  padding: 0 12px;
  background: rgba(28, 6, 52, 0.7);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-pill);
  color: var(--text-primary);
  font-size: 1.15rem;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.25s, border-color 0.25s, transform 0.15s;
}

.sc-btn:hover {
  background: rgba(133, 4, 162, 0.3);
  border-color: var(--purple-light);
}

.sc-btn:active { transform: scale(0.95); }

.sc-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.sc-btn-main {
  background: linear-gradient(135deg, var(--purple-dark), var(--purple));
  border-color: var(--purple-light);
  color: white;
  font-size: 1.3rem;
  min-width: 54px;
  min-height: 54px;
}

.sc-btn-main:hover {
  background: linear-gradient(135deg, var(--purple), var(--purple-light));
}

.sc-btn-text {
  font-size: 0.82rem;
  min-height: 40px;
  padding: 0 14px;
}

.sc-sep {
  width: 1px;
  height: 24px;
  background: var(--glass-border);
  margin: 0 4px;
}

@media (max-width: 600px) {
  .scene-controls { gap: 4px; padding: 10px 8px calc(10px + env(safe-area-inset-bottom, 0)); }
  .sc-btn { min-width: 42px; min-height: 42px; padding: 0 8px; font-size: 1.05rem; }
  .sc-btn-main { min-width: 50px; min-height: 50px; font-size: 1.2rem; }
  .sc-btn-text { font-size: 0.72rem; padding: 0 10px; min-height: 38px; }
  .sc-sep { margin: 0 2px; }

  /* במובייל: הסתרה של טקסט שם/סיפור אחר — הם נגישים ממסך ה-CTA */
  .sc-btn-text { display: none; }
}


/* ─── Font size classes (על ה-story-stage) ─── */
.story-stage.fs-small { font-size: 14px; }
.story-stage.fs-medium { font-size: 16px; }
.story-stage.fs-large { font-size: 19px; }
.story-stage.fs-xl { font-size: 22px; }

.story-stage.fs-small .number-meaning,
.story-stage.fs-small .karaoke-wrap { font-size: 0.85rem; }
.story-stage.fs-medium .number-meaning,
.story-stage.fs-medium .karaoke-wrap { font-size: 0.95rem; }
.story-stage.fs-large .number-meaning,
.story-stage.fs-large .karaoke-wrap { font-size: 1.1rem; line-height: 1.9; }
.story-stage.fs-xl .number-meaning,
.story-stage.fs-xl .karaoke-wrap { font-size: 1.25rem; line-height: 2; }

.story-stage.fs-large .bottom-line-msg,
.story-stage.fs-xl .bottom-line-msg { font-size: 1.15rem; }

.story-stage.fs-large .verse-wrap,
.story-stage.fs-xl .verse-wrap { font-size: 1.4rem; }


/* ─── Settings Popover ─── */
.settings-popover {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(10, 1, 24, 0.78);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.settings-card {
  position: relative;
  width: min(420px, 100%);
  max-height: 85vh;
  overflow-y: auto;
  padding: 28px 24px;
  background: var(--bg-card);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow-purple);
  animation: scaleIn 0.4s ease-out;
}

.settings-close {
  position: absolute;
  top: 10px;
  left: 10px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: transparent;
  border: 1px solid var(--glass-border);
  color: var(--text-secondary);
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.3s, color 0.3s;
}

.settings-close:hover {
  background: rgba(133, 4, 162, 0.2);
  color: var(--text-primary);
}

.settings-title {
  font-family: 'Rubik', sans-serif;
  font-size: 1.3rem;
  background: linear-gradient(135deg, var(--purple-light), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 20px;
  text-align: center;
}

.settings-group {
  margin-bottom: 20px;
}

.settings-label {
  display: block;
  font-size: 0.88rem;
  color: var(--text-secondary);
  margin-bottom: 10px;
  font-weight: 500;
}

.settings-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.settings-chip {
  flex: 1 1 auto;
  min-width: 70px;
  padding: 10px 14px;
  background: rgba(10, 1, 24, 0.6);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-pill);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.25s;
  text-align: center;
}

.settings-chip:hover {
  background: rgba(133, 4, 162, 0.2);
  border-color: var(--purple-light);
}

.settings-chip.active {
  background: linear-gradient(135deg, var(--purple-dark), var(--purple));
  border-color: var(--purple-light);
  color: white;
  box-shadow: 0 0 14px rgba(201, 102, 232, 0.3);
}

.settings-select {
  width: 100%;
  padding: 12px 14px;
  background: rgba(10, 1, 24, 0.6);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.95rem;
  margin-bottom: 10px;
}

.settings-select:focus {
  outline: none;
  border-color: var(--purple-light);
  box-shadow: 0 0 0 3px rgba(201, 102, 232, 0.15);
}

.settings-voice-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.settings-voice-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.settings-footer {
  margin-top: 16px;
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* ElevenLabs specifics */
.settings-slider {
  width: 100%;
  margin: 6px 0 4px;
  accent-color: var(--purple-light);
}

.settings-cache {
  margin-top: 14px;
  padding: 10px 12px;
  background: rgba(10, 1, 24, 0.5);
  border-radius: var(--radius-sm);
  border: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.settings-cache-stat {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin: 0;
  flex: 1;
}

.settings-warning {
  margin-top: 14px;
  padding: 10px 12px;
  background: rgba(201, 168, 76, 0.08);
  border: 1px solid rgba(201, 168, 76, 0.3);
  border-radius: var(--radius-sm);
  font-size: 0.76rem;
  color: var(--gold-light);
  line-height: 1.6;
}

#settings-provider .settings-chip {
  font-size: 0.82rem;
}

#el-api-key {
  font-family: monospace;
  letter-spacing: 0.5px;
}

