/* Legal Max. One neutral palette plus one accent (brass). Spacing scale 4/8/12/16/24. */
:root {
  --bg: #141312; --card: #262422; --card2: #1d1b1a; --line: #37332f; --line2: #4a453f; --text: #F5F2EE; --muted: #a9a39b; --dim: #857f77;
  --gold: #C9A227; --gold2: #e3c565; --gold-d: #8f7218; --gold-dim: rgba(201,162,39,.14); --red: #d9705a; --red-dim: rgba(217,112,90,.14);
  --serif: 'Fraunces', 'Iowan Old Style', 'Palatino Linotype', Palatino, Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --tab-h: 60px; --disc-h: 20px; --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px);
  --t: 180ms cubic-bezier(.2,.7,.3,1);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { background: var(--bg); color-scheme: dark; -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--sans); font-size: 16px; line-height: 1.45; -webkit-font-smoothing: antialiased; overscroll-behavior-y: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; text-align: inherit; }
button:disabled { cursor: default; }
a { color: var(--gold2); }
h1, h2, h3, p, ul { margin: 0; }
[hidden] { display: none !important; }
svg { display: block; }
.latin { font-family: var(--serif); font-style: italic; color: var(--gold2); }
b { font-weight: 650; }
.pop { animation: pop 150ms ease-out; }
@keyframes pop { 50% { transform: scale(1.03); } }
@keyframes up { from { transform: translateY(24px); opacity: 0; } }
@keyframes fadein { from { opacity: 0; } }

#app { max-width: 560px; margin: 0 auto; min-height: 100dvh; padding-bottom: calc(var(--tab-h) + var(--disc-h) + var(--safe-b) + 24px); }
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 8px; padding: calc(8px + var(--safe-t)) 16px 8px; background: var(--bg); border-bottom: 1px solid var(--line); min-height: 64px; }
.brand { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }
.brand img { width: 32px; height: 32px; border-radius: 8px; }
.brand b { font-family: var(--serif); font-weight: 600; font-size: 22px; }
.brand b i { font-style: normal; color: var(--gold); }
#hud { display: flex; gap: 8px; }
.hud { display: inline-flex; align-items: center; gap: 4px; height: 48px; padding: 0 12px; border-radius: 12px; font-weight: 700; font-size: 16px; color: var(--muted); font-variant-numeric: tabular-nums; }
.hud svg { width: 22px; height: 22px; }
.hud.s.on, .hud.s.on b { color: var(--gold2); }
.hud.h svg { color: var(--red); }
.hud b { color: var(--text); }
button.hud:active { background: var(--card); }
.icon-btn { width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center; color: var(--muted); font-size: 26px; line-height: 1; }
.icon-btn:active { background: var(--card); }

