:root {
  --bg: #fbf8f1; --card: #ffffff; --ink: #1b2a4a; --muted: #5c6a85; --line: #e7e1d3;
  --gold: #b98d1e; --gold-soft: #f6ecd2; --leaf: #6a9a3a; --leaf-soft: #e9f2dc;
  --danger: #b3402f; --radius: 14px; --shadow: 0 1px 2px rgba(27,42,74,.06), 0 4px 16px rgba(27,42,74,.06);
  --serif: Georgia, "Iowan Old Style", "Palatino Linotype", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
}
[data-theme="dark"] {
  --bg: #111827; --card: #1a2335; --ink: #f1ece0; --muted: #a9b3c7; --line: #2c3850;
  --gold: #e0b955; --gold-soft: #3a3220; --leaf: #9fcd6b; --leaf-soft: #23301b; --shadow: none;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--sans); font-size: 17px; line-height: 1.55; -webkit-text-size-adjust: 100%; }
a { color: var(--gold); }
h1, h2, h3 { font-family: var(--serif); line-height: 1.25; margin: 0 0 .4em; }
h1 { font-size: 1.6rem; } h2 { font-size: 1.3rem; } h3 { font-size: 1.08rem; }
.wrap { max-width: 760px; margin: 0 auto; padding: 14px 14px 90px; }
header.top { position: sticky; top: 0; z-index: 10; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
header.top .bar { max-width: 760px; margin: 0 auto; padding: 10px 14px; display: flex; align-items: center; gap: 10px; }
.brand { display: flex; align-items: center; gap: 8px; font-family: var(--serif); font-weight: 700; font-size: 1.15rem; color: var(--ink); text-decoration: none; }
.brand img { width: 30px; height: 30px; }
.spacer { flex: 1; }
.chipbtn { border: 1px solid var(--line); background: var(--card); color: var(--ink); border-radius: 999px; padding: 5px 11px; font-size: .85rem; cursor: pointer; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 12px 0; box-shadow: var(--shadow); }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
label { display: block; font-weight: 600; margin: 12px 0 5px; font-size: .95rem; }
input, select, textarea { width: 100%; font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px; }
input:focus, select:focus, textarea:focus, [contenteditable]:focus { outline: 2px solid var(--gold); outline-offset: 1px; }
textarea { min-height: 90px; resize: vertical; }
.row { display: flex; gap: 10px; } .row > * { flex: 1; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-weight: 600; border: 0; border-radius: 12px; padding: 12px 16px; cursor: pointer; background: var(--ink); color: var(--bg); text-decoration: none; }
.btn.gold { background: var(--gold); color: #fff; }
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn.small { padding: 7px 11px; font-size: .85rem; border-radius: 10px; }
.btn.danger { background: transparent; color: var(--danger); border: 1px solid var(--danger); }
.btn.block { width: 100%; }
.btn:disabled { opacity: .55; cursor: default; }
.tabs { display: flex; gap: 6px; overflow-x: auto; padding: 4px 0; scrollbar-width: none; }
.tabs a { white-space: nowrap; padding: 8px 13px; border-radius: 999px; border: 1px solid var(--line); text-decoration: none; color: var(--ink); background: var(--card); font-size: .92rem; }
.tabs a.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.list-item { display: block; text-decoration: none; color: inherit; }
.list-item:hover .card { border-color: var(--gold); }
.tag { display: inline-block; font-size: .75rem; padding: 2px 8px; border-radius: 999px; background: var(--gold-soft); color: var(--ink); margin-right: 4px; }
.tag.leaf { background: var(--leaf-soft); }
/* path */
.path { display: flex; align-items: stretch; gap: 0; overflow-x: auto; padding: 6px 2px 10px; scrollbar-width: thin; }
.path a { flex: 0 0 auto; min-width: 120px; max-width: 170px; text-decoration: none; color: var(--ink); background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; font-size: .82rem; line-height: 1.3; }
.path a b { display: block; color: var(--gold); font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; }
.path a.done { border-color: var(--leaf); background: var(--leaf-soft); }
.path .arrow { flex: 0 0 22px; display: flex; align-items: center; justify-content: center; color: var(--gold); font-weight: 700; }
/* week */
.week { scroll-margin-top: 70px; }
.week-head { display: flex; align-items: flex-start; gap: 10px; }
.week-num { flex: 0 0 auto; background: var(--gold); color: #fff; border-radius: 10px; padding: 4px 9px; font-weight: 700; font-size: .85rem; }
.mainpoint { font-family: var(--serif); font-size: 1.1rem; font-style: italic; border-left: 3px solid var(--gold); padding-left: 10px; margin: 10px 0; }
.verse { background: var(--gold-soft); border-radius: 12px; padding: 12px 14px; margin: 10px 0; }
.verse .ref { font-weight: 700; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.verse .ok { font-size: .72rem; font-weight: 600; color: var(--leaf); background: var(--card); border-radius: 999px; padding: 1px 8px; }
.verse .text { font-family: var(--serif); margin-top: 4px; }
.verse sup { color: var(--gold); font-size: .7em; margin-right: 2px; }
.verse.support { background: transparent; border: 1px dashed var(--line); }
.sec { margin-top: 14px; }
.sec h4 { margin: 0 0 4px; font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--gold); }
.sec ul, .sec ol { margin: 4px 0; padding-left: 22px; }
.sec li { margin: 4px 0; }
.pairs { display: grid; grid-template-columns: 1fr auto 1fr; gap: 4px 8px; align-items: center; font-size: .95rem; }
.pairs .to { color: var(--gold); }
.pairs .better { font-weight: 600; }
.actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
[contenteditable="true"] { border-radius: 6px; padding: 1px 3px; margin: -1px -3px; }
[contenteditable="true"]:hover { background: var(--gold-soft); }
.editing-note { font-size: .8rem; color: var(--muted); }
.notice { background: var(--leaf-soft); border-radius: 12px; padding: 10px 12px; font-size: .9rem; }
.error { background: #fbe9e6; color: #7a2418; border-radius: 12px; padding: 10px 12px; font-size: .92rem; }
[data-theme="dark"] .error { background: #3a1f1b; color: #ffcabd; }
.toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 12px; z-index: 50; font-size: .92rem; box-shadow: var(--shadow); max-width: 90vw; }
.overlay { position: fixed; inset: 0; background: color-mix(in srgb, var(--bg) 85%, transparent); z-index: 40; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; text-align: center; padding: 20px; }
.spinner { width: 42px; height: 42px; border: 4px solid var(--gold-soft); border-top-color: var(--gold); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 45; display: flex; align-items: flex-end; justify-content: center; }
.modal { background: var(--card); width: 100%; max-width: 560px; max-height: 85vh; overflow: auto; border-radius: 18px 18px 0 0; padding: 18px; }
@media (min-width: 640px) { .modal-bg { align-items: center; } .modal { border-radius: 18px; } }
.footnote { font-size: .8rem; color: var(--muted); text-align: center; margin-top: 18px; }
.qr { max-width: 240px; width: 100%; border-radius: 12px; border: 1px solid var(--line); display: block; margin: 10px auto; }
table.admin { width: 100%; border-collapse: collapse; font-size: .88rem; }
table.admin td, table.admin th { padding: 8px 6px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.code { font-family: ui-monospace, Menlo, Consolas, monospace; font-weight: 700; letter-spacing: .03em; }
.expired { color: var(--danger); font-weight: 600; }
.hide { display: none !important; }
@media print {
  header.top, .tabs, .actions, .no-print, .toast, .path { display: none !important; }
  html, body { background: #fff; color: #000; font-size: 12pt; }
  .wrap { max-width: none; padding: 0; }
  .card { box-shadow: none; border: 0; padding: 0; margin: 0 0 12pt; }
  .week { page-break-before: always; }
  .verse { background: #f5f0e2 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  [contenteditable] { outline: none !important; }
}
