/* ==========================================================================
   NetScope — design system & application styles
   Dark-first · Emerald/sky accent · Inter + JetBrains Mono · 4px rhythm
   ========================================================================== */

/* ---------- Self-hosted variable fonts ---------- */
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url("../fonts/inter-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url("../fonts/inter-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url("../fonts/jetbrains-mono-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url("../fonts/jetbrains-mono-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ---------- Tokens ---------- */
:root {
  --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  --radius-xs: 6px;
  --radius-sm: 9px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 22px;
  --radius-full: 999px;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-7: 28px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;

  --sidebar-w: 264px;
  --topbar-h: 78px;
  --mobile-nav-h: 66px;
  --content-max: 1320px;

  --dur-1: 120ms;
  --dur-2: 200ms;
  --dur-3: 320ms;
  --dur-4: 520ms;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);

  --text-xs: 0.75rem;
  --text-sm: 0.8125rem;
  --text-base: 0.9375rem;
  --text-md: 1rem;
}

:root,
:root[data-theme="dark"] {
  --bg: #06090f;
  --bg-2: #080d15;
  --surface: #0b111b;
  --surface-2: #0e1622;
  --surface-3: #141e2c;
  --surface-glass: rgba(8, 13, 21, 0.76);
  --text: #eaf0f9;
  --text-2: #a9b6c9;
  --text-3: #7f8ea5;
  --border: rgba(151, 168, 192, 0.13);
  --border-strong: rgba(151, 168, 192, 0.24);
  --accent: #4ade80;
  --accent-strong: #86efac;
  --accent-deep: #22c55e;
  --accent-soft: rgba(74, 222, 128, 0.1);
  --accent-soft-2: rgba(74, 222, 128, 0.17);
  --on-accent: #04130a;
  --cyan: #38bdf8;
  --cyan-soft: rgba(56, 189, 248, 0.12);
  --violet: #a78bfa;
  --violet-soft: rgba(167, 139, 250, 0.12);
  --amber: #fbbf24;
  --amber-soft: rgba(251, 191, 36, 0.12);
  --red: #fb7185;
  --red-soft: rgba(251, 113, 133, 0.12);
  --focus: #86efac;
  --shadow-sm: inset 0 1px 0 rgba(255, 255, 255, 0.025), 0 10px 30px -18px rgba(0, 0, 0, 0.9);
  --shadow-md: 0 18px 48px -24px rgba(0, 0, 0, 0.85);
  --shadow-lg: 0 40px 100px -40px rgba(0, 0, 0, 0.95);
  --grid-line: rgba(148, 163, 184, 0.055);
  --scrim: rgba(3, 6, 11, 0.74);
  --orb-a: rgba(34, 197, 94, 0.16);
  --orb-b: rgba(56, 189, 248, 0.12);
  --orb-c: rgba(167, 139, 250, 0.1);
  --card-sheen: linear-gradient(180deg, rgba(255, 255, 255, 0.018), transparent 45%);
  --input-bg: #0a101a;
}

:root[data-theme="light"] {
  --bg: #f3f6fb;
  --bg-2: #eef3f9;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #edf1f7;
  --surface-glass: rgba(255, 255, 255, 0.8);
  --text: #0a1120;
  --text-2: #43536b;
  --text-3: #5e6f89;
  --border: rgba(15, 23, 42, 0.1);
  --border-strong: rgba(15, 23, 42, 0.19);
  --accent: #047857;
  --accent-strong: #065f46;
  --accent-deep: #059669;
  --accent-soft: rgba(5, 150, 105, 0.08);
  --accent-soft-2: rgba(5, 150, 105, 0.14);
  --on-accent: #ffffff;
  --cyan: #0369a1;
  --cyan-soft: rgba(3, 105, 161, 0.08);
  --violet: #6d28d9;
  --violet-soft: rgba(109, 40, 217, 0.08);
  --amber: #b45309;
  --amber-soft: rgba(180, 83, 9, 0.1);
  --red: #be123c;
  --red-soft: rgba(190, 18, 60, 0.08);
  --focus: #047857;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04), 0 12px 32px -22px rgba(15, 23, 42, 0.35);
  --shadow-md: 0 20px 50px -28px rgba(15, 23, 42, 0.3);
  --shadow-lg: 0 40px 100px -40px rgba(15, 23, 42, 0.35);
  --grid-line: rgba(15, 23, 42, 0.045);
  --scrim: rgba(15, 23, 42, 0.42);
  --orb-a: rgba(5, 150, 105, 0.12);
  --orb-b: rgba(3, 105, 161, 0.1);
  --orb-c: rgba(109, 40, 217, 0.08);
  --card-sheen: linear-gradient(180deg, rgba(255, 255, 255, 0.55), transparent 52%);
  --input-bg: #ffffff;
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scrollbar-color: var(--border-strong) transparent;
  scrollbar-width: thin;
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: 1.55;
  letter-spacing: -0.005em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

h1, h2, h3, h4, p, figure, dl, dd {
  margin: 0;
}

h1, h2, h3, h4 {
  line-height: 1.15;
  letter-spacing: -0.02em;
  font-weight: 650;
  text-wrap: balance;
}

ul, ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

img,
svg {
  display: block;
  max-width: 100%;
}

::selection {
  background: var(--accent-soft-2);
  color: var(--text);
}

[hidden] {
  display: none !important;
}

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: 3px;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border: 3px solid transparent;
  border-radius: 999px;
  background-clip: content-box;
}

::-webkit-scrollbar-track {
  background: transparent;
}

/* ---------- Utilities ---------- */
.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.icon {
  width: 18px;
  height: 18px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.mono,
code,
kbd,
pre {
  font-family: var(--font-mono);
  font-variant-ligatures: none;
}

.muted {
  color: var(--text-3);
}

.dot-sep {
  color: var(--text-3);
}

.sep {
  color: var(--text-3);
  padding: 0 2px;
}

.skip-link {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 200;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 650;
  transform: translateY(-160%);
  transition: transform var(--dur-2) var(--ease);
}

.skip-link:focus-visible {
  transform: translateY(0);
  outline-color: var(--text);
}

kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border: 1px solid var(--border);
  border-bottom-color: var(--border-strong);
  border-radius: 5px;
  background: var(--surface-3);
  color: var(--text-3);
  font-size: 10.5px;
  line-height: 1;
  font-weight: 500;
}

/* ---------- Ambient background ---------- */
.ambient {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.ambient .orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.9;
}

.orb-a {
  width: 620px;
  height: 620px;
  top: -280px;
  right: -140px;
  background: radial-gradient(circle, var(--orb-a), transparent 68%);
}

.orb-b {
  width: 540px;
  height: 540px;
  bottom: -240px;
  left: 18%;
  background: radial-gradient(circle, var(--orb-b), transparent 68%);
}

.orb-c {
  width: 420px;
  height: 420px;
  top: 38%;
  right: 20%;
  background: radial-gradient(circle, var(--orb-c), transparent 70%);
}

.grid-plane {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(to right, var(--grid-line) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid-line) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse 90% 70% at 50% 0%, #000 0%, transparent 78%);
  -webkit-mask-image: radial-gradient(ellipse 90% 70% at 50% 0%, #000 0%, transparent 78%);
  opacity: 0.7;
}

/* ---------- App layout ---------- */
.app {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100dvh;
}

.shell {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 100dvh;
}

.sidebar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
  height: 100dvh;
  padding: 20px 16px 18px;
  overflow-y: auto;
  overscroll-behavior: contain;
  border-right: 1px solid var(--border);
  background: var(--surface-glass);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  backdrop-filter: blur(18px) saturate(140%);
}

.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 2px 6px 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
  border-radius: var(--radius-sm);
}

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  box-shadow: 0 0 0 1px var(--border), 0 8px 24px -12px rgba(34, 197, 94, 0.55);
}

