:root {
	--paper: #ece6da;
	--ink: #2b2620;
	--muted: #7a7064;
	--card: rgba(250, 247, 240, 0.92);
	--line: rgba(43, 38, 32, 0.12);
	--bnsf: #e8661c;
	--up: #f2b705;
	--amtk: #1f5aa6;
	--live: #2f9e55;
	--est: #c98a2b;
}
@media (prefers-color-scheme: dark) {
	:root:not([data-theme="light"]) {
		--card: rgba(30, 27, 24, 0.9);
		--ink: #efe9df;
		--muted: #b3a998;
		--line: rgba(239, 233, 223, 0.14);
	}
}
:root[data-theme="dark"] {
	--card: rgba(30, 27, 24, 0.9);
	--ink: #efe9df;
	--muted: #b3a998;
	--line: rgba(239, 233, 223, 0.14);
}

* {
	box-sizing: border-box;
}
html,
body {
	margin: 0;
	height: 100%;
	background: var(--paper);
	color: var(--ink);
	font: 14px/1.4 Inter, system-ui, sans-serif;
	overflow: hidden;
}
#stage {
	position: fixed;
	inset: 0;
}
#stage canvas {
	display: block;
	touch-action: none;
}

#panel {
	position: fixed;
	top: 16px;
	left: 16px;
	width: 300px;
	max-height: calc(100% - 32px);
	overflow: auto;
	background: var(--card);
	backdrop-filter: blur(8px);
	border-radius: 14px;
	padding: 16px 16px 12px;
	box-shadow: 0 6px 30px rgba(0, 0, 0, 0.12);
}
h1 {
	font: 600 26px/1.1 Fraunces, Georgia, serif;
	margin: 0 0 6px;
}
h2 {
	font-size: 11px;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--muted);
	margin: 0 0 6px;
	font-weight: 600;
}
.blurb {
	margin: 0;
	color: var(--muted);
}
section {
	border-top: 1px solid var(--line);
	padding-top: 10px;
	margin-top: 12px;
}
.row {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	gap: 8px;
	padding: 2px 0;
}
.row b {
	font-weight: 600;
	font-variant-numeric: tabular-nums;
}
.dot {
	display: inline-block;
	width: 7px;
	height: 7px;
	border-radius: 50%;
	margin-left: 4px;
	vertical-align: 1px;
}
.dot.live {
	background: var(--live);
}
.dot.est {
	background: var(--est);
}
#amtrak {
	color: var(--ink);
}
#amtrak .sub {
	color: var(--muted);
	font-size: 12px;
}
#trains, #detections {
	list-style: none;
	margin: 0;
	padding: 0;
}
#trains li, #detections li {
	display: flex;
	gap: 8px;
	align-items: center;
	padding: 5px 6px;
	margin: 0 -6px;
	border-radius: 8px;
	cursor: pointer;
}
#trains li:hover, #detections li[data-det]:hover,
#trains li.sel {
	background: var(--line);
}
.chip {
	flex: none;
	width: 10px;
	height: 10px;
	border-radius: 3px;
}
#trains .what {
	flex: 1;
	min-width: 0;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
#trains .dir, #detections .dir {
	color: var(--muted);
	font-size: 12px;
}
footer {
	margin-top: 12px;
	display: flex;
	flex-direction: column;
	gap: 6px;
}
footer button {
	align-self: flex-start;
	background: none;
	border: 1px solid var(--line);
	color: var(--ink);
	border-radius: 8px;
	padding: 4px 10px;
	font: inherit;
	cursor: pointer;
}
.hint {
	color: var(--muted);
	font-size: 12px;
}

#card,
#creditsBox {
	position: fixed;
	right: 16px;
	bottom: 16px;
	width: 280px;
	background: var(--card);
	backdrop-filter: blur(8px);
	border-radius: 14px;
	padding: 14px 16px;
	box-shadow: 0 6px 30px rgba(0, 0, 0, 0.12);
}
#creditsBox {
	bottom: auto;
	top: 16px;
}
#creditsBox p {
	margin: 0 0 8px;
	color: var(--muted);
}
#creditsBox a {
	color: inherit;
}
#card h3 {
	margin: 0 0 4px;
	font: 600 18px/1.2 Fraunces, Georgia, serif;
}
#card .tag {
	display: inline-block;
	font-size: 11px;
	font-weight: 600;
	padding: 1px 7px;
	border-radius: 99px;
	color: #fff;
	margin-bottom: 8px;
}
#card .close {
	position: absolute;
	top: 8px;
	right: 10px;
	background: none;
	border: 0;
	font-size: 18px;
	color: var(--muted);
	cursor: pointer;
}
#loading {
	position: fixed;
	inset: 0;
	display: grid;
	place-items: center;
	font: 600 20px Fraunces, Georgia, serif;
	color: var(--muted);
	background: var(--paper);
	transition: opacity 0.6s;
}
#loading.done {
	opacity: 0;
	pointer-events: none;
}

@media (max-width: 640px) {
	#panel {
		top: auto;
		bottom: 0;
		left: 0;
		right: 0;
		width: auto;
		max-height: 42%;
		border-radius: 14px 14px 0 0;
	}
	#card {
		left: 16px;
		right: 16px;
		width: auto;
		top: 16px;
		bottom: auto;
	}
	#creditsBox {
		left: 16px;
		right: 16px;
		width: auto;
	}
}
.place {
	font-size: 12px;
	font-weight: 600;
	letter-spacing: 0.04em;
	color: var(--muted);
	margin: -2px 0 8px;
}

/* detector reports */
section .sub {
	color: var(--muted);
	font-size: 12px;
	margin: -4px 0 6px;
}
#detections li {
	align-items: flex-start;
}
#detections .chip {
	margin-top: 4px;
}
#detections .what {
	flex: 1;
	min-width: 0;
}
#detections small {
	display: block;
	color: var(--muted);
	font-size: 12px;
}
#detections .empty {
	color: var(--muted);
	font-size: 12px;
	cursor: default;
}
.alarm {
	font-style: normal;
	font-size: 11px;
	font-weight: 600;
	color: #fff;
	background: #c33d32;
	border-radius: 4px;
	padding: 0 4px;
}
#card .heard {
	font-size: 12px;
	color: var(--muted);
	font-style: italic;
	margin: 8px 0 0;
}
#card .note {
	font-size: 11px;
	color: var(--muted);
	margin: 6px 0 0;
}

/* replay list */
.count {
	font-weight: 500;
	color: var(--muted);
	text-transform: none;
	letter-spacing: 0;
}
.seg {
	display: inline-flex;
	border: 1px solid var(--line);
	border-radius: 9px;
	padding: 2px;
	gap: 2px;
	margin-bottom: 6px;
}
.seg button {
	background: none;
	border: 0;
	border-radius: 7px;
	padding: 3px 10px;
	font: inherit;
	font-size: 12px;
	color: var(--ink);
	cursor: pointer;
}
.seg button.on {
	background: var(--ink);
	color: var(--paper);
}
#history {
	list-style: none;
	margin: 0 -6px;
	padding: 0 6px;
	max-height: 220px;
	overflow-y: auto;
}
#history li {
	display: flex;
	gap: 8px;
	align-items: center;
	padding: 4px 6px;
	margin: 0 -6px;
	border-radius: 8px;
	cursor: pointer;
	font-size: 13px;
}
#history li:hover,
#history li.sel {
	background: var(--line);
}
#history .when {
	flex: none;
	width: 74px;
	color: var(--muted);
	font-variant-numeric: tabular-nums;
	font-size: 12px;
}
#history .what {
	flex: 1;
	min-width: 0;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
#history .dir {
	color: var(--muted);
}

