/* ============================================
   Vidya Prototype — Styles
   Based on docs/STYLE_GUIDE.md
   ============================================ */

:root {
  /* Primary Colors */
  --saffron: #E8751A;
  --deep-indigo: #1A237E;
  --lotus-pink: #C2185B;
  --gold-leaf: #D4A017;
  --ivory: #FFF8E7;

  /* Secondary Colors */
  --forest-green: #2E7D32;
  --river-blue: #0277BD;
  --fire-orange: #E65100;
  --twilight-purple: #6A1B9A;
  --earth-brown: #4E342E;

  /* Functional */
  --bg-dark: #0D1117;
  --text-primary: #1a1a1a;
  --text-secondary: #555;
  --text-light: #FFF8E7;
  --correct: #2E7D32;
  --incorrect: #C62828;

  /* Typography */
  --font-devanagari: 'Eczar', serif;
  --font-latin: 'Source Serif 4', Georgia, serif;
  --font-ui: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  /* Spacing */
  --screen-padding: 24px;
  --max-width: 440px;
}

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

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: var(--font-latin);
  background: var(--bg-dark);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
}

#app {
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

#screen-container {
  width: 100%;
  max-width: var(--max-width);
  height: 100%;
  max-height: 100dvh;
  overflow-y: auto;
  overflow-x: hidden;
  position: relative;
  scrollbar-width: none;
}

#screen-container::-webkit-scrollbar {
  display: none;
}

/* ============================================
   Screen Base
   ============================================ */

.screen {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: var(--screen-padding);
  opacity: 0;
  animation: fadeIn 0.6s ease forwards;
}

.screen--dark {
  background: var(--bg-dark);
  color: var(--text-light);
}

.screen--ivory {
  background: var(--ivory);
  color: var(--text-primary);
}

.screen--indigo {
  background: var(--deep-indigo);
  color: var(--text-light);
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInSlow {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes glowPulse {
  0%, 100% { text-shadow: 0 0 20px rgba(212, 160, 23, 0.3); }
  50% { text-shadow: 0 0 40px rgba(212, 160, 23, 0.6); }
}

/* ============================================
   Typography
   ============================================ */

.devanagari {
  font-family: var(--font-devanagari);
}

.devanagari--display {
  font-family: var(--font-devanagari);
  font-size: 2rem;
  font-weight: 600;
  line-height: 1.4;
  color: var(--gold-leaf);
}

.devanagari--large {
  font-family: var(--font-devanagari);
  font-size: 4rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--gold-leaf);
  animation: glowPulse 3s ease-in-out infinite;
}

.iast {
  font-family: var(--font-latin);
  font-style: italic;
  color: var(--text-secondary);
}

.screen--dark .iast {
  color: rgba(255, 248, 231, 0.6);
}

.teaching-text {
  font-family: var(--font-latin);
  font-size: 1.05rem;
  line-height: 1.7;
  margin: 16px 0;
}

.teaching-text em {
  font-style: italic;
}

.section-label {
  font-family: var(--font-ui);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  opacity: 0.5;
  margin-bottom: 8px;
}

h2 {
  font-family: var(--font-latin);
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 12px;
}

h3 {
  font-family: var(--font-latin);
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 8px;
}

/* ============================================
   Buttons
   ============================================ */

.btn {
  display: inline-block;
  padding: 14px 32px;
  border: none;
  border-radius: 12px;
  font-family: var(--font-ui);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
  -webkit-tap-highlight-color: transparent;
}

.btn:active {
  transform: scale(0.97);
}

.btn--primary {
  background: var(--saffron);
  color: white;
}

.btn--primary:hover {
  background: #d06818;
}

.btn--gold {
  background: var(--gold-leaf);
  color: var(--bg-dark);
}

.btn--gold:hover {
  background: #c49515;
}

.btn--ghost {
  background: transparent;
  color: var(--gold-leaf);
  border: 1px solid rgba(212, 160, 23, 0.3);
}

.btn--ghost:hover {
  border-color: var(--gold-leaf);
}

.btn--full {
  display: block;
  width: 100%;
}

.btn--continue {
  margin-top: auto;
  padding-top: 20px;
}

/* ============================================
   Vocabulary Card
   ============================================ */

.vocab-card {
  background: white;
  border-radius: 16px;
  padding: 24px;
  margin: 16px 0;
  box-shadow: 0 2px 16px rgba(0,0,0,0.06);
  border-left: 4px solid var(--gold-leaf);
}

.screen--dark .vocab-card {
  background: rgba(255, 255, 255, 0.06);
  box-shadow: 0 2px 16px rgba(0,0,0,0.2);
}

.vocab-card__word {
  font-family: var(--font-devanagari);
  font-size: 2rem;
  font-weight: 600;
  color: var(--deep-indigo);
}

.screen--dark .vocab-card__word {
  color: var(--gold-leaf);
}

.vocab-card__iast {
  font-family: var(--font-latin);
  font-style: italic;
  font-size: 1.1rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

.screen--dark .vocab-card__iast {
  color: rgba(255, 248, 231, 0.6);
}

.vocab-card__meaning {
  font-size: 1rem;
  margin-top: 8px;
  font-weight: 600;
}

.vocab-card__root {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-top: 8px;
}

.screen--dark .vocab-card__root {
  color: rgba(255, 248, 231, 0.5);
}

.vocab-card__note {
  font-size: 0.95rem;
  line-height: 1.6;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(0,0,0,0.06);
}

.screen--dark .vocab-card__note {
  border-top-color: rgba(255,255,255,0.08);
}

/* ============================================
   Quiz Elements
   ============================================ */

.quiz-prompt {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 16px;
}

.quiz-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 16px 0;
}

.quiz-option {
  padding: 16px;
  border: 2px solid rgba(0,0,0,0.1);
  border-radius: 12px;
  font-family: var(--font-devanagari);
  font-size: 1.3rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  background: white;
  -webkit-tap-highlight-color: transparent;
}

.screen--dark .quiz-option {
  background: rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.12);
  color: var(--text-light);
}

