:root {
    --bg: #f5f6fa; --surface: #ffffff; --surface-2: #f0f2f8; --text: #14161f; --muted: #626a80;
    --line: #e3e6ef; --accent: #2563eb; --accent-soft: #e6eeff; --bad: #b3261e;
    --good: #0f7b4b; --good-bg: #e0f5ea; --warn: #9a5b00; --warn-bg: #fff1d6; --info: #1d4ed8; --info-bg: #e6eeff;
    --shadow: 0 1px 2px rgba(20,22,31,.05), 0 8px 24px -12px rgba(20,22,31,.12);
    --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0d0f16; --surface: #151824; --surface-2: #1c2030; --text: #eceef6; --muted: #98a0b8;
        --line: #272c40; --accent: #6b9bff; --accent-soft: #1b2a4d; --bad: #ff8a80;
        --good: #55d69a; --good-bg: #11301f; --warn: #ffc15a; --warn-bg: #3a2a0b; --info: #8fb3ff; --info-bg: #1b2a4d;
        --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px -12px rgba(0,0,0,.6);
    }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0; background: var(--bg); color: var(--text);
    font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    background-image: radial-gradient(900px 400px at 50% -120px, var(--accent-soft), transparent 70%);
    background-repeat: no-repeat;
}
.wrap { max-width: 1240px; margin: 0 auto; padding: 32px 16px 56px; }

.hero {
    background: var(--surface); border: 1px solid var(--line); border-radius: 20px;
    padding: 28px clamp(18px, 4vw, 40px); box-shadow: var(--shadow); text-align: center;
}
.eyebrow { color: var(--muted); font-size: .8rem; letter-spacing: .08em; text-transform: uppercase; font-weight: 600; overflow-wrap: anywhere; }
.ip {
    font: 700 clamp(1.5rem, 6.5vw, 3.2rem)/1.15 var(--mono); margin: 8px 0 4px;
    word-break: break-all; cursor: pointer; letter-spacing: -.01em;
}
.where { color: var(--muted); font-size: 1.05rem; margin: 0; }
.badges { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 16px 0 0; padding: 0; list-style: none; }
.badges:empty { display: none; }
.badge { font-size: .78rem; font-weight: 600; padding: 3px 10px; border-radius: 999px; }
.badge.good { color: var(--good); background: var(--good-bg); }
.badge.warn { color: var(--warn); background: var(--warn-bg); }
.badge.info { color: var(--info); background: var(--info-bg); }
/* ---- plain-English summary and the per-card "?" help ---- */
.whererow { display: flex; align-items: center; justify-content: center; gap: 10px; }
.whererow .helpbtn { margin-left: 0; }
.summary { max-width: 62ch; margin: 14px auto 0; color: var(--muted); font-size: .95rem; line-height: 1.55; }
.summary b { color: var(--text); }
.helpbtn {
    margin-left: auto; flex: none; width: 24px; height: 24px; border-radius: 50%; padding: 0; cursor: pointer;
    border: 1px solid var(--line); background: var(--surface-2); color: var(--muted); font: 700 .8rem/1 system-ui, sans-serif;
}
.helpbtn:hover, .helpbtn[aria-expanded="true"] { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.helpbtn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.help { background: var(--surface-2); border-radius: 12px; padding: 14px 16px; margin: -4px 0 18px; font-size: .88rem; line-height: 1.5; }
.help p { margin: 0 0 10px; }
.help p:last-child { margin-bottom: 0; }
.help-intro { color: var(--text); }
.help-term { color: var(--muted); }
.help-term b { color: var(--text); font-weight: 600; }
.help-guide a { color: var(--accent); font-weight: 600; }

/* ---- main navigation, hub, related links, table of contents ---- */
.topnav { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 6px; margin: 0 auto 18px; max-width: 760px; }
.topnav a { color: var(--muted); text-decoration: none; font-weight: 600; font-size: .92rem; padding: 6px 14px; border-radius: 999px; }
.topnav a:hover { color: var(--text); background: var(--surface-2); }
.topnav a[aria-current="page"] { color: var(--accent); background: var(--accent-soft); }
.guidelist { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 10px; }
.guidelist li { background: var(--surface-2); border-radius: 12px; padding: 12px 16px; }
.guidelist a { font-weight: 600; display: block; }
.guidelist span { color: var(--muted); font-size: .92rem; }
.related { max-width: 760px; margin: 22px auto 0; }
.related h2 { font-size: 1rem; margin: 0 0 8px; }
.related ul { margin: 0; padding-left: 1.2em; }
.related li { margin-bottom: 4px; }
.related a { color: var(--accent); }
.related span { color: var(--muted); font-size: .9rem; }
.toc { background: var(--surface-2); border-radius: 12px; padding: 12px 18px; margin: 16px 0; font-size: .92rem; }
.toc strong { display: block; margin-bottom: 4px; }
.toc ol { margin: 0; padding-left: 1.3em; columns: 2 220px; }
.toc li { margin: 0 0 3px; }
.article h2[id], .article h3[id] { scroll-margin-top: 16px; }

/* ---- SPF explainer ---- */
.spfform { display: grid; gap: 8px; margin: 12px 0 4px; }
.spfform label { font-weight: 600; font-size: .88rem; }
.spfform input, .spfform textarea { width: 100%; font: .92rem var(--mono); padding: 9px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--text); }
.spfform .btn { justify-self: start; margin-top: 4px; }
table.spfterms td:first-child { white-space: nowrap; }
table.spfterms td.cost { text-align: center; font-family: var(--mono); }
table.spfterms tr.warn td:first-child { border-left: 3px solid var(--warn); }
table.spfterms tr.bad td:first-child { border-left: 3px solid var(--bad); }
.termnote { margin-top: 4px; color: var(--warn); font-size: .88rem; }
table.spfterms tr.bad .termnote { color: var(--bad); }
.warnnote { color: var(--warn); }
.callout { background: var(--accent-soft); border-radius: 12px; padding: 12px 16px; margin: 16px 0; }
.article h3 { font-size: 1.05rem; margin: 22px 0 6px; }
.article h3 + pre { margin-top: 6px; }

