/* Hidden Word — white "paper & ink" theme. Accent comes from the profile colour (--acc). */
:root {
  --bg: #FFFFFF;
  --paper: #FBF9F5;
  --paper-2: #F5F1EA;
  --edge: #ECE6DC;
  --line: #DED6C8;
  --ink: #1D1A16;
  --soft: #4A443C;
  --mut: #7C7468;
  --dim: #A59D90;
  --acc: #B3261E;
  --acc-soft: color-mix(in srgb, var(--acc) 9%, white);
  --acc-line: color-mix(in srgb, var(--acc) 35%, white);
  --gold: #B07D12;
  --gold-soft: #FBF3DF;
  --new: #CFC7BA;
  --learning: #D9534A;
  --growing: #D9952B;
  --memorized: #3E8E5E;
  --serif: "Crimson Pro", "Iowan Old Style", Georgia, serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --vs: 22px;
  --r: 16px;
  --shadow: 0 1px 2px rgba(60, 45, 20, .05), 0 8px 24px -12px rgba(60, 45, 20, .18);
  color-scheme: light;
}
[data-size="s"] { --vs: 19px; }
[data-size="l"] { --vs: 26px; }

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body { font: 15px/1.5 var(--sans); -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; min-height: 100dvh; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--acc); }
[hidden] { display: none !important; }