.brand-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.2;
}

.brand-name {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.015em;
}

.brand-sub {
  margin-top: 2px;
  color: var(--text-3);
  font-size: 10px;
  font-weight: 550;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  white-space: nowrap;
}

.sidebar .sidebar-close {
  display: none;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-height: 0;
}

.nav-label {
  padding: 0 12px;
  margin-bottom: 8px;
  color: var(--text-3);
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.nav-item {
  position: relative;
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  min-height: 44px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-size: 13.5px;
  font-weight: 550;
  transition: color var(--dur-2) ease, background-color var(--dur-2) ease, box-shadow var(--dur-2) ease;
}

.nav-item .icon {
  width: 18px;
  height: 18px;
  color: var(--text-3);
  transition: color var(--dur-2) ease;
}

.nav-item kbd {
  height: 18px;
  min-width: 18px;
  opacity: 0;
  transition: opacity var(--dur-2) ease;
}

.nav-item:hover {
  background: var(--surface-2);
  color: var(--text);
}

.nav-item:hover .icon {
  color: var(--text-2);
}

.nav-item:hover kbd,
.nav-item[aria-current="page"] kbd {
  opacity: 1;
}

.nav-item[aria-current="page"] {
  background: var(--accent-soft);
  color: var(--text);
  box-shadow: inset 0 0 0 1px var(--accent-soft-2);
}

.nav-item[aria-current="page"] .icon {
  color: var(--accent);
}

.nav-item[aria-current="page"]::before {
  content: "";
  position: absolute;
  left: -1px;
  top: 11px;
  bottom: 11px;
  width: 2px;
  border-radius: 2px;
  background: linear-gradient(180deg, var(--accent), var(--cyan));
}

.sidebar-foot {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin-top: auto;
}

.api-card {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-2);
  text-align: left;
  transition: border-color var(--dur-2) ease, background-color var(--dur-2) ease;
}

.api-card:hover {
  border-color: var(--border-strong);
  background: var(--surface-3);
}

.api-dot {
  width: 8px;
  height: 8px;
  flex: none;
  border-radius: 50%;
  background: var(--text-3);
  box-shadow: 0 0 0 4px transparent;
}

.api-dot.is-online {
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
  animation: pulse-dot 2.4s ease-in-out infinite;
}

.api-dot.is-offline {
  background: var(--amber);
  box-shadow: 0 0 0 4px var(--amber-soft);
}

.api-dot.is-checking {
  background: var(--cyan);
  box-shadow: 0 0 0 4px var(--cyan-soft);
  animation: pulse-dot 1.2s ease-in-out infinite;
}

.api-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.3;
}

.api-title {
  font-size: 11.5px;
  font-weight: 650;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.api-sub {
  margin-top: 1px;
  color: var(--text-3);
  font-size: 10.5px;
}

.api-arrow {
  width: 14px;
  height: 14px;
  margin-left: auto;
  color: var(--text-3);
}

.sidebar-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 6px;
  color: var(--text-3);
  font-size: 11px;
}

.sidebar-meta a {
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: 3px;
  transition: color var(--dur-2) ease, text-decoration-color var(--dur-2) ease;
}

.sidebar-meta a:hover {
  color: var(--text);
  text-decoration-color: currentColor;
}

.sidebar-scrim {
  position: fixed;
  inset: 0;
  z-index: 35;
  background: var(--scrim);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}

/* ---------- Topbar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  min-height: var(--topbar-h);
  padding: 12px clamp(16px, 3vw, 36px);
  border-bottom: 1px solid var(--border);
  background: var(--surface-glass);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  backdrop-filter: blur(18px) saturate(160%);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.topbar .menu-btn {
  display: none;
}

.page-id {
  min-width: 0;
}

.page-eyebrow {
  color: var(--text-3);
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  line-height: 1.3;
}

.page-title {
  margin-top: 2px;
  font-size: 18px;
  font-weight: 650;
  letter-spacing: -0.02em;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.palette-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  min-width: 218px;
  padding: 0 8px 0 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text-3);
  font-size: 12.5px;
  font-weight: 500;
  transition: border-color var(--dur-2) ease, color var(--dur-2) ease, background-color var(--dur-2) ease;
}

.palette-trigger:hover {
  border-color: var(--border-strong);
  background: var(--surface-3);
  color: var(--text-2);
}

.palette-trigger .icon {
  width: 15px;
  height: 15px;
}

.palette-trigger-text {
  flex: 1;
  text-align: left;
}

.palette-trigger-kbd {
  min-width: 32px;
  height: 22px;
  background: var(--surface);
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-2);
  transition: background-color var(--dur-2) ease, color var(--dur-2) ease, border-color var(--dur-2) ease;
}

.icon-btn:hover {
  background: var(--surface-3);
  color: var(--text);
}

.icon-btn:active {
  background: var(--surface-3);
}

.icon-btn .icon {
  width: 17px;
  height: 17px;
}

#theme-toggle .icon-sun,
#theme-toggle .icon-moon {
  width: 18px;
  height: 18px;
}

:root[data-theme="dark"] #theme-toggle .icon-moon,
:root[data-theme="light"] #theme-toggle .icon-sun {
  display: none;
}

/* ---------- Main / views ---------- */
.main {
  flex: 1;
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: clamp(22px, 3.2vw, 40px) clamp(16px, 3vw, 36px) 56px;
}

.main:focus {
  outline: none;
}

.view {
  animation: view-in var(--dur-4) var(--ease) both;
}

.view-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-6);
  margin-bottom: var(--space-7);
}

.view-head-copy {
  min-width: 0;
  max-width: 68ch;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 9px;
  color: var(--text-3);
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
  animation: pulse-dot 2.4s ease-in-out infinite;
}

.view-head h2 {
  font-size: clamp(1.55rem, 2.5vw, 2.15rem);
  font-weight: 660;
  letter-spacing: -0.035em;
}

.lede {
  margin-top: 8px;
  max-width: 64ch;
  color: var(--text-2);
  font-size: 14px;
  line-height: 1.6;
}

.view-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
}

/* ---------- Cards / bento ---------- */
.bento {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: var(--space-4);
}

.span-3 { grid-column: span 3; }
.span-4 { grid-column: span 4; }
.span-5 { grid-column: span 5; }
.span-6 { grid-column: span 6; }
.span-7 { grid-column: span 7; }
.span-8 { grid-column: span 8; }
.span-9 { grid-column: span 9; }
.span-12 { grid-column: span 12; }

.card {
  position: relative;
  min-width: 0;
  padding: clamp(16px, 2vw, 22px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background-color: var(--surface);
  background-image: var(--card-sheen);
  box-shadow: var(--shadow-sm);
  animation: rise var(--dur-4) var(--ease) both;
}

.bento > .card:nth-child(2) { animation-delay: 45ms; }
.bento > .card:nth-child(3) { animation-delay: 90ms; }
.bento > .card:nth-child(4) { animation-delay: 135ms; }
.bento > .card:nth-child(5) { animation-delay: 180ms; }
.bento > .card:nth-child(6) { animation-delay: 225ms; }
.bento > .card:nth-child(7) { animation-delay: 270ms; }

.card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.card-kicker {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--text-3);
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.card-tools {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: none;
}

.card h3 {
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -0.015em;
}

.card-head {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  margin-bottom: 4px;
}

.card-head h3 {
  font-size: 14.5px;
}

.card-head p {
  margin-top: 2px;
  color: var(--text-3);
  font-size: 11.5px;
  line-height: 1.45;
}

.card-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-2);
  color: var(--accent);
}

