:root {
  color-scheme: light dark;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --text: #121620;
  --muted: #5a6372;
  --faint: #8a93a3;
  --border: #e1e5eb;
  --accent: #0a66c2;
  --accent-ink: #ffffff;
  --accent-soft: #e7f0fa;
  --ok: #17784a;
  --ok-soft: #e2f3e9;
  --warn: #8f5500;
  --warn-soft: #fbefd9;
  --bad: #b3261e;
  --bad-soft: #fce8e6;
  --v4: #0a66c2;
  --v6: #7a3fc4;
  --radius: 14px;
  --radius-small: 8px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 2px 6px rgba(16, 24, 40, .05);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

/* Theme: "auto" (no data-theme on <html>) follows the system setting;
   the footer switch sets data-theme="light" or "dark" to override it.
   The two dark blocks below must stay identical. */
:root[data-theme="light"] { color-scheme: light; }

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0c1016;
  --surface: #141a22;
  --surface-2: #1b222c;
  --text: #e7ecf2;
  --muted: #9ba6b4;
  --faint: #6f7a88;
  --border: #28313c;
  --accent: #5aa2ff;
  --accent-ink: #0c1016;
  --accent-soft: #14263c;
  --ok: #4cc38a;
  --ok-soft: #12291e;
  --warn: #e5ac4b;
  --warn-soft: #2e2412;
  --bad: #f2756b;
  --bad-soft: #321816;
  --v4: #5aa2ff;
  --v6: #b48cf2;
  --shadow: none;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0c1016;
    --surface: #141a22;
    --surface-2: #1b222c;
    --text: #e7ecf2;
    --muted: #9ba6b4;
    --faint: #6f7a88;
    --border: #28313c;
    --accent: #5aa2ff;
    --accent-ink: #0c1016;
    --accent-soft: #14263c;
    --ok: #4cc38a;
    --ok-soft: #12291e;
    --warn: #e5ac4b;
    --warn-soft: #2e2412;
    --bad: #f2756b;
    --bad-soft: #321816;
    --v4: #5aa2ff;
    --v6: #b48cf2;
    --shadow: none;
  }
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 var(--font);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--accent); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }

code, pre { font-family: var(--mono); font-size: .92em; }

h1, h2, h3 { line-height: 1.2; margin: 0; }

[hidden] { display: none !important; }

.wrap {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px;
}

/* Header and footer */

.masthead {
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.masthead-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 24px;
  padding-top: 14px;
  padding-bottom: 14px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-weight: 650;
  text-decoration: none;
  letter-spacing: -.01em;
}
.brand .tld { color: var(--muted); font-weight: 500; }

.nav { display: flex; flex-wrap: wrap; gap: 4px 18px; font-size: .95rem; }
.nav a { color: var(--muted); text-decoration: none; padding: 2px 0; }
.nav a:hover { color: var(--text); }
.nav a[aria-current="page"] { color: var(--text); font-weight: 600; box-shadow: inset 0 -2px 0 var(--accent); }

main.wrap { flex: 1; padding-top: 36px; padding-bottom: 48px; }

.footer {
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: .9rem;
}
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  padding-top: 16px;
  padding-bottom: 16px;
}

/* Pill of options (theme switch, history filter): real radio buttons, drawn as one pill */
.segmented {
  display: inline-flex;
  gap: 2px;
  margin: 0;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
}
.segmented label { position: relative; cursor: pointer; }
.segmented input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.segmented .opt {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: .85rem;
  font-weight: 600;
  color: var(--muted);
}
.segmented label:hover .opt { color: var(--text); }
.segmented input:checked + .opt {
  background: var(--surface-2);
  color: var(--text);
  box-shadow: inset 0 0 0 1px var(--border);
}
.segmented input:focus-visible + .opt { outline: 2px solid var(--accent); outline-offset: 1px; }

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* Intro */

.intro { margin-bottom: 24px; }
.intro h1 { font-size: clamp(1.75rem, 1.2rem + 2.4vw, 2.6rem); letter-spacing: -.02em; }
.lede { color: var(--muted); margin: 10px 0 0; max-width: 62ch; font-size: 1.05rem; }
.lede strong { color: var(--text); font-weight: 600; }