/* camera buttons */
#nav {
	position: fixed;
	top: 16px;
	right: 16px;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 8px;
	background: var(--card);
	backdrop-filter: blur(8px);
	border-radius: 14px;
	padding: 8px;
	box-shadow: 0 6px 30px rgba(0, 0, 0, 0.12);
	user-select: none;
	-webkit-user-select: none;
}
#nav .seg {
	margin: 0;
}
#nav .pad {
	display: grid;
	grid-template-columns: repeat(3, 30px);
	grid-template-rows: repeat(3, 30px);
	gap: 2px;
}
#nav .pad button,
#nav .zoom button {
	width: 30px;
	height: 30px;
	border: 1px solid var(--line);
	background: var(--paper);
	color: var(--ink);
	border-radius: 8px;
	font-size: 14px;
	cursor: pointer;
	touch-action: none;
	padding: 0;
}
#nav .pad button:active,
#nav .zoom button:active {
	background: var(--line);
}
#nav [data-hold="tilt:1"] { grid-area: 1 / 2; }
#nav [data-hold="yaw:1"] { grid-area: 2 / 1; }
#nav [data-act="home"] { grid-area: 2 / 2; }
#nav [data-hold="yaw:-1"] { grid-area: 2 / 3; }
#nav [data-hold="tilt:-1"] { grid-area: 3 / 2; }
#nav .zoom {
	display: flex;
	gap: 2px;
}

/* replay bar */
#replayBar {
	position: fixed;
	left: 50%;
	bottom: 16px;
	transform: translateX(-50%);
	width: min(720px, calc(100vw - 32px - 300px - 16px - 300px));
	min-width: 420px;
	display: flex;
	align-items: center;
	gap: 10px;
	background: var(--card);
	backdrop-filter: blur(8px);
	border-radius: 14px;
	padding: 10px 12px;
	box-shadow: 0 6px 30px rgba(0, 0, 0, 0.16);
	border: 2px solid #c33d32;
}
#replayBar[hidden] {
	display: none;
}
#replayBar .rtag {
	font-size: 10px;
	font-weight: 700;
	letter-spacing: 0.08em;
	color: #fff;
	background: #c33d32;
	border-radius: 5px;
	padding: 2px 6px;
}
#rbPlay {
	width: 34px;
	height: 34px;
	border-radius: 50%;
	border: 0;
	background: var(--ink);
	color: var(--paper);
	cursor: pointer;
	font-size: 12px;
	flex: none;
}
#replayBar .rmain {
	flex: 1;
	min-width: 0;
}
#replayBar .rtop {
	display: flex;
	gap: 8px;
	font-size: 13px;
	white-space: nowrap;
	overflow: hidden;
}
#replayBar .rtop span {
	color: var(--muted);
	overflow: hidden;
	text-overflow: ellipsis;
}
#rbScrub {
	width: 100%;
	accent-color: #c33d32;
}
#replayBar .rates {
	margin: 0;
}
#replayBar .ghost,
#replayBar .live {
	border: 1px solid var(--line);
	background: none;
	color: var(--ink);
	border-radius: 8px;
	padding: 5px 10px;
	font: inherit;
	font-size: 12px;
	cursor: pointer;
	white-space: nowrap;
}
#replayBar .live {
	background: #2f6f4f;
	border-color: #2f6f4f;
	color: #fff;
}
body.replaying #card {
	bottom: 96px;
}
@media (max-width: 1100px) {
	#replayBar {
		width: calc(100vw - 32px);
		min-width: 0;
		flex-wrap: wrap;
		top: 16px;
		bottom: auto;
		left: 16px;
		transform: none;
	}
	body.replaying #nav {
		top: 150px;
	}
}
@media (max-width: 640px) {
	#nav {
		top: auto;
		bottom: calc(42% + 12px);
		right: 12px;
		padding: 6px;
	}
	#nav .seg {
		display: none;
	}
	body.replaying #nav {
		top: auto;
	}
	body.replaying #card {
		top: 150px;
		bottom: auto;
	}
}

/* folded sections */
details.fold summary {
	list-style: none;
	cursor: pointer;
	display: flex;
	align-items: baseline;
	gap: 6px;
}
details.fold summary::-webkit-details-marker {
	display: none;
}
details.fold summary h2 {
	margin: 0;
}
details.fold summary::before {
	content: "▸";
	color: var(--muted);
	font-size: 11px;
}
details.fold[open] summary::before {
	content: "▾";
}
details.fold {
	padding: 10px 0;
	border-top: 1px solid var(--line);
}
details.fold > .sub {
	margin-top: 6px;
}

/* train info bar */
#trainBar {
	position: fixed;
	left: 50%;
	transform: translateX(-50%);
	bottom: 16px;
	width: min(760px, calc(100vw - 340px - 32px));
	background: var(--card);
	backdrop-filter: blur(8px);
	border-radius: 14px;
	padding: 10px 14px 10px;
	box-shadow: 0 6px 30px rgba(0, 0, 0, 0.16);
	margin-left: 160px;
}
#trainBar[hidden] {
	display: none;
}
#trainBar .tbTop {
	display: flex;
	align-items: center;
	gap: 8px;
}
#tbHead {
	flex: 1;
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 4px 10px;
	min-width: 0;
}
#tbHead .tag {
	font-size: 11px;
	font-weight: 600;
	padding: 1px 7px;
	border-radius: 99px;
	color: #fff;
}
#tbHead .sym {
	font: 600 17px/1.2 Fraunces, Georgia, serif;
}
#tbHead .muted {
	color: var(--muted);
	font-size: 12px;
}
#tbHead .src {
	font-size: 11px;
	border-radius: 5px;
	padding: 0 5px;
	border: 1px solid var(--line);
	color: var(--muted);
}
#tbHead .src.live {
	color: #2f6f4f;
	border-color: #2f6f4f;
}
#tbClose {
	background: none;
	border: 0;
	font-size: 18px;
	color: var(--muted);
	cursor: pointer;
}
#tbStats {
	display: grid;
	grid-template-columns: repeat(5, minmax(0, 1fr));
	gap: 6px 12px;
	margin: 8px 0;
}
#tbStats div {
	display: flex;
	flex-direction: column;
	min-width: 0;
}
#tbStats span {
	font-size: 10px;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: var(--muted);
}
#tbStats b {
	font-size: 13px;
	font-weight: 600;
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
.tbViewsRow {
	display: flex;
	align-items: center;
	gap: 8px;
	overflow-x: auto;
}
.tbViewsRow .lbl {
	font-size: 10px;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: var(--muted);
}
.tbViewsRow .seg {
	margin: 0;
	flex-wrap: nowrap;
}
.tbViewsRow .seg button {
	white-space: nowrap;
}
/* replay controls sit just above the train bar */
body.hasTrainBar #replayBar {
	bottom: 190px;
}
#replayBar {
	margin-left: 160px;
}
@media (max-width: 1100px) {
	#trainBar {
		width: calc(100vw - 32px);
		margin-left: 0;
	}
	#tbStats {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}
	#replayBar {
		margin-left: 0;
	}
	body.hasTrainBar #replayBar {
		bottom: auto;
	}
}
@media (max-width: 640px) {
	#trainBar {
		top: 12px;
		bottom: auto;
		left: 12px;
		right: 12px;
		width: auto;
		transform: none;
		padding: 8px 10px;
	}
	#tbStats {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		max-height: 90px;
		overflow-y: auto;
	}
}

/* sky / look settings */
#nav .lookBtn {
	width: 30px;
	height: 30px;
	border: 1px solid var(--line);
	background: var(--paper);
	color: var(--ink);
	border-radius: 8px;
	cursor: pointer;
	font-size: 15px;
}
#lookPanel {
	position: absolute;
	top: 0;
	right: calc(100% + 8px);
	width: 220px;
	background: var(--card);
	backdrop-filter: blur(8px);
	border-radius: 12px;
	padding: 10px 12px;
	box-shadow: 0 6px 30px rgba(0, 0, 0, 0.14);
	display: flex;
	flex-direction: column;
	gap: 8px;
	font-size: 12px;
}
#lookPanel[hidden] {
	display: none;
}
#lookPanel label {
	display: flex;
	flex-direction: column;
	gap: 2px;
}
#lookPanel label.sw {
	flex-direction: row;
	align-items: center;
	gap: 6px;
	font-weight: 600;
}
#lookPanel input[type="range"] {
	width: 100%;
}
#lookPanel .hint {
	margin: 0;
}
#trainBar .meaning {
	font-size: 11px;
	color: var(--muted);
	margin-top: 2px;
}
#tbLock {
	flex: none;
	border: 1px solid var(--line);
	background: var(--paper);
	color: var(--ink);
	border-radius: 8px;
	padding: 4px 10px;
	font: inherit;
	font-size: 12px;
	cursor: pointer;
	white-space: nowrap;
}
#tbLock.on {
	background: var(--ink);
	color: var(--paper);
}

