/* tools in the apple.com arrangement, compact: Store-style head with the search, the fifteen tools as four Settings
   lists (a coloured icon square, name, one grey line), then the open tool: its name, one sentence, the form in a tile,
   results below with thin dividers. tools.js binds by id/class and writes the result markup; every state below is
   read from that markup. */

/* older palette names tools.js still writes inline (score widths stay inline, the video status colour) */
.tl main { --text: var(--ink); --text-muted: var(--body); --text-subtle: var(--mut); --accent: var(--acc); --border: var(--div); }
main strong, main b { font-weight: 600; color: var(--ink); }
main em { font-style: normal; font-family: var(--mono); font-size: .92em; }
main code { font-size: .92em; color: var(--ink); }

/* ---------- head: title, sentence, the tool search under it ---------- */
.tl-head { flex-direction: column; align-items: flex-start; }
.tool-find { width: min(360px, 100%); }
main #toolSearch { width: 100%; font-size: 15px; }

/* ---------- the tools as Settings lists: four groups, the open tool inverted ---------- */
.tool-nav { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); align-items: start; gap: 24px 16px; margin-top: 40px; }
.tool-nav-group { display: flex; flex-direction: column; min-width: 0; }
.tool-nav-group:nth-child(1) { --grp: #0a84ff; }
.tool-nav-group:nth-child(2) { --grp: #5e5ce6; }
.tool-nav-group:nth-child(3) { --grp: #2c9fb8; }
.tool-nav-group:nth-child(4) { --grp: #8e8e93; }
.tool-nav-label { margin: 0 0 8px 14px; font-size: 13px; font-weight: 400; letter-spacing: -.01em; color: var(--mut); }
.tool-seg { display: flex; flex-direction: column; border-radius: var(--r-m); background: var(--surf); overflow: hidden; }
.tool-nav-group.is-hidden, .tool-tab.is-hidden { display: none; }
.tool-nav-empty { display: none; grid-column: 1 / -1; padding: 4px 0; font-size: 15px; color: var(--mut); }

.tool-tab {
  position: relative; display: grid; grid-template-columns: 28px minmax(0, 1fr) auto;
  grid-template-areas: "ico name code" "ico desc code"; align-items: center; column-gap: 12px;
  width: 100%; min-width: 0; padding: 9px 14px;
  border: 0; border-radius: 0; background: none; color: var(--ink); font: inherit; text-align: left; cursor: pointer;
  transition: background-color .2s var(--ease), color .2s var(--ease);
}
.tool-tab + .tool-tab::before { content: ''; position: absolute; top: 0; left: 54px; right: 0; height: 1px; background: var(--div); }
.tt-ico { grid-area: ico; width: 28px; height: 28px; padding: 5px; border-radius: 7px; background: var(--grp); color: #fff; stroke-width: 2; }
.tt-name { grid-area: name; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; font-weight: 500; line-height: 1.3; }
.tt-desc { grid-area: desc; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; line-height: 1.35; color: var(--mut); }
.tt-code { grid-area: code; font-size: 11px; color: var(--mut); font-variant-numeric: tabular-nums; }
@media (hover: hover) {
  .tool-tab:hover { background: var(--surf-h); }
}
.tool-tab:focus-visible { outline-offset: -3px; }
/* the chosen tool like a selected sidebar row: accent fill, white text */
.tool-tab.active { background: var(--acc-fill); color: #fff; }
.tool-tab.active :is(.tt-desc, .tt-code) { color: #fff; }
.tool-tab.active .tt-ico { background: #fff; color: var(--grp); }
.tool-tab.active::before, .tool-tab.active + .tool-tab::before { opacity: 0; }

/* ---------- the open tool ---------- */
.tl-tool { margin-top: 56px; padding-top: 48px; border-top: 1px solid var(--div); scroll-margin-top: 56px; }
.tl-hero { margin-bottom: 26px; }
.tl-name { font-size: clamp(28px, 3.4vw, 40px); letter-spacing: -.024em; }
.tl-say { margin-top: 10px; max-width: 64ch; font-size: 17px; line-height: 1.47; color: var(--mut); }
.tl-say:empty { display: none; }
.tool-tab-pane { display: none; min-width: 0; }
.tool-tab-pane.active { display: block; }

/* the form: a tile with labelled fields; the run button is the one blue thing */
.tool-ctl { display: flex; flex-direction: column; gap: 20px; min-width: 0; padding: 28px; border-radius: var(--r); background: var(--surf); }
.iig { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; min-width: 0; }
.fld { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.fld > label { font-size: 13px; color: var(--body); }
.fld-grow { flex: 1 1 320px; max-width: 640px; }
main :is(.iig-input, .tool-input) { width: 100%; height: 44px; font-family: var(--mono); font-size: 15px; }
main :is(.iig-input, .tool-input, .diff-input)::placeholder { font-family: var(--font); }
main :is(.iig-select, .tool-select) { height: 44px; min-width: 132px; font-size: 15px; }
.iig > .dm-btn { min-height: 44px; padding: 0 24px; font-size: 15px; }
.iig-area > .fld-grow { flex-basis: 100%; max-width: none; }
main .iig-area textarea.iig-input { height: auto; min-height: 112px; padding: 10px 14px; resize: vertical; }
main #pwOut { font-size: 18px; cursor: text; }
.tool-note { font-size: 13px; color: var(--mut); }
.extra-row { display: none; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.extra-row.visible { display: flex; }
main :is(#speedBtn, #nslookupBtn, #ytInfoBtn, #ytDownBtn):disabled { cursor: progress; }

/* quick actions and toggles: pills; a chosen toggle is inverted */
.tab-quick, .tool-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.tab-quick-lbl { margin-right: 6px; font-size: 13px; color: var(--mut); }
.tool-chip {
  display: inline-flex; align-items: center; height: 32px; padding: 0 15px;
  border: 0; border-radius: var(--pill); background: var(--card); color: var(--ink);
  font-size: 13px; white-space: nowrap; cursor: pointer; transition: background-color .2s var(--ease), color .2s var(--ease);
}
.tool-chip:hover { background: var(--card-h); }
.tool-chip.tool-chip-accent, #subnetHostsBtn.active { background: var(--sel); color: var(--sel-ink); }

/* recent dns queries (tools.js shows the row with an inline display) */
.dns-history-row { flex-wrap: wrap; align-items: center; gap: 8px; min-width: 0; padding-top: 18px; border-top: 1px solid var(--div); }
.dns-hist-label { margin-right: 6px; font-size: 13px; color: var(--mut); }
.dns-hist-chip {
  display: inline-flex; align-items: center; gap: 8px; max-width: 100%; height: 30px; padding: 0 12px;
  border: 0; border-radius: var(--pill); background: var(--card); color: var(--ink); cursor: pointer;
  font-family: var(--mono); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.dns-hist-chip:hover { background: var(--card-h); }
.dns-hist-type { font-family: var(--font); font-size: 12px; font-weight: 600; color: var(--mut); }
.dns-hist-clear { background: none; font-family: var(--font); color: var(--acc); }
.dns-hist-clear:hover { background: none; text-decoration: underline; }

/* ---------- results: a heading, then rows with thin dividers ---------- */
.tl-res { position: relative; min-width: 0; margin-top: 44px; }
.tl-res > header { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 16px; min-height: 37px; padding-bottom: 12px; border-bottom: 1px solid var(--div); }
.tl-res > header h3 { font-size: 21px; letter-spacing: -.018em; }
.tl-res > header .lbl { margin-left: auto; font-size: 13px; }
.tl-empty { max-width: 78ch; padding: 18px 0; font-size: 15px; color: var(--mut); }
.tl-res:has(> .tl-out:not([style*="none"]):not(:empty)) > .tl-empty { display: none; }

/* the shared result (dns · email · checks · ip): tools.js toggles .visible and writes #resultCard */
.result-wrap { display: none; }
main:has(#tab-dns.active, #tab-email.active, #tab-checks.active, #tab-ip.active) .result-wrap { display: block; }
.result-wrap > .tl-empty, .result-wrap:not(.visible) > .result-card { display: none; }
main:has(#tab-dns.active) .result-wrap:not(.visible) > [data-for="dns"],
main:has(#tab-email.active) .result-wrap:not(.visible) > [data-for="email"],
main:has(#tab-checks.active) .result-wrap:not(.visible) > [data-for="checks"],
main:has(#tab-ip.active) .result-wrap:not(.visible) > [data-for="ip"] { display: block; }
.result-copy { position: absolute; top: -4px; right: 0; min-height: 32px; padding: 0 14px; font-size: 13px; }
.result-copy.copied { color: var(--ok); }
.result-wrap:not(.visible) > .result-copy,
.result-wrap:not(:has(> .result-card > .res-host:first-child)) > .result-copy { display: none; }

.result-card { font-size: 15px; line-height: 1.5; overflow-wrap: anywhere; }
.result-card > .res-host:first-child { padding: 16px 0; border-bottom: 1px solid var(--div); font-family: var(--mono); font-size: 16px; font-weight: 500; color: var(--ink); }

/* waiting: a small ring that turns slowly (static under reduced motion, see ui.css) */
@keyframes tl-spin { to { transform: rotate(360deg); } }
.res-loading, .hdr-loading, .dnssec-loading { display: flex; align-items: center; gap: 12px; padding: 20px 0; font-size: 15px; color: var(--mut); }
:is(.res-loading, .hdr-loading, .dnssec-loading)::before, #speedBtn:disabled + .speed-state::before {
  content: ''; flex: none; width: 16px; height: 16px; border: 2px solid var(--div-2); border-top-color: var(--acc); border-radius: 50%;
  animation: tl-spin 1.1s linear infinite;
}

/* errors, notes and raw records */
.tl-err, .yt-error { margin-top: 16px; padding: 12px 16px; border-radius: var(--r-m); background: var(--down-bg); color: var(--down); font-size: 15px; overflow-wrap: anywhere; }
.tl-err code { color: inherit; }
.res-note { margin-top: 10px; font-size: 14px; color: var(--mut); }
.res-raw { margin-top: 12px; padding: 10px 14px; border-radius: 8px; background: var(--surf); font-family: var(--mono); font-size: 13.5px; color: var(--ink); overflow-wrap: anywhere; }
.res-none { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; color: var(--ink); }
.res-none > .res-note { flex-basis: 100%; margin-top: 2px; }
.result-card > .res-host + .tl-err { margin-top: 20px; }

/* ---------- tables inside a result ---------- */
.res-divider { display: none; }
.res-section { margin-top: 28px; }
.result-card > .res-host + .res-section, .result-card > .res-host + .res-note { margin-top: 20px; }
.res-label {
  display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; padding-bottom: 10px; border-bottom: 1px solid var(--div);
  font-size: 16px; font-weight: 600; color: var(--ink);
}
:is(.rec-row, .check-row, .bl-row, .kv-row, .chain-step, .sec-rec, .trace-step) { padding: 11px 0; border-bottom: 1px solid var(--div); }
/* a state tag tools.js places right under a label (spf in mx and spf) */
.res-label + .badge { display: flex; width: fit-content; margin-top: 12px; }

.rec-row { display: flex; align-items: baseline; gap: 20px; }
.rec-val { flex: 1 1 auto; min-width: 0; font-family: var(--mono); font-size: 14.5px; color: var(--ink); }
.rec-prio { flex: none; font-size: 13px; color: var(--mut); white-space: nowrap; }
.rec-row > .rec-prio:first-child { min-width: 3ch; font-family: var(--mono); color: var(--ink); }

/* spec rows: the key in body grey, the value in ink, a state tag at the end */
.check-row { display: grid; grid-template-columns: minmax(140px, 240px) minmax(0, 1fr) auto; align-items: baseline; gap: 4px 20px; }
.check-name, .kv-key { color: var(--body); }
.check-value, .kv-val { min-width: 0; font-family: var(--mono); font-size: 14px; color: var(--ink); }
.check-row > .badge { justify-self: end; }
.bl-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.bl-name { min-width: 0; font-family: var(--mono); font-size: 14px; color: var(--ink); }
.kv-row { display: grid; grid-template-columns: minmax(130px, 220px) minmax(0, 1fr); align-items: baseline; gap: 4px 20px; }
.chain-step { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; font-family: var(--mono); font-size: 14.5px; color: var(--ink); }
.chain-arrow { flex: none; width: 11px; height: 9px; margin: -6px 0 0 4px; border-left: 1.5px solid var(--div-2); border-bottom: 1.5px solid var(--div-2); }
.trace-zone { font-family: var(--mono); font-size: 14.5px; color: var(--ink); }
.trace-ns { margin-top: 2px; font-family: var(--mono); font-size: 13px; color: var(--mut); }

/* state tags: green, amber, red only for state; an outlined grey tag for plain information */
.badge, .sec-rec-icon, .hdr-icon, .dnssec-icon, .in-range {
  display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: var(--pill);
  background: var(--surf); color: var(--body); font-family: var(--font); font-size: 12px; font-weight: 600; line-height: 1;
  white-space: nowrap; vertical-align: middle;
}
:is(.sec-rec-icon, .hdr-icon, .dnssec-icon) { justify-self: start; }
.badge.ok, .hdr-ok .hdr-icon, .dnssec-ok .dnssec-icon, .in-range.is-in { background: var(--ok-bg); color: var(--ok); }
.badge.warn, .sec-rec-icon.warn { background: var(--warn-bg); color: var(--warn); }
.badge.err, .sec-rec-icon.err, .hdr-fail .hdr-icon, .dnssec-fail .dnssec-icon, .in-range.is-bad { background: var(--down-bg); color: var(--down); }
.badge.info, .sec-rec-icon.info, .dnssec-neutral .dnssec-icon { background: none; box-shadow: inset 0 0 0 1px var(--div-2); color: var(--mut); font-weight: 400; }
/* spf qualifiers: "-all" fail is the strict setting, not an alarm (only spf and srv put a tag in the label above check rows) */
.res-section:has(> .res-label > .badge) > .check-row > .badge.err { background: var(--surf); color: var(--body); }
.res-section:has(> .res-label > .badge) > .check-row > .check-name { font-family: var(--mono); font-size: 14px; color: var(--ink); overflow-wrap: anywhere; }

.sec-rec { display: grid; grid-template-columns: 84px minmax(0, 1fr); align-items: baseline; gap: 4px 16px; }
.sec-rec-text { min-width: 0; color: var(--ink); }

/* scores: a rounded meter in its state colour, the figure in the same colour */
.score-wrap, .score-total-wrap { display: grid; grid-template-columns: minmax(120px, 200px) minmax(0, 1fr) auto; align-items: center; gap: 8px 18px; }
.score-wrap { margin-top: 28px; }
.score-total-wrap { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--div); }
.score-bar { height: 8px; border-radius: 4px; background: var(--div); overflow: hidden; }
.score-bar-lg { height: 12px; border-radius: 6px; }
.score-fill { height: 100%; border-radius: inherit; background: var(--ok-dot); }
.score-fill.warn { background: var(--warn-dot); }
.score-fill.err { background: var(--down); }
.score-label, .subscore-label { color: var(--ink); white-space: nowrap; }
.score-wrap > .score-label:last-child { text-align: right; font-weight: 600; color: var(--ok); }
.score-total-num { font-size: 36px; font-weight: 600; line-height: 1; letter-spacing: -.025em; text-align: right; white-space: nowrap; color: var(--ok); }
.subscore-pts { font-weight: 600; color: var(--ok); }
:is(.score-wrap, .score-total-wrap, .subscore):has(.score-fill.warn) > :is(.score-label:last-child, .score-total-num, .subscore-pts) { color: var(--warn); }
:is(.score-wrap, .score-total-wrap, .subscore):has(.score-fill.err) > :is(.score-label:last-child, .score-total-num, .subscore-pts) { color: var(--down); }
.subscore-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px 32px; margin-top: 28px; }
.subscore { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "l p" "b b"; align-items: baseline; gap: 8px 12px; }
.subscore-label { grid-area: l; }
.subscore-pts { grid-area: p; }
.subscore > .score-bar { grid-area: b; }

/* propagation: one row per resolver, a state dot first (green in sync, amber differs, red timeout) */
.prop-row { display: grid; grid-template-columns: 8px minmax(90px, 130px) minmax(0, 1fr) auto; align-items: center; gap: 4px 14px; padding: 11px 0; border-bottom: 1px solid var(--div); }
.prop-row::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--ok-dot); }
.prop-odd::before { background: var(--warn-dot); }
.prop-err::before { background: var(--down); }
.prop-name { color: var(--body); }
.prop-val { min-width: 0; font-family: var(--mono); font-size: 14px; color: var(--ink); }
.prop-odd .prop-val { color: var(--warn); }
.prop-err .prop-val { font-family: var(--font); color: var(--down); }

/* ssl: days left as a figure beside its tag */
.ssl-days { display: flex; align-items: center; flex-wrap: wrap; gap: 12px 20px; padding: 20px 0; }
.ssl-num { font-size: 44px; font-weight: 600; line-height: 1; letter-spacing: -.025em; color: var(--ink); }
.ssl-unit { font-size: 17px; font-weight: 400; letter-spacing: 0; color: var(--mut); }
.ssl-days .res-note { margin-top: 6px; }

/* ---------- subnet: figures in a spec grid ---------- */
.subnet-bento { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); column-gap: 24px; }
.subnet-cell { display: flex; flex-direction: column; gap: 4px; min-width: 0; padding: 14px 0; border-bottom: 1px solid var(--div); }
.subnet-cell-label { font-size: 13.5px; color: var(--mut); }
.subnet-cell-value { font-family: var(--mono); font-size: 15px; color: var(--ink); overflow-wrap: anywhere; }
.subnet-cell-value.is-text { font-family: var(--font); }
.subnet-cell.hl .subnet-cell-value { font-weight: 500; }
.subnet-cell.hl .subnet-cell-value.is-text { font-weight: 600; }
.subnet-bin { font-size: 13px; }
.subnet-cell:has(.subnet-bin) { grid-column: span 2; }
.subnet-bento > .tl-err { grid-column: 1 / -1; }
/* on a parse error tools.js keeps the stepping tools of the previous net: only the error stays */
.subnet-result:has(> .subnet-bento > .tl-err) > :not(.subnet-bento) { display: none !important; }
.subnet-result > .tool-chips { padding: 16px 0; border-bottom: 1px solid var(--div); }
.subnet-hosts { padding: 4px 0 14px; border-bottom: 1px solid var(--div); }
.subnet-hosts-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); column-gap: 20px; max-height: 280px; overflow-y: auto; }
.subnet-host-ip { padding: 7px 0; border-bottom: 1px solid var(--div); font-size: 13.5px; }
.subnet-more { grid-column: 1 / -1; padding-top: 10px; font-size: 14px; color: var(--mut); }
.tool-input-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 16px; padding: 16px 0; }
.tool-input-row > .fld { flex: 0 1 300px; }
.subnet-contains { padding-bottom: 11px; }

/* ---------- video ---------- */
.yt-card { display: flex; align-items: flex-start; gap: 20px; padding: 20px 0; border-bottom: 1px solid var(--div); }
#ytThumb { display: block; flex: none; width: 192px; max-width: 100%; height: 108px; object-fit: cover; border-radius: var(--r-m); background: var(--surf); }
#ytThumb:not(.is-loaded) { display: none; }
.yt-meta { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.yt-title { font-size: 18px; font-weight: 600; line-height: 1.3; color: var(--ink); overflow-wrap: anywhere; }
.yt-sub { display: flex; flex-wrap: wrap; gap: 4px 18px; font-size: 14px; color: var(--mut); }
.yt-sub > span:empty { display: none; }
.yt-progress { padding: 16px 0; border-bottom: 1px solid var(--div); }
.yt-prog { display: grid; grid-template-columns: minmax(0, 1fr) 56px; align-items: center; gap: 14px; }
.yt-bar { height: 8px; border-radius: 4px; background: var(--div); overflow: hidden; }
#ytProgressBar { width: 0; height: 100%; border-radius: inherit; background: var(--acc); }
#ytProgressPct { text-align: right; font-weight: 600; color: var(--ink); }
.yt-status { margin-top: 6px; font-size: 14px; color: var(--mut); }

/* ---------- security header: the grade as a tinted tile, one row per header, raw headers on demand ---------- */
.hdr-summary { display: flex; align-items: center; gap: 20px; padding: 20px 0; border-bottom: 1px solid var(--div); }
.hdr-grade {
  flex: none; display: grid; place-items: center; min-width: 64px; height: 64px; padding: 0 10px; border-radius: var(--r-m);
  background: var(--down-bg); color: var(--down); font-size: 30px; font-weight: 600; line-height: 1; letter-spacing: -.025em;
}
.hdr-grade-aplus, .hdr-grade-a { background: var(--ok-bg); color: var(--ok); }
.hdr-grade-b { background: var(--warn-bg); color: var(--warn); }
.hdr-summary-title { font-size: 18px; font-weight: 600; color: var(--ink); }
.hdr-summary-sub { margin-top: 2px; font-family: var(--mono); font-size: 13.5px; color: var(--mut); overflow-wrap: anywhere; }
.hdr-row { display: grid; grid-template-columns: 76px minmax(120px, 210px) minmax(0, 1fr); align-items: baseline; gap: 4px 16px; padding: 11px 0; border-bottom: 1px solid var(--div); }
.hdr-name { font-weight: 600; color: var(--ink); }
.hdr-detail { min-width: 0; font-family: var(--mono); font-size: 13.5px; color: var(--body); overflow-wrap: anywhere; }
.hdr-fail .hdr-detail { font-family: var(--font); font-size: 14.5px; }
.hdr-raw > summary { padding: 14px 0; cursor: pointer; color: var(--acc); }
.hdr-raw > summary:hover { color: var(--acc-ink); text-decoration: underline; }
.hdr-raw-row { display: grid; grid-template-columns: minmax(150px, 260px) minmax(0, 1fr); gap: 4px 16px; padding: 7px 0; border-bottom: 1px solid var(--div); font-family: var(--mono); font-size: 13px; color: var(--ink); }
.hdr-raw-row:first-of-type { border-top: 1px solid var(--div); }
.hdr-raw-k { color: var(--mut); }
.hdr-raw-k, .hdr-raw-v { min-width: 0; overflow-wrap: anywhere; }

/* ---------- mac vendor ---------- */
.mac-row { display: grid; grid-template-columns: minmax(110px, 180px) minmax(0, 1fr); align-items: baseline; gap: 4px 20px; padding: 11px 0; border-bottom: 1px solid var(--div); }
.mac-label { color: var(--body); }
.mac-val { min-width: 0; color: var(--ink); overflow-wrap: anywhere; }
.mac-mono { font-family: var(--mono); font-size: 14.5px; }
.mac-vendor { font-weight: 600; }
.mac-fail { color: var(--warn); }
.mac-result > .mac-row:only-child { margin-top: 16px; padding: 12px 16px; border: 0; border-radius: var(--r-m); background: var(--down-bg); color: var(--down); }
.mac-result > .mac-row:only-child :is(.mac-label, .mac-fail) { color: inherit; }

/* ---------- ptr batch ---------- */
.ptr-summary { padding: 16px 0; border-bottom: 1px solid var(--div); font-size: 16px; font-weight: 600; color: var(--ink); }
.ptr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr)); column-gap: 32px; }
.ptr-row { display: grid; grid-template-columns: 8px minmax(110px, 140px) minmax(0, 1fr); align-items: center; gap: 4px 14px; padding: 9px 0; border-bottom: 1px solid var(--div); font-family: var(--mono); font-size: 14px; color: var(--ink); }
.ptr-row::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--ok-dot); }
.ptr-empty::before { background: none; box-shadow: inset 0 0 0 1.5px var(--div-2); }
.ptr-empty .ptr-name { font-family: var(--font); color: var(--mut); }
.ptr-name { min-width: 0; overflow-wrap: anywhere; }

/* ---------- speedtest: latency and download as figures ---------- */
.speed-state { display: inline-flex; align-items: center; gap: 10px; font-size: 15px; color: var(--body); }
.speed-state:empty { display: none; }
.speed-result:not([style*="none"]) { display: grid !important; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.speed-card { display: flex; flex-direction: column; gap: 8px; min-width: 0; padding: 22px 0; border-bottom: 1px solid var(--div); }
.speed-card + .speed-card { padding-left: 28px; border-left: 1px solid var(--div); }
.speed-num { font-size: 44px; font-weight: 600; line-height: 1; letter-spacing: -.025em; color: var(--ink); }
.speed-card-main .speed-num { font-size: 56px; }
.speed-unit { font-size: 17px; font-weight: 400; letter-spacing: 0; color: var(--mut); }
.speed-label { font-size: 14px; color: var(--mut); }
.speed-detail { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px 26px; padding: 12px 0; border-bottom: 1px solid var(--div); font-family: var(--mono); font-size: 13.5px; color: var(--mut); }
/* a run that ended without a download figure ended in its error line */
#tab-speed:has(#speedBtn:enabled):has(#speedResult:not([style*="none"])):not(:has(.speed-card-main)) #speedState { color: var(--down); }

/* ---------- passwords: output, mode, length and characters in the form; strength below ---------- */
.pw-len-row { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 18px; max-width: 640px; }
.pw-label { min-width: 90px; color: var(--ink); }
.pw-len-num { margin-left: 4px; font-weight: 600; font-variant-numeric: tabular-nums; }
.pw-range { width: 100%; }
.pw-toggles { display: flex; flex-wrap: wrap; gap: 12px 28px; }
.pw-toggles label { display: inline-flex; align-items: center; gap: 8px; color: var(--ink); cursor: pointer; }
.pw-strength { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 10px 20px; padding: 20px 0; border-bottom: 1px solid var(--div); }
.pw-bar { height: 10px; border-radius: 5px; background: var(--div); overflow: hidden; }
.pw-bar-fill { width: 0; height: 100%; border-radius: inherit; background: var(--ok-dot); }
.pw-bar-fill.ok { background: var(--warn-dot); }
.pw-bar-fill.weak { background: var(--down); }
.pw-bar-label { min-width: 150px; text-align: right; white-space: nowrap; font-weight: 600; color: var(--ok); }
.pw-strength:has(.pw-bar-fill.ok) .pw-bar-label { color: var(--warn); }
.pw-strength:has(.pw-bar-fill.weak) .pw-bar-label { color: var(--down); }

/* ---------- text diff: two fields side by side; added lines green, removed lines red ---------- */
.diff-input-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
main .diff-input { width: 100%; min-height: 180px; font-family: var(--mono); font-size: 13.5px; resize: vertical; }
.diff-stats { display: inline-flex; gap: 14px; margin-left: auto; font-family: var(--mono); font-size: 14px; font-weight: 500; }
.diff-stats > .diff-add { color: var(--ok); }
.diff-stats > .diff-del { color: var(--down); }
.diff-out { max-height: 520px; overflow: auto; padding: 8px 0; border-bottom: 1px solid var(--div); font-family: var(--mono); font-size: 13.5px; line-height: 1.6; color: var(--ink); }
.diff-line { display: grid; grid-template-columns: 4ch 4ch 2ch minmax(0, 1fr); gap: 0 10px; padding: 0 10px; border-radius: var(--r-s); }
.diff-ln { color: var(--mut); text-align: right; white-space: pre; user-select: none; }
.diff-sign { text-align: center; user-select: none; }
.diff-content { min-width: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.diff-line.diff-add { background: var(--ok-bg); }
.diff-line.diff-add .diff-sign { color: var(--ok); }
.diff-line.diff-del { background: var(--down-bg); }
.diff-line.diff-del .diff-sign { color: var(--down); }

/* ---------- dnssec: a summary plate in its state colour, then zone by zone from the root ---------- */
.dnssec-summary { margin-top: 20px; padding: 16px 20px; border-radius: var(--r-m); background: var(--down-bg); }
.dnssec-summary.ok { background: var(--ok-bg); }
.dnssec-summary-title { font-size: 18px; font-weight: 600; color: var(--down); }
.dnssec-summary.ok .dnssec-summary-title { color: var(--ok); }
.dnssec-summary-sub { margin-top: 2px; font-family: var(--mono); font-size: 13.5px; color: var(--body); overflow-wrap: anywhere; }
.dnssec-chain { counter-reset: dnssec-zone; margin-top: 12px; }
.dnssec-step { counter-increment: dnssec-zone; padding: 14px 0; border-bottom: 1px solid var(--div); }
.dnssec-step-head { margin-bottom: 6px; font-family: var(--mono); font-size: 15px; font-weight: 500; color: var(--ink); }
.dnssec-step-zone { display: inline-flex; align-items: center; gap: 10px; }
.dnssec-step-zone::before {
  content: counter(dnssec-zone); display: grid; place-items: center; width: 22px; height: 22px;
  border: 1.5px solid var(--div-2); border-radius: 50%; font: 600 11.5px/1 var(--font); color: var(--mut);
}
.dnssec-arrow { display: none; }
.dnssec-row { display: grid; grid-template-columns: 64px minmax(130px, 200px) minmax(0, 1fr); align-items: baseline; gap: 4px 16px; padding: 6px 0 6px 32px; }
.dnssec-label { color: var(--body); }
.dnssec-detail { min-width: 0; font-family: var(--mono); font-size: 13.5px; color: var(--ink); overflow-wrap: anywhere; }
.dnssec-result > .dnssec-row { padding: 12px 0; border-bottom: 1px solid var(--div); }
.dnssec-fail .dnssec-detail, .dnssec-step:first-child .dnssec-step-zone { font-family: var(--font); }
.dnssec-step:first-child .dnssec-step-zone { font-weight: 600; }

/* ---------- nslookup ---------- */
.ns-label { margin-top: 24px; padding-bottom: 10px; border-bottom: 1px solid var(--div); font-size: 16px; font-weight: 600; color: var(--ink); }
.nslookup-result > .ns-label:first-child { margin-top: 20px; }
.ns-row { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; align-items: baseline; gap: 4px 16px; padding: 11px 0; border-bottom: 1px solid var(--div); }
.ns-type { font-size: 13px; font-weight: 600; color: var(--mut); }
.ns-val { min-width: 0; font-family: var(--mono); font-size: 14.5px; color: var(--ink); overflow-wrap: anywhere; }
.ns-ttl { font-size: 13px; color: var(--mut); white-space: nowrap; }
.ns-none { padding: 20px 0; font-size: 15px; color: var(--mut); }

/* ---------- image converter: a drop zone in the form card; loaded images stay images ---------- */
.imgconv-drop {
  display: block; width: 100%; padding: 36px 16px;
  border: 1.5px dashed var(--div-2); border-radius: var(--r-m); background: var(--field); color: var(--ink);
  font-size: 15.5px; text-align: center; cursor: pointer;
}
.imgconv-drop svg { display: block; margin: 0 auto 10px; color: var(--mut); }
.imgconv-drop:hover { border-color: var(--acc); }
.imgconv-drop span { font-weight: 600; color: var(--acc); }
/* tools.js marks a file dragged over the zone with an inline border colour (--accent) */
#imgconvDrop[style*="border-color"] { background: var(--acc-bg); }
.imgconv-row { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 20px; padding: 20px 0; border-bottom: 1px solid var(--div); }
#imgconvImg { display: block; max-width: min(240px, 100%); max-height: 180px; border: 1px solid var(--div); border-radius: 8px; }
#imgconvImg:not([src]) { display: none; }
.imgconv-meta { flex: 1 1 280px; min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.imgconv-info { font-family: var(--mono); font-size: 14px; color: var(--ink); overflow-wrap: anywhere; }
.imgconv-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; }
.imgconv-actions .dm-btn { min-height: 40px; padding: 0 18px; font-size: 14px; }
.imgconv-q { display: inline-flex; align-items: center; gap: 10px; font-size: 14px; color: var(--body); }
.imgconv-q input[type="range"] { width: 130px; }
#imgconvQualityVal { min-width: 4ch; font-weight: 600; color: var(--ink); }
.imgconv-status { padding: 14px 0; font-size: 15px; color: var(--ink); overflow-wrap: anywhere; }
.imgconv-status:empty { display: none; }
/* without a loaded preview the status can only be the type error */
.tl-res:has(> #imgconvPreview[style*="none"]) > .imgconv-status { margin-top: 16px; padding: 12px 16px; border-radius: var(--r-m); background: var(--down-bg); color: var(--down); }

/* ---------- responsive ---------- */
@media (max-width: 1000px) {
  .tool-nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .tool-find { width: 100%; }
  .tool-nav-search kbd { display: none; }
  .tool-nav { gap: 18px 10px; margin-top: 28px; }
  .tool-nav-label { margin-left: 12px; }
  .tool-tab { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "name code"; min-height: 42px; padding: 8px 12px; }
  .tool-tab + .tool-tab::before { left: 12px; }
  .tt-ico, .tt-desc { display: none; }
  .tt-name { font-size: 13.5px; }
  .tl-tool { margin-top: 36px; padding-top: 32px; }
  .tl-hero { margin-bottom: 18px; }
  .tl-say { font-size: 15px; }
  .tool-ctl { gap: 16px; padding: 20px; }
  .fld-grow { flex-basis: 100%; max-width: none; }
  /* a select never shares a row with the run button: it takes its own full row, the buttons share the next */
  :is(.iig, .extra-row) > .fld:not(.fld-grow) { flex: 1 1 100%; }
  main :is(.iig-select, .tool-select) { width: 100%; min-width: 0; }
  .iig > .dm-btn { flex: 1 1 0; }
  .tab-quick-lbl { flex-basis: 100%; }
  .tl-res { margin-top: 32px; }
  .tl-res > header .lbl { flex-basis: 100%; margin-left: 0; }
  .diff-input-row { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 600px) {
  .check-row { grid-template-columns: minmax(0, 1fr) auto; }
  .check-value { grid-column: 1 / -1; grid-row: 2; }
  .kv-row, .mac-row, .hdr-raw-row { grid-template-columns: minmax(0, 1fr); }
  .hdr-row, .dnssec-row { grid-template-columns: 70px minmax(0, 1fr); }
  .hdr-detail, .dnssec-detail { grid-column: 2; }
  .dnssec-row { padding-left: 0; }
  .ptr-row { grid-template-columns: 8px minmax(0, 1fr); }
  .ptr-name { grid-column: 2; }
  .prop-row { grid-template-columns: 8px minmax(0, 1fr) auto; }
  .prop-val { grid-column: 2 / -1; }
  .sec-rec { grid-template-columns: minmax(0, 1fr); }
  .score-wrap, .score-total-wrap { grid-template-columns: minmax(0, 1fr) auto; }
  .score-wrap > .score-bar, .score-total-wrap > .score-bar { grid-column: 1 / -1; grid-row: 2; }
  .subscore-row { grid-template-columns: minmax(0, 1fr); }
  .subnet-bento { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .subnet-cell:has(.subnet-bin) { grid-column: 1 / -1; }
  .speed-result:not([style*="none"]) { grid-template-columns: minmax(0, 1fr); }
  .speed-card + .speed-card { padding-left: 0; border-left: 0; }
  .yt-card { flex-direction: column; }
  .pw-strength { grid-template-columns: minmax(0, 1fr); }
  .pw-bar-label { min-width: 0; text-align: left; }
}
