/* ───────── Gita Verse — temple at dusk ───────── */
:root {
  --bg: #171028;
  --bg-soft: #1f1736;
  --card: #241b3e;
  --card-edge: rgba(240, 178, 80, 0.16);
  --ink: #f3ecdd;
  --ink-dim: #b9aed2;
  --ink-faint: #82759f;
  --gold: #f0b250;
  --gold-bright: #ffd27a;
  --gold-deep: #c98a2e;
  --rose: #e88fb7;
  --teal: #69d2c8;
  --good: #7ed98a;
  --bad: #f08080;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --r: 18px;
  --nav-h: 64px;
  --serif: Georgia, "Noto Serif", "Times New Roman", serif;
  --sans: -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  --deva: "Noto Sans Devanagari", "Nirmala UI", "Mangal", sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { height: 100%; }
body {
  margin: 0; min-height: 100%;
  background:
    radial-gradient(1200px 500px at 80% -10%, rgba(240, 178, 80, 0.10), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(232, 143, 183, 0.08), transparent 60%),
    var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  line-height: 1.5;
  user-select: none;
}
#app { max-width: 560px; margin: 0 auto; min-height: 100vh; position: relative; }
.screen {
  padding: 18px 18px calc(var(--nav-h) + 28px);
  animation: fadein 0.25s ease;
}
@keyframes fadein { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

h1, h2, h3 { font-weight: 650; margin: 0 0 8px; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.15rem; }
p { margin: 0 0 10px; }
a { color: var(--gold-bright); text-decoration: none; }
.dim { color: var(--ink-dim); }
.faint { color: var(--ink-faint); font-size: 0.85rem; }
.center { text-align: center; }
.spacer { height: 14px; }

/* ── cards & buttons ── */
.card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.025), transparent 55%), var(--card);
  border: 1px solid var(--card-edge);
  border-radius: var(--r);
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: linear-gradient(180deg, var(--gold-bright), var(--gold));
  color: #3a250a; font-weight: 700; font-size: 1rem;
  border: 0; border-radius: 14px; padding: 13px 20px;
  cursor: pointer; width: 100%;
  box-shadow: 0 6px 18px rgba(240, 178, 80, 0.25);
  transition: transform 0.08s ease, filter 0.15s;
  font-family: var(--sans);
}
.btn:active { transform: scale(0.97); }
.btn.secondary {
  background: var(--bg-soft); color: var(--ink);
  border: 1px solid var(--card-edge); box-shadow: none;
}
.btn.ghost { background: transparent; color: var(--gold-bright); box-shadow: none; border: 1px dashed var(--card-edge); }
.btn.small { width: auto; padding: 9px 14px; font-size: 0.9rem; border-radius: 11px; }
.btn:disabled { opacity: 0.45; pointer-events: none; }
.btnrow { display: flex; gap: 10px; }
.btnrow .btn { flex: 1; }

.chip {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.04em;
  background: var(--bg-soft); color: var(--ink-dim); border: 1px solid var(--card-edge);
}
.chip.new { color: var(--teal); }
.chip.learning { color: var(--gold-bright); }
.chip.due { color: var(--rose); }
.chip.known { color: var(--good); }

/* ── top bar ── */
.topbar { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.topbar .back {
  flex: 0 0 auto; width: 38px; height: 38px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-soft); border: 1px solid var(--card-edge); color: var(--ink);
  font-size: 1.2rem; cursor: pointer;
}
.topbar .title { flex: 1; }
.topbar .title h1 { font-size: 1.15rem; margin: 0; }
.topbar .title .faint { margin: 0; }