/* train pins when zoomed out */
#markers {
	position: fixed;
	inset: 0;
	pointer-events: none;
	overflow: hidden;
}
.marker {
	position: absolute;
	left: 0;
	top: 0;
	pointer-events: auto;
	border: 0;
	background: none;
	padding: 0;
	cursor: pointer;
	display: flex;
	align-items: center;
	gap: 4px;
	margin: -9px 0 0 -9px;
	font: 600 11px Inter, system-ui, sans-serif;
	will-change: transform;
}
.marker i {
	width: 18px;
	height: 18px;
	border-radius: 50%;
	background: #ffd21f;
	border: 3px solid #fff;
	box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.35), 0 0 14px 4px rgba(255, 210, 31, 0.7);
	animation: pin 1.8s ease-in-out infinite;
}
.marker.up i {
	background: #ff4d2e;
	box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.35), 0 0 14px 4px rgba(255, 77, 46, 0.65);
}
.marker.amtk i {
	background: #2f7cff;
	box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.35), 0 0 14px 4px rgba(47, 124, 255, 0.65);
}
.marker span {
	background: rgba(20, 18, 16, 0.78);
	color: #fff;
	border-radius: 5px;
	padding: 1px 5px;
	white-space: nowrap;
}
.marker.small span {
	display: none;
}
.marker.sel i {
	transform: scale(1.35);
}
@keyframes pin {
	50% {
		box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.35), 0 0 22px 9px rgba(255, 210, 31, 0.35);
	}
}

/* compass */
#compass {
	border: 0;
	background: none;
	padding: 0;
	cursor: pointer;
	display: flex;
	flex-direction: column;
	align-items: center;
	color: var(--muted);
	font: 500 10px Inter, system-ui, sans-serif;
}
#compassRose {
	transition: none;
}
#compassRose .ring {
	fill: var(--paper);
	stroke: var(--line);
	stroke-width: 2;
}
#compassRose .ticks line {
	stroke: var(--muted);
	stroke-width: 2;
}
#compassRose .n {
	fill: #c33d32;
}
#compassRose .s {
	fill: var(--muted);
	opacity: 0.6;
}
#compassRose text {
	font: 700 11px Inter, system-ui, sans-serif;
	text-anchor: middle;
	fill: var(--ink);
}
#compassRose text.lN {
	fill: #c33d32;
}

/* map labels */
#labels {
	position: fixed;
	inset: 0;
	pointer-events: none;
	overflow: hidden;
}
.label {
	position: absolute;
	left: 0;
	top: 0;
	white-space: nowrap;
	text-align: center;
	font: 600 12px Inter, system-ui, sans-serif;
	color: #2b2621;
	text-shadow: 0 0 3px #f4efe5, 0 0 3px #f4efe5, 0 0 6px #f4efe5;
	will-change: transform;
}
.label small {
	display: block;
	font-size: 9px;
	font-weight: 500;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: #6b6258;
}
.label.road {
	font-size: 11px;
	color: #5b4a35;
}
.label.road.minor {
	font-weight: 500;
}
.label.water {
	font-style: italic;
	font-weight: 500;
	color: #2f5d8a;
}
.label.rail {
	color: #3a2a20;
	font-family: Fraunces, Georgia, serif;
	font-size: 13px;
}
.label.place.town {
	font: 600 16px Fraunces, Georgia, serif;
}
.label.place.peak::before {
	content: "▲ ";
	font-size: 9px;
}
body.night .label {
	color: #f2ede4;
	text-shadow: 0 0 3px #0e1420, 0 0 6px #0e1420;
}
body.night .label small {
	color: #b9c1d2;
}
#coords {
	position: fixed;
	right: 16px;
	bottom: 16px;
	font: 500 11px Inter, system-ui, sans-serif;
	color: var(--muted);
	background: var(--card);
	border-radius: 6px;
	padding: 2px 7px;
	pointer-events: none;
	font-variant-numeric: tabular-nums;
}
#coords:empty {
	display: none;
}
body.hasTrainBar #coords {
	display: none;
}

/* name tags over engines */
.tag3d {
	position: absolute;
	left: 0;
	top: 0;
	pointer-events: auto;
	cursor: pointer;
	border: 0;
	border-left: 4px solid #e8661c;
	background: rgba(20, 18, 16, 0.82);
	color: #fff;
	border-radius: 6px;
	padding: 2px 7px 3px;
	font: 500 11px Inter, system-ui, sans-serif;
	white-space: nowrap;
	text-align: left;
	will-change: transform;
}
.tag3d.up {
	border-left-color: #f4b400;
}
.tag3d.amtk {
	border-left-color: #2f7cff;
}
.tag3d b {
	font-weight: 700;
}
.tag3d small {
	display: block;
	font-size: 9px;
	opacity: 0.75;
}
.tag3d.sel {
	outline: 2px solid #ffd21f;
}
/* the pointer: a thin stem down to the train (or detector) with a small tip,
   starting below the selection outline so it doesn't notch into it */
.tag3d::before {
	content: "";
	position: absolute;
	left: 50%;
	top: calc(100% + 2px);
	width: 2px;
	height: 11px;
	margin-left: -1px;
	background: rgba(20, 18, 16, 0.82);
}
.tag3d::after {
	content: "";
	position: absolute;
	left: 50%;
	top: calc(100% + 12px);
	margin-left: -4px;
	border: 4px solid transparent;
	border-bottom: 0;
	border-top: 5px solid rgba(20, 18, 16, 0.82);
}
.tag3d.sel::before {
	background: #ffd21f;
}
.tag3d.sel::after {
	border-top-color: #ffd21f;
}
#trains li.divider {
	cursor: default;
	font-size: 10px;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	color: var(--muted);
	padding-top: 8px;
	border-top: 1px dashed var(--line);
	margin-top: 4px;
}
#trains li.divider:hover {
	background: none;
}

/* radar */
#radarCorner {
	position: fixed;
	right: 16px;
	bottom: 16px;
	width: 170px;
	display: flex;
	flex-direction: column;
	gap: 4px;
	z-index: 3;
}
#radarMini {
	width: 170px;
	height: 200px;
	border-radius: 12px;
	cursor: pointer;
	box-shadow: 0 6px 24px rgba(0, 0, 0, 0.25);
	border: 2px solid rgba(160, 255, 200, 0.35);
	display: block;
}
#radarBtn {
	align-self: stretch;
	border: 0;
	border-radius: 8px;
	background: #0d1712;
	color: #bff5d2;
	font: 600 11px Inter, system-ui, sans-serif;
	letter-spacing: 0.04em;
	padding: 4px;
	cursor: pointer;
}
#radarView {
	position: fixed;
	inset: 0;
	z-index: 20;
	background: #0b130f;
	display: flex;
	flex-direction: column;
}
#radarView[hidden] {
	display: none;
}
#radarBig {
	flex: 1;
	width: 100%;
	min-height: 0;
	cursor: crosshair;
}
#radarView .radarBar {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 12px;
	padding: 10px 16px;
	color: #9fd8b4;
	font: 500 12px Inter, system-ui, sans-serif;
}
#radarBack {
	border: 0;
	border-radius: 8px;
	background: #2f6f4f;
	color: #fff;
	padding: 7px 14px;
	font: 600 12px Inter, system-ui, sans-serif;
	cursor: pointer;
}
#coords {
	bottom: 252px;
}
#card {
	right: 200px;
}
#trainBar {
	width: min(760px, calc(100vw - 340px - 32px - 200px));
}
@media (max-width: 1100px) {
	#radarCorner {
		width: 120px;
	}
	#radarMini {
		width: 120px;
		height: 140px;
	}
	#trainBar {
		width: calc(100vw - 32px - 140px);
		left: 16px;
		transform: none;
	}
}
@media (max-width: 640px) {
	#radarCorner {
		bottom: calc(42% + 12px);
		left: 12px;
		right: auto;
		width: 96px;
	}
	#radarMini {
		width: 96px;
		height: 110px;
	}
	#radarBtn {
		display: none;
	}
	#trainBar {
		width: auto;
	}
}
.tbLocos {
	margin: -2px 0 8px;
	font-size: 12px;
}
.tbLocos summary {
	cursor: pointer;
	font-size: 10px;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: var(--muted);
}
.tbLocos summary .muted {
	text-transform: none;
	letter-spacing: 0;
}
#tbLocos {
	list-style: none;
	margin: 4px 0 0;
	padding: 0;
	display: grid;
	gap: 3px;
	max-height: 120px;
	overflow-y: auto;
}
#tbLocos li {
	display: flex;
	gap: 8px;
	align-items: baseline;
	cursor: help;
}
#tbLocos li b {
	font-weight: 600;
	min-width: 78px;
}
#tbLocos li span {
	flex: 1;
	color: var(--ink);
}
#tbLocos li em {
	font-style: normal;
	font-size: 10px;
	color: var(--muted);
}
.radio .row span {
	font-size: 12px;
	font-weight: 600;
}
.radioRow {
	display: flex;
	gap: 10px;
	align-items: center;
}
#radioBtn {
	border: 0;
	border-radius: 8px;
	background: var(--ink);
	color: var(--paper);
	padding: 5px 12px;
	font: inherit;
	font-size: 12px;
	cursor: pointer;
}
#radioLink {
	font-size: 12px;
	color: var(--muted);
}
#lookPanel select {
	font: inherit;
	font-size: 12px;
	max-width: 100%;
}