.card-icon .icon {
  width: 18px;
  height: 18px;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 44px;
  padding: 0 15px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.005em;
  white-space: nowrap;
  transition: background-color var(--dur-2) ease, border-color var(--dur-2) ease, color var(--dur-2) ease, filter var(--dur-2) ease, transform var(--dur-1) ease;
}

.btn .icon {
  width: 16px;
  height: 16px;
}

.btn:active {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  background: linear-gradient(180deg, var(--accent-strong), var(--accent));
  color: var(--on-accent);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 10px 24px -14px var(--accent);
}

.btn-primary:hover {
  filter: brightness(1.055);
}

:root[data-theme="light"] .btn-primary {
  background: linear-gradient(180deg, var(--accent-deep), var(--accent));
  box-shadow: 0 10px 24px -16px rgba(4, 120, 87, 0.65);
}

.btn-secondary {
  border-color: var(--border);
  background: var(--surface-3);
  color: var(--text);
}

.btn-secondary:hover {
  border-color: var(--border-strong);
  background: var(--surface-2);
}

.btn-ghost {
  border-color: var(--border);
  background: transparent;
  color: var(--text-2);
}

.btn-ghost:hover {
  border-color: var(--border-strong);
  background: var(--surface-2);
  color: var(--text);
}

.btn-small {
  min-height: 32px;
  padding: 0 10px;
  border-radius: var(--radius-xs);
  font-size: 12px;
  gap: 5px;
}

.btn-small .icon {
  width: 14px;
  height: 14px;
}

.btn.is-loading .icon {
  animation: spin 0.9s linear infinite;
}

/* ---------- Forms ---------- */
.field,
.field-grow,
.field-port {
  min-width: 0;
}

.field-grow {
  flex: 1 1 260px;
}

.field-port {
  width: 88px;
  flex: none;
}

.label {
  display: block;
  margin-bottom: 6px;
  color: var(--text-2);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.hint {
  margin-top: 6px;
  color: var(--text-3);
  font-size: 11.5px;
  line-height: 1.5;
}

.hint code {
  padding: 1px 4px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 10.5px;
}

.input {
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--input-bg);
  color: var(--text);
  font-size: 13.5px;
  transition: border-color var(--dur-2) ease, box-shadow var(--dur-2) ease, background-color var(--dur-2) ease;
}

.input.mono {
  font-size: 13px;
  letter-spacing: -0.01em;
}

.input:hover {
  border-color: var(--border-strong);
}

.input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.input::placeholder {
  color: var(--text-3);
  opacity: 0.78;
}

.input[aria-invalid="true"] {
  border-color: var(--red);
  box-shadow: 0 0 0 3px var(--red-soft);
}

.input-shell {
  position: relative;
}

.input-icon {
  position: absolute;
  left: 13px;
  top: 50%;
  width: 16px;
  height: 16px;
  transform: translateY(-50%);
  color: var(--text-3);
  pointer-events: none;
}

.input-shell .input {
  padding-left: 39px;
  padding-right: 42px;
}

.input-clear {
  position: absolute;
  right: 5px;
  top: 50%;
  width: 32px;
  height: 32px;
  transform: translateY(-50%);
  border-radius: var(--radius-xs);
}

.input-clear .icon {
  width: 14px;
  height: 14px;
}

.select-shell {
  position: relative;
}

.select-shell select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 36px;
  cursor: pointer;
}

.select-chevron {
  position: absolute;
  right: 12px;
  top: 50%;
  width: 15px;
  height: 15px;
  transform: translateY(-50%);
  color: var(--text-3);
  pointer-events: none;
}

.inline-form {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.inline-form .field-grow {
  flex: 1 1 180px;
}

/* ---------- Query bars ---------- */
.query-bar {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: 16px;
  margin-bottom: var(--space-4);
}

.query-bar .field-grow {
  flex: 1 1 320px;
}

.query-bar .field {
  flex: 0 0 208px;
}

.query-bar-dns {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 208px auto;
  align-items: start;
  gap: var(--space-3);
}

.query-bar-dns .field-grow {
  grid-column: 1;
}

.query-bar-dns .field {
  grid-column: 2;
  width: auto;
}

.query-bar-dns .query-actions {
  grid-column: 3;
}

.query-bar-dns .record-chips {
  grid-column: 1 / -1;
  grid-row: 2;
  margin-top: 0;
}

.record-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  flex: 1 0 100%;
  border: 0;
  padding: 0;
  margin: 2px 0 0;
}

.record-chips input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.record-chips label {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  background: var(--surface-2);
  color: var(--text-2);
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color var(--dur-2) ease, border-color var(--dur-2) ease, color var(--dur-2) ease;
}

.record-chips label:hover {
  border-color: var(--border-strong);
  color: var(--text);
}

.record-chips input:checked + label {
  border-color: var(--accent-soft-2);
  background: var(--accent-soft);
  color: var(--accent);
}

.record-chips input:focus-visible + label {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.query-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
  margin-top: 25px;
}

/* ---------- Badges / links ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 22px;
  padding: 0 8px;
  border: 1px solid transparent;
  border-radius: var(--radius-full);
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.badge::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.9;
}

.badge-no-dot::before {
  display: none;
}

.badge-good {
  border-color: transparent;
  background: var(--accent-soft);
  color: var(--accent);
}

.badge-warn {
  background: var(--amber-soft);
  color: var(--amber);
}

.badge-bad {
  background: var(--red-soft);
  color: var(--red);
}

.badge-info {
  background: var(--cyan-soft);
  color: var(--cyan);
}

.badge-neutral {
  background: var(--surface-3);
  color: var(--text-2);
}

.text-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 28px;
  padding: 2px 4px;
  margin: -2px -4px;
  border: 0;
  background: none;
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: 3px;
  transition: text-decoration-color var(--dur-2) ease;
}

.text-link:hover {
  text-decoration-color: currentColor;
}

.text-link .icon {
  width: 13px;
  height: 13px;
}

.link-btn {
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent);
  font-size: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: var(--accent-soft-2);
  text-underline-offset: 2px;
  transition: text-decoration-color var(--dur-2) ease;
}

.link-btn:hover {
  text-decoration-color: currentColor;
}

/* ---------- Overview: IP hero ---------- */
.ip-card {
  overflow: hidden;
  background-image:
    radial-gradient(120% 150% at 100% 0%, var(--accent-soft), transparent 52%),
    radial-gradient(90% 120% at 0% 100%, var(--cyan-soft), transparent 58%),
    var(--card-sheen);
}

