/* BoloEnglish — Main Stylesheet
   Mobile-first, Light/Dark mode, Parrot Green theme */

@import url('https://fonts.googleapis.com/css2?family=Baloo+2:wght@400;500;600;700;800&family=Noto+Sans+Devanagari:wght@400;500;600;700&display=swap');

:root {
  --green:      #22c55e;
  --green-dark: #16a34a;
  --green-light:#dcfce7;
  --green-soft: #f0fdf4;
  --amber:      #f59e0b;
  --red:        #ef4444;
  --blue:       #3b82f6;
  --purple:     #8b5cf6;
  --bg:         #ffffff;
  --bg2:        #f8fafc;
  --bg3:        #f1f5f9;
  --card:       #ffffff;
  --text:       #0f172a;
  --text2:      #475569;
  --text3:      #94a3b8;
  --border:     #e2e8f0;
  --shadow:     0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md:  0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
  --radius:     12px;
  --radius-sm:  8px;
  --radius-lg:  20px;
  --font:       'Baloo 2', 'Noto Sans Devanagari', sans-serif;
  --transition: all .2s ease;
}

[data-theme="dark"] {
  --bg:         #0f172a;
  --bg2:        #1e293b;
  --bg3:        #334155;
  --card:       #1e293b;
  --text:       #f1f5f9;
  --text2:      #94a3b8;
  --text3:      #64748b;
  --border:     #334155;
  --shadow:     0 1px 3px rgba(0,0,0,.3);
  --shadow-md:  0 4px 6px rgba(0,0,0,.4);
  --green-soft: #052e16;
  --green-light:#14532d;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  transition: background .3s, color .3s;
}

/* ── Typography ── */
h1 { font-size: clamp(1.5rem, 5vw, 2rem); font-weight: 800; }
h2 { font-size: clamp(1.2rem, 4vw, 1.5rem); font-weight: 700; }
h3 { font-size: 1.1rem; font-weight: 600; }
p  { color: var(--text2); }
a  { color: var(--green); text-decoration: none; }

/* ── Layout ── */
.container { max-width: 480px; margin: 0 auto; padding: 0 16px; }
.container-wide { max-width: 960px; margin: 0 auto; padding: 0 16px; }
.page { padding-bottom: 80px; }

/* ── Cards ── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}
.card-flat { background: var(--bg2); border-radius: var(--radius); padding: 16px; }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 24px; border-radius: var(--radius-sm); font-family: var(--font);
  font-size: 1rem; font-weight: 600; cursor: pointer; border: none;
  transition: var(--transition); text-decoration: none; white-space: nowrap;
}
.btn:active { transform: scale(0.97); }
.btn-primary   { background: var(--green); color: #fff; width: 100%; }
.btn-primary:hover { background: var(--green-dark); }
.btn-outline   { background: transparent; color: var(--green); border: 2px solid var(--green); width: 100%; }
.btn-outline:hover { background: var(--green-soft); }
.btn-google    { background: var(--card); color: var(--text); border: 1px solid var(--border); width: 100%; box-shadow: var(--shadow); }
.btn-google:hover { background: var(--bg2); }
.btn-sm { padding: 8px 16px; font-size: .875rem; border-radius: var(--radius-sm); }
.btn-danger { background: var(--red); color: #fff; }
.btn-amber  { background: var(--amber); color: #fff; }

/* ── Top Nav ── */
.topnav {
  position: sticky; top: 0; z-index: 100;
  background: var(--card); border-bottom: 1px solid var(--border);
  padding: 0 16px; height: 56px;
  display: flex; align-items: center; justify-content: space-between;
  box-shadow: var(--shadow);
}
.topnav-brand { display: flex; align-items: center; gap: 8px; font-size: 1.2rem; font-weight: 800; color: var(--green); }
.topnav-brand span { font-size: 1.5rem; }
.topnav-right { display: flex; align-items: center; gap: 12px; }
.topnav-stat  { display: flex; align-items: center; gap: 4px; font-weight: 700; font-size: .9rem; }

/* ── Bottom Nav ── */
.bottomnav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 100;
  background: var(--card); border-top: 1px solid var(--border);
  display: flex; padding: 8px 0 max(8px, env(safe-area-inset-bottom));
  box-shadow: 0 -2px 10px rgba(0,0,0,.08);
}
.bottomnav a {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
  color: var(--text3); font-size: .65rem; font-weight: 600; text-decoration: none;
  padding: 4px 0; transition: var(--transition);
}
.bottomnav a .nav-icon { font-size: 1.4rem; }
.bottomnav a.active, .bottomnav a:hover { color: var(--green); }