.quiz-option:hover {
  border-color: var(--saffron);
}

.quiz-option--selected {
  border-color: var(--saffron);
  background: rgba(232, 117, 26, 0.08);
}

.quiz-option--correct {
  border-color: var(--correct);
  background: rgba(46, 125, 50, 0.1);
}

.quiz-option--incorrect {
  border-color: var(--incorrect);
  background: rgba(198, 40, 40, 0.08);
  opacity: 0.6;
}

.quiz-feedback {
  font-size: 0.95rem;
  margin-top: 12px;
  padding: 12px 16px;
  border-radius: 8px;
  animation: fadeIn 0.3s ease;
}

.quiz-feedback--correct {
  background: rgba(46, 125, 50, 0.08);
  color: var(--correct);
}

.quiz-feedback--incorrect {
  background: rgba(198, 40, 40, 0.06);
  color: var(--incorrect);
}

/* Matching exercise */
.matching-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 16px 0;
}

.matching-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.matching-term {
  flex: 1;
  padding: 12px;
  background: rgba(26, 35, 126, 0.06);
  border-radius: 8px;
  font-family: var(--font-devanagari);
  font-size: 1.15rem;
  text-align: center;
}

.screen--dark .matching-term {
  background: rgba(255, 255, 255, 0.06);
}

.matching-arrow {
  color: var(--gold-leaf);
  font-size: 1.2rem;
}

.matching-definition {
  flex: 1.5;
  padding: 12px;
  background: rgba(232, 117, 26, 0.06);
  border-radius: 8px;
  font-size: 0.95rem;
  text-align: center;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.2s;
}

.matching-definition--active {
  border-color: var(--saffron);
}

.matching-definition--correct {
  border-color: var(--correct);
  background: rgba(46, 125, 50, 0.08);
}

/* Drag-to-order */
.word-bank {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 16px 0;
  min-height: 52px;
}

.word-chip {
  padding: 10px 18px;
  background: white;
  border: 2px solid rgba(26, 35, 126, 0.15);
  border-radius: 24px;
  font-family: var(--font-devanagari);
  font-size: 1.15rem;
  cursor: pointer;
  transition: all 0.2s;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.screen--dark .word-chip {
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.15);
  color: var(--text-light);
}

.word-chip:hover {
  border-color: var(--saffron);
}

.word-chip--placed {
  background: rgba(232, 117, 26, 0.12);
  border-color: var(--saffron);
}

.word-chip--correct {
  background: rgba(46, 125, 50, 0.12);
  border-color: var(--correct);
}

.drop-zone {
  min-height: 56px;
  border: 2px dashed rgba(0,0,0,0.12);
  border-radius: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px;
  margin: 12px 0;
  transition: all 0.2s;
}

.screen--dark .drop-zone {
  border-color: rgba(255,255,255,0.15);
}

.drop-zone--active {
  border-color: var(--saffron);
  background: rgba(232, 117, 26, 0.04);
}

/* ============================================
   Interest Compass
   ============================================ */

.compass {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 24px 0;
}

.compass-choice {
  padding: 20px 16px;
  border: 2px solid rgba(255,255,255,0.12);
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.25s ease;
  text-align: center;
  -webkit-tap-highlight-color: transparent;
}

.compass-choice:hover {
  border-color: var(--gold-leaf);
}

.compass-choice--selected {
  border-color: var(--gold-leaf);
  background: rgba(212, 160, 23, 0.1);
}

.compass-choice__icon {
  font-size: 2rem;
  margin-bottom: 8px;
}

.compass-choice__label {
  font-size: 0.85rem;
  line-height: 1.4;
  opacity: 0.85;
}

/* ============================================
   Progress Bar
   ============================================ */

.progress-bar {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: var(--max-width);
  height: 3px;
  background: rgba(255,255,255,0.08);
  z-index: 100;
}