.ip-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(var(--border-strong) 0.7px, transparent 0.7px);
  background-size: 18px 18px;
  opacity: 0.28;
  mask-image: radial-gradient(80% 90% at 82% 8%, #000, transparent 68%);
  -webkit-mask-image: radial-gradient(80% 90% at 82% 8%, #000, transparent 68%);
  pointer-events: none;
}

.ip-card > * {
  position: relative;
}

.ip-value {
  margin: 2px 0 10px;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: clamp(1.18rem, 2.7vw, 1.95rem);
  font-weight: 500;
  letter-spacing: -0.035em;
  line-height: 1.22;
  overflow-wrap: anywhere;
}

.ip-value.is-v4 {
  font-size: clamp(1.85rem, 4vw, 2.85rem);
  letter-spacing: -0.045em;
}

@supports ((-webkit-background-clip: text) or (background-clip: text)) {
  .ip-value {
    background: linear-gradient(96deg, var(--text) 6%, var(--text) 34%, var(--accent) 82%, var(--cyan) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    -webkit-text-fill-color: transparent;
  }
}

.ip-sub {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  color: var(--text-2);
  font-size: 13px;
}

.flag {
  width: 20px;
  height: 14px;
  border-radius: 2px;
  object-fit: cover;
  box-shadow: 0 0 0 1px var(--border);
}

.ip-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 16px 0 18px;
}

.ip-facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  padding-top: 16px;
  border-top: 1px dashed var(--border);
}

.ip-facts dt,
.mini-facts dt {
  color: var(--text-3);
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.ip-facts dd,
.mini-facts dd {
  margin-top: 3px;
  color: var(--text-2);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.ip-facts dd.mono,
.mini-facts dd.mono {
  color: var(--text);
  font-size: 11.5px;
}

/* ---------- Facts / metrics ---------- */
.fact-list {
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.fact-list > div {
  display: grid;
  grid-template-columns: minmax(88px, 0.72fr) minmax(0, 1.28fr);
  align-items: baseline;
  gap: 12px;
  padding-bottom: 11px;
  border-bottom: 1px dashed var(--border);
}

.fact-list > div:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.fact-list dt {
  color: var(--text-3);
  font-size: 11px;
  font-weight: 550;
}

.fact-list dd {
  color: var(--text);
  font-size: 12.5px;
  font-weight: 500;
  overflow-wrap: anywhere;
}

.fact-list dd.mono {
  font-size: 11.5px;
}

.metric-card {
  display: flex;
  flex-direction: column;
}

.metric-value {
  display: flex;
  align-items: baseline;
  gap: 5px;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: clamp(1.8rem, 3vw, 2.35rem);
  font-weight: 500;
  letter-spacing: -0.045em;
  line-height: 1.15;
}

.metric-unit {
  color: var(--text-3);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0;
}

.metric-value-sm {
  color: var(--text);
  font-size: 19px;
  font-weight: 650;
  letter-spacing: -0.025em;
  line-height: 1.2;
}

.metric-sub {
  margin-top: 5px;
  color: var(--text-3);
  font-size: 11.5px;
  line-height: 1.5;
}

.sparkline {
  margin-top: auto;
  padding-top: 14px;
}

.sparkline svg {
  width: 100%;
  height: 38px;
  overflow: visible;
}

.sparkline .spark-line {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sparkline .spark-area {
  fill: url(#spark-gradient);
  opacity: 0.35;
}

.meter {
  height: 5px;
  margin-top: 12px;
  border-radius: var(--radius-full);
  background: var(--surface-3);
  overflow: hidden;
}

.meter > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--cyan));
  transition: width var(--dur-4) var(--ease);
}

.location-row {
  display: flex;
  align-items: center;
  gap: 11px;
  margin: 2px 0 14px;
}

.location-row .flag {
  width: 30px;
  height: 21px;
  border-radius: 3px;
}

.location-row .metric-sub {
  margin-top: 1px;
}

.mini-facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
}

.mini-facts .text-link {
  margin-top: 12px;
}

.clock-value {
  font-size: clamp(2rem, 4vw, 2.8rem);
  letter-spacing: -0.05em;
  font-variant-numeric: tabular-nums;
}

.clock-date {
  margin-top: 3px;
  color: var(--text-2);
  font-size: 12px;
}

.day-track {
  display: flex;
  gap: 3px;
  margin-top: auto;
  padding-top: 16px;
}

.day-track span {
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: var(--surface-3);
}

.day-track span.is-past {
  background: var(--accent-soft-2);
}

.day-track span.is-now {
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
}

/* ---------- History / lists ---------- */
.history-list {
  display: flex;
  flex-direction: column;
}

.history-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: 8px 0;
  border-bottom: 1px dashed var(--border);
}

.history-list li:last-child {
  border-bottom: 0;
}

.history-dot {
  width: 7px;
  height: 7px;
  flex: none;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.history-copy {
  min-width: 0;
  flex: 1;
}

.history-ip {
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 11.5px;
  overflow-wrap: anywhere;
}

.history-meta {
  margin-top: 1px;
  color: var(--text-3);
  font-size: 10.5px;
}

.history-time {
  flex: none;
  color: var(--text-3);
  font-size: 10.5px;
  white-space: nowrap;
}

.check-list {
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin-top: 14px;
}

.check-list li {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  color: var(--text-2);
  font-size: 12px;
  line-height: 1.5;
}

.check-list .icon {
  width: 14px;
  height: 14px;
  margin-top: 2px;
  color: var(--accent);
}

.privacy-card {
  background-image:
    radial-gradient(120% 130% at 100% 0%, var(--violet-soft), transparent 60%),
    var(--card-sheen);
}

/* ---------- Empty & skeleton states ---------- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: clamp(32px, 6vw, 64px) 24px;
  text-align: center;
}

.empty-icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  margin-bottom: 4px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface-2);
  color: var(--accent);
}

.empty-icon .icon {
  width: 23px;
  height: 23px;
}

.empty-state h3 {
  font-size: 15.5px;
}

.empty-state p {
  max-width: 48ch;
  color: var(--text-2);
  font-size: 12.5px;
}

.empty-state .link-btn {
  font-family: var(--font-mono);
  font-size: 12px;
}

.placeholder-note {
  padding: 14px 0 4px;
  color: var(--text-3);
  font-size: 12px;
  line-height: 1.55;
}

.skeleton-card {
  min-height: 150px;
  pointer-events: none;
}

.sk {
  display: block;
  height: 12px;
  margin-bottom: 10px;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--surface-3) 20%, var(--surface-2) 45%, var(--surface-3) 70%);
  background-size: 220% 100%;
  animation: shimmer 1.5s linear infinite;
}

.sk.tall {
  height: 34px;
  margin: 14px 0;
}

.w-30 { width: 30%; }
.w-40 { width: 40%; }
.w-45 { width: 45%; }
.w-50 { width: 50%; }
.w-60 { width: 60%; }
.w-70 { width: 70%; }
.w-80 { width: 80%; }

/* ---------- Results ---------- */
.stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.result-hero {
  overflow: hidden;
  background-image:
    radial-gradient(100% 150% at 100% 0%, var(--accent-soft), transparent 55%),
    var(--card-sheen);
}

.result-value {
  margin: 0 0 6px;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: clamp(1.45rem, 3.2vw, 2.2rem);
  font-weight: 500;
  letter-spacing: -0.04em;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.result-title {
  font-size: clamp(1.2rem, 2.2vw, 1.5rem);
  font-weight: 650;
  letter-spacing: -0.03em;
  overflow-wrap: anywhere;
}

.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 16px;
}

.dns-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  margin: 10px 0 14px;
  color: var(--text-3);
  font-size: 11px;
}

.dns-meta span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.dns-meta span::before {
  content: "";
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--border-strong);
}

.kv {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px 20px;
}

.kv > div {
  min-width: 0;
}

.kv .span-all {
  grid-column: 1 / -1;
}

