/* SCROLL. Warm ivory, forest green and gold (light); deep charcoal, emerald and muted gold (dark). */
:root {
  --bg: #F6F2E8; --bg-2: #EFE9DA; --surface: #FFFDF8; --surface-2: #F0EBDD; --text: #1B211D; --muted: #667067;
  --line: #E2DBC8; --accent: #1F5A43; --accent-2: #2F7A5A; --accent-text: #FFFFFF; --accent-soft: #E1ECE2;
  --gold: #B98A2E; --gold-soft: #F4E8C6; --gold-text: #7A5A14;
  --good: #2E7A4A; --good-bg: #DDEFDF; --bad: #B23A2E; --bad-bg: #F8DEDA; --warn-bg: #F7E9C8;
  --shadow: 0 1px 2px rgba(31,40,32,.06), 0 8px 24px rgba(31,40,32,.07);
  --hero: linear-gradient(145deg, #1F5A43 0%, #2B6F52 55%, #3C7E5C 100%);
  --serif: 'Iowan Old Style', Charter, 'Palatino Linotype', Palatino, Georgia, 'Times New Roman', serif;
  --sans: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --radius: 20px; --ease: cubic-bezier(.22,.61,.36,1); --spring: cubic-bezier(.34,1.56,.64,1);
  --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px);
}
:root[data-theme="paper"] { --bg: #EAE5DA; --bg-2: #E2DCCD; --surface: #F4F0E6; --surface-2: #DFD9CB; --line: #CFC8B6; --accent-soft: #D8DCCB; }
:root[data-theme="dark"] {
  --bg: #121513; --bg-2: #181C19; --surface: #1C211E; --surface-2: #252B27; --text: #EDEBE4; --muted: #A2A79F;
  --line: #2E352F; --accent: #4DB88B; --accent-2: #3FA079; --accent-text: #0E1A14; --accent-soft: #1F2E27;
  --gold: #C9A24B; --gold-soft: #33301F; --gold-text: #E2C27A;
  --good: #8FCB9B; --good-bg: #1F3524; --bad: #F0958B; --bad-bg: #3D1F1B; --warn-bg: #3A3220;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.35);
  --hero: linear-gradient(145deg, #14382B 0%, #1B4A38 60%, #235A45 100%);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.5 var(--sans); min-height: 100dvh; padding-bottom: calc(84px + var(--safe-b)); -webkit-tap-highlight-color: transparent; }
body[data-chrome="none"] { padding-bottom: 0; }
h1, h2 { font-family: var(--serif); line-height: 1.2; margin: 0; letter-spacing: -.01em; }
h1 { font-size: 1.75rem; } h2 { font-size: 1.25rem; }
.display { font-family: var(--serif); font-size: 2.1rem; font-weight: 600; line-height: 1.1; margin: 0; }
.lead { font-size: 1.05rem; color: var(--muted); margin: 0; }
p { margin: 0; } a { color: inherit; }
.muted { color: var(--muted); } .small { font-size: .85rem; } .bad { color: var(--bad); }
.eyebrow { display: block; font: 700 .72rem var(--sans); letter-spacing: .12em; text-transform: uppercase; color: var(--gold-text); }
.sr-only, .skip:not(:focus) { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; padding: 0; }
.skip:focus { position: fixed; top: 8px; left: 8px; z-index: 100; background: var(--surface); padding: 8px 12px; border-radius: 8px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 8px; }
main { max-width: 720px; margin: 0 auto; padding: 8px 16px 110px; }
main:focus, main:focus-visible { outline: none; }
.view { display: flex; flex-direction: column; gap: 24px; animation: rise .45s var(--ease); }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
:root[data-motion="reduce"] *, :root[data-motion="reduce"] *::before { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
@media (prefers-reduced-motion: reduce) { *, *::before { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }

/* chrome */
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: calc(10px + var(--safe-t)) 16px 10px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(14px); }
.top:empty { display: none; }
.brand { font: 700 .92rem var(--sans); letter-spacing: .28em; text-decoration: none; color: var(--accent); }
.chip-player, .player-switch { font: 600 .9rem var(--sans); background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: 99px; padding: 6px 12px; }
.icon-btn { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 99px; background: var(--surface); border: 1px solid var(--line); text-decoration: none; font-size: 1.05rem; }
.bottom-nav { position: fixed; z-index: 30; left: 10px; right: 10px; bottom: calc(8px + var(--safe-b)); display: flex; justify-content: space-around; padding: 6px; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(16px); border: 1px solid var(--line); border-radius: 26px; box-shadow: var(--shadow); max-width: 560px; margin: 0 auto; }
.bottom-nav:empty { display: none; }
.bottom-nav a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 7px 2px; font-size: .68rem; text-decoration: none; color: var(--muted); border-radius: 18px; transition: background .2s, color .2s, transform .2s var(--spring); }
.bottom-nav a.on { color: var(--accent); background: var(--accent-soft); font-weight: 700; transform: translateY(-2px); }
.bottom-nav .ico { font-size: 1.2rem; line-height: 1.2; }
.notice { background: var(--warn-bg); text-align: center; font-size: .9rem; padding: 8px 12px; }
.install { position: fixed; z-index: 40; right: 12px; bottom: calc(92px + var(--safe-b)); box-shadow: var(--shadow); }
body:not([data-view="home"]):not([data-view="settings"]) .install { display: none; }
.toast { position: fixed; z-index: 120; left: 50%; bottom: calc(100px + var(--safe-b)); transform: translate(-50%, 20px); background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 99px; font-size: .9rem; opacity: 0; pointer-events: none; transition: .3s var(--spring); max-width: 90vw; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* controls */
.btn { font: 600 1rem var(--sans); display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 46px; padding: 10px 18px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); color: var(--text); text-decoration: none; cursor: pointer; transition: transform .15s var(--spring), background .15s, box-shadow .15s; }
.btn:hover { background: var(--surface-2); } .btn:active { transform: scale(.96); }
.btn.primary { background: var(--accent); color: var(--accent-text); border-color: transparent; box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 35%, transparent); }
.btn.primary:hover { filter: brightness(1.08); background: var(--accent); }
.btn.big { min-height: 54px; font-size: 1.08rem; width: 100%; }
.btn.ghost { background: transparent; } .btn.small { min-height: 38px; padding: 6px 14px; font-size: .9rem; border-radius: 12px; }
.btn:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }
.linkish { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; font-weight: 600; text-decoration: underline; cursor: pointer; }
.input { width: 100%; min-height: 48px; padding: 10px 14px; font: 1rem var(--sans); color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 14px; }
.label { font-weight: 600; font-size: .92rem; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; } .row.between { justify-content: space-between; } .row.tight { gap: 8px; flex-wrap: nowrap; }
.stack { display: flex; flex-direction: column; gap: 12px; } .stack.tight { gap: 6px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.two { display: grid; grid-template-columns: 1fr; gap: 12px; } @media (min-width: 560px) { .two { grid-template-columns: 1fr 1fr; } }
.card, .card-static { display: flex; flex-direction: column; gap: 8px; padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); text-decoration: none; }
.card { transition: transform .2s var(--spring), border-color .2s, box-shadow .2s; }
.card:hover { border-color: var(--accent); transform: translateY(-3px); } .card:active { transform: scale(.985); }
.ref { font-family: var(--serif); font-size: 1.1rem; }
.card-text { font-family: var(--serif); color: var(--muted); font-size: .95rem; }
.card-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.callout { padding: 12px 14px; background: var(--gold-soft); color: var(--gold-text); border-radius: 14px; font-size: .92rem; border-left: 4px solid var(--gold); }
.stage { display: inline-block; padding: 2px 10px; border-radius: 99px; background: var(--surface-2); font: 700 .72rem var(--sans); letter-spacing: .03em; }
.s-learning { background: var(--surface-2); } .s-practising { background: var(--accent-soft); color: var(--accent); }
.s-memorised { background: var(--good-bg); color: var(--good); } .s-mastered { background: var(--gold-soft); color: var(--gold-text); }
.pill { display: inline-block; padding: 8px 14px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface); font: 600 .9rem var(--sans); color: var(--text); text-decoration: none; cursor: pointer; white-space: nowrap; transition: transform .15s var(--spring), background .15s; }
.pill:active { transform: scale(.95); } .pill.on { background: var(--accent); color: var(--accent-text); border-color: transparent; }
.pill.alt.on { background: var(--gold); color: #fff; } .pill.dashed { border-style: dashed; color: var(--muted); background: transparent; }
.chips-row { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; } .chips-row::-webkit-scrollbar { display: none; }
.tabs { display: flex; border-bottom: 1px solid var(--line); }
.tabs a { flex: 1; text-align: center; padding: 12px; text-decoration: none; color: var(--muted); font-weight: 600; border-bottom: 3px solid transparent; }
.tabs a.on { color: var(--accent); border-color: var(--accent); }
.empty { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 32px 8px; color: var(--muted); }
.banner { background: var(--accent-soft); padding: 11px 14px; border-radius: 14px; font-weight: 600; animation: pop-in .5s var(--spring) both; }
.banner.gold { background: var(--gold-soft); color: var(--gold-text); } .banner.warn { background: var(--warn-bg); }
@keyframes pop-in { from { opacity: 0; transform: scale(.9) translateY(8px); } to { opacity: 1; transform: none; } }
.sticky-actions { position: sticky; bottom: calc(86px + var(--safe-b)); z-index: 10; padding: 8px 0; }

/* welcome + hero */
.welcome { display: flex; flex-direction: column; gap: 18px; padding-top: 10vh; }
.avatar-row { display: flex; flex-wrap: wrap; gap: 8px; }
.avatar-pick { font-size: 1.6rem; width: 54px; height: 54px; border-radius: 16px; border: 2px solid var(--line); background: var(--surface); cursor: pointer; transition: transform .2s var(--spring); }
.avatar-pick.on { border-color: var(--accent); background: var(--accent-soft); transform: scale(1.08); }
.hero { background: var(--hero); color: #F6F2E8; border-radius: 28px; padding: 22px; display: flex; flex-direction: column; gap: 18px; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.hero::after { content: ''; position: absolute; right: -60px; top: -60px; width: 200px; height: 200px; border-radius: 50%; background: radial-gradient(circle, rgba(201,162,75,.35), transparent 70%); pointer-events: none; }
.hero .eyebrow { color: #E7D9A8; } .hero .display { font-size: 1.7rem; margin: 4px 0; } .hero .muted { color: rgba(246,242,232,.75); }
.tagline { font-family: var(--serif); font-style: italic; color: rgba(246,242,232,.82); font-size: .98rem; }
.hero-top { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; position: relative; z-index: 1; }
.continue { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 16px; border-radius: 18px; background: rgba(255,253,248,.96); color: #1B211D; text-decoration: none; transition: transform .2s var(--spring); position: relative; z-index: 1; }
.continue:active { transform: scale(.98); } .continue > div { display: flex; flex-direction: column; gap: 2px; }
.continue .muted { color: #667067; } .continue .eyebrow { color: #7A5A14; }
.continue-side { align-items: flex-end; } .go { font-size: 1.4rem; color: #1F5A43; }
.hero .btn.primary { background: #C9A24B; color: #231A05; box-shadow: none; position: relative; z-index: 1; }
.hero .stack { position: relative; z-index: 1; } .hero .btn { border-color: transparent; }
.challenge { display: flex; flex-direction: column; gap: 10px; padding: 14px; border-radius: var(--radius); background: linear-gradient(145deg, var(--gold-soft), var(--surface)); border: 1px solid var(--line); }
.challenge .card { box-shadow: none; }

/* rings, pips, rank, stats */
.ring { position: relative; width: var(--size, 88px); height: var(--size, 88px); flex: none; }
.ring svg { display: block; } .ring-bg { stroke: color-mix(in srgb, currentColor 16%, transparent); } .ring-fg { stroke: var(--gold); transition: stroke-dasharray .8s var(--ease); }
.ring-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.1; }
.ring-center strong { font: 700 1.15rem var(--serif); }
.hero .ring-bg { stroke: rgba(255,255,255,.2); } .hero .ring-fg { stroke: #E7C66E; }
.pips { display: inline-flex; gap: 3px; } .pips i { width: 14px; height: 6px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--line); }
.pips i.on { background: var(--gold); border-color: var(--gold); }
.rank-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; display: flex; flex-direction: column; gap: 10px; box-shadow: var(--shadow); }
.rank-top { display: flex; align-items: center; gap: 12px; } .avatar { font-size: 2rem; }
.rank-name { font: 600 1.45rem var(--serif); color: var(--accent); }
.rank-stats { display: flex; gap: 18px; font-size: .95rem; }
.bar { height: 10px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.bar span { display: block; height: 100%; width: var(--w, 0%); background: linear-gradient(90deg, var(--accent), var(--gold)); border-radius: 99px; transition: width .8s var(--ease); }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; } .stats.four { grid-template-columns: repeat(2, 1fr); } @media (min-width: 480px) { .stats.four { grid-template-columns: repeat(4, 1fr); } }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 14px 10px; display: flex; flex-direction: column; align-items: center; text-align: center; box-shadow: var(--shadow); }
.stat strong { font: 700 1.7rem var(--serif); color: var(--accent); }
.milestone { display: flex; flex-direction: column; gap: 8px; padding: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; }
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; align-items: end; height: 110px; }
.wday { display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.wbar { flex: 1; width: 100%; max-width: 34px; display: flex; align-items: flex-end; background: var(--surface-2); border-radius: 10px; overflow: hidden; }
.wbar i { display: block; width: 100%; height: var(--h, 0%); min-height: 4px; background: var(--accent-2); border-radius: 10px; transition: height .7s var(--ease); }
.wday.hit .wbar i { background: var(--gold); } .wday.today .small { color: var(--accent); font-weight: 800; }
.board, .ranks, .history, .badges, .players, .stages, .levels, .check, .prompts { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.history li, .ranks li, .player-row { display: flex; align-items: center; gap: 12px; justify-content: space-between; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; flex-wrap: wrap; }
.ranks li.on { border-color: var(--gold); background: var(--gold-soft); }
.badges li { display: flex; gap: 12px; align-items: center; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; opacity: .55; }
.badges li > div { display: flex; flex-direction: column; } .badges li.on { opacity: 1; border-color: var(--gold); background: linear-gradient(145deg, var(--gold-soft), var(--surface)); }
.badge-ico { font-size: 1.6rem; }

/* journey */
.journey-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.stages { gap: 0; position: relative; }
.stage-card { display: flex; gap: 14px; padding-bottom: 18px; position: relative; }
.stage-card::before { content: ''; position: absolute; left: 17px; top: 36px; bottom: 0; width: 2px; background: var(--line); }
.stage-card:last-child::before { display: none; } .stage-card.done::before { background: var(--gold); }
.stage-dot { width: 36px; height: 36px; flex: none; border-radius: 50%; display: grid; place-items: center; font: 700 .9rem var(--sans); background: var(--surface-2); border: 2px solid var(--line); z-index: 1; }
.stage-card.done .stage-dot { background: var(--gold); border-color: var(--gold); color: #fff; }
.stage-card.current .stage-dot { background: var(--accent); border-color: var(--accent); color: var(--accent-text); box-shadow: 0 0 0 5px var(--accent-soft); }
.stage-main { flex: 1; display: flex; flex-direction: column; gap: 6px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; min-width: 0; }
.stage-card.current .stage-main { border-color: var(--accent); box-shadow: var(--shadow); } .stage-card.locked .stage-main { opacity: .6; }
.chip-state { font: 700 .7rem var(--sans); letter-spacing: .04em; padding: 3px 9px; border-radius: 99px; background: var(--surface-2); white-space: nowrap; }
.chip-state.done { background: var(--gold-soft); color: var(--gold-text); } .chip-state.current { background: var(--accent-soft); color: var(--accent); }
.check li { font-size: .92rem; color: var(--muted); } .check li.ok { color: var(--good); font-weight: 600; }
.levels { gap: 10px; } .level { display: flex; flex-direction: column; gap: 6px; padding: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; }
.level.cleared { border-color: var(--gold); } .level.locked { opacity: .55; }
.journey-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; text-decoration: none; flex-wrap: wrap; transition: transform .2s var(--spring), border-color .2s; }
a.journey-row:hover { border-color: var(--accent); transform: translateY(-2px); }
.journey-row > div:first-child { display: flex; flex-direction: column; } .journey-next { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.reflect, .recite-box { width: 100%; padding: 14px; font: 1.05rem/1.6 var(--serif); color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 16px; resize: vertical; }
.reflect:focus, .recite-box:focus { border-color: var(--accent); outline: 3px solid var(--accent-soft); }
.chapter { font: 1.15rem/1.9 var(--serif); padding: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.cv.hl { background: var(--gold-soft); border-radius: 6px; padding: 2px 0; box-shadow: 0 0 0 3px var(--gold-soft); }
.prompts { gap: 4px; padding-left: 18px; list-style: disc; font-size: .95rem; }

/* scripture + games */
.verse { font-family: var(--serif); font-size: 1.3rem; line-height: 2.1; margin: 0; padding: 0; overflow-wrap: anywhere; }
.verse.reading { line-height: 1.8; padding: 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); font-size: 1.28rem; }
.verse.small-verse { font-size: 1.05rem; line-height: 1.8; }
.vnum { font: 600 .65em var(--sans); color: var(--gold); margin-right: 2px; vertical-align: super; }
.game { display: flex; flex-direction: column; gap: 16px; }
.game .verse { padding: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.scorebar { display: flex; font-size: .9rem; gap: 4px; color: var(--muted); } .scorebar strong { color: var(--text); }
.blank, .slot { font: inherit; color: var(--text); width: calc(var(--ch, 4) * .62em + 1.1em); min-width: 3.2em; max-width: 100%; padding: 0 .25em; margin: 0 1px; text-align: center; background: var(--accent-soft); border: 0; border-bottom: 2px solid var(--accent); border-radius: 8px 8px 0 0; line-height: 1.5; transition: background .2s, transform .2s var(--spring); }
.slot { cursor: pointer; display: inline-block; vertical-align: baseline; height: 1.6em; } .slot.active, .blank:focus { outline: 2px solid var(--accent); }
.blank.right, .slot.right { background: var(--good-bg); border-color: var(--good); color: var(--good); animation: tada .45s var(--spring); }
.blank.wrong, .slot.wrong { background: var(--bad-bg); border-color: var(--bad); animation: shake .35s; }
.blank.revealed, .slot.revealed { background: var(--warn-bg); border-color: var(--gold); }
@keyframes shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
@keyframes tada { 0% { transform: scale(1); } 40% { transform: scale(1.18); } 100% { transform: scale(1); } }
.bank, .answer-line { display: flex; flex-wrap: wrap; gap: 8px; min-height: 52px; padding: 10px; border: 1px dashed var(--line); border-radius: var(--radius); }
.answer-line { background: var(--surface); border-style: solid; }
.chip { font: 600 1rem var(--sans); min-height: 42px; padding: 6px 15px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--text); cursor: pointer; box-shadow: 0 2px 0 var(--line); transition: transform .15s var(--spring); }
.chip:active { transform: translateY(2px) scale(.97); box-shadow: none; }
.chip.used { opacity: .25; } .chip.right { background: var(--good-bg); border-color: var(--good); } .chip.wrong { background: var(--bad-bg); border-color: var(--bad); }
.hintline { font: 1.05rem/1.8 var(--serif); letter-spacing: .04em; padding: 10px 14px; background: var(--accent-soft); border-radius: 14px; }
.hit { color: var(--good); } .miss { color: var(--bad); text-decoration: underline wavy; }
.options { display: grid; gap: 10px; } .option.right { background: var(--good-bg); border-color: var(--good); } .option.wrong { background: var(--bad-bg); border-color: var(--bad); }
.mic-wrap { display: grid; place-items: center; padding: 18px 0; }
.mic { width: 108px; height: 108px; border-radius: 50%; border: 0; font-size: 2.6rem; background: var(--hero); color: #fff; cursor: pointer; box-shadow: var(--shadow); transition: transform .2s var(--spring); }
.mic:active { transform: scale(.94); } .mic.on { background: var(--bad); animation: pulse 1.3s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--bad) 50%, transparent); } 100% { box-shadow: 0 0 0 28px transparent; } }
.live-text { min-height: 3.2em; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; font: 1.05rem/1.6 var(--serif); color: var(--muted); }
.preview { padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); display: flex; flex-direction: column; gap: 8px; }
.verse-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 6px; }
.vbtn { min-height: 44px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font: 600 .95rem var(--sans); cursor: pointer; }
.vbtn.on { background: var(--accent); color: var(--accent-text); border-color: transparent; }
.results { text-align: center; align-items: stretch; padding-top: 3vh; }
.big-number { font: 700 3.6rem var(--serif); background: linear-gradient(90deg, var(--accent), var(--gold)); -webkit-background-clip: text; background-clip: text; color: transparent; animation: pop-in .6s var(--spring); }
.big-number .muted { -webkit-text-fill-color: var(--muted); }
.play-ref { font-size: 1.3rem; }
.theme { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); padding: 4px; box-shadow: var(--shadow); }
.theme-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; text-decoration: none; padding: 12px; min-height: 48px; } .theme .grid { padding: 8px; }
.switch { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; } .switch input { width: 22px; height: 22px; margin-top: 2px; accent-color: var(--accent); } .switch span { display: flex; flex-direction: column; }

