/* KT8 Speed Test: the test form, the home page sections and the results page.
   Built on kt8.com's /assets/site.css and the KT8 Tools look in tools.css. */
:root {
	--card: var(--sheet); --mute: var(--ink-soft); --accent: var(--post); --soft: var(--post-soft);
	--g-a: #0f8a3c; --g-b: #5a9e1a; --g-c: #b08900; --g-d: #d9750b; --g-e: #d4541a; --g-f: #c62828; --ok: #b08900;
	--good: var(--g-a); --bad: var(--g-f);
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --g-a: #34c26a; --g-b: #8fcf4a; --g-c: #e3bd2f; --g-d: #f39a3c; --g-e: #f2753f; --g-f: #f26464; --ok: #e3bd2f; } }

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.btn.ghost { background: var(--sheet); color: var(--ink); border-color: var(--line-2); box-shadow: var(--shadow-sm); }
.btn.ghost:hover { border-color: var(--ink-faint); }
.btn:disabled { opacity: .6; cursor: progress; }
.msg { margin: 10px 0 0; font-size: 1.05rem; color: var(--ink); }
.msg.err { color: var(--g-f); font-weight: 600; }
.note { color: var(--ink-soft); font-size: 1rem; }
details summary { cursor: pointer; }

/* The test form, in the tool card. */
.tool-card .url-row input { font-size: 1.2rem; padding: 15px 16px; border-width: 2px; border-radius: 14px; }
.tool-card .url-row button { font-size: 1.15rem; padding: 15px 26px; border-radius: 14px; }
.opts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 16px; }
.opts label { display: grid; gap: 6px; font-size: 0.95rem; font-weight: 600; color: var(--ink); }
.opts select { font: inherit; font-size: 1rem; color: var(--ink); background: var(--bg); border: 1px solid var(--line-2); border-radius: 12px; padding: 10px 12px; width: 100%; }
.opts select:focus { outline: 2px solid var(--post); outline-offset: 1px; }
.check { margin-top: 16px; }
.ticks { list-style: none; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 24px; padding: 0; margin: 22px 0 0; font-size: 1.05rem; color: var(--ink); }
.ticks li::before { content: "✓"; color: var(--pass); font-weight: 700; margin-right: 8px; }
#tester.tool-card { max-width: 860px; }
@media (max-width: 700px) { .opts { grid-template-columns: minmax(0, 1fr); } .url-row button { width: 100%; } }

/* Home page sections below the hero. */
.block { padding: 64px 0 8px; }
.block h2 { font-size: clamp(1.8rem, 1.4rem + 1.6vw, 2.4rem); letter-spacing: -0.03em; line-height: 1.1; margin: 0 0 10px; text-align: center; }
.block .sub { font-size: 1.2rem; color: var(--ink); opacity: .82; text-align: center; max-width: 40rem; margin: 0 auto 30px; }
.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.card { background: var(--sheet); border: 1px solid var(--line); border-radius: 18px; padding: 24px; box-shadow: var(--shadow-sm); }
.card h3 { font-size: 1.15rem; letter-spacing: -0.01em; margin: 12px 0 6px; }
.card p { margin: 0; color: var(--ink); font-size: 1.05rem; }
.card .ico { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--post-soft); color: var(--post); }
.card .ico svg { width: 24px; height: 24px; }
.badge { display: inline-block; font-size: 0.8rem; font-weight: 600; padding: 3px 10px; border-radius: 999px; background: var(--bg-2); color: var(--ink-soft); border: 1px solid var(--line); }
.uk-band { margin: 64px 0 0; padding: 48px 24px; text-align: center; background: var(--bg-2); border: 1px solid var(--line); border-radius: 24px; }
.uk-band .sub { margin-bottom: 24px; }
@media (max-width: 860px) { .grid, .grid.two { grid-template-columns: minmax(0, 1fr); } }

/* Results */
main.result { padding: 30px 0 60px; }
.r-head { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 26px; align-items: start; }
.r-shot { border-radius: 12px; overflow: hidden; border: 1px solid var(--line); background: var(--bg); aspect-ratio: 1350 / 940; }
.r-shot.mobile { aspect-ratio: auto; max-width: 180px; }
.r-shot img { display: block; width: 100%; height: auto; }
.r-head h1 { font-size: clamp(30px, 4vw, 44px); letter-spacing: -0.03em; margin: 0; line-height: 1.1; }
.r-url { margin: 8px 0 14px; font-size: 19px; word-break: break-all; }
.r-url a { color: var(--ink); font-weight: 600; }
dl.r-info { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 4px 16px; margin: 0; font-size: 17px; }
dl.r-info dt { color: var(--mute); }
dl.r-info dd { margin: 0; }
.r-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.r-actions .btn { padding: 10px 18px; font-size: 16px; }

