#nopeus-widget {
	width: 100%;
	max-width: 615px;
	height: 650px;
	margin: 0 auto;
	background: #fff;
	text-align: left;
}

.nopeus-speedtest {
	--nopeus-download: #47bae3;
	--nopeus-download-light: #b5e5f6;
	--nopeus-upload: #9061f9;
	--nopeus-upload-light: #d6c5fd;
	--nopeus-ink: #004264;
	--nopeus-text: #23292e;
	--nopeus-muted: #66757f;
	--nopeus-track: #e6ecf0;
	--nopeus-line: #e3e8ec;
	--nopeus-phase: var(--nopeus-download);
	--nopeus-phase-light: var(--nopeus-download-light);
	box-sizing: border-box;
	height: 100%;
	padding: 22px 22px 14px;
	display: flex;
	flex-direction: column;
	gap: 16px;
	color: var(--nopeus-text);
	font-family: "Trebuchet MS", sans-serif;
	font-size: 15px;
	line-height: 1.3;
}

.nopeus-speedtest *,
.nopeus-speedtest *::before,
.nopeus-speedtest *::after {
	box-sizing: border-box;
}

.nopeus-speedtest[data-phase="upload"] {
	--nopeus-phase: var(--nopeus-upload);
	--nopeus-phase-light: var(--nopeus-upload-light);
}

.nopeus-speedtest svg {
	display: block;
	flex: none;
}

.nopeus-speeds {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 12px;
}

.nopeus-speed-heading {
	display: flex;
	align-items: center;
	gap: 7px;
	font-size: 13px;
	font-weight: bold;
	letter-spacing: 0.08em;
}

.nopeus-speed-heading svg {
	width: 22px;
	height: 22px;
}

.nopeus-speed-heading span {
	white-space: nowrap;
}

.nopeus-speed[data-metric="download"] svg {
	color: var(--nopeus-download);
}

.nopeus-speed[data-metric="upload"] svg {
	color: var(--nopeus-upload);
}

.nopeus-unit {
	font-weight: normal;
	letter-spacing: 0;
	color: var(--nopeus-muted);
}

.nopeus-speed-value {
	margin-top: 6px;
	padding-left: 29px;
	color: var(--nopeus-ink);
	font-family: "Orbitron", "Trebuchet MS", sans-serif;
	font-size: 28px;
	font-weight: 700;
	line-height: 1.1;
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
}

.nopeus-speedtest[data-state="running"][data-phase="download"] .nopeus-speed[data-metric="upload"] .nopeus-speed-value,
.nopeus-speedtest[data-state="running"][data-phase="latency"] .nopeus-speed-value {
	color: #b6c2ca;
}

.nopeus-ping {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px 18px;
	padding: 10px 0;
	border-top: 1px solid var(--nopeus-line);
	border-bottom: 1px solid var(--nopeus-line);
	font-size: 14px;
}

.nopeus-ping-title {
	font-weight: bold;
}

.nopeus-ping-item {
	display: inline-flex;
	align-items: center;
	gap: 5px;
}

.nopeus-ping-item svg {
	width: 16px;
	height: 16px;
}

.nopeus-ping-item b {
	min-width: 2ch;
	font-variant-numeric: tabular-nums;
}

.nopeus-ping-item[data-metric="latency"] svg {
	color: var(--nopeus-ink);
}

.nopeus-ping-item[data-metric="download"] svg {
	color: var(--nopeus-download);
}

.nopeus-ping-item[data-metric="upload"] svg {
	color: var(--nopeus-upload);
}

.nopeus-speedtest .nopeus-quality {
	margin: 0;
	padding: 0;
	list-style: none;
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 10px 8px;
}

.nopeus-quality-item {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 7px;
	font-size: 13px;
}

.nopeus-quality-name {
	display: flex;
	align-items: center;
	gap: 5px;
	white-space: nowrap;
}

.nopeus-quality-name svg {
	width: 18px;
	height: 18px;
	color: var(--nopeus-ink);
}

.nopeus-dots {
	display: flex;
	gap: 4px;
}

.nopeus-dots i {
	width: 9px;
	height: 9px;
	border-radius: 50%;
	background: var(--nopeus-track);
}

.nopeus-dots i.is-filled {
	background: var(--nopeus-download);
}

.nopeus-gauge {
	position: relative;
	flex: 1 1 auto;
	min-height: 0;
	display: flex;
	align-items: center;
	justify-content: center;
}

.nopeus-gauge-dial {
	position: relative;
	width: 100%;
	max-width: 350px;
	max-height: 100%;
	aspect-ratio: 300 / 262;
}

.nopeus-gauge-svg {
	width: 100%;
	height: 100%;
	overflow: visible;
	transition: opacity 0.3s;
}

.nopeus-gauge-track,
.nopeus-gauge-progress {
	fill: none;
	stroke-width: 18;
	stroke-linecap: round;
}

.nopeus-gauge-track {
	stroke: var(--nopeus-track);
}

