:root {
    --bg: #fbfaf6;
    --surface: #ffffff;
    --text: #1a2233;
    --muted: #5d6677;
    --line: #e4e1d6;
    --brand: #0f2a4a;
    --brand-ink: #0f2a4a;
    --accent: #f2b600;
    --link: #0b5cad;
    --good: #14683a;
    --good-bg: #e3f4ea;
    --warn: #8a5a00;
    --warn-bg: #fff3d6;
    --bad: #a1261e;
    --bad-bg: #fde7e5;
    --neutral-bg: #eceff4;
    --radius: 12px;
}

/* Theme: follows the system unless the visitor picked Light or Dark in the footer
   (stored as data-theme on <html>, from a small preference cookie). */
:root { color-scheme: light dark; }
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #0e1420;
        --surface: #151d2c;
        --text: #e8ecf3;
        --muted: #9aa5b8;
        --line: #26324a;
        --brand: #f2b600;
        --brand-ink: #e8ecf3;
        --link: #7db7f2;
        --good: #6fd49a;
        --good-bg: #12301f;
        --warn: #f2c261;
        --warn-bg: #33270a;
        --bad: #ff9a92;
        --bad-bg: #3a1714;
        --neutral-bg: #1f2a40;
    }
}

:root[data-theme="dark"] {
        --bg: #0e1420;
        --surface: #151d2c;
        --text: #e8ecf3;
        --muted: #9aa5b8;
        --line: #26324a;
        --brand: #f2b600;
        --brand-ink: #e8ecf3;
        --link: #7db7f2;
        --good: #6fd49a;
        --good-bg: #12301f;
        --warn: #f2c261;
        --warn-bg: #33270a;
        --bad: #ff9a92;
        --bad-bg: #3a1714;
        --neutral-bg: #1f2a40;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.55;
    font-size: 16px;
}

.container { max-width: 760px; margin: 0 auto; padding: 0 16px; }
main.container { padding-top: 24px; padding-bottom: 48px; }

a { color: var(--link); }
h1 { font-size: 1.7rem; line-height: 1.2; margin: 0 0 8px; }
h2 { font-size: 1.2rem; margin: 28px 0 8px; }
h3 { font-size: 1rem; margin: 16px 0 4px; }
.lead { font-size: 1.05rem; color: var(--muted); margin: 0 0 20px; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.site-header { border-bottom: 1px solid var(--line); background: var(--surface); }
.header-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding-top: 12px; padding-bottom: 12px; }
.brand { font-weight: 800; font-size: 1.2rem; color: var(--brand-ink); text-decoration: none; letter-spacing: -0.01em; }
.brand-boi { color: var(--accent); }
.nav { display: flex; gap: 14px; flex-wrap: wrap; font-size: 0.95rem; }
.nav a { color: var(--text); text-decoration: none; }
.nav a:hover { text-decoration: underline; }

.site-footer { border-top: 1px solid var(--line); padding: 20px 0 32px; color: var(--muted); font-size: 0.85rem; }

.theme-switch { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 14px 0 0; }
.theme-switch .seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.theme-switch button {
    appearance: none; border: 0; background: var(--surface); color: var(--text);
    font: inherit; font-size: 0.85rem; padding: 6px 12px; cursor: pointer;
}
.theme-switch button + button { border-left: 1px solid var(--line); }
.theme-switch button[aria-pressed="true"] { background: var(--brand); color: var(--bg); font-weight: 700; cursor: default; }
.theme-switch button:focus-visible { outline: 2px solid var(--link); outline-offset: -2px; }

.hero { padding: 12px 0 8px; }
.hero h1 { font-size: 2.2rem; }

.cards { display: grid; gap: 14px; grid-template-columns: 1fr; margin: 12px 0 24px; }
@media (min-width: 640px) { .cards { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); } }

.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 16px;
}
.tool { text-decoration: none; color: var(--text); display: block; }
.tool:hover { border-color: var(--accent); }
.tool h2 { margin: 0 0 6px; font-size: 1.15rem; }
.kicker { margin: 0 0 4px; color: var(--muted); font-size: 0.9rem; }
.cta { color: var(--link); font-weight: 600; }

