/**
 * Network Speed Test — front end.
 *
 * Every rule is scoped under .nspt, and every property a theme is likely to
 * have set globally (button appearance, heading margins, list spacing, link
 * colour) is restated rather than inherited. That is what makes the widget
 * look the same in a stripped block theme and in a heavy page-builder theme.
 */

/* --------------------------------------------------------------------------
   Tokens — light is the base, dark overrides below.
   -------------------------------------------------------------------------- */

.nspt.nspt {
	--nspt-accent: #3ec99a;
	--nspt-action: #7c4dff;

	--nspt-bg: #ffffff;
	--nspt-surface: rgba(15, 23, 20, 0.04);
	--nspt-surface-2: rgba(15, 23, 20, 0.06);
	--nspt-line: rgba(15, 23, 20, 0.1);
	--nspt-fg: #10201b;
	--nspt-muted: #5d6b64;
	--nspt-shadow: 0 1px 2px rgba(16, 32, 27, 0.06), 0 12px 32px rgba(16, 32, 27, 0.07);
	--nspt-danger-bg: rgba(200, 45, 45, 0.1);
	--nspt-danger-fg: #a12222;

	--nspt-radius: 20px;
	--nspt-radius-sm: 14px;
	--nspt-pad: 32px;
	--nspt-gap: 20px;

	/* Layout: overridden per modifier. */
	--nspt-max: 640px;

	box-sizing: border-box;
	display: block;
	width: 100%;
	max-width: var(--nspt-max);
	margin-left: auto;
	margin-right: auto;
	padding: var(--nspt-pad);
	border-radius: var(--nspt-radius);
	background: var(--nspt-bg);
	box-shadow: var(--nspt-shadow);
	color: var(--nspt-fg);
	font-family: inherit;
	font-size: 16px;
	font-weight: 400;
	line-height: 1.6;
	letter-spacing: normal;
	text-transform: none;
	-webkit-font-smoothing: antialiased;
	/* Keeps theme filters and blend modes from bleeding into the widget. */
	isolation: isolate;
}

.nspt.nspt *,
.nspt.nspt *::before,
.nspt.nspt *::after {
	box-sizing: inherit;
}

/* A theme rule such as `button { display: inline-flex }` outranks the user
   agent's [hidden] rule, which would leave "Copy results" on screen before
   there are any. Hiding is not negotiable, so it wins outright. */
.nspt.nspt [hidden] {
	display: none !important;
}

/* Dark tokens, applied by three routes: an explicit setting, the visitor's
   system preference under "auto", and the runtime toggle. */
.nspt.nspt[data-nspt-theme='dark'] {
	--nspt-bg: #0d1512;
	--nspt-surface: rgba(255, 255, 255, 0.05);
	--nspt-surface-2: rgba(255, 255, 255, 0.08);
	--nspt-line: rgba(255, 255, 255, 0.1);
	--nspt-fg: #f2f5f3;
	--nspt-muted: #93a29a;
	--nspt-shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 18px 44px rgba(0, 0, 0, 0.35);
	--nspt-danger-bg: rgba(226, 75, 74, 0.14);
	--nspt-danger-fg: #f09595;
}

@media (prefers-color-scheme: dark) {
	.nspt.nspt[data-nspt-theme='auto'] {
		--nspt-bg: #0d1512;
		--nspt-surface: rgba(255, 255, 255, 0.05);
		--nspt-surface-2: rgba(255, 255, 255, 0.08);
		--nspt-line: rgba(255, 255, 255, 0.1);
		--nspt-fg: #f2f5f3;
		--nspt-muted: #93a29a;
		--nspt-shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 18px 44px rgba(0, 0, 0, 0.35);
		--nspt-danger-bg: rgba(226, 75, 74, 0.14);
		--nspt-danger-fg: #f09595;
	}
}

/* The runtime toggle writes data-nspt-scheme. These come last so they win
   over both the setting and the media query, in either direction. */
.nspt.nspt[data-nspt-scheme='dark'] {
	--nspt-bg: #0d1512;
	--nspt-surface: rgba(255, 255, 255, 0.05);
	--nspt-surface-2: rgba(255, 255, 255, 0.08);
	--nspt-line: rgba(255, 255, 255, 0.1);
	--nspt-fg: #f2f5f3;
	--nspt-muted: #93a29a;
	--nspt-shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 18px 44px rgba(0, 0, 0, 0.35);
	--nspt-danger-bg: rgba(226, 75, 74, 0.14);
	--nspt-danger-fg: #f09595;
}