/* celebration */
.pop { position: fixed; z-index: 90; left: var(--x); top: var(--y); transform: translateX(-50%); font: 700 1.1rem var(--sans); color: var(--good); pointer-events: none; animation: floatup .9s var(--ease) forwards; }
@keyframes floatup { to { transform: translate(-50%, -48px); opacity: 0; } }
.confetti { position: fixed; inset: 0; z-index: 130; pointer-events: none; overflow: hidden; }
.confetti i { position: absolute; left: 50%; top: 40%; width: 9px; height: 14px; background: var(--c); border-radius: 2px; opacity: 0; animation: burst 1.7s var(--ease) var(--d) forwards; }
@keyframes burst { 0% { opacity: 1; transform: translate(0,0) rotate(0); } 100% { opacity: 0; transform: translate(var(--dx), var(--dy)) rotate(var(--rot)); } }
.overlay { position: fixed; inset: 0; z-index: 125; display: grid; place-items: center; padding: 24px; background: rgba(12,18,14,.72); backdrop-filter: blur(6px); animation: fade .3s; }
@keyframes fade { from { opacity: 0; } }
.celebrate { width: min(420px, 100%); text-align: center; display: flex; flex-direction: column; gap: 14px; padding: 32px 24px; border-radius: 28px; background: var(--surface); box-shadow: var(--shadow); animation: pop-in .55s var(--spring); }
.celebrate-icon { font-size: 4rem; animation: float 2.4s ease-in-out infinite; }
@keyframes float { 50% { transform: translateY(-8px); } }
@media (min-width: 720px) { main { padding-top: 16px; } }

