/* ItihasaCards — visual design
   Palette: deep maroon, saffron, temple gold, warm cream. */

:root {
  --bg-top: #fdf3e1;
  --bg-bottom: #f6d49b;
  --ink: #2b1a12;
  --ink-soft: #6e5643;
  --ink-faint: #9b8571;
  --maroon: #5a1626;
  --maroon-2: #7d2233;
  --saffron: #e0741f;
  --saffron-2: #c45f12;
  --gold: #c99a2e;
  --gold-soft: #f1dca0;
  --cream: #fffaf1;
  --line: #ead7b8;
  --green: #2c8a52;
  --green-bg: #e7f5ec;
  --red: #c2413a;
  --red-bg: #fbe9e7;
  --common: #8d99a6;
  --rare: #2f6fbf;
  --legendary: #c99a2e;
  --radius: 16px;
  --radius-lg: 22px;
  --shadow-sm: 0 1px 2px rgba(60, 25, 10, 0.08), 0 2px 6px rgba(60, 25, 10, 0.06);
  --shadow: 0 2px 4px rgba(60, 25, 10, 0.06), 0 10px 28px rgba(60, 25, 10, 0.12);
  --font-display: "Yatra One", "Mukta Malar", "Mukta", "Nirmala UI", serif;
  --font-body: "Mukta", "Mukta Malar", "Nirmala UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }

body {
  min-height: 100vh;
  font-family: var(--font-body);
  font-size: 17px;
  color: var(--ink);
  background: linear-gradient(180deg, var(--bg-top) 0%, var(--bg-bottom) 100%) fixed;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body.lang-ta { font-family: "Mukta Malar", "Nirmala UI", system-ui, sans-serif; font-size: 16px; }

button { font: inherit; cursor: pointer; border: none; background: none; color: inherit; }
button:focus-visible, [data-stop]:focus-visible { outline: 3px solid var(--saffron); outline-offset: 3px; }

.icon { width: 1.1em; height: 1.1em; flex: none; vertical-align: -0.16em; }

/* Faint silhouette of Rama, Lakshmana, Sita, Garuda and Hanuman behind every page */
#backdrop {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: min(42vh, 360px);
  color: var(--maroon);
  opacity: 0.075;
  pointer-events: none;
  z-index: 0;
}

#backdrop svg { width: 100%; height: 100%; display: block; }

main {
  position: relative;
  z-index: 1;
  max-width: 920px;
  margin: 0 auto;
  padding: 0 16px 56px;
}

/* ── Top bar ─────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin: 0 -16px 20px;
  padding: 10px 16px;
  background: rgba(255, 250, 241, 0.82);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(201, 154, 46, 0.25);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-size: 1.45rem;
  color: var(--maroon);
  line-height: 1;
}

.brand .icon { width: 26px; height: 26px; color: var(--saffron); }
.brand span span { color: var(--saffron-2); }

.langs {
  display: inline-flex;
  padding: 3px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
}

.lang-btn {
  padding: 3px 14px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--ink-soft);
}

.lang-btn[aria-pressed="true"] { background: var(--maroon); color: #fff; }

/* ── Buttons ─────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 50px;
  padding: 10px 22px;
  border-radius: 14px;
  font-weight: 700;
  font-size: 1.05rem;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}

.btn:active { transform: translateY(1px) scale(0.99); }

.btn-primary {
  background: linear-gradient(180deg, #ea8a35, var(--saffron-2));
  color: #fff;
  box-shadow: 0 2px 0 #9c4a0c, 0 8px 18px rgba(196, 95, 18, 0.3);
}

.btn-primary:hover { background: linear-gradient(180deg, #f0974a, #cf6816); }

.btn-secondary {
  background: #fff;
  color: var(--maroon);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}

.btn-secondary:hover { border-color: var(--gold); }
.btn-small { min-height: 38px; padding: 6px 14px; font-size: 0.95rem; border-radius: 10px; }
.btn:disabled { opacity: 0.45; cursor: default; }

.link-btn { color: var(--ink-faint); text-decoration: underline; padding: 4px; font-size: 0.9rem; }

/* ── Home ────────────────────────────── */
.hero {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
  background: #3d1029;
}

.hero-art { display: block; width: 100%; height: clamp(190px, 38vw, 330px); }
.hero-figures { filter: drop-shadow(0 0 5px rgba(255, 214, 140, 0.55)); }

.hero-title {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  padding: 18px 22px;
  color: #fff;
  text-shadow: 0 2px 12px rgba(30, 5, 15, 0.6);
}

.hero-title h1 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(2rem, 6vw, 3.2rem);
  line-height: 1;
  letter-spacing: 0.5px;
}

