/* Total Uptime tools: the NetOps / NetDiag look (same tokens and components). */

:root {
  --canvas: #e8ecf2;
  --bg: #f4f6fa;
  --surface: #ffffff;
  --surface-2: #f0f2f7;
  --border: #dde2ea;
  --line: #edf0f4;
  --text: #18202d;
  --muted: #5d6878;
  --accent: #1ca3db;
  --accent-ink: #0b78a6;
  --accent-text: #ffffff;
  --accent-soft: #e0f3fb;
  --ok: #0a7a5f;
  --warn: #c2570c;
  --bad: #c62828;
  --radius: 12px;
  --mono: ui-monospace, SFMono-Regular, "Cascadia Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --canvas: #080b10; --bg: #0d1117; --surface: #161b24; --surface-2: #1d2430; --border: #2a3342; --line: #222a36;
    --text: #e4e9f1; --muted: #93a0b4; --accent: #1ca3db; --accent-ink: #1ca3db; --accent-text: #06202c; --accent-soft: #10303f;
    --ok: #34d1a5; --warn: #f7943a; --bad: #f87171; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --canvas: #080b10; --bg: #0d1117; --surface: #161b24; --surface-2: #1d2430; --border: #2a3342; --line: #222a36;
  --text: #e4e9f1; --muted: #93a0b4; --accent: #1ca3db; --accent-ink: #1ca3db; --accent-text: #06202c; --accent-soft: #10303f;
  --ok: #34d1a5; --warn: #f7943a; --bad: #f87171; color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--canvas); color: var(--text); font: 15px/1.5 var(--sans); }
h1, h2, h3 { margin: 0; line-height: 1.25; }
[hidden] { display: none !important; }
a { color: var(--accent-ink); }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); }

/* ---------- Frame: a top bar, then the page in a rounded panel ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  max-width: 1080px; margin: 0 auto; padding: 14px 20px 12px;
}
.brand { display: flex; align-items: center; gap: 14px; color: var(--text); text-decoration: none; }
.brand img { width: 168px; height: auto; display: none; }
:root:not([data-theme="dark"]) .brand .th-light, :root[data-theme="dark"] .brand .th-dark { display: block; }
.brand-sub {
  padding-left: 14px; border-left: 1px solid var(--border);
  font-size: .72rem; font-weight: 650; text-transform: uppercase; letter-spacing: .14em; color: var(--muted); white-space: nowrap;
}
.icon-btn {
  display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 8px;
  border: 0; background: transparent; color: var(--muted); cursor: pointer;
}
.icon-btn:hover { background: var(--surface); color: var(--text); }
.ico-sun { display: none; }
:root[data-theme="dark"] .ico-sun { display: block; }
:root[data-theme="dark"] .ico-moon { display: none; }

.page {
  max-width: 1080px; margin: 0 auto; padding: 28px 28px 32px;
  background: var(--bg); border-radius: 20px;
}
.intro { margin-bottom: 20px; }
.intro h1 { font-size: 1.6rem; font-weight: 700; letter-spacing: -.01em; }
.intro p { margin: 4px 0 0; color: var(--muted); }

footer {
  max-width: 1080px; margin: 0 auto; padding: 18px 20px 28px;
  display: flex; flex-wrap: wrap; gap: 6px 16px; justify-content: space-between; color: var(--muted); font-size: .85rem;
}
footer a { color: var(--muted); }

/* ---------- Your IP addresses ---------- */
.ips { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.ip-card { position: relative; background: var(--surface); border-radius: var(--radius); padding: 16px 18px 18px; min-width: 0; }
.ip-k { display: flex; align-items: center; gap: 8px; font-size: .75rem; font-weight: 650; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.ip-v {
  margin-top: 6px; font-family: var(--mono); font-size: 1.45rem; font-weight: 600; letter-spacing: -.01em;
  overflow-wrap: anywhere; min-height: 1.5em;
}
.ip-v.none { color: var(--muted); font-family: var(--sans); font-size: 1.05rem; font-weight: 500; padding-top: .25em; }
.ip-card .copy { position: absolute; top: 10px; right: 10px; }
.ip-card .copy:hover { background: var(--surface-2); }
.copy.done { color: var(--ok); }
.tag {
  font-size: .68rem; font-weight: 650; letter-spacing: .02em; text-transform: none;
  padding: 1px 8px; border-radius: 999px; color: var(--accent-ink); background: var(--accent-soft);
}

/* ---------- Tool card with tabs ---------- */
.card { background: var(--surface); border-radius: var(--radius); }
.tabs {
  display: flex; gap: 4px; padding: 8px 8px 0; box-shadow: inset 0 -1px var(--line);
  overflow-x: auto; overflow-y: hidden; scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  display: inline-flex; align-items: center; gap: 8px; padding: 10px 14px;
  font: inherit; font-weight: 600; color: var(--muted); background: none; cursor: pointer;
  border: 0; border-bottom: 2px solid transparent; white-space: nowrap; text-decoration: none;
}
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); }
.tab svg { flex: none; }
.tab[aria-selected="true"] svg { color: var(--accent); }
.no-js .tabs { display: none; }

