:root {
  --navy: #0e3456; --gold: #cec386; --cream: #f8f5e9; --sage: #5f8282; --taupe: #696151; --ink: #2f2f2f;
  --paper: #fffdf8; --surface: #ffffff; --line: #e4dcc0; --muted: #6b665a; --accent: #0e3456; --link: #0e3456;
  --btn-bg: #cec386; --btn-fg: #0e3456; --focus: #0e3456; --band: #f8f5e9; --danger: #8c2f2f; --on: #0e3456; --on-fg: #fff;
  --serif: Charter, "Iowan Old Style", "Palatino Linotype", Georgia, serif; --ui: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) { :root {
  --ink: #f3efe0; --paper: #0a2540; --surface: #0e3456; --line: #1f4a73; --muted: #b8c4cf; --accent: #cec386; --link: #e0d7a6;
  --band: #0e3456; --focus: #cec386; --danger: #f0a0a0; --on: #cec386; --on-fg: #0e3456;
} }
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 17px/1.6 var(--serif); min-height: 100vh; }
.skip { position: absolute; left: -999px; } .skip:focus { left: 8px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 99; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
a { color: var(--link); } :focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3 { font-style: italic; font-weight: 500; color: var(--accent); line-height: 1.25; margin: 1.1em 0 .4em; }
h1 { font-size: 1.7rem; margin-top: 0; } h2 { font-size: 1.35rem; } h3 { font-size: 1.12rem; font-style: normal; font-weight: 600; }
p { margin: .6em 0; } .dim { color: var(--muted); } .small { font-size: .9rem; }

.shell { display: flex; flex-direction: column; min-height: 100vh; }
.topbar { background: var(--band); border-bottom: 1px solid var(--line); padding: calc(env(safe-area-inset-top) + 10px) 16px 10px; display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 5; }
.topbar img { height: 40px; width: auto; display: block; } .topbar .lock { font: 600 .9rem var(--ui); }
main { flex: 1; width: 100%; max-width: 720px; margin: 0 auto; padding: 20px 16px 120px; }
.tabs { position: fixed; bottom: 0; left: 0; right: 0; background: var(--band); border-top: 1px solid var(--line); display: grid; grid-template-columns: repeat(5, 1fr); padding-bottom: env(safe-area-inset-bottom); z-index: 5; }
.tabs a { text-decoration: none; text-align: center; padding: 8px 2px 8px; font: 600 .72rem var(--ui); color: var(--muted); min-height: 56px; display: flex; flex-direction: column; align-items: center; gap: 3px; }
.tabs a svg { width: 24px; height: 24px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tabs a[aria-current="page"] { color: var(--accent); box-shadow: inset 0 3px 0 var(--gold); }

.btn { font: 600 1rem var(--ui); background: var(--btn-bg); color: var(--btn-fg); border: 2px solid var(--btn-bg); border-radius: 999px; padding: 12px 24px; min-height: 46px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; line-height: 1.25; text-align: center; }
.btn.ghost { background: transparent; color: var(--accent); border-color: var(--gold); }
.btn.small { padding: 8px 16px; min-height: 38px; font-size: .9rem; } .btn.block { width: 100%; }
.btn.danger { color: var(--danger); border-color: var(--danger); background: transparent; } .btn[disabled] { opacity: .5; cursor: default; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px; margin: 12px 0; display: block; color: inherit; text-decoration: none; }
a.card:hover, button.card:hover { border-color: var(--gold); }
.card h3 { margin: 0 0 4px; font-style: italic; font-weight: 500; font-size: 1.15rem; color: var(--accent); }
.card p { margin: 2px 0; } .card .meta { font: .8rem var(--ui); color: var(--muted); display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.bar { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; margin-top: 10px; } .bar i { display: block; height: 100%; background: var(--gold); }
.hero { background: var(--navy); color: #fff; border-radius: 16px; padding: 24px 20px; margin-bottom: 16px; }
.hero h1 { color: #fff; margin: 0 0 6px; } .hero p { margin: 0; color: #dfe7ee; } .hero .btn { margin-top: 14px; }
.notice { border-left: 4px solid var(--gold); background: var(--surface); padding: 10px 14px; border-radius: 0 10px 10px 0; font-size: .95rem; margin: 14px 0; }
.notice.warn { border-color: #b8860b; } .notice.err { border-color: var(--danger); }

/* forms */
label.f { display: block; margin: 10px 0; } label.f > span { display: block; font: 600 .88rem var(--ui); color: var(--muted); margin-bottom: 4px; }
input[type=text], input[type=password], input[type=date], input[type=search], select, textarea { width: 100%; font: 1rem/1.5 var(--serif); color: var(--ink); background: var(--surface); border: 1.5px solid var(--line); border-radius: 10px; padding: 10px 12px; min-height: 44px; }
textarea { resize: none; overflow: hidden; display: block; } select { font-family: var(--ui); }
input:focus, textarea:focus, select:focus { border-color: var(--gold); outline: 3px solid var(--focus); outline-offset: 0; }
input[type=checkbox] { width: 24px; height: 24px; accent-color: var(--navy); flex: none; margin: 2px 0 0; }
input[type=range] { width: 100%; accent-color: var(--navy); }
.field { margin: 16px 0; } .q { display: block; font-weight: 600; margin-bottom: 6px; } .qn { color: var(--accent); }
.checks { margin: 10px 0; } .check { display: flex; gap: 10px; align-items: flex-start; padding: 6px 0; } .check-row input[type=text] { margin: 2px 0 8px 34px; width: calc(100% - 34px); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.chip { font: 500 .95rem var(--ui); border: 1.5px solid var(--gold); background: var(--surface); color: var(--ink); padding: 8px 14px; border-radius: 999px; min-height: 40px; cursor: pointer; }
.chip.on { background: var(--on); color: var(--on-fg); border-color: var(--on); }
.fields { display: grid; gap: 6px; } .range { display: flex; gap: 10px; align-items: center; } .range-l { font: .9rem var(--ui); color: var(--muted); white-space: nowrap; } .range output { font: 700 1.1rem var(--ui); min-width: 2ch; }
.fill-row { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; margin: 10px 0; } .fill-title { font-weight: 600; margin-bottom: 2px; } .fill-title.dim { font: 600 .85rem var(--ui); color: var(--muted); }
.scale-row { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin: 10px 0; } .scale-st { margin: 0 0 8px; }
.seg { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin: 6px 0 0; } .seg-l { font: 600 .8rem var(--ui); color: var(--muted); width: 100%; }
.seg-b { flex: 1 1 0; min-width: 44px; font: 600 .95rem var(--ui); border: 1.5px solid var(--gold); background: transparent; color: var(--ink); border-radius: 10px; padding: 9px 4px; min-height: 44px; cursor: pointer; }
.seg-b.on { background: var(--on); color: var(--on-fg); border-color: var(--on); }
.score { margin: 14px 0; } .totals { display: flex; gap: 24px; flex-wrap: wrap; font-family: var(--ui); } .totals div { display: flex; flex-direction: column; } .totals strong { font-size: 1.5rem; color: var(--accent); }
.band { background: var(--surface); border: 2px solid var(--gold); border-radius: 12px; padding: 12px 14px; margin-top: 10px; } .flag { font-weight: 600; }
.repeat { background: var(--surface); border: 1px dashed var(--gold); border-radius: 12px; padding: 12px 14px; margin: 12px 0; }

/* reading blocks */
.label { font: 700 .78rem var(--ui); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 22px 0 4px; }
.lead { font-style: italic; color: var(--accent); font-size: 1.1rem; }
blockquote { margin: 14px 0; padding: 4px 16px; border-left: 4px solid var(--gold); font-style: italic; } blockquote footer { font: .85rem var(--ui); font-style: normal; color: var(--muted); margin-top: -4px; }
.callout { background: var(--surface); border: 1px solid var(--gold); border-radius: 12px; padding: 10px 16px; margin: 14px 0; } .callout > strong { font: 700 .8rem var(--ui); letter-spacing: .05em; text-transform: uppercase; color: var(--accent); }
.list { padding-left: 22px; } .list li { margin: 6px 0; }
.item { display: flex; gap: 14px; margin: 14px 0; } .item h3 { margin: 0; } .item p { margin: 2px 0; }
.item-n { font: italic 1.5rem var(--serif); color: var(--gold); min-width: 2ch; line-height: 1.2; }
.table-wrap { overflow-x: auto; margin: 12px 0; } table { border-collapse: collapse; width: 100%; font-size: .95rem; } th, td { border: 1px solid var(--line); padding: 8px 10px; text-align: left; vertical-align: top; } thead th { background: var(--band); font-family: var(--ui); font-size: .85rem; } tbody th { font-weight: 600; }

.guide-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; flex-wrap: wrap; } .guide-title { flex: 1 1 260px; } .guide-meta { display: flex; gap: 10px; align-items: center; } .saved { font: .8rem var(--ui); color: var(--muted); }
.sec-select { margin: 16px 0 0; font-weight: 600; } .sec-title { margin-top: .8em; }
.guide-nav { display: flex; justify-content: space-between; gap: 10px; margin: 28px 0 0; }
.back { font: 600 .9rem var(--ui); text-decoration: none; display: inline-block; margin-bottom: 10px; }
.cover { position: fixed; inset: 0; background: var(--navy); display: flex; align-items: center; justify-content: center; z-index: 50; }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(env(safe-area-inset-bottom) + 76px); background: var(--navy); color: #fff; font: 600 .92rem var(--ui); padding: 10px 18px; border-radius: 999px; z-index: 60; max-width: 90vw; }
dialog { border: 1px solid var(--gold); border-radius: 16px; background: var(--paper); color: var(--ink); max-width: min(92vw, 460px); width: 100%; padding: 20px; } dialog::backdrop { background: rgba(10,37,64,.6); }
.welcome { max-width: 460px; margin: 0 auto; padding: calc(env(safe-area-inset-top) + 28px) 20px 40px; text-align: center; }
.welcome img.logo { width: min(260px, 70vw); height: auto; margin: 10px auto 18px; display: block; } .welcome .stack { display: grid; gap: 12px; margin-top: 24px; text-align: left; } .welcome .btn { width: 100%; }
.welcome form { text-align: left; } .pwmeter { font: .85rem var(--ui); color: var(--muted); }
.steps { font: 600 .8rem var(--ui); color: var(--muted); margin-bottom: 8px; }
@media (min-width: 760px) { body { font-size: 18px; } .tabs { left: 50%; transform: translateX(-50%); max-width: 720px; border-radius: 16px 16px 0 0; border: 1px solid var(--line); border-bottom: 0; } }
@media print { .tabs, .topbar, .guide-nav, .btn, .toast { display: none !important; } body { background: #fff; color: #000; } }
@media (prefers-reduced-motion: no-preference) { .bar i { transition: width .4s; } }

[hidden] { display: none !important; }

.fbpre{white-space:pre-wrap;word-break:break-word;background:var(--card,#fff);border:1px solid var(--line,#e0d9c4);border-radius:10px;padding:12px;max-height:30vh;overflow:auto;font:inherit}
textarea{width:100%;font:inherit;padding:10px;border:1px solid var(--line,#cfc7ad);border-radius:10px;background:var(--card,#fff);color:inherit}

.topbar picture{display:block}.welcome picture{display:block}
