:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --ink: #0f172a;
  --muted: #5b6475;
  --line: #e3e6ec;
  --accent: #2f5bff;
  --accent-soft: #e8edff;
  --fast: #00a693;
  --good: #0f8a4f;
  --warn: #a15c07;
  --warn-soft: #fff4e2;
  --bar-track: #eef0f4;
  --shadow: 0 1px 2px rgb(15 23 42 / 6%), 0 8px 24px rgb(15 23 42 / 6%);
  --display: "Space Grotesk", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --body: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0f17;
    --surface: #121826;
    --ink: #e8ecf3;
    --muted: #9aa4b5;
    --line: #232b3b;
    --accent: #7c96ff;
    --accent-soft: #1b2440;
    --fast: #2dd4bf;
    --good: #4ade80;
    --warn: #fbbf24;
    --warn-soft: #2a2010;
    --bar-track: #1c2333;
    --shadow: 0 1px 2px rgb(0 0 0 / 30%), 0 8px 24px rgb(0 0 0 / 25%);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 var(--body);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: var(--accent); }
main { flex: 1; width: 100%; max-width: 760px; margin: 0 auto; padding: 0 16px; }

.top { max-width: 760px; width: 100%; margin: 0 auto; padding: 20px 16px 0; }
.brand { display: inline-flex; align-items: center; gap: 8px; color: var(--ink); text-decoration: none; font: 700 18px/1 var(--display); letter-spacing: -0.01em; }
.brand-mark { width: 28px; height: 28px; }
.tld { color: var(--accent); }

/* The question */
.ask { padding: 12vh 0 40px; transition: padding .25s ease; }
.ask-title { margin: 0; font: 700 clamp(2.2rem, 7vw, 4.2rem)/1.05 var(--display); letter-spacing: -0.03em; }
.search { position: relative; display: flex; align-items: baseline; margin-top: 6px; }
#q {
  flex: 1;
  min-width: 0;
  border: 0;
  border-bottom: 3px solid var(--line);
  border-radius: 0;
  background: transparent;
  color: var(--accent);
  font: 700 clamp(1.6rem, 5.4vw, 3.2rem)/1.2 var(--display);
  letter-spacing: -0.02em;
  padding: 4px 0 8px;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}
#q::placeholder { color: var(--muted); opacity: .55; }
#q:focus { border-bottom-color: var(--accent); }
#q::-webkit-search-cancel-button { display: none; }
.search-q { font: 700 clamp(1.6rem, 5.4vw, 3.2rem)/1.2 var(--display); color: var(--muted); opacity: .55; padding-left: 4px; }
.ask-sub { color: var(--muted); max-width: 560px; margin: 20px 0 0; }
.ask-try { color: var(--muted); margin: 8px 0 0; font-size: 15px; }

#suggestions {
  position: absolute;
  z-index: 10;
  top: 100%;
  left: 0;
  right: 0;
  margin: 6px 0 0;
  padding: 6px;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  max-height: 60vh;
  overflow-y: auto;
}
#suggestions li { padding: 10px 12px; border-radius: 10px; cursor: pointer; }
#suggestions li[aria-selected="true"], #suggestions li:hover { background: var(--accent-soft); }
#suggestions li.empty { color: var(--muted); cursor: default; background: none; }

/* After a search: the question shrinks to a bar */
body.has-result .ask { padding: 28px 0 8px; }
body.has-result .ask-title { font-size: clamp(1.1rem, 3vw, 1.4rem); color: var(--muted); letter-spacing: -0.01em; }
body.has-result #q, body.has-result .search-q { font-size: clamp(1.3rem, 4vw, 1.9rem); }
body.has-result .ask-sub, body.has-result .ask-try { display: none; }

/* Result */
.result { padding: 8px 0 40px; }
.hero {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 24px;
  margin-top: 16px;
}
.hero-label { margin: 0; color: var(--muted); font-size: 15px; }
.hero-speed { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 12px; margin: 4px 0 2px; }
.hero-num { font: 700 clamp(3.4rem, 14vw, 6rem)/1 var(--display); letter-spacing: -0.04em; color: var(--ink); }
.hero-unit { font: 700 clamp(1.2rem, 4vw, 1.8rem)/1 var(--display); color: var(--muted); }
.hero-up { color: var(--muted); font-size: 15px; }
.hero-on { margin: 10px 0 0; font-size: 17px; }
.hero-fun { margin: 14px 0 0; padding-top: 14px; border-top: 1px solid var(--line); color: var(--muted); font-size: 15px; }
.hero-none .hero-num { font-size: clamp(2rem, 8vw, 3rem); }