.nspt.nspt[data-nspt-scheme='light'] {
	--nspt-bg: #ffffff;
	--nspt-surface: rgba(15, 23, 20, 0.04);
	--nspt-surface-2: rgba(15, 23, 20, 0.06);
	--nspt-line: rgba(15, 23, 20, 0.1);
	--nspt-fg: #10201b;
	--nspt-muted: #5d6b64;
	--nspt-shadow: 0 1px 2px rgba(16, 32, 27, 0.06), 0 12px 32px rgba(16, 32, 27, 0.07);
	--nspt-danger-bg: rgba(200, 45, 45, 0.1);
	--nspt-danger-fg: #a12222;
}

/* Inherit mode borrows the page's own colours: no background, no shadow, and
   surfaces mixed from whatever the text colour happens to be. */
.nspt.nspt[data-nspt-theme='inherit'] {
	--nspt-bg: transparent;
	--nspt-fg: inherit;
	--nspt-muted: inherit;
	--nspt-surface: rgba(128, 128, 128, 0.08);
	--nspt-surface-2: rgba(128, 128, 128, 0.14);
	--nspt-line: rgba(128, 128, 128, 0.25);
	--nspt-shadow: none;

	padding-left: 0;
	padding-right: 0;
	color: inherit;
}

@supports (color: color-mix(in srgb, currentColor 8%, transparent)) {
	.nspt.nspt[data-nspt-theme='inherit'] {
		--nspt-surface: color-mix(in srgb, currentColor 6%, transparent);
		--nspt-surface-2: color-mix(in srgb, currentColor 12%, transparent);
		--nspt-line: color-mix(in srgb, currentColor 18%, transparent);
	}
}

.nspt.nspt[data-nspt-theme='inherit'] .nspt__muted,
.nspt.nspt[data-nspt-theme='inherit'] .nspt__intro,
.nspt.nspt[data-nspt-theme='inherit'] .nspt__note,
.nspt.nspt[data-nspt-theme='inherit'] .nspt__phase {
	opacity: 0.72;
}

/* --------------------------------------------------------------------------
   Layout modifiers
   -------------------------------------------------------------------------- */

.nspt.nspt--layout-card {
	--nspt-max: 640px;
}

.nspt.nspt--layout-wide {
	--nspt-max: 960px;
}

.nspt.nspt--layout-full {
	--nspt-max: none;
	--nspt-pad: clamp(20px, 4vw, 44px);
	--nspt-radius: 0;

	border-radius: 0;
}

.nspt.nspt--density-compact {
	--nspt-pad: 20px;
	--nspt-gap: 14px;
	--nspt-radius: 16px;
	font-size: 15px;
}

.nspt.nspt--align-center {
	text-align: center;
}

.nspt.nspt--align-left {
	text-align: left;
}

.nspt.nspt .nspt__inner {
	display: flex;
	flex-direction: column;
	gap: var(--nspt-gap);
	min-width: 0;
}

/* --------------------------------------------------------------------------
   Header
   -------------------------------------------------------------------------- */

.nspt.nspt .nspt__header {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 16px;
}

.nspt.nspt--align-center .nspt__header {
	justify-content: center;
}

.nspt.nspt--align-center .nspt__titles {
	flex: 1 1 auto;
}

.nspt.nspt .nspt__titles {
	min-width: 0;
}

.nspt.nspt .nspt__heading {
	margin: 0 0 6px;
	padding: 0;
	border: 0;
	font-family: inherit;
	font-size: clamp(20px, 2.4vw, 26px);
	font-weight: 600;
	line-height: 1.25;
	letter-spacing: -0.01em;
	text-transform: none;
	color: var(--nspt-fg);
}

.nspt.nspt .nspt__intro {
	margin: 0;
	padding: 0;
	font-size: 14px;
	line-height: 1.55;
	color: var(--nspt-muted);
}

/* --------------------------------------------------------------------------
   Buttons — restated from scratch, because themes style every button on the
   page and a speed test that inherits an uppercase pill looks broken.
   -------------------------------------------------------------------------- */

.nspt.nspt button {
	appearance: none;
	-webkit-appearance: none;
	margin: 0;
	padding: 0;
	border: 0;
	background: none;
	box-shadow: none;
	color: inherit;
	font: inherit;
	line-height: 1.2;
	letter-spacing: normal;
	text-transform: none;
	text-decoration: none;
	text-shadow: none;
	cursor: pointer;
	min-height: 0;
	min-width: 0;
	width: auto;
	height: auto;
	transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease, transform 120ms ease;
}

.nspt.nspt .nspt__theme-toggle {
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 38px;
	height: 38px;
	border: 1px solid var(--nspt-line);
	border-radius: 999px;
	color: var(--nspt-fg);
	background: var(--nspt-surface);
}

