/* ServerMania look: Switzer, #0777FF blue, navy #002149, pill buttons, 16px cards */
@font-face {
  font-family: Switzer;
  src: url("/fonts/Switzer-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --blue: #0777FF;
  --blue-hover: #066BE5;
  --blue-pale: #DBEBFF;
  --navy: #002149;
  --navy-2: #0A2E5C;
  --navy-3: #12396D;
  --ink: #3A494F;
  --heading: #002149;
  --muted: #5F6C72;
  --line: #E1E7EC;
  --paper: #F4F7FA;
  --white: #FFFFFF;
  --good: #12A36B;
  --fair: #E3A92F;
  --poor: #F0645A;
  --term-bg: #001730;
  --term-ink: #DBEBFF;
  --term-dim: #7E95B3;
  --font: Switzer, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}

[hidden] { display: none !important; }
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 17px/1.55 var(--font); }
a { color: var(--blue); }
button, input { font: inherit; color: inherit; }
h1, h2, h3 { color: var(--heading); font-weight: 500; letter-spacing: -.01em; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--white); padding: 8px 14px; border-radius: 8px; z-index: 10; }
.skip:focus { left: 8px; }
.wrap { max-width: 1240px; margin: 0 auto; padding-left: 24px; padding-right: 24px; }

/* Pills, as on servermania.com */
.pill {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 32px; border-radius: 32px; border: 1px solid transparent;
  background: var(--blue); color: var(--white); font-weight: 500; font-size: 1rem;
  text-decoration: none; cursor: pointer; white-space: nowrap;
}
.pill:hover { background: var(--blue-hover); }
.pill:disabled { opacity: .5; cursor: default; }
.pill-ghost { background: transparent; color: var(--heading); border-color: var(--line); padding: 8px 20px; font-size: .9375rem; }
.pill-ghost:hover { background: var(--white); border-color: var(--blue); color: var(--blue); }
.pill.stop { background: var(--navy); }

/* Header */
.top { background: var(--white); border-bottom: 1px solid var(--line); }
.top-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 72px; }
.brand { display: flex; align-items: center; gap: 14px; text-decoration: none; color: var(--heading); font-weight: 500; font-size: 1.0625rem; }
.brand img { height: 32px; width: auto; display: block; }
.brand-sep { width: 1px; height: 24px; background: var(--line); }
.brand img[hidden] + .brand-sep { display: none; }
.top-right { display: flex; align-items: center; gap: 10px; }
.you-label { color: var(--muted); font-size: .875rem; }
.ip-chip { border: 1px solid var(--line); background: var(--paper); border-radius: 999px; padding: 6px 14px; font-family: var(--mono); font-size: .875rem; cursor: pointer; }
.ip-chip:hover { border-color: var(--blue); }