.callout { margin-top: 16px; padding: 14px 16px; border-radius: 14px; background: var(--accent-soft); font-size: 15px; }
.callout strong { font-weight: 650; }
.callout.warn { background: var(--warn-soft); }

h2.section { font: 700 20px/1.2 var(--display); margin: 32px 0 12px; letter-spacing: -0.01em; }

.net {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px 20px;
  margin-bottom: 12px;
}
.net-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.net-name { font: 700 19px/1.2 var(--display); margin: 0; }
.badge { display: inline-block; font-size: 13px; font-weight: 600; padding: 3px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); white-space: nowrap; }
.badge.off { background: var(--bar-track); color: var(--muted); }
.net-tech { color: var(--muted); margin: 2px 0 0; font-size: 15px; }

/* Rows share one grid so names, bars and speeds line up */
.tiers { list-style: none; margin: 14px 0 0; padding: 0; display: grid; grid-template-columns: max-content 1fr max-content; align-items: center; gap: 8px 12px; font-size: 15px; }
.tier { display: contents; }
.tier-name { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tier-bar { height: 10px; border-radius: 999px; background: var(--bar-track); overflow: hidden; }
.tier-bar span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--fast), var(--accent)); }
.tier-speed { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.tier-speed small { color: var(--muted); font-weight: 400; }
.tier.best .tier-name { color: var(--ink); font-weight: 600; }
.tier-speed { text-align: right; }

.net-biz { margin: 14px 0 0; padding-top: 12px; border-top: 1px dashed var(--line); font-size: 15px; }
.net-notes { margin: 12px 0 0; padding-left: 18px; color: var(--muted); font-size: 14px; }
.net-notes li + li { margin-top: 4px; }

.also { color: var(--muted); font-size: 15px; margin: 4px 0 0; }

.net-details { margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--line); font-size: 14px; }
.net-details summary { cursor: pointer; color: var(--accent); font-weight: 600; }
.net-details dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 10px 0 0; }
.net-details dt { color: var(--muted); }
.net-details dd { margin: 0; overflow-wrap: anywhere; }
@media (max-width: 480px) { .net-details dl { grid-template-columns: 1fr; gap: 0; } .net-details dd { margin-bottom: 8px; } }

.mobile-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.mobile-grid .net { margin: 0; display: flex; flex-direction: column; }
.mobile-grid .net-tech { margin-top: 8px; }
.mob-home { font-size: 14px; margin: 10px 0 0; }
.mob-sub { font-size: 13px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin: 14px 0 6px; }
.mob-plans { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: 14px; }
.plan-kind { display: block; color: var(--muted); font-size: 13px; }
.mob-plans a { color: var(--ink); text-decoration: none; }
.mob-plans a:hover { text-decoration: underline; }
.mob-map { margin: auto 0 0; padding-top: 12px; font-size: 14px; }
@media (max-width: 760px) { .mobile-grid { grid-template-columns: 1fr; } }

.meta { color: var(--muted); font-size: 13px; margin-top: 24px; }

/* Loading */
.checking { list-style: none; margin: 16px 0 0; padding: 0; display: grid; gap: 10px; }
.checking li { display: flex; align-items: center; gap: 10px; color: var(--muted); }
.checking li::before {
  content: "";
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--line);
  border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .checking li::before { animation: none; } .ask { transition: none; } }

.error { margin-top: 16px; padding: 16px; border-radius: 14px; background: var(--warn-soft); }

.foot { max-width: 760px; width: 100%; margin: 0 auto; padding: 24px 16px 40px; color: var(--muted); font-size: 13px; }
.foot p { margin: 4px 0; }

@media (max-width: 480px) {
  .hero { padding: 20px 18px; }
  .net { padding: 16px; }
  /* Name and speed on one line, the bar under them */
  .tiers { grid-template-columns: 1fr; row-gap: 12px; }
  .tier { display: grid; grid-template-columns: 1fr max-content; gap: 4px 12px; align-items: center; }
  .tier-bar { grid-column: 1 / -1; grid-row: 2; }
}
.muted { color: var(--muted); }
