/* Speed Test — Apple-minimal, self-contained (shares the site's token
   values from app-style.css; tools with their own style.css do not get
   the shared sheet, so the tokens and the classes this page uses are
   duplicated here). */
:root {
  color-scheme: light;
  font: 16px/1.55 -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "PingFang SC", "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-variant-numeric: tabular-nums;
  --canvas: #f5f5f7;
  --surface: #fff;
  --recessed: #f5f5f7;
  --ink: #1d1d1f;
  --muted: #65656b;
  --line: rgb(0 0 0 / .06);
  --control-line: rgb(0 0 0 / .14);
  --selected: rgb(0 0 0 / .075);
  --accent: #0071e3;
  --accent-hover: #0065cc;
  --accent-ink: #fff;
  --motion: .2s cubic-bezier(.16, 1, .3, 1);
  --good: #1f9d55;
  --warn: #b7791f;
  --bad: #d9481c;
  color: var(--ink);
  background: var(--canvas);
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --canvas: #161618;
  --surface: #1e1e20;
  --recessed: #242426;
  --ink: #f5f5f7;
  --muted: #ababaf;
  --line: rgb(255 255 255 / .08);
  --control-line: rgb(255 255 255 / .19);
  --selected: rgb(255 255 255 / .10);
  --accent: #5aaaf9;
  --accent-hover: #7bbaff;
  --accent-ink: #101820;
  --good: #4cc38a;
  --warn: #e0a63f;
  --bad: #f26d4d;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; transition: background-color var(--motion), color var(--motion); }
main { width: min(560px, calc(100% - 32px)); margin: clamp(32px, 7vw, 80px) auto; }
h1 { font-size: clamp(2.25rem, 5vw, 4rem); font-weight: 600; line-height: 1.12; letter-spacing: -.045em; margin: 16px 0 8px; }
h2 { font-size: 1.25rem; font-weight: 600; margin: 0; }
p { color: var(--muted); margin: 0; }
a { color: var(--ink); text-underline-offset: .2em; }
.subtitle { color: var(--ink); font-size: 1.05rem; font-weight: 500; }
.lede { margin-top: 8px; }
.badges { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 12px; font-size: 14px; }
.badges span { color: var(--muted); }
.panel { display: grid; gap: 24px; margin-block-start: 32px; border: 1px solid var(--line); border-radius: 24px; padding: clamp(16px, 4vw, 32px); background: var(--surface); }
.buttons { display: flex; flex-wrap: wrap; gap: 12px; }
button { display: inline-flex; justify-content: center; align-items: center; background: var(--accent); color: var(--accent-ink); border: 1px solid transparent; border-radius: 8px; min-height: 44px; font: inherit; font-size: 14px; font-weight: 500; padding: 8px 16px; text-decoration: none; cursor: pointer; transition: background-color var(--motion), transform var(--motion); }
button:hover { background: var(--accent-hover); }
button:active { transform: scale(.98); }
button.secondary { background: transparent; color: var(--ink); border-color: var(--control-line); }
button.secondary:hover { background: var(--selected); }
button:disabled { opacity: .45; cursor: default; transform: none; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.note { margin-top: 24px; font-size: 13px; }
.brand-line { margin-top: 8px; font-size: 13px; color: var(--muted); }

/* Results: three cards in a row (stack on narrow screens). */
.results { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.result { border: 1px solid var(--line); border-radius: 16px; padding: 16px 12px; text-align: center; background: var(--recessed); overflow: hidden; }
.result.active { border-color: var(--accent); }
.result-label { font-size: 14px; font-weight: 500; color: var(--muted); }
.result-value { font-size: clamp(1.05rem, 4vw, 1.7rem); font-weight: 600; letter-spacing: -.02em; margin-top: 6px; min-height: 1.2em; white-space: nowrap; }
.result-sub { font-size: 12px; color: var(--muted); margin-top: 4px; min-height: 1.4em; }
@media (max-width: 420px) {
  .results { grid-template-columns: 1fr; }
  .result { padding: 12px; }
}

/* Progress bar + status line. */
.progress { display: grid; gap: 8px; }
.progress-bar { height: 8px; border-radius: 999px; background: var(--recessed); overflow: hidden; border: 1px solid var(--line); }
.progress-bar span { display: block; height: 100%; width: 0; border-radius: 999px; background: var(--accent); transition: width .15s linear; }
.progress-bar.indeterminate span { width: 40%; animation: slide 1.2s ease-in-out infinite alternate; }
@keyframes slide { from { margin-left: 0; } to { margin-left: 60%; } }
.progress-text { font-size: 14px; }
@media (prefers-reduced-motion: reduce) {
  .progress-bar.indeterminate span { animation: none; width: 40%; margin-left: 30%; }
}

/* Grade badge + use note. */
.grade { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; font-size: 15px; }
.grade-badge { display: inline-flex; align-items: center; border-radius: 999px; padding: 4px 12px; font-size: 14px; font-weight: 600; background: var(--selected); }
.grade-badge.good { color: var(--good); }
.grade-badge.warn { color: var(--warn); }
.grade-badge.bad { color: var(--bad); }

/* Error / status message. */
.msg { min-height: 1.4em; font-size: 14px; }
.msg.error { color: var(--bad); }
