/* ═══════════════════════════════════════════════════════════
   SinhalaEase – Main Stylesheet
   ═══════════════════════════════════════════════════════════ */

/* ── CUSTOM FONT ───────────────────────────────────────────── */
@font-face {
  font-family: 'Noto Serif Sinhala';
  src: url('../assets/Fonts/Noto Serif Sinhala.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

/* ── DESIGN TOKENS ─────────────────────────────────────────── */
:root {
  --primary:    #5B4FCF;
  --primary-lt: #7B6FDF;
  --accent:     #FF6B35;
  --accent-lt:  #FF8C5A;
  --success:    #27AE60;
  --danger:     #E74C3C;
  --warn:       #F39C12;
  --bg:         #F4F6FB;
  --surface:    #FFFFFF;
  --surface2:   #EEF0F8;
  --text:       #1A1A2E;
  --text-muted: #6B7280;
  --border:     #E2E6F0;
  --radius:     14px;
  --radius-sm:  8px;
  --shadow:     0 4px 18px rgba(91,79,207,.12);
  --shadow-card:0 2px 10px rgba(0,0,0,.08);
  --font:       'Nunito', 'Segoe UI', sans-serif;
  --sinhala-font: 'Noto Serif Sinhala', 'Iskoola Pota', 'Nirmala UI', serif;
}

/* ── RESET & BASE ───────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}
button { cursor: pointer; font-family: var(--font); border: none; outline: none; }
input  { font-family: var(--font); }
img    { max-width: 100%; display: block; }

/* ── SCREENS ────────────────────────────────────────────────── */
.screen { display: none; min-height: 100vh; padding-bottom: 40px; }
.screen.active { display: block; }

/* ── UTILITY ────────────────────────────────────────────────── */
.hidden { display: none !important; }
.mt10   { margin-top: 10px; }
.flex-center { display:flex; align-items:center; justify-content:center; }

/* ── SCREEN HEADER ──────────────────────────────────────────── */
.screen-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 20px 14px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
}
.screen-header h2 { font-size: 1.25rem; font-weight: 800; flex: 1; }
.back-btn {
  background: var(--surface2);
  color: var(--primary);
  font-weight: 700;
  font-size: .9rem;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  transition: background .2s;
}
.back-btn:hover { background: var(--border); }
.counter {
  background: var(--primary);
  color: #fff;
  font-size: .8rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 20px;
}

/* ═══════════════════════════════════════════════════════════
   HOME SCREEN
   ═══════════════════════════════════════════════════════════ */
#screen-home {
  flex-direction: column;
  background: linear-gradient(150deg, #5B4FCF 0%, #7B6FDF 40%, #F4F6FB 70%);
}
#screen-home.active {
  display: flex;
}
.home-hero {
  padding: 40px 24px 28px;
}
.logo-wrap {
  text-align: center;
  margin-bottom: 28px;
}
.app-logo {
  width: 90px;
  height: 90px;
  margin: 0 auto 12px;
  border-radius: 22px;
  box-shadow: var(--shadow);
}
.app-title {
  font-family: var(--sinhala-font);
  font-size: 2.4rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -1px;
}
.app-title span { color: #FFD700; font-family: var(--font); }
.app-subtitle {
  color: rgba(255,255,255,.82);
  font-size: 1rem;
  margin-top: 6px;
}

/* Stats bar */
.stats-bar {
  display: flex;
  justify-content: center;
  gap: 24px;
  background: rgba(255,255,255,.15);
  backdrop-filter: blur(8px);
  border-radius: var(--radius);
  padding: 14px 20px;
  margin-bottom: 28px;
}
.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  color: #fff;
}
.stat-item span { font-size: 1.6rem; font-weight: 800; line-height: 1; }
.stat-item small { font-size: .72rem; margin-top: 4px; opacity: .85; }