.connection {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: clamp(1.15rem, 1rem + .6vw, 1.4rem);
  line-height: 1.7;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 1px 12px;
  border-radius: 999px;
  font-size: .88em;
  font-weight: 700;
  letter-spacing: .01em;
  white-space: nowrap;
  vertical-align: 1px;
  color: var(--fam);
  background: color-mix(in srgb, var(--fam) 13%, transparent);
  border: 1px solid color-mix(in srgb, var(--fam) 32%, transparent);
}
.chip-https { --fam: var(--ok); }
.chip-http { --fam: var(--muted); }
.chip-icon { flex: none; }

/* Cards */

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 22px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  border-top: 3px solid var(--fam, var(--accent));
}
.card[data-family="4"] { --fam: var(--v4); }
.card[data-family="6"] { --fam: var(--v6); }

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.card-head h2 { font-size: 1.3rem; color: var(--fam); letter-spacing: .01em; }

.tag {
  font-size: .78rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  white-space: nowrap;
}
.tag-accent { background: var(--accent-soft); color: var(--accent); }
.tag-ok { background: var(--ok-soft); color: var(--ok); }
.tag-bad { background: var(--bad-soft); color: var(--bad); }

/* The fields in each IPv4 / IPv6 box: labels in a fixed left column, values
   beside them, and Copy buttons lined up on the right. On phones each label
   sits above its value. */
.fields { margin: 0; }
.field {
  display: grid;
  grid-template-columns: 8rem minmax(0, 1fr) auto;
  align-items: baseline;
  column-gap: 20px;
  padding: 11px 0;
  border-top: 1px solid var(--border);
}
.field:first-child { border-top: 0; padding-top: 2px; }
.field dt { font-size: 1rem; font-weight: 500; color: var(--muted); }
.field dd { margin: 0; min-width: 0; }
.field .act { align-self: center; }
.val {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 12px;
  font-size: clamp(1.1rem, 1rem + .45vw, 1.3rem);
  font-weight: 600;
  line-height: 1.4;
  overflow-wrap: anywhere;
  min-height: 1.4em;
}
/* Addresses, hostnames and AS numbers are technical strings: monospace keeps
   0/O and 1/l apart. Organisation names stay in the normal font. */
.val code, .val .hostname, .val .network a { font-family: var(--mono); font-size: .95em; }
.val .hostname, .val .ipaddr, .val .network { min-width: 0; }
.val .verify:empty { display: none; }
/* Messages in place of a value ("Checking…", "No reverse DNS", "Unreachable") */
.none { color: var(--faint); font-weight: 500; font-style: italic; }
.val .none { font-family: var(--font); font-size: 1rem; font-weight: 500; line-height: 1.5; }

.cards-stacked { grid-template-columns: minmax(0, 1fr); }

.badge {
  display: inline-block;
  font-family: var(--font);
  font-size: .78rem;
  font-weight: 600;
  line-height: 1.5;
  padding: 2px 9px;
  border-radius: 999px;
  cursor: help;
  white-space: nowrap;
}
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }

.copy {
  font: inherit;
  font-size: .8rem;
  font-weight: 600;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  padding: 3px 10px;
  cursor: pointer;
}
.copy:hover { color: var(--text); }

.card-foot {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  gap: 6px 20px;
  font-size: .9rem;
}

.card.off { opacity: .55; }
.skipped-note { margin: 0 0 4px; color: var(--muted); }

.stats {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1.25fr) minmax(0, .8fr);
  gap: 12px;
  margin: 12px 0 0;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.stats dt { font-size: .9rem; color: var(--muted); font-weight: 500; }
.stats dd { margin: 2px 0 0; font-size: 1rem; font-weight: 600; font-variant-numeric: tabular-nums; }

/* Call to action */

.cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px 24px;
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent);
  border-radius: var(--radius);
  padding: 20px 22px;
  margin-bottom: 20px;
}
.cta h2 { font-size: 1.15rem; margin-bottom: 4px; }
.cta p { margin: 0; color: var(--muted); max-width: 60ch; }

/* The affiliate ad: a solid box in DigitalOcean's navy and blue, so it
   stands apart from the pale call to action above it. It looks the same in
   light and dark themes. Its class names avoid "ad": ad blockers' lists
   (EasyList) hide .ad-body, .ad-label and .ad-note, which left the button
   showing without its label. */