.view { padding: 16px 16px 8px; }
.h-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin: 4px 0 16px; }
.h-row h1 { font-family: var(--serif); font-weight: 600; font-size: 28px; line-height: 1.1; text-wrap: balance; }
.h-row p { color: var(--muted); font-size: 14px; margin-top: 4px; }
.eyebrow { font-size: 11px; font-weight: 700; letter-spacing: 1.4px; text-transform: uppercase; color: var(--gold); }
.back { display: inline-flex; align-items: center; gap: 4px; color: var(--gold2); font-weight: 600; font-size: 15px; height: 48px; margin: -8px 0 0 -4px; padding: 0 8px 0 4px; }
.note { font-size: 13px; color: var(--muted); background: var(--card2); border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin: 16px 0 12px; }
.note b { color: var(--text); }
.fine { font-size: 12.5px; color: var(--muted); margin-top: 12px; }
.lead { color: #ddd8d1; font-size: 15.5px; }
.tag { display: inline-block; font-size: 10.5px; font-weight: 700; letter-spacing: .7px; text-transform: uppercase; padding: 4px 8px; border-radius: 6px; background: #322f2b; color: var(--muted); }
.tag.g { background: var(--gold-dim); color: var(--gold2); }
.empty { text-align: center; color: var(--muted); padding: 24px 16px; border: 1px dashed var(--line2); border-radius: 16px; font-size: 15px; }
.empty b { display: block; color: var(--text); font-family: var(--serif); font-size: 21px; font-weight: 500; margin: 8px 0 4px; }
.empty .char { margin: 0 auto; }
.empty .btn { margin-top: 16px; }
.toast { position: fixed; left: 50%; bottom: calc(var(--tab-h) + var(--disc-h) + var(--safe-b) + 16px); transform: translateX(-50%); z-index: 90; background: var(--text); color: var(--bg); font-weight: 600; font-size: 14px; padding: 12px 16px; border-radius: 999px; white-space: nowrap; animation: fadein 150ms ease-out; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 16px; border-radius: 14px; font-weight: 650; font-size: 15px; border: 1px solid var(--line2); background: var(--card2); color: var(--text); white-space: nowrap; text-decoration: none; transition: transform var(--t), background var(--t), opacity var(--t); }
.btn svg { width: 18px; height: 18px; flex: none; }
.btn:active { transform: scale(.97); }
.btn.gold { background: var(--gold); border-color: var(--gold); border-bottom: 4px solid var(--gold-d); color: #1a1608; }
.btn.red { background: var(--red); border-color: var(--red); border-bottom: 4px solid #a04a38; color: #1f0d08; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.danger { color: var(--red); }
.btn.sm { font-size: 14px; padding: 0 12px; border-radius: 12px; }
.btn.big { min-height: 56px; font-size: 17px; border-radius: 16px; }
.btn.block { width: 100%; }
.btn:disabled { background: #2e2b28; border-color: #2e2b28; color: #6d675f; }
.btn.fav.on svg { fill: var(--gold); color: var(--gold); }
.linkb { display: block; margin: 16px auto 0; min-height: 48px; padding: 0 16px; color: var(--muted); font-size: 14px; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }

/* Grouped rows */
.gh { display: flex; justify-content: space-between; align-items: baseline; font-family: var(--sans); font-size: 12px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: var(--dim); margin: 24px 4px 8px; }
.gh span { font-weight: 600; letter-spacing: 0; text-transform: none; font-variant-numeric: tabular-nums; }
.rows { background: var(--card); border-radius: 16px; overflow: hidden; }
.row { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px; padding: 12px 16px; border-bottom: 1px solid var(--line); transition: background var(--t); }
.row:last-child { border-bottom: 0; }
button.row:active { background: #2e2b28; }
.rt { flex: 1; min-width: 0; display: block; }
.rt b { display: block; font-size: 15.5px; line-height: 1.3; font-weight: 600; }
.rt i.latin { display: block; font-size: 14.5px; margin-top: 2px; line-height: 1.3; }
.rt small { display: block; color: var(--muted); font-size: 13px; margin-top: 2px; }
.rt small.srcl { color: var(--dim); font-size: 12px; margin-top: 4px; }
.row .ch { color: #6d675f; font-size: 22px; flex: none; }
.row .rs svg { width: 16px; height: 16px; fill: var(--gold); color: var(--gold); }
.row .ic { flex: none; width: 40px; height: 40px; border-radius: 12px; background: #322f2b; color: var(--gold2); display: grid; place-items: center; }
.row .ic svg { width: 20px; height: 20px; }
.row .lx { flex: none; font-size: 13.5px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.row.kv { min-height: 48px; padding: 8px 16px; }
.row.kv i { flex: 0 0 42%; font-size: 17px; }
.row.kv span { color: #ddd8d1; font-size: 15px; }
.row.sel, .row.me { background: var(--gold-dim); }
.row.sel .lx, .row.me .lx { color: var(--gold2); }
.row.soon { opacity: .55; }
.row .rk { flex: none; width: 20px; text-align: center; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.av { flex: none; width: 36px; height: 36px; border-radius: 50%; background: #3a3632; color: var(--text); display: grid; place-items: center; font-weight: 700; font-size: 15px; }
.row.me .av, .av.big { background: var(--gold); color: #1a1608; }
.av.big { width: 64px; height: 64px; font-size: 28px; font-family: var(--serif); }
.pips { display: flex; gap: 4px; flex: none; }
.pips i { width: 6px; height: 16px; border-radius: 3px; background: #45413c; }
.pips i.on { background: var(--gold); }
.prog { display: block; height: 6px; border-radius: 6px; background: #3a3632; margin-top: 8px; overflow: hidden; }
.prog i { display: block; height: 100%; background: var(--gold); border-radius: 6px; transition: width 220ms ease-out; }
.row.ach.got b { color: var(--gold2); }
.row.ach.got .lx { color: var(--gold2); }

/* Path */
.goal { background: var(--card); border-radius: 16px; padding: 12px 16px 16px; margin-bottom: 8px; }
.goal > div:first-child { display: flex; justify-content: space-between; align-items: baseline; font-size: 14px; }
.goal span { color: var(--muted); font-variant-numeric: tabular-nums; }
.unit { margin-top: 16px; }
.uh { display: flex; align-items: center; justify-content: space-between; gap: 12px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 12px 0; }
.uh small { font-size: 11px; font-weight: 700; letter-spacing: 1.4px; text-transform: uppercase; color: var(--gold); }
.uh h2 { font-family: var(--serif); font-weight: 600; font-size: 22px; line-height: 1.15; }
.uh p { color: var(--muted); font-size: 13.5px; margin-top: 2px; }
.path { position: relative; padding: 24px 0 8px; }
.nw { display: flex; flex-direction: column; align-items: center; width: 132px; margin: 0 auto 16px; transform: translateX(var(--x)); position: relative; }
.node { width: 76px; height: 70px; border-radius: 50%; display: grid; place-items: center; position: relative; background: #3a3632; border-bottom: 6px solid #2a2724; color: #7d776f; transition: transform var(--t); }
.node svg { width: 32px; height: 32px; }
.node:active { transform: translateY(3px); }
.node.open { background: #57514a; border-bottom-color: #3d3935; color: var(--text); }
.node.cur, .node.done { background: var(--gold); border-bottom-color: var(--gold-d); color: #1a1608; }
.node.done { background: #a88a2a; border-bottom-color: #6f5a14; }
.node.cur { outline: 3px solid var(--gold2); outline-offset: 5px; }
.node i { position: absolute; right: -4px; bottom: -6px; min-width: 24px; height: 24px; border-radius: 12px; background: var(--bg); border: 2px solid var(--gold); color: var(--gold2); font-style: normal; font-weight: 700; font-size: 13px; display: grid; place-items: center; }
.flag { font-size: 12px; font-weight: 800; letter-spacing: 1.2px; text-transform: uppercase; color: var(--gold2); border: 1.5px solid var(--gold); border-radius: 8px; padding: 4px 8px; margin-bottom: 12px; background: var(--bg); }
.nl { margin-top: 12px; font-size: 13px; font-weight: 600; color: var(--muted); text-align: center; line-height: 1.25; }
.teach { position: absolute; top: 50%; transform: translateY(-50%); display: flex; flex-direction: column; align-items: center; width: 104px; text-align: center; }
.teach.l { left: 0; } .teach.r { right: 0; }
.teach span { font-size: 11.5px; color: var(--dim); font-weight: 600; margin-top: 4px; }

/* Lesson */
#stage:empty { display: none; }
.lesson { position: fixed; inset: 0; z-index: 60; background: var(--bg); display: flex; flex-direction: column; max-width: 560px; margin: 0 auto; }
#stage::before { content: ''; position: fixed; inset: 0; z-index: 59; background: var(--bg); }
.lt { display: flex; align-items: center; gap: 8px; padding: calc(8px + var(--safe-t)) 8px 8px; }
.pbar { flex: 1; height: 14px; border-radius: 8px; background: #322f2b; overflow: hidden; }
.pbar i { display: block; height: 100%; border-radius: 8px; background: var(--gold); transition: width 240ms ease-out; }
.lb { flex: 1; overflow-y: auto; padding: 8px 16px 16px; }
.lb h2 { font-size: 21px; font-weight: 700; line-height: 1.2; display: flex; align-items: center; gap: 8px; }
.say { display: flex; align-items: flex-end; gap: 4px; margin: 16px 0 24px; }
.who { flex: none; }
.bubble { position: relative; flex: 1; min-width: 0; border: 1.5px solid var(--line2); border-radius: 16px; padding: 12px 16px; font-size: 18px; line-height: 1.35; margin-bottom: 24px; display: flex; align-items: flex-start; gap: 8px; flex-wrap: wrap; }
.bubble::before { content: ''; position: absolute; left: -8px; bottom: 16px; width: 14px; height: 14px; background: var(--bg); border-left: 1.5px solid var(--line2); border-bottom: 1.5px solid var(--line2); transform: rotate(45deg); }
.bubble > span { flex: 1; min-width: 60%; }
.bubble .latin { font-size: 21px; color: var(--text); }
.bubble small { flex-basis: 100%; color: var(--muted); font-size: 13px; }
.spk { flex: none; width: 48px; height: 48px; margin: -8px 0 -8px -8px; border-radius: 12px; color: var(--gold2); display: grid; place-items: center; }
.spk svg { width: 24px; height: 24px; }
.spk:active { background: var(--card); }
.spk.big { width: auto; height: 56px; margin: 0; padding: 0 24px; display: inline-flex; gap: 8px; align-items: center; background: var(--gold); color: #1a1608; font-weight: 700; border-bottom: 4px solid var(--gold-d); border-radius: 14px; }
.blank { display: inline-block; min-width: 72px; border-bottom: 2px solid var(--gold); text-decoration: none; text-align: center; color: var(--gold2); font-weight: 650; }
.opts { display: grid; gap: 8px; }
.opts.grid { grid-template-columns: 1fr 1fr; }
.opt { display: block; width: 100%; min-height: 56px; padding: 12px 16px; border: 1.5px solid var(--line2); border-bottom-width: 4px; border-radius: 14px; font-size: 16px; line-height: 1.3; background: var(--bg); transition: background var(--t), border-color var(--t), opacity var(--t); }
.opt.latin { font-size: 17.5px; color: var(--text); }
.opts.grid .opt, .opt.mt { text-align: center; }
.opt:active { background: var(--card); }
.opt.sel { border-color: var(--gold); background: var(--gold-dim); }
.opt.good { border-color: var(--gold); background: var(--gold-dim); color: var(--gold2); }
.opt.bad { border-color: var(--red); background: var(--red-dim); }
.opt.gone { opacity: .28; border-color: var(--line); }
.match { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.mcol { display: grid; gap: 8px; align-content: start; }
.ans { min-height: 116px; border-top: 1.5px solid var(--line2); border-bottom: 1.5px solid var(--line2); padding: 8px 0; display: flex; flex-wrap: wrap; gap: 8px; align-content: flex-start; margin-bottom: 24px; background: repeating-linear-gradient(transparent, transparent 55px, var(--line) 55px, var(--line) 56px); }
.ans.good { border-color: var(--gold); } .ans.bad { border-color: var(--red); }
.tiles { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.tile { min-height: 48px; padding: 0 12px; border: 1.5px solid var(--line2); border-bottom-width: 4px; border-radius: 12px; background: var(--card2); font-size: 16px; color: var(--text); transition: opacity var(--t); }
.tile.latin { font-size: 17.5px; }
.tile.used { color: transparent; background: #1a1918; border-color: var(--line); }
.lf { padding: 12px 16px calc(16px + var(--safe-b)); border-top: 1px solid var(--line); display: grid; gap: 8px; }
.fb { padding: 16px 16px calc(16px + var(--safe-b)); animation: up 200ms ease-out; }
.fb.ok { background: #2b2616; } .fb.no { background: #2c1b17; }
.fb > b { display: block; font-size: 21px; font-weight: 800; }
.fb.ok > b { color: var(--gold2); } .fb.no > b { color: var(--red); }
.fba { margin-top: 8px; font-size: 16px; font-weight: 600; }
.fba span { display: block; font-size: 11px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); }
.fbe { margin-top: 8px; font-size: 14.5px; color: #ddd8d1; }
.fb .btn { margin-top: 16px; }
.lesson.end .endm { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 24px; animation: fadein 220ms ease-out; }
.endm h1 { font-family: var(--serif); font-size: 34px; font-weight: 600; margin-top: 16px; line-height: 1.1; }
.endm > p { color: var(--muted); margin-top: 8px; max-width: 320px; }
.endm .stat3 { width: 100%; margin-top: 24px; }
.won { color: var(--gold2) !important; font-weight: 650; font-size: 15px; }
.stat3 { display: grid; grid-template-columns: repeat(3, 1fr); background: var(--card); border-radius: 16px; }
.stat3 div { padding: 16px 8px; text-align: center; border-right: 1px solid var(--line); }
.stat3 div:last-child { border-right: 0; }
.stat3 span { display: block; font-size: 12px; color: var(--muted); }
.stat3 b { display: block; font-family: var(--serif); font-size: 26px; font-weight: 600; color: var(--gold2); margin-top: 4px; font-variant-numeric: tabular-nums; }

/* Practice, profile */
.pcard { display: flex; align-items: center; gap: 12px; background: var(--card); border-radius: 16px; padding: 12px 16px; margin-bottom: 16px; }
.pcard b { display: block; font-family: var(--serif); font-size: 21px; font-weight: 600; line-height: 1.2; }
.pcard span { display: block; color: var(--muted); font-size: 14px; margin-top: 4px; }
.prof { display: flex; align-items: center; gap: 16px; margin: 8px 0 16px; }
.prof > div { flex: 1; min-width: 0; }
.prof h1 { font-family: var(--serif); font-size: 26px; font-weight: 600; line-height: 1.1; overflow: hidden; text-overflow: ellipsis; }
.prof p { color: var(--muted); font-size: 13.5px; margin-top: 4px; }
.stat4 { display: grid; grid-template-columns: 1fr 1fr; background: var(--card); border-radius: 16px; overflow: hidden; }
.stat4 > div { display: grid; grid-template-columns: 28px 1fr; column-gap: 8px; align-items: center; padding: 16px; border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); }
.stat4 > div:nth-child(2n) { border-right: 0; } .stat4 > div:nth-child(n+3) { border-bottom: 0; }
.stat4 .si { grid-row: span 2; color: var(--gold2); } .stat4 .si svg { width: 26px; height: 26px; }
.stat4 b { font-family: var(--serif); font-size: 24px; font-weight: 600; line-height: 1; font-variant-numeric: tabular-nums; }
.stat4 span:last-child { font-size: 12.5px; color: var(--muted); }

/* Library */
.hero { display: block; width: 100%; border-radius: 16px; padding: 16px; margin-bottom: 16px; background: var(--card); border: 1px solid var(--gold); }
.hero .eyebrow { display: flex; justify-content: space-between; }
.hero .eyebrow span:last-child { color: var(--muted); letter-spacing: .4px; font-weight: 600; text-transform: none; }
.hero q { display: block; quotes: none; font-family: var(--serif); font-size: 24px; line-height: 1.22; font-weight: 500; margin: 12px 0 8px; text-wrap: balance; }
.hero .latin { display: block; font-size: 16px; }
.hero .src { display: block; font-size: 12.5px; color: var(--muted); margin-top: 12px; }
.search { position: relative; margin-bottom: 8px; }
.search > svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--muted); }
.search input { width: 100%; height: 48px; border-radius: 14px; border: 1px solid var(--line2); background: var(--card2); padding: 0 48px 0 42px; outline: none; font-size: 16px; -webkit-appearance: none; }
.search input:focus { border-color: var(--gold); }
.search input::placeholder { color: #7d776f; }
.search input::-webkit-search-cancel-button { display: none; }
.search .clear { position: absolute; right: 0; top: 0; width: 48px; height: 48px; color: var(--muted); font-size: 22px; text-align: center; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 4px 16px; margin: 0 -16px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; height: 48px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line2); background: var(--card2); color: var(--muted); font-size: 14px; font-weight: 600; transition: background var(--t), color var(--t); }
.chip.on { background: var(--gold-dim); border-color: var(--gold); color: var(--gold2); }
.count { color: var(--dim); font-size: 12.5px; margin: 8px 4px -12px; }
.mxd .tags { display: flex; gap: 8px; margin-bottom: 12px; }
.mxd h3 { font-family: var(--serif); font-weight: 500; font-size: 24px; line-height: 1.22; text-wrap: balance; }
.mxd .latin { font-size: 17px; margin-top: 8px; }
.mxd dl, .facts { margin: 16px 0 0; display: grid; gap: 12px; }
dt, .facts span, .sec-t { font-size: 11px; font-weight: 700; letter-spacing: .9px; text-transform: uppercase; color: var(--dim); }
dd { margin: 2px 0 0; font-size: 15.5px; color: #ddd8d1; }
.meta { display: flex; justify-content: space-between; color: var(--muted); font-size: 14px; margin-bottom: 12px; }
.meta span { color: var(--gold2); font-weight: 600; }
.mlist { list-style: none; padding: 0; }
.mlist li { padding: 12px 0; border-top: 1px solid var(--line); }
.mlist b { display: block; font-size: 15.5px; font-weight: 600; line-height: 1.3; }
.mlist i, .mlist small { display: block; font-size: 14px; margin-top: 2px; }
.mlist small { color: var(--muted); font-size: 12.5px; }
.hrow { display: flex; gap: 8px; justify-content: center; margin: 8px 0 16px; }
.hrow span { color: #45413c; } .hrow span.on { color: var(--red); }
.hrow svg { width: 40px; height: 40px; }

/* Cases */
.case { background: var(--card); border-radius: 16px; margin-bottom: 12px; overflow: hidden; }
.case .head { display: block; width: 100%; padding: 16px; }
.case .head .tag { margin-bottom: 8px; }
.case .r1 { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.case .r1 b { font-size: 17px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.case .sub { color: var(--muted); font-size: 13.5px; margin-top: 4px; }
.pill { flex: none; font-size: 11.5px; font-weight: 700; padding: 4px 12px; border-radius: 999px; background: #322f2b; color: var(--muted); }
.pill.soon { background: var(--gold-dim); color: var(--gold2); }
.pill.past { background: var(--red-dim); color: var(--red); }
.cd { display: flex; align-items: center; gap: 16px; margin-top: 16px; }
.cd .n { font-family: var(--serif); font-size: 44px; line-height: 1; font-weight: 600; color: var(--gold2); min-width: 44px; font-variant-numeric: tabular-nums; }
.cd .n.past { color: var(--red); }
.cd .t { font-size: 13.5px; color: var(--muted); }
.cd .t b { display: block; color: var(--text); font-size: 15px; }
.case .prog { margin-top: 16px; }
.prog-l { font-size: 12.5px; color: var(--muted); margin-top: 8px; display: flex; justify-content: space-between; }
.case .body { padding: 0 16px 16px; border-top: 1px solid var(--line); }
.facts { grid-template-columns: 1fr 1fr; gap: 12px 16px; padding: 16px 0; margin: 0; }
.facts div { min-width: 0; }
.facts span { display: block; }
.facts b { font-weight: 500; font-size: 15px; overflow-wrap: anywhere; }
.facts .full { grid-column: 1 / -1; }
.chk { display: flex; align-items: center; gap: 12px; min-height: 48px; width: 100%; font-size: 15px; cursor: pointer; }
.chk > i { flex: none; width: 24px; height: 24px; border-radius: 8px; border: 1.5px solid #5a554e; display: grid; place-items: center; }
.chk.on > i { background: var(--gold); border-color: var(--gold); }
.chk.on > i::after { content: ''; width: 10px; height: 5px; border-left: 2px solid #1a1608; border-bottom: 2px solid #1a1608; transform: rotate(-45deg) translate(1px, -1px); }
.chk.on > span { color: var(--muted); text-decoration: line-through; }
.chk > span { flex: 1; }
.chk .x { color: #6d675f; font-size: 20px; width: 48px; height: 48px; margin-right: -12px; text-align: center; }
.addrow { display: flex; gap: 8px; margin-top: 8px; }
.addrow input { flex: 1; min-width: 0; }
.acts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 16px; }

/* Forms */
label.f { display: block; margin-bottom: 12px; }
label.f > span { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
label.f > span em { font-style: normal; color: #7d776f; font-weight: 500; }
input.i, select.i, textarea.i { width: 100%; height: 48px; border-radius: 12px; border: 1px solid var(--line2); background: var(--card2); padding: 0 12px; outline: none; font-size: 16px; -webkit-appearance: none; appearance: none; }
textarea.i { height: auto; min-height: 88px; padding: 12px; resize: vertical; line-height: 1.4; }
select.i { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.500l5 5 5-5' fill='none' stroke='%23a9a39b' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; background-size: 11px; padding-right: 36px; }
.i:focus { border-color: var(--gold); }
input[type=date].i, input[type=time].i { min-width: 0; color-scheme: dark; }
.g2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; } .g32 { display: grid; grid-template-columns: 3fr 2fr; gap: 12px; }
.g2 > *, .g32 > * { min-width: 0; }
.fs { background: var(--card); border-radius: 16px; padding: 16px 16px 4px; margin-bottom: 12px; }
.fs > h4 { margin: 0 0 12px; font-size: 14px; font-weight: 700; display: flex; justify-content: space-between; align-items: center; }
.fs > h4 small { font-weight: 500; color: var(--muted); font-size: 12px; }
.fs .note { margin-top: 0; }
.ck { display: flex; gap: 12px; align-items: center; font-size: 15px; min-height: 48px; }
.ck input { width: 22px; height: 22px; accent-color: var(--gold); flex: none; margin: 0; }

/* Sheets and pages */
.scrim { position: fixed; inset: 0; z-index: 70; background: rgba(0,0,0,.62); display: flex; align-items: flex-end; justify-content: center; animation: fadein 150ms ease-out; }
.sheet { width: 100%; max-width: 560px; max-height: 92dvh; background: var(--bg); border-radius: 20px 20px 0 0; border: 1px solid var(--line2); border-bottom: 0; display: flex; flex-direction: column; animation: up 220ms cubic-bezier(.2,.8,.2,1); }
.sheet .sh { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 8px 8px 16px; border-bottom: 1px solid var(--line); }
.sheet .sh h2 { font-family: var(--serif); font-size: 21px; font-weight: 600; line-height: 1.2; }
.sheet .sb { overflow-y: auto; padding: 16px; -webkit-overflow-scrolling: touch; }
.sheet .sf { padding: 12px 16px calc(12px + var(--safe-b)); border-top: 1px solid var(--line); display: flex; gap: 8px; }
.sheet .sf .btn { flex: 1; }
.xbtn { flex: none; width: 48px; height: 48px; border-radius: 12px; color: var(--muted); font-size: 26px; line-height: 1; text-align: center; }
.xbtn:active { background: var(--card); }
.share-canvas { width: 100%; height: auto; border-radius: 12px; border: 1px solid var(--line); }
.page { position: fixed; inset: 0; z-index: 65; background: var(--bg); overflow-y: auto; animation: fadein 180ms ease-out; }
.page .in { max-width: 560px; margin: 0 auto; padding: 0 16px calc(48px + var(--safe-b)); }
.page .top { margin: 0 -16px; }
.say.bk { margin-bottom: 0; } .say.bk .bubble { font-family: var(--serif); font-size: 20px; }

/* Letters */
.tpl { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 72px; background: var(--card); border-radius: 16px; padding: 12px 16px; margin-bottom: 8px; }
.tpl:active { background: #2e2b28; }
.tpl .ic { flex: none; width: 40px; height: 40px; border-radius: 12px; background: #322f2b; color: var(--gold2); display: grid; place-items: center; }
.tpl .ic svg { width: 20px; height: 20px; }
.tpl b { display: block; font-size: 16px; }
.tpl span span { display: block; color: var(--muted); font-size: 13.5px; margin-top: 2px; }
.tpl .ch { margin-left: auto; color: #6d675f; font-size: 22px; }
.paper { background: #F5F2EE; color: #151413; border-radius: 4px; padding: 28px 24px; font-family: 'Times New Roman', Times, Georgia, serif; font-size: 14px; line-height: 1.5; overflow-wrap: anywhere; }
.paper p { margin: 0 0 1em; white-space: pre-line; }
.paper .ph { background: #ecdca0; border-radius: 2px; padding: 0 2px; }
.paper .sig { margin-top: 2.6em; }
.bar { position: sticky; bottom: calc(var(--tab-h) + var(--disc-h) + var(--safe-b) + 8px); display: flex; gap: 8px; margin-top: 16px; padding: 8px; background: var(--card2); border: 1px solid var(--line2); border-radius: 16px; z-index: 5; }
.bar .btn { flex: 1; }

/* Guides */
.guide { background: var(--card); border-radius: 16px; margin-bottom: 8px; overflow: hidden; }
.guide > button { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 72px; padding: 12px 16px; }
.guide .num { flex: none; width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--line2); color: var(--gold2); font-family: var(--serif); font-size: 16px; display: grid; place-items: center; }
.guide b { display: block; font-size: 16px; }
.guide small { display: block; color: var(--muted); font-size: 13px; margin-top: 2px; }
.guide .car { margin-left: auto; color: #6d675f; transition: transform var(--t); font-size: 22px; }
.guide.open .car { transform: rotate(90deg); color: var(--gold); }
.guide .gb { padding: 0 16px 16px; font-size: 15.5px; color: #ddd8d1; }
.guide .gb h4 { margin: 16px 0 8px; font-size: 11px; letter-spacing: 1px; text-transform: uppercase; color: var(--gold); }
.guide .gb p { margin: 0 0 8px; }
.guide .gb ul, .guide .gb ol { margin: 0 0 8px; padding-left: 20px; }
.guide .gb li { margin-bottom: 4px; }
.links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

/* About, terms */
.ab-hero { text-align: center; padding: 24px 8px; }
.ab-hero .char { margin: 0 auto; }
.ab-hero h1 { font-family: var(--serif); font-size: 40px; font-weight: 600; margin-top: 8px; line-height: 1.05; }
.ab-hero h1 i { font-style: normal; color: var(--gold); }
.ab-hero p { color: var(--muted); font-size: 16.5px; margin: 8px auto 0; max-width: 330px; text-wrap: balance; }
.ab-hero .q { font-family: var(--serif); font-style: italic; color: var(--gold2); font-size: 15.5px; margin-top: 16px; }
.ab h2 { font-family: var(--serif); font-size: 23px; font-weight: 600; margin: 24px 0 8px; }
.road { list-style: none; padding: 0; background: var(--card); border-radius: 16px; }
.road li { padding: 12px 16px; border-bottom: 1px solid var(--line); }
.road li:last-child { border-bottom: 0; }
.road b { display: block; font-size: 15.5px; }
.road span { font-size: 14px; color: var(--muted); }
.price { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.price > div { background: var(--card); border-radius: 16px; padding: 16px; border: 1px solid transparent; }
.price > div.pro { border-color: var(--gold); }
.price h3 { font-size: 12px; letter-spacing: 1.2px; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.price .pro h3 { color: var(--gold2); }
.price .amt { font-family: var(--serif); font-size: 30px; font-weight: 600; margin: 8px 0 12px; line-height: 1; }
.price .amt small { font-family: var(--sans); font-size: 12.5px; color: var(--muted); font-weight: 500; }
.price ul { list-style: none; padding: 0; font-size: 14px; color: #ddd8d1; }
.price li { padding: 4px 0; border-top: 1px solid var(--line); }
.credits { text-align: center; margin-top: 24px; padding-top: 24px; border-top: 1px solid var(--line); color: var(--muted); font-size: 14px; }
.credits b { display: block; color: var(--text); font-family: var(--serif); font-size: 18px; font-weight: 500; margin-bottom: 4px; }

/* Dock */
.dock { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: var(--bg); border-top: 1px solid var(--line); padding-bottom: var(--safe-b); }
.dock .in { max-width: 560px; margin: 0 auto; }
.disc { height: var(--disc-h); line-height: var(--disc-h); text-align: center; font-size: 9.5px; color: #7d776f; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 8px; }
.tabs { display: grid; grid-template-columns: repeat(5, 1fr); height: var(--tab-h); }
.tabs button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: var(--dim); font-size: 11px; font-weight: 600; transition: color var(--t); }
.tabs svg { width: 24px; height: 24px; }
.tabs button.on { color: var(--gold2); }
.tabs button:active svg { transform: scale(.92); }

/* Onboarding */
.ob { position: fixed; inset: 0; z-index: 80; background: var(--bg); display: flex; flex-direction: column; padding: calc(8px + var(--safe-t)) 24px calc(16px + var(--safe-b)); overflow-y: auto; }
.ob .skip { align-self: flex-end; color: var(--muted); font-weight: 600; font-size: 15px; min-height: 48px; min-width: 48px; text-align: right; }
.ob .mid { flex: 1; display: flex; flex-direction: column; justify-content: center; max-width: 420px; margin: 0 auto; width: 100%; animation: fadein 220ms ease-out; }
.ob .art { margin-bottom: 16px; }
.ob h1 { font-family: var(--serif); font-size: 34px; line-height: 1.1; font-weight: 600; text-wrap: balance; }
.ob h1 i { font-style: normal; color: var(--gold); }
.ob .mid > p { color: var(--muted); font-size: 17px; margin-top: 12px; line-height: 1.5; }
.ob .rows { margin-top: 16px; }
.ob .bot { max-width: 420px; margin: 16px auto 0; width: 100%; }
.ob .bot .fine { text-align: center; }
.dots { display: flex; gap: 8px; justify-content: center; margin-bottom: 16px; }
.dots i { width: 8px; height: 8px; border-radius: 50%; background: #45413c; transition: all var(--t); }
.dots i.on { width: 24px; background: var(--gold); border-radius: 4px; }

#print-root { display: none; }
@media print {
  @page { size: letter; margin: 1in; }
  html, body { background: #fff !important; color: #000 !important; }
  body > *:not(#print-root) { display: none !important; }
  #print-root { display: block !important; font-family: 'Times New Roman', Times, serif; font-size: 12pt; line-height: 1.5; color: #000; }
  #print-root p { margin: 0 0 12pt; white-space: pre-line; }
  #print-root .sig { margin-top: 30pt; }
  #print-root .ph { background: none; }
}
@media (max-width: 359px) { .teach { display: none; } .tabs button { font-size: 10px; } }
@media (min-width: 600px) { .scrim { align-items: center; } .sheet { border-radius: 20px; border-bottom: 1px solid var(--line2); max-height: 86dvh; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