.kv dt {
  margin-bottom: 3px;
  color: var(--text-3);
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.kv dd {
  margin: 0;
  color: var(--text);
  font-size: 12.5px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.kv dd.mono {
  font-size: 11.5px;
}

.kv dd .badge {
  margin-right: 3px;
  margin-bottom: 3px;
}

.meta-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.meta-chips span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 24px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 10.5px;
}

.meta-chips span.mono {
  color: var(--text);
  font-size: 10px;
}

/* ---------- Tables / code ---------- */
.table-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow-x: auto;
  background: var(--surface-2);
}

.table-wrap:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

table.data {
  width: 100%;
  min-width: 560px;
  border-collapse: collapse;
  font-size: 12px;
}

table.data th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 9px 13px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-3);
  color: var(--text-3);
  font-size: 9.5px;
  font-weight: 650;
  letter-spacing: 0.1em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}

table.data td {
  padding: 10px 13px;
  border-bottom: 1px solid var(--border);
  color: var(--text-2);
  vertical-align: top;
  line-height: 1.5;
}

table.data tr:last-child td {
  border-bottom: 0;
}

table.data tbody tr:hover td {
  background: var(--surface-3);
}

table.data td.mono,
table.data .cell-value {
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 11px;
  overflow-wrap: anywhere;
}

table.data td.cell-type {
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  white-space: nowrap;
}

table.data.compact {
  min-width: 0;
  font-size: 11.5px;
}

table.data.compact th,
table.data.compact td {
  padding: 8px 11px;
}

.code-panel,
.code-block {
  position: relative;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--input-bg);
  color: var(--text-2);
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.65;
  overflow-x: auto;
  white-space: pre;
}

.code-block {
  margin-top: 12px;
  padding-right: 44px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.code-copy {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 30px;
  height: 30px;
  background: var(--surface-2);
  border-color: var(--border);
}

.raw {
  margin-top: 14px;
  border-top: 1px dashed var(--border);
  padding-top: 12px;
}

.raw summary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-3);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  transition: color var(--dur-2) ease;
}

.raw summary::-webkit-details-marker {
  display: none;
}

.raw summary::before {
  content: "";
  width: 0;
  height: 0;
  border-left: 4px solid currentColor;
  border-top: 3.5px solid transparent;
  border-bottom: 3.5px solid transparent;
  transition: transform var(--dur-2) ease;
}

.raw[open] summary::before {
  transform: rotate(90deg);
}

.raw summary:hover {
  color: var(--text);
}

.raw .code-panel {
  margin-top: 10px;
  max-height: 260px;
  overflow: auto;
}

/* ---------- Progress / score / audit ---------- */
.bar {
  height: 6px;
  border-radius: var(--radius-full);
  background: var(--surface-3);
  overflow: hidden;
}

.bar > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--cyan));
  transition: width var(--dur-4) var(--ease);
}

.score-wrap {
  display: flex;
  align-items: center;
  gap: 18px;
  margin: 4px 0 18px;
}

.score-ring {
  position: relative;
  display: grid;
  place-items: center;
  width: 92px;
  height: 92px;
  flex: none;
  border-radius: 50%;
  background: conic-gradient(var(--ring-color, var(--accent)) calc(var(--score, 0) * 1%), var(--surface-3) 0);
}

.score-ring::before {
  content: "";
  position: absolute;
  inset: 7px;
  border-radius: 50%;
  background: var(--surface);
}

.score-ring > span {
  position: relative;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 24px;
  font-weight: 500;
  letter-spacing: -0.04em;
}

.score-ring > span small {
  color: var(--text-3);
  font-family: var(--font-sans);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.audit-grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.audit-row {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.audit-icon {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  font-size: 0;
}

.audit-icon .icon {
  width: 13px;
  height: 13px;
}

.audit-row.is-pass .audit-icon {
  background: var(--accent-soft);
  color: var(--accent);
}

.audit-row.is-fail .audit-icon {
  background: var(--red-soft);
  color: var(--red);
}

.audit-row.is-warn .audit-icon {
  background: var(--amber-soft);
  color: var(--amber);
}

.audit-name {
  color: var(--text);
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.35;
}

.audit-detail {
  margin-top: 1px;
  color: var(--text-3);
  font-size: 10.5px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.audit-row .badge {
  min-height: 20px;
  font-size: 9.5px;
}

.cert-validity {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px dashed var(--border);
}

.cert-validity p {
  margin-top: 7px;
  color: var(--text-3);
  font-size: 11px;
}

.chain {
  display: flex;
  flex-direction: column;
  margin-top: 10px;
}

.chain-step {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 0 8px 16px;
}

.chain-step::before {
  content: "";
  position: absolute;
  left: 3px;
  top: 15px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.chain-step::after {
  content: "";
  position: absolute;
  left: 5.5px;
  top: 24px;
  bottom: -3px;
  width: 1px;
  background: var(--border);
}

.chain-step:last-child::after {
  display: none;
}

.chain-url {
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 10.5px;
  overflow-wrap: anywhere;
}

.chain-meta {
  margin-top: 1px;
  color: var(--text-3);
  font-size: 10px;
}

/* ---------- Notices / errors ---------- */
.notice {
  display: flex;
  gap: 12px;
  margin-bottom: var(--space-4);
  padding: 14px 16px;
  border: 1px solid var(--amber-soft);
  border-radius: var(--radius-md);
  background: var(--amber-soft);
}

.notice-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: none;
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--amber);
}

.notice-icon .icon {
  width: 17px;
  height: 17px;
}

.notice-copy {
  min-width: 0;
}

.notice-copy strong {
  display: block;
  color: var(--text);
  font-size: 12.5px;
  font-weight: 650;
}

.notice-copy p {
  margin-top: 3px;
  color: var(--text-2);
  font-size: 11.5px;
  line-height: 1.55;
}

.notice-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 9px;
}

.error-card {
  display: flex;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--red-soft);
  border-radius: var(--radius-md);
  background: var(--red-soft);
}

.error-card .empty-icon {
  width: 40px;
  height: 40px;
  margin: 0;
  border-color: transparent;
  background: var(--surface);
  color: var(--red);
}

.error-card h3 {
  font-size: 13.5px;
}

.error-card p {
  margin-top: 2px;
  color: var(--text-2);
  font-size: 11.5px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.error-code {
  margin-top: 6px;
  color: var(--text-3);
  font-family: var(--font-mono);
  font-size: 10px;
}

/* ---------- Tools ---------- */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-4);
}

.tool-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: border-color var(--dur-2) ease, box-shadow var(--dur-2) ease;
}

.tool-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
}

.tool-card:nth-child(2) .card-icon { color: var(--cyan); background: var(--cyan-soft); }
.tool-card:nth-child(3) .card-icon { color: var(--violet); background: var(--violet-soft); }
.tool-card:nth-child(4) .card-icon { color: var(--accent); }
.tool-card:nth-child(5) .card-icon { color: var(--violet); background: var(--violet-soft); }
.tool-card:nth-child(6) .card-icon { color: var(--cyan); background: var(--cyan-soft); }

.tool-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.muted-note {
  color: var(--text-3);
  font-size: 10.5px;
}

.tool-output {
  flex: 1;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
  font-size: 12px;
}

.tool-output .kv {
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px 16px;
}

.tool-output h4 {
  margin: 14px 0 7px;
  color: var(--text-3);
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.tool-output .code-panel {
  margin-top: 8px;
  max-height: 180px;
}

.latency-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.latency-row {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr) 66px;
  align-items: center;
  gap: 10px;
}

.latency-name {
  color: var(--text-2);
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.latency-track {
  height: 5px;
  border-radius: var(--radius-full);
  background: var(--surface-3);
  overflow: hidden;
}

.latency-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--cyan));
  transition: width var(--dur-4) var(--ease);
}

