/* ============================================================
   Literature Quest — theme
   Sister to Philosophy Quest's "ink & marble": same scholarly
   dark-parchment DNA, tinted toward a storybook forest green.
   Worlds re-accent the UI as you climb (meadow → gothic library).
   Mobile-first.
   ============================================================ */
:root {
  --bg: #10150e;
  --bg-2: #171e14;
  --panel: #1c2417;
  --panel-2: #242d1d;
  --line: #35402b;
  --ink: #ecead8;
  --ink-dim: #c2c1a4;
  --muted: #93957a;
  --gold: #d7b24a;
  --gold-soft: #ead18a;
  --good: #86b562;
  --bad: #d5765f;
  --heart: #e0705f;
  --accent: #9dc06a;          /* per-world accent; JS swaps this */
  --accent-soft: #c4de9b;
  --radius: 16px;
  --radius-sm: 11px;
  --shadow: 0 10px 30px rgba(0,0,0,.35);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --maxw: 720px;
  --fs: 16px;
}
:root[data-world="2"] { --accent: #d9a251; --accent-soft: #eec990; }

/* accessibility toggles */
:root[data-bigtext="1"] { --fs: 19px; }
:root[data-readable="1"] body,
:root[data-readable="1"] button,
:root[data-readable="1"] h1, :root[data-readable="1"] h2, :root[data-readable="1"] h3 {
  font-family: Verdana, "Comic Sans MS", Tahoma, sans-serif !important;
  letter-spacing: .3px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background:
    radial-gradient(1200px 800px at 50% -10%, #22301a 0%, transparent 60%),
    var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: var(--fs);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
}
/* fine paper grain */
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none; opacity: .05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.82' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
button { font-family: inherit; font-size: inherit; cursor: pointer; }
h1, h2, h3 { font-family: var(--serif); font-weight: 700; letter-spacing: .1px; line-height: 1.18; }
[tabindex="-1"]:focus { outline: none; }
::selection { background: var(--gold); color: #201a08; }
.skip-link { position: absolute; left: -9999px; top: 0; background: var(--gold); color: #201a08; padding: 8px 14px; z-index: 99; border-radius: 0 0 8px 0; }
.skip-link:focus { left: 0; }
.seo-fallback { color: var(--ink-dim); }

/* ---- App bar ------------------------------------------------ */
.appbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px;
  padding: max(10px, env(safe-area-inset-top)) 16px 10px;
  background: rgba(16,21,14,.84);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 9px; background: none; border: 0; color: var(--ink); padding: 4px; }
.brand-glyph {
  font-family: var(--serif); font-size: 25px; line-height: 1;
  color: var(--gold); text-shadow: 0 0 18px rgba(215,178,74,.5);
}
.brand-name { font-family: var(--serif); font-weight: 700; font-size: 17px; }
@media (max-width: 420px) { .brand-name { display: none; } }
.appbar-stats { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; justify-content: flex-end; }
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--panel); border: 1px solid var(--line);
  padding: 4px 10px; border-radius: 999px; font-size: 14px; color: var(--ink-dim);
}
.chip b { color: var(--ink); }
.chip.hearts b { color: var(--heart); }
.chip.ink-chip b { color: var(--accent-soft); }
.icon-btn { background: var(--panel); border: 1px solid var(--line); color: var(--ink-dim); border-radius: 999px; width: 34px; height: 34px; display: grid; place-items: center; font-size: 16px; padding: 0; }
.icon-btn:hover { border-color: var(--gold); color: var(--ink); }
.level-chip { flex-direction: column; align-items: stretch; gap: 3px; padding: 4px 10px; }
.lvl { font-size: 12px; color: var(--gold-soft); font-weight: 700; text-align: center; }
.lvl-bar { width: 54px; height: 4px; background: #0b0f09; border-radius: 3px; overflow: hidden; }
.lvl-fill { display: block; height: 100%; background: linear-gradient(90deg, var(--gold), var(--gold-soft)); }

/* ---- Layout ------------------------------------------------- */
.screen {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 18px 16px calc(40px + env(safe-area-inset-bottom));
  animation: fade .28s ease;
}
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---- Home --------------------------------------------------- */
.home-hero { text-align: center; padding: 14px 8px 6px; }
.home-title {
  font-size: clamp(30px, 8vw, 44px);
  margin: 6px 0 4px; color: var(--ink);
  letter-spacing: .2px; font-weight: 800;
}
.home-title::after {
  content: ""; display: block; width: 42px; height: 2px; margin: 13px auto 0;
  background: var(--gold); border-radius: 2px; opacity: .8;
}
.home-tag {
  color: var(--muted); margin: 0 auto 20px; max-width: 36ch;
  font-style: italic; font-family: var(--serif); font-size: 15.5px;
}
.home-status { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 8px; }
.status-box {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 11px 6px; display: flex; flex-direction: column; gap: 2px; text-align: center;
}
.status-num { font-family: var(--serif); font-size: clamp(15px, 4.4vw, 19px); color: var(--gold-soft); font-weight: 700; }
.status-lbl { font-size: 11px; color: var(--muted); }

.section-head { font-size: 14px; color: var(--muted); text-transform: uppercase; letter-spacing: 1.5px; margin: 26px 4px 12px; }

.continue-btn { margin: 14px 0 4px; }

/* world cards on home */
.world-list { display: flex; flex-direction: column; gap: 12px; }
.world-card {
  position: relative; text-align: left; width: 100%;
  display: flex; gap: 14px; align-items: center;
  background: var(--panel);
  border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.035);
  padding: 16px; color: var(--ink);
  transition: transform .12s ease, border-color .12s ease, box-shadow .12s ease;
}
.world-card:not(:disabled):hover { transform: translateY(-2px); border-color: var(--gold); box-shadow: var(--shadow); }
.world-card:disabled { cursor: default; opacity: .55; }
.world-glyph { font-size: 32px; flex: none; filter: drop-shadow(0 2px 8px rgba(0,0,0,.4)); }
.world-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1; }
.world-name { font-family: var(--serif); font-size: 19px; }
.world-sub { font-size: 13px; color: var(--ink-dim); }
.world-progress { margin-top: 4px; }
.world-lock { margin-left: auto; font-size: 20px; color: var(--muted); flex: none; }
.world-soon { font-size: 11px; color: var(--muted); border: 1px dashed var(--line); border-radius: 999px; padding: 2px 9px; flex: none; }