/* story player */
.story {
	--accent: #e8661c;
	flex: none;
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 3px 10px 3px 3px;
	border-radius: 99px;
	background: var(--paper);
	border: 1px solid var(--line);
	min-width: 190px;
	max-width: 260px;
}
.story[hidden] {
	display: none;
}
#storyPlay {
	flex: none;
	width: 30px;
	height: 30px;
	border-radius: 50%;
	border: 0;
	background: var(--ink);
	color: var(--paper);
	display: grid;
	place-items: center;
	cursor: pointer;
	padding: 0;
	transition: transform 0.15s ease, background 0.2s;
}
#storyPlay:hover {
	transform: scale(1.07);
}
#storyPlay svg {
	width: 16px;
	height: 16px;
	fill: currentColor;
	grid-area: 1 / 1;
	display: none;
}
#story.idle .i-play,
#story.paused .i-play,
#story.done .i-play,
#story.error .i-play,
#story.playing .i-pause {
	display: block;
}
#story.loading .i-spin {
	display: block;
	fill: none;
	stroke: currentColor;
	stroke-width: 2.5;
	stroke-dasharray: 34 60;
	stroke-linecap: round;
	animation: storySpin 0.9s linear infinite;
	transform-origin: 50% 50%;
}
.story.playing #storyPlay,
.story:hover #storyPlay {
	background: var(--accent);
}
@keyframes storySpin {
	to {
		transform: rotate(360deg);
	}
}
.storyBody {
	flex: 1;
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 4px;
}
#storyLabel {
	font-size: 12px;
	font-weight: 600;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
.story.error #storyLabel {
	color: var(--muted);
	font-weight: 500;
}
.storyTrack {
	height: 3px;
	border-radius: 2px;
	background: var(--line);
	overflow: hidden;
	cursor: pointer;
	display: none;
}
.story.playing .storyTrack,
.story.paused .storyTrack,
.story.done .storyTrack {
	display: block;
}
.storyTrack i {
	display: block;
	height: 100%;
	width: 0;
	background: var(--accent);
	transition: width 0.25s linear;
}
.storyTime {
	font-size: 11px;
	color: var(--muted);
	font-variant-numeric: tabular-nums;
	min-width: 30px;
	text-align: right;
}
.story .eq {
	display: none;
	align-items: flex-end;
	gap: 2px;
	height: 14px;
}
.story.playing .eq {
	display: flex;
}
.eq i {
	width: 3px;
	border-radius: 1px;
	background: var(--accent);
	animation: eq 0.9s ease-in-out infinite;
}
.eq i:nth-child(2) {
	animation-delay: -0.3s;
}
.eq i:nth-child(3) {
	animation-delay: -0.6s;
}
.eq i:nth-child(4) {
	animation-delay: -0.15s;
}
@keyframes eq {
	0%,
	100% {
		height: 3px;
	}
	50% {
		height: 14px;
	}
}
@media (prefers-reduced-motion: reduce) {
	.eq i,
	.story.loading .i-spin {
		animation: none;
	}
}

/* about link */
.aboutLink {
	float: right;
	margin-top: 6px;
	font: 600 11px Inter, system-ui, sans-serif;
	letter-spacing: 0.02em;
	color: #fff;
	background: #e8661c;
	padding: 4px 9px;
	border-radius: 99px;
	text-decoration: none;
}
.aboutLink:hover {
	background: #c9520f;
}

/* embed: the model only */
body.embed #panel,
body.embed #nav,
body.embed #radarCorner,
body.embed #trainBar,
body.embed #replayBar,
body.embed #card,
body.embed #coords,
body.embed #creditsBox,
body.embed #markers,
body.embed #loading {
	display: none !important;
}

/* ---------- locomotive hologram */
#holo {
	position: fixed;
	right: 16px;
	top: 16px;
	width: min(760px, calc(100vw - 32px));
	max-height: calc(100vh - 32px);
	z-index: 30;
	background: radial-gradient(120% 90% at 30% 20%, rgba(18, 52, 64, 0.94), rgba(6, 14, 20, 0.96));
	border: 1px solid rgba(111, 231, 255, 0.45);
	border-radius: 16px;
	box-shadow: 0 0 40px rgba(111, 231, 255, 0.18), inset 0 0 60px rgba(111, 231, 255, 0.06);
	color: #c9f6ff;
	font: 500 12px Inter, system-ui, sans-serif;
	padding: 12px 14px 10px;
	display: flex;
	flex-direction: column;
	overflow: hidden;
}
#holo[hidden] {
	display: none;
}
#holo.in {
	animation: holoIn 0.6s ease-out;
}
@keyframes holoIn {
	0% {
		opacity: 0;
		transform: scale(0.96) translateY(8px);
		filter: brightness(2.2);
	}
	60% {
		opacity: 1;
		filter: brightness(1.4);
	}
	100% {
		transform: none;
		filter: none;
	}
}
#holo .hTop {
	display: flex;
	justify-content: space-between;
	align-items: flex-start;
}
#holo .hKick {
	font-size: 10px;
	letter-spacing: 0.16em;
	text-transform: uppercase;
	color: #6fe7ff;
}
#holo h3 {
	margin: 2px 0 0;
	font: 700 22px Fraunces, Georgia, serif;
	color: #eafcff;
	text-shadow: 0 0 12px rgba(111, 231, 255, 0.7);
}
#hSub {
	color: #8fd4e2;
}
#hClose {
	background: none;
	border: 1px solid rgba(111, 231, 255, 0.4);
	color: #c9f6ff;
	border-radius: 8px;
	width: 30px;
	height: 30px;
	font-size: 18px;
	cursor: pointer;
}
#holo .hBody {
	display: grid;
	grid-template-columns: 1.45fr 1fr;
	gap: 12px;
	min-height: 0;
	margin-top: 8px;
}
#holo .hStage {
	position: relative;
	min-height: 300px;
	border-radius: 10px;
	overflow: hidden;
	background: radial-gradient(70% 60% at 50% 60%, rgba(111, 231, 255, 0.1), transparent);
}
#hCanvas {
	width: 100%;
	height: 100%;
	display: block;
	cursor: grab;
	filter: drop-shadow(0 0 4px rgba(111, 231, 255, 0.55));
}
#holo .hScan {
	position: absolute;
	inset: 0;
	pointer-events: none;
	background: repeating-linear-gradient(0deg, rgba(111, 231, 255, 0.05) 0 1px, transparent 1px 3px);
	animation: scan 6s linear infinite;
}
@keyframes scan {
	to {
		background-position: 0 120px;
	}
}
#hLabels {
	position: absolute;
	inset: 0;
	pointer-events: none;
}
.hLab {
	position: absolute;
	left: 0;
	top: 0;
	display: flex;
	align-items: flex-start;
	gap: 4px;
	white-space: nowrap;
	transition: opacity 0.2s;
}
.hLab i {
	width: 6px;
	height: 6px;
	margin: -3px 0 0 -3px;
	border-radius: 50%;
	background: #6fe7ff;
	box-shadow: 0 0 8px #6fe7ff;
	flex: none;
}
.hLab span {
	margin-top: -18px;
	padding: 1px 6px;
	border-left: 1px solid rgba(111, 231, 255, 0.7);
	background: rgba(4, 18, 24, 0.6);
	font-size: 11px;
	color: #eafcff;
}
.hLab small {
	display: block;
	color: #8fd4e2;
	font-size: 9.5px;
	max-width: 180px;
	white-space: normal;
}
.hLab.warm i {
	background: #ffad42;
	box-shadow: 0 0 8px #ffad42;
}
.hLab.warm span {
	border-left-color: #ffad42;
}
.hLab.cool i {
	background: #7aa8ff;
	box-shadow: 0 0 8px #7aa8ff;
}
.hLab.dim i {
	background: #ffe36b;
	box-shadow: 0 0 8px #ffe36b;
}
.hLab.dim span {
	border-left-color: #ffe36b;
}
#hSpecs {
	margin: 0;
	overflow-y: auto;
	display: grid;
	grid-template-columns: auto 1fr;
	gap: 5px 10px;
	align-content: start;
	padding-right: 4px;
}
#hSpecs dt {
	color: #6fe7ff;
	font-size: 10px;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	padding-top: 2px;
}
#hSpecs dd {
	margin: 0;
	color: #eafcff;
}
#hSpecs small {
	display: block;
	color: #6fa9b6;
	font-size: 9.5px;
}
#hSpecs small.flag {
	color: #ffd36b;
}
#holo .hFoot {
	margin: 8px 0 0;
	font-size: 10px;
	color: #6fa9b6;
}
.holoBtn {
	flex: none;
	border: 1px solid #6fe7ff;
	background: #0b1d24;
	color: #c9f6ff;
	border-radius: 99px;
	padding: 6px 12px;
	font: 600 12px Inter, system-ui, sans-serif;
	cursor: pointer;
	box-shadow: 0 0 10px rgba(111, 231, 255, 0.25);
}
.holoBtn:hover {
	box-shadow: 0 0 16px rgba(111, 231, 255, 0.5);
}
@media (max-width: 760px) {
	#holo .hBody {
		grid-template-columns: 1fr;
	}
	#holo .hStage {
		min-height: 220px;
	}
	#hSpecs {
		max-height: 30vh;
	}
}