.panel { padding: 20px 20px 22px; }
.no-js .panel + .panel { border-top: 1px solid var(--line); }
.panel-head { margin-bottom: 14px; }
.panel-head h2 { font-size: 1.1rem; }
.panel-head p { margin: 2px 0 0; color: var(--muted); font-size: .9rem; }

/* ---------- Forms ---------- */
.row { display: grid; gap: 12px; align-items: end; }
.row-dns { grid-template-columns: minmax(0, 2.2fr) minmax(0, 1.3fr) minmax(0, 1.3fr) auto; }
.row-one { grid-template-columns: minmax(0, 1fr) auto; }
.row-trace { grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr) auto; }
.row-opts { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-top: 12px; }
.field { min-width: 0; }
.field > label { display: block; font-weight: 600; font-size: .85rem; margin-bottom: 6px; }
input[type="text"], input[type="number"], select {
  width: 100%; font: inherit; font-size: 16px; color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: 8px; padding: 9px 11px; min-height: 42px;
}
input.mono-in { font-family: var(--mono); font-size: 15px; }
input:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible, summary:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
.btn {
  font: inherit; font-weight: 650; min-height: 42px; padding: 0 20px; border-radius: 8px; border: 1px solid transparent;
  background: var(--accent); color: var(--accent-text); cursor: pointer; white-space: nowrap;
}
.btn:hover:not(:disabled) { background: color-mix(in srgb, var(--accent) 86%, black); }
.btn:disabled { opacity: .6; cursor: progress; }
.opts { margin-top: 12px; }
.opts > summary {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer; list-style: none;
  font-size: .85rem; font-weight: 600; color: var(--muted);
}
.opts > summary::-webkit-details-marker { display: none; }
.opts > summary::before { content: "›"; display: inline-block; font-size: 1.1rem; line-height: 1; transition: transform .15s; }
.opts[open] > summary::before { transform: rotate(90deg); }
.opts > summary:hover { color: var(--text); }
.checks { display: flex; flex-wrap: wrap; gap: 6px 22px; margin-top: 12px; }
label.check { display: inline-flex; align-items: center; gap: 8px; font-size: .9rem; cursor: pointer; }
label.check input { width: 16px; height: 16px; accent-color: var(--accent); margin: 0; }

/* ---------- Results ---------- */
.result { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line); }
.result:empty { display: none; }
.loading { display: flex; align-items: center; gap: 10px; color: var(--muted); }
.spin { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--border); border-top-color: var(--accent); animation: spin .8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.load-error {
  margin: 0; padding: 10px 12px; border-radius: 8px; color: var(--text);
  background: color-mix(in srgb, var(--bad) 12%, transparent); border: 1px solid color-mix(in srgb, var(--bad) 40%, transparent);
}
.res-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-bottom: 14px; }
.res-head .what { font-weight: 650; overflow-wrap: anywhere; }
.res-head .meta { color: var(--muted); font-size: .9rem; }
.pill {
  display: inline-flex; align-items: center; gap: 6px; font-size: .78rem; font-weight: 700; padding: 2px 10px; border-radius: 999px;
  color: var(--muted); background: var(--surface-2);
}
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.ok { color: var(--ok); background: color-mix(in srgb, var(--ok) 13%, transparent); }
.pill.warn { color: var(--warn); background: color-mix(in srgb, var(--warn) 14%, transparent); }
.pill.bad { color: var(--bad); background: color-mix(in srgb, var(--bad) 13%, transparent); }

