* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
	font-family: "Avenir Next", "PingFang SC", "Hiragino Sans GB", "微软雅黑", sans-serif;
	background:
		radial-gradient(900px 520px at 12% -8%, rgba(48, 92, 120, 0.45), transparent 60%),
		radial-gradient(640px 380px at 100% 0%, rgba(150, 90, 48, 0.18), transparent 55%),
		#090d12;
	color: #e7eef3;
}
button, input { font-family: inherit; }
button { cursor: pointer; }
a { color: inherit; }

.ambience {
	position: fixed;
	inset: 0;
	pointer-events: none;
	overflow: hidden;
	z-index: 0;
}
.ambience i {
	position: absolute;
	width: 460px;
	height: 460px;
	border-radius: 50%;
	filter: blur(50px);
	background: #1a536c;
	top: -120px;
	left: -80px;
	opacity: 0.55;
	animation: drift 16s ease-in-out infinite alternate;
}
.ambience i:last-child {
	width: 300px;
	height: 300px;
	background: #7a4630;
	left: auto;
	right: -40px;
	top: 30px;
	opacity: 0.32;
	animation-duration: 22s;
	animation-direction: alternate-reverse;
}
@keyframes drift { to { transform: translate3d(48px, 36px, 0); } }

.sheet {
	position: relative;
	z-index: 1;
	max-width: 1180px;
	margin: 0 auto;
	padding: 22px 22px 48px;
}

.mast {
	display: flex;
	justify-content: space-between;
	align-items: flex-end;
	gap: 20px;
	margin-bottom: 14px;
}
.eyebrow {
	font-size: 12px;
	letter-spacing: 0.18em;
	color: #8ea3b0;
}
h1 {
	font-family: "Songti SC", "STSong", serif;
	font-size: 40px;
	font-weight: 700;
	line-height: 1.15;
	margin-top: 4px;
	color: #f4f7f8;
	text-shadow: 0 0 24px rgba(180, 210, 220, 0.25);
}
.mast p {
	max-width: 360px;
	font-size: 14px;
	line-height: 1.6;
	color: #9aafbc;
}