/* ---- email check results ---- */
.verdict { border-radius: 16px; padding: 18px 22px; margin: 22px 0 6px; border: 1px solid var(--line); background: var(--surface-2); }
.verdict-for { color: var(--muted); font: .85rem var(--mono); overflow-wrap: anywhere; }
.verdict-title { font-size: 1.3rem; font-weight: 700; margin: 2px 0; }
.verdict-sub { color: var(--muted); }
.verdict.good { background: var(--good-bg); border-color: var(--good); } .verdict.good .verdict-title { color: var(--good); }
.verdict.warn { background: var(--warn-bg); border-color: var(--warn); } .verdict.warn .verdict-title { color: var(--warn); }
.verdict.info { background: var(--info-bg); border-color: var(--info); } .verdict.info .verdict-title { color: var(--info); }
.verdict.bad { border-color: var(--bad); } .verdict.bad .verdict-title { color: var(--bad); }
.fixlist { display: grid; gap: 16px; margin-bottom: 8px; }
.passlist { list-style: none; padding: 0; margin: 0 0 16px; display: grid; gap: 6px; }
.passlist li { padding-left: 1.6em; position: relative; }
.passlist li::before { content: "\2713"; position: absolute; left: 0; color: var(--good); font-weight: 700; }
.passlist li.pending { color: var(--muted); }
.passlist li.pending::before { content: "\2026"; color: var(--muted); }
details.selector { margin: 8px 0 0; }
details.selector input { width: 100%; max-width: 360px; font: inherit; padding: 8px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--text); }
.article .error { margin: 16px 0; max-width: none; }

/* ---- guide pages ---- */
.crumbs { max-width: 760px; margin: 0 auto 14px; font-size: .9rem; }
.crumbs a { color: var(--accent); text-decoration: none; }
.crumbs a:hover { text-decoration: underline; }
.article {
    max-width: 760px; margin: 0 auto; background: var(--surface); border: 1px solid var(--line); border-radius: 20px;
    padding: 28px clamp(18px, 4vw, 40px) 32px; box-shadow: var(--shadow);
}
.article h1 { font-size: clamp(1.45rem, 4vw, 2.05rem); line-height: 1.2; margin: 0 0 6px; letter-spacing: -.01em; }
.article .meta { color: var(--muted); font-size: .85rem; margin: 0 0 20px; }
.article .lead { font-size: 1.05rem; color: var(--muted); }
.article h2 { font-size: 1.25rem; margin: 34px 0 10px; }
.article p, .article li { line-height: 1.65; }
.article li { margin-bottom: 6px; }
.article a { color: var(--accent); }
.article code { font: .88em var(--mono); background: var(--surface-2); padding: 1px 6px; border-radius: 6px; overflow-wrap: anywhere; }
.article pre { margin: 10px 0; padding: 12px 14px; overflow-x: auto; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; font: .84rem/1.55 var(--mono); }
.article pre code { background: none; padding: 0; }
.tablewrap { overflow-x: auto; margin: 14px 0; }
.article table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.article th, .article td { text-align: left; vertical-align: top; padding: 9px 12px; border-bottom: 1px solid var(--line); }
.article th { color: var(--muted); font-size: .72rem; letter-spacing: .05em; text-transform: uppercase; }
.live { background: var(--accent-soft); border-radius: 14px; padding: 14px 18px; margin: 18px 0; }
.live p { margin: 0 0 6px; }
.live p:last-child { margin: 0; }
.live-note { color: var(--muted); font-size: .9rem; }
.lookup.inline { margin: 14px 0 4px; max-width: none; }
details.setup { border: 1px solid var(--line); border-radius: 12px; padding: 2px 16px; margin: 10px 0; }
details.setup summary { cursor: pointer; font-weight: 600; padding: 12px 0; }
details.setup[open] summary { border-bottom: 1px solid var(--line); margin-bottom: 10px; }
.sources { font-size: .9rem; }