/* Main Nav */
.main-nav {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.nav-btn {
  background: var(--surface);
  color: var(--primary);
  font-weight: 700;
  font-size: .88rem;
  padding: 14px 8px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  transition: transform .15s, box-shadow .15s, background .2s;
  text-align: center;
}
.nav-btn:hover, .nav-btn.active {
  background: var(--primary);
  color: #fff;
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

/* Daily goal bar */
.daily-goal-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  padding: 14px 24px;
  font-size: .88rem;
  font-weight: 700;
  color: var(--text);
  border-top: 1px solid var(--border);
}
.goal-progress-outer {
  flex: 1;
  height: 10px;
  background: var(--surface2);
  border-radius: 20px;
  overflow: hidden;
}
.goal-progress-inner {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 20px;
  transition: width .5s ease;
}

/* ═══════════════════════════════════════════════════════════
   CARD GRID (Lessons & Quiz Topics)
   ═══════════════════════════════════════════════════════════ */
.section-intro {
  padding: 16px 20px 6px;
  font-size: .95rem;
  color: var(--text-muted);
  font-weight: 600;
}
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
  padding: 16px 20px;
}
.topic-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px 14px 16px;
  box-shadow: var(--shadow-card);
  cursor: pointer;
  transition: transform .2s, box-shadow .2s;
  text-align: center;
  border: 2px solid transparent;
  position: relative;
  overflow: hidden;
}
.topic-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
  border-color: var(--primary);
}
.topic-card.completed { border-color: var(--success); }
.topic-card .card-icon  { font-size: 2.4rem; line-height: 1; margin-bottom: 8px; }
.topic-card .card-title { font-weight: 800; font-size: .95rem; color: var(--text); }
.topic-card .card-count { font-size: .78rem; color: var(--text-muted); margin-top: 4px; }
.topic-card .card-badge {
  position: absolute;
  top: 8px; right: 8px;
  background: var(--success);
  color: #fff;
  font-size: .65rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 10px;
}

/* ═══════════════════════════════════════════════════════════
   LESSON DETAIL – WORD LIST
   ═══════════════════════════════════════════════════════════ */
.word-list {
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.word-row {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 12px 16px;
  box-shadow: var(--shadow-card);
  transition: border-color .2s;
  border: 2px solid transparent;
}
.word-row.known { border-color: var(--success); }

/* Updated for Emoji Fallbacks */
.word-thumb-container {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
}
.word-row img.word-thumb {
  width: 100%;
  height: 100%;
  border-radius: var(--radius-sm);
  object-fit: cover;
}
.word-emoji-fallback {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  background: transparent;
  border-radius: var(--radius-sm);
  color: var(--primary);
}

.word-row .word-sinhala {
  font-family: var(--sinhala-font);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--primary);
  line-height: 1.2;
}
.word-row .word-roman   { font-size: .82rem; color: var(--text-muted); }
.word-row .word-english { font-size: .95rem; font-weight: 600; color: var(--text); }
.word-row .word-meta    { flex: 1; }
.word-row .word-audio-btn {
  background: var(--surface2);
  border-radius: 50%;
  width: 36px; height: 36px;
  font-size: 1rem;
  display: flex; align-items: center; justify-content: center;
  transition: background .2s;
  flex-shrink: 0;
}
.word-row .word-audio-btn:hover { background: var(--primary); color: #fff; }
.lesson-actions {
  display: flex;
  gap: 12px;
  padding: 16px 20px;
}

/* ═══════════════════════════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════════════════════════ */
.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-lt));
  color: #fff;
  font-weight: 700;
  padding: 13px 24px;
  border-radius: var(--radius);
  font-size: .95rem;
  box-shadow: 0 4px 14px rgba(91,79,207,.3);
  transition: transform .15s, box-shadow .15s;
  flex: 1;
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(91,79,207,.4); }
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  background: var(--surface2);
  color: var(--primary);
  font-weight: 700;
  padding: 13px 24px;
  border-radius: var(--radius);
  font-size: .95rem;
  border: 2px solid var(--border);
  transition: background .2s;
  flex: 1;
}
.btn-secondary:hover { background: var(--border); }

.btn-danger {
  background: var(--danger);
  color: #fff;
  font-weight: 700;
  padding: 12px 22px;
  border-radius: var(--radius);
  font-size: .9rem;
  width: 100%;
  transition: opacity .2s;
}
.btn-danger:hover { opacity: .85; }