/* Hero: the memorable part, a live map of latency to every PoP */
.hero {
  margin-top: 24px; padding-top: 48px; padding-bottom: 32px;
  background: var(--navy); border-radius: 24px; color: var(--blue-pale);
  max-width: 1192px;
}
.hero-text { max-width: 720px; }
.hero h1 { color: var(--white); font-size: clamp(2.25rem, 1.6rem + 2.4vw, 2.875rem); line-height: 1.1; letter-spacing: -1px; font-weight: 400; margin: 0; }
.hero-text p { margin: 14px 0 0; font-size: 1.125rem; color: #B9CBE4; max-width: 62ch; }
.pops-bar { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; margin: 36px 0 12px; }
.pops-note { margin: 0; font-size: .9375rem; color: #9FB4D1; }
.hero-link { background: none; border: 0; padding: 0; color: var(--white); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; font-size: .9375rem; }
.hero-link:disabled { opacity: .5; cursor: default; }

.pops-vpn { margin: -4px 0 14px; font-size: .8125rem; color: #7E95B3; max-width: 90ch; }
.pops-vpn.warn { color: #FFE3A3; background: rgba(227,169,47,.14); border: 1px solid rgba(227,169,47,.35); border-radius: 12px; padding: 10px 14px; font-size: .875rem; margin-top: 0; }
.pops-vpn.warn strong { color: #FFF; font-weight: 600; }
.pop-vpn { grid-column: 1 / -1; margin-top: 8px; font-size: .75rem; font-weight: 600; color: #FFD27A; }
.pop[aria-current="true"] .pop-vpn { color: #FFF; }
.pop-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.pop {
  width: 100%; text-align: left; cursor: pointer; color: var(--white);
  background: var(--navy-2); border: 1px solid var(--navy-3); border-radius: 16px;
  padding: 14px 16px 14px; display: grid; grid-template-columns: 1fr auto; column-gap: 8px;
}
.pop:hover { border-color: #3B6AA8; }
.pop[aria-current="true"] { background: var(--blue); border-color: var(--blue); }
.pop-code { font-weight: 600; letter-spacing: .02em; }
.pop-city { grid-column: 1; color: #A9BDD8; font-size: .875rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pop[aria-current="true"] .pop-city { color: var(--blue-pale); }
.pop-ms { grid-row: 1 / span 2; grid-column: 2; align-self: center; text-align: right; font-variant-numeric: tabular-nums; font-size: 1.75rem; font-weight: 300; line-height: 1; letter-spacing: -.02em; }
.pop-ms small { font-size: .75rem; font-weight: 500; margin-left: 2px; letter-spacing: 0; color: #A9BDD8; }
.pop[aria-current="true"] .pop-ms small { color: var(--blue-pale); }
.pop-ms.wait { font-size: 1rem; color: #7E95B3; }
.pop-track { grid-column: 1 / -1; height: 3px; background: rgba(255,255,255,.1); border-radius: 2px; margin-top: 12px; overflow: hidden; }
.pop-fill { height: 100%; width: 0; border-radius: 2px; transition: width .7s cubic-bezier(.2,.7,.2,1); background: #7E95B3; }
.pop.good .pop-fill { background: var(--good); }
.pop.fair .pop-fill { background: var(--fair); }
.pop.poor .pop-fill { background: var(--poor); }
.pop[aria-current="true"] .pop-fill { background: var(--white); }
.pop-best { grid-column: 1 / -1; margin-top: 8px; font-size: .75rem; font-weight: 600; color: #6EE0AE; }
.pop[aria-current="true"] .pop-best { color: var(--white); }

/* Main */
.main { padding-top: 40px; padding-bottom: 56px; }
.site-head { margin-bottom: 20px; }
.site-title { margin: 0; font-size: clamp(1.75rem, 1.3rem + 1.4vw, 2.25rem); font-weight: 400; letter-spacing: -1px; line-height: 1.15; }
.site-code { color: var(--muted); font-size: .6em; font-weight: 500; letter-spacing: 0; margin-left: 6px; }
.site-port { display: inline-block; vertical-align: middle; margin-left: 8px; padding: 3px 12px; border-radius: 32px; background: var(--blue-pale); color: var(--navy); font-size: .9rem; font-weight: 500; letter-spacing: 0; }
.notice { margin: 14px 0 0; padding: 12px 16px; border-radius: 12px; background: #FFF4DD; color: #5A4300; max-width: 70ch; }

.grid { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 20px; align-items: start; }
.col-main, .col-side { display: grid; gap: 20px; min-width: 0; }
.card { background: var(--white); border: 1px solid var(--line); border-radius: 16px; padding: 24px; }
.card-title { margin: 0; font-size: 1.25rem; }
.card-sub { margin: 4px 0 16px; color: var(--muted); font-size: .9375rem; max-width: 60ch; }

/* Test form */
.test .card-title { margin-bottom: 16px; }
.field-label { display: block; font-weight: 500; color: var(--heading); font-size: .9375rem; margin-bottom: 6px; }
.target-row { display: flex; gap: 10px; }
.target-row input {
  flex: 1; min-width: 0; padding: 12px 18px; border: 1px solid var(--line); border-radius: 32px;
  background: var(--paper); font-family: var(--mono); font-size: 1rem; color: var(--heading);
}
.target-row input:focus { border-color: var(--blue); outline: none; box-shadow: 0 0 0 3px var(--blue-pale); background: var(--white); }
.controls { display: flex; flex-wrap: wrap; gap: 10px 16px; margin-top: 16px; justify-content: space-between; }
.seg { display: inline-flex; flex-wrap: wrap; border: 0; border-radius: 32px; padding: 4px; margin: 0; gap: 2px; background: var(--paper); }
.seg-wrap { border-radius: 20px; }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seg span { display: block; padding: 7px 16px; border-radius: 32px; font-size: .9375rem; cursor: pointer; color: var(--ink); }
.seg input:checked + span { background: var(--blue); color: var(--white); font-weight: 500; }
.seg input:focus-visible + span { outline: 3px solid var(--blue); outline-offset: 1px; }
.seg input:disabled + span { opacity: .4; cursor: not-allowed; }
.cmd-desc { margin: 12px 0 0; color: var(--muted); font-size: .875rem; }

/* Terminal */
.term { background: var(--term-bg); color: var(--term-ink); border-radius: 16px; overflow: hidden; }
.term-bar { display: flex; align-items: center; gap: 12px; padding: 12px 14px 12px 20px; border-bottom: 1px solid rgba(219,235,255,.08); }
.term-title { margin: 0; font-size: .9375rem; font-weight: 500; color: var(--white); }
.term-status { flex: 1; color: var(--term-dim); font-size: .875rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.term-status.live::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #4FD1A1; margin-right: 8px; vertical-align: 1px; animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .3; } }
.term-actions { display: flex; gap: 6px; }
.term-btn { background: rgba(219,235,255,.1); border: 0; color: var(--term-ink); border-radius: 32px; padding: 5px 14px; font-size: .8125rem; cursor: pointer; }
.term-btn:hover:not(:disabled) { background: rgba(219,235,255,.2); }
.term-btn:disabled { opacity: .4; cursor: default; }
.term-out { margin: 0; padding: 18px 20px 22px; min-height: 300px; max-height: 600px; overflow: auto; font: .875rem/1.6 var(--mono); white-space: pre; tab-size: 8; }
.term-out .dim { color: var(--term-dim); white-space: pre-wrap; font-family: var(--font); }
.term-out .cmd { color: #7DB4FF; }
.term-out .err { color: #FF9C94; white-space: pre-wrap; }

/* Side cards */
.ips { margin: 0; display: grid; gap: 8px; }
.ips div { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 14px; background: var(--paper); border-radius: 12px; }
.ips dt { color: var(--muted); font-size: .875rem; }
.ips dd { margin: 0; min-width: 0; }
.copyable { font-family: var(--mono); font-size: .875rem; color: var(--heading); background: none; border: 0; padding: 2px 4px; margin: -2px -4px; border-radius: 6px; cursor: pointer; overflow-wrap: anywhere; text-align: right; }
.copyable:hover { background: var(--blue-pale); }
.ports { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.port { font-family: var(--mono); font-size: .8125rem; padding: 4px 10px; border-radius: 32px; background: var(--paper); border: 1px solid var(--line); cursor: pointer; color: var(--heading); }
.port[aria-pressed="true"] { background: var(--blue); color: var(--white); border-color: var(--blue); }
.cmds { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.cmd-label { font-size: .8125rem; color: var(--muted); margin: 0 0 4px; }
.cmd-line { display: flex; align-items: stretch; background: var(--term-bg); border-radius: 12px; overflow: hidden; }
.cmd-line code { flex: 1; min-width: 0; padding: 10px 14px; color: var(--term-ink); font: .8125rem/1.5 var(--mono); overflow-x: auto; white-space: pre; }
.cmd-copy { border: 0; background: rgba(219,235,255,.1); color: var(--term-ink); padding: 0 14px; cursor: pointer; font-size: .8125rem; }
.cmd-copy:hover { background: var(--blue); color: var(--white); }

/* Speed */
.speed { margin-top: 20px; }
.speed-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 40px; }
.gauge { display: flex; align-items: baseline; gap: 10px; margin-top: 8px; }
.gauge-value { font-size: clamp(3rem, 2rem + 3vw, 4.5rem); font-weight: 300; line-height: 1; letter-spacing: -.03em; color: var(--heading); font-variant-numeric: tabular-nums; }
.gauge-unit { color: var(--muted); font-weight: 500; font-size: 1.125rem; }
.bar { height: 6px; background: var(--paper); border-radius: 3px; margin-top: 16px; overflow: hidden; }
.bar-fill { height: 100%; width: 0; background: var(--blue); border-radius: 3px; }
.gauge-meta { color: var(--muted); font-size: .875rem; margin: 8px 0 18px; font-variant-numeric: tabular-nums; min-height: 1.4em; }
.fine { color: var(--muted); font-size: .8125rem; margin: 16px 0 0; max-width: 52ch; }
.speed-files { min-width: 0; border-left: 1px solid var(--line); padding-left: 40px; }
.speed-files .seg { margin-bottom: 10px; display: flex; width: fit-content; }
.speed-files .cmds { margin-top: 6px; }
.file-link { display: inline-block; margin-top: 12px; font-size: .9375rem; }

/* Footer, navy with rounded top like the main site */
.foot { background: var(--navy); color: #CED1D3; border-radius: 24px 24px 0 0; }
.foot-inner { display: flex; justify-content: space-between; align-items: end; gap: 24px; padding-top: 40px; padding-bottom: 40px; flex-wrap: wrap; }
.foot-title { color: var(--white); font-size: 1.5rem; font-weight: 400; letter-spacing: -.5px; margin: 0 0 16px; }
.foot-meta { margin: 0; font-size: .8125rem; color: #9DA4A7; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--navy); color: var(--white); padding: 10px 18px; border-radius: 32px; font-size: .875rem; opacity: 0; transition: opacity .2s; pointer-events: none; z-index: 20; }
.toast.show { opacity: 1; }

@media (max-width: 1000px) {
  .grid { grid-template-columns: 1fr; }
  .speed-grid { grid-template-columns: 1fr; gap: 28px; }
  .speed-files { border-left: 0; padding-left: 0; border-top: 1px solid var(--line); padding-top: 24px; }
}
@media (max-width: 640px) {
  .wrap { padding-left: 16px; padding-right: 16px; }
  .hero { margin: 12px 12px 0; padding-top: 32px; border-radius: 20px; }
  .pop-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .pop { padding: 12px; }
  .pop-ms { font-size: 1.375rem; }
  .you-label, #cta, .brand-sep, #brand-name { display: none; }
  /* Tiles: city gets its own full-width line instead of being cut off */
  .pop { grid-template-columns: 1fr auto; row-gap: 2px; }
  .pop-ms { grid-row: 1; }
  .pop-city { grid-column: 1 / -1; white-space: normal; overflow: visible; }
  /* Test picker as an even 2x2 grid; size/tool pickers wrap evenly */
  #commands { display: grid; grid-template-columns: 1fr 1fr; width: 100%; border-radius: 20px; }
  #commands span, #file-sizes span, #file-tools span { text-align: center; }
  #file-sizes { display: grid; grid-template-columns: repeat(3, 1fr); width: 100%; }
  #file-tools { display: grid; grid-template-columns: 1fr 1fr; width: 100%; }
  #file-tools label:last-child { grid-column: 1 / -1; }
  /* Show whole commands on small screens instead of a sideways scroll */
  .cmd-line { flex-direction: column; }
  .cmd-line code { white-space: pre-wrap; }
  .cmd-line .tok { display: inline-block; max-width: 100%; overflow-wrap: anywhere; }
  .cmd-copy { padding: 8px 14px; text-align: right; }
  .term-out { min-height: 200px; }
  .target-row { flex-direction: column; }
  .card { padding: 18px; }
  .pops-bar { flex-direction: column; gap: 4px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