.stage {
	display: grid;
	grid-template-columns: 1fr 320px;
	gap: 12px;
	align-items: stretch;
}
.plate {
	position: relative;
	background-color: #0e1620;
	background-image:
		radial-gradient(ellipse at 50% 42%, rgba(70, 130, 160, 0.16), transparent 58%),
		linear-gradient(rgba(190, 220, 230, 0.055) 1px, transparent 1px),
		linear-gradient(90deg, rgba(190, 220, 230, 0.055) 1px, transparent 1px);
	background-size: auto, 32px 32px, 32px 32px;
	border: 1px solid rgba(255, 255, 255, 0.08);
	box-shadow: 0 24px 50px rgba(0, 0, 0, 0.35), inset 0 0 80px rgba(0, 0, 0, 0.28);
	min-height: 520px;
	overflow: hidden;
}
.plate.hit { animation: platehit 0.7s ease; }
@keyframes platehit {
	0% { box-shadow: 0 0 0 0 rgba(255, 224, 194, 0.0), inset 0 0 80px rgba(0, 0, 0, 0.28); }
	35% { box-shadow: 0 0 0 1px rgba(255, 224, 194, 0.85), 0 0 36px rgba(255, 196, 140, 0.35), inset 0 0 80px rgba(0, 0, 0, 0.28); }
	100% { box-shadow: 0 24px 50px rgba(0, 0, 0, 0.35), inset 0 0 80px rgba(0, 0, 0, 0.28); }
}
.plate::after {
	content: "";
	position: absolute;
	inset: 0;
	pointer-events: none;
	z-index: 2;
	background: radial-gradient(ellipse at center, transparent 42%, rgba(0, 0, 0, 0.42) 100%);
}
.river {
	position: absolute;
	left: -5%;
	right: -5%;
	bottom: 18%;
	height: 90px;
	background:
		radial-gradient(80% 120% at 20% 0%, rgba(150, 210, 230, 0.35), transparent 60%),
		linear-gradient(90deg, #0d2c3c, #1a5874 42%, #0c2433);
	border-radius: 50% 50% 0 0 / 100% 100% 0 0;
	transform: rotate(-4deg);
	box-shadow: 0 0 36px rgba(70, 170, 200, 0.28);
	overflow: hidden;
}
.river::after {
	content: "";
	position: absolute;
	inset: 0;
	background: linear-gradient(100deg, transparent 15%, rgba(255, 255, 255, 0.22), transparent 55%);
	transform: translateX(-60%);
	animation: sheen 7s linear infinite;
}
@keyframes sheen { to { transform: translateX(80%); } }
#map {
	position: relative;
	z-index: 1;
	width: 100%;
	height: 520px;
	display: block;
}
.road {
	fill: none;
	stroke: #d5e2ea;
	stroke-width: 6;
	stroke-linecap: round;
	filter: url(#glow);
}
.road.slow { stroke: #e4b15a; }
.road.jam {
	stroke: #ff6b4a;
	filter: url(#glow-hot);
	animation: ember 1.8s ease-in-out infinite;
}
@keyframes ember { 50% { stroke-opacity: 0.45; } }
.busline {
	fill: none;
	stroke: #7ec8d6;
	stroke-width: 3;
	stroke-dasharray: 7 8;
	opacity: 0;
	filter: url(#glow);
}
.busline.on { opacity: 0.95; }
#map.has-route .road {
	stroke: #6a7c88;
	stroke-opacity: 0.45;
	filter: none;
}
#map.has-route .road.slow,
#map.has-route .road.jam {
	stroke-opacity: 1;
	filter: url(#glow-hot);
}
#map.has-route .road.slow { stroke: #e4b15a; }
#map.has-route .road.jam { stroke: #ff6b4a; }
.route {
	fill: none;
	stroke: #ff8a2a;
	stroke-width: 7;
	stroke-linecap: round;
	opacity: 0;
	filter: url(#glow-hot);
}
.route.show { opacity: 1; }
.stop { cursor: pointer; }
.halo {
	fill: none;
	stroke: rgba(255, 224, 194, 0.85);
	stroke-width: 1;
	pointer-events: none;
}
.stop circle {
	fill: #0e1620;
	stroke: #f2f6f8;
	stroke-width: 2;
}
.stop.on circle { fill: #ff8a2a; stroke: #ffe7cc; stroke-width: 3; }
.stop text {
	font-size: 13px;
	fill: #f4f7f8;
	font-family: "PingFang SC", "微软雅黑", sans-serif;
	paint-order: stroke;
	stroke: rgba(9, 13, 18, 0.85);
	stroke-width: 3px;
}
.vehicle { fill: #fff6ea; filter: url(#glow-hot); }
.spark { fill: #fffaf4; filter: url(#glow-hot); }

.cartouche {
	position: absolute;
	z-index: 3;
	left: 16px;
	top: 16px;
	width: 220px;
	padding: 14px 14px 12px;
	background: rgba(10, 16, 22, 0.62);
	border: 1px solid rgba(255, 236, 214, 0.22);
	backdrop-filter: blur(12px);
	box-shadow: 0 12px 30px rgba(0, 0, 0, 0.28);
	color: #f4f7f8;
}
.cartouche strong {
	display: block;
	font-family: "Songti SC", "STSong", serif;
	font-size: 22px;
}
.cartouche span {
	display: block;
	margin-top: 4px;
	font-size: 12px;
	color: #a9b9c4;
}
.legend {
	display: flex;
	gap: 12px;
	margin-top: 10px;
	font-size: 12px;
}
.swatch {
	display: inline-block;
	width: 16px;
	height: 4px;
	margin-right: 4px;
	vertical-align: middle;
	box-shadow: 0 0 8px currentColor;
}
.note {
	background:
		linear-gradient(180deg, rgba(255, 255, 255, 0.05), transparent 90px),
		#101820;
	color: #e7eef2;
	padding: 16px;
	display: flex;
	flex-direction: column;
	border: 1px solid rgba(255, 255, 255, 0.08);
	box-shadow: inset 0 1px 0 rgba(228, 177, 90, 0.55), 0 18px 40px rgba(0, 0, 0, 0.28);
}
.note label {
	display: block;
	font-size: 12px;
	letter-spacing: 0.08em;
	color: #b7c4cc;
	margin-bottom: 8px;
}
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.chips button, .run {
	border: 1px solid rgba(255, 255, 255, 0.14);
	background: rgba(255, 255, 255, 0.03);
	color: #e7eef2;
	padding: 5px 8px;
	font-size: 12px;
}
.chips button:hover { background: rgba(255, 255, 255, 0.08); }
.ask { display: flex; gap: 6px; }
.ask input {
	flex: 1;
	border: 1px solid rgba(255, 255, 255, 0.08);
	background: rgba(0, 0, 0, 0.35);
	color: #f4f7f8;
	padding: 8px;
	font-size: 13px;
	outline: none;
}
.ask input:focus { border-color: rgba(228, 177, 90, 0.7); }
.run {
	background: linear-gradient(180deg, #f0c08a, #c4845a);
	border-color: transparent;
	color: #1c120c;
	box-shadow: 0 0 18px rgba(228, 160, 100, 0.4);
}
.run:hover { filter: brightness(1.08); }
.code {
	margin-top: 10px;
	font-family: Menlo, Consolas, monospace;
	font-size: 12px;
	line-height: 1.55;
	white-space: pre-wrap;
	color: #d5c4ae;
	min-height: 72px;
}
.readout {
	display: flex;
	gap: 16px;
	margin-top: 10px;
	font-size: 12px;
	color: #9aafbc;
}
.readout b { color: #f6e7d4; font-weight: 600; }

.lessons {
	display: grid;
	grid-template-columns: repeat(6, 1fr);
	gap: 8px;
	margin-top: 14px;
}
.lesson {
	text-align: left;
	border: 1px solid rgba(255, 255, 255, 0.08);
	padding: 10px;
	color: #d5e2ea;
	background: rgba(16, 24, 32, 0.72);
}
.lesson.on {
	background: #18222c;
	color: #f6e7d4;
	border-color: rgba(228, 177, 90, 0.75);
	box-shadow: 0 0 0 1px rgba(228, 177, 90, 0.2), 0 10px 24px rgba(0, 0, 0, 0.28);
}
.lesson small { display: block; margin-top: 6px; font-size: 12px; opacity: 0.75; }
.lesson b { font-weight: 600; font-size: 14px; }

@media (max-width: 900px) {
	.mast, .ask { flex-direction: column; }
	.cartouche { position: static; width: auto; margin: 12px; }
	.stage { grid-template-columns: 1fr; }
	.plate { min-height: 0; }
	#map { height: 420px; }
	.lessons { grid-template-columns: 1fr 1fr; }
}
@media (prefers-reduced-motion: reduce) {
	.ambience i, .river::after, .road.jam { animation: none; }
}