.btn-audio {
  background: var(--surface2);
  color: var(--primary);
  font-weight: 700;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: .9rem;
  margin-top: 14px;
  display: inline-block;
  border: 2px solid var(--border);
  transition: background .2s;
}
.btn-audio:hover { background: var(--primary-lt); color: #fff; }

/* ═══════════════════════════════════════════════════════════
   FLASHCARDS
   ═══════════════════════════════════════════════════════════ */
.flashcard-wrap {
  perspective: 1200px;
  padding: 24px 20px 10px;
  display: flex;
  justify-content: center;
}
.flashcard {
  width: min(100%, 420px);
  height: 300px;
  cursor: pointer;
  position: relative;
}
.flashcard-inner {
  width: 100%;
  height: 100%;
  transition: transform .55s cubic-bezier(.4,2,.55,.8);
  transform-style: preserve-3d;
  position: relative;
}
.flashcard.flipped .flashcard-inner { transform: rotateY(180deg); }

.flashcard-front, .flashcard-back {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  background: var(--surface);
  border-radius: 20px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.flashcard-back { transform: rotateY(180deg); }

.fc-category { font-size: .75rem; text-transform: uppercase; letter-spacing: 1px; color: var(--text-muted); font-weight: 700; margin-bottom: 8px; }
.fc-img { width: 72px; height: 72px; object-fit: contain; margin-bottom: 12px; border-radius: var(--radius-sm); }
.fc-emoji-fallback {
  width: 72px;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  background: transparent;
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  color: var(--primary);
}

.fc-word {
  font-family: var(--sinhala-font);
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--primary);
  text-align: center;
  line-height: 1.2;
}
.fc-romanized { font-size: .9rem; color: var(--text-muted); margin-top: 6px; }
.fc-hint { font-size: .78rem; color: var(--text-muted); margin-top: 14px; font-style: italic; }
.fc-translation { font-size: 1.8rem; font-weight: 800; color: var(--text); text-align: center; }


/* Rating buttons */
.fc-buttons {
  display: flex;
  justify-content: center;
  gap: 14px;
  padding: 16px 20px 6px;
}
.btn-wrong {
  background: #FDEEEC;
  color: var(--danger);
  font-weight: 700;
  padding: 12px 22px;
  border-radius: var(--radius);
  font-size: .9rem;
  border: 2px solid #F5C6C2;
  transition: background .2s;
}
.btn-wrong:hover { background: var(--danger); color: #fff; }
.btn-right {
  background: #EAF8EF;
  color: var(--success);
  font-weight: 700;
  padding: 12px 22px;
  border-radius: var(--radius);
  font-size: .9rem;
  border: 2px solid #B7E8C8;
  transition: background .2s;
}
.btn-right:hover { background: var(--success); color: #fff; }
.btn-skip {
  background: var(--surface2);
  color: var(--text-muted);
  font-weight: 700;
  padding: 12px 18px;
  border-radius: var(--radius);
  font-size: .9rem;
  border: 2px solid var(--border);
}

/* Flashcard progress bar */
.fc-progress-bar-outer {
  height: 6px;
  background: var(--surface2);
  margin: 10px 20px 0;
  border-radius: 20px;
  overflow: hidden;
}
.fc-progress-bar-inner {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 20px;
  transition: width .4s ease;
}

/* ═══════════════════════════════════════════════════════════
   QUIZ
   ═══════════════════════════════════════════════════════════ */
.quiz-picker h3 { padding: 16px 20px 4px; font-size: 1.1rem; }
.quiz-active { padding: 16px 20px; }
.quiz-progress-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  font-weight: 700;
  font-size: .85rem;
  color: var(--text-muted);
}
.quiz-prog-outer { flex:1; height:8px; background:var(--surface2); border-radius:20px; overflow:hidden; }
.quiz-prog-inner  { height:100%; background:linear-gradient(90deg,var(--primary),var(--accent)); border-radius:20px; transition:width .4s; }

.quiz-type-badge {
  display: inline-block;
  background: var(--primary);
  color: #fff;
  font-size: .72rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 14px;
}
.quiz-question-box {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow-card);
  text-align: center;
  margin-bottom: 18px;
}
.quiz-img {
  width: 80px; height: 80px;
  object-fit: contain;
  margin: 0 auto 12px;
  border-radius: var(--radius-sm);
}
.quiz-emoji-fallback {
  width: 80px;
  height: 80px;
  margin: 0 auto 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3.5rem;
  background: transparent;
  border-radius: var(--radius-sm);
  color: var(--primary);
}
.quiz-question {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text);
}
.quiz-subtext { font-size: .88rem; color: var(--text-muted); margin-top: 6px; }