.nopeus-gauge-progress {
	stroke: url(#nopeus-progress-gradient);
	stroke-dasharray: 1000;
	stroke-dashoffset: 1000;
	opacity: 0;
}

.nopeus-gradient-from {
	stop-color: var(--nopeus-phase-light);
}

.nopeus-gradient-to {
	stop-color: var(--nopeus-phase);
}

.nopeus-needle-from {
	stop-color: var(--nopeus-phase);
	stop-opacity: 0.15;
}

.nopeus-needle-to {
	stop-color: var(--nopeus-phase);
}

.nopeus-gauge-needle polygon {
	fill: url(#nopeus-needle-gradient);
}

.nopeus-gauge-hub {
	fill: var(--nopeus-ink);
}

.nopeus-gauge-label {
	fill: var(--nopeus-muted);
	font-family: "Trebuchet MS", sans-serif;
	font-size: 13px;
	text-anchor: middle;
	dominant-baseline: central;
}

.nopeus-gauge-label.is-passed {
	fill: var(--nopeus-ink);
	font-weight: bold;
}

.nopeus-readout {
	position: absolute;
	left: 50%;
	top: 80%;
	transform: translate(-50%, -50%);
	display: flex;
	flex-direction: column;
	align-items: center;
	white-space: nowrap;
}

.nopeus-readout-value {
	color: var(--nopeus-ink);
	font-family: "Orbitron", "Trebuchet MS", sans-serif;
	font-size: 26px;
	font-weight: 700;
	line-height: 1.1;
	font-variant-numeric: tabular-nums;
}

.nopeus-readout-unit {
	color: var(--nopeus-muted);
	font-size: 12px;
}

.nopeus-speedtest .nopeus-status {
	position: absolute;
	left: 0;
	right: 0;
	bottom: -6px;
	margin: 0;
	color: var(--nopeus-muted);
	font-size: 13px;
	text-align: center;
}

.nopeus-speedtest .nopeus-start,
.nopeus-speedtest .nopeus-again {
	border: 3px solid var(--nopeus-download);
	background: #fff;
	color: var(--nopeus-ink);
	font-family: "Orbitron", "Trebuchet MS", sans-serif;
	font-weight: 700;
	letter-spacing: 0.1em;
	line-height: 1;
	cursor: pointer;
	transition: background 0.2s, color 0.2s;
}

.nopeus-speedtest .nopeus-start {
	position: absolute;
	left: 50%;
	top: 57.25%;
	transform: translate(-50%, -50%);
	width: 132px;
	height: 132px;
	padding: 0;
	border-radius: 50%;
	font-size: 19px;
	animation: nopeus-start-pulse 2.4s ease-out infinite;
}

.nopeus-speedtest .nopeus-again {
	padding: 12px 22px;
	border-radius: 999px;
	font-size: 15px;
}

.nopeus-speedtest .nopeus-start:hover,
.nopeus-speedtest .nopeus-start:focus-visible,
.nopeus-speedtest .nopeus-again:hover,
.nopeus-speedtest .nopeus-again:focus-visible {
	border-color: var(--nopeus-download);
	background: var(--nopeus-download);
	color: #fff;
}

.nopeus-speedtest .nopeus-start:focus-visible,
.nopeus-speedtest .nopeus-again:focus-visible {
	outline: 3px solid var(--nopeus-ink);
	outline-offset: 4px;
}

@keyframes nopeus-start-pulse {
	0% {
		box-shadow: 0 0 0 0 rgba(71, 186, 227, 0.45);
	}

	70% {
		box-shadow: 0 0 0 20px rgba(71, 186, 227, 0);
	}

	100% {
		box-shadow: 0 0 0 0 rgba(71, 186, 227, 0);
	}
}

.nopeus-error {
	position: absolute;
	inset: 0;
	display: none;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 18px;
	padding: 0 24px;
	text-align: center;
}

.nopeus-speedtest .nopeus-error p {
	max-width: 30ch;
	margin: 0;
	font-size: 16px;
}

.nopeus-speedtest[data-state="idle"] .nopeus-gauge-svg {
	opacity: 0.5;
}

.nopeus-speedtest[data-state="idle"] .nopeus-gauge-needle,
.nopeus-speedtest[data-state="idle"] .nopeus-readout {
	visibility: hidden;
}

.nopeus-speedtest:not([data-state="idle"]) .nopeus-start,
.nopeus-speedtest:not([data-state="done"]) .nopeus-status {
	display: none;
}

.nopeus-speedtest[data-state="error"] .nopeus-gauge-dial {
	visibility: hidden;
}

.nopeus-speedtest[data-state="error"] .nopeus-error {
	display: flex;
}

.nopeus-footer {
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
	gap: 4px 12px;
	min-height: 28px;
	padding-top: 10px;
	border-top: 1px solid var(--nopeus-line);
	color: var(--nopeus-muted);
	font-size: 12px;
}

@media (max-width: 480px) {
	.nopeus-speedtest {
		padding-inline: 14px;
	}

	.nopeus-speed-heading {
		flex-wrap: wrap;
		gap: 2px 6px;
		font-size: 12px;
		letter-spacing: 0.04em;
	}

	.nopeus-speed-value {
		padding-left: 0;
		font-size: 23px;
	}

	.nopeus-quality-item {
		font-size: 12px;
	}

	.nopeus-quality-name {
		flex-direction: column;
		gap: 3px;
	}

	.nopeus-gauge {
		align-items: flex-start;
		padding-top: 20px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.nopeus-speedtest .nopeus-start {
		animation: none;
	}

	.nopeus-gauge-svg {
		transition: none;
	}
}
