:root {
  --bg: #fbfaf7; --surface: #ffffff; --text: #1d2327; --muted: #5d6870; --line: #e2dfd8;
  --accent: #0b5cad; --accent-ink: #ffffff;
  --red-bg: #fdecea; --red: #a4261c; --amber-bg: #fdf3d8; --amber: #7a5200; --green-bg: #e5f4ea; --green: #1c6b3a; --blue-bg: #e6f0fa;
  --mono: ui-monospace, "Cascadia Mono", Consolas, Menlo, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14181b; --surface: #1c2226; --text: #e7eaec; --muted: #9aa5ad; --line: #2d363c;
    --accent: #6db3f2; --accent-ink: #0c1820;
    --red-bg: #3a1c19; --red: #ff9d92; --amber-bg: #372b0c; --amber: #f2c661; --green-bg: #15301f; --green: #7fd39c; --blue-bg: #17293a;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 17px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
.wrap { max-width: 960px; margin: 0 auto; padding: 0 20px; }
a { color: var(--accent); text-underline-offset: 2px; }
h1 { font-size: 2rem; line-height: 1.2; margin: 0.4em 0 0.6em; letter-spacing: -0.01em; }
h2 { font-size: 1.3rem; margin: 2em 0 0.5em; }
h3 { font-size: 1.1rem; margin: 0 0 0.4em; }
h4 { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin: 1.4em 0 0.4em; }
.lead { font-size: 1.15rem; color: var(--muted); max-width: 60ch; }
.muted { color: var(--muted); font-size: 0.9em; }
.eyebrow { color: var(--muted); font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.06em; margin: 0; }
.hint { color: var(--muted); font-size: 0.95rem; border-left: 3px solid var(--line); padding-left: 12px; }
.code { font-family: var(--mono); font-size: 0.92em; white-space: nowrap; }

.site-header { border-bottom: 1px solid var(--line); background: var(--surface); }
.site-header .wrap { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 24px; padding-top: 14px; padding-bottom: 14px; }
.brand { font-weight: 700; font-size: 1.1rem; color: var(--text); text-decoration: none; }
.site-header nav { display: flex; flex-wrap: wrap; gap: 4px 18px; }
.site-header nav a { color: var(--muted); text-decoration: none; font-size: 0.95rem; }
.site-header nav a:hover { color: var(--accent); }
main { padding-top: 24px; padding-bottom: 48px; }
.site-footer { border-top: 1px solid var(--line); color: var(--muted); font-size: 0.85rem; padding: 20px 0 32px; }

.crumbs { font-size: 0.85rem; color: var(--muted); margin-bottom: 18px; }
.crumbs a { color: var(--muted); }
.crumbs .sep { margin: 0 8px; }

.badge { display: inline-block; font-size: 0.75rem; font-weight: 600; padding: 2px 8px; border-radius: 999px; white-space: nowrap; vertical-align: middle; }
.badge.v-conflict, .badge.r-high { background: var(--red-bg); color: var(--red); }
.badge.v-depends, .badge.r-medium { background: var(--amber-bg); color: var(--amber); }
.badge.v-no, .badge.r-low { background: var(--green-bg); color: var(--green); }

.verdict { background: var(--surface); border: 1px solid var(--line); border-left: 6px solid var(--muted); border-radius: 8px; padding: 16px 20px; margin: 20px 0; }
.verdict p { margin: 0 0 8px; }
.verdict p:last-child { margin-bottom: 0; }
.verdict-head { font-size: 1.2rem; }
.verdict.v-conflict { border-left-color: var(--red); }
.verdict.v-depends { border-left-color: var(--amber); }
.verdict.v-no { border-left-color: var(--green); }

.two { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 760px) { .two { grid-template-columns: 1fr; } h1 { font-size: 1.6rem; } }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 18px; min-width: 0; }
.panel p { margin: 0; color: var(--muted); font-size: 0.95rem; }

.tscroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 0.93rem; }
th, td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
thead th { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); font-weight: 600; }

.clist { list-style: none; padding: 0; margin: 0; }
.clist li { padding: 9px 0; border-bottom: 1px solid var(--line); }
.clist li a { margin-right: 8px; }

.notes { margin-top: 2.5em; }
.note { background: var(--blue-bg); border-radius: 8px; padding: 12px 16px; margin: 10px 0; }
.note p { margin: 0; }
.note-add { color: var(--muted); font-size: 0.95rem; }