/* info bar: fold and drag */
#tbHead {
	cursor: grab;
	user-select: none;
}
#tbHead:active {
	cursor: grabbing;
}
#trainBar .fold {
	background: none;
	border: 1px solid var(--line);
	border-radius: 7px;
	width: 26px;
	height: 26px;
	color: var(--muted);
	cursor: pointer;
	flex: none;
}
#trainBar.collapsed #tbMeaning,
#trainBar.collapsed #tbStats,
#trainBar.collapsed .tbLocos,
#trainBar.collapsed .tbViewsRow .lbl {
	display: none;
}
#trainBar.collapsed {
	padding-bottom: 8px;
}
#trainBar.collapsed .tbViewsRow {
	margin-top: 6px;
}

/* trackside video spots */
.spot {
	position: absolute;
	left: 0;
	top: 0;
	width: 26px;
	height: 26px;
	margin: -13px 0 0 -13px;
	border-radius: 50%;
	border: 2px solid #fff;
	background: rgba(20, 18, 16, 0.75);
	color: #fff;
	pointer-events: auto;
	cursor: pointer;
	padding: 4px;
	display: grid;
	place-items: center;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}
.spot svg {
	width: 14px;
	height: 14px;
	fill: currentColor;
}
.spot.has {
	background: #c33d32;
}
.spot:hover {
	transform-origin: center;
	box-shadow: 0 0 0 3px rgba(195, 61, 50, 0.45);
}
#spotCard {
	position: fixed;
	right: 200px;
	bottom: 16px;
	width: 340px;
	max-height: calc(100vh - 32px);
	overflow-y: auto;
	background: var(--card);
	backdrop-filter: blur(8px);
	border-radius: 14px;
	padding: 14px 16px;
	box-shadow: 0 6px 30px rgba(0, 0, 0, 0.18);
	z-index: 6;
}
#spotCard[hidden] {
	display: none;
}
#spotCard h3 {
	margin: 0 0 2px;
	font: 600 18px Fraunces, Georgia, serif;
}
#spotCard .tag {
	display: inline-block;
	font-size: 11px;
	font-weight: 600;
	padding: 1px 7px;
	border-radius: 99px;
	color: #fff;
	margin-bottom: 6px;
}
#spotCard .close {
	position: absolute;
	top: 8px;
	right: 10px;
	background: none;
	border: 0;
	font-size: 18px;
	color: var(--muted);
	cursor: pointer;
}
#spotCard .vids {
	display: grid;
	gap: 6px;
	margin: 8px 0;
}
#spotCard .vid {
	display: flex;
	gap: 8px;
	align-items: center;
	border: 1px solid var(--line);
	background: var(--paper);
	border-radius: 8px;
	padding: 4px;
	cursor: pointer;
	text-align: left;
	color: var(--ink);
	font: inherit;
}
#spotCard .vid img {
	width: 96px;
	border-radius: 5px;
}
#spotCard .vid small {
	display: block;
	color: var(--muted);
	font-size: 11px;
}
#spotCard .player iframe {
	width: 100%;
	aspect-ratio: 16 / 9;
	border: 0;
	border-radius: 8px;
}
#spotCard .empty {
	color: var(--muted);
	font-size: 12px;
}
#spotCard .yt {
	display: block;
	margin: 6px 0 10px;
	font-size: 13px;
	color: #c33d32;
	font-weight: 600;
}
#spotCard form {
	display: grid;
	gap: 6px;
}
#spotCard input {
	font: inherit;
	font-size: 12px;
	padding: 6px 8px;
	border: 1px solid var(--line);
	border-radius: 7px;
	background: var(--paper);
	color: var(--ink);
}
#spotCard form button {
	justify-self: start;
	border: 0;
	border-radius: 8px;
	background: var(--ink);
	color: var(--paper);
	padding: 6px 12px;
	font: 600 12px Inter, system-ui, sans-serif;
	cursor: pointer;
}
#spotCard .msg {
	color: #c33d32;
}

/* hologram: labels only on hover; expand to full screen */
.hLab {
	opacity: 0 !important;
	transition: opacity 0.15s;
}
.hLab.on {
	opacity: 1 !important;
}
.hLab.on span {
	font-size: 13px;
}
.hLab.on small {
	font-size: 11px;
	max-width: 260px;
}
.hParts {
	position: absolute;
	left: 8px;
	right: 8px;
	bottom: 8px;
	display: flex;
	flex-wrap: wrap;
	gap: 4px;
}
.hParts button {
	border: 1px solid rgba(111, 231, 255, 0.35);
	background: rgba(4, 18, 24, 0.55);
	color: #9fe6f5;
	border-radius: 99px;
	padding: 2px 9px;
	font: 600 10.5px Inter, system-ui, sans-serif;
	cursor: pointer;
}
.hParts button.on {
	background: #6fe7ff;
	color: #04161c;
}
.hHint {
	position: absolute;
	top: 8px;
	left: 10px;
	font-size: 10px;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: #6fa9b6;
	transition: opacity 0.2s;
	pointer-events: none;
}
#holo.full {
	inset: 12px;
	width: auto;
	max-height: none;
	right: 12px;
	top: 12px;
}
#holo.full .hBody {
	flex: 1;
	grid-template-columns: 3fr 1fr;
}
#holo.full .hStage {
	min-height: 0;
	height: 100%;
}
#holo.full .hLab.on span {
	font-size: 15px;
}
#lookPanel .qual {
	display: flex;
	flex-direction: column;
	gap: 4px;
	font-weight: 600;
}
#lookPanel .qual .seg {
	margin: 0;
}

/* ---------- railroad type set
   League Gothic: train symbols and tags (railroad-poster condensed gothic)
   Overpass: map labels (from US highway-sign lettering)
   IBM Plex Mono: technical readouts (steady digits) */