.progress-bar__fill {
  height: 100%;
  background: var(--gold-leaf);
  transition: width 0.4s ease;
}

/* ============================================
   Navigation Header
   ============================================ */

.nav-header {
  position: fixed;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 48px);
  max-width: calc(var(--max-width) - 48px);
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 100;
  padding: 8px 0;
}

.nav-back {
  background: none;
  border: none;
  color: var(--text-light);
  font-size: 1.5rem;
  cursor: pointer;
  opacity: 0.6;
  transition: opacity 0.2s;
  padding: 4px;
}

.nav-back:hover {
  opacity: 1;
}

.nav-title {
  font-family: var(--font-ui);
  font-size: 0.8rem;
  opacity: 0.5;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.nav-audio {
  background: none;
  border: none;
  color: var(--text-light);
  font-size: 1.2rem;
  cursor: pointer;
  opacity: 0.6;
  padding: 4px;
}

/* ============================================
   Lesson Complete
   ============================================ */

.completion-stats {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 24px 0;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.stat-label {
  font-size: 0.9rem;
  opacity: 0.6;
}

.stat-value {
  font-weight: 600;
  color: var(--gold-leaf);
}

.jyoti-counter {
  font-size: 1.5rem;
  color: var(--gold-leaf);
  font-weight: 700;
  text-align: center;
  margin: 16px 0;
}

/* Mala beads */
.mala-display {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  justify-content: center;
  margin: 16px 0;
}

.mala-bead {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255,255,255,0.1);
  transition: background 0.3s ease;
}

.mala-bead--filled {
  background: var(--gold-leaf);
}

/* ============================================
   Reflection / Contemplation
   ============================================ */

.reflection {
  text-align: center;
  padding: 40px 0;
}

.reflection__verse {
  font-family: var(--font-devanagari);
  font-size: 1.5rem;
  color: var(--gold-leaf);
  line-height: 1.6;
  margin-bottom: 24px;
}

.reflection__translation {
  font-style: italic;
  font-size: 1.05rem;
  line-height: 1.7;
  opacity: 0;
  animation: fadeInSlow 1.5s ease 2s forwards;
}

.reflection__prompt {
  font-size: 0.9rem;
  opacity: 0;
  margin-top: 32px;
  animation: fadeInSlow 1s ease 5s forwards;
}

/* ============================================
   Map
   ============================================ */

.map-container {
  padding: 20px 0;
}

.map-region {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  margin: 8px 0;
  border-radius: 12px;
  transition: all 0.2s;
}

.map-region--active {
  background: rgba(212, 160, 23, 0.1);
  border: 1px solid rgba(212, 160, 23, 0.3);
  cursor: pointer;
}

.map-region--locked {
  opacity: 0.3;
}

.map-region__icon {
  font-size: 2rem;
  width: 48px;
  text-align: center;
}

.map-region__info {
  flex: 1;
}

.map-region__name {
  font-weight: 600;
  font-size: 0.95rem;
}

.map-region__subtitle {
  font-size: 0.8rem;
  opacity: 0.6;
  margin-top: 2px;
}

/* ============================================
   Audio Placeholder
   ============================================ */

.audio-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 20px;
  background: rgba(255,255,255,0.04);
  color: var(--text-light);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
  margin: 8px 0;
}

.audio-btn:hover {
  background: rgba(255,255,255,0.08);
  border-color: var(--gold-leaf);
}

.screen--ivory .audio-btn {
  border-color: rgba(0,0,0,0.12);
  background: rgba(0,0,0,0.03);
  color: var(--text-primary);
}

/* ============================================
   Delayed elements
   ============================================ */

.delay-1 { animation-delay: 0.3s; opacity: 0; animation-fill-mode: forwards; }
.delay-2 { animation-delay: 0.8s; opacity: 0; animation-fill-mode: forwards; }
.delay-3 { animation-delay: 1.5s; opacity: 0; animation-fill-mode: forwards; }
.delay-4 { animation-delay: 2.5s; opacity: 0; animation-fill-mode: forwards; }
.delay-5 { animation-delay: 4s; opacity: 0; animation-fill-mode: forwards; }

.delay-1, .delay-2, .delay-3, .delay-4, .delay-5 {
  animation-name: fadeIn;
  animation-duration: 0.8s;
}

/* ============================================
   Spacers and utilities
   ============================================ */

.spacer { flex: 1; }
.mt-sm { margin-top: 8px; }
.mt-md { margin-top: 16px; }
.mt-lg { margin-top: 32px; }
.mb-md { margin-bottom: 16px; }
.text-center { text-align: center; }
.text-gold { color: var(--gold-leaf); }
.text-saffron { color: var(--saffron); }
.text-muted { opacity: 0.5; }
.text-sm { font-size: 0.85rem; }

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

@media (min-width: 500px) {
  #screen-container {
    border-left: 1px solid rgba(255,255,255,0.05);
    border-right: 1px solid rgba(255,255,255,0.05);
  }
}