/* ═══════════════ App shell: behaves like a native app ═══════════════
   The page itself never scrolls. App bar + content + tab bar fill the screen;
   only the content area scrolls when a screen genuinely needs it (a long list). */
html { height: 100%; overflow: hidden; touch-action: manipulation; overscroll-behavior: none; }
body { height: 100%; height: 100dvh; overflow: hidden; display: flex; flex-direction: column; padding: 0; overscroll-behavior: none; }
body[data-chrome="none"] { padding: 0; }
.notice { flex: none; }
button, a, .tile, .chip, .pill, .list-row, .bottom-nav { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }

/* app bar */
.top { position: relative; flex: none; display: grid; grid-template-columns: 48px 1fr auto; align-items: center; gap: 4px; min-height: calc(54px + var(--safe-t)); padding: var(--safe-t) 10px 0; background: var(--bg); backdrop-filter: none; border-bottom: 1px solid transparent; }
body[data-chrome="none"] .top, body[data-chrome="none"] .bottom-nav { display: none; }
.top .brand { grid-column: 1 / span 2; padding-left: 6px; }
.bar-title { margin: 0; font: 700 1.05rem var(--sans); text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: 0; }
.bar-title.root { grid-column: 1 / span 2; text-align: left; font: 700 1.55rem var(--serif); padding-left: 6px; }
.bar-right { display: flex; gap: 6px; justify-content: flex-end; min-width: 48px; }
.bar-btn { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--surface); box-shadow: var(--shadow); color: var(--text); font: 600 1.5rem/1 var(--sans); text-decoration: none; cursor: pointer; transition: transform .15s var(--spring); }
.bar-btn:active { transform: scale(.9); } .bar-btn.close { font-size: 1.1rem; } .avatar-btn { font-size: 1.25rem; }