.readernav { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 0.9rem; color: var(--muted); margin: 0 0 8px; }
.readernav a { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 4px 12px; text-decoration: none; }
.readernav a:hover { border-color: var(--accent); }
section[id] { scroll-margin-top: 16px; }
#summary h3, #technical h3 { margin-top: 1.6em; }
.aud { display: inline-block; font-size: 0.8rem; font-weight: 600; color: var(--muted); background: var(--blue-bg); border-radius: 999px; padding: 2px 10px; margin-left: 6px; vertical-align: middle; }
#technical { margin-top: 3em; padding-top: 0.5em; border-top: 2px solid var(--line); }

.equation { display: grid; grid-template-columns: 1fr auto 1fr; gap: 12px; align-items: stretch; margin: 12px 0 16px; }
.eq-box { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.eq-box strong { font-size: 1.05rem; }
.eq-box span { color: var(--muted); font-size: 0.92rem; }
.eq-label { text-transform: uppercase; letter-spacing: 0.06em; font-size: 0.72rem !important; font-weight: 600; }
.eq-op { align-self: center; font-size: 1.8rem; font-weight: 700; color: var(--muted); }
@media (max-width: 760px) { .equation { grid-template-columns: 1fr; } .eq-op { justify-self: center; line-height: 1; } }

.gloss { margin-top: 1.6em; border: 1px solid var(--line); border-radius: 8px; padding: 10px 16px; background: var(--surface); }
.gloss summary { cursor: pointer; font-weight: 600; }
dl { margin: 12px 0 0; }
dt { font-weight: 600; margin-top: 12px; }
dd { margin: 2px 0 0; color: var(--muted); }
.glossary dd { color: var(--text); max-width: 70ch; }

.howto { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin: 28px 0 8px; }
.howto > div { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 16px 18px; }
.howto p { margin: 0; color: var(--muted); font-size: 0.95rem; }
@media (max-width: 760px) { .howto { grid-template-columns: 1fr; } }

.comments { margin-top: 3em; padding-top: 0.5em; border-top: 2px solid var(--line); }
.comment { border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 12px 16px; margin: 10px 0; }
.comment p { margin: 0; }
.comment-meta { color: var(--muted); font-size: 0.88rem; margin-bottom: 4px !important; }
.comment-meta strong { color: var(--text); }
.comment-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.comment .cta-actions { margin-top: 10px; }
.comment-form { display: grid; gap: 12px; margin-top: 18px; max-width: 640px; }
.comment-form label, .adminbar label { display: flex; flex-direction: column; gap: 4px; font-size: 0.85rem; color: var(--muted); }
.comment-form input, .comment-form textarea, .adminbar input { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 9px 10px; width: 100%; }
.comment-form textarea { resize: vertical; }
.comment-form .btn, .adminbar .btn { justify-self: start; cursor: pointer; font-family: inherit; }
.comment-form .btn[disabled] { opacity: 0.6; cursor: progress; }
.comment-form p { margin: 0; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.adminbar { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; max-width: 640px; }
.adminbar label { flex: 1 1 260px; }
button.btn-ghost { cursor: pointer; font-family: inherit; }

.cta { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 22px 24px; margin-top: 48px; }
.cta h2 { margin-top: 0; }
.cta-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 0; }
.btn { display: inline-block; background: var(--accent); color: var(--accent-ink); border: 1px solid var(--accent); padding: 9px 16px; border-radius: 6px; text-decoration: none; font-weight: 600; font-size: 0.95rem; }
.btn-ghost { background: transparent; color: var(--accent); }

.hero { padding: 24px 0 8px; }
.checker { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; margin-top: 24px; }
.checker label { flex: 1 1 260px; font-size: 0.85rem; color: var(--muted); display: flex; flex-direction: column; gap: 4px; }
.checker select { font: inherit; padding: 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--text); width: 100%; }
.checker .vs { padding-bottom: 12px; font-weight: 700; color: var(--muted); }
.result { min-height: 12px; }

.matrix table { width: auto; font-size: 0.8rem; }
.matrix th, .matrix td { padding: 4px 6px; border: 1px solid var(--line); text-align: center; }
.matrix tbody th { text-align: left; white-space: nowrap; font-weight: 400; position: sticky; left: 0; background: var(--bg); }
.matrix td a { text-decoration: none; font-weight: 700; color: inherit; display: block; }
.m-self { background: var(--line); }
.m-H { background: var(--red-bg); color: var(--red); }
.m-M, .m-D { background: var(--amber-bg); color: var(--amber); }
.m-L, .m-N { background: var(--green-bg); color: var(--green); }