.r-scores { display: grid; grid-template-columns: 200px repeat(2, minmax(0, 1fr)) minmax(0, 2fr); gap: 16px; margin-top: 18px; }
.grade { display: grid; place-items: center; text-align: center; border-radius: 20px; color: #fff; padding: 18px; }
.grade b { font-size: 84px; line-height: 1; font-weight: 800; }
.grade small { font-size: 15px; font-weight: 650; opacity: .95; }
.g-A { background: var(--g-a); } .g-B { background: var(--g-b); } .g-C { background: var(--g-c); } .g-D { background: var(--g-d); } .g-E { background: var(--g-e); } .g-F { background: var(--g-f); }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 20px 22px; }
.tile h3 { margin: 0; font-size: 16px; color: var(--mute); font-weight: 650; }
.tile .big { font-size: 46px; font-weight: 800; letter-spacing: -0.03em; line-height: 1.15; }
.tile p { margin: 4px 0 0; color: var(--mute); font-size: 15.5px; }
.bar { height: 8px; border-radius: 99px; background: var(--line); overflow: hidden; margin-top: 8px; }
.bar i { display: block; height: 100%; border-radius: 99px; }
.vitals { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.vitals div { min-width: 0; }
.vitals b { display: block; font-size: 30px; letter-spacing: -0.02em; }
.vitals span { display: block; line-height: 1.3; font-size: 15px; color: var(--mute); }
.good { color: var(--g-a); } .ok { color: var(--ok); } .poor { color: var(--g-f); }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; }
.dot.good { background: var(--g-a); } .dot.ok { background: var(--ok); } .dot.poor { background: var(--g-f); }

.r-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 30px 0 18px; border-bottom: 1px solid var(--line); }
.r-tabs button { font: inherit; font-size: 18px; font-weight: 650; color: var(--mute); background: none; border: 0; border-bottom: 3px solid transparent; padding: 10px 14px; cursor: pointer; margin-bottom: -1px; }
.r-tabs button[aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); }
.r-tabs .count { display: inline-block; min-width: 22px; padding: 0 7px; border-radius: 99px; background: var(--soft); color: var(--accent); font-size: 14px; margin-left: 6px; }
section.panel h2 { font-size: 26px; letter-spacing: -0.02em; margin: 26px 0 12px; }
section.panel h2:first-child { margin-top: 0; }