#tbHead .sym,
.tag3d b,
.marker span,
#trains .what,
#history .what,
#holo h3 {
	font-family: "League Gothic", "Arial Narrow", sans-serif;
	font-weight: 400;
	letter-spacing: 0.04em;
}
#tbHead .sym {
	font-size: 26px;
	line-height: 1;
}
#holo h3 {
	font-size: 30px;
}
.tag3d b {
	font-size: 16px;
}
.marker span {
	font-size: 14px;
}
#trains .what,
#history .what {
	font-size: 16px;
}
.label,
.label.rail,
.label.place.town {
	font-family: Overpass, Inter, system-ui, sans-serif;
}
.label.place.town {
	font-weight: 700;
}
#tbStats b,
#coords,
#clock,
#hSpecs dd,
.hLab span,
#history .when,
.storyTime,
#rbTime {
	font-family: "IBM Plex Mono", ui-monospace, monospace;
	font-weight: 500;
	letter-spacing: -0.02em;
}
#tbStats b {
	font-size: 12.5px;
}

/* ---------- type, second pass (3 Dec): League Gothic was too narrow to read at
   small sizes. Train symbols now use Overpass Bold (US highway-sign lettering,
   made to be read at a glance), and the tag over a train is larger. */
#tbHead .sym,
.tag3d b,
.marker span,
#trains .what,
#history .what,
#holo h3 {
	font-family: Overpass, Inter, system-ui, sans-serif;
	font-weight: 700;
	letter-spacing: 0.01em;
}
#tbHead .sym {
	font-size: 20px;
}
#holo h3 {
	font-size: 22px;
}
#trains .what,
#history .what {
	font-size: 13.5px;
	font-weight: 500;
}
.marker span {
	font-size: 12.5px;
	padding: 2px 7px;
}
.tag3d {
	padding: 5px 11px 6px;
	font-size: 13px;
	border-left-width: 5px;
	border-radius: 8px;
}
.tag3d b {
	font-size: 17px;
	margin-right: 4px;
}
.tag3d small {
	font-size: 11.5px;
	opacity: 0.85;
}

/* info bar in Overpass; a clear Details / Hide details button */
#trainBar,
#trainBar button,
#tbHead .muted,
#tbStats span,
#tbMeaning,
.tbLocos {
	font-family: Overpass, Inter, system-ui, sans-serif;
}
#tbStats b {
	font-family: Overpass, Inter, system-ui, sans-serif;
	font-weight: 700;
	font-size: 14px;
	letter-spacing: 0;
}
#tbStats span {
	font-size: 10.5px;
}
#trainBar .fold {
	width: auto;
	height: 30px;
	padding: 0 11px;
	display: inline-flex;
	align-items: center;
	gap: 6px;
	border-radius: 99px;
	font-size: 12.5px;
	font-weight: 700;
	color: var(--ink);
	white-space: nowrap;
}
#trainBar .fold svg {
	width: 15px;
	height: 15px;
}
#trainBar .fold:hover {
	border-color: var(--ink);
}

/* hologram part info */
.hInfo {
	position: absolute;
	left: 10px;
	top: 30px;
	width: min(330px, 46%);
	background: rgba(4, 18, 24, 0.82);
	border: 1px solid rgba(111, 231, 255, 0.4);
	border-left: 3px solid #6fe7ff;
	border-radius: 8px;
	padding: 9px 11px;
	font: 500 12.5px/1.45 Overpass, Inter, system-ui, sans-serif;
	color: #dff8ff;
}
.hInfo[hidden] {
	display: none;
}
.hInfo b {
	font-size: 15px;
	color: #fff;
}
.hInfo p {
	margin: 5px 0 0;
}
.hInfo button {
	margin-top: 8px;
	border: 1px solid #6fe7ff;
	background: none;
	color: #6fe7ff;
	border-radius: 99px;
	padding: 3px 11px;
	font: 700 12px Overpass, Inter, system-ui, sans-serif;
	cursor: pointer;
}
#holo.full .hInfo {
	font-size: 15px;
	width: min(420px, 34%);
}
#holo.full .hInfo b {
	font-size: 19px;
}
#holo.full #hCanvas {
	cursor: default;
}
.hParts button.sel {
	background: #ffad42;
	border-color: #ffad42;
	color: #1a0f04;
}

/* clickable map labels + place card */
#labels .label {
	pointer-events: auto;
	cursor: pointer;
}
#labels .label:hover {
	text-decoration: underline;
}
#placeCard {
	position: fixed;
	left: 50%;
	top: 16px;
	transform: translateX(-50%);
	width: 280px;
	background: var(--card);
	backdrop-filter: blur(8px);
	border-radius: 14px;
	padding: 14px 16px;
	box-shadow: 0 6px 30px rgba(0, 0, 0, 0.18);
	z-index: 7;
	font-family: Overpass, Inter, system-ui, sans-serif;
}
#placeCard[hidden] {
	display: none;
}
#placeCard h3 {
	margin: 0 0 2px;
	font-size: 18px;
	font-weight: 700;
}
#placeCard .close {
	position: absolute;
	top: 8px;
	right: 10px;
	background: none;
	border: 0;
	font-size: 18px;
	color: var(--muted);
	cursor: pointer;
}
#placeCard .gm {
	display: block;
	margin-top: 10px;
	padding: 7px 12px;
	border-radius: 8px;
	background: var(--ink);
	color: var(--paper);
	font-weight: 700;
	font-size: 13px;
	text-decoration: none;
	text-align: center;
}
#placeCard .gm.alt {
	background: none;
	color: var(--ink);
	border: 1px solid var(--line);
	margin-top: 6px;
}

/* ---------- hologram, A2 redesign (3 Dec): Enlarge / Shrink button, no zoom
   cursor, part names in a strip under the model, and the fact card in the
   right-hand column in place of the spec table, so it never covers the model */
#holo .hBtns {
	display: flex;
	gap: 6px;
	align-items: center;
	flex: none;
}
#holo .hSize {
	height: 30px;
	padding: 0 12px;
	border: 1px solid rgba(111, 231, 255, 0.55);
	background: rgba(4, 18, 24, 0.6);
	color: #c9f6ff;
	border-radius: 8px;
	font: 700 12.5px Overpass, Inter, system-ui, sans-serif;
	cursor: pointer;
	white-space: nowrap;
}
#holo .hSize:hover,
#hClose:hover {
	border-color: #6fe7ff;
	box-shadow: 0 0 10px rgba(111, 231, 255, 0.35);
}
#holo .hBody {
	flex: 1 1 auto;
	height: min(400px, calc(100vh - 150px));
	grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr);
	grid-template-rows: minmax(0, 1fr);
}
#holo .hStage {
	min-height: 0;
	height: auto;
	display: flex;
	flex-direction: column;
	gap: 6px;
	overflow: visible;
	background: none;
}
#holo .hView {
	position: relative;
	flex: 1 1 auto;
	min-height: 0;
	border-radius: 10px;
	overflow: hidden;
	background: radial-gradient(70% 60% at 50% 60%, rgba(111, 231, 255, 0.1), transparent);
}
#hCanvas,
#holo.full #hCanvas {
	cursor: grab;
}
#holo .hParts {
	position: static;
	flex: none;
}
#holo .hParts button.sel {
	background: #ffad42;
	border-color: #ffad42;
	color: #1a0f04;
}
#holo .hSide {
	min-height: 0;
	overflow-y: auto;
	padding-right: 4px;
}
#holo .hSide #hSpecs {
	overflow: visible;
}
#holo #hSpecs[hidden] {
	display: none;
}
#holo .hInfo {
	position: static;
	width: auto;
	border-radius: 8px;
	padding: 8px 11px 10px;
	font: 500 13px/1.4 Overpass, Inter, system-ui, sans-serif;
	background: rgba(4, 18, 24, 0.7);
}
#holo .hInfo[hidden] {
	display: none;
}
#holo .hInfo .hBack {
	margin: 0 0 6px;
	padding: 0;
	border: 0;
	background: none;
	color: #6fe7ff;
	font: 600 12px Overpass, Inter, system-ui, sans-serif;
	cursor: pointer;
	text-decoration: underline;
	text-underline-offset: 2px;
}
#holo .hInfo .hCardTitle {
	display: block;
	font-size: 16px;
	color: #fff;
}
#holo .hInfo ul {
	margin: 6px 0 0;
	padding-left: 16px;
}
#holo .hInfo li {
	margin: 3px 0;
}
#holo .hInfo li::marker {
	color: #6fe7ff;
}
#holo .hInfo .calc {
	display: block;
	font-style: normal;
	font-size: 10.5px;
	color: #ffd36b;
}
#holo .hInfo .hSay {
	display: flex;
	align-items: center;
	gap: 8px;
	margin-top: 9px;
}
#holo .hInfo #hSpeak {
	margin: 0;
	padding: 4px 12px;
	border: 1px solid #6fe7ff;
	background: none;
	color: #6fe7ff;
	border-radius: 99px;
	font: 700 12.5px Overpass, Inter, system-ui, sans-serif;
	cursor: pointer;
}
#holo .hInfo #hSpeak.on {
	background: #6fe7ff;
	color: #04161c;
}
#holo .hInfo #hSayNote {
	font-size: 11px;
	color: #ffd36b;
}
#holo .hInfo .hSrc {
	display: block;
	margin-top: 8px;
	font-size: 10px;
	line-height: 1.35;
	color: #6fa9b6;
}
#holo .hInfo .hSrc a {
	color: #8fd4e2;
}
#holo.full .hBody {
	height: auto;
	grid-template-columns: minmax(0, 2.3fr) minmax(300px, 1fr);
}
#holo.full .hInfo {
	width: auto;
	font-size: 15px;
}
#holo.full .hInfo .hCardTitle {
	font-size: 20px;
}
@media (max-width: 760px) {
	#holo .hBody {
		height: auto;
		grid-template-columns: minmax(0, 1fr);
		grid-template-rows: 240px auto;
	}
	#holo .hSide {
		max-height: 34vh;
	}
	#holo.full .hBody {
		grid-template-columns: minmax(0, 1fr);
		grid-template-rows: minmax(0, 1fr) auto;
	}
}
#holo.full {
	background: radial-gradient(120% 90% at 30% 20%, rgb(16, 46, 57), rgb(6, 14, 20));
}