.hosting-pick {
  --pick-ink: #ffffff;
  --pick-soft: #dbe6ff;
  --pick-blue: #0050d0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px 24px;
  background: linear-gradient(135deg, #031b4e 0%, #06317f 55%, var(--pick-blue) 100%);
  color: var(--pick-ink);
  border: 1px solid #031b4e;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 22px;
  margin-bottom: 20px;
}
.hosting-pick h2 { font-size: 1.15rem; margin-bottom: 4px; color: var(--pick-ink); }
.hosting-pick p { margin: 0; color: var(--pick-soft); max-width: 70ch; }
.hosting-pick .pick-label { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-size: .85rem; font-weight: 600; color: var(--pick-soft); }
.hosting-pick .tag { background: rgba(255, 255, 255, .16); color: var(--pick-ink); }
.hosting-pick .button { background: #ffffff; color: var(--pick-blue); border-color: #ffffff; }
.hosting-pick .button:hover { background: #e8efff; filter: none; }
.hosting-pick a:focus-visible { outline-color: #ffffff; }
.pick-preview { border: 2px dashed var(--warn); }

.preview-note {
  background: var(--warn-soft);
  color: var(--text);
  border: 1px solid color-mix(in srgb, var(--warn) 35%, transparent);
  border-radius: var(--radius-small);
  padding: 10px 14px;
  margin: 0 0 18px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font: inherit;
  font-weight: 600;
  line-height: 1.2;
  color: var(--accent-ink);
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 10px;
  padding: 11px 18px;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}
.button:hover { filter: brightness(1.08); text-decoration: none; }
.button-small { padding: 7px 13px; font-size: .9rem; border-radius: var(--radius-small); }
.button-quiet { background: var(--surface); color: var(--text); border-color: var(--border); }
.button-danger { background: var(--surface); color: var(--bad); border-color: var(--border); }
.button-quiet:hover, .button-danger:hover { filter: none; background: var(--surface-2); }

/* Panels */

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  margin-bottom: 20px;
  min-width: 0;
  scroll-margin-top: 130px; /* clear of the sticky toolbar on the Watch page */
}
.panel > h2, .panel-head h2 { font-size: 1.15rem; margin-bottom: 12px; }
.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px 20px;
  margin-bottom: 14px;
}
.panel-head h2 { margin-bottom: 4px; }
.panel-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.panel-actions .segmented { margin-right: 4px; }

.hint { color: var(--muted); font-size: .9rem; margin: 0; }
.panel > .hint { margin-top: 12px; }
.empty { color: var(--faint); margin: 8px 0 0; font-style: italic; }

.prose { max-width: none; }
.prose h2:not(:first-child) { margin-top: 24px; }
.prose p { margin: 0 0 12px; max-width: 72ch; }

.notice pre {
  background: var(--surface-2);
  border-radius: var(--radius-small);
  padding: 12px 14px;
  overflow-x: auto;
}

.link-list { list-style: none; margin: 0; padding: 0; }
.link-list li {
  display: grid;
  grid-template-columns: minmax(150px, 220px) 1fr;
  gap: 4px 16px;
  padding: 10px 0;
  border-top: 1px solid var(--border);
}
.link-list li:first-child { border-top: 0; padding-top: 0; }
.link-list li > span:last-child { color: var(--muted); font-size: .95rem; }
.link-list a { font-weight: 600; }
.pair { color: var(--muted); }

/* Tables */

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

table { border-collapse: collapse; width: 100%; font-size: .93rem; }
th, td { text-align: left; padding: 9px 12px 9px 0; border-top: 1px solid var(--border); vertical-align: top; }
th { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--faint); font-weight: 600; border-top: 0; white-space: nowrap; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

.api-table td:first-child { white-space: nowrap; width: 1%; padding-right: 24px; }
.api-table tr:first-child td { border-top: 0; }

.history td { white-space: nowrap; font-variant-numeric: tabular-nums; }
.history td.host { white-space: normal; overflow-wrap: anywhere; min-width: 18ch; color: var(--muted); }
.history td.host .net { display: block; font-size: .85em; color: var(--faint); }
.history td.addr code { font-weight: 600; }
/* Times from another day ("14 Nov 21:03:16") may put the date above the time */
.history td.when { white-space: normal; }
.history .nowrap { white-space: nowrap; }
/* In the full table, IP addresses stay on one line. (Chrome otherwise
   breaks at the <wbr> points even inside nowrap.) */
.history wbr { display: none; }

/* Below the width where all seven columns fit, each entry becomes a small
   block: family, address and checks / hostname / times. */
@media (max-width: 1020px) {
  .history wbr { display: inline; }
  .history thead { display: none; }
  .history, .history tbody { display: block; width: 100%; }
  .history tr {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px 10px;
    padding: 10px 0 10px 10px;
    border-top: 1px solid var(--border);
  }
  .history tr:first-child { border-top: 0; }
  .history td { border: 0; padding: 0 !important; white-space: normal; }
  .history tr.current { box-shadow: inset 3px 0 0 var(--ok); }
  .history tr.current td:first-child { box-shadow: none; }
  .history td.addr { flex: 1; min-width: 0; overflow-wrap: anywhere; }
  .history td.num { order: 2; color: var(--muted); font-size: .85rem; }
  .history td.num::before { content: "Checks: "; }
  .history td.host { order: 3; flex-basis: 100%; min-width: 0; }
  .history td.when, .history td.dur { order: 4; color: var(--muted); font-size: .85rem; }
  .history td.when.from::before { content: "From "; }
  .history td.when.to::before { content: "to "; }
  .history td.dur::before { content: "· "; }
}
.history tr.current td:first-child { box-shadow: inset 3px 0 0 var(--ok); padding-left: 10px; }
.history tr.fail td.addr { color: var(--bad); font-weight: 600; }
.history tr.fail td.host { color: var(--bad); }
.history td:first-child { padding-left: 10px; }
.history th:first-child { padding-left: 10px; }

.fam {
  display: inline-block;
  font-size: .75rem;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 6px;
  color: var(--fam);
  background: color-mix(in srgb, var(--fam) 13%, transparent);
}
.fam-4 { --fam: var(--v4); }
.fam-6 { --fam: var(--v6); }

.mark-ok { color: var(--ok); font-weight: 700; margin-left: 4px; cursor: help; }

/* Watch page toolbar */

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 12px 16px;
  margin-bottom: 16px;
  position: sticky;
  top: 8px;
  z-index: 2;
}

.status { display: flex; align-items: center; gap: 10px; font-weight: 600; font-variant-numeric: tabular-nums; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--faint); flex: none; }
.dot.live { background: var(--ok); box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 60%, transparent); animation: pulse 2s infinite; }
.dot.problem { background: var(--bad); }
.dot.paused { background: var(--warn); }

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 55%, transparent); }
  70% { box-shadow: 0 0 0 8px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}