/* ── home ── */
.hero { text-align: center; padding: 26px 16px 18px; }
.hero .om {
  font-family: var(--deva); font-size: 2.6rem; color: var(--gold);
  text-shadow: 0 0 30px rgba(240, 178, 80, 0.45);
  display: block; margin-bottom: 4px;
}
.hero h1 { font-family: var(--serif); letter-spacing: 0.02em; }
.statrow { display: flex; gap: 10px; margin-bottom: 14px; }
.stat {
  flex: 1; text-align: center; padding: 12px 6px;
  background: var(--card); border: 1px solid var(--card-edge); border-radius: var(--r);
}
.stat b { display: block; font-size: 1.3rem; color: var(--gold-bright); }
.stat span { font-size: 0.72rem; color: var(--ink-dim); letter-spacing: 0.05em; text-transform: uppercase; }
.ringwrap { display: flex; align-items: center; gap: 16px; }
.ring { flex: 0 0 auto; }
.ring svg { display: block; }
.ring .pct { font-size: 1.05rem; font-weight: 800; fill: var(--gold-bright); }
.ring .lbl { font-size: 0.5rem; fill: var(--ink-dim); letter-spacing: 0.08em; }
.xpbar { height: 8px; border-radius: 99px; background: var(--bg-soft); overflow: hidden; margin-top: 6px; }
.xpbar i { display: block; height: 100%; background: linear-gradient(90deg, var(--gold-deep), var(--gold-bright)); border-radius: 99px; }