.section-title { margin-top: 28px; }

.notice {
    background: var(--neutral-bg);
    border-left: 4px solid var(--accent);
    border-radius: 8px;
    padding: 12px 14px;
    margin: 20px 0;
}
.notice.warn { background: var(--warn-bg); border-left-color: var(--warn); }
.notice.good { background: var(--good-bg); border-left-color: var(--good); }
.notice.bad { background: var(--bad-bg); border-left-color: var(--bad); }
.notice p, .notice ul { margin: 6px 0 0; }
.notice ul { padding-left: 20px; }

.search { display: flex; gap: 8px; align-items: stretch; margin: 12px 0 16px; }
.search input {
    flex: 1;
    min-width: 0;
    padding: 12px 14px;
    font-size: 1rem;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--text);
}
.prefix { display: flex; align-items: center; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--neutral-bg); font-weight: 600; }

.btn {
    display: inline-block;
    padding: 12px 18px;
    border: 0;
    border-radius: 10px;
    background: var(--accent);
    color: #1a1400;
    font-weight: 700;
    font-size: 1rem;
    text-decoration: none;
    cursor: pointer;
}
.btn.secondary { background: var(--neutral-bg); color: var(--text); font-weight: 600; padding: 8px 14px; font-size: 0.9rem; }

.results, .quotes, .alert-full { list-style: none; padding: 0; margin: 12px 0; display: grid; gap: 12px; }
.result-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; flex-wrap: wrap; }
.result-name { font-weight: 700; }
.results p, .quotes p { margin: 6px 0 0; }

.badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
    white-space: nowrap;
}
.badge.big { font-size: 0.95rem; padding: 4px 14px; }
.badge.good { background: var(--good-bg); color: var(--good); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }
.badge.neutral { background: var(--neutral-bg); color: var(--muted); }

.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 16px 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }

.quote.best { border-color: var(--good); }
.received { font-size: 1.6rem; font-weight: 800; margin: 8px 0 0; }
.received .unit { font-size: 0.9rem; font-weight: 500; color: var(--muted); }
.cost-bar { width: 100%; height: 8px; margin: 8px 0 4px; accent-color: var(--bad); }

.alert-list { padding-left: 20px; }
.pattern { margin: 10px 0; }
.pattern summary { cursor: pointer; font-weight: 700; }
.pattern ul { padding-left: 20px; margin: 4px 0; }

.check-box { margin: 8px 0 24px; }
.check-box h2 { margin: 0 0 10px; font-size: 1.1rem; }
textarea {
    width: 100%;
    min-height: 120px;
    padding: 12px 14px;
    font: inherit;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--text);
    resize: vertical;
    margin-bottom: 10px;
}
.verdict { border-radius: var(--radius); padding: 16px; margin: 20px 0; border: 1px solid var(--line); }
.verdict p { margin: 4px 0 0; }
.verdict-label { font-size: 1.4rem; font-weight: 800; margin: 0; }
.verdict.good { background: var(--good-bg); border-color: var(--good); }
.verdict.warn { background: var(--warn-bg); border-color: var(--warn); }
.verdict.bad { background: var(--bad-bg); border-color: var(--bad); }
.signals, .guide-list { list-style: none; padding: 0; margin: 12px 0; display: grid; gap: 12px; }
.signals p, .guide-list p { margin: 6px 0 0; }
.prose h1 { margin-top: 0; }
.prose h2 { margin-top: 24px; }
.prose ul, .prose ol { padding-left: 22px; }
.prose li { margin: 4px 0; }
.prose code { background: var(--neutral-bg); padding: 1px 6px; border-radius: 6px; }

/* Checker: the status text only shows while an in-page request is running (htmx adds .htmx-request). */
.htmx-indicator { opacity: 0; visibility: hidden; margin-left: 10px; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { opacity: 1; visibility: visible; transition: opacity 200ms ease-in; }
#check-result { min-height: 1px; }