.hero-title h1 span { color: #ffd27a; }
.hero-title p { margin: 6px 0 0; font-size: clamp(0.95rem, 2.4vw, 1.15rem); opacity: 0.95; }

.journey-card {
  position: relative;
  margin: 16px 0 0;
  background: var(--cream);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 18px;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 16px;
  align-items: center;
}

.level-medal {
  grid-row: span 3;
  display: grid;
  place-items: center;
  width: 74px;
  height: 74px;
  border-radius: 50%;
  font-size: 2.2rem;
  background: radial-gradient(circle at 35% 30%, #fff6dc, var(--gold-soft) 60%, var(--gold));
  border: 3px solid #fff;
  box-shadow: 0 0 0 2px var(--gold), var(--shadow-sm);
}

.eyebrow {
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--saffron-2);
}

.lang-ta .eyebrow, .lang-hi .eyebrow { letter-spacing: 0; text-transform: none; font-size: 0.85rem; }

.journey-card h2 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.45rem;
  line-height: 1.2;
  color: var(--maroon);
}

.journey-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; color: var(--ink-soft); font-size: 0.92rem; }

.journey-actions {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-top: 12px;
}

.pips { display: inline-flex; gap: 4px; }
.pip { width: 10px; height: 10px; border-radius: 50%; background: #e7d8bf; }
.pip.on { background: var(--saffron); }

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin: 18px 0;
}

.stat {
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 10px;
  text-align: center;
  box-shadow: var(--shadow-sm);
}

.stat-value { display: flex; align-items: center; justify-content: center; gap: 6px; font-size: 1.45rem; font-weight: 800; line-height: 1.1; }
.stat-label { font-size: 0.82rem; color: var(--ink-soft); }
.c-heart { color: #d64545; }
.c-bolt { color: #2f6fbf; }
.c-cards { color: var(--maroon-2); }
.c-flame { color: var(--saffron); }

.home-links { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.footer { text-align: center; font-size: 0.85rem; color: var(--ink-faint); margin-top: 28px; }

/* ── Section headings ────────────────── */
.page-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 4px 0 14px;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.8rem;
  color: var(--maroon);
}

.page-title .icon { color: var(--saffron); }

.section-title {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
  margin: 26px 0 10px;
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--maroon);
}

.section-title small { font-weight: 600; color: var(--ink-faint); font-size: 0.85rem; }

.panel {
  background: var(--cream);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow);
}

/* ── Level intro ─────────────────────── */
.intro {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  overflow: hidden;
  padding: 0;
}