@media (prefers-reduced-motion: reduce) { .dot.live { animation: none; } }

.controls { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 16px; font-size: .92rem; }
.alerts-hint { flex-basis: 100%; }
.field-inline { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); }
.check { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.check input { accent-color: var(--accent); width: 16px; height: 16px; margin: 0; }

select {
  font: inherit;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  padding: 5px 8px;
}

button:focus-visible, a:focus-visible, select:focus-visible, input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Share of checks */

.summary { display: grid; gap: 18px; }
.share-group h3 { font-size: .85rem; margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
.share-group h3 .count { color: var(--faint); font-weight: 500; }
.share-row {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(80px, 2fr) 3.2em minmax(0, 1.3fr);
  align-items: center;
  gap: 12px;
  padding: 5px 0;
  font-size: .92rem;
}
.share-row code { font-weight: 600; overflow-wrap: anywhere; }
.share-label { min-width: 0; }
.share-label .net { display: block; font-size: .8rem; color: var(--faint); overflow-wrap: anywhere; }
.share-row.fail code { color: var(--bad); font-family: var(--font); }
.bar { height: 8px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--fam, var(--accent)); border-radius: 999px; transition: width .3s ease; }
.share-row.fail .bar > span { background: var(--bad); }
.pct { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.share-meta { color: var(--muted); font-size: .85rem; font-variant-numeric: tabular-nums; }

@media (max-width: 640px) {
  main.wrap { padding-top: 24px; }
  .card, .panel, .cta, .hosting-pick { padding: 18px 16px; }
  .link-list li { grid-template-columns: 1fr; }
  .share-row { grid-template-columns: minmax(0, 1fr) 3.2em; }
  .share-row .bar { grid-column: 1 / -1; grid-row: 2; }
  .share-row .share-meta { grid-column: 1 / -1; }
  .toolbar { position: static; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .field { grid-template-columns: minmax(0, 1fr) auto; row-gap: 2px; }
  .field dt { grid-column: 1 / -1; font-size: .9rem; }
}