/* ── XP / Progress Bar ── */
.xp-bar-wrap { background: var(--bg3); border-radius: 20px; height: 8px; overflow: hidden; }
.xp-bar      { background: var(--green); height: 8px; border-radius: 20px; transition: width .6s ease; }
.xp-bar-sm   { height: 4px; }

/* ── Hearts ── */
.hearts { display: flex; gap: 3px; }
.heart  { font-size: 1.1rem; }
.heart.empty { filter: grayscale(1); opacity: .4; }

/* ── Stats Row ── */
.stats-row { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; margin: 16px 0; }
.stat-box  { background: var(--bg2); border-radius: var(--radius-sm); padding: 12px 8px; text-align: center; }
.stat-num  { font-size: 1.4rem; font-weight: 800; color: var(--green); }
.stat-lbl  { font-size: .7rem; color: var(--text3); font-weight: 600; margin-top: 2px; }

/* ── Emoji Quiz ── */
.quiz-wrap    { padding: 16px 0; }
.quiz-emoji   { font-size: 5rem; text-align: center; display: block; margin: 24px 0; animation: pop .4s ease; }
.quiz-question { font-size: 1.1rem; font-weight: 600; text-align: center; margin-bottom: 8px; }
.quiz-hint    { font-size: .85rem; color: var(--text3); text-align: center; margin-bottom: 24px; }
.quiz-choices { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.choice-btn {
  background: var(--card); border: 2px solid var(--border); border-radius: var(--radius-sm);
  padding: 14px 10px; font-family: var(--font); font-size: .95rem; font-weight: 600;
  cursor: pointer; text-align: center; transition: var(--transition); color: var(--text);
}
.choice-btn:hover { border-color: var(--green); background: var(--green-soft); }
.choice-btn.correct { border-color: var(--green); background: var(--green-light); color: #166534; }
.choice-btn.wrong   { border-color: var(--red); background: #fee2e2; color: #991b1b; animation: shake .3s ease; }

/* ── Word Tiles ── */
.tile-answer { min-height: 48px; display: flex; flex-wrap: wrap; gap: 6px; border-bottom: 2px solid var(--border); padding-bottom: 12px; margin-bottom: 12px; }
.tile-pool   { display: flex; flex-wrap: wrap; gap: 6px; }
.tile {
  background: var(--card); border: 2px solid var(--border); border-radius: var(--radius-sm);
  padding: 8px 14px; font-family: var(--font); font-size: .95rem; font-weight: 600;
  cursor: pointer; transition: var(--transition); color: var(--text);
}
.tile:hover         { border-color: var(--green); }
.tile.in-answer     { background: var(--green-light); border-color: var(--green); color: #166534; }
.tile.used          { opacity: .3; pointer-events: none; }

/* ── Lesson Progress Bar (top) ── */
.lesson-progress { height: 6px; background: var(--bg3); border-radius: 20px; margin-bottom: 16px; }
.lesson-progress-fill { height: 6px; background: var(--green); border-radius: 20px; transition: width .4s ease; }

/* ── Streak ── */
.streak-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: linear-gradient(135deg, #ff6b35, #ff4500);
  color: #fff; border-radius: 20px; padding: 6px 14px;
  font-size: .9rem; font-weight: 800;
}

/* ── Badge / Achievement ── */
.badge-item  { display: flex; align-items: center; gap: 12px; padding: 12px; }
.badge-emoji { font-size: 2rem; }
.badge-info  .badge-name { font-weight: 700; }
.badge-info  .badge-desc { font-size: .8rem; color: var(--text3); }

/* ── Premium card ── */
.plan-card { border: 2px solid var(--border); border-radius: var(--radius); padding: 20px; }
.plan-card.featured { border-color: var(--green); background: var(--green-soft); }
.plan-price { font-size: 2rem; font-weight: 800; color: var(--green); }
.plan-price span { font-size: 1rem; font-weight: 500; color: var(--text2); }
.plan-features { list-style: none; margin: 12px 0; }
.plan-features li { padding: 6px 0; font-size: .9rem; display: flex; align-items: center; gap: 8px; }
.plan-features li::before { content: '✅'; font-size: .8rem; }

/* ── Form inputs ── */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: .85rem; font-weight: 600; margin-bottom: 6px; color: var(--text2); }
.form-input {
  width: 100%; padding: 13px 14px; border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); font-family: var(--font); font-size: 1rem;
  background: var(--card); color: var(--text); transition: var(--transition);
}
.form-input:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px rgba(34,197,94,.15); }
.form-input::placeholder { color: var(--text3); }

/* ── Toast notification ── */
.toast {
  position: fixed; top: 70px; left: 50%; transform: translateX(-50%);
  background: var(--text); color: var(--bg); padding: 10px 20px;
  border-radius: var(--radius-sm); font-weight: 600; font-size: .9rem;
  z-index: 9999; animation: slideDown .3s ease; white-space: nowrap;
}
.toast.success { background: var(--green); }
.toast.error   { background: var(--red); }

/* ── Course map path ── */
.course-map { padding: 16px 0; }
.map-node {
  width: 64px; height: 64px; border-radius: 50%; display: flex;
  align-items: center; justify-content: center; font-size: 1.8rem;
  margin: 0 auto 8px; cursor: pointer; transition: var(--transition);
  box-shadow: var(--shadow-md); border: 3px solid transparent;
}
.map-node.done   { background: var(--green); border-color: var(--green-dark); }
.map-node.active { background: var(--amber); border-color: #d97706; animation: pulse 2s infinite; }
.map-node.locked { background: var(--bg3); filter: grayscale(1); cursor: not-allowed; }
.map-connector   { width: 2px; height: 30px; background: var(--border); margin: 0 auto; }

/* ── Avatar selector ── */
.avatar-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 10px; }
.avatar-opt  {
  aspect-ratio: 1; border-radius: 50%; border: 3px solid var(--border);
  display: flex; align-items: center; justify-content: center; font-size: 1.8rem;
  cursor: pointer; transition: var(--transition); background: var(--bg2);
}
.avatar-opt.selected { border-color: var(--green); background: var(--green-soft); }

/* ── Divider ── */
.divider { display: flex; align-items: center; gap: 12px; margin: 16px 0; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.divider span { font-size: .8rem; color: var(--text3); white-space: nowrap; }

/* ── Section header ── */
.section-hd { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.section-hd h3 { font-size: 1rem; font-weight: 700; }
.section-hd a  { font-size: .8rem; color: var(--green); font-weight: 600; }

/* ── Leaderboard ── */
.lb-row { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: var(--radius-sm); }
.lb-row:hover { background: var(--bg2); }
.lb-rank  { font-size: 1rem; font-weight: 800; min-width: 28px; }
.lb-name  { flex: 1; font-weight: 600; }
.lb-xp    { font-size: .85rem; font-weight: 700; color: var(--green); }
.lb-row.me { background: var(--green-soft); border: 1px solid var(--green-light); }

/* ── Animations ── */
@keyframes pop   { 0%{transform:scale(.6)} 70%{transform:scale(1.1)} 100%{transform:scale(1)} }
@keyframes shake { 0%,100%{transform:translateX(0)} 25%{transform:translateX(-6px)} 75%{transform:translateX(6px)} }
@keyframes pulse { 0%,100%{box-shadow:0 0 0 0 rgba(245,158,11,.4)} 50%{box-shadow:0 0 0 12px rgba(245,158,11,0)} }
@keyframes slideDown { from{opacity:0;transform:translateX(-50%) translateY(-10px)} to{opacity:1;transform:translateX(-50%) translateY(0)} }
@keyframes confettiFall { to{transform:translateY(100vh) rotate(720deg);opacity:0} }
@keyframes fadeIn { from{opacity:0;transform:translateY(8px)} to{opacity:1;transform:translateY(0)} }

.fade-in { animation: fadeIn .4s ease; }

/* ── Dark mode toggle ── */
.theme-toggle {
  width: 40px; height: 22px; border-radius: 11px; background: var(--bg3);
  border: 1.5px solid var(--border); cursor: pointer; position: relative;
  transition: var(--transition);
}
.theme-toggle::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 16px; height: 16px; border-radius: 50%; background: var(--text3);
  transition: var(--transition);
}
[data-theme="dark"] .theme-toggle { background: var(--green); }
[data-theme="dark"] .theme-toggle::after { left: calc(100% - 18px); background: #fff; }

/* ── Responsive ── */
@media (min-width: 480px) {
  .quiz-choices { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 768px) {
  .container { padding: 0 24px; }
  .quiz-emoji { font-size: 6rem; }
}

@keyframes slideUp { from{transform:translateY(100%);opacity:0} to{transform:translateY(0);opacity:1} }