.sec { display: flex; align-items: center; gap: 8px; margin: 18px 0 8px; font-size: .78rem; font-weight: 650; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.sec:first-child { margin-top: 0; }
.count { font-weight: 700; padding: 0 7px; border-radius: 999px; background: var(--surface-2); letter-spacing: 0; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th { text-align: left; font-size: .74rem; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; background: var(--surface-2); }
th, td { padding: 8px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: color-mix(in srgb, var(--surface-2) 60%, transparent); }
td.mono, td .mono { font-family: var(--mono); font-size: .85rem; }
td.wrap { white-space: normal; overflow-wrap: anywhere; min-width: 200px; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.sub { color: var(--muted); font-size: .82rem; }
td .alt { display: block; color: var(--muted); font-size: .82rem; }
td.lost { color: var(--muted); }
td.hop { color: var(--muted); font-weight: 650; width: 1%; }
.hop-host + .hop-host { margin-top: 6px; }
.empty-line { margin: 0; padding: 10px 12px; color: var(--muted); border: 1px dashed var(--border); border-radius: 10px; font-size: .9rem; }

.stats { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.stat { background: var(--surface-2); border-radius: 10px; padding: 10px 12px; min-width: 0; }
.stat-k { font-size: .72rem; font-weight: 650; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.stat-v { font-size: 1.3rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat-v small { font-size: .8rem; font-weight: 600; color: var(--muted); margin-left: 2px; }
.stat-v.ok { color: var(--ok); } .stat-v.warn { color: var(--warn); } .stat-v.bad { color: var(--bad); }

.kv-grid { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 18px; margin: 0 0 14px; padding: 14px 16px; background: var(--surface-2); border-radius: 10px; }
.kv-grid dt { color: var(--muted); font-size: .88rem; }
.kv-grid dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.kv-grid dd span { display: block; }

pre.out {
  margin: 0; padding: 12px 14px; border-radius: 10px; background: var(--surface-2);
  font: .82rem/1.5 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; max-height: 560px; overflow: auto;
}
details.raw { margin-top: 14px; }
details.raw > summary { cursor: pointer; font-size: .85rem; font-weight: 600; color: var(--muted); margin-bottom: 8px; }
details.raw > summary:hover { color: var(--text); }

/* Result page reached without JavaScript */
.back { display: inline-block; margin-top: 18px; font-weight: 600; }

/* ---------- /myip/ ---------- */
.myip .ips { margin-bottom: 10px; }
.cli { margin-top: 18px; }
.cli h2 { font-size: 1rem; margin-bottom: 8px; }

/* ---------- Narrow screens ---------- */
@media (max-width: 820px) {
  .row-dns { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .row-dns .f-domain { grid-column: 1 / -1; }
  .row-opts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
  .topbar { padding: 10px 14px; }
  .brand img { width: 130px; }
  .brand-sub { display: none; }
  .page { padding: 18px 14px 22px; border-radius: 16px; }
  .intro h1 { font-size: 1.3rem; }
  .ips { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .ip-v { font-size: 1.15rem; }
  .panel { padding: 16px 14px 18px; }
  .row-trace, .row-one { grid-template-columns: minmax(0, 1fr); }
  .row-dns .btn, .row-trace .btn, .row-one .btn { grid-column: 1 / -1; }
  .tab { padding: 10px 10px; }
  .tab svg { display: none; }
  footer { padding: 14px 16px 24px; }
}