.latency-row.is-slow .latency-track span {
  background: linear-gradient(90deg, var(--amber), var(--red));
}

.latency-ms {
  color: var(--text);
  font-size: 11px;
  text-align: right;
  white-space: nowrap;
}

.result-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  font-size: 12px;
}

.result-pill .icon {
  width: 15px;
  height: 15px;
}

.result-pill.is-good {
  border-color: var(--accent-soft-2);
  background: var(--accent-soft);
  color: var(--accent);
}

.result-pill.is-bad {
  border-color: var(--red-soft);
  background: var(--red-soft);
  color: var(--red);
}

/* ---------- Browser view ---------- */
.env-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: var(--space-4);
}

.env-card .card-top {
  margin-bottom: 14px;
}

.env-list {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.env-list > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  padding-bottom: 8px;
  border-bottom: 1px dashed var(--border);
}

.env-list > div:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.env-list dt {
  flex: none;
  color: var(--text-3);
  font-size: 11px;
}

.env-list dd {
  margin: 0;
  color: var(--text);
  font-size: 11.5px;
  font-weight: 500;
  text-align: right;
  overflow-wrap: anywhere;
}

.env-list dd.mono {
  font-size: 10.5px;
}

/* ---------- Mobile bottom nav ---------- */
.mobile-nav {
  transition: opacity var(--dur-2) ease, transform var(--dur-2) ease, visibility var(--dur-2) ease;
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: max(10px, env(safe-area-inset-bottom));
  z-index: 45;
  display: none;
  align-items: stretch;
  gap: 2px;
  padding: 5px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface-glass);
  box-shadow: var(--shadow-lg);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  backdrop-filter: blur(20px) saturate(160%);
}

.mobile-nav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  flex: 1;
  min-height: 48px;
  border-radius: 11px;
  color: var(--text-3);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  transition: color var(--dur-2) ease, background-color var(--dur-2) ease;
}

.mobile-nav a .icon {
  width: 19px;
  height: 19px;
}

.mobile-nav a[aria-current="page"] {
  background: var(--accent-soft);
  color: var(--accent);
}

body.drawer-open .mobile-nav {
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  pointer-events: none;
}

/* ---------- Footer ---------- */
.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: var(--space-10);
  padding-top: var(--space-5);
  border-top: 1px solid var(--border);
  color: var(--text-3);
  font-size: 11px;
}

.footer-links {
  display: flex;
  align-items: center;
  gap: 7px;
}

.footer-links .link-btn,
.footer-links a {
  color: var(--text-3);
  font-size: 11px;
  font-weight: 500;
  text-decoration: none;
  transition: color var(--dur-2) ease;
}

.footer-links .link-btn:hover,
.footer-links a:hover {
  color: var(--text);
}

/* ---------- Dialog base ---------- */
dialog {
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-lg);
}

dialog::backdrop {
  background: var(--scrim);
  -webkit-backdrop-filter: blur(5px);
  backdrop-filter: blur(5px);
}

dialog[open] {
  animation: dialog-in var(--dur-3) var(--ease) both;
}

/* ---------- Command palette ---------- */
.palette {
  position: fixed;
  top: 13vh;
  left: 50%;
  width: min(620px, calc(100vw - 28px));
  max-height: min(600px, 72vh);
  margin: 0;
  transform: translateX(-50%);
  overflow: hidden;
  border-radius: var(--radius-lg);
}

.palette[open] {
  display: flex;
  flex-direction: column;
}

.palette-search {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 15px;
  border-bottom: 1px solid var(--border);
  flex: none;
}

.palette-search .icon {
  width: 17px;
  height: 17px;
  color: var(--text-3);
}

.palette-search input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 14.5px;
  font-weight: 450;
  outline: none;
}

.palette-search input::placeholder {
  color: var(--text-3);
}

.palette-search kbd {
  height: 22px;
  padding: 0 6px;
  font-size: 10px;
}

.palette-body {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 8px;
  overflow-y: auto;
}

.palette-label {
  padding: 7px 10px 5px;
  color: var(--text-3);
  font-size: 9.5px;
  font-weight: 650;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.palette-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.palette-item {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  min-height: 44px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-2);
  text-align: left;
  transition: background-color var(--dur-1) ease, color var(--dur-1) ease;
}

.palette-item:hover {
  background: var(--surface-2);
  color: var(--text);
}

.palette-item[aria-selected="true"] {
  border-color: var(--accent-soft-2);
  background: var(--accent-soft);
  color: var(--text);
}

.palette-item .icon {
  width: 17px;
  height: 17px;
  color: var(--text-3);
}

.palette-item[aria-selected="true"] .icon {
  color: var(--accent);
}

.palette-item-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
  line-height: 1.3;
}

.palette-item-title {
  font-size: 12.5px;
  font-weight: 600;
}

.palette-item-desc {
  color: var(--text-3);
  font-size: 10.5px;
}

.palette-item-kbd {
  flex: none;
  font-size: 9.5px;
}

.palette-empty {
  padding: 26px 12px;
  color: var(--text-3);
  font-size: 12px;
  text-align: center;
}

.palette-foot {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 9px 14px;
  border-top: 1px solid var(--border);
  color: var(--text-3);
  font-size: 10px;
  flex: none;
}

.palette-foot span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.palette-foot kbd {
  min-width: 17px;
  height: 17px;
  font-size: 9px;
}

.palette-foot-brand {
  margin-left: auto;
  color: var(--text-3);
  font-weight: 600;
  letter-spacing: 0.04em;
}

/* ---------- Settings modal ---------- */
.modal {
  width: min(680px, calc(100vw - 24px));
  max-height: min(88vh, 820px);
  margin: auto;
}

.modal[open] {
  display: flex;
  flex-direction: column;
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 22px 16px;
  border-bottom: 1px solid var(--border);
  flex: none;
}

.modal-head h2 {
  font-size: 20px;
  letter-spacing: -0.025em;
}

.modal-body {
  padding: 6px 22px 10px;
  overflow-y: auto;
}

.setting-group {
  padding: 18px 0;
  border-bottom: 1px solid var(--border);
}

.setting-group:last-child {
  border-bottom: 0;
}

.setting-group h3 {
  margin-bottom: 10px;
  color: var(--text);
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.segmented {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.segmented label {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.segmented input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.segmented span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 68px;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 7px;
  color: var(--text-3);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color var(--dur-2) ease, color var(--dur-2) ease, box-shadow var(--dur-2) ease;
}

.segmented input:checked + span {
  background: var(--accent-soft-2);
  color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent-soft-2);
}

.segmented input:focus-visible + span {
  outline: 2px solid var(--focus);
  outline-offset: 1px;
}

.switch-row,
.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 9px 0;
}

.switch-row {
  cursor: pointer;
}

.switch-title {
  display: block;
  color: var(--text);
  font-size: 12.5px;
  font-weight: 550;
}

.switch-row .hint,
.setting-row .hint {
  display: block;
  margin-top: 2px;
}

.switch-row input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.switch {
  position: relative;
  width: 42px;
  height: 24px;
  flex: none;
  border-radius: var(--radius-full);
  background: var(--surface-3);
  box-shadow: inset 0 0 0 1px var(--border);
  transition: background-color var(--dur-2) ease;
}

.switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--text-3);
  transition: transform var(--dur-2) var(--ease), background-color var(--dur-2) ease;
}

.switch-row input:checked + .switch {
  background: var(--accent-soft-2);
  box-shadow: inset 0 0 0 1px var(--accent-soft-2);
}

