/* Topvisor SERP Simulator — standalone layout */
:root {
	color-scheme: light dark;
	--background: #f6f7f9;
	--surface: #fff;
	--text: #202124;
	--muted: #74777d;
	--line: #e4e5e7;
	--hover: #f0f2f4;
	--blue: #2563eb;
	--green: #16a34a;
	--red: #dc2626;
	--yellow: #ca8a04;
	--gray: #a3a3a3;
	--missing: #e68a20;
	font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
@media (prefers-color-scheme: dark) {
	:root {
		--background: #171717;
		--surface: #222;
		--text: #ededed;
		--muted: #aaa;
		--line: #3d3d3d;
		--hover: #303030;
		--green: #32bd62;
		--red: #f26b6b;
		--yellow: #d7a72e;
	}
}
* { box-sizing: border-box; }
body { margin: 0; padding: 24px 12px; background: var(--background); color: var(--text); }
button, input { font: inherit; }
button { cursor: pointer; color: inherit; }
button:disabled { cursor: default; opacity: .45; }
button:focus-visible, input:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }
button, .icon { flex-shrink: 0; }
[hidden] { display: none !important; }
.simulator { width: min(100%, 960px); margin: auto; padding: 16px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.brand { font-size: 15px; }
.spacer { flex: 1; }
.outline, .ghost { border: 1px solid var(--line); background: transparent; border-radius: 9px; min-height: 34px; padding: 6px 10px; font-size: 12px; }
.ghost { border-color: transparent; }
.outline:hover:not(:disabled), .ghost:hover:not(:disabled), .help:hover { background: var(--hover); }
.help { display: inline-grid; place-items: center; border: 0; color: var(--muted); background: transparent; border-radius: 50%; width: 16px; height: 16px; padding: 0; }
.settings-wrap { position: relative; }
.settings-toggle { display: flex; gap: 6px; align-items: center; }
.popover { position: absolute; right: 0; top: calc(100% + 8px); z-index: 5; width: min(295px, 80vw); padding: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 8px 30px #0002; font-size: 13px; }
.setting-label, .range-labels { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.setting-label output { font-size: 20px; font-weight: 600; }
.range-labels, .muted { color: var(--muted); }
.range-labels { font-size: 11px; }
input[type="range"] { width: 100%; accent-color: var(--blue); cursor: pointer; margin: 8px 0; min-width: 0; }
hr { border: 0; border-top: 1px solid var(--line); margin: 12px 0; }
.full { width: 100%; }
.statistics { position: relative; min-height: 82px; border-bottom: 1px solid var(--line); display: grid; align-items: center; }
.metrics { display: grid; grid-template-columns: 1.06fr .94fr 1.16fr 1fr 1fr; gap: 8px; }
.metric { display: grid; grid-template-columns: minmax(0, 1fr); align-content: center; min-width: 0; gap: 3px; }
.metric:nth-child(3) { border-left: 1px solid var(--line); padding-left: 10px; }
.metric-heading { display: flex; min-width: 0; align-items: center; gap: 4px; color: var(--muted); font-size: clamp(8px, 1.65vw, 11px); white-space: nowrap; }
.help-icon { display: block; width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.metric-label { min-width: 0; }
.metric-value { font-size: clamp(17px, 3.6vw, 25px); font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.15; }
.metric-count { font-size: 11px; color: var(--muted); }
.metrics.faded { opacity: .025; pointer-events: none; }
.warmup { position: absolute; background: color-mix(in srgb, var(--surface) 97.5%, transparent); inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; text-align: center; font-size: clamp(9px, 1.65vw, 12px); }
.warmup strong { font-size: clamp(12px, 2vw, 15px); }
.status, .controls { display: grid; grid-template-columns: 17.333333% minmax(0, 1fr); }
.status { height: 144px; padding: 8px 0; }
.status-side { text-align: center; padding-right: 5px; font-size: 12px; }
#check-count { font-size: 10px; }
#check-date { font-weight: 500; margin-top: 3px; }
.face { font-size: 29px; line-height: 1.35; margin-top: 6px; }
#face-label { max-width: 110px; margin: 2px auto 0; line-height: 1.25; }
.status-main { text-align: center; min-width: 0; }
#status-title { font-size: 14px; font-weight: 600; min-height: 22px; }
#status-detail { font-size: 12px; }
.message { color: var(--muted); margin-top: 11px; line-height: 1.65; }
.comparisons { display: grid; grid-template-columns: max-content max-content 13px max-content 16px; column-gap: 7px; row-gap: 3px; justify-content: center; align-items: center; font-variant-numeric: tabular-nums; }
.comparisons .heading { color: var(--muted); font-size: 11px; }
.comparisons .score, .comparisons .threshold { font-weight: 600; }
.comparisons .score { text-align: center; }
.comparisons .sign { text-align: center; }
.comparisons .threshold { text-align: center; }
.result-mark { border-radius: 50%; display: grid; place-items: center; width: 15px; height: 15px; font-size: 11px; line-height: 1; }
.result-mark.pass { background: #16a34a26; color: var(--green); }
.result-mark.fail { background: #dc262626; color: var(--red); }
.summary { margin-top: 5px; color: var(--muted); font-size: 11px; }
.short-note { font-size: 10px; color: var(--muted); margin-top: 3px; }
.back-controls { display: flex; gap: 7px; padding-right: 8px; min-width: 0; }
.back-controls button { flex: 1; min-width: 0; padding: 5px; display: grid; place-items: center; }
.icon { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.primary { display: flex; justify-content: center; align-items: center; gap: 7px; min-height: 36px; border: 0; border-radius: 100px; background: var(--blue); color: #fff; font-size: 13px; font-weight: 600; padding: 8px 10px; }
.primary:disabled { background: #64748b; opacity: 1; }
.timeline { display: flex; align-items: center; gap: 12px; margin: 7px 0 10px; font-size: 12px; }
.timeline span { flex-shrink: 0; font-variant-numeric: tabular-nums; }
#board { display: block; width: 100%; height: auto; overflow: hidden; }
.legend { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; font-size: 11px; color: var(--muted); margin-top: 2px; }
.legend span { display: inline-flex; align-items: center; gap: 4px; }
.swatch { display: inline-block; width: 12px; height: 12px; border-radius: 3px; }
.swatch.match { background: #16a34a29; border: 1px solid #16a34a; }
.swatch.missing { background: #e68a2029; border: 1px solid #e68a20; }
dialog { max-width: min(410px, calc(100vw - 28px)); max-height: 85vh; overflow: auto; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--text); padding: 16px 20px; font-size: 13px; }
dialog::backdrop { background: #0005; }
.dialog-heading { display: flex; justify-content: space-between; gap: 10px; align-items: center; }
dialog h2 { font-size: 16px; margin: 0; }
dialog h3 { margin: 13px 0 5px; font-size: 13px; border-top: 1px solid var(--line); padding-top: 11px; }
dialog p { margin: 5px 0; line-height: 1.5; }
.close { font-size: 23px; padding: 0 7px; }
.formula { font-family: Georgia, serif; font-size: 19px; text-align: center; padding: 6px 0; }
@media (max-width: 460px) {
	body { padding: 8px 5px; }
	.simulator { padding: 9px; }
	.toolbar { gap: 5px; }
	.metrics { gap: 3px; }
	.metric:nth-child(3) { padding-left: 4px; }
	.metric-heading { font-size: 8px; gap: 2px; white-space: normal; min-height: 23px; }
	.help { width: 13px; height: 13px; }
	.metric-count { font-size: 9px; }
	.status { height: 160px; }
	.status-side { font-size: 10px; }
	#check-count { font-size: 9px; }
	#status-title { font-size: 13px; }
	.comparisons { font-size: 11px; column-gap: 3px; grid-template-columns: max-content max-content 11px max-content 13px; }
	.comparisons .heading { font-size: 10px; }
	.result-mark { width: 13px; height: 13px; }
	.back-controls { gap: 3px; padding-right: 4px; }
	.back-controls button { padding: 3px; }
	.back-controls .icon { width: 15px; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }

.updates-link { color: var(--blue); font-size: 13px; text-decoration: none; white-space: nowrap; }
.updates-link:hover { color: var(--blue); text-decoration: underline; }
.updates-link:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }

/* Original desktop scale with a shorter fixed status block. */
@media (min-width: 780px) {
	.brand { font-size: 17px; }
	.statistics { min-height: 100px; }
	.metric-heading { font-size: 13px; }
	.metric-value { font-size: 30px; }
	.metric-count { font-size: 13px; }
	.warmup { font-size: 14px; }
	.warmup strong { font-size: 17px; }
	.status { height: 178px; padding: 10px 0; }
	.status-side { font-size: 15px; }
	#check-count { font-size: 12px; }
	.face { font-size: 35px; margin-top: 10px; }
	#status-title { font-size: 17px; min-height: 28px; }
	#status-detail { font-size: 15px; }
	.comparisons { column-gap: 8px; row-gap: 3px; }
	.comparisons .score, .comparisons .threshold { text-align: center; }
	.comparisons .heading { font-size: 14px; }
	.comparisons .score, .comparisons .threshold { text-align: center; }
	.result-mark { width: 17px; height: 17px; font-size: 13px; }
	.summary { font-size: 13px; }
	.short-note { font-size: 12px; }
	.primary { font-size: 15px; min-height: 43px; }
	.timeline, .legend { font-size: 13px; }
}
@media (max-width: 779px) {
	.metric-heading { white-space: normal; min-height: 28px; }
	.metric-label { overflow-wrap: anywhere; }
}
@media (max-width: 460px) {
	.metric-heading { min-height: 36px; }
}
input[type="range"] { appearance: none; height: 20px; background: var(--hover); border-radius: 99px; }
input[type="range"]::-webkit-slider-thumb { appearance: none; width: 18px; height: 18px; border-radius: 50%; background: var(--surface); border: 1px solid var(--line); box-shadow: 0 1px 3px #0002; }
input[type="range"]::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: var(--surface); border: 1px solid var(--line); box-shadow: 0 1px 3px #0002; }