/* ---------- shell ---------- */
.top { position: sticky; top: 0; z-index: 20; background: rgba(255,255,255,.92); backdrop-filter: blur(10px); border-bottom: 1px solid var(--edge); }
.top-in { max-width: 640px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 10px; min-height: 54px; }
.brand { font: 600 22px/1 var(--serif); letter-spacing: .2px; display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--ink); }
.brand i { font-style: italic; color: var(--acc); margin-left: -.14em; }
.brand svg { width: 22px; height: 22px; color: var(--acc); }
.top .sp { flex: 1; }
.sync { width: 8px; height: 8px; border-radius: 50%; background: var(--dim); transition: background .3s; }
.sync.ok { background: var(--memorized); } .sync.busy { background: var(--growing); } .sync.off { background: var(--learning); }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--acc); color: #fff; display: grid; place-items: center; font: 600 14px var(--sans); border: 0; }
.back { border: 0; background: none; padding: 6px; margin-left: -6px; display: flex; align-items: center; gap: 4px; color: var(--soft); font-weight: 500; }
.back svg { width: 22px; height: 22px; }
.top h1 { font: 600 20px/1.2 var(--serif); margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

main { max-width: 640px; margin: 0 auto; padding: 18px 16px 110px; }
body.focus main { padding-bottom: 40px; }
body.focus .nav { display: none; }

.nav { position: fixed; bottom: 0; left: 0; right: 0; z-index: 20; background: rgba(255,255,255,.96); backdrop-filter: blur(10px); border-top: 1px solid var(--edge); padding-bottom: env(safe-area-inset-bottom); }
.nav-in { max-width: 640px; margin: 0 auto; display: grid; grid-template-columns: repeat(4, 1fr); }
.nav a { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 9px 0 10px; color: var(--mut); text-decoration: none; font-size: 11.5px; font-weight: 500; position: relative; }
.nav a svg { width: 23px; height: 23px; }
.nav a.on { color: var(--acc); }
.nav a.on::before { content: ""; position: absolute; top: 0; left: 32%; right: 32%; height: 2.5px; border-radius: 0 0 3px 3px; background: var(--acc); }

/* ---------- type ---------- */
.eyebrow { font: 600 11.5px/1 var(--sans); letter-spacing: 1.4px; text-transform: uppercase; color: var(--acc); }
.muted { color: var(--mut); } .soft { color: var(--soft); } .small { font-size: 13px; }
h2 { font: 600 26px/1.15 var(--serif); margin: 4px 0 2px; }
h3 { font: 600 19px/1.2 var(--serif); margin: 0; }
.sec { margin: 26px 0 10px; display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.sec h3 { font-size: 20px; }

.scripture { font: 400 var(--vs)/1.55 var(--serif); color: var(--ink); text-wrap: pretty; }
.scripture.drop::first-letter { float: left; font-size: 3.15em; line-height: .82; padding: 0 .045em 0 0; margin-top: -.04em; color: var(--acc); font-weight: 600; }
.scripture sup { font: 600 .5em var(--sans); color: var(--acc); vertical-align: .75em; margin: 0 .2em 0 .1em; }
.scripture .vn { display: inline; }
.ref { font: 600 italic 17px/1.3 var(--serif); color: var(--soft); }
.ref-big { font: 600 30px/1.1 var(--serif); }
.ver { display: inline-block; font: 600 10.5px/1 var(--sans); letter-spacing: .8px; color: var(--mut); border: 1px solid var(--line); border-radius: 6px; padding: 3px 5px; vertical-align: middle; }

/* ---------- surfaces ---------- */
.card { background: var(--paper); border: 1px solid var(--edge); border-radius: var(--r); padding: 18px; }
.card + .card { margin-top: 12px; }
.card.tap { cursor: pointer; transition: transform .12s, box-shadow .2s; }
.card.tap:active { transform: scale(.99); }
.focus-card { background: #fff; border: 1px solid var(--edge); border-top: 3px solid var(--acc); border-radius: var(--r); padding: 20px 20px 18px; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.focus-card::after { content: "”"; position: absolute; right: 12px; bottom: -46px; font: 700 160px/1 var(--serif); color: var(--acc-soft); pointer-events: none; }
.focus-card .scripture { margin: 12px 0 12px; position: relative; z-index: 1; }

.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.row .sp { flex: 1; }
.stack > * + * { margin-top: 10px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.pill { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 6px 11px; font: 600 12.5px/1 var(--sans); background: var(--paper-2); color: var(--soft); }
.pill svg { width: 15px; height: 15px; }
.pill.gold { background: var(--gold-soft); color: var(--gold); }
.lvl { display: inline-flex; align-items: center; gap: 6px; font: 600 12px/1 var(--sans); color: var(--soft); }
.lvl::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--c, var(--new)); }
.lvl.new { --c: var(--new); } .lvl.learning { --c: var(--learning); } .lvl.growing { --c: var(--growing); } .lvl.memorized { --c: var(--memorized); }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border-radius: 12px; padding: 12px 18px; border: 1px solid var(--line); background: #fff; font-weight: 600; font-size: 15px; color: var(--ink); text-decoration: none; min-height: 46px; transition: background .15s, transform .1s; }
.btn:active { transform: scale(.98); }
.btn svg { width: 18px; height: 18px; }
.btn.pri { background: var(--acc); border-color: var(--acc); color: #fff; }
.btn.soft { background: var(--acc-soft); border-color: var(--acc-line); color: var(--acc); }
.btn.ghost { border-color: transparent; background: none; color: var(--soft); }
.btn.danger { color: #A3231B; border-color: #EBC9C5; }
.btn.block { width: 100%; }
.btn.sm { padding: 8px 12px; min-height: 36px; font-size: 13.5px; border-radius: 10px; }
.btn:disabled { opacity: .45; pointer-events: none; }
.icon-btn { border: 1px solid var(--line); background: #fff; width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; color: var(--soft); flex: none; }
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn.on { background: var(--acc-soft); border-color: var(--acc-line); color: var(--acc); }

.seg { display: flex; background: var(--paper-2); border-radius: 12px; padding: 3px; gap: 3px; }
.seg button { flex: 1; border: 0; background: none; border-radius: 9px; padding: 9px 8px; font-weight: 600; font-size: 13.5px; color: var(--mut); }
.seg button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(60,45,20,.14); }

.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 16px 4px; margin: 0 -16px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 8px 13px; font-size: 13.5px; font-weight: 500; color: var(--soft); white-space: nowrap; }
.chip.on { background: var(--acc); border-color: var(--acc); color: #fff; }
.chip.add { border-style: dashed; }

/* ---------- forms ---------- */
label.f { display: block; font: 600 13px var(--sans); color: var(--soft); margin: 14px 0 6px; }
.inp { width: 100%; border: 1px solid var(--line); background: #fff; border-radius: 12px; padding: 12px 14px; font-size: 16px; outline: none; transition: border-color .15s, box-shadow .15s; }
.inp:focus { border-color: var(--acc); box-shadow: 0 0 0 3px var(--acc-soft); }
.inp.big { font: 500 22px var(--serif); padding: 12px 16px; }
textarea.inp { min-height: 150px; resize: vertical; font: 17px/1.5 var(--serif); }
.hint { font-size: 13px; color: var(--mut); margin-top: 6px; }
.hint.err { color: #A3231B; }
.hint.ok { color: var(--memorized); }

/* ---------- lists ---------- */
.list { border: 1px solid var(--edge); border-radius: var(--r); overflow: hidden; background: #fff; }
.li { display: flex; gap: 12px; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--edge); text-decoration: none; color: inherit; }
.li:last-child { border-bottom: 0; }
.li:active { background: var(--paper); }
.li .main { flex: 1; min-width: 0; }
.li .t { font: 600 17px/1.25 var(--serif); }
.li .s { font: 15px/1.35 var(--serif); color: var(--mut); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.li .chev { color: var(--dim); width: 18px; height: 18px; flex: none; }
.empty { text-align: center; padding: 34px 18px; color: var(--mut); }
.empty .scripture { color: var(--soft); font-style: italic; margin-bottom: 6px; }

/* ---------- heat strip ---------- */
.heat { display: flex; flex-wrap: wrap; gap: 4px; }
.heat i { width: 16px; height: 16px; border-radius: 4px; background: var(--paper-2); border: 1px solid var(--edge); }
.heat.lg i { width: 26px; height: 26px; border-radius: 6px; display: grid; place-items: center; font: 600 10px var(--sans); font-style: normal; color: rgba(0,0,0,.45); cursor: pointer; }
.heat i.learning { background: #F6D3CF; border-color: #EDB3AC; }
.heat i.growing { background: #F6E1BC; border-color: #EBC98C; }
.heat i.memorized { background: #CFE7D7; border-color: #A8D2B6; }
.heat i.next { background: #fff; border: 1.5px dashed var(--acc); }
.heat.lg i.learning, .heat.lg i.growing, .heat.lg i.memorized { color: rgba(0,0,0,.6); }
.legend { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 10px; }

.bar { height: 6px; border-radius: 6px; background: var(--paper-2); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--acc); border-radius: 6px; transition: width .35s; }

/* ---------- flip ---------- */
.flip-wrap { perspective: 1400px; margin: 14px 0 12px; touch-action: pan-y; user-select: none; }
.flip { position: relative; min-height: 360px; transition: transform .55s cubic-bezier(.2,.75,.25,1); transform-style: preserve-3d; cursor: pointer; }
.flip.over { transform: rotateY(180deg); }
.flip.out-l { animation: outL .22s ease-in forwards; } .flip.out-r { animation: outR .22s ease-in forwards; }
.flip.in { animation: inC .28s ease-out; }
@keyframes outL { to { transform: translateX(-60px) rotate(-3deg); opacity: 0; } }
@keyframes outR { to { transform: translateX(60px) rotate(3deg); opacity: 0; } }
@keyframes inC { from { transform: translateY(10px) scale(.98); opacity: 0; } }
.face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; border-radius: 22px; background: #fff; border: 1px solid var(--edge); box-shadow: var(--shadow); padding: 26px 24px; display: flex; flex-direction: column; overflow-y: auto; }
.face.back { transform: rotateY(180deg); }
.face .mid { flex: 1; display: flex; flex-direction: column; justify-content: center; }
.face.front { border-top: 4px solid var(--acc); text-align: center; background: radial-gradient(120% 80% at 50% 0%, var(--acc-soft), #fff 60%); }
.face.front .scripture.drop { text-align: left; }   /* a drop cap needs left-aligned lines; centred text leaves a gap beside the cap */
.face .tapnote { font-size: 12px; color: var(--dim); text-align: center; margin-top: 12px; }
.flip-ctrl { display: flex; align-items: center; gap: 10px; justify-content: center; }
.counter { font: 600 13px var(--sans); color: var(--mut); min-width: 70px; text-align: center; }

/* ---------- practice ---------- */
.words { font: 400 var(--vs)/1.7 var(--serif); }
.words span { border-radius: 4px; transition: color .2s, background .2s; }
.words .hid { color: transparent; background: none; border-bottom: 2px solid var(--line); cursor: pointer; }
.words .hid.hl::first-letter { color: var(--mut); }
.words .peek { color: var(--acc); }
.words .ok { color: var(--ink); }
.words .bad { color: #B3261E; background: #FBE6E3; }
.words .cur { border-bottom-color: var(--acc); background: var(--acc-soft); }
.letters { font: 500 calc(var(--vs) + 2px)/1.7 var(--serif); letter-spacing: .5px; word-spacing: .18em; color: var(--soft); }
.typer { position: relative; }
.typer input { position: absolute; opacity: 0; width: 1px; height: 1px; left: 50%; top: 0; border: 0; padding: 0; }
.typer .tap { margin-top: 14px; text-align: center; font-size: 13px; color: var(--mut); }
.stepper { display: flex; align-items: center; gap: 12px; }
.stepper .dots { display: flex; gap: 5px; flex: 1; justify-content: center; }
.stepper .dots i { width: 22px; height: 6px; border-radius: 6px; background: var(--paper-2); }
.stepper .dots i.on { background: var(--acc); }

.session-top { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.session-top .bar { flex: 1; }
.prompt-prev { font: italic 400 17px/1.5 var(--serif); color: var(--mut); border-left: 3px solid var(--edge); padding: 2px 0 2px 12px; margin-bottom: 16px; max-height: 9.5em; overflow: hidden; }
.grades { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 18px; }
.grades.three { grid-template-columns: repeat(3, 1fr); }
.grades button { border: 1px solid var(--line); background: #fff; border-radius: 12px; padding: 10px 4px 9px; display: flex; flex-direction: column; align-items: center; gap: 3px; font-weight: 600; font-size: 14px; }
.grades button small { font-weight: 500; font-size: 11.5px; color: var(--mut); }
.grades .g1 { color: #A3231B; } .grades .g2 { color: #9A5B00; } .grades .g3 { color: #2F7049; } .grades .g4 { color: #1F5E8C; }
.grades button.sug { border-width: 2px; border-color: currentColor; background: var(--paper); }
.big-done { text-align: center; padding: 30px 10px 10px; }
.big-done svg { width: 56px; height: 56px; color: var(--gold); }
.score { font: 600 40px/1 var(--serif); color: var(--acc); }

/* ---------- sheet & toast ---------- */
.sheet-bg { position: fixed; inset: 0; background: rgba(29,26,22,.35); z-index: 50; display: flex; align-items: flex-end; justify-content: center; animation: fade .2s; }
.sheet { background: #fff; width: 100%; max-width: 640px; max-height: 92dvh; overflow-y: auto; border-radius: 22px 22px 0 0; padding: 20px 16px calc(20px + env(safe-area-inset-bottom)); animation: up .25s cubic-bezier(.2,.8,.2,1); }
.sheet .grab { width: 40px; height: 4px; border-radius: 4px; background: var(--line); margin: -6px auto 14px; }
@keyframes fade { from { opacity: 0; } } @keyframes up { from { transform: translateY(40px); opacity: 0; } }
.toast { position: fixed; left: 50%; bottom: calc(84px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--ink); color: #fff; padding: 11px 16px; border-radius: 12px; font-size: 14px; font-weight: 500; z-index: 60; box-shadow: var(--shadow); animation: up .2s; max-width: calc(100% - 32px); }
body.focus .toast { bottom: 24px; }

.code { font: 12.5px/1.45 ui-monospace, Consolas, monospace; background: var(--paper-2); border: 1px solid var(--edge); border-radius: 10px; padding: 10px 12px; word-break: break-all; user-select: all; }
.steps { padding-left: 20px; margin: 8px 0 0; } .steps li { margin: 6px 0; }
.swatches { display: flex; gap: 10px; flex-wrap: wrap; }
.swatches button { width: 34px; height: 34px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 1px var(--line); }
.swatches button.on { box-shadow: 0 0 0 2px var(--ink); }
.pin { letter-spacing: 8px; text-align: center; font-size: 24px; }

.splash { min-height: 70dvh; display: grid; place-items: center; text-align: center; }
.who { display: grid; gap: 10px; }
.who button { display: flex; align-items: center; gap: 14px; border: 1px solid var(--edge); background: #fff; border-radius: 16px; padding: 14px 16px; text-align: left; font: 600 18px var(--serif); }
.who .avatar { width: 40px; height: 40px; font-size: 17px; }
.who svg.lock { width: 16px; height: 16px; color: var(--dim); margin-left: auto; }

@media (min-width: 700px) {
  main { padding-top: 28px; }
  .flip { min-height: 400px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
.top-inst { min-height: 34px; padding: 6px 12px; border-radius: 999px; font-size: 13.5px; gap: 6px; }
.top-inst svg { width: 16px; height: 16px; }
.rv + .rv { border-top: 1px solid var(--edge); margin-top: 12px; padding-top: 12px; }
.grades.mini { margin-top: 8px; gap: 6px; }
.grades.mini button { padding: 7px 4px; font-size: 13px; }