.home-foot { text-align: center; margin-top: 26px; color: var(--muted); font-size: 13.5px; line-height: 1.7; }
.link-btn { background: none; border: 0; color: var(--gold-soft); text-decoration: underline; font-size: 13.5px; padding: 0; }
.home-foot a { color: var(--gold-soft); }

/* ---- Progress bar ------------------------------------------- */
.progress { position: relative; height: 12px; background: #0c1009; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-soft)); transition: width .5s ease; }
.progress.gold .progress-fill { background: linear-gradient(90deg, var(--gold), var(--gold-soft)); }
.progress-label { position: absolute; inset: 0; display: grid; place-items: center; font-size: 10px; color: var(--ink); text-shadow: 0 1px 2px rgba(0,0,0,.6); }

/* ---- The Path ------------------------------------------------ */
.path-head { text-align: center; margin: 4px 0 6px; }
.path-title { font-size: clamp(26px, 7vw, 36px); margin: 4px 0 2px; }
.path-spirit { color: var(--muted); font-style: italic; font-family: var(--serif); font-size: 14.5px; max-width: 44ch; margin: 0 auto 8px; }
.path { position: relative; display: flex; flex-direction: column; align-items: center; gap: 0; padding: 18px 0 8px; }
.path::before {
  content: ""; position: absolute; top: 30px; bottom: 30px; left: 50%;
  width: 3px; transform: translateX(-50%);
  background: repeating-linear-gradient(180deg, var(--line) 0 10px, transparent 10px 20px);
}
.path-node {
  position: relative; z-index: 1;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  background: none; border: 0; color: var(--ink);
  padding: 12px 10px; width: min(340px, 88vw);
}
.path-node:nth-child(odd)  { transform: translateX(-11%); }
.path-node:nth-child(even) { transform: translateX(11%); }
.node-bubble {
  width: 74px; height: 74px; border-radius: 50%;
  display: grid; place-items: center; font-size: 32px;
  background: var(--panel); border: 3px solid var(--line);
  box-shadow: 0 6px 0 rgba(0,0,0,.35);
  transition: transform .12s ease, border-color .12s ease;
}
.path-node:not(:disabled):hover .node-bubble { transform: translateY(-3px); border-color: var(--accent); }
.path-node:not(:disabled):active .node-bubble { transform: translateY(0); }
.path-node.done .node-bubble { border-color: var(--accent); background: linear-gradient(160deg, var(--panel-2), var(--panel)); }
.path-node.gold .node-bubble { border-color: var(--gold); box-shadow: 0 6px 0 rgba(0,0,0,.35), 0 0 22px rgba(215,178,74,.35); }
.path-node.next .node-bubble { border-color: var(--accent); animation: pulse 1.8s ease infinite; }
@keyframes pulse { 0%,100% { box-shadow: 0 6px 0 rgba(0,0,0,.35), 0 0 0 0 rgba(157,192,106,.45); } 50% { box-shadow: 0 6px 0 rgba(0,0,0,.35), 0 0 0 12px rgba(157,192,106,0); } }
.path-node:disabled { cursor: default; }
.path-node:disabled .node-bubble { opacity: .45; filter: grayscale(.6); }
.node-label { font-family: var(--serif); font-size: 15.5px; text-align: center; max-width: 24ch; }
.path-node:disabled .node-label { color: var(--muted); }
.node-sub { font-size: 12px; color: var(--muted); }
.node-crowns { font-size: 12px; letter-spacing: 1px; color: var(--gold-soft); min-height: 15px; }
.node-boss .node-bubble { width: 92px; height: 92px; font-size: 44px; border-color: #7a4b3a; }
.node-boss.next .node-bubble { border-color: var(--bad); animation: pulse 1.8s ease infinite; }
.node-boss.done .node-bubble { border-color: var(--gold); }
.path-next-world { margin: 20px auto 0; text-align: center; color: var(--muted); font-size: 14px; }

/* ---- Lesson player chrome ------------------------------------ */
.game-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.qcount { font-size: 13px; color: var(--muted); text-align: center; flex: 1; font-weight: 600; }
.hearts-live { font-size: 15px; letter-spacing: 1px; white-space: nowrap; }
.ghost-btn {
  background: var(--panel); border: 1px solid var(--line); color: var(--ink-dim);
  padding: 8px 12px; border-radius: 999px; font-size: 13px; white-space: nowrap;
}
.ghost-btn:hover { color: var(--ink); border-color: var(--gold); }
.primary {
  background: linear-gradient(180deg, var(--gold-soft), var(--gold));
  color: #241c05; border: 0; font-weight: 700; font-size: 16px;
  padding: 14px 20px; border-radius: 12px; width: 100%;
  box-shadow: 0 6px 18px rgba(215,178,74,.25);
  transition: transform .1s ease, filter .1s ease;
}
.primary:hover { filter: brightness(1.05); }
.primary:active { transform: scale(.98); }
.primary:disabled { filter: grayscale(.5) brightness(.7); cursor: default; transform: none; }
.danger-btn { background: rgba(215,106,99,.12); border: 1px solid var(--bad); color: #f0a9a4; padding: 12px 18px; border-radius: 12px; font-weight: 600; }

.qbar { height: 6px; background: #0c1009; border-radius: 3px; overflow: hidden; margin-bottom: 18px; }
.qbar-fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-soft)); transition: width .3s ease; }
.qprompt { font-size: clamp(19px, 5vw, 24px); line-height: 1.35; margin: 0 0 18px; font-family: var(--serif); }

/* teaching cards */
.teach-card {
  background: linear-gradient(160deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line); border-left: 4px solid var(--gold);
  border-radius: var(--radius); padding: 18px 18px; margin-bottom: 14px;
  box-shadow: var(--shadow); animation: fade .25s ease;
}
.teach-card h3 { margin: 0 0 8px; color: var(--gold-soft); }
.teach-card p { margin: 0 0 10px; color: var(--ink); }
.teach-card p:last-child { margin-bottom: 0; }
.teach-card em { color: var(--accent-soft); font-style: italic; }
.teach-card strong { color: var(--gold-soft); }
.teach-ex { font-family: var(--serif); font-style: italic; background: rgba(0,0,0,.22); border-radius: 10px; padding: 10px 14px; margin: 8px 0; color: var(--ink-dim); }

/* ---- Exercise widgets ---------------------------------------- */
.options { display: flex; flex-direction: column; gap: 11px; }
.option {
  text-align: left; background: var(--panel); border: 1.5px solid var(--line);
  color: var(--ink); font-size: 16px; padding: 15px 16px; border-radius: 13px;
  transition: border-color .12s, background .12s, transform .08s;
}
.option:not(:disabled):hover { border-color: var(--accent); background: var(--panel-2); }
.option:not(:disabled):active { transform: scale(.99); }
.option:disabled { opacity: .95; cursor: default; }
.option.correct { border-color: var(--good); background: rgba(107,191,115,.16); color: #d7f5db; }
.option.wrong { border-color: var(--bad); background: rgba(215,106,99,.15); color: #f6cecb; }

/* tap-the-word */
.tapwords { display: flex; flex-wrap: wrap; gap: 8px 6px; font-family: var(--serif); font-size: 19px; line-height: 1.6; margin-bottom: 8px; }
.tapword {
  background: none; border: 1.5px solid transparent; border-radius: 9px;
  color: var(--ink); padding: 3px 7px; font-family: inherit; font-size: inherit;
  transition: border-color .1s, background .1s;
}
.tapword:not(:disabled):hover { border-color: var(--accent); background: var(--panel-2); }
.tapword.correct { border-color: var(--good); background: rgba(107,191,115,.16); }
.tapword.wrong { border-color: var(--bad); background: rgba(215,106,99,.15); }
.tapword.reveal { border-color: var(--good); }

/* punctuation placement */
.punct-mark-badge {
  display: inline-grid; place-items: center; min-width: 46px; height: 46px; padding: 0 12px;
  border-radius: 12px; background: var(--panel-2); border: 1.5px solid var(--gold);
  color: var(--gold-soft); font-size: 26px; font-family: var(--serif); font-weight: 700;
  margin: 0 auto 14px;
}
.punct-line { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px; font-family: var(--serif); font-size: 20px; line-height: 1.9; margin-bottom: 8px; }
.punct-seg { padding: 2px 1px; }
.punct-slot {
  display: inline-grid; place-items: center;
  width: 30px; height: 34px; margin: 0 3px; vertical-align: baseline;
  background: var(--panel); border: 1.5px dashed var(--muted); border-radius: 8px;
  color: var(--muted); font-size: 18px; font-family: inherit;
  transition: border-color .1s, background .1s;
}
.punct-slot:not(:disabled):hover { border-color: var(--accent); background: var(--panel-2); }
.punct-slot.correct { border-style: solid; border-color: var(--good); background: rgba(107,191,115,.16); color: var(--good); font-weight: 700; }
.punct-slot.wrong { border-style: solid; border-color: var(--bad); background: rgba(215,106,99,.15); color: var(--bad); }
.punct-slot.reveal { border-style: solid; border-color: var(--good); color: var(--good); font-weight: 700; }

/* word bank */
.wb-answer {
  min-height: 58px; display: flex; flex-wrap: wrap; gap: 8px; align-content: flex-start;
  border-bottom: 2px solid var(--line); padding: 6px 2px 12px; margin-bottom: 18px;
}
.wb-bank { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-bottom: 18px; }
.tile {
  background: var(--panel); border: 1.5px solid var(--line); border-bottom-width: 3px;
  color: var(--ink); font-size: 16.5px; padding: 9px 14px; border-radius: 11px;
  font-family: var(--serif);
  transition: transform .08s, border-color .1s;
}
.tile:not(:disabled):hover { border-color: var(--accent); }
.tile:not(:disabled):active { transform: scale(.96); }
.tile.ghost { opacity: .25; pointer-events: none; }
.wb-answer .tile { background: var(--panel-2); }
.wb-answer.good .tile { border-color: var(--good); }
.wb-answer.bad .tile { border-color: var(--bad); }

/* match pairs */
.mp-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 8px; }
.mp-col { display: flex; flex-direction: column; gap: 10px; }
.mp-item {
  text-align: left; background: var(--panel); border: 1.5px solid var(--line);
  color: var(--ink); font-size: 14.5px; padding: 12px 12px; border-radius: 12px;
  min-height: 52px; line-height: 1.35;
  transition: border-color .1s, background .1s, opacity .3s;
}
.mp-item:not(:disabled):hover { border-color: var(--accent); }
.mp-item.active { border-color: var(--gold); background: var(--panel-2); box-shadow: 0 0 0 3px rgba(215,178,74,.18); }
.mp-item.done { opacity: .35; border-style: dashed; cursor: default; }
.mp-item.flash { border-color: var(--bad); background: rgba(215,106,99,.15); animation: shake .3s ease; }
@keyframes shake { 0%,100% { transform: none; } 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }

/* order-it */
.ord-pool, .ord-answer { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.ord-item {
  display: flex; align-items: center; gap: 10px; text-align: left;
  background: var(--panel); border: 1.5px solid var(--line);
  color: var(--ink); font-size: 15.5px; padding: 12px 14px; border-radius: 12px;
}
.ord-item:not(:disabled):hover { border-color: var(--accent); }
.ord-num {
  flex: none; width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center; font-size: 13px; font-weight: 700;
  background: var(--panel-2); border: 1px solid var(--line); color: var(--gold-soft);
}
.ord-item.ok { border-color: var(--good); background: rgba(107,191,115,.1); }
.ord-item.miss { border-color: var(--bad); background: rgba(215,106,99,.1); }
.ord-item.ghost { opacity: .25; pointer-events: none; }

/* feedback + explain */
.explain { margin-top: 18px; border-radius: 13px; padding: 14px 16px; border: 1px solid var(--line); animation: fade .25s ease; }
.explain.good { border-color: rgba(107,191,115,.5); background: rgba(107,191,115,.08); }
.explain.bad { border-color: rgba(215,106,99,.5); background: rgba(215,106,99,.08); }
.explain-head { font-weight: 700; font-family: var(--serif); margin-bottom: 4px; }
.explain.good .explain-head { color: var(--good); }
.explain.bad .explain-head { color: var(--bad); }
.explain-body { color: var(--ink-dim); font-size: 14.5px; }
.next-btn { margin-top: 16px; }

/* ---- Results / end screens ----------------------------------- */
.result-card { text-align: center; background: linear-gradient(160deg, var(--panel-2), var(--panel)); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px 20px; box-shadow: var(--shadow); }
.result-emoji { font-size: 54px; }
.result-card h2 { font-size: 36px; margin: 6px 0 2px; color: var(--gold-soft); }
.result-verdict { color: var(--ink-dim); margin: 0 0 18px; }
.result-stats { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; margin-bottom: 16px; }
.stat { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 6px; display: flex; flex-direction: column; gap: 2px; }
.stat-num { font-family: var(--serif); font-size: 20px; color: var(--gold-soft); font-weight: 700; }
.stat-lbl { font-size: 11px; color: var(--muted); }
.record-badge { color: var(--gold-soft); font-weight: 700; margin-bottom: 16px; animation: pop .4s ease; }
@keyframes pop { 0% { transform: scale(.6); opacity: 0; } 70% { transform: scale(1.1); } 100% { transform: scale(1); opacity: 1; } }
.result-actions { display: flex; flex-direction: column; gap: 10px; }

/* ---- Boss battle ---------------------------------------------- */
.boss-head { text-align: center; margin-bottom: 10px; }
.boss-portrait { font-size: 64px; filter: drop-shadow(0 4px 14px rgba(0,0,0,.5)); animation: bossbob 3s ease-in-out infinite; display: inline-block; }
@keyframes bossbob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
.boss-portrait.hit { animation: bosshit .4s ease; }
@keyframes bosshit { 0% { transform: scale(1); filter: brightness(2) drop-shadow(0 0 18px rgba(215,178,74,.8)); } 100% { transform: scale(1); } }
.boss-name { font-size: 24px; margin: 2px 0 8px; color: var(--gold-soft); }
.boss-hp { max-width: 300px; margin: 0 auto 4px; }
.boss-hp .progress-fill { background: linear-gradient(90deg, #b0503c, var(--bad)); }
.boss-taunt {
  font-family: var(--serif); font-style: italic; color: var(--ink-dim);
  background: rgba(0,0,0,.25); border: 1px solid var(--line); border-radius: 12px;
  padding: 10px 14px; margin: 10px auto 14px; max-width: 46ch; min-height: 20px;
  animation: fade .3s ease;
}
.boss-intro-card { text-align: center; }
.boss-intro-card .boss-portrait { font-size: 84px; }

/* ---- Badges / toast / confetti -------------------------------- */
.badge-row { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-bottom: 14px; }
.badge-pill { background: rgba(215,178,74,.1); border: 1px solid rgba(215,178,74,.35); color: var(--gold-soft); border-radius: 999px; padding: 5px 12px; font-size: 13px; }
.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: var(--panel-2); border: 1px solid var(--gold); color: var(--ink);
  border-radius: 999px; padding: 10px 18px; font-size: 14.5px; z-index: 60;
  box-shadow: var(--shadow); animation: toastin .25s ease;
  max-width: 92vw; text-align: center;
}
@keyframes toastin { from { opacity: 0; transform: translate(-50%, 10px); } to { opacity: 1; transform: translate(-50%, 0); } }
.confetti { position: fixed; top: -12px; z-index: 70; font-size: 18px; pointer-events: none; animation: confall linear forwards; }
@keyframes confall { to { transform: translateY(105vh) rotate(540deg); opacity: .7; } }

/* ---- Settings / modal ----------------------------------------- */
.modal-back { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 50; display: grid; place-items: center; padding: 20px; animation: fade .2s ease; }
.modal { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 20px; max-width: 420px; width: 100%; max-height: 84dvh; overflow: auto; box-shadow: var(--shadow); }
.modal h2 { margin: 0 0 14px; font-size: 22px; }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.setting-row:last-of-type { border-bottom: 0; }
.setting-lbl { font-size: 15px; }
.setting-sub { display: block; font-size: 12.5px; color: var(--muted); }
.tog { background: var(--panel); border: 1px solid var(--line); border-radius: 999px; width: 52px; height: 30px; position: relative; flex: none; }
.tog::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--muted); transition: transform .15s ease, background .15s ease; }
.tog.on { border-color: var(--gold); }
.tog.on::after { transform: translateX(22px); background: var(--gold); }
.modal-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }

/* hearts-empty screen */
.hearts-empty { text-align: center; }
.hearts-empty .result-emoji { animation: bossbob 2.4s ease-in-out infinite; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