/* ---------- Southwest Chief: live / preview badges, preview link */
.liveBadge,
.previewBadge {
	display: inline-block;
	font: 700 9px/1 "IBM Plex Mono", ui-monospace, monospace;
	letter-spacing: 0.08em;
	font-style: normal;
	padding: 2px 5px;
	border-radius: 4px;
	vertical-align: 1px;
	color: #fff;
	background: #1f5aa6;
}
.liveBadge::before {
	content: "● ";
	color: #7fe08a;
}
.previewBadge {
	background: #6b6f76;
}
#tbHead .src.live {
	background: #1f5aa6;
	color: #fff;
}
button.linkish {
	display: block;
	margin-top: 6px;
	padding: 6px 0;
	min-height: 32px;
	background: none;
	border: 0;
	color: #1f5aa6;
	font: 600 13px Overpass, system-ui, sans-serif;
	cursor: pointer;
	text-align: left;
}
button.linkish:hover {
	text-decoration: underline;
}

/* ---------- glossary, knowledge level welcome card */
#glBtn {
	margin-left: 6px;
	min-width: 32px;
	min-height: 32px;
	border: 1px solid rgba(0, 0, 0, 0.12);
	border-radius: 8px;
	background: rgba(255, 255, 255, 0.6);
	font-size: 16px;
	cursor: pointer;
	vertical-align: middle;
}
#glossary {
	position: fixed;
	z-index: 40;
	left: 260px;
	top: 12px;
	width: min(380px, calc(100vw - 24px));
	max-height: calc(100vh - 24px);
	display: flex;
	flex-direction: column;
	background: #f6f1e7;
	color: #2b2723;
	border-radius: 14px;
	box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
	padding: 12px 14px;
	font: 14px/1.4 Overpass, system-ui, sans-serif;
}
#glossary[hidden],
#welcome[hidden] {
	display: none;
}
#glossary .glHead {
	display: flex;
	justify-content: space-between;
	align-items: center;
	font-size: 16px;
	margin-bottom: 8px;
}
#glossary .close {
	min-width: 36px;
	min-height: 36px;
	border: 0;
	background: none;
	font-size: 22px;
	cursor: pointer;
}
#glSearch {
	padding: 8px 10px;
	border-radius: 8px;
	border: 1px solid rgba(0, 0, 0, 0.15);
	font: inherit;
	margin-bottom: 8px;
}
#glList {
	overflow: auto;
}
#glList h4 {
	margin: 10px 0 4px;
	font-size: 11px;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: #8a7f72;
}
#glList dl {
	margin: 0;
}
#glList dt {
	font-weight: 700;
	margin-top: 6px;
	border-radius: 4px;
	transition: background 0.4s;
}
#glList dt small {
	font-weight: 400;
	color: #8a7f72;
}
#glList dt.flash {
	background: #ffe28a;
}
#glList dd {
	margin: 2px 0 0;
}
#glList dd a {
	font-size: 11px;
	color: #8a7f72;
}
abbr.gl {
	text-decoration: underline dotted 1.5px;
	text-underline-offset: 3px;
	cursor: help;
}
#welcome {
	position: fixed;
	z-index: 45;
	left: 50%;
	top: 50%;
	transform: translate(-50%, -50%);
	width: min(440px, calc(100vw - 32px));
	background: #f6f1e7;
	color: #2b2723;
	border-radius: 16px;
	box-shadow: 0 16px 50px rgba(0, 0, 0, 0.3);
	padding: 18px 20px;
	font: 14px/1.45 Overpass, system-ui, sans-serif;
}
#welcome > b {
	font-size: 18px;
}
#welcome .lvls {
	display: grid;
	gap: 8px;
	margin: 10px 0;
}
#welcome .lvls button {
	text-align: left;
	padding: 10px 12px;
	min-height: 44px;
	border-radius: 10px;
	border: 1px solid rgba(0, 0, 0, 0.12);
	background: #fff;
	cursor: pointer;
	font: inherit;
}
#welcome .lvls button small {
	display: block;
	color: #8a7f72;
}
#welcome .lvls button:hover {
	border-color: #e8661c;
}
#welcome .skip {
	border: 0;
	background: none;
	color: #8a7f72;
	cursor: pointer;
	min-height: 36px;
	font: inherit;
}
@media (max-width: 640px) {
	#glossary {
		left: 12px;
		top: 12px;
	}
}

/* ---------- trackside seats, TV mode, alerts, golden hour, toasts */
.seatRow,
.alertRow {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	align-items: center;
	margin: 6px 0;
	font-size: 13px;
}
.pill {
	min-height: 32px;
	padding: 4px 10px;
	border-radius: 99px;
	border: 1px solid rgba(0, 0, 0, 0.15);
	background: #fff;
	font: 600 12px Overpass, system-ui, sans-serif;
	cursor: pointer;
}
.pill.on {
	background: #2b2723;
	color: #fff;
}
#spots {
	list-style: none;
	margin: 4px 0;
	padding: 0;
	display: flex;
	flex-wrap: wrap;
	gap: 4px;
}
#spots li {
	padding: 4px 9px;
	border-radius: 99px;
	background: rgba(0, 0, 0, 0.05);
	font-size: 12px;
	cursor: pointer;
}
#spots li.sel {
	background: #e8661c;
	color: #fff;
}
#tvLine,
#golden {
	font-size: 12px;
}
#tvLine em,
.toast em {
	color: #b06a1e;
	font-style: normal;
}
#golden ul {
	margin: 2px 0 6px;
	padding-left: 16px;
}
.alertItem {
	display: inline-block;
	background: rgba(0, 0, 0, 0.05);
	border-radius: 99px;
	padding: 2px 4px 2px 9px;
	margin: 2px 2px 0 0;
}
.alertItem button {
	border: 0;
	background: none;
	cursor: pointer;
	min-width: 24px;
}
#toasts {
	position: fixed;
	z-index: 50;
	right: 16px;
	bottom: 110px;
	display: flex;
	flex-direction: column;
	gap: 8px;
	max-width: min(360px, calc(100vw - 32px));
}
.toast {
	background: #2b2723;
	color: #fff;
	border-radius: 12px;
	padding: 10px 14px;
	font: 13px/1.4 Overpass, system-ui, sans-serif;
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}
.toast .linkish {
	display: inline;
	color: #ffc27a;
	margin: 0 0 0 6px;
	min-height: 0;
	padding: 0;
}