/* ---- "What to do" fix cards ---- */
.fix { border-left: 4px solid var(--accent); }
.fix.bad { border-left-color: var(--bad); }
.fix.warn { border-left-color: var(--warn); }
.fix h2 { align-items: flex-start; }
.fixtag { margin-left: auto; flex: none; font-size: .68rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding: 3px 9px; border-radius: 999px; background: var(--info-bg); color: var(--info); }
.fix.bad .fixtag { background: var(--surface-2); color: var(--bad); }
.fix.warn .fixtag { background: var(--warn-bg); color: var(--warn); }
.fix-why { margin: 0 0 12px; color: var(--muted); }
.fix-steps { margin: 0 0 14px; padding-left: 1.3em; display: grid; gap: 8px; }
pre.record { margin: 0 0 12px; padding: 10px 12px; white-space: pre-wrap; overflow-wrap: anywhere; cursor: pointer; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; font: .82rem/1.5 var(--mono); }
pre.record:hover { background: var(--accent-soft); }
.fix-links { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 0; }

/* ---- addresses a domain resolves to ---- */
.addrs { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; align-items: center; margin: 14px 0 0; font-size: .8rem; color: var(--muted); }
.addrs a { color: var(--text); background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; padding: 2px 10px; text-decoration: none; font-family: var(--mono); overflow-wrap: anywhere; }
.addrs a b { font-family: system-ui, sans-serif; font-size: .7rem; color: var(--muted); }
.addrs a:hover { background: var(--accent-soft); }
.addrs a.on { border-color: var(--accent); background: var(--accent-soft); }

