/* My Faith Journey | "Dusk lantern" look. Warm paper cards, indigo dusk, gold and flame accents. */

:root {
  --bg: #FBF5EA;
  --bg2: #F3EADA;
  --card: #FFFFFF;
  --ink: #2B2342;
  --ink2: #5C5470;
  --line: #E7DCC8;
  --dusk1: #2B2342;
  --dusk2: #4B3590;
  --gold: #F2B33D;
  --gold-soft: #FFF1CC;
  --flame: #FF7A2F;
  --good: #167A4B;
  --good-bg: #E3F6EC;
  --try: #A44A0B;
  --try-bg: #FFEFD9;
  --btn-bg: #2B2342;
  --btn-ink: #FFFFFF;
  --accent: #E9A33B;
  --on-accent: #2B2342;
  --shadow: 0 1px 2px rgba(43, 35, 66, .06), 0 10px 30px rgba(43, 35, 66, .08);
  --shadow-lg: 0 2px 4px rgba(43, 35, 66, .08), 0 24px 60px rgba(43, 35, 66, .18);
  --radius: 20px;
  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans: "Figtree", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --p0: #E9A33B; --p1: #2BA6A0; --p2: #E4604F; --p3: #7A5AF8; --p4: #3FAE6A; --p5: #D6559B; --p6: #3C83D8;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #15112B; --bg2: #1C1738; --card: #241F45; --ink: #F5F0FF; --ink2: #BDB4D8; --line: #38325F;
    --gold-soft: #3A3120; --good: #6EE0A6; --good-bg: #17382B; --try: #FFB36B; --try-bg: #3B2A1B;
    --btn-bg: #F5F0FF; --btn-ink: #2B2342;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 30px rgba(0, 0, 0, .35);
    --shadow-lg: 0 2px 4px rgba(0, 0, 0, .4), 0 24px 60px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #15112B; --bg2: #1C1738; --card: #241F45; --ink: #F5F0FF; --ink2: #BDB4D8; --line: #38325F;
  --gold-soft: #3A3120; --good: #6EE0A6; --good-bg: #17382B; --try: #FFB36B; --try-bg: #3B2A1B;
  --btn-bg: #F5F0FF; --btn-ink: #2B2342;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 30px rgba(0, 0, 0, .35);
  --shadow-lg: 0 2px 4px rgba(0, 0, 0, .4), 0 24px 60px rgba(0, 0, 0, .5);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--sans); font-size: 1.0625rem; line-height: 1.6;
  min-height: 100vh; display: flex; flex-direction: column;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: var(--serif); line-height: 1.15; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: clamp(2rem, 5vw, 3rem); font-weight: 900; }
h2 { font-size: clamp(1.5rem, 3.4vw, 2.1rem); font-weight: 700; }
h3 { font-size: 1.25rem; font-weight: 700; }
p { margin: 0 0 1em; }
a { color: inherit; }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; border-radius: 8px; }
main { flex: 1; width: 100%; max-width: 1140px; margin: 0 auto; padding: 22px 16px 48px; outline: none; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--btn-bg); color: var(--btn-ink); padding: 10px 14px; border-radius: 10px; z-index: 100; }
.skip:focus { left: 8px; }
.noscript { padding: 24px; text-align: center; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 12px;
  padding: 10px 16px; padding-top: calc(10px + env(safe-area-inset-top));
  background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-family: var(--serif); font-weight: 900; font-size: 1.15rem; }