/* content */
main { flex: 1 1 auto; min-height: 0; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; max-width: none; margin: 0; padding: 6px 16px 14px; scrollbar-width: none; }
main::-webkit-scrollbar { display: none; }
.view { max-width: 640px; margin: 0 auto; min-height: 100%; gap: 14px; animation: none; }
.view.enter-forward { animation: push-in .3s var(--ease) both; }
.view.enter-back { animation: pop-back .3s var(--ease) both; }
.view.enter-tab, .view.enter-fade, .view.enter-none { animation: fade-in .22s var(--ease) both; }
@keyframes push-in { from { opacity: 0; transform: translateX(28%); } to { opacity: 1; transform: none; } }
@keyframes pop-back { from { opacity: 0; transform: translateX(-22%); } to { opacity: 1; transform: none; } }
@keyframes fade-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* tab bar (in the flex flow, never covering content) */
.bottom-nav { position: relative; flex: none; left: auto; right: auto; bottom: auto; margin: 0 10px calc(8px + var(--safe-b)); width: auto; max-width: 560px; transform: none; }
@media (min-width: 600px) { .bottom-nav { margin-left: auto; margin-right: auto; width: 560px; } }
body[data-chrome="game"] .bottom-nav { display: none; }
body[data-chrome="game"] main { padding-bottom: calc(10px + var(--safe-b)); }
.bottom-nav a { min-height: 50px; justify-content: center; }
.bottom-nav a:active { transform: scale(.92); }
.install { bottom: calc(96px + var(--safe-b)); }
.toast { bottom: calc(96px + var(--safe-b)); }
body[data-chrome="game"] .toast { bottom: calc(100px + var(--safe-b)); }