/* ---------- link to the sectors page */
.sectorsLink {
	display: inline-block;
	margin: 2px 0 4px;
	font: 600 12px Overpass, system-ui, sans-serif;
	color: #b4521a;
	text-decoration: none;
}
.sectorsLink:hover {
	text-decoration: underline;
}

/* ---------- when a train entered the map (tells same-symbol trains apart) */
.inAt {
	font: 500 11px "IBM Plex Mono", ui-monospace, monospace;
	color: #8a7f72;
	white-space: nowrap;
}

/* ---------- photo-real test: Google's required credit */
#photoCredit {
	position: fixed;
	right: 210px;
	bottom: 8px;
	z-index: 5;
	font: 11px Overpass, system-ui, sans-serif;
	color: #fff;
	text-shadow: 0 1px 2px #000;
	pointer-events: none;
}

/* ---------- Labels panel (what is named on the map) */
#layerPanel {
	position: absolute;
	top: 0;
	right: calc(100% + 8px);
	width: 220px;
	background: var(--card);
	backdrop-filter: blur(8px);
	border-radius: 12px;
	padding: 10px 12px;
	box-shadow: 0 6px 30px rgba(0, 0, 0, 0.14);
	display: flex;
	flex-direction: column;
	gap: 6px;
	font-size: 12px;
}
#layerPanel[hidden] {
	display: none;
}
#layerPanel label.sw {
	display: flex;
	align-items: center;
	gap: 6px;
	min-height: 24px;
	cursor: pointer;
}
#layerPanel .row2 {
	display: flex;
	gap: 6px;
	margin-top: 4px;
}
#layerPanel .row2 button {
	flex: 1;
	min-height: 30px;
	border-radius: 8px;
	border: 1px solid rgba(0, 0, 0, 0.15);
	background: #fff;
	cursor: pointer;
	font: 600 12px Overpass, system-ui, sans-serif;
}
body.noVideoPins .spot,
body.noTrainPins #markers .marker {
	display: none !important;
}

/* detector "What is this?" explainer */
#card .whatBtn {
	float: right;
	margin: 0 22px 6px 0;
	padding: 2px 9px;
	border-radius: 99px;
	border: 1px solid var(--muted);
	background: none;
	color: inherit;
	font: inherit;
	font-size: 11px;
	cursor: pointer;
}
#card .explain {
	font-size: 12px;
	line-height: 1.45;
	margin: 6px 0 8px;
	padding: 8px 10px;
	border-radius: 10px;
	background: rgba(0, 0, 0, 0.05);
	max-height: 46vh;
	overflow: auto;
}
#card .explain p {
	margin: 0 0 6px;
}
#card .explain ul {
	margin: 0 0 6px;
	padding-left: 16px;
}
#card .explain li {
	margin-bottom: 4px;
}
#card .explain .sw {
	display: block;
	margin: 8px 0 4px;
}
#card .linkBtn {
	background: none;
	border: 0;
	padding: 0;
	color: inherit;
	text-decoration: underline;
	font: inherit;
	font-size: 12px;
	cursor: pointer;
}

/* "?" on map tags (trains: hear the story; detectors and other features: what is this) */
.tag3d .ask {
	display: inline-grid;
	place-items: center;
	width: 15px;
	height: 15px;
	margin-left: 6px;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.18);
	color: #fff;
	font: 700 10px/1 Inter, system-ui, sans-serif;
	vertical-align: 1px;
	cursor: pointer;
}
.tag3d .ask:hover {
	background: #ffd21f;
	color: #1d1a16;
}
.tag3d.det {
	border-left-color: #c9ccce;
}
.tag3d.det.bnsf {
	border-left-color: #e8661c;
}
.tag3d.det.up {
	border-left-color: #d9a300;
}
.tag3d[hidden] {
	display: none;
}

/* the shared explainer panel */
#explain {
	position: fixed;
	left: 50%;
	bottom: 16px;
	transform: translateX(-50%);
	width: min(440px, calc(100vw - 24px));
	max-height: min(70vh, 560px);
	display: flex;
	flex-direction: column;
	background: var(--card);
	backdrop-filter: blur(8px);
	border-radius: 14px;
	padding: 14px 16px 12px;
	box-shadow: 0 8px 36px rgba(0, 0, 0, 0.22);
	z-index: 40;
	font-size: 13px;
	line-height: 1.45;
}
body.hasTrainBar #explain {
	bottom: 130px;
}
#explain[hidden] {
	display: none;
}
#explain .close {
	position: absolute;
	top: 8px;
	right: 10px;
	background: none;
	border: 0;
	font-size: 18px;
	color: var(--muted);
	cursor: pointer;
}
#explain .kicker {
	font-size: 11px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	color: var(--muted);
}
#explain h3 {
	margin: 2px 0 8px;
	font: 600 18px/1.2 Fraunces, Georgia, serif;
}
#explain .say {
	display: flex;
	align-items: center;
	gap: 8px;
	margin-bottom: 8px;
}
#explain .sayBtn {
	width: 30px;
	height: 30px;
	border-radius: 50%;
	border: 0;
	background: #e8661c;
	color: #fff;
	cursor: pointer;
	font-size: 11px;
}
#explain .sayBtn .i-stop,
#explain.speaking .sayBtn .i-play,
#explain.loading .sayBtn .i-play {
	display: none;
}
#explain.speaking .sayBtn .i-stop,
#explain.loading .sayBtn .i-stop {
	display: inline;
}
#explain .sayLabel::after {
	content: "Listen";
	color: var(--muted);
	font-size: 12px;
}
#explain.loading .sayLabel::after {
	content: "Getting the voice ready…";
}
#explain.speaking .sayLabel::after {
	content: "Speaking · tap to stop";
}
#explain .body {
	overflow: auto;
}
#explain .body p {
	margin: 0 0 8px;
}
#explain .body ul {
	margin: 0 0 8px;
	padding-left: 18px;
}
#explain .body li {
	margin-bottom: 5px;
}
#explain .foot {
	border-top: 1px solid var(--line);
	margin-top: 6px;
	padding-top: 8px;
	display: flex;
	flex-direction: column;
	gap: 4px;
	font-size: 12px;
}
#explain .foot .linkBtn {
	align-self: flex-start;
}
body:has(#card:not([hidden])) #explain {
	left: auto;
	right: 312px;
	transform: none;
	width: min(420px, calc(100vw - 336px));
}
@media (max-width: 760px) {
	body:has(#card:not([hidden])) #explain {
		right: 12px;
		width: calc(100vw - 24px);
	}
}

/* trains on the pass: name on the first line, direction and entry time below */
#trains .what .line1 {
	display: block;
	overflow: hidden;
	text-overflow: ellipsis;
}
#trains .what .sub {
	display: block;
	font-size: 11px;
	color: var(--muted);
	line-height: 1.25;
	overflow: hidden;
	text-overflow: ellipsis;
}

/* the selected train's tag: ✕ docks it into the info bar */
.tag3d .tagX {
	display: inline-grid;
	place-items: center;
	width: 15px;
	height: 15px;
	margin-left: 4px;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.18);
	font: 700 9px/1 Inter, system-ui, sans-serif;
	vertical-align: 1px;
	cursor: pointer;
}
.tag3d .tagX:hover {
	background: #ffd21f;
	color: #1d1a16;
}
#tbHead .tbSpeed {
	font-weight: 600;
	font-size: 13px;
}
#tbHead .tbUndock {
	font: 600 11px Inter, system-ui, sans-serif;
	padding: 1px 8px;
	border-radius: 99px;
	border: 1px solid var(--line);
	background: none;
	color: inherit;
	cursor: pointer;
}
#tbHead .tbUndock:hover {
	border-color: #ffd21f;
}

/* where you are: lat, lon of the view's centre, click to copy */
#here {
	display: block;
	width: 100%;
	margin: 2px 0 6px;
	padding: 3px 4px;
	border: 1px solid var(--line);
	border-radius: 8px;
	background: none;
	color: inherit;
	font: 500 10px "IBM Plex Mono", ui-monospace, monospace;
	cursor: pointer;
	user-select: text;
	text-align: center;
}
#here small {
	display: block;
	font: 600 9px Inter, system-ui, sans-serif;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	color: var(--muted);
}
#here:hover {
	border-color: #ffd21f;
}