.switch-row input:checked + .switch::after {
  transform: translateX(18px);
  background: var(--accent);
}

.switch-row input:focus-visible + .switch {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.api-test-result {
  min-height: 18px;
  margin-top: 6px;
  font-size: 11px;
  color: var(--text-3);
}

.api-test-result.is-good {
  color: var(--accent);
}

.api-test-result.is-bad {
  color: var(--red);
}

.shortcut-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.shortcut-list > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.shortcut-list dt {
  display: flex;
  align-items: center;
  gap: 3px;
  color: var(--text-2);
  font-size: 11px;
}

.shortcut-list dd {
  color: var(--text-3);
  font-size: 11px;
  text-align: right;
}

.source-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 10px;
}

.source-list li {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  color: var(--text-2);
  font-size: 11.5px;
}

.source-list li > span:first-child {
  min-width: 150px;
  color: var(--text-3);
}

.source-list a {
  color: var(--accent);
  font-size: 10.5px;
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: 2px;
}

.source-list a:hover {
  text-decoration-color: currentColor;
}

.modal-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 22px;
  border-top: 1px solid var(--border);
  flex: none;
}

.modal-foot-meta {
  color: var(--text-3);
  font-size: 10.5px;
}

/* ---------- Toasts ---------- */
.toast-stack {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 120;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(360px, calc(100vw - 28px));
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 11px 13px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  color: var(--text);
  font-size: 12px;
  line-height: 1.45;
  pointer-events: auto;
  animation: toast-in var(--dur-3) var(--ease) both;
}

.toast .icon {
  width: 16px;
  height: 16px;
  margin-top: 1px;
  flex: none;
}

.toast.is-good .icon { color: var(--accent); }
.toast.is-bad .icon { color: var(--red); }
.toast.is-info .icon { color: var(--cyan); }
.toast.is-warn .icon { color: var(--amber); }

.toast.is-leaving {
  animation: toast-out var(--dur-2) ease forwards;
}

/* ---------- Copy feedback ---------- */
.is-copied {
  color: var(--accent) !important;
}

/* ---------- Noscript ---------- */
.noscript {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 300;
  width: min(520px, calc(100vw - 32px));
  padding: 16px 18px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  transform: translateX(-50%);
}

.noscript strong {
  font-size: 13px;
}

.noscript p {
  margin-top: 4px;
  color: var(--text-2);
  font-size: 12px;
}

/* ---------- Sidebar rail (tablet) ---------- */
@media (max-width: 1100px) and (min-width: 961px) {
  :root {
    --sidebar-w: 82px;
  }

  .sidebar {
    align-items: center;
    padding: 18px 10px;
    gap: 18px;
  }

  .sidebar-head {
    padding: 0;
  }

  .brand-text,
  .nav-label,
  .nav-item kbd,
  .api-copy,
  .api-arrow,
  .sidebar-meta {
    display: none;
  }

  .nav {
    width: 100%;
    align-items: center;
    gap: 6px;
  }

  .nav-item {
    grid-template-columns: 1fr;
    place-items: center;
    width: 46px;
    height: 46px;
    min-height: 46px;
    padding: 0;
  }

  .nav-item span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
  }

  .nav-item .icon {
    width: 20px;
    height: 20px;
  }

  .sidebar-foot {
    width: 100%;
    align-items: center;
  }

  .api-card {
    justify-content: center;
    width: 46px;
    height: 46px;
    padding: 0;
  }

  .api-dot {
    width: 9px;
    height: 9px;
  }
}

/* ---------- Tablet / drawer ---------- */
@media (max-width: 1024px) {
  .span-8,
  .span-7,
  .span-9 {
    grid-column: span 12;
  }

  .span-4,
  .span-5,
  .span-6 {
    grid-column: span 6;
  }

  .view-head {
    align-items: flex-start;
  }
}

@media (max-width: 960px) {
  .app {
    grid-template-columns: minmax(0, 1fr);
  }

  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 60;
    width: 286px;
    height: 100dvh;
    padding: 20px 16px 24px;
    transform: translateX(-104%);
    transition: transform var(--dur-3) var(--ease);
    box-shadow: var(--shadow-lg);
  }

  .sidebar.is-open {
    transform: translateX(0);
  }

  .sidebar .sidebar-close {
    display: inline-grid;
  }

  .topbar .menu-btn {
    display: inline-grid;
  }

  .topbar {
    min-height: 68px;
  }

  .span-4,
  .span-5,
  .span-6 {
    grid-column: span 12;
  }

  .view-head {
    flex-direction: column;
    gap: 14px;
  }

  .view-actions {
    width: 100%;
  }
}