.strip { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 8px; }
.strip figure { margin: 0; flex: none; width: 150px; text-align: center; }
.strip.mobile figure { width: 96px; }
.strip.mobile img { aspect-ratio: 280 / 560; }
.strip img { display: block; width: 100%; aspect-ratio: 480 / 334; object-fit: cover; object-position: top; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.strip figcaption { font-size: 14px; color: var(--mute); margin-top: 6px; }
.strip figcaption b { color: var(--ink); }
.strip figure.mark img { outline: 3px solid var(--accent); outline-offset: -1px; }
.marks { display: flex; flex-wrap: wrap; gap: 8px 20px; margin: 12px 0 0; font-size: 16px; }
.marks span::before { content: ""; display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; background: var(--c); }

.stats3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.mix { display: flex; height: 22px; border-radius: 8px; overflow: hidden; margin: 14px 0 10px; background: var(--line); }
.mix i { display: block; height: 100%; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 16px; color: var(--ink); }
.legend span::before { content: ""; display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; background: var(--c); }
.legend small { color: var(--mute); font-size: 14.5px; }

ul.issues { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.issue { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 16px 20px; }
.issue h3 { margin: 0; font-size: 19px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.issue p { margin: 6px 0 0; color: var(--ink); font-size: 17.5px; }
.issue .save { color: var(--mute); font-size: 15.5px; margin-top: 4px; }
.impact { font-size: 13px; font-weight: 750; text-transform: uppercase; letter-spacing: .04em; padding: 3px 10px; border-radius: 99px; }
.impact.high { background: #fde4e1; color: #a1251b; } .impact.medium { background: #fff1d1; color: #7a4b00; } .impact.low { background: var(--soft); color: var(--accent); }
@media (prefers-color-scheme: dark) { .impact.high { background: #4a1d1a; color: #ffb4a8; } .impact.medium { background: #3d2e10; color: #f5d27a; } }
.issue details { margin: 10px 0 0; background: none; border: 0; padding: 0; }
.issue details summary { font-size: 16px; color: var(--accent); }
.issue ol { margin: 8px 0 0; padding-left: 22px; font-size: 15px; }
.issue ol li { margin: 4px 0; word-break: break-all; }
.issue ol small { color: var(--mute); word-break: normal; }
.none { color: var(--good); font-weight: 650; }

table.metrics { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; font-size: 17px; }
table.metrics th, table.metrics td { padding: 12px 16px; border-bottom: 1px solid var(--line); text-align: left; }
table.metrics thead th { font-size: 14.5px; color: var(--mute); }
table.metrics tr:last-child td { border-bottom: 0; }
table.metrics td.num { font-weight: 700; white-space: nowrap; }
table.metrics td small { display: block; color: var(--mute); font-size: 14.5px; }

/* Waterfall */
.wf-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: 16px; }
table.wf { width: 100%; min-width: 860px; border-collapse: collapse; font-size: 14px; }
table.wf th, table.wf td { padding: 5px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; text-align: left; }
table.wf thead th { position: sticky; top: 0; background: var(--card); color: var(--mute); font-weight: 650; }
table.wf td.name { max-width: 300px; overflow: hidden; text-overflow: ellipsis; }
table.wf td.name small { color: var(--mute); }
table.wf td.r { text-align: right; }
table.wf tr.bad td { color: var(--bad); }
table.wf td.tl { width: 45%; min-width: 320px; position: relative; padding: 0; }
.tl-in { position: relative; height: 26px; margin: 0 10px; }
.tl-in .seg { position: absolute; top: 8px; height: 10px; }
.tl-in .t { position: absolute; top: 4px; font-size: 12px; color: var(--mute); padding-left: 4px; }
.tl-in .ln { position: absolute; top: 0; bottom: 0; width: 2px; opacity: .55; }
.ph-blocked { background: #c7c7cf; } .ph-dns { background: #2a9d8f; } .ph-connect { background: #e76f51; } .ph-ssl { background: #9b5de5; } .ph-send { background: #577590; } .ph-wait { background: #f4a261; } .ph-receive { background: #2f6fed; }

.filmstrip-full { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; }
.filmstrip-full.mobile { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
.filmstrip-full figure { margin: 0; }
.filmstrip-full img { display: block; width: 100%; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.filmstrip-full figcaption { font-size: 15px; margin-top: 4px; color: var(--mute); }
.filmstrip-full figcaption b { color: var(--ink); }

/* While the test runs */
.waiting { max-width: 640px; margin: 40px auto; text-align: center; background: var(--card); border: 1px solid var(--line); border-radius: 22px; padding: 36px 28px; }
.waiting h1 { font-size: 34px; letter-spacing: -0.02em; margin: 0 0 6px; }
.waiting .r-url { margin: 0 0 22px; }
ol.progress { list-style: none; padding: 0; margin: 0 auto; display: grid; gap: 10px; text-align: left; max-width: 360px; font-size: 18px; }
ol.progress li { color: var(--mute); }
ol.progress li::before { content: "○"; display: inline-block; width: 26px; color: var(--mute); }
ol.progress li.now { color: var(--ink); font-weight: 650; }
ol.progress li.now::before { content: "◐"; color: var(--accent); animation: spin 1s linear infinite; display: inline-block; }
ol.progress li.done { color: var(--ink); }
ol.progress li.done::before { content: "✓"; color: var(--good); font-weight: 800; }
@keyframes spin { to { transform: rotate(360deg); } }
.waiting .note { margin-top: 22px; }
.failed { border-color: var(--bad); }

@media (max-width: 900px) {
	.r-head { grid-template-columns: minmax(0, 1fr); }
	.r-shot { max-width: 420px; }
	.r-scores { grid-template-columns: repeat(3, minmax(0, 1fr)); }
	.r-scores .tile.vt { grid-column: 1 / -1; }
}
@media (max-width: 600px) {
	.r-scores { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
	.r-scores .grade { grid-column: 1 / -1; grid-template-columns: auto auto; justify-content: center; gap: 16px; }
	.grade b { font-size: 64px; }
	.stats3 { grid-template-columns: minmax(0, 1fr); }
	.vitals b { font-size: 24px; }
	.tile .big { font-size: 38px; }
	.r-tabs button { font-size: 16px; padding: 8px 10px; }
}