/* Options */
.quiz-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}
.quiz-opt-btn {
  background: var(--surface);
  border: 2.5px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 10px;
  font-weight: 700;
  color: var(--text);
  transition: all .2s;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.quiz-opt-btn:hover:not(:disabled)  { border-color: var(--primary); background: #F0EEFF; }
.quiz-opt-btn.correct { background: #EAF8EF; border-color: var(--success); color: var(--success); }
.quiz-opt-btn.wrong   { background: #FDEEEC; border-color: var(--danger);  color: var(--danger);  }
.quiz-opt-btn:disabled { opacity: .7; cursor: not-allowed; }
.quiz-opt-sinhala {
  font-family: var(--sinhala-font);
  font-size: 1.15rem;
  font-weight: 700;
  color: inherit;
  line-height: 1.3;
}
.quiz-opt-roman {
  font-size: .75rem;
  color: inherit;
  font-weight: 600;
  opacity: 0.7;
}
.quiz-opt-audio {
  font-size: .85rem;
  cursor: pointer;
  margin-top: 2px;
  opacity: 0.7;
  transition: opacity .2s;
}
.quiz-opt-audio:hover {
  opacity: 1;
}

/* Fill in the blank */
.quiz-fill { display:flex; gap:10px; align-items:center; }
.fill-input {
  flex: 1;
  border: 2.5px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: 1rem;
  outline: none;
  transition: border-color .2s;
}
.fill-input:focus { border-color: var(--primary); }

/* Word order */
.worder-answer {
  min-height: 52px;
  background: var(--surface2);
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}
.worder-tiles { display:flex; flex-wrap:wrap; gap:8px; margin-bottom:8px; }
.tile {
  background: var(--surface);
  border: 2px solid var(--primary);
  color: var(--primary);
  font-weight: 700;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: .9rem;
  cursor: pointer;
  transition: all .15s;
  user-select: none;
}
.tile:hover { background: var(--primary); color: #fff; }
.tile.used  { opacity: .35; cursor: not-allowed; pointer-events: none; }

/* Feedback */
.quiz-feedback {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-weight: 700;
  font-size: .95rem;
  margin-top: 10px;
}
.quiz-feedback.correct { background: #EAF8EF; color: var(--success); border: 2px solid var(--success); }
.quiz-feedback.wrong   { background: #FDEEEC; color: var(--danger);  border: 2px solid var(--danger);  }

/* Results */
.quiz-results {
  text-align: center;
  padding: 40px 24px;
}
.result-emoji { font-size: 4rem; margin-bottom: 12px; }
.quiz-results h3 { font-size: 1.6rem; font-weight: 800; margin-bottom: 8px; }
.quiz-results p  { font-size: 1rem; color: var(--text-muted); margin-bottom: 14px; }
.result-xp {
  display: inline-block;
  background: #FFF7E0;
  color: var(--warn);
  font-weight: 800;
  font-size: 1.1rem;
  padding: 8px 20px;
  border-radius: var(--radius);
  margin-bottom: 20px;
}
.quiz-results .btn-primary,
.quiz-results .btn-secondary { display: block; margin: 8px auto; max-width: 280px; flex: unset; }

/* ═══════════════════════════════════════════════════════════
   SRS REVIEW
   ═══════════════════════════════════════════════════════════ */
.srs-info { padding: 30px 24px; text-align: center; }
.srs-info p { font-size: 1.05rem; margin-bottom: 8px; }
.srs-desc { color: var(--text-muted); font-size: .9rem !important; margin-bottom: 24px !important; }
.srs-counter-text { text-align:center; color:var(--text-muted); font-size:.88rem; margin-top:10px; padding: 0 20px; }
.srs-done { text-align: center; padding: 40px 24px; }
.srs-done h3 { font-size: 1.4rem; font-weight: 800; margin: 12px 0 8px; }
.srs-done p  { color: var(--text-muted); margin-bottom: 20px; }

/* ═══════════════════════════════════════════════════════════
   PROGRESS PAGE
   ═══════════════════════════════════════════════════════════ */
.progress-page { padding: 20px; }
.progress-summary-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin-bottom: 24px;
}
.prog-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  box-shadow: var(--shadow-card);
}
.prog-card span { font-size: 2rem; font-weight: 800; color: var(--primary); display: block; }
.prog-card small { font-size: .78rem; color: var(--text-muted); }
.section-subheading { font-size: 1rem; font-weight: 800; color: var(--text); margin-bottom: 12px; margin-top: 6px; }

/* Category progress */
.cat-progress-list { display:flex; flex-direction:column; gap:10px; margin-bottom:24px; }
.cat-prog-row {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow-card);
}
.cat-prog-row .cat-title { font-weight: 700; font-size: .9rem; margin-bottom: 6px; display:flex; justify-content:space-between; }
.cat-bar-outer { height: 8px; background: var(--surface2); border-radius: 20px; overflow: hidden; }
.cat-bar-inner  { height: 100%; background: linear-gradient(90deg, var(--primary), var(--accent)); border-radius: 20px; transition: width .6s ease; }

/* Activity log */
.activity-log { display:flex; flex-direction:column; gap:8px; margin-bottom: 16px; }
.activity-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: .88rem;
  box-shadow: var(--shadow-card);
}
.activity-item .act-icon { font-size: 1.2rem; }
.activity-item .act-text { flex: 1; }
.activity-item .act-time { color: var(--text-muted); font-size: .78rem; }

/* ═══════════════════════════════════════════════════════════
   PHRASEBOOK
   ═══════════════════════════════════════════════════════════ */
.phrasebook-search-bar { padding: 14px 20px 6px; }
.phrasebook-search-bar input {
  width: 100%;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 11px 16px;
  font-size: .95rem;
  outline: none;
  transition: border-color .2s;
}
.phrasebook-search-bar input:focus { border-color: var(--primary); }

.phrase-tabs {
  display: flex;
  gap: 8px;
  padding: 10px 20px;
  overflow-x: auto;
  scrollbar-width: none;
}
.phrase-tabs::-webkit-scrollbar { display: none; }
.phrase-tab-btn {
  background: var(--surface2);
  color: var(--text-muted);
  font-weight: 700;
  font-size: .8rem;
  padding: 7px 14px;
  border-radius: 20px;
  white-space: nowrap;
  border: 2px solid transparent;
  transition: all .2s;
}
.phrase-tab-btn.active,
.phrase-tab-btn:hover { background: var(--primary); color: #fff; }

.phrasebook-list {
  padding: 6px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.phrase-row {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow-card);
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.phrase-text-block { flex: 1; }
.phrase-sinhala {
  font-family: var(--sinhala-font);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--primary);
  line-height: 1.3;
}
.phrase-roman   { font-size: .8rem; color: var(--text-muted); margin-top: 2px; }
.phrase-english { font-size: .92rem; font-weight: 600; color: var(--text); margin-top: 4px; }
.phrase-audio-btn {
  background: var(--surface2);
  border-radius: 50%;
  width: 36px; height: 36px;
  font-size: .9rem;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
  transition: background .2s;
}
.phrase-audio-btn:hover { background: var(--primary); color: #fff; }

/* ═══════════════════════════════════════════════════════════
   CONVERSATIONS
   ═══════════════════════════════════════════════════════════ */
.conversation-lines {
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.conversation-card-media {
  width: 72px;
  height: 72px;
  margin: 0 auto 10px;
}
.conversation-card-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  background: var(--surface);
  border-radius: var(--radius-sm);
}
.conversation-card-emoji-fallback {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: var(--primary);
}
.conversation-scene-media {
  width: 100%;
  max-width: 460px;
  height: 170px;
  align-self: center;
  margin-bottom: 6px;
}
.conversation-scene-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
}
.conversation-scene-emoji-fallback {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3.2rem;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-card);
  color: var(--primary);
}
.dialog-line {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  max-width: 85%;
}
.dialog-line.dialog-left {
  align-self: flex-start;
}
.dialog-line.dialog-right {
  align-self: flex-end;
  flex-direction: row-reverse;
}
.dialog-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--surface2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
  box-shadow: var(--shadow-card);
  overflow: hidden;
}
.dialog-avatar-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.dialog-avatar-emoji-fallback {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}
.dialog-bubble {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 12px 16px;
  box-shadow: var(--shadow-card);
  flex: 1;
}
.dialog-left .dialog-bubble {
  border-top-left-radius: 4px;
}
.dialog-right .dialog-bubble {
  border-top-right-radius: 4px;
  text-align: right;
}
.dialog-speaker {
  font-size: .72rem;
  font-weight: 700;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 4px;
}
.dialog-sinhala {
  font-family: var(--sinhala-font);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--primary);
  line-height: 1.3;
}
.dialog-roman {
  font-size: .78rem;
  color: var(--text-muted);
  margin-top: 2px;
}
.dialog-english {
  font-size: .88rem;
  font-weight: 600;
  color: var(--text);
  margin-top: 4px;
}
.dialog-audio-btn {
  background: var(--surface2);
  border: none;
  border-radius: 50%;
  width: 30px;
  height: 30px;
  font-size: .8rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  margin-top: 6px;
  transition: background .2s;
}
.dialog-audio-btn:hover {
  background: var(--primary);
  color: #fff;
}

/* ═══════════════════════════════════════════════════════════
   ALPHABET
   ═══════════════════════════════════════════════════════════ */
.alphabet-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 12px;
  padding: 12px 20px 30px;
}
.alpha-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 18px 10px 14px;
  box-shadow: var(--shadow-card);
  text-align: center;
  cursor: default;
  transition: transform .2s, box-shadow .2s;
  border: 2px solid transparent;
}
.alpha-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
  border-color: var(--primary);
}
.alpha-char {
  font-family: var(--sinhala-font);
  font-size: 2.6rem;
  font-weight: 700;
  color: var(--primary);
  line-height: 1;
  margin-bottom: 8px;
}
.alpha-roman {
  font-size: .9rem;
  font-weight: 700;
  color: var(--accent);
}
.alpha-name {
  font-size: .72rem;
  color: var(--text-muted);
  margin-top: 4px;
  font-weight: 600;
}
.alpha-audio-btn {
  background: var(--surface2);
  border: none;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  font-size: .85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 8px auto 0;
  cursor: pointer;
  transition: background .2s, transform .15s;
}
.alpha-audio-btn:hover {
  background: var(--primary);
  color: #fff;
  transform: scale(1.1);
}
.alpha-audio-btn:active {
  transform: scale(0.95);
}