/* Tablet: keep two card columns while the sidebar is a drawer */
@media (min-width: 721px) and (max-width: 960px) {
  .span-4,
  .span-5,
  .span-6 {
    grid-column: span 6;
  }

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

/* ---------- Mobile ---------- */
@media (max-width: 720px) {
  :root {
    --topbar-h: 64px;
  }

  body {
    font-size: 14.5px;
  }

  .sidebar {
    width: min(300px, 86vw);
  }

  .topbar {
    padding: 10px 14px;
    gap: 8px;
  }

  .page-eyebrow {
    display: none;
  }

  .page-title {
    font-size: 16px;
  }

  .palette-trigger {
    min-width: 44px;
    width: 44px;
    height: 44px;
    padding: 0;
    justify-content: center;
    border-color: transparent;
    background: transparent;
  }

  .palette-trigger:hover {
    background: var(--surface-3);
  }

  .palette-trigger-text,
  .palette-trigger-kbd {
    display: none;
  }

  .main {
    padding: 20px 14px calc(var(--mobile-nav-h) + 30px);
  }

  .mobile-nav {
    display: flex;
  }

  .view-head {
    margin-bottom: 20px;
  }

  .view-head h2 {
    font-size: 1.5rem;
  }

  .lede {
    font-size: 12.5px;
  }

  .bento,
  .tools-grid,
  .env-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
  }

  .span-3,
  .span-4,
  .span-5,
  .span-6,
  .span-7,
  .span-8,
  .span-9,
  .span-12 {
    grid-column: span 1;
  }

  .card {
    padding: 15px;
    border-radius: 14px;
  }

  .query-bar,
  .query-bar-dns {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    padding: 14px;
  }

  .query-bar .field-grow,
  .query-bar .field {
    flex: 0 0 auto;
    width: 100%;
  }

  .query-actions {
    width: 100%;
    flex: 0 0 auto;
    margin-top: 0;
  }

  .table-wrap .headers-table {
    min-width: 0;
  }

  .headers-table th,
  .headers-table td {
    padding-left: 10px;
    padding-right: 10px;
  }

  .headers-table td.cell-value {
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .query-actions .btn {
    flex: 1;
  }

  .segmented span {
    min-height: 44px;
  }

  .record-chips label {
    min-height: 44px;
  }

  .btn-small {
    min-height: 44px;
    padding: 0 12px;
  }

  /* Prevent iOS Safari from zooming into focused form controls */
  .input,
  .input.mono,
  .palette-search input {
    font-size: 16px;
  }

  table.data {
    font-size: 12px;
  }

  table.data td.mono,
  table.data .cell-value {
    font-size: 11.5px;
  }

  .record-chips {
    margin-top: 0;
  }

  .ip-value.is-v4 {
    font-size: clamp(1.7rem, 8vw, 2.3rem);
  }

  .ip-facts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ip-actions .btn {
    flex: 1 1 auto;
  }

  .latency-row {
    grid-template-columns: 76px minmax(0, 1fr) 60px;
    gap: 8px;
  }

  .score-wrap {
    gap: 14px;
  }

  .score-ring {
    width: 80px;
    height: 80px;
  }

  .score-ring > span {
    font-size: 21px;
  }

  .setting-row,
  .switch-row {
    gap: 12px;
  }

  .source-list li > span:first-child {
    min-width: 0;
    width: 100%;
  }

  .modal-head,
  .modal-body,
  .modal-foot {
    padding-left: 16px;
    padding-right: 16px;
  }

  .toast-stack {
    left: 14px;
    right: 14px;
    bottom: calc(var(--mobile-nav-h) + 22px + env(safe-area-inset-bottom));
    width: auto;
  }

  .site-footer {
    margin-top: 28px;
    padding-bottom: 8px;
    font-size: 10.5px;
  }

  .footer-links .link-btn,
  .footer-links a {
    font-size: 10.5px;
  }
}

@media (max-width: 420px) {
  .topbar-actions {
    gap: 2px;
  }

  .icon-btn {
    width: 36px;
    height: 36px;
  }

  .ip-facts {
    grid-template-columns: 1fr;
  }

  .metric-value {
    font-size: 1.9rem;
  }

  .segmented span {
    min-width: 58px;
  }

  .inline-form {
    gap: 6px;
  }
}

/* ---------- Short landscape ---------- */
@media (max-height: 560px) and (min-width: 721px) {
  .sidebar {
    padding-top: 14px;
    gap: 14px;
  }

  .nav-item {
    min-height: 38px;
  }

  .api-card {
    display: none;
  }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .view,
  .card,
  .toast,
  dialog[open] {
    animation: none !important;
  }
}

/* ---------- Forced colors ---------- */
@media (forced-colors: active) {
  .card,
  .input,
  .btn,
  .badge,
  .record-chips label {
    border: 1px solid CanvasText;
  }

  .live-dot,
  .api-dot,
  .history-dot {
    forced-color-adjust: none;
  }
}

/* ---------- Print ---------- */
@media print {
  .sidebar,
  .topbar,
  .mobile-nav,
  .view-actions,
  .toast-stack,
  dialog,
  .ambient {
    display: none !important;
  }

  body {
    background: #fff;
    color: #000;
  }

  .app {
    display: block;
  }

  .main {
    max-width: none;
    padding: 0;
  }

  .card {
    break-inside: avoid;
    border: 1px solid #ccc;
    box-shadow: none;
  }
}

/* ---------- Keyframes ---------- */
@keyframes view-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes rise {
  from { opacity: 0; transform: translateY(14px) scale(0.995); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes shimmer {
  from { background-position: 200% 0; }
  to { background-position: -20% 0; }
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes dialog-in {
  from { opacity: 0; transform: translateY(-8px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.palette[open] {
  animation-name: palette-in;
}

@keyframes palette-in {
  from { opacity: 0; transform: translate(-50%, -8px) scale(0.985); }
  to { opacity: 1; transform: translate(-50%, 0) scale(1); }
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes toast-out {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(6px); }
}

/* ---------- Late additions: history chips, site hero, WebRTC ---------- */
body.drawer-open {
  overflow: hidden;
}

.recent-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-bottom: 12px;
}

.recent-label {
  margin-right: 2px;
  color: var(--text-3);
  font-size: 9.5px;
  font-weight: 650;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.recent-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 0 9px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 10.5px;
  transition: border-color var(--dur-2) ease, color var(--dur-2) ease, background-color var(--dur-2) ease;
}

.recent-chip:hover {
  border-color: var(--border-strong);
  background: var(--surface-3);
  color: var(--text);
}

.recent-type {
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
}

.site-hero {
  background-image:
    radial-gradient(100% 160% at 100% 0%, var(--cyan-soft), transparent 55%),
    var(--card-sheen);
}

.site-title {
  margin: 2px 0 6px;
  font-size: clamp(1.3rem, 2.6vw, 1.8rem);
  font-weight: 660;
  letter-spacing: -0.035em;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.site-url {
  color: var(--text-2);
  font-size: 11.5px;
  overflow-wrap: anywhere;
}

.rtc-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.rtc-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 7px 9px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  background: var(--surface-2);
  font-size: 10.5px;
}

.rtc-list li .mono {
  color: var(--text);
  overflow-wrap: anywhere;
}

.rtc-list li .muted {
  margin-left: auto;
  font-size: 9.5px;
}

.spark-area {
  fill: var(--accent-soft-2);
  opacity: 0.55;
}

/* ---------- file:// guidance ---------- */
.file-warning {
  position: fixed;
  top: 14px;
  left: 50%;
  z-index: 250;
  width: min(560px, calc(100vw - 28px));
  padding: 13px 16px;
  border: 1px solid var(--amber-soft);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  transform: translateX(-50%);
}

.file-warning strong {
  display: block;
  color: var(--amber);
  font-size: 12.5px;
}

.file-warning p {
  margin-top: 3px;
  color: var(--text-2);
  font-size: 11.5px;
  line-height: 1.55;
}

.file-warning code {
  padding: 1px 4px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 10.5px;
}

/* ---------- Language switch (topbar) ---------- */
.lang-btn {
  width: auto;
  min-width: 40px;
  padding: 0 9px;
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

/* ---------- Email / SMTP ---------- */
.stack-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 4px;
}

.form-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 120px;
  align-items: end;
  gap: 10px;
}

.field-port-sm input {
  text-align: center;
}

.stack-form .query-actions {
  margin-top: 3px;
}

.stack-form .query-actions .btn {
  min-width: 148px;
}

.email-examples {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
}

.email-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 14px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text-3);
  font-size: 11px;
  line-height: 1.5;
}

.email-note .icon {
  width: 14px;
  height: 14px;
  margin-top: 1px;
  color: var(--cyan);
}

.cap-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.cap-chip {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--text-2);
  font-family: var(--font-mono);
  font-size: 10.5px;
  line-height: 1.2;
}

.cap-chip.is-auth {
  border-color: var(--accent-soft-2);
  background: var(--accent-soft);
  color: var(--accent);
}

.card h4 {
  margin: 14px 0 8px;
  color: var(--text-3);
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.smtp-hero .result-title {
  font-size: clamp(1.35rem, 2.8vw, 2rem);
}

.email-hero .score-wrap {
  margin-top: 18px;
}

.email-checks {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: var(--space-4);
}

.email-check {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  background-image: var(--card-sheen);
  box-shadow: var(--shadow-sm);
}

.email-check-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.email-check-name {
  color: var(--text);
  font-size: 12.5px;
  font-weight: 650;
}

.email-check-value {
  color: var(--text-2);
  font-family: var(--font-mono);
  font-size: 10.5px;
  line-height: 1.55;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.email-check-note {
  color: var(--text-3);
  font-size: 10.5px;
  line-height: 1.45;
}

@media (max-width: 720px) {
  .form-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .stack-form .query-actions .btn {
    width: 100%;
  }

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

}

.dig-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 0 10px;
}

#smtp-results:not(:empty),
#email-dns-results:not(:empty) {
  margin-top: var(--space-4);
}

@media (max-width: 1100px) and (min-width: 961px) {
  #view-email .bento > .span-5,
  #view-email .bento > .span-7 {
    grid-column: span 12;
  }
}

@media (max-width: 420px) {
  .lang-btn {
    width: 36px;
    min-width: 36px;
    padding: 0;
    font-size: 10.5px;
  }
}