/* bottom actions pinned to the screen, like a native toolbar */
.action-bar { position: sticky; bottom: -14px; z-index: 5; margin-top: auto; padding: 14px 0 14px; display: flex; gap: 10px; background: linear-gradient(to bottom, transparent, var(--bg) 26%); }
.action-bar > .btn, .action-bar > a.btn { flex: 1; }
.action-bar.stack { flex-direction: column; }
.action-bar.pager { justify-content: space-between; } .action-bar.pager > span { flex: 1; }
.play-sub { margin-top: -4px; text-align: center; }
.results { padding-top: 0; }

/* home: one screen */
.hero { padding: 18px; gap: 14px; border-radius: 26px; }
.hero .display { font-size: 1.55rem; }
.continue { padding: 12px 14px; }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tile { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; min-height: 108px; padding: 14px; text-align: left; border-radius: 20px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); color: var(--text); font: inherit; text-decoration: none; cursor: pointer; transition: transform .18s var(--spring); }
.tile:active { transform: scale(.96); }
.tile-ico { font-size: 1.2rem; line-height: 1; margin-bottom: 4px; }
.tile-big { font: 700 1.8rem/1 var(--serif); }
.tile-accent { background: var(--accent); color: var(--accent-text); border-color: transparent; }
.tile-gold { background: linear-gradient(145deg, var(--gold-soft), var(--surface)); border-color: var(--gold); }
.mini-week { display: flex; gap: 4px; align-items: flex-end; height: 26px; margin-top: 4px; width: 100%; }
.mini-week i { flex: 1; height: var(--h); background: var(--surface-2); border-radius: 4px; }
.mini-week i.hit { background: var(--gold); } .mini-week i.today { outline: 2px solid var(--accent); outline-offset: 1px; }
.bar.thin { height: 6px; width: 100%; margin: 6px 0 2px; }
.strip { display: grid; grid-template-columns: repeat(4, 1fr); background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); overflow: hidden; }
.strip-item { display: flex; flex-direction: column; align-items: center; padding: 10px 4px; text-decoration: none; border-right: 1px solid var(--line); }
.strip-item:last-child { border-right: 0; } .strip-item strong { font: 700 1.35rem var(--serif); color: var(--accent); }
@media (max-height: 720px) { .hero .tagline, .tile .small.muted { display: none; } .tile { min-height: 92px; } .hero .display { font-size: 1.35rem; } }