/* ---- trust score ---- */
.score { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 8px 20px; margin: 22px auto 0; text-align: left; }
.ring {
    --pct: 0; --c: var(--accent); position: relative; flex: none; width: 88px; height: 88px; border-radius: 50%;
    display: grid; place-items: center; background: conic-gradient(var(--c) calc(var(--pct) * 1%), var(--surface-2) 0);
}
.ring::before { content: ""; position: absolute; inset: 9px; border-radius: 50%; background: var(--surface); }
.ring span { position: relative; font: 700 1.6rem/1 var(--mono); }
.ring.good { --c: var(--good); } .ring.warn { --c: var(--warn); } .ring.bad { --c: var(--bad); }
.score-title { color: var(--muted); font-size: .72rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.score-label { font-size: 1.2rem; font-weight: 700; }
.score-label.good { color: var(--good); } .score-label.warn { color: var(--warn); } .score-label.bad { color: var(--bad); }
.why { margin-top: 4px; font-size: .85rem; max-width: 460px; }
.why summary { cursor: pointer; color: var(--accent); width: fit-content; }
.why ul { margin: 8px 0 0; padding: 0; list-style: none; display: grid; gap: 4px; }
.why li { display: flex; gap: 10px; }
.why li b { flex: none; min-width: 2.6em; font-family: var(--mono); text-align: right; }
.why li.good b { color: var(--good); } .why li.warn b { color: var(--warn); } .why li.bad b { color: var(--bad); }

.actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 20px; }
.btn {
    appearance: none; border: 1px solid var(--line); background: var(--surface-2); color: var(--text);
    font: inherit; font-weight: 600; padding: 8px 16px; border-radius: 10px; cursor: pointer; text-decoration: none;
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn:hover { filter: brightness(1.06); }
.btn:disabled { opacity: .6; cursor: progress; }
.btn:focus-visible, .val:focus-visible, .ip:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.lookup { display: flex; gap: 10px; max-width: 520px; margin: 22px auto 0; }
.lookup input {
    flex: 1; min-width: 0; font: inherit; padding: 8px 14px; border-radius: 10px;
    border: 1px solid var(--line); background: var(--bg); color: var(--text);
}
.error { color: var(--warn); background: var(--warn-bg); border-radius: 10px; padding: 8px 14px; margin: 16px auto 0; max-width: 520px; font-weight: 600; }

.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 440px), 1fr)); gap: 20px; margin-top: 24px; align-items: start; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 22px 24px 24px; box-shadow: var(--shadow); min-width: 0; }
.card h2 {
    display: flex; align-items: center; gap: 12px; font-size: 1rem; margin: 0 0 18px; padding-bottom: 14px;
    border-bottom: 1px solid var(--line);
}
.card h2 svg { width: 22px; height: 22px; flex: none; fill: none; stroke: var(--accent); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.card .btn { margin: 18px 8px 4px 0; font-size: .85rem; padding: 7px 16px; display: inline-block; }
/* each field is a small tile: label on top, value below; long values span the full width */
dl { margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 18px 24px; }
.row { display: block; min-width: 0; }
.row.wide { grid-column: 1 / -1; }
dt { color: var(--muted); font-size: .72rem; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; margin-bottom: 3px; }
dd { margin: 0; min-width: 0; overflow-wrap: anywhere; font-size: .95rem; line-height: 1.4; }
.val { cursor: pointer; border-radius: 4px; white-space: pre-line; }
.val:hover { background: var(--accent-soft); }
.tone-good { color: var(--good); font-weight: 600; }
.tone-warn { color: var(--warn); font-weight: 600; }
.ext { font-size: .8rem; color: var(--accent); white-space: nowrap; }
.note { color: var(--muted); font-size: .78rem; margin: 6px 0 4px; }
[hidden] { display: none !important; }

.toast {
    position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
    background: var(--text); color: var(--bg); padding: 8px 16px; border-radius: 999px; font-weight: 600; font-size: .85rem;
    transition: .2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
footer { text-align: center; color: var(--muted); font-size: .8rem; margin-top: 28px; }
footer a { color: inherit; }
@media (max-width: 520px) { .card { padding: 18px 16px 20px; } dl { grid-template-columns: 1fr 1fr; gap: 16px 14px; } }
@media (prefers-reduced-motion: reduce) { .toast { transition: none; } }

/* ---- tabs ---- */
.tabs {
    display: flex; gap: 4px; margin-top: 24px; overflow-x: auto; border-bottom: 1px solid var(--line);
    scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
    appearance: none; background: none; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px;
    padding: 12px 16px; font: inherit; font-weight: 600; color: var(--muted); cursor: pointer; white-space: nowrap;
    display: inline-flex; align-items: center; gap: 8px; border-radius: 8px 8px 0 0;
}
.tab:hover { color: var(--text); background: var(--surface-2); }
.tab[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); }
.tab:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.dot.warn { background: var(--warn); }
.dot.good { background: var(--good); }
.tabpanel .grid { margin-top: 20px; }
@media (max-width: 520px) { .tab { padding: 10px 12px; } }

/* ---- recent lookups ---- */
.recent { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; align-items: center; margin-top: 14px; font-size: .8rem; color: var(--muted); }
.recent a { color: var(--text); background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; padding: 2px 10px; text-decoration: none; overflow-wrap: anywhere; }
.recent a:hover { background: var(--accent-soft); }
.recent button { background: none; border: 0; color: var(--muted); font: inherit; cursor: pointer; text-decoration: underline; }
/* DKIM check */
dl.keyfacts { display: grid; gap: 4px; margin: 6px 0 10px; }
dl.keyfacts .row { display: grid; grid-template-columns: 10.5em 1fr; gap: 10px; }
dl.keyfacts dt { color: var(--muted); }
dl.keyfacts dd { margin: 0; overflow-wrap: anywhere; font-family: var(--mono); font-size: .88rem; }
.dkim-issue { border-left: 3px solid var(--line); padding: 4px 0 4px 14px; margin: 12px 0; }
.dkim-issue.bad { border-color: var(--bad); } .dkim-issue.warn { border-color: var(--warn); } .dkim-issue.good { border-color: var(--good); } .dkim-issue.info { border-color: var(--info); }
.dkim-issue pre.record { max-height: 9em; overflow: auto; }
form.lookup.inline input + input { max-width: 14em; }
.spfform label { display: block; font-weight: 600; margin: 8px 0 4px; }
.spfform button { margin-top: 10px; }
