@font-face { font-family: 'Plex Arabic'; src: url('/assets/fonts/plex-arabic-extralight.woff2') format('woff2'); font-weight: 200; font-display: swap; }
@font-face { font-family: 'Plex Arabic'; src: url('/assets/fonts/plex-arabic-regular.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Plex Arabic'; src: url('/assets/fonts/plex-arabic-medium.woff2') format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Plex Arabic'; src: url('/assets/fonts/plex-arabic-semibold.woff2') format('woff2'); font-weight: 600; font-display: swap; }

/* ---------- Tokens ----------
   Dark is the brand look (Mal-inspired deep green). Light is opt-in from the header toggle. */
:root {
  color-scheme: dark;
  --bg: #030806;
  --bg-grouped: #07100C;
  --card: #0B1511;
  --text: #F2F5F3;
  --muted: #8A958F;
  --sep: rgba(255, 255, 255, 0.09);
  --accent: #3BE39B;
  --logo-tone: #1C5E43;
  --down: #3BE39B;
  --up: #5CC8FF;
  --danger: #FF6B6B;
  --header: rgba(3, 8, 6, 0.55);
  --tile: rgba(255, 255, 255, 0.05);
  --edge: rgba(255, 255, 255, 0.08);
  --input: rgba(255, 255, 255, 0.08);
  --glow-a: rgba(46, 216, 142, 0.30);
  --glow-b: rgba(163, 230, 53, 0.10);
  --glow-c: rgba(46, 216, 142, 0.10);
  --g1: #0E8F5A; --g2: #3BE39B; --g3: #C4F56A; --g4: #9BF8E6;
  --orb-core: radial-gradient(circle at 50% 38%, #08150F 0%, #020604 72%);
  --primary-bg: #FFFFFF; --primary-fg: #050A08;
  --radius: 22px;
  --measure: 40rem;
  --font: -apple-system, BlinkMacSystemFont, 'SF Pro Arabic', 'SF Pro Text', 'Plex Arabic', 'Segoe UI', system-ui, sans-serif;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #F3F7F4;
  --bg-grouped: #E8F0EA;
  --card: #FFFFFF;
  --text: #0B1410;
  --muted: #5D6B63;
  --sep: rgba(0, 0, 0, 0.1);
  --accent: #0FAE6E;
  --logo-tone: #B4EFD2;
  --down: #0FAE6E;
  --up: #0A84C6;
  --danger: #D70015;
  --header: rgba(243, 247, 244, 0.6);
  --tile: rgba(255, 255, 255, 0.72);
  --edge: rgba(0, 0, 0, 0.06);
  --input: rgba(0, 0, 0, 0.05);
  --glow-a: rgba(46, 216, 142, 0.28);
  --glow-b: rgba(163, 230, 53, 0.18);
  --glow-c: rgba(46, 216, 142, 0.10);
  --g1: #0FAE6E; --g2: #3BE39B; --g3: #B5EE55; --g4: #6FE8CF;
  --orb-core: radial-gradient(circle at 50% 38%, #FFFFFF 0%, #EEF6F1 75%);
  --primary-bg: #0B1410; --primary-fg: #FFFFFF;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 4rem; background: var(--bg); }
body {
  margin: 0;
  min-height: 100vh; min-height: 100svh;
  display: flex; flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}
/* Ambient green light in the corners, like Mal */
body::before {
  content: ''; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(42rem 32rem at -6% -8%, var(--glow-a), transparent 68%),
    radial-gradient(34rem 26rem at 108% 2%, var(--glow-b), transparent 70%),
    radial-gradient(60rem 30rem at 50% 115%, var(--glow-c), transparent 70%);
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 0.2em; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 8px; }
button, input, select { font: inherit; color: inherit; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.wrap { width: min(100% - 2.5rem, 60rem); margin-inline: auto; }
.narrow { width: min(100% - 2.5rem, var(--measure)); margin-inline: auto; }

/* Glass surface shared by tiles, the nav pill and round buttons */
.glass, .metrics, .example, .site-nav, .icon-btn, .lang-switch, .btn-ghost, .isp-note, .card, .chip {
  background: var(--tile);
  box-shadow: inset 0 0 0 1px var(--edge);
  -webkit-backdrop-filter: blur(20px) saturate(140%); backdrop-filter: blur(20px) saturate(140%);
}

/* ---------- Header: logo · segmented pill nav · round buttons ---------- */
.site-header {
  position: sticky; top: 0; z-index: 10;
  background: var(--header);
  -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px);
  padding-top: env(safe-area-inset-top);
}
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; height: 4rem; gap: 0.75rem; }
.brand { display: inline-flex; align-items: center; color: var(--text); flex: none; }
.brand:hover { text-decoration: none; }
.brand-logo { height: 1.625rem; width: auto; display: block; }
.header-end { display: flex; align-items: center; gap: 0.5rem; }
.site-nav { display: flex; gap: 0.125rem; padding: 0.25rem; border-radius: 999px; font-size: 0.875rem; }
.site-nav a {
  display: inline-flex; align-items: center; min-height: 2.25rem; padding: 0 0.9rem; border-radius: 999px;
  color: var(--muted); white-space: nowrap; transition: background 0.2s ease, color 0.2s ease;
}
.site-nav a:hover { color: var(--text); text-decoration: none; }
.site-nav a[aria-current="page"] { background: var(--primary-bg); color: var(--primary-fg); font-weight: 500; }
.icon-btn, .lang-switch {
  display: grid; place-items: center; width: 2.75rem; height: 2.75rem; flex: none;
  border: 0; border-radius: 50%; color: var(--text); cursor: pointer; font-size: 0.875rem; font-weight: 600;
}
.lang-switch:hover, .icon-btn:hover { text-decoration: none; box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 40%, transparent); }
.icon-btn svg { width: 1.2rem; height: 1.2rem; }
.icon-sun { display: block; }
.icon-moon { display: none; }
:root[data-theme="light"] .icon-sun { display: none; }
:root[data-theme="light"] .icon-moon { display: block; }

/* ---------- Breadcrumbs ---------- */
.crumbs { font-size: 0.8125rem; color: var(--muted); margin: 1.25rem 0 0; }
.crumbs ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.35rem; justify-content: center; }
.page-plain .crumbs ol { justify-content: flex-start; }
.crumbs li + li::before { content: '‹'; margin-inline-end: 0.35rem; }
.crumbs a { color: var(--muted); }

/* ---------- Hero ---------- */
.hero { text-align: center; padding-block: 1.25rem; }
.hero h1 { font-size: clamp(1.75rem, 6vw, 2.75rem); font-weight: 700; line-height: 1.15; letter-spacing: -0.025em; margin: 0; }
.lead { color: var(--muted); font-size: clamp(1rem, 2.4vw, 1.1875rem); margin: 0.5rem auto 0; max-width: 34rem; }
.hero:has(.tester:not([data-state="idle"])) :is(.lead, h1, .crumbs) { display: none; }

/* ---------- The orb: start button, live readout and result in one ----------
   Its glow slowly turns: the one ambient motion on the page. */
.tester { display: grid; justify-items: center; margin-top: 1.25rem; }
.hero:has(.tester:not([data-state="idle"])) .tester { margin-top: 0.5rem; }
.orb {
  --size: clamp(14rem, min(78vw, 40svh), 24rem);
  position: relative; width: var(--size); aspect-ratio: 1; border-radius: 50%;
  container-type: inline-size; isolation: isolate;
  transition: width 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.tester:is([data-state="latency"], [data-state="download"], [data-state="upload"]) .orb { --size: clamp(15rem, min(84vw, 50svh), 27rem); }
.tester[data-state="done"] .orb { --size: clamp(12rem, min(60vw, 30svh), 19rem); }
/* Glass sphere (after Mal's credits circle): a near-black core, light caught in a few
   streaks on the rim, and a faint outer glow. The light sways a few degrees, very slowly. */
.orb-core {
  position: absolute; inset: 0; border-radius: 50%; z-index: 0;
  background: radial-gradient(circle at 50% 46%, #07130E 0%, #030806 62%, #020504 100%);
  box-shadow: inset 0 0 0 1px rgba(110, 230, 170, 0.16);
  display: grid; place-content: center; justify-items: center; text-align: center; padding: 12cqi;
  color: #F2F5F3;
}
.orb-halo {
  position: absolute; inset: -9%; border-radius: 50%; z-index: -1; pointer-events: none;
  background: radial-gradient(circle, rgba(59, 227, 155, 0.13) 52%, transparent 70%);
  filter: blur(18px);
}
.orb-ring, .orb-edge {
  position: absolute; inset: 0; border-radius: 50%; z-index: 1; pointer-events: none;
  animation: orb-sway 14s ease-in-out infinite alternate;
}
/* Rim light: brightest top-right and right (lime), a cool glint bottom-left, dim elsewhere */
.orb-ring {
  background: conic-gradient(from 0deg,
    rgba(190, 248, 120, 1) -6deg, rgba(150, 236, 110, 0.85) 22deg, rgba(90, 210, 120, 0.25) 50deg,
    rgba(120, 228, 110, 0.6) 66deg, rgba(185, 248, 105, 1) 86deg, rgba(150, 236, 110, 0.75) 104deg,
    rgba(70, 190, 115, 0.18) 140deg, rgba(40, 150, 100, 0.08) 180deg,
    rgba(110, 220, 190, 0.45) 205deg, rgba(205, 255, 248, 1) 224deg, rgba(90, 210, 160, 0.4) 244deg,
    rgba(30, 140, 90, 0.1) 286deg, rgba(90, 205, 120, 0.4) 326deg, rgba(190, 248, 120, 1) 354deg);
  -webkit-mask: radial-gradient(farthest-side, transparent 83%, rgba(0, 0, 0, 0.4) 91%, #000 96.5%, #000 99%, transparent 100%);
  mask: radial-gradient(farthest-side, transparent 83%, rgba(0, 0, 0, 0.4) 91%, #000 96.5%, #000 99%, transparent 100%);
  filter: blur(0.8cqi) saturate(1.15);
}
/* Glass reflections: a soft crescent at the top and a glint at the bottom-left */
.orb-edge {
  background:
    radial-gradient(ellipse 34% 9% at 57% 3.5%, rgba(200, 248, 160, 0.5), transparent 72%),
    radial-gradient(ellipse 17% 8% at 19% 88%, rgba(210, 255, 250, 0.45), transparent 72%);
  box-shadow: inset 0 0 0 1px rgba(150, 240, 170, 0.22), 0 0 60px -14px rgba(59, 227, 155, 0.3);
}
[dir="rtl"] .orb-ring, [dir="rtl"] .orb-edge { animation-direction: alternate-reverse; }
@keyframes orb-sway { from { transform: rotate(-7deg); } to { transform: rotate(9deg); } }
.tester[data-state="upload"] :is(.orb-ring, .orb-edge) { filter: hue-rotate(42deg) blur(var(--b, 0px)); }
.tester[data-state="upload"] .orb-ring { --b: 0.8cqi; }
.orb:has(.orb-btn:hover) .orb-halo { filter: blur(18px) brightness(1.6); }
.orb-btn {
  position: absolute; inset: 0; border-radius: 50%; border: 0; padding: 0; cursor: pointer;
  background: transparent; -webkit-tap-highlight-color: transparent;
}
.orb:has(.orb-btn:active) { transform: scale(0.98); }
.orb { transition: width 0.6s cubic-bezier(0.2, 0.8, 0.2, 1), transform 0.15s ease; }

.start-label { position: relative; z-index: 2; font-size: 10cqi; font-weight: 600; letter-spacing: -0.01em; color: #F2F5F3; }
.stage, .readout { display: none; }
.tester:not([data-state="idle"]) .start-label,
.tester:not([data-state="idle"]) .orb-btn { display: none; }
.tester:not([data-state="idle"]) .stage { display: block; }
.tester:not([data-state="idle"]) .readout { display: flex; }
.stage { color: #F2F5F3; font-size: max(0.8125rem, 5.4cqi); font-weight: 500; line-height: 1.4; margin: 0 0 2cqi; }
.readout { flex-direction: column; align-items: center; }
.readout-value {
  direction: ltr; display: block;
  font-size: 22cqi; font-weight: 600; line-height: 1; letter-spacing: -0.035em;
  font-variant-numeric: tabular-nums;
}
.readout-unit { color: #9AA59F; font-size: max(0.8125rem, 5cqi); margin-top: 2cqi; }
.tester[data-state="download"] .readout-value { color: #F2F5F3; }
.tester[data-state="upload"] .readout-value { color: #F2F5F3; }

.hint { color: var(--muted); font-size: 0.9375rem; margin: 1.25rem auto 0; max-width: 24rem; }
.tester:not([data-state="idle"]) .hint { display: none; }
.tester .stop-btn { display: none; margin-top: 1.25rem; }
.tester:is([data-state="latency"], [data-state="download"], [data-state="upload"]) .stop-btn { display: inline-flex; }

.live { display: none; width: 100%; }
.tester:not([data-state="idle"]) .live { display: block; }
.trace { display: none; }

/* What shows in each state */
.tester .verdict, .tester .actions { display: none; }
.tester[data-state="done"] .verdict { display: block; }
.tester[data-state="done"] .actions { display: flex; }
.tester:is([data-state="latency"], [data-state="download"], [data-state="upload"]) .example { display: none; }
.tester[data-state="done"] .isp-line { display: none; }
.live, .verdict, .example, .actions, .data-pill, .stop-btn { animation: rise 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
@keyframes rise { from { opacity: 0; transform: translateY(0.5rem); } to { opacity: 1; transform: none; } }

.metrics {
  display: grid; grid-template-columns: repeat(4, 1fr);
  width: 100%; max-width: 34rem; margin: 1.25rem auto 0; padding: 0.9rem 0.25rem;
  border-radius: var(--radius);
}
.metrics > div { padding: 0 0.4rem; }
.metrics > div + div { border-inline-start: 1px solid var(--edge); }
.metrics dt { font-size: 0.8125rem; color: var(--muted); }
.metrics dd { margin: 0; font-size: 1.375rem; font-weight: 600; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.metrics small { font-size: 0.6875rem; font-weight: 400; color: var(--muted); margin-inline-start: 0.2rem; letter-spacing: 0; }
.dot { display: inline-block; width: 0.5rem; height: 0.5rem; border-radius: 50%; margin-inline-end: 0.3rem; vertical-align: 0.1em; box-shadow: 0 0 8px currentColor; }
.dot-down { background: var(--down); color: var(--down); }
.dot-up { background: var(--up); color: var(--up); }

.data-pill {
  display: inline-flex; align-items: center; gap: 0.4rem; margin-top: 0.25rem; position: relative; z-index: 1;
  padding: 0.3rem 0.85rem; border-radius: 999px; font-size: 0.8125rem; font-weight: 500;
  color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 30%, transparent);
}
.data-pill::before { content: ''; width: 0.45rem; height: 0.45rem; border-radius: 50%; background: currentColor; box-shadow: 0 0 8px currentColor; }
.data-pill[hidden] { display: none; }

.isp-line { color: var(--muted); font-size: 0.875rem; margin: 1rem 0 0; min-height: 1.5em; }
.example {
  width: 100%; max-width: 30rem; margin-top: 1.25rem; padding: 0.7rem 0.6rem 0.7rem 1.1rem; border-radius: var(--radius);
  display: flex; align-items: center; gap: 0.5rem; text-align: start;
}
[dir="rtl"] .example { padding: 0.7rem 1.1rem 0.7rem 0.6rem; }
.example[hidden] { display: none; }
.ex-text { margin: 0; flex: 1; font-size: 0.9375rem; line-height: 1.6; }
.ex-next {
  flex: none; display: grid; place-items: center; width: 2.75rem; height: 2.75rem; border-radius: 50%;
  border: 0; cursor: pointer; color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent);
}
.ex-next svg { width: 1.15rem; height: 1.15rem; }
.ex-next:active svg { transform: rotate(-90deg); transition: transform 0.2s ease; }
.link-btn {
  min-height: 2.75rem; padding: 0 1rem; border: 0; background: none; cursor: pointer;
  color: var(--accent); font-size: 0.875rem; font-weight: 500;
}
.isp-note { font-size: 0.9375rem; margin: 0.75rem auto 0; max-width: 30rem; border-radius: 16px; padding: 0.6rem 1rem; }
.error { color: var(--danger); margin: 1rem 0 0; }

/* ---------- Results and the "more" toggle ---------- */
.verdict { font-size: clamp(1rem, 2.4vw, 1.125rem); font-weight: 500; line-height: 1.5; margin: 1.1rem auto 0; max-width: 34rem; text-align: center; }
.data-used { text-align: center; color: var(--muted); font-size: 0.9375rem; margin: 0.5rem 0 0; }
.extended-row { text-align: center; margin: 0.25rem 0 0; }
.more { padding-bottom: 1rem; }
.toggle {
  list-style: none; cursor: pointer; display: flex; justify-content: center; align-items: center; gap: 0.4rem;
  min-height: 2.75rem; color: var(--muted); font-size: 0.875rem;
}
.toggle::-webkit-details-marker { display: none; }
.toggle::after {
  content: ''; width: 0.45rem; height: 0.45rem; margin-top: -0.2rem;
  border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg);
  transition: transform 0.2s ease;
}
details[open] > .toggle::after { transform: rotate(-135deg); margin-top: 0.2rem; }
.toggle:hover { color: var(--text); }

.group { margin-top: 1.75rem; }
.group-title { font-size: 1.125rem; font-weight: 600; margin: 0 0 0.5rem; padding-inline: 0.25rem; }
.group-note { font-size: 0.8125rem; color: var(--muted); margin: 0.5rem 0 0; padding-inline: 0.25rem; }
.card { background: var(--card); border-radius: var(--radius); overflow: hidden; }

.rows { list-style: none; margin: 0; padding: 0; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.8rem 1.1rem; min-height: 3.5rem; }
.row + .row { border-top: 0.5px solid var(--sep); }
.row-main { display: grid; }
.row-title { font-size: 1rem; }
.row-sub { font-size: 0.8125rem; color: var(--muted); }
.row-value { font-weight: 500; text-align: end; font-variant-numeric: tabular-nums; white-space: nowrap; }

.field-row { display: flex; align-items: center; gap: 0.75rem; padding: 0.8rem 1.1rem; min-height: 3.5rem; }
.field-row label { flex: 1; }
.field-row + .field-row, .field-row + .field-out { border-top: 0.5px solid var(--sep); }
.input {
  width: 7rem; min-height: 2.75rem; padding: 0.4rem 0.75rem;
  background: var(--input); border: 0; border-radius: 12px;
  font-size: 1.0625rem; text-align: center; direction: ltr; font-variant-numeric: tabular-nums;
}
.select { width: auto; min-width: 5.5rem; text-align: start; direction: inherit; padding-inline: 0.75rem 0.5rem; }
.field-out { padding: 0.8rem 1.1rem; color: var(--muted); font-size: 0.9375rem; }
.bar { height: 6px; margin: 0 1.1rem 1rem; border-radius: 3px; background: var(--sep); overflow: hidden; }
.bar::after { content: ''; display: block; height: 100%; width: var(--pct, 0%); background: var(--accent); border-radius: 3px; transition: width 0.4s ease; }

/* ---------- Buttons: white primary pill, glass secondary (Mal style) ---------- */
.actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.75rem; margin-top: 1.25rem; }
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 3rem; padding: 0.6rem 1.75rem; border-radius: 999px; border: 0; cursor: pointer; font-weight: 600;
  transition: transform 0.15s ease, opacity 0.2s ease;
}
.btn:active { transform: scale(0.97); }
.btn-filled { background: var(--primary-bg); color: var(--primary-fg); }
.btn-tinted, .btn-ghost { color: var(--text); }
.btn-tinted { background: var(--tile); box-shadow: inset 0 0 0 1px var(--edge); }
.btn:disabled { opacity: 0.5; cursor: progress; }
.affiliate { text-align: center; margin-top: 1.25rem; }
.affiliate-link { font-weight: 500; }
.ad-slot { min-height: 100px; margin-block: 1.5rem; }

/* ---------- Calculator ---------- */
.calc { margin-top: 2rem; text-align: start; }
.chips { display: flex; flex-wrap: wrap; gap: 0.5rem; justify-content: center; margin-bottom: 1.25rem; }
.chip {
  min-height: 2.25rem; padding: 0.35rem 1rem; border-radius: 999px; cursor: pointer;
  border: 0; font-size: 0.9375rem;
}
.chip[aria-pressed="true"] { background: var(--primary-bg); color: var(--primary-fg); box-shadow: none; }
.calc-out { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; margin-top: 1rem; }
.calc-out .card { padding: 1rem 1.1rem; text-align: center; }
.calc-out dt { font-size: 0.875rem; color: var(--muted); }
.calc-out dd { margin: 0.25rem 0 0; font-size: 1.375rem; font-weight: 500; }
.calc-source { text-align: center; color: var(--muted); font-size: 0.875rem; margin-top: 1rem; }

/* ---------- Article content ---------- */
.content { padding-block: 3rem; }
.content h2 { font-size: 1.5rem; font-weight: 600; line-height: 1.35; letter-spacing: -0.01em; margin: 2.75rem 0 0.75rem; }
.content > h2:first-child { margin-top: 0; }
.content p, .content ul { margin: 0 0 1rem; }
.content ul { padding-inline-start: 1.25rem; }
.content li + li { margin-top: 0.35rem; }
.table-wrap { background: var(--bg-grouped); border-radius: var(--radius); padding: 0.25rem 1.1rem; margin-bottom: 1rem; overflow-x: auto; }
.content table { width: 100%; border-collapse: collapse; font-size: 0.9375rem; }
.content caption { text-align: start; color: var(--muted); font-size: 0.8125rem; padding-top: 0.75rem; }
.content th, .content td { text-align: start; padding: 0.7rem 0; }
.content tr + tr td, .content tbody tr:first-child td { border-top: 0.5px solid var(--sep); }
.content th { font-weight: 500; color: var(--muted); font-size: 0.8125rem; }
.content td:last-child, .content th:last-child { text-align: end; }
.faq { border-top: 0.5px solid var(--sep); }
.faq details { border-bottom: 0.5px solid var(--sep); }
.faq summary {
  list-style: none; cursor: pointer; font-weight: 500;
  display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 1rem 0;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: '+'; font-size: 1.5rem; font-weight: 200; color: var(--muted); line-height: 1; }
.faq details[open] summary::after { content: '−'; }
.faq details p { margin: 0 0 1rem; color: var(--muted); }

/* ---------- Footer ---------- */
.site-footer { background: transparent; border-top: 1px solid var(--edge); padding-block: 2rem calc(2rem + env(safe-area-inset-bottom)); font-size: 0.8125rem; color: var(--muted); }
.guide-footer { background: none; padding: 0 0 env(safe-area-inset-bottom); font-size: inherit; color: inherit; }
.guide[open] { background: color-mix(in srgb, var(--bg) 92%, transparent); }
.guide .content { padding-block: 1rem 3rem; font-size: 1.0625rem; color: var(--text); }
.guide .footer-inner { padding-block: 2rem; border-top: 0.5px solid var(--sep); font-size: 0.8125rem; color: var(--muted); }
main { flex: 1; display: flex; flex-direction: column; justify-content: center; }
.page-plain main { justify-content: flex-start; }
.footer-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); gap: 1.5rem; }
.footer-cols h2 { font-size: 0.8125rem; font-weight: 600; color: var(--text); margin: 0 0 0.5rem; }
.footer-cols ul { list-style: none; margin: 0; padding: 0; }
.footer-cols li + li { margin-top: 0.35rem; }
.footer-cols a { color: var(--muted); }
.footer-cols a:hover { color: var(--text); }
.footer-cols a[aria-current="page"] { color: var(--text); }
.footer-note { margin: 2rem 0 0; padding-top: 1rem; border-top: 0.5px solid var(--sep); max-width: var(--measure); }

/* ---------- Small screens ---------- */
@media (max-width: 40rem) {
  body { font-size: 1rem; }
  .site-nav .nav-wide { display: none; }
  .site-nav a { padding: 0 0.75rem; }
  .hero { padding-block: 0.75rem; }
  .metrics { padding-block: 0.75rem; }
  .metrics > div { padding: 0 0.2rem; }
  .metrics dt { font-size: 0.75rem; }
  .metrics dd { font-size: 1.25rem; }
  .verdict { font-size: 0.9375rem; margin-top: 0.85rem; }
  .example { margin-top: 0.85rem; }
  .ex-text { font-size: 0.875rem; }
  .metrics { margin-top: 0.85rem; }
  .metrics dd { font-size: 1.125rem; }
  .icon-btn, .lang-switch { width: 2.5rem; height: 2.5rem; }
  .site-nav a { min-height: 2rem; }
  .header-end { gap: 0.35rem; }
  .actions { margin-top: 1rem; }
  .row { padding-inline: 1rem; }
  .input { width: 5.75rem; }
}
@media (max-width: 23rem) {
  .site-header .wrap { gap: 0.35rem; }
  .header-end { gap: 0.3rem; }
  .site-wrap, .site-header .wrap { width: calc(100% - 1.5rem); }
  .site-nav { padding: 0.2rem; }
  .site-nav a { padding: 0 0.5rem; font-size: 0.75rem; }
  .icon-btn, .lang-switch { width: 2.5rem; height: 2.5rem; }
  .brand-logo { height: 1.25rem; }
}
/* Short phone screens: keep each tool on one screen */
@media (max-width: 40rem) and (max-height: 760px) {
  .crumbs { margin-top: 0.5rem; }
  .lead { font-size: 0.9375rem; line-height: 1.55; }
  .lead { display: none; }
  .orb { --size: clamp(12.5rem, min(72vw, 38svh), 21rem); }
  .tester[data-state="done"] .orb { --size: clamp(10.5rem, min(54vw, 27svh), 17rem); }
  .hint { margin-top: 1rem; }
  .chips { flex-wrap: nowrap; overflow-x: auto; justify-content: flex-start; margin-inline: -1.25rem; padding-inline: 1.25rem; scrollbar-width: none; }
  .chips::-webkit-scrollbar { display: none; }
  .chip { flex: none; }
  .calc { margin-top: 1.25rem; }
  .field-row { min-height: 3rem; padding-block: 0.4rem; }
  .calc-out { margin-top: 0.75rem; }
  .calc-out .card { padding: 0.75rem 1rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

.unit-label { color: var(--muted); font-size: 0.875rem; white-space: nowrap; }
.page-plain .hero { text-align: start; padding-bottom: 0; }
.page-plain .lead { margin-inline: 0; }
[dir="ltr"] .crumbs li + li::before { content: '›'; }
