.decoherence-viewer {
	margin: 1.5rem 0;
	padding: 16px;
	color: var(--body);
	background: var(--surface);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	font-size: .85rem;
	line-height: 1.5;
}

.decoherence-viewer [hidden] {
	display: none;
}

.decoherence-viewer__stage {
	position: relative;
}

.decoherence-viewer__graphs {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 12px;
}

.decoherence-viewer__graph {
	min-width: 0;
	padding: 8px 4px;
	background: var(--canvas);
	border-radius: var(--radius-sm);
	outline-offset: 2px;
}

.decoherence-viewer__graph.is-highlighted {
	outline: 2px solid var(--blue);
}

.decoherence-viewer__graph canvas {
	display: block;
	width: 100%;
	height: 220px;
}

.decoherence-viewer__caption {
	display: block;
	margin-top: 8px;
	text-align: center;
	font-size: .75rem;
	font-weight: 650;
}

.decoherence-viewer__chart {
	margin: 20px 0 12px;
}

.decoherence-viewer__chart svg {
	display: block;
	width: 100%;
	height: auto;
	overflow: visible;
	font-family: inherit;
}

.decoherence-viewer__grid-line {
	stroke: var(--line);
	stroke-dasharray: 3 4;
}

.decoherence-viewer__axis {
	fill: var(--muted);
	font-size: 11px;
}

.decoherence-viewer__curve {
	fill: none;
	stroke: var(--blue);
	stroke-width: 2;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.decoherence-viewer__point {
	fill: var(--blue);
	stroke: transparent;
	stroke-width: 14;
	cursor: pointer;
	outline: none;
}

.decoherence-viewer__point.is-highlighted {
	stroke: rgba(29, 112, 184, .25);
}

.decoherence-viewer__count {
	fill: var(--navy);
	font-size: 11px;
	font-weight: 700;
	pointer-events: none;
}

.decoherence-viewer__controls {
	display: flex;
	align-items: center;
	gap: 8px;
	padding-top: 12px;
	border-top: 1px solid var(--line);
}

.decoherence-viewer button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: 0 0 auto;
	min-width: 44px;
	min-height: 44px;
	padding: 6px 10px;
	margin: 0;
	color: var(--navy);
	background: var(--blue-soft);
	border: 1px solid var(--line-strong);
	border-radius: var(--radius-sm);
	font-family: inherit;
	font-size: 1rem;
	line-height: 1;
	cursor: pointer;
}

.decoherence-viewer button:hover {
	background: var(--line);
}

.decoherence-viewer .decoherence-viewer__start,
.decoherence-viewer .decoherence-viewer__play {
	color: #fff;
	background: var(--blue);
	border-color: var(--blue);
}

.decoherence-viewer .decoherence-viewer__start:hover,
.decoherence-viewer .decoherence-viewer__play:hover {
	background: var(--blue-dark);
}

.decoherence-viewer .decoherence-viewer__start {
	position: absolute;
	top: 50%;
	left: 50%;
	gap: 8px;
	padding: 14px 24px;
	border-radius: 999px;
	box-shadow: var(--shadow);
	transform: translate(-50%, -50%);
	font-weight: 700;
}

.decoherence-viewer input[type="range"] {
	flex: 1;
	width: 100%;
	min-width: 0;
	height: 44px;
	padding: 0;
	margin: 0;
	accent-color: var(--blue);
	background: transparent;
	border: 0;
	cursor: pointer;
}

.decoherence-viewer__step {
	flex: 0 0 88px;
	text-align: right;
	font-family: var(--mono);
	font-size: .75rem;
	font-variant-numeric: tabular-nums;
}

.decoherence-viewer button:focus-visible,
.decoherence-viewer input:focus-visible,
.decoherence-viewer__graph:focus-visible {
	outline: 3px solid var(--blue);
	outline-offset: 3px;
}

.decoherence-viewer .decoherence-viewer__status {
	margin: 10px 0 0;
	color: var(--muted);
}

@media (max-width: 600px) {
	.decoherence-viewer {
		padding: 10px;
	}

	.decoherence-viewer__graphs {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 10px;
	}

	.decoherence-viewer__graph canvas {
		height: 160px;
	}

	.decoherence-viewer__controls {
		flex-wrap: wrap;
		gap: 6px;
	}

	.decoherence-viewer__step {
		flex-basis: 100%;
	}
}