/* segmented control */
.segmented { display: flex; padding: 4px; gap: 4px; background: var(--surface-2); border-radius: 14px; flex: none; }
.segmented > * { flex: 1; text-align: center; padding: 9px 6px; border-radius: 10px; border: 0; background: none; color: var(--muted); font: 600 .9rem var(--sans); text-decoration: none; cursor: pointer; transition: background .2s, color .2s; }
.segmented > .on { background: var(--surface); color: var(--text); box-shadow: 0 1px 4px rgba(0,0,0,.12); }

/* lists (settings-style) */
.list { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; box-shadow: var(--shadow); }
.list-row, .switch-row, .player-row { display: flex; align-items: center; gap: 12px; min-height: 58px; padding: 10px 14px; border: 0; border-bottom: 1px solid var(--line); background: none; color: var(--text); font: inherit; text-align: left; text-decoration: none; width: 100%; cursor: pointer; border-radius: 0; }
.list > :last-child { border-bottom: 0; }
.list-row:active, .switch-row:active { background: var(--surface-2); }
.list-ico { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; background: var(--surface-2); font-size: 1.05rem; flex: none; }
.list-text { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.chev { color: var(--muted); font-size: 1.4rem; }
.player-row .avatar { font-size: 1.6rem; } .player-row.me { background: var(--accent-soft); }
.ios-switch { appearance: none; -webkit-appearance: none; width: 50px; height: 30px; flex: none; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--line); position: relative; cursor: pointer; transition: background .2s; margin: 0; }
.ios-switch::after { content: ''; position: absolute; top: 2px; left: 2px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform .25s var(--spring); }
.ios-switch:checked { background: var(--accent); border-color: var(--accent); } .ios-switch:checked::after { transform: translateX(20px); }
.radio { width: 22px; height: 22px; accent-color: var(--accent); flex: none; }
.danger-ghost { background: transparent; color: var(--bad); border-color: color-mix(in srgb, var(--bad) 35%, transparent); }
.btn.danger { background: var(--bad); color: #fff; border-color: transparent; }
.theme-pick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.theme-swatch { display: flex; flex-direction: column; align-items: center; gap: 6px; cursor: pointer; }
.swatch { width: 100%; aspect-ratio: 1; border-radius: 16px; border: 2px solid var(--line); }
.theme-auto .swatch { background: linear-gradient(135deg, #F6F2E8 50%, #121513 50%); } .theme-light .swatch { background: #F6F2E8; }
.theme-paper .swatch { background: #EAE5DA; } .theme-dark .swatch { background: #121513; }
.theme-swatch:has(input:checked) .swatch { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.theme-swatch:has(input:focus-visible) .swatch { outline: 3px solid var(--accent); }

/* bottom sheet */
.sheet-backdrop { position: fixed; inset: 0; z-index: 140; display: flex; align-items: flex-end; justify-content: center; background: rgba(10,14,12,.5); animation: fade .2s; }
.sheet { width: min(560px, 100%); max-height: 86dvh; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; padding: 10px 18px calc(18px + var(--safe-b)); background: var(--surface); border-radius: 26px 26px 0 0; box-shadow: 0 -8px 30px rgba(0,0,0,.25); animation: sheet-up .32s var(--spring); }
.sheet-handle { align-self: center; width: 40px; height: 5px; border-radius: 99px; background: var(--line); margin-bottom: 4px; }
.sheet-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.sheet-backdrop.out { animation: fade .18s reverse forwards; } .sheet.out { animation: sheet-down .18s var(--ease) forwards; }
@keyframes sheet-up { from { transform: translateY(100%); } to { transform: none; } }
@keyframes sheet-down { to { transform: translateY(100%); } }
.badge-big { font-size: 3.4rem; text-align: center; } .center { text-align: center; }

/* journey screens */
.journey-head { align-items: flex-start; }
.verse-peek { position: relative; display: block; text-decoration: none; padding: 16px 18px 26px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.verse.peek { font-size: 1.15rem; line-height: 1.6; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.peek-more { position: absolute; right: 14px; bottom: 8px; color: var(--accent); font-weight: 700; }
.next-step { justify-content: flex-start; text-align: left; }
.next-label { display: flex; flex-direction: column; line-height: 1.25; } .next-label .small { opacity: .8; }
.stage-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stage-tile { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; text-decoration: none; transition: transform .18s var(--spring); }
.stage-tile:active { transform: scale(.94); }
.stage-tile .stage-dot { width: 34px; height: 34px; font-size: .85rem; }
.stage-tile.done { border-color: var(--gold); } .stage-tile.done .stage-dot { background: var(--gold); border-color: var(--gold); color: #fff; }
.stage-tile.current { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); } .stage-tile.current .stage-dot { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.stage-tile.locked { opacity: .55; }
.stage-name { font: 600 .8rem var(--sans); }
.quick-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.quick { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 4px; border-radius: 16px; background: var(--surface-2); text-decoration: none; font: 600 .85rem var(--sans); transition: transform .18s var(--spring); }
.quick span { font-size: 1.2rem; } .quick:active { transform: scale(.94); }
.stage-hero { display: flex; gap: 14px; align-items: center; }
.stage-hero .stage-dot.big { width: 58px; height: 58px; font-size: 1.3rem; }
.stage-hero.done .stage-dot { background: var(--gold); border-color: var(--gold); color: #fff; }
.stage-hero.current .stage-dot { background: var(--accent); border-color: var(--accent); color: var(--accent-text); box-shadow: 0 0 0 5px var(--accent-soft); }
.stage-hero h2 { font-size: 1.5rem; margin: 2px 0 4px; }
.mastery-days { display: flex; align-items: baseline; gap: 8px; } .mastery-days strong { font: 700 2.4rem var(--serif); color: var(--gold); }
.levels-list .level { padding: 12px; gap: 4px; }
.reflect-card { display: flex; flex-direction: column; gap: 10px; padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.reflect-card.flip { animation: fade-in .25s var(--ease); }
.reflect-card .reflect { min-height: 150px; }
.dots { display: flex; gap: 6px; } .dots i { width: 22px; height: 6px; border-radius: 99px; background: var(--surface-2); } .dots i.done { background: var(--gold); } .dots i.on { background: var(--accent); width: 34px; }
.theme-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.theme-tile { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; padding: 14px 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; text-decoration: none; box-shadow: var(--shadow); transition: transform .18s var(--spring); }
.theme-tile:active { transform: scale(.95); } .theme-tile strong { font-size: .9rem; }
.theme-ico { font-size: 1.7rem; }
.theme-hero { display: flex; gap: 14px; align-items: center; } .theme-hero .theme-ico { font-size: 2.4rem; }
.list-cards { display: flex; flex-direction: column; gap: 10px; }
.list-cards .card { padding: 14px; gap: 6px; } .list-cards .card-text { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.chips-row.wrap { flex-wrap: wrap; }
.badge-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.badge-tile { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 6px; border-radius: 18px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font: inherit; cursor: pointer; opacity: .55; transition: transform .18s var(--spring); }
.badge-tile.on { opacity: 1; border-color: var(--gold); background: linear-gradient(160deg, var(--gold-soft), var(--surface)); }
.badge-tile:active { transform: scale(.94); } .badge-tile .badge-ico { font-size: 1.9rem; }
.badge-name { font: 600 .76rem/1.2 var(--sans); text-align: center; }
.ranks.compact { gap: 6px; } .ranks.compact li { padding: 10px 14px; } .ranks li.past { opacity: .7; }
.stats { grid-template-columns: repeat(3, 1fr); }
.disclosure summary { cursor: pointer; font-weight: 700; list-style: none; } .disclosure summary::after { content: ' ▾'; color: var(--muted); }
.disclosure[open] summary { margin-bottom: 6px; } .disclosure .prompts { margin: 0; }
.tagline-dark { font-family: var(--serif); font-style: italic; color: var(--accent); }
.welcome { padding-top: 6vh; }
.journey-row { padding: 12px 14px; }

/* The `hidden` attribute must always win over layout classes like .stack. */
[hidden] { display: none !important; }

/* Short phones (iPhone SE, small Androids): a compact layout so screens still fit without scrolling. */
@media (max-height: 740px) {
  .top { min-height: calc(48px + var(--safe-t)); }
  .bar-btn { width: 36px; height: 36px; font-size: 1.3rem; }
  .bar-title.root { font-size: 1.35rem; }
  main { padding-top: 2px; }
  .view { gap: 10px; }
  .bottom-nav { padding: 4px; margin-bottom: calc(6px + var(--safe-b)); }
  .bottom-nav a { min-height: 44px; padding: 4px 2px; }
  .bottom-nav .lbl { font-size: .62rem; }
  .hero { padding: 14px; gap: 10px; }
  .hero .display { font-size: 1.25rem; margin: 2px 0; }
  .hero .ring { --size: 66px !important; }
  .hero .ring svg { width: 66px; height: 66px; }
  .continue { padding: 10px 12px; }
  .tiles { gap: 8px; }
  .tile { min-height: 84px; padding: 10px 12px; }
  .tile-big { font-size: 1.5rem; }
  .strip-item { padding: 7px 4px; } .strip-item strong { font-size: 1.15rem; }
  .btn { min-height: 42px; padding: 8px 14px; }
  .btn.big { min-height: 48px; font-size: 1rem; }
  .verse-peek { padding: 12px 14px 22px; }
  .verse.peek { font-size: 1.02rem; -webkit-line-clamp: 2; }
  .journey-head .ring, .journey-head .ring svg { width: 60px; height: 60px; }
  .stage-tile { padding: 8px 4px; gap: 4px; } .stage-tile .stage-dot { width: 28px; height: 28px; }
  .quick { padding: 7px 4px; }
  .levels-list { gap: 6px; } .levels-list .level { padding: 8px 12px; gap: 2px; } .levels-list .level > p { display: none; }
  .level .btn.small { min-height: 34px; padding: 4px 12px; }
  .reflect-card { padding: 12px; gap: 6px; } .reflect-card .reflect { min-height: 96px; } .reflect-card p.small { display: none; }
  .results .display { font-size: 1.6rem; } .big-number { font-size: 2.6rem; } .results { gap: 8px; }
  .badge-grid { grid-template-columns: repeat(4, 1fr); gap: 8px; } .badge-tile { padding: 10px 4px; } .badge-tile .badge-ico { font-size: 1.5rem; }
  .ranks.compact li { padding: 7px 12px; }
  .theme-grid { grid-template-columns: repeat(4, 1fr); gap: 8px; } .theme-tile { padding: 10px 4px; } .theme-tile .muted { display: none; } .theme-ico { font-size: 1.4rem; }
  .rank-card { padding: 12px; gap: 6px; } .rank-name { font-size: 1.2rem; } .avatar { font-size: 1.6rem; }
  .week { height: 74px; }
  .milestone { padding: 10px; }
  .list-row, .switch-row, .player-row { min-height: 50px; padding: 8px 12px; }
  .segmented > * { padding: 7px 4px; }
  .stage-hero .stage-dot.big { width: 48px; height: 48px; }
  .action-bar { padding: 10px 0; }
  .history li { padding: 8px 12px; }
  .stat { padding: 10px 6px; } .stat strong { font-size: 1.35rem; }
}