.nspt.nspt .nspt__theme-toggle:hover {
	color: var(--nspt-fg);
	background: var(--nspt-surface-2);
}

.nspt.nspt .nspt__icon {
	flex: 0 0 auto;
	width: 18px;
	height: 18px;
	fill: none;
	stroke: currentColor;
	stroke-width: 1.9;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.nspt.nspt .nspt__icon--moon {
	display: none;
}

/* Which glyph shows is the *target* scheme, not the current one. */
.nspt.nspt[data-nspt-scheme='dark'] .nspt__icon--sun,
.nspt.nspt[data-nspt-theme='dark']:not([data-nspt-scheme='light']) .nspt__icon--sun {
	display: none;
}

.nspt.nspt[data-nspt-scheme='dark'] .nspt__icon--moon,
.nspt.nspt[data-nspt-theme='dark']:not([data-nspt-scheme='light']) .nspt__icon--moon {
	display: block;
}

@media (prefers-color-scheme: dark) {
	.nspt.nspt[data-nspt-theme='auto']:not([data-nspt-scheme]) .nspt__icon--sun {
		display: none;
	}

	.nspt.nspt[data-nspt-theme='auto']:not([data-nspt-scheme]) .nspt__icon--moon {
		display: block;
	}
}

/* --------------------------------------------------------------------------
   Stage: live readout, graph, progress
   -------------------------------------------------------------------------- */

.nspt.nspt .nspt__cols {
	display: flex;
	flex-direction: column;
	gap: var(--nspt-gap);
	min-width: 0;
}

.nspt.nspt--info-top .nspt__cols .nspt__info {
	order: -1;
}

.nspt.nspt .nspt__stage {
	position: relative;
	display: flex;
	flex-direction: column;
	gap: 12px;
	min-width: 0;
	padding: 16px 18px;
	border-radius: 14px;
	background: var(--nspt-surface);
}

/* Tiles sit on the card, so they need the darker surface to read as raised. */
.nspt.nspt .nspt__stage .nspt__tile {
	background: var(--nspt-surface-2);
}

.nspt.nspt .nspt__go {
	position: relative;
	display: none;
	align-items: center;
	justify-content: center;
	width: clamp(140px, 22vw, 190px);
	height: clamp(140px, 22vw, 190px);
	/* Auto margins on every side centre it in whatever space the card has
	   left between the pills above and the tiles below. */
	margin: auto;
	flex: 0 0 auto;
	border: 2px solid var(--nspt-accent);
	border-radius: 50%;
	background: transparent;
	color: var(--nspt-accent);
	font-size: clamp(26px, 3.4vw, 34px);
	font-weight: 600;
	letter-spacing: 0.06em;
}

/* Shown only while the widget is at rest; once a test starts the live readout
   takes this spot. */
.nspt.nspt:not(.is-running):not(.is-done) .nspt__go {
	display: inline-flex;
}

.nspt.nspt:not(.is-running):not(.is-done) .nspt__trace {
	flex: 0 0 auto;
	min-height: 0;
}

.nspt.nspt--has-go:not(.is-running):not(.is-done) .nspt__readout,
.nspt.nspt--has-go:not(.is-running):not(.is-done) .nspt__button {
	display: none;
}

.nspt.nspt .nspt__go-label {
	position: relative;
	z-index: 1;
}

/* The resting pulse: a ring that breathes outward, so an idle widget reads as
   ready rather than broken. */
.nspt.nspt .nspt__go-ring {
	position: absolute;
	inset: -2px;
	border: 2px solid var(--nspt-accent);
	border-radius: 50%;
	opacity: 0;
	animation: nspt-breathe 2.6s ease-out infinite;
}

.nspt.nspt .nspt__go:hover {
	background: var(--nspt-surface);
}

.nspt.nspt .nspt__go:active {
	transform: scale(0.97);
}

@keyframes nspt-breathe {
	0% {
		transform: scale(1);
		opacity: 0.55;
	}

	70% {
		transform: scale(1.22);
		opacity: 0;
	}

	100% {
		transform: scale(1.22);
		opacity: 0;
	}
}

@media (prefers-reduced-motion: reduce) {
	.nspt.nspt .nspt__go-ring {
		animation: none;
		opacity: 0.35;
	}
}

.nspt.nspt .nspt__readout {
	display: flex;
	align-items: baseline;
	gap: 6px;
	min-height: 44px;
}

/* Tabular figures keep the number from reflowing on every sample. */
.nspt.nspt .nspt__value {
	font-size: clamp(28px, 4vw, 40px);
	font-weight: 600;
	line-height: 1;
	letter-spacing: -0.03em;
	font-variant-numeric: tabular-nums;
	color: var(--nspt-fg);
}

.nspt.nspt:not(.is-running):not(.is-done) .nspt__value {
	color: var(--nspt-muted);
	opacity: 0.65;
}

.nspt.nspt .nspt__unit {
	font-size: 15px;
	font-weight: 500;
	color: var(--nspt-muted);
}

.nspt.nspt .nspt__phase {
	margin: 10px 0 0;
	padding: 0;
	font-size: 13px;
	line-height: 1.4;
	color: var(--nspt-muted);
	min-height: 20px;
}

.nspt.nspt .nspt__trace {
	display: block;
	width: 100%;
	height: 0;
	margin-top: 0;
	overflow: visible;
	opacity: 0;
	transition: opacity 240ms ease, height 240ms ease;
}

.nspt.nspt.is-running .nspt__trace,
.nspt.nspt.is-done .nspt__trace {
	height: 110px;
	margin-top: 14px;
	opacity: 1;
}

.nspt.nspt .nspt__trace-line {
	stroke: var(--nspt-accent);
	stroke-width: 2;
	stroke-linejoin: round;
	stroke-linecap: round;
	fill: none;
	vector-effect: non-scaling-stroke;
}

.nspt.nspt .nspt__trace-fill {
	fill: var(--nspt-accent);
	opacity: 0.12;
	stroke: none;
}

.nspt.nspt[data-direction='upload'] .nspt__trace-line {
	stroke: var(--nspt-action);
}

.nspt.nspt[data-direction='upload'] .nspt__trace-fill {
	fill: var(--nspt-action);
}

.nspt.nspt .nspt__progress {
	height: 3px;
	margin-top: 8px;
	border-radius: 3px;
	background: var(--nspt-line);
	overflow: hidden;
}

.nspt.nspt .nspt__progress-bar {
	width: 0;
	height: 100%;
	border-radius: 3px;
	background: var(--nspt-accent);
	transition: width 400ms ease;
}

.nspt.nspt[data-direction='upload'] .nspt__progress-bar {
	background: var(--nspt-action);
}

/* --------------------------------------------------------------------------
   Headline pills and the tile grid
   -------------------------------------------------------------------------- */

.nspt.nspt .nspt__head {
	display: flex;
	align-items: flex-end;
	justify-content: space-between;
	gap: 12px;
	flex-wrap: wrap;
}

.nspt.nspt .nspt__headline {
	min-width: 0;
	text-align: left;
}

.nspt.nspt .nspt__pills {
	display: flex;
	flex-wrap: wrap;
	justify-content: flex-end;
	gap: 5px;
}

/* Download, upload and latency ride beside the score rather than queueing in
   the grid: they are the answer to the question that was asked. */
.nspt.nspt .nspt__pill {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	padding: 6px 9px;
	border-radius: 999px;
	background: var(--nspt-surface-2);
	color: var(--nspt-fg);
	font-size: 13px;
	font-weight: 600;
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
}

.nspt.nspt .nspt__pill-unit {
	font-size: 10.5px;
	font-weight: 400;
	color: var(--nspt-muted);
}

.nspt.nspt .nspt__tiles {
	display: grid;
	gap: 8px;
}

/* Three verdicts, one row. */
.nspt.nspt .nspt__tiles--verdicts {
	grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

/* The supporting numbers stay on one row whatever the card width, so a column
   count rather than a min-width. The count follows how many tiles are actually
   visible — a measurement the engine skipped must not leave a hole. */
.nspt.nspt .nspt__tiles--metrics {
	grid-template-columns: repeat(var(--nspt-metrics, 4), minmax(0, 1fr));
	gap: 6px;
}

.nspt.nspt .nspt__tiles--metrics .nspt__tile {
	padding: 9px 10px;
}

.nspt.nspt .nspt__tiles--metrics .nspt__tile-label {
	font-size: 11px;
}

.nspt.nspt .nspt__tile {
	display: flex;
	flex-direction: column;
	/* Labels wrap to two lines at some widths ("Loaded down", "Video
	   streaming"); pinning the value to the bottom keeps every figure in the
	   row on the same baseline regardless. */
	justify-content: space-between;
	min-width: 0;
	padding: 10px 12px;
	border-radius: var(--nspt-radius-sm);
	background: var(--nspt-surface);
	text-align: left;
}

.nspt.nspt .nspt__tile-label {
	display: flex;
	align-items: center;
	gap: 5px;
	margin-bottom: 3px;
	font-size: 11.5px;
	font-weight: 500;
	line-height: 1.3;
	color: var(--nspt-muted);
}

.nspt.nspt .nspt__tile-icon {
	flex: 0 0 auto;
	width: 14px;
	height: 14px;
	fill: none;
	stroke: currentColor;
	stroke-width: 1.7;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.nspt.nspt .nspt__pill .nspt__tile-icon {
	width: 13px;
	height: 13px;
	color: var(--nspt-muted);
}

.nspt.nspt .nspt__tile-value {
	display: block;
	font-size: 17px;
	font-weight: 600;
	line-height: 1.25;
	font-variant-numeric: tabular-nums;
	color: var(--nspt-fg);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.nspt.nspt .nspt__tile-unit {
	margin-left: 4px;
	font-size: 11px;
	font-style: normal;
	font-weight: 400;
	color: var(--nspt-muted);
}

.nspt.nspt .nspt__tile.is-live .nspt__tile-value {
	color: var(--nspt-accent);
}

/* Grades and verdicts share one colour language: green is fine, amber is
   watch it, red is the reason your call broke up. */
.nspt.nspt .nspt__tile[data-grade='a'] .nspt__tile-value,
.nspt.nspt .nspt__tile[data-rating='great'] .nspt__tile-value,
.nspt.nspt .nspt__tile[data-rating='good'] .nspt__tile-value {
	color: var(--nspt-accent);
}

.nspt.nspt .nspt__tile[data-grade='b'] .nspt__tile-value,
.nspt.nspt .nspt__tile[data-rating='average'] .nspt__tile-value {
	color: #d8a628;
}

.nspt.nspt .nspt__tile[data-grade='c'] .nspt__tile-value,
.nspt.nspt .nspt__tile[data-grade='d'] .nspt__tile-value,
.nspt.nspt .nspt__tile[data-grade='f'] .nspt__tile-value,
.nspt.nspt .nspt__tile[data-rating='poor'] .nspt__tile-value,
.nspt.nspt .nspt__tile[data-rating='bad'] .nspt__tile-value {
	color: var(--nspt-danger-fg);
}

/* --------------------------------------------------------------------------
   Message
   -------------------------------------------------------------------------- */

.nspt.nspt .nspt__message {
	margin: 0;
	padding: 12px 14px;
	border-radius: var(--nspt-radius-sm);
	background: var(--nspt-danger-bg);
	color: var(--nspt-danger-fg);
	font-size: 14px;
	line-height: 1.5;
	text-align: left;
}

/* --------------------------------------------------------------------------
   Details table
   -------------------------------------------------------------------------- */

.nspt.nspt .nspt__details {
	margin: 0;
	padding: 0;
	border: 1px solid var(--nspt-line);
	border-radius: var(--nspt-radius-sm);
	background: var(--nspt-surface);
	text-align: left;
}

.nspt.nspt .nspt__details-summary {
	display: block;
	padding: 12px 16px;
	font-size: 14px;
	font-weight: 500;
	color: var(--nspt-fg);
	cursor: pointer;
	list-style: none;
	user-select: none;
}

.nspt.nspt .nspt__details-summary::-webkit-details-marker {
	display: none;
}

.nspt.nspt .nspt__details-summary::after {
	content: '';
	float: right;
	width: 8px;
	height: 8px;
	margin-top: 6px;
	border-right: 2px solid currentColor;
	border-bottom: 2px solid currentColor;
	transform: rotate(45deg);
	opacity: 0.6;
}

.nspt.nspt .nspt__details[open] .nspt__details-summary::after {
	transform: rotate(-135deg);
	margin-top: 9px;
}

.nspt.nspt .nspt__details-body {
	padding: 0 16px 12px;
}

.nspt.nspt .nspt__det-group {
	margin: 10px 0 4px;
	font-size: 11px;
	font-weight: 600;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--nspt-muted);
}

.nspt.nspt .nspt__det-row {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 16px;
	padding: 6px 0;
	border-top: 1px solid var(--nspt-line);
	font-size: 13px;
}

.nspt.nspt .nspt__det-row:first-of-type {
	border-top: 0;
}

.nspt.nspt .nspt__det-key {
	color: var(--nspt-muted);
	min-width: 0;
}

.nspt.nspt .nspt__det-val {
	font-variant-numeric: tabular-nums;
	font-weight: 500;
	text-align: right;
	overflow-wrap: anywhere;
}

/* --------------------------------------------------------------------------
   Actions
   -------------------------------------------------------------------------- */

.nspt.nspt .nspt__actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
	gap: 12px;
}

.nspt.nspt--align-left .nspt__actions {
	justify-content: flex-start;
}

.nspt.nspt .nspt__button {
	min-width: 190px;
	padding: 14px 28px;
	border: 1px solid var(--nspt-action);
	border-radius: 999px;
	background: var(--nspt-action);
	color: #fff;
	font-size: 16px;
	font-weight: 600;
	text-align: center;
}

.nspt.nspt .nspt__button:hover:not(:disabled) {
	filter: brightness(1.08);
}

.nspt.nspt .nspt__button:active:not(:disabled) {
	transform: scale(0.985);
}

.nspt.nspt .nspt__button:disabled {
	opacity: 0.6;
	cursor: default;
}

.nspt.nspt .nspt__ghost {
	padding: 13px 22px;
	border: 1px solid var(--nspt-line);
	border-radius: 999px;
	background: transparent;
	color: var(--nspt-fg);
	font-size: 15px;
	font-weight: 500;
}

.nspt.nspt .nspt__ghost:hover {
	background: var(--nspt-surface-2);
}

/* Share ------------------------------------------------------------------ */

.nspt.nspt .nspt__share {
	position: relative;
	display: inline-flex;
}

.nspt.nspt [data-nspt-share] {
	display: inline-flex;
	align-items: center;
	gap: 8px;
}

.nspt.nspt [data-nspt-share] .nspt__icon {
	width: 16px;
	height: 16px;
}

.nspt.nspt .nspt__share-menu {
	position: absolute;
	bottom: calc(100% + 8px);
	left: 50%;
	z-index: 2;
	display: flex;
	flex-direction: column;
	min-width: 160px;
	padding: 6px;
	border: 1px solid var(--nspt-line);
	border-radius: 12px;
	background: var(--nspt-bg);
	box-shadow: var(--nspt-shadow);
	transform: translateX(-50%);
}

/* Inherit mode has no opaque background of its own, and a see-through menu
   over a chart is unreadable. */
.nspt.nspt[data-nspt-theme='inherit'] .nspt__share-menu {
	background: var(--nspt-surface-2);
	backdrop-filter: blur(8px);
}

.nspt.nspt .nspt__share-menu .nspt__share-link {
	display: block;
	width: 100%;
	padding: 9px 12px;
	border: 0;
	border-radius: 8px;
	background: transparent;
	color: var(--nspt-fg);
	font-size: 14px;
	font-weight: 500;
	text-align: left;
	text-decoration: none;
	cursor: pointer;
}

.nspt.nspt .nspt__share-menu .nspt__share-link:hover,
.nspt.nspt .nspt__share-menu .nspt__share-link:focus-visible {
	background: var(--nspt-surface-2);
	color: var(--nspt-fg);
	text-decoration: none;
}

.nspt.nspt .nspt__actions .nspt__cta {
	display: inline-flex;
	align-items: center;
	padding: 13px 24px;
	border-radius: 999px;
	background: var(--nspt-surface);
	color: var(--nspt-fg);
	font-size: 15px;
	font-weight: 500;
	text-decoration: none;
	box-shadow: none;
	transition: background-color 160ms ease;
}

.nspt.nspt .nspt__actions .nspt__cta:hover,
.nspt.nspt .nspt__actions .nspt__cta:focus {
	background: var(--nspt-surface-2);
	color: var(--nspt-fg);
	text-decoration: none;
}

.nspt.nspt .nspt__button:focus-visible,
.nspt.nspt .nspt__ghost:focus-visible,
.nspt.nspt .nspt__actions .nspt__cta:focus-visible,
.nspt.nspt .nspt__theme-toggle:focus-visible,
.nspt.nspt .nspt__details-summary:focus-visible {
	outline: 2px solid var(--nspt-accent);
	outline-offset: 3px;
}

/* Running meter ---------------------------------------------------------- */

.nspt.nspt .nspt__meter {
	position: relative;
	flex: 0 1 auto;
	min-width: 190px;
	padding: 14px 28px;
	border: 1px solid var(--nspt-line);
	border-radius: 999px;
	background: var(--nspt-surface);
	overflow: hidden;
	text-align: center;
}

.nspt.nspt .nspt__meter-fill {
	position: absolute;
	top: 0;
	left: 0;
	bottom: 0;
	width: 0;
	border-radius: 999px;
	background: var(--nspt-action);
	opacity: 0.9;
	transition: width 400ms ease;
}

/* The stripes move even when the measured percentage sits still, which is
   what tells a visitor the test is alive during a long upload batch. */
.nspt.nspt .nspt__meter-fill::after {
	content: '';
	position: absolute;
	inset: 0;
	background-image: linear-gradient(
		115deg,
		rgba(255, 255, 255, 0) 25%,
		rgba(255, 255, 255, 0.28) 50%,
		rgba(255, 255, 255, 0) 75%
	);
	background-size: 220px 100%;
	animation: nspt-sheen 1.15s linear infinite;
}

.nspt[data-direction='download'] .nspt__meter-fill {
	background: var(--nspt-accent);
}

.nspt.nspt .nspt__meter-label {
	position: relative;
	font-size: 15px;
	font-weight: 600;
	font-variant-numeric: tabular-nums;
	color: var(--nspt-fg);
	mix-blend-mode: normal;
}

@keyframes nspt-sheen {
	from {
		background-position: -220px 0;
	}

	to {
		background-position: 220px 0;
	}
}

@media (prefers-reduced-motion: reduce) {
	.nspt.nspt .nspt__meter-fill::after {
		animation: none;
	}
}

/* Map -------------------------------------------------------------------- */

.nspt.nspt .nspt__map {
	margin: 14px 0 0;
	padding: 0;
}

.nspt.nspt .nspt__map-svg {
	display: block;
	width: 100%;
	height: auto;
	aspect-ratio: 2 / 1;
	border-radius: 10px;
	background: var(--nspt-surface-2);
}

.nspt.nspt .nspt__map-land {
	fill: var(--nspt-muted);
	fill-opacity: 0.45;
	stroke: none;
}

.nspt.nspt .nspt__map-borders {
	fill: none;
	stroke: var(--nspt-fg);
	stroke-opacity: 0.22;
	stroke-width: 1;
	vector-effect: non-scaling-stroke;
}

/* A soft ring under the visitor's dot: at a city-level zoom the dot alone is
   easy to lose against the coastline. */
.nspt.nspt .nspt__map-halo {
	fill: var(--nspt-accent);
	fill-opacity: 0.22;
}

.nspt.nspt .nspt__map-link {
	stroke: var(--nspt-accent);
	stroke-width: 2;
	stroke-dasharray: 6 6;
	opacity: 0.7;
	vector-effect: non-scaling-stroke;
}

.nspt.nspt .nspt__map-dot--you {
	fill: var(--nspt-accent);
}

.nspt.nspt .nspt__map-dot--server {
	fill: var(--nspt-action);
}

.nspt.nspt .nspt__map-legend {
	display: flex;
	flex-wrap: wrap;
	gap: 6px 16px;
	margin: 8px 0 0;
	padding: 0;
	font-size: 12px;
	color: var(--nspt-muted);
}

.nspt.nspt .nspt__map-key {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	min-width: 0;
	overflow-wrap: anywhere;
}

.nspt.nspt .nspt__map-key::before {
	content: '';
	flex: 0 0 auto;
	width: 8px;
	height: 8px;
	border-radius: 50%;
}

.nspt.nspt .nspt__map-key--you::before {
	background: var(--nspt-accent);
}

.nspt.nspt .nspt__map-key--server::before {
	background: var(--nspt-action);
}

.nspt.nspt .nspt__note {
	margin: 0;
	padding: 0;
	font-size: 12px;
	line-height: 1.6;
	color: var(--nspt-muted);
}

.nspt.nspt .nspt__inner .nspt__note a {
	color: inherit;
	text-decoration: underline;
}

.nspt.nspt .nspt__sr {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0 0 0 0);
	clip-path: inset(50%);
	white-space: nowrap;
	border: 0;
}

/* --------------------------------------------------------------------------
   Connection panel
   -------------------------------------------------------------------------- */

.nspt.nspt .nspt__info {
	margin: 0;
	padding: 16px 18px;
	border-radius: var(--nspt-radius-sm);
	background: var(--nspt-surface);
	text-align: left;
	min-width: 0;
}

.nspt.nspt .nspt__info-head {
	display: flex;
	align-items: center;
	gap: 10px;
	margin-bottom: 12px;
	padding-bottom: 12px;
	border-bottom: 1px solid var(--nspt-line);
}

.nspt.nspt .nspt__info--empty .nspt__info-head {
	margin-bottom: 0;
	padding-bottom: 0;
	border-bottom: 0;
}

.nspt.nspt .nspt__info--empty .nspt__info-list {
	display: none;
}

.nspt.nspt .nspt__info-flag {
	font-size: 22px;
	line-height: 1;
}

.nspt.nspt .nspt__info-flag:empty {
	display: none;
}

.nspt.nspt .nspt__info-primary {
	font-size: 15px;
	font-weight: 600;
	color: var(--nspt-fg);
	min-width: 0;
	overflow-wrap: anywhere;
}

.nspt.nspt .nspt__info-list {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
	gap: 12px 20px;
	margin: 0;
	padding: 0;
}

.nspt.nspt .nspt__info-row {
	min-width: 0;
	margin: 0;
}

.nspt.nspt .nspt__info-row dt {
	margin: 0 0 2px;
	padding: 0;
	font-size: 12px;
	font-weight: 400;
	color: var(--nspt-muted);
}

/* Addresses and codes must never be clipped — a truncated IP is wrong data,
   not just an ugly line. Wrap instead. */
.nspt.nspt .nspt__info-row dd {
	margin: 0;
	padding: 0;
	font-size: 14px;
	font-weight: 500;
	color: var(--nspt-fg);
	font-variant-numeric: tabular-nums;
	overflow-wrap: anywhere;
}

.nspt.nspt .nspt__info-row dd[data-nspt-verdict='yes'] {
	color: var(--nspt-danger-fg);
}

.nspt.nspt .nspt__info-row dd[data-nspt-verdict='maybe'] {
	color: #d8a628;
}

.nspt.nspt .nspt__info-row dd[data-nspt-verdict='no'] {
	color: var(--nspt-accent);
}

/* --------------------------------------------------------------------------
   Full-page layout: the stage and the connection panel share a row once
   there is room for both.
   -------------------------------------------------------------------------- */

@media (min-width: 900px) {
	.nspt.nspt--layout-full .nspt__cols,
	.nspt.nspt--layout-wide.nspt--info-top .nspt__cols {
		flex-direction: row;
		align-items: stretch;
		gap: 20px;
	}

	.nspt.nspt--layout-full .nspt__cols .nspt__stage,
	.nspt.nspt--layout-wide.nspt--info-top .nspt__cols .nspt__stage {
		flex: 1 1 58%;
		min-width: 0;
		/* Matched to the panel's height, so the trace takes up the slack
		   rather than the card ending in dead space. */
		justify-content: space-between;
	}

	.nspt.nspt--layout-full .nspt__cols .nspt__trace,
	.nspt.nspt--layout-wide.nspt--info-top .nspt__cols .nspt__trace {
		flex: 1 1 auto;
		min-height: 110px;
	}

	.nspt.nspt--layout-full .nspt__cols .nspt__info,
	.nspt.nspt--layout-wide.nspt--info-top .nspt__cols .nspt__info {
		order: 0;
		flex: 1 1 36%;
		min-width: 0;
		display: flex;
		flex-direction: column;
		justify-content: center;
	}

	.nspt.nspt--layout-full.is-running .nspt__trace,
	.nspt.nspt--layout-full.is-done .nspt__trace {
		height: 150px;
	}

	.nspt.nspt--layout-full .nspt__tiles--verdicts {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}
}

/* --------------------------------------------------------------------------
   Small screens
   -------------------------------------------------------------------------- */

@media (max-width: 640px) {
	.nspt.nspt {
		--nspt-pad: 20px;
		--nspt-radius: 16px;
	}

	.nspt.nspt .nspt__tiles--verdicts {
		grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
	}

	.nspt.nspt .nspt__stage {
		padding: 14px;
	}

	.nspt.nspt .nspt__tile-value {
		font-size: 16px;
	}
}

@media (max-width: 480px) {
	/* Four columns on a phone would be four unreadable slivers. */
	.nspt.nspt .nspt__tiles--metrics {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (max-width: 420px) {
	.nspt.nspt .nspt__tiles {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.nspt.nspt .nspt__pills {
		width: 100%;
	}

	.nspt.nspt .nspt__pill {
		flex: 1 1 auto;
		justify-content: center;
	}

	.nspt.nspt .nspt__button,
	.nspt.nspt .nspt__ghost,
	.nspt.nspt .nspt__cta {
		width: 100%;
		justify-content: center;
	}

	.nspt.nspt .nspt__det-row {
		flex-direction: column;
		gap: 2px;
	}

	.nspt.nspt .nspt__det-val {
		text-align: left;
	}
}

@media (prefers-reduced-motion: reduce) {
	.nspt.nspt *,
	.nspt.nspt *::before,
	.nspt.nspt *::after {
		transition-duration: 1ms !important;
		animation-duration: 1ms !important;
	}
}

@media print {
	.nspt.nspt .nspt__actions,
	.nspt.nspt .nspt__theme-toggle,
	.nspt.nspt .nspt__trace,
	.nspt.nspt .nspt__progress {
		display: none;
	}

	.nspt.nspt {
		box-shadow: none;
		border: 1px solid #ccc;
	}

	.nspt.nspt .nspt__details-body {
		display: block !important;
	}
}