/* ── verse list ── */
.vrow {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 14px; margin-bottom: 10px;
  background: var(--card); border: 1px solid var(--card-edge); border-radius: 15px;
  cursor: pointer; transition: border-color 0.15s;
}
.vrow:active { border-color: var(--gold); }
.vrow .num {
  flex: 0 0 44px; height: 44px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-soft); color: var(--gold-bright); font-weight: 800; font-size: 0.85rem;
}
.vrow .mid { flex: 1; min-width: 0; }
.vrow .inc {
  font-family: var(--serif); font-size: 0.98rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.stars { font-size: 0.78rem; letter-spacing: 1.5px; color: var(--gold); }
.stars .off { color: #4a3f68; }

/* ── verse screen ── */
.versecard { text-align: center; padding: 22px 14px; }
.uvaca { color: var(--rose); font-style: italic; font-family: var(--serif); margin-bottom: 10px; font-size: 1rem; }
.deva-line { font-family: var(--deva); font-size: 1.25rem; color: var(--gold-bright); margin: 2px 0 10px; line-height: 1.9; }
.pada { font-family: var(--serif); font-size: 1.32rem; line-height: 1.75; margin: 3px 0; }
.pada .w { cursor: pointer; border-radius: 6px; padding: 1px 3px; transition: background 0.15s; }
.pada .w:active, .pada .w.hl { background: rgba(240, 178, 80, 0.22); color: var(--gold-bright); }
.transl { font-size: 0.98rem; color: var(--ink-dim); line-height: 1.6; }
.wbw { margin-top: 6px; }
.wbw-item {
  display: flex; gap: 10px; padding: 9px 4px; cursor: pointer;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05); align-items: baseline;
}
.wbw-item .w { font-family: var(--serif); font-size: 1.02rem; color: var(--gold-bright); flex: 0 0 38%; }
.wbw-item .m { color: var(--ink-dim); font-size: 0.9rem; }

/* ── bottom sheet ── */
.sheet { position: fixed; inset: 0; z-index: 50; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(8, 5, 18, 0.6); backdrop-filter: blur(2px); }
.sheet-panel {
  position: absolute; left: 0; right: 0; bottom: 0;
  max-width: 560px; margin: 0 auto; max-height: 78vh; overflow-y: auto;
  background: var(--bg-soft); border: 1px solid var(--card-edge); border-bottom: 0;
  border-radius: 22px 22px 0 0; padding: 20px 20px 30px;
  animation: sheetup 0.22s ease;
}
@keyframes sheetup { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet-handle { width: 40px; height: 4px; border-radius: 99px; background: var(--ink-faint); margin: -6px auto 14px; }
.rootword { font-family: var(--serif); font-size: 1.5rem; color: var(--gold-bright); }
.rootline { margin: 10px 0; padding: 10px 12px; background: var(--card); border-radius: 12px; border: 1px solid var(--card-edge); }
.rootline .k { font-size: 0.68rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-faint); display: block; margin-bottom: 2px; }
.rootline .v { font-size: 0.95rem; }
.rootnote { font-size: 0.92rem; color: var(--ink-dim); font-style: italic; line-height: 1.55; padding: 4px 2px; }

/* ── memorize / reveal ── */
.stagebar { display: flex; gap: 6px; margin-bottom: 14px; }
.stagebar i { flex: 1; height: 5px; border-radius: 99px; background: var(--bg-soft); }
.stagebar i.on { background: var(--gold); }
.hintword { letter-spacing: 0.02em; }
.bigprompt { font-size: 1.05rem; color: var(--ink-dim); text-align: center; margin: 12px 0; }
.gradegrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.grade { border: 0; border-radius: 13px; padding: 12px 4px; font-weight: 800; font-size: 0.86rem; cursor: pointer; color: #21142e; font-family: var(--sans); }
.grade small { display: block; font-weight: 600; font-size: 0.66rem; opacity: 0.75; }
.grade.again { background: #f08080; }
.grade.hard { background: #f0b250; }
.grade.good { background: #7ed98a; }
.grade.easy { background: #69d2c8; }
.grade:active { transform: scale(0.96); }

/* ── games ── */
.gamegrid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.gamecard {
  background: var(--card); border: 1px solid var(--card-edge); border-radius: var(--r);
  padding: 16px 14px; text-align: center; cursor: pointer; transition: border-color 0.15s;
}
.gamecard:active { border-color: var(--gold); }
.gamecard .ico { font-size: 1.7rem; display: block; margin-bottom: 6px; }
.gamecard b { display: block; font-size: 0.95rem; }
.gamecard span { font-size: 0.76rem; color: var(--ink-dim); }

.slotline { display: flex; flex-wrap: wrap; gap: 7px; justify-content: center; min-height: 44px; margin-bottom: 8px; }
.slot {
  min-width: 54px; padding: 9px 12px; border-radius: 11px; text-align: center;
  border: 1.5px dashed var(--card-edge); color: var(--ink-faint);
  font-family: var(--serif); font-size: 1.05rem;
}
.slot.filled { border-style: solid; border-color: var(--gold-deep); color: var(--gold-bright); background: rgba(240, 178, 80, 0.08); }
.tiles { display: flex; flex-wrap: wrap; gap: 9px; justify-content: center; margin-top: 16px; }
.tile {
  padding: 11px 15px; border-radius: 12px; cursor: pointer;
  background: var(--bg-soft); border: 1px solid var(--card-edge);
  font-family: var(--serif); font-size: 1.08rem; color: var(--ink);
  transition: transform 0.1s, opacity 0.2s, border-color 0.15s;
}
.tile:active { transform: scale(0.94); }
.tile.used { opacity: 0; pointer-events: none; transform: scale(0.6); }
.tile.wrong { animation: shake 0.3s; border-color: var(--bad); }
@keyframes shake { 20% { transform: translateX(-5px); } 50% { transform: translateX(5px); } 80% { transform: translateX(-3px); } }

.mcq { display: flex; flex-direction: column; gap: 9px; margin-top: 14px; }
.mcq .opt {
  padding: 13px 16px; border-radius: 13px; cursor: pointer; text-align: center;
  background: var(--bg-soft); border: 1px solid var(--card-edge);
  font-family: var(--serif); font-size: 1.1rem;
}
.mcq .opt.right { border-color: var(--good); background: rgba(126, 217, 138, 0.13); }
.mcq .opt.wrongpick { border-color: var(--bad); background: rgba(240, 128, 128, 0.13); animation: shake 0.3s; }
.gapword { color: var(--gold-bright); border-bottom: 2px dashed var(--gold-deep); padding: 0 6px; }

.pairgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 10px; }
.pair {
  padding: 12px 10px; border-radius: 12px; cursor: pointer; text-align: center;
  background: var(--bg-soft); border: 1px solid var(--card-edge); font-size: 0.92rem;
  min-height: 52px; display: flex; align-items: center; justify-content: center;
  transition: opacity 0.25s, border-color 0.15s;
}
.pair.sk { font-family: var(--serif); font-size: 1.05rem; color: var(--gold-bright); }
.pair.sel { border-color: var(--gold); background: rgba(240, 178, 80, 0.12); }
.pair.done { opacity: 0.28; pointer-events: none; border-color: var(--good); }
.pair.wrong { animation: shake 0.3s; border-color: var(--bad); }

.revealgrid { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.rword {
  padding: 9px 13px; border-radius: 11px; cursor: pointer;
  background: var(--bg-soft); border: 1px solid var(--card-edge);
  font-family: var(--serif); font-size: 1.07rem; color: var(--ink-faint);
}
.rword.shown { color: var(--gold-bright); border-color: var(--gold-deep); }

/* ── results / celebration ── */
.bigscore { text-align: center; padding: 24px 10px; }
.bigscore .glyph { font-size: 3rem; display: block; margin-bottom: 6px; }
.bigscore b { font-size: 1.8rem; color: var(--gold-bright); }
.sparkle { animation: pop 0.5s ease; }
@keyframes pop { 0% { transform: scale(0.6); opacity: 0; } 70% { transform: scale(1.08); } 100% { transform: scale(1); opacity: 1; } }

/* ── badges ── */
.badgegrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.badgecell { text-align: center; padding: 12px 6px; background: var(--card); border: 1px solid var(--card-edge); border-radius: 14px; }
.badgecell .ico { font-size: 1.6rem; display: block; }
.badgecell b { font-size: 0.72rem; display: block; margin-top: 4px; }
.badgecell.locked { opacity: 0.3; filter: grayscale(1); }
.streakcal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; margin-top: 8px; }
.daycell { aspect-ratio: 1; border-radius: 7px; background: var(--bg-soft); display: flex; align-items: center; justify-content: center; font-size: 0.62rem; color: var(--ink-faint); }
.daycell.lit { background: linear-gradient(180deg, var(--gold-bright), var(--gold-deep)); color: #3a250a; font-weight: 700; }

/* ── settings ── */
.setrow { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 2px; border-bottom: 1px solid rgba(255,255,255,0.05); }
.switch { position: relative; width: 48px; height: 28px; flex: 0 0 auto; }
.switch input { opacity: 0; width: 100%; height: 100%; position: absolute; margin: 0; cursor: pointer; z-index: 2; }
.switch i { position: absolute; inset: 0; border-radius: 99px; background: var(--bg-soft); border: 1px solid var(--card-edge); transition: background 0.2s; }
.switch i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--ink-dim); transition: transform 0.2s, background 0.2s; }
.switch input:checked + i { background: var(--gold-deep); }
.switch input:checked + i::after { transform: translateX(20px); background: #fff7e8; }
select, input[type="range"] { accent-color: var(--gold); }
select { background: var(--bg-soft); color: var(--ink); border: 1px solid var(--card-edge); border-radius: 10px; padding: 8px 10px; font-size: 0.9rem; max-width: 56%; }

/* ── bottom nav ── */
.bottomnav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 40;
  max-width: 560px; margin: 0 auto; height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: flex; background: rgba(23, 16, 40, 0.92); backdrop-filter: blur(14px);
  border-top: 1px solid var(--card-edge);
}
.nav-item {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--ink-faint); font-size: 0.66rem; font-weight: 600; position: relative;
}
.nav-item svg { width: 23px; height: 23px; fill: currentColor; }
.nav-item.active { color: var(--gold-bright); }
.nav-item .badge {
  position: absolute; top: 7px; right: calc(50% - 21px);
  background: var(--rose); color: #2b0f1e; font-size: 0.62rem; font-weight: 800;
  min-width: 17px; height: 17px; border-radius: 99px;
  display: flex; align-items: center; justify-content: center; padding: 0 4px;
}
.nav-item .badge[hidden] { display: none; }

/* ── toast ── */
.toast {
  position: fixed; bottom: calc(var(--nav-h) + 18px); left: 50%; transform: translateX(-50%);
  background: var(--gold-bright); color: #3a250a; font-weight: 700; font-size: 0.9rem;
  padding: 11px 20px; border-radius: 99px; z-index: 60;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4); white-space: nowrap;
  animation: toastin 0.25s ease;
}
@keyframes toastin { from { transform: translate(-50%, 14px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }

@media (min-width: 480px) {
  .pada { font-size: 1.42rem; }
}