/* ═══════════════════════════════════════════════════════════
   ABOUT SECTION
   ═══════════════════════════════════════════════════════════ */
.about-page {
  padding: 30px 24px;
  text-align: center;
}
.about-avatar {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.8rem;
  color: #fff;
  margin: 0 auto 20px;
  box-shadow: var(--shadow);
}
.about-name {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 4px;
}
.about-role {
  font-size: .92rem;
  color: var(--text-muted);
  margin-bottom: 24px;
}
.about-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-card);
  margin-bottom: 16px;
  text-align: left;
}
.about-card h3 {
  font-size: 1rem;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 12px;
}
.about-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: .92rem;
  color: var(--text);
}
.about-row:last-child { border-bottom: none; }
.about-row .about-icon {
  font-size: 1.3rem;
  width: 32px;
  text-align: center;
  flex-shrink: 0;
}
.about-row a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 700;
  word-break: break-all;
}
.about-row a:hover { text-decoration: underline; }
.about-app-info {
  margin-top: 30px;
  padding: 20px;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
}
.about-app-info .app-title-sm {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 6px;
}
.about-app-info .app-title-sm span { color: var(--warn); }
.about-app-info p {
  font-size: .88rem;
  color: var(--text-muted);
  line-height: 1.6;
}
.about-footer {
  margin-top: 30px;
  font-size: .78rem;
  color: var(--text-muted);
}

/* ═══════════════════════════════════════════════════════════
   TOAST NOTIFICATION
   ═══════════════════════════════════════════════════════════ */
.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--text);
  color: #fff;
  padding: 12px 22px;
  border-radius: var(--radius);
  font-weight: 700;
  font-size: .9rem;
  z-index: 9999;
  opacity: 0;
  transition: all .35s ease;
  pointer-events: none;
  white-space: nowrap;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════ */
@media (min-width: 600px) {
  #screen-home, .screen { max-width: 540px; margin: 0 auto; }
  .card-grid { grid-template-columns: repeat(3, 1fr); }
  .quiz-options { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 380px) {
  .app-title { font-size: 1.9rem; }
  .main-nav  { grid-template-columns: repeat(2, 1fr); }
  .fc-word   { font-size: 1.8rem; }
}