.intro-banner {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 22px;
  background: linear-gradient(135deg, var(--maroon), #8a2d2d 60%, var(--saffron-2));
  color: #fff;
}

.intro-banner .level-medal { width: 84px; height: 84px; font-size: 2.6rem; flex: none; }
.intro-banner .eyebrow { color: #ffd27a; }
.intro-banner h1 { margin: 2px 0 4px; font-family: var(--font-display); font-weight: 400; font-size: clamp(1.5rem, 4.5vw, 2.1rem); line-height: 1.15; }
.intro-banner .place { display: flex; align-items: center; gap: 6px; opacity: 0.9; font-size: 0.95rem; }

.intro-body { padding: 20px 22px 22px; }
.intro-story { font-size: 1.15rem; line-height: 1.6; margin: 6px 0 14px; }
.intro-hint { color: var(--ink-soft); font-size: 0.95rem; margin: 0 0 16px; }

.mini-cards { display: flex; gap: 10px; flex-wrap: wrap; margin: 8px 0 20px; }
.mini-card {
  width: 54px;
  height: 74px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  font-size: 1.6rem;
  background: linear-gradient(160deg, var(--maroon-2), var(--maroon));
  border: 2px solid var(--gold);
  color: var(--gold-soft);
  font-family: var(--font-display);
  box-shadow: var(--shadow-sm);
}

.mini-card.won { background: #fff; color: inherit; border-color: var(--green); }

/* ── Quiz ────────────────────────────── */
.quiz-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.quiz-head .eyebrow { display: block; }
.quiz-head h2 { margin: 0; font-family: var(--font-display); font-weight: 400; font-size: 1.35rem; color: var(--maroon); line-height: 1.2; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.92rem;
}

.quiz { display: grid; grid-template-columns: 210px 1fr; gap: 22px; align-items: start; }
.quiz-side { display: grid; gap: 12px; justify-items: center; }

.challenge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 10px;
  padding: 3px 12px;
  background: #fff7dd;
  border: 1px solid var(--legendary);
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.9rem;
  color: #7a5a00;
}

.question { font-size: 1.35rem; font-weight: 800; line-height: 1.35; margin: 0 0 16px; }

.choices { display: grid; gap: 10px; }

.choice {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 1.05rem;
  font-weight: 600;
  transition: border-color 0.12s, background 0.12s, transform 0.12s;
}

.choice-key {
  flex: none;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: #f6ecdb;
  color: var(--maroon);
  font-weight: 800;
  font-size: 0.9rem;
}

.choice:hover:not(:disabled) { border-color: var(--saffron); background: #fff8ee; transform: translateX(2px); }
.choice:disabled { cursor: default; }
.choice.removed { opacity: 0.35; text-decoration: line-through; }
.choice.correct { background: var(--green-bg); border-color: var(--green); color: #1b5e36; }
.choice.correct .choice-key { background: var(--green); color: #fff; }
.choice.wrong { background: var(--red-bg); border-color: var(--red); color: #8a2620; }
.choice.wrong .choice-key { background: var(--red); color: #fff; }

.hint-row { margin-top: 14px; display: flex; justify-content: flex-end; }

.result { margin-top: 18px; }
.result h2 { display: flex; align-items: center; gap: 8px; margin: 0 0 6px; font-size: 1.35rem; }
.result.good h2 { color: var(--green); }
.result.bad h2 { color: var(--red); }
.result p { margin: 6px 0; }
.bonus { display: flex; align-items: center; gap: 6px; font-weight: 700; color: var(--saffron-2); }

.learn {
  margin-top: 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-left: 4px solid var(--gold);
  border-radius: 12px;
  padding: 12px 14px;
}

.learn-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.learn-head strong { display: inline-flex; align-items: center; gap: 6px; color: var(--maroon); }

.speak {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--cream);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--maroon);
}

.speak:hover { border-color: var(--gold); }

.result-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }

.level-done {
  margin-top: 12px;
  padding: 16px;
  border-radius: 14px;
  background: linear-gradient(135deg, #fff7dd, #ffe9b0);
  border: 1px solid var(--gold);
  text-align: center;
}

.level-done h3 { margin: 0 0 4px; font-family: var(--font-display); font-weight: 400; font-size: 1.5rem; color: var(--maroon); }

/* ── Cards ───────────────────────────── */
.card {
  --frame: var(--common);
  position: relative;
  width: 100%;
  max-width: 210px;
  aspect-ratio: 5 / 7.2;
  border-radius: 14px;
  padding: 6px;
  background: linear-gradient(160deg, #fff, #f3e6cf);
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 0 0 3px var(--frame), var(--shadow);
  display: flex;
  flex-direction: column;
  text-align: left;
  overflow: hidden;
}

.card.rare { --frame: var(--rare); }
.card.legendary {
  --frame: var(--legendary);
  background: linear-gradient(160deg, #fffaf0, #f4dc9b);
  box-shadow: 0 0 0 3px var(--legendary), 0 0 22px rgba(201, 154, 46, 0.55), var(--shadow);
}

.card-top { display: flex; align-items: center; justify-content: space-between; gap: 4px; padding: 2px 4px 5px; }
.card-name { min-width: 0; overflow-wrap: anywhere; font-weight: 800; font-size: 1rem; line-height: 1.15; color: var(--maroon); }
.stars { display: inline-flex; color: var(--frame); flex: none; }
.stars .icon { width: 13px; height: 13px; }

.card-art {
  position: relative;
  flex: 1;
  display: grid;
  place-items: center;
  border-radius: 9px;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 45%, rgba(255, 236, 180, 0.95) 0 22%, transparent 60%),
    repeating-conic-gradient(from 0deg at 50% 45%, rgba(255, 255, 255, 0.10) 0 6deg, transparent 6deg 12deg),
    linear-gradient(170deg, #e7863a, #9a2f2c 70%, #5a1626);
  box-shadow: inset 0 0 0 1px rgba(255, 220, 150, 0.6);
}

.card-emoji { font-size: 3.6rem; line-height: 1; filter: drop-shadow(0 4px 6px rgba(40, 5, 10, 0.45)); }

.card-type { padding: 5px 4px 0; font-size: 0.72rem; color: var(--ink-soft); line-height: 1.2; }

.card-stats { display: flex; justify-content: space-between; padding: 3px 4px 2px; font-weight: 800; font-size: 0.9rem; }
.card-stats span { display: inline-flex; align-items: center; gap: 3px; }

/* Card back (not yet won) */
.card.mystery { background: linear-gradient(160deg, var(--maroon-2), #3a0e1b); box-shadow: 0 0 0 3px var(--gold), var(--shadow); }
.card.mystery .card-art {
  background:
    radial-gradient(circle at 50% 50%, transparent 0 30%, rgba(201, 154, 46, 0.35) 31% 32%, transparent 33% 44%, rgba(201, 154, 46, 0.35) 45% 46%, transparent 47%),
    repeating-conic-gradient(from 0deg, rgba(201, 154, 46, 0.22) 0 10deg, transparent 10deg 20deg),
    linear-gradient(160deg, #6d1d2e, #3a0e1b);
  color: var(--gold-soft);
  font-family: var(--font-display);
  font-size: 4rem;
}
.card.mystery .card-name, .card.mystery .card-type { color: var(--gold-soft); }
.card.mystery .card-stats { color: var(--gold-soft); }

.card.locked { filter: grayscale(1); opacity: 0.5; box-shadow: 0 0 0 2px #cdbfa9; }
.card.locked .card-art { background: #e5dccd; color: #9a8f80; }
.card.locked .card-art .icon { width: 40px; height: 40px; }

.card.flip-in { animation: flip-in 0.7s cubic-bezier(0.2, 0.8, 0.2, 1); }
@keyframes flip-in {
  from { transform: perspective(600px) rotateY(90deg) scale(0.85); }
  to { transform: perspective(600px) rotateY(0) scale(1); }
}

/* ── Collection ──────────────────────── */
.progress {
  display: block;
  height: 10px;
  background: #efe2cb;
  border-radius: 999px;
  overflow: hidden;
}

.progress > span { display: block; height: 100%; background: linear-gradient(90deg, var(--saffron), var(--gold)); border-radius: 999px; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 18px 14px;
  justify-items: center;
  padding: 6px 4px;
}

.grid .card { font-size: 0.92em; }
.grid .card-emoji { font-size: 2.8rem; }
.grid button.card { cursor: pointer; transition: transform 0.15s; }
.grid button.card:hover { transform: translateY(-4px); }

.sets { display: grid; gap: 8px; }

.set-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 14px;
}

.set-row.done { border-color: var(--green); background: var(--green-bg); }
.set-name { font-weight: 800; min-width: 170px; }
.set-cards { display: flex; gap: 4px; font-size: 1.3rem; }
.set-cards .missing { filter: grayscale(1); opacity: 0.3; }
.set-bonus { margin-left: auto; display: inline-flex; align-items: center; gap: 8px; font-size: 0.9rem; font-weight: 700; color: var(--ink-soft); }

/* ── India map ───────────────────────── */
.map-layout { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 20px; align-items: start; }

.map-card { padding: 12px; }

.india { display: block; width: 100%; height: auto; }
.india .sea { fill: #dceef5; }
.india .land { fill: #f8ecd2; stroke: #b99b6b; stroke-width: 1.2; stroke-linejoin: round; }
.india .river { fill: none; stroke: #7cb6d6; stroke-width: 1.6; stroke-linecap: round; }
.india .label-sea { fill: #6f9db6; font-size: 8.5px; font-style: italic; letter-spacing: 0.04em; }
.india .label-river { fill: #4f8fb3; font-size: 7.5px; font-style: italic; }
.india .route { fill: none; stroke: #c3a77d; stroke-width: 2; stroke-dasharray: 3 4; stroke-linecap: round; }
.india .route-done { fill: none; stroke: var(--saffron); stroke-width: 3; stroke-linecap: round; }
.india .route-new { fill: none; stroke: var(--saffron); stroke-width: 3; stroke-linecap: round; stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw 1.8s 0.3s ease-in-out forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }

.india .mk { cursor: pointer; }
.india .mk circle.base { fill: #fff; stroke: var(--saffron); stroke-width: 2; }
.india .mk.done circle.base { fill: #fff3df; }
.india .mk.locked { cursor: default; }
.india .mk.locked circle.base { fill: #efe7da; stroke: #bfb09a; }
.india .mk text.num { font-size: 6.5px; font-weight: 800; fill: var(--maroon); text-anchor: middle; dominant-baseline: central; font-family: var(--font-body); }
.india .mk.locked text.num { fill: #9b8b74; }
.india .mk text.emo { font-size: 9px; text-anchor: middle; dominant-baseline: central; }
.india .mk.here circle.base { stroke: var(--gold); stroke-width: 3; fill: #fff; }
.india .mk.here .halo { fill: rgba(201, 154, 46, 0.35); animation: halo 1.8s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes halo { 50% { transform: scale(1.5); opacity: 0.2; } }
.india .traveller { fill: var(--maroon); stroke: #fff; stroke-width: 1.5; }

.map-note { margin: 8px 4px 2px; font-size: 0.8rem; color: var(--ink-faint); }

.levels { display: grid; gap: 8px; }

.level-row {
  display: grid;
  grid-template-columns: 38px 1fr auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-sm);
}

.level-row:hover:not(:disabled) { border-color: var(--gold); }
.level-row:disabled { cursor: default; opacity: 0.6; }
.level-row.here { border: 2px solid var(--gold); background: #fffaf0; }

.level-num {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  font-size: 1.2rem;
  background: #f6ecdb;
  border: 2px solid var(--line);
}

.level-row.done .level-num { background: #fff3df; border-color: var(--saffron); }
.level-row.here .level-num { background: radial-gradient(circle at 35% 30%, #fff6dc, var(--gold-soft) 60%, var(--gold)); border-color: #fff; box-shadow: 0 0 0 2px var(--gold); }
.level-name { font-weight: 800; line-height: 1.2; color: var(--maroon); }
.level-place { display: flex; align-items: center; gap: 4px; font-size: 0.82rem; color: var(--ink-soft); }
.level-state { font-size: 0.85rem; font-weight: 700; color: var(--ink-soft); white-space: nowrap; display: inline-flex; align-items: center; gap: 4px; }
.level-row.done .level-state { color: var(--green); }

/* ── Modal ───────────────────────────── */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(35, 12, 8, 0.6);
  display: grid;
  place-items: center;
  padding: 16px;
  z-index: 20;
}

.modal[hidden] { display: none; }

.modal-box {
  position: relative;
  background: var(--cream);
  border-radius: var(--radius-lg);
  max-width: 600px;
  width: 100%;
  max-height: 92vh;
  overflow: auto;
  padding: 22px;
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 18px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}

.modal-box h3 { margin: 0 0 4px; font-family: var(--font-display); font-weight: 400; color: var(--maroon); font-size: 1.7rem; line-height: 1.15; }
.modal-box p { margin: 8px 0; }
.modal-box .label { font-weight: 800; color: var(--saffron-2); }
.modal-close { position: absolute; top: 10px; right: 10px; width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; background: #fff; border: 1px solid var(--line); }
.stop-box { grid-template-columns: 1fr; }

/* ── Toast ───────────────────────────── */
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  background: var(--maroon);
  color: #fff;
  font-weight: 700;
  padding: 10px 18px;
  border-radius: 12px;
  box-shadow: var(--shadow);
  animation: toast 2.6s ease forwards;
  z-index: 30;
}

@keyframes toast {
  0% { opacity: 0; transform: translate(-50%, 16px); }
  10%, 80% { opacity: 1; transform: translate(-50%, 0); }
  100% { opacity: 0; }
}

/* ── Small screens ───────────────────── */
@media (max-width: 760px) {
  .map-layout { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  body { font-size: 16px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .quiz { grid-template-columns: 1fr; }
  .quiz-side { grid-template-columns: auto; }
  .quiz-side .card { max-width: 150px; }
  .journey-card { padding: 16px; }
  .level-medal { width: 60px; height: 60px; font-size: 1.8rem; }
  .modal-box { grid-template-columns: 1fr; justify-items: center; }
  .modal-box > div:last-of-type { justify-self: stretch; }
  .home-links { grid-template-columns: 1fr; }
  .hero-title { padding: 14px 16px; }
}

@media (prefers-reduced-motion: reduce) {
  .card.flip-in, .toast, .india .mk.here .halo, .india .route-new { animation: none; }
  .india .route-new { stroke-dashoffset: 0; }
}

/* ── Indian silhouette art inside cards, medals and lists ── */
.card-art { padding: 4px 4px 0; }
.card-svg { width: 100%; height: 100%; display: block; color: #2a0c18; filter: drop-shadow(0 0 6px rgba(255, 222, 160, 0.55)); }
.card.legendary .card-svg { color: #24091a; }
.mini-card.won { padding: 3px; background: radial-gradient(circle at 50% 40%, #ffe7a8, #e7863a 75%); }
.mini-card .card-svg { filter: none; }
.set-cards > span { display: inline-grid; width: 28px; height: 36px; border-radius: 6px; background: radial-gradient(circle at 50% 40%, #ffe7a8, #e7863a 80%); overflow: hidden; }
.set-cards .set-svg { filter: none; }
.level-medal .sym { width: 56%; height: 56%; color: var(--maroon); }
.level-num .sym { width: 22px; height: 22px; color: var(--maroon); }
.section-title .sym, .set-name .sym, .bonus .sym { width: 1.2em; height: 1.2em; color: var(--saffron-2); vertical-align: -0.2em; }
.intro-banner .level-medal .sym { color: var(--maroon); }
.hero-art .jai { font-family: "Yatra One", "Mukta Malar", serif; font-size: 25px; fill: #ffd27a; letter-spacing: 1px; paint-order: stroke; stroke: #24091a; stroke-width: 3px; }
.home-title { text-align: center; margin: 4px 0 14px; }
.home-title h1 { margin: 0; font-family: var(--font-display); font-weight: 400; font-size: clamp(2rem, 6vw, 3rem); line-height: 1.05; color: var(--maroon); }
.home-title h1 span { color: var(--saffron-2); }
.home-title p { margin: 4px 0 0; color: var(--ink-soft); font-size: 1.05rem; }

/* ── Painted Ram Parivar (from RamParivar.jpeg) ── */
.hero-painting { filter: drop-shadow(0 6px 14px rgba(30, 5, 15, 0.55)); }
.card-img { display: block; width: 100%; height: 100%; object-fit: contain; object-position: center bottom; }
.card-art:has(.card-img) { padding: 4px 2px 0; }
.mini-card .card-img, .set-cards .card-img { object-fit: cover; object-position: center top; }
/* Painted character portraits sit on white, like the character sheets. */
.card-art:has(.card-img) { background: #fff; box-shadow: inset 0 0 0 1px rgba(201, 154, 46, 0.6); }
.mini-card.won:has(.card-img), .set-cards > span:has(.card-img) { background: #fff; }
/* Place cards: the painting fills the whole picture area. */
.card-art:has(.card-place) { padding: 0; }
.card-img.card-place { object-fit: cover; object-position: center; }

/* ── Celebration: fireworks and "Jai Shri Ram" ── */
.celebrate {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 50% 45%, rgba(45, 8, 24, 0.72), rgba(14, 2, 8, 0.86));
  animation: celebrate-in 0.3s ease-out;
  cursor: pointer;
}
.celebrate canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.celebrate.leaving { animation: celebrate-out 0.6s ease-in forwards; }
.celebrate-text { position: relative; display: grid; justify-items: center; gap: 10px; padding: 0 16px; text-align: center; }
.celebrate-jai {
  font-family: "Yatra One", "Mukta Malar", serif;
  font-size: clamp(2.6rem, 11vw, 6rem);
  line-height: 1.1;
  background: linear-gradient(180deg, #fff6cc 0%, #ffd24d 45%, #e9962a 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 18px rgba(255, 190, 80, 0.85)) drop-shadow(0 4px 2px rgba(60, 10, 20, 0.6));
  animation: jai-pop 3.8s cubic-bezier(0.2, 0.9, 0.25, 1) forwards;
}
.celebrate-sub {
  font-weight: 800;
  font-size: clamp(1rem, 3.6vw, 1.5rem);
  color: #fff3d6;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
  animation: sub-in 3.8s ease forwards;
}
.celebrate.calm .celebrate-jai { animation: jai-calm 2.6s ease forwards; }
.celebrate.calm .celebrate-sub { animation: none; }

@keyframes celebrate-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes celebrate-out { to { opacity: 0; } }
@keyframes jai-pop {
  0% { transform: scale(0.2) rotate(-6deg); opacity: 0; }
  14% { transform: scale(1.18) rotate(2deg); opacity: 1; }
  22% { transform: scale(0.96) rotate(0); }
  30% { transform: scale(1.04); }
  38%, 72% { transform: scale(1); opacity: 1; }
  100% { transform: scale(1.35) translateY(-40px); opacity: 0; }
}
@keyframes sub-in {
  0%, 18% { opacity: 0; transform: translateY(12px); }
  30%, 75% { opacity: 1; transform: none; }
  100% { opacity: 0; }
}
@keyframes jai-calm { 0% { opacity: 0; } 20%, 80% { opacity: 1; } 100% { opacity: 0; } }

/* "Back to the quiz" button beside the page title on My Cards and the map */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.page-head .page-title { margin: 4px 0; }
.resume-btn { min-height: 42px; }
.home-tagline { margin: 2px 0 14px; text-align: center; font-family: var(--font-display); font-size: clamp(1.15rem, 3.4vw, 1.5rem); color: var(--maroon); }
.lang-ta .home-tagline { font-family: "Mukta Malar", serif; font-weight: 700; }

/* Sound on/off button in the top bar */
.topbar-right { display: inline-flex; align-items: center; gap: 8px; }
.sound-btn { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; background: #fff; border: 1px solid var(--line); color: var(--maroon); }
.sound-btn .icon { width: 20px; height: 20px; }
.sound-btn[aria-pressed="false"] { color: var(--ink-faint); }

/* Difficulty picker on the home page */
.difficulty { margin: 16px 0 0; }
.difficulty .eyebrow { display: block; margin: 0 4px 6px; }
.diff-options { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.diff-btn {
  display: grid; gap: 2px; text-align: left; padding: 10px 12px;
  background: rgba(255, 255, 255, 0.85); border: 1.5px solid var(--line); border-radius: 14px;
  box-shadow: var(--shadow-sm); color: var(--ink);
}
.diff-btn strong { font-size: 1.05rem; color: var(--maroon); }
.diff-btn small { font-size: 0.8rem; color: var(--ink-soft); line-height: 1.3; }
.diff-btn:hover { border-color: var(--gold); }
.diff-btn[aria-pressed="true"] { background: #fff7e6; border: 2px solid var(--saffron); box-shadow: 0 0 0 3px rgba(224, 116, 31, 0.15); }
.diff-chip { color: var(--saffron-2); }
@media (max-width: 640px) { .diff-options { grid-template-columns: 1fr; } }

/* ── Garland of Sets ── */
.garland {
  margin: 16px 0 0;
  padding: 12px 14px 10px;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  text-align: center;
}
.garland .eyebrow { display: block; text-align: left; }
.garland-svg { display: block; width: 100%; max-width: 620px; height: auto; margin: 2px auto 0; }
.garland-foot { display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; font-size: 0.92rem; color: var(--ink-soft); font-weight: 600; }
.garland-stars { display: inline-flex; gap: 2px; }
.garland-stars .icon { width: 20px; height: 20px; }
.garland-stars .star-on { color: var(--gold); filter: drop-shadow(0 0 3px rgba(201, 154, 46, 0.7)); }
.garland-stars .star-off { color: #e2d8c6; }
.garland.complete { border-color: var(--gold); background: linear-gradient(180deg, #fffaf0, #fff1cc); box-shadow: 0 0 0 2px rgba(201, 154, 46, 0.35), 0 0 24px rgba(201, 154, 46, 0.35); }
.garland.complete .garland-foot { color: var(--maroon); }
.g-flower { transform-box: fill-box; transform-origin: center; }
.g-flower.bloom { animation: bloom 1.1s 0.5s cubic-bezier(0.2, 1.4, 0.4, 1) both; }
@keyframes bloom { from { transform: scale(0) rotate(-90deg); opacity: 0; } to { transform: scale(1) rotate(0); opacity: 1; } }
.garland-svg.complete .g-pendant { filter: drop-shadow(0 0 6px rgba(255, 200, 80, 0.8)); }
.celebrate-garland { width: min(560px, 88vw); margin-top: 4px; animation: sub-in 3.8s ease forwards; }
.celebrate-garland .garland-svg { max-width: none; filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.4)); }
@media (prefers-reduced-motion: reduce) { .g-flower.bloom { animation: none; } }