.brand img { border-radius: 10px; }
.nav { display: flex; gap: 4px; margin-left: 8px; }
.nav a { text-decoration: none; padding: 8px 12px; border-radius: 999px; font-weight: 700; font-size: .95rem; color: var(--ink2); }
.nav a:hover { background: var(--bg2); color: var(--ink); }
.nav a[aria-current="page"] { background: var(--ink); color: var(--bg); }
.hud { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px;
  background: var(--card); border: 1px solid var(--line); font-weight: 800; font-size: .92rem; white-space: nowrap;
}
.pill .e { font-size: 1.05rem; }
.pill.flame.on { background: linear-gradient(135deg, #FFD27A, #FF9A4D); color: #3A1B00; border-color: transparent; }
.pill.bump { animation: bump .6s ease; }
.icon-btn { border: 1px solid var(--line); background: var(--card); width: 40px; height: 40px; border-radius: 50%; font-size: 1.1rem; }
.icon-btn:hover { background: var(--bg2); }

@media (max-width: 720px) {
  .brand-text { display: none; }
  .nav { margin-left: 0; }
  .nav a { padding: 8px 10px; font-size: .88rem; }
  .pill { padding: 5px 9px; font-size: .85rem; }
  .pill.level .name { display: none; }
}
@media (max-width: 470px) { .pill.xp .lab { display: none; } }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 14px; padding: 14px 22px; font-weight: 800; font-size: 1rem;
  background: var(--btn-bg); color: var(--btn-ink); text-decoration: none;
  box-shadow: 0 4px 0 rgba(0, 0, 0, .18); transition: transform .12s ease, box-shadow .12s ease, opacity .2s;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(0, 0, 0, .18); }
.btn[disabled] { opacity: .4; cursor: not-allowed; transform: none; box-shadow: none; }
.btn.gold { background: var(--gold); color: #2B2342; }
.btn.ghost { background: transparent; color: var(--ink); border: 2px solid var(--line); box-shadow: none; }
.btn.ghost:hover { background: var(--bg2); }
.btn.small { padding: 9px 14px; font-size: .9rem; border-radius: 12px; }
.btn.accent { background: var(--accent); color: var(--on-accent); }
.btn.glow { animation: glow 2.2s ease-in-out infinite; }
.linkish { background: none; border: 0; padding: 4px 2px; text-decoration: underline; text-underline-offset: 3px; color: var(--ink2); font-weight: 600; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.row.end { justify-content: flex-end; }

/* ---------- home ---------- */
.hero {
  position: relative; overflow: hidden; border-radius: 28px; padding: 30px 26px 28px; color: #FBF5EA;
  background:
    radial-gradient(1.5px 1.5px at 12% 22%, #fff9 50%, transparent 52%),
    radial-gradient(1.5px 1.5px at 28% 62%, #fff8 50%, transparent 52%),
    radial-gradient(2px 2px at 46% 18%, #fffb 50%, transparent 52%),
    radial-gradient(1.5px 1.5px at 63% 48%, #fff8 50%, transparent 52%),
    radial-gradient(2px 2px at 78% 24%, #fffa 50%, transparent 52%),
    radial-gradient(1.5px 1.5px at 90% 70%, #fff8 50%, transparent 52%),
    radial-gradient(120% 90% at 85% 120%, #F2B33D 0%, #E9743A 22%, transparent 55%),
    linear-gradient(160deg, var(--dusk1) 10%, var(--dusk2) 100%);
  box-shadow: var(--shadow-lg);
}
.hero::after { content: ""; position: absolute; right: -40px; bottom: -40px; width: 220px; height: 220px; border-radius: 50%; background: radial-gradient(circle, #FFE29A88, transparent 65%); animation: breathe 5s ease-in-out infinite; pointer-events: none; }
.hero h1 { color: #FFF8EA; margin-bottom: .25em; }
.hero p { color: #E9E1F7; max-width: 46ch; }
.hero .eyebrow { display: inline-block; font-weight: 800; text-transform: uppercase; letter-spacing: .12em; font-size: .75rem; color: #FFD98A; margin-bottom: 10px; }
.hero .btn { position: relative; z-index: 1; }
.hero .btn.gold { box-shadow: 0 4px 0 #B97C14; }

.grid2 { display: grid; gap: 16px; grid-template-columns: 1fr; margin: 18px 0; }
@media (min-width: 820px) { .grid2 { grid-template-columns: 1.2fr 1fr; } }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.card h3 { margin-bottom: .3em; }
.card.verse { background: linear-gradient(180deg, var(--gold-soft), var(--card)); }
.card.verse blockquote { margin: 0; font-family: var(--serif); font-size: 1.15rem; line-height: 1.5; }
.card.verse cite { display: block; margin-top: 10px; font-style: normal; font-weight: 800; font-size: .9rem; color: var(--ink2); }
.kicker { font-weight: 800; text-transform: uppercase; letter-spacing: .1em; font-size: .75rem; color: var(--ink2); margin-bottom: 6px; }
.muted { color: var(--ink2); }
.bar { height: 10px; border-radius: 999px; background: var(--bg2); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--gold), var(--flame)); transition: width .6s cubic-bezier(.2, .8, .2, 1); width: 0; }
.statline { display: flex; justify-content: space-between; font-size: .88rem; font-weight: 700; color: var(--ink2); margin-bottom: 6px; }

.daily { display: flex; gap: 16px; align-items: center; }
.daily .big { font-size: 2.6rem; line-height: 1; }
.daily.done { opacity: .85; }

/* journey map */
.map { list-style: none; margin: 28px 0 0; padding: 0; position: relative; }
.map::before { content: ""; position: absolute; left: 36px; top: 20px; bottom: 20px; width: 0; border-left: 4px dotted color-mix(in srgb, var(--ink) 25%, transparent); }
.stop { position: relative; display: flex; gap: 18px; padding: 0 0 22px; align-items: flex-start; }
.node {
  flex: none; width: 72px; height: 72px; border-radius: 50%; display: grid; place-items: center; font-size: 1.9rem; position: relative; z-index: 1;
  background: var(--card); border: 4px solid var(--line); box-shadow: var(--shadow);
}
.stop.done .node { background: radial-gradient(circle, #FFE29A, #F2B33D); border-color: #C98912; }
.stop.current .node { border-color: var(--accent); animation: pulse 2.2s ease-in-out infinite; }
.stop.locked .node { filter: grayscale(1); opacity: .7; }
.stop .num { position: absolute; top: -6px; left: -6px; width: 26px; height: 26px; border-radius: 50%; background: var(--ink); color: var(--bg); font-size: .8rem; font-weight: 800; display: grid; place-items: center; }
.stop .card { flex: 1; min-width: 0; }
.stop.locked .card { background: var(--bg2); box-shadow: none; }
.stop h3 { font-size: 1.3rem; }
.stop .tag { display: inline-block; font-size: .78rem; font-weight: 800; padding: 3px 10px; border-radius: 999px; background: var(--gold-soft); margin-bottom: 8px; }
.stop.locked .tag { background: var(--line); }
@media (min-width: 900px) {
  .map::before { left: 50%; margin-left: -2px; }
  .stop { width: 50%; padding-right: 54px; }
  .stop:nth-child(even) { margin-left: 50%; padding-right: 0; padding-left: 54px; flex-direction: row-reverse; }
  .stop .node { position: absolute; top: 8px; right: -36px; }
  .stop:nth-child(even) .node { right: auto; left: -36px; }
  .stop { flex-direction: row; }
}

/* ---------- lesson layout ---------- */
.lesson-wrap { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; align-items: start; }
@media (min-width: 1000px) { .lesson-wrap { grid-template-columns: minmax(0, 1fr) 340px; } }
.lesson-wrap.single { grid-template-columns: minmax(0, 760px); justify-content: center; }
.lesson-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.lesson-head .back { text-decoration: none; font-weight: 800; color: var(--ink2); padding: 6px 10px; border-radius: 10px; }
.lesson-head .back:hover { background: var(--bg2); }
.lesson-head .ttl { font-family: var(--serif); font-weight: 700; font-size: 1.05rem; margin-left: auto; text-align: right; }
.steps { display: flex; gap: 4px; margin-bottom: 18px; }
.steps i, .steps a { flex: 1; height: 8px; border-radius: 999px; background: var(--bg2); transition: background .3s, transform .2s; display: block; }
.steps a { background: var(--accent); }
.steps a:hover { transform: scaleY(1.8); }
.steps i.done { background: var(--accent); }
.steps i.now { background: var(--accent); opacity: .55; animation: breathe 1.8s ease-in-out infinite; }

.stage {
  background: var(--card); border: 1px solid var(--line); border-top: 6px solid var(--accent); border-radius: var(--radius);
  padding: 28px 26px 26px; box-shadow: var(--shadow); animation: slideIn .45s cubic-bezier(.2, .8, .2, 1);
  position: relative;
}
.stage.celebrate { animation: celebrate .8s ease; }
.stage h2 { margin-bottom: .45em; }
.stage .kicker { color: color-mix(in srgb, var(--accent) 55%, var(--ink)); }
.stage p { max-width: 62ch; }
.stage ul.bul { margin: 0 0 1em; padding-left: 1.2em; }
.stage ul.bul li { margin-bottom: .3em; }
.nav-row { display: flex; justify-content: space-between; align-items: center; margin-top: 22px; gap: 12px; }
.quote { margin: 16px 0; padding: 14px 18px; border-left: 5px solid var(--accent); background: color-mix(in srgb, var(--accent) 12%, var(--card)); border-radius: 0 14px 14px 0; font-family: var(--serif); font-size: 1.12rem; line-height: 1.5; }
.quote cite { display: block; margin-top: 6px; font-family: var(--sans); font-style: normal; font-weight: 800; font-size: .85rem; color: var(--ink2); }
.leader-note { margin-top: 14px; padding: 12px 16px; border-radius: 14px; background: var(--bg2); border: 1px dashed var(--line); font-size: .95rem; }
.leader-note b { display: block; font-size: .75rem; letter-spacing: .1em; text-transform: uppercase; color: var(--ink2); margin-bottom: 4px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; border: 1.5px solid var(--line); background: var(--bg); font-weight: 700; font-size: .88rem; text-decoration: none; }
.chip:hover { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, var(--bg)); }

/* quiz */
.opts { display: grid; gap: 10px; margin: 16px 0 6px; }
.opt {
  display: flex; gap: 14px; align-items: flex-start; text-align: left; width: 100%;
  padding: 14px 16px; border-radius: 16px; border: 2px solid var(--line); background: var(--bg);
  transition: transform .12s ease, border-color .12s, background .12s;
}
.opt:hover:not([disabled]) { border-color: var(--accent); transform: translateY(-2px); background: color-mix(in srgb, var(--accent) 10%, var(--bg)); }
.opt .ltr { flex: none; width: 30px; height: 30px; border-radius: 10px; display: grid; place-items: center; font-weight: 800; background: var(--card); border: 2px solid var(--line); font-size: .9rem; }
.opt .txt { flex: 1; padding-top: 2px; }
.opt .tagx { flex: none; font-size: .78rem; font-weight: 800; padding: 3px 9px; border-radius: 999px; align-self: center; }
.opt.right { border-color: var(--good); background: var(--good-bg); }
.opt.right .ltr { background: var(--good); color: var(--bg); border-color: var(--good); }
.opt.right .tagx { background: var(--good); color: var(--bg); }
.opt.wrong { border-color: var(--try); background: var(--try-bg); opacity: .85; animation: shake .45s ease; }
.opt.wrong .tagx { background: var(--try); color: var(--bg); }
.opt[disabled]:not(.right):not(.wrong) { opacity: .55; cursor: default; }
.fb { margin-top: 14px; padding: 14px 16px; border-radius: 16px; display: flex; gap: 12px; align-items: flex-start; animation: pop .35s ease; }
.fb .ic { font-size: 1.5rem; line-height: 1.2; }
.fb.good { background: var(--good-bg); border: 1.5px solid var(--good); }
.fb.try { background: var(--try-bg); border: 1.5px solid var(--try); }
.fb strong { display: block; }
.fb p { margin: .25em 0 0; max-width: none; }
.xpgain { display: inline-block; margin-left: 8px; padding: 2px 10px; border-radius: 999px; background: var(--gold); color: #2B2342; font-weight: 800; font-size: .85rem; }

/* scenario */
.story { background: var(--bg2); border-radius: 18px; padding: 16px 18px; margin: 10px 0 16px; }
.story .who { font-weight: 800; font-size: .9rem; color: var(--ink2); margin-bottom: 6px; display: flex; align-items: center; gap: 8px; }
.story p { margin: 0; font-size: 1.05rem; }
.stagebar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 8px; font-size: .9rem; color: var(--ink2); }
.stagebar button { padding: 5px 11px; border-radius: 999px; border: 1.5px solid var(--line); background: var(--bg); font-weight: 700; font-size: .85rem; }
.stagebar button[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.take { margin-top: 12px; font-family: var(--serif); font-size: 1.2rem; font-weight: 700; padding: 12px 16px; border-radius: 14px; background: var(--gold-soft); }

/* match */
.match { display: grid; gap: 12px; grid-template-columns: 1fr; margin: 14px 0; }
@media (min-width: 640px) { .match { grid-template-columns: 1fr 1fr; gap: 14px 22px; } }
.match .col { display: grid; gap: 10px; align-content: start; }
.mt { text-align: left; padding: 12px 14px; border-radius: 14px; border: 2px solid var(--line); background: var(--bg); position: relative; display: flex; gap: 10px; align-items: flex-start; transition: transform .12s, border-color .12s; }
.mt:hover:not([disabled]) { border-color: var(--accent); transform: translateY(-1px); }
.mt.sel { border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 30%, transparent); background: color-mix(in srgb, var(--accent) 14%, var(--bg)); }
.mt.done { cursor: default; border-color: var(--pc); background: color-mix(in srgb, var(--pc) 16%, var(--card)); }
.mt .pn { flex: none; width: 24px; height: 24px; border-radius: 50%; background: var(--pc); color: #fff; font-weight: 800; font-size: .8rem; display: none; place-items: center; }
.mt.done .pn { display: grid; }
.mt.miss { animation: shake .4s ease; border-color: var(--try); }

/* order */
.pool, .seq { display: flex; flex-wrap: wrap; gap: 10px; margin: 12px 0; min-height: 52px; }
.seq { padding: 12px; border-radius: 16px; border: 2px dashed var(--line); background: var(--bg2); }
.seq .ph { color: var(--ink2); font-size: .92rem; align-self: center; }
.tok { padding: 10px 16px; border-radius: 12px; border: 2px solid var(--line); background: var(--bg); font-weight: 700; }
.tok:hover:not([disabled]) { border-color: var(--accent); transform: translateY(-1px); }
.tok.placed { border-color: var(--good); background: var(--good-bg); }
.tok.miss { animation: shake .4s ease; border-color: var(--try); }

/* declare */
.declare { display: grid; gap: 10px; margin: 14px 0; }
.dline { text-align: left; padding: 14px 18px; border-radius: 16px; border: 2px solid var(--line); background: var(--bg); font-family: var(--serif); font-size: 1.1rem; position: relative; overflow: hidden; transition: all .3s; }
.dline:hover { border-color: var(--accent); }
.dline.lit { border-color: var(--gold); background: linear-gradient(135deg, #FFF3CF, #FFE7A8); color: #3A2A00; box-shadow: 0 0 24px rgba(242, 179, 61, .55); }
.dline.lit::after { content: "✨"; position: absolute; right: 14px; top: 50%; transform: translateY(-50%); }

/* verse */
.vtext { font-family: var(--serif); font-size: 1.25rem; line-height: 2.1; margin: 14px 0; }
.slot { display: inline-block; min-width: 5.5ch; padding: 0 8px; margin: 0 2px; border-bottom: 3px dashed var(--ink2); text-align: center; border-radius: 6px; }
.slot.active { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 18%, transparent); animation: breathe 1.4s ease-in-out infinite; }
.slot.filled { border-bottom-style: solid; border-color: var(--good); color: var(--good); font-weight: 800; background: var(--good-bg); }
.bank { display: flex; flex-wrap: wrap; gap: 10px; margin: 10px 0 4px; }

/* bridge */
.bridge-svg { width: 100%; height: auto; display: block; border-radius: 18px; background: linear-gradient(180deg, #F6D8A8 0%, #FBE9C7 55%, #E7C899 100%); }
:root[data-theme="dark"] .bridge-svg { background: linear-gradient(180deg, #3B2E5C, #5A3F6B 60%, #7B4C5A); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .bridge-svg { background: linear-gradient(180deg, #3B2E5C, #5A3F6B 60%, #7B4C5A); } }
.bridge-svg .cliff { fill: #4A3F55; }
.bridge-svg .plank { fill: #8B6B4A; transform-box: fill-box; transform-origin: center; transition: transform 1s ease-in, opacity 1s; }
.bridge-svg .plank.fell { transform: translateY(150px) rotate(35deg); opacity: 0; }
.bridge-svg .crossg { opacity: 0; transition: opacity 1s ease .2s; }
.bridge-svg .crossg.on { opacity: 1; }
.bridge-svg text { font-family: var(--sans); font-weight: 800; }
.attempts { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin: 14px 0; }
.attempt { padding: 12px; border-radius: 14px; border: 2px solid var(--line); background: var(--bg); font-weight: 800; text-align: center; }
.attempt.tried { border-color: var(--try); background: var(--try-bg); }
.bnote { min-height: 3.2em; }

/* reflect + notes */
.field { margin: 14px 0; }
.field label { display: block; font-weight: 700; margin-bottom: 6px; }
textarea {
  width: 100%; min-height: 96px; resize: vertical; padding: 12px 14px; border-radius: 14px; border: 2px solid var(--line);
  background: var(--bg); color: var(--ink); font: inherit; line-height: 1.5;
}
textarea:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 25%, transparent); }
.savebadge { font-size: .8rem; font-weight: 700; color: var(--good); opacity: 0; transition: opacity .3s; }
.savebadge.on { opacity: 1; }
.lockline { font-size: .85rem; color: var(--ink2); display: flex; align-items: center; gap: 6px; }

.notes { position: sticky; top: 84px; background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 10%, var(--card)), var(--card)); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.notes h3 { font-size: 1.1rem; display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: .2em; }
.notes textarea { min-height: 190px; background: var(--card); }
.notes .close { display: none; }
.notes-fab { display: none; }
@media (max-width: 999px) {
  .notes { position: fixed; left: 0; right: 0; bottom: 0; top: auto; z-index: 40; border-radius: 22px 22px 0 0; padding-bottom: calc(18px + env(safe-area-inset-bottom)); transform: translateY(105%); transition: transform .3s ease; max-height: 80vh; overflow: auto; box-shadow: 0 -10px 40px rgba(0, 0, 0, .3); }
  .lesson-wrap.notes-open .notes { transform: none; }
  .notes .close { display: inline-block; }
  .notes-fab { display: inline-flex; position: fixed; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 35; padding: 13px 18px; border-radius: 999px; border: 0; font-weight: 800; background: var(--accent); color: var(--on-accent); box-shadow: 0 8px 24px rgba(0, 0, 0, .3); }
  .lesson-wrap.notes-open .notes-fab { display: none; }
}

/* finish */
.finish { text-align: center; }
.finish p { margin-inline: auto; }
.qtext { font-size: 1.15rem; margin-bottom: .4em; }
.finish .trophy { font-size: 5rem; line-height: 1; animation: bounce 1.2s ease infinite; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; margin: 18px 0; }
.stat { padding: 14px; border-radius: 16px; background: var(--bg2); }
.stat b { display: block; font-family: var(--serif); font-size: 1.8rem; }
.stat span { font-size: .85rem; color: var(--ink2); font-weight: 700; }

/* journal, badges, review, settings */
.page-head { margin-bottom: 18px; }
.jgroup { margin-bottom: 26px; }
.jgroup > h2 { display: flex; align-items: center; gap: 10px; }
.jitem { margin: 10px 0; padding: 16px; border: 1px solid var(--line); border-radius: 16px; background: var(--card); }
.jitem .jq { font-weight: 700; margin-bottom: 6px; }
.jitem .jmeta { font-size: .8rem; color: var(--ink2); font-weight: 700; margin-bottom: 4px; }
.jitem textarea { min-height: 80px; }
.empty { padding: 28px; text-align: center; border: 2px dashed var(--line); border-radius: 18px; color: var(--ink2); }
.bgrid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); }
.badge { text-align: center; padding: 18px 12px; border-radius: 20px; background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow); }
.badge .be { font-size: 2.6rem; line-height: 1.1; }
.badge b { display: block; margin-top: 6px; }
.badge small { color: var(--ink2); font-weight: 600; display: block; margin-top: 2px; }
.badge.locked { background: var(--bg2); box-shadow: none; }
.badge.locked .be { filter: grayscale(1) opacity(.45); }
.badge.got { background: linear-gradient(180deg, var(--gold-soft), var(--card)); border-color: var(--gold); }
.revq { padding: 14px 16px; border: 1px solid var(--line); border-radius: 14px; margin: 10px 0; background: var(--card); }
.revq .tg { display: inline-block; font-size: .72rem; font-weight: 800; padding: 2px 8px; border-radius: 999px; background: var(--try-bg); color: var(--try); margin-bottom: 6px; }

dialog { border: 0; border-radius: 24px; padding: 0; max-width: min(520px, calc(100vw - 24px)); width: 100%; background: var(--card); color: var(--ink); box-shadow: var(--shadow-lg); }
dialog::backdrop { background: rgba(21, 17, 43, .62); backdrop-filter: blur(3px); }
.dlg { padding: 26px 24px 22px; }
.dlg h2 { margin-bottom: .3em; }
.dlg .field input[type="text"] { width: 100%; padding: 12px 14px; border-radius: 14px; border: 2px solid var(--line); background: var(--bg); color: var(--ink); font: inherit; }
.dlg .field input[type="text"]:focus { border-color: var(--gold); outline: none; }
.stagepick { display: grid; gap: 10px; margin: 12px 0 18px; }
.sp { display: flex; gap: 14px; align-items: center; text-align: left; padding: 12px 14px; border-radius: 16px; border: 2px solid var(--line); background: var(--bg); }
.sp[aria-pressed="true"] { border-color: var(--gold); background: var(--gold-soft); box-shadow: 0 0 0 3px color-mix(in srgb, var(--gold) 35%, transparent); }
.sp .e { font-size: 1.8rem; }
.sp small { display: block; color: var(--ink2); }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.switch input { width: 22px; height: 22px; accent-color: #E9A33B; }
.danger { color: #B3261E; border-color: #B3261E; }

/* certificate */
.cert { text-align: center; padding: 40px 24px; border: 6px double var(--gold); border-radius: 22px; background: linear-gradient(180deg, var(--gold-soft), var(--card)); }
.cert h1 { margin-bottom: .1em; }
.cert .nm { font-family: var(--serif); font-size: clamp(2rem, 6vw, 3.2rem); font-weight: 900; margin: .2em 0; }
.cert .bs { font-size: 2.2rem; letter-spacing: .3em; margin: 12px 0; }

.foot { padding: 18px 16px 30px; text-align: center; color: var(--ink2); font-size: .9rem; max-width: 900px; margin: 0 auto; }
.foot .fine { font-size: .75rem; opacity: .8; }

.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translate(-50%, 140%); background: var(--ink); color: var(--bg); padding: 12px 20px; border-radius: 16px; font-weight: 700; z-index: 90; max-width: min(92vw, 460px); text-align: center; box-shadow: var(--shadow-lg); transition: transform .4s cubic-bezier(.2, .9, .2, 1.2); pointer-events: none; }
.toast.on { transform: translate(-50%, 0); }
#confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 80; }
.floatxp { position: fixed; z-index: 85; font-weight: 900; font-size: 1.4rem; color: #2B2342; background: var(--gold); padding: 4px 14px; border-radius: 999px; pointer-events: none; animation: floatup 1.3s ease-out forwards; box-shadow: 0 6px 20px rgba(242, 179, 61, .6); }

/* animations */
@keyframes slideIn { from { opacity: 0; transform: translateY(18px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-7px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(3px); } }
@keyframes pop { from { opacity: 0; transform: scale(.94); } to { opacity: 1; transform: none; } }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 55%, transparent), var(--shadow); } 50% { box-shadow: 0 0 0 16px transparent, var(--shadow); } }
@keyframes glow { 0%, 100% { box-shadow: 0 4px 0 rgba(0, 0, 0, .18), 0 0 0 0 rgba(242, 179, 61, .6); } 50% { box-shadow: 0 4px 0 rgba(0, 0, 0, .18), 0 0 0 10px rgba(242, 179, 61, 0); } }
@keyframes breathe { 0%, 100% { opacity: .5; transform: scale(1); } 50% { opacity: 1; transform: scale(1.06); } }
@keyframes bounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
@keyframes bump { 0% { transform: scale(1); } 40% { transform: scale(1.22); } 100% { transform: scale(1); } }
@keyframes floatup { from { opacity: 1; transform: translateY(0) scale(.9); } to { opacity: 0; transform: translateY(-90px) scale(1.15); } }
@keyframes celebrate { 0% { box-shadow: var(--shadow); } 30% { box-shadow: 0 0 0 8px rgba(242, 179, 61, .55), var(--shadow); } 100% { box-shadow: var(--shadow); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
:root[data-motion="off"] *, :root[data-motion="off"] *::before, :root[data-motion="off"] *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }

@media print {
  body * { visibility: hidden; }
  .cert, .cert * { visibility: visible; }
  .cert { position: absolute; left: 0; top: 0; width: 100%; }
}

@media (max-width: 560px) {
  .topbar { gap: 6px; padding-left: 10px; padding-right: 10px; }
  .pill.level { display: none; }
  .nav { margin-left: 0; }
  .nav a { padding: 8px 8px; }
  .icon-btn { width: 36px; height: 36px; }
  .stage { padding: 22px 18px 20px; }
}
@media (max-width: 560px) {
  .brand { display: none; }
  .nav a { font-size: .85rem; }
  .pill { padding: 5px 8px; gap: 4px; }
}
