/* First-scene demo only. No root palette overrides: opening the journey map
   from Midian must still show the original, unmodified main menu. */
.midian-intro-art,
.midian-kicker { display: none; }
:root[lang='en'] .midian-kicker [lang='ro'],
:root[lang='ro'] .midian-kicker [lang='en'] { display: none; }

:root[data-scene='midian'] #view { filter: none; }
:root[data-scene='midian'] .cinematic-vignette {
	box-shadow: inset 0 0 80px rgba(37, 30, 23, 0.12);
	background: none;
}
:root[data-scene='midian'] #loader {
	color: #f4eddf;
	background: radial-gradient(ellipse at 50% 40%, #4b5048, #242e30 68%, #1b2528);
}
:root[data-scene='midian'] #loader svg { width: 62px; height: 62px; filter: none; }
:root[data-scene='midian'] #loader .track {
	height: 4px;
	border: 0;
	background: #f4eddf26;
}
:root[data-scene='midian'] #loaderBar { background: #d9b77b; }

/* Ivory sheets, a single bronze hairline, and unhurried typography. */
:root[data-scene='midian'] .overlay:not(#chooser) {
	background: rgba(22, 29, 29, 0.43);
	backdrop-filter: blur(5px);
	-webkit-backdrop-filter: blur(5px);
	padding: clamp(12px, 3vw, 28px);
}
:root[data-scene='midian'] .overlay:not(#chooser) .card {
	--ink: #30291f;
	--ink-soft: #746957;
	--gold: #987345;
	--lapis: #3e6270;
	--papyrus-light: #faf6ed;
	--sheet: #f4eddf;
	color: var(--ink);
	background: linear-gradient(145deg, #faf6ee, #efe6d6);
	border: 1px solid rgba(177, 150, 110, 0.7);
	border-radius: 20px;
	box-shadow: 0 24px 80px #111c204d, 0 2px 8px #111c201f;
	padding: 30px 34px;
	font-size: 17px;
	line-height: 1.65;
	animation: midian-sheet-in 320ms cubic-bezier(0.2, 0.75, 0.25, 1) both;
	scrollbar-width: thin;
	scrollbar-color: #b6a48a transparent;
}
:root[data-scene='midian'] .overlay:not(#chooser) .card::before,
:root[data-scene='midian'] .overlay:not(#chooser) .card::after,
:root[data-scene='midian'] .overlay:not(#chooser) .card h1::after,
:root[data-scene='midian'] .overlay:not(#chooser) .card > h2:first-of-type::after {
	content: none;
	display: none;
	animation: none;
}
:root[data-scene='midian'] .overlay:not(#chooser) .card h1,
:root[data-scene='midian'] .overlay:not(#chooser) .card h2 {
	font-weight: 500;
	font-variant: normal;
	letter-spacing: -0.025em;
	text-shadow: none;
	color: #30291f;
	line-height: 1.12;
}
:root[data-scene='midian'] .overlay:not(#chooser) .card > h2:first-of-type {
	padding: 0 0 16px;
	margin: 0 0 16px;
	border-bottom: 1px solid #9f835238;
	font-size: clamp(26px, 4vw, 36px);
}
:root[data-scene='midian'] .overlay:not(#chooser) .ref {
	font: 600 11px/1.5 -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
	letter-spacing: 0.13em;
	text-transform: uppercase;
	color: #58716f;
}
:root[data-scene='midian'] #start.overlay .card.start-card {
	width: min(640px, 100%);
	padding: 0 34px 30px;
	overflow: auto;
}
:root[data-scene='midian'] #start .midian-intro-art {
	display: block;
	height: clamp(130px, 21vh, 190px);
	margin: 0 -34px 24px;
	background: linear-gradient(0deg, #30291f12, transparent 60%), url('./img/art-midian.png') center 53% / cover;
	border-radius: 19px 19px 0 0;
	border-bottom: 1px solid #9f835230;
}
:root[data-scene='midian'] #start .midian-kicker {
	display: block;
	margin: 0 0 10px;
	font: 600 10px/1.5 -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
	letter-spacing: 0.2em;
	text-transform: uppercase;
	color: #827152;
}
:root[data-scene='midian'] #start.overlay .card #startTitle {
	font-size: clamp(32px, 5.3vw, 46px);
	text-align: left;
	padding: 0;
	width: 100%;
	margin: 0 0 12px;
}
:root[data-scene='midian'] #start.overlay .card #startSubtitle {
	font-size: 18px;
	text-align: left;
	color: #71634e;
	margin-bottom: 14px;
}
:root[data-scene='midian'] #startIntro { font-size: 16px; }
:root[data-scene='midian'] #start .controls {
	margin: 20px 0 22px;
	padding: 16px 0;
	border: 0;
	border-top: 1px solid #9f835233;
	border-bottom: 1px solid #9f835233;
	border-radius: 0;
	background: transparent;
	font: 12px/1.6 -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
	gap: 12px 18px;
	color: #655c4e;
}
:root[data-scene='midian'] #start .controls kbd {
	background: #fffcf5;
	color: #554b3c;
	border: 1px solid #b6a48a66;
	border-bottom-width: 2px;
	box-shadow: none;
	font-size: 11px;
	border-radius: 5px;
}
:root[data-scene='midian'] .overlay:not(#chooser) .btn {
	min-height: 44px;
	padding: 11px 22px;
	border: 1px solid #354d49;
	border-radius: 10px;
	background: #354d49;
	box-shadow: 0 4px 10px #273c361c;
	color: #fffaf0;
	font: 600 13px/1.45 -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
	letter-spacing: 0.015em;
	text-shadow: none;
	transition: background 180ms ease, transform 180ms ease, box-shadow 180ms ease;
}
:root[data-scene='midian'] .overlay:not(#chooser) .btn:hover {
	background: #44645d;
	transform: translateY(-1px);
	box-shadow: 0 6px 16px #273c3626;
}
:root[data-scene='midian'] .overlay:not(#chooser) .btn.ghost {
	color: #4b5c52;
	border-color: #71817255;
	background: transparent;
	box-shadow: none;
}
:root[data-scene='midian'] #startBtn { min-width: 142px; }
:root[data-scene='midian'] .overlay:not(#chooser) .chip.corner {
	top: 14px;
	right: 14px;
	border: 1px solid #fff8e940;
	background: #273b36d9;
	box-shadow: 0 3px 14px #101e2326;
	border-radius: 10px;
	color: #fff8e9;
	backdrop-filter: blur(8px);
}
:root[data-scene='midian'] .overlay:not(#chooser) .options button {
	padding: 13px 16px;
	border: 1px solid #b9a78b80;
	border-radius: 10px;
	background: #fffcf780;
	box-shadow: none;
	color: #403729;
	transition: background 160ms ease, border-color 160ms ease;
}
:root[data-scene='midian'] .overlay:not(#chooser) .options button:hover:not(:disabled) {
	background: #e7ede3;
	border-color: #748775;
}
/* (the game marks the right answer `right`: on a station already answered it
   is the one shown as chosen) */
:root[data-scene='midian'] .overlay:not(#chooser) .options button.right {
	background: #dce8d5;
	border: 2px solid #66845d;
	color: #2c4526;
	font-weight: 600;
}
:root[data-scene='midian'] .overlay:not(#chooser) .options button.right::after {
	content: '✓';
	float: right;
	margin-left: 12px;
	color: #4f7345;
	font-weight: 700;
}
:root[data-scene='midian'] .overlay:not(#chooser) .options button:disabled:not(.right):not(.wrong) {
	opacity: 0.55;
}
:root[data-scene='midian'] .overlay:not(#chooser) .options button.wrong {
	background: #f0dbd1;
	border-color: #b67662;
}
:root[data-scene='midian'] .overlay:not(#chooser) .st-actions { border-top: 1px solid #9f835233; }
/* Keep the game's sticky reading header/footer, without their legacy gold fill. */
:root[data-scene='midian'] .overlay:not(#chooser) > .card:not(.start-card):not(.wide) {
	--px: 30px;
	--py: 24px;
	padding: 0 var(--px) var(--py) !important;
}
:root[data-scene='midian'] .overlay:not(#chooser) > .card:not(.start-card) > h2:first-of-type {
	margin: 0 calc(-1 * var(--px)) 18px;
	padding: 24px calc(var(--px) + 32px) 18px var(--px);
	background: #f7f1e6;
	box-shadow: none;
}
:root[data-scene='midian'] .overlay:not(#chooser) > .card:not(.start-card) > .actions:last-child {
	margin-right: calc(-1 * var(--px));
	margin-left: calc(-1 * var(--px));
	padding: 16px var(--px);
	background: #eee7da;
	border-color: #9f835238;
	box-shadow: none;
}
:root[data-scene='midian'] .overlay:not(#chooser) .card-x button {
	color: #657568;
	background: transparent;
	border: 1px solid #a3aa9566;
	border-radius: 8px;
	box-shadow: none;
}
:root[data-scene='midian'] .overlay:not(#chooser) .card-x button:hover {
	background: #e2e8dc;
}

/* The HUD recedes into the scenery, while its labels retain strong contrast. */
:root[data-scene='midian'] #hud .panel:not(#minimap),
:root[data-scene='midian'] #hud .chip,
:root[data-scene='midian'] #guide,
:root[data-scene='midian'] #hud .sound-panel {
	color: #f5efdf;
	background: rgba(36, 49, 46, 0.88);
	border: 1px solid rgba(240, 225, 197, 0.24);
	border-radius: 12px;
	box-shadow: 0 5px 22px #18231e1f;
	backdrop-filter: blur(12px);
	-webkit-backdrop-filter: blur(12px);
	font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
	text-shadow: none;
}
:root[data-scene='midian'] #hud .progress { padding: 12px 14px; font-size: 12px; }
:root[data-scene='midian'] #hud .progress .row:first-child { border-color: #f1dfbb30; }
:root[data-scene='midian'] #hud .progress .row { line-height: 1.7; }
:root[data-scene='midian'] #hud .progress .hint,
:root[data-scene='midian'] #hud .progress .missions,
:root[data-scene='midian'] #guide .guide-dist { color: #ded3bd; }
:root[data-scene='midian'] #hud .chip:hover { background: #3b534b; }
:root[data-scene='midian'] #hud .chip.home { background: #e7d6af; color: #2d3b33; border-color: #f5e7c7; }
:root[data-scene='midian'] #hud .dots span { border: 1px solid #d4c8ac; box-shadow: none; }
:root[data-scene='midian'] #hud .dots span.done { background: #e8bd70; box-shadow: none; }
:root[data-scene='midian'] #hud .bar { background: #f3e9d01f; border: 0; }
:root[data-scene='midian'] #joyBar { background: #c6d3a0; box-shadow: none; }
:root[data-scene='midian'] #minimap {
	border: 1px solid #d6c5a380;
	border-radius: 12px;
	box-shadow: 0 5px 20px #18231e26;
	opacity: 0.82;
}
:root[data-scene='midian'] #hud .guide-arrow { fill: #e4c386; filter: none; }
:root[data-scene='midian'] #prompt {
	background: #f6f0e3f5;
	color: #354b41;
	border: 1px solid #b69a68;
	border-radius: 12px;
	box-shadow: 0 6px 24px #17221d30;
	animation: none;
	font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
:root[data-scene='midian'] #toast {
	background: #2c423ef2;
	border: 1px solid #c4b08966;
	border-radius: 12px;
	color: #fbf4e6;
	box-shadow: 0 6px 24px #17221d30;
}
:root[data-scene='midian'] #chapter {
	background: radial-gradient(ellipse at center, #2a3b37ed, #1a2828fa);
	color: #f5ecdb;
}
:root[data-scene='midian'] #chapter h1 {
	font-weight: 400;
	letter-spacing: -0.025em;
	font-variant: normal;
	text-shadow: none;
}
:root[data-scene='midian'] #chapter h1::after { background: #ccb181; width: 54px; height: 1px; }
:root[data-scene='midian'] :is(.overlay:not(#chooser), #hud) :is(button, input):focus-visible {
	outline: 3px solid #b98b42;
	outline-offset: 4px;
}
@keyframes midian-sheet-in {
	from { opacity: 0; transform: translateY(10px); }
	to { opacity: 1; transform: translateY(0); }
}
@media (max-width: 520px) {
	:root[data-scene='midian'] .overlay:not(#chooser) { padding: 10px; align-items: center; }
	:root[data-scene='midian'] .overlay:not(#chooser) .card {
		max-height: calc(100dvh - 20px);
		padding: 24px 22px;
		border-radius: 16px;
		border-width: 1px;
		font-size: 16px;
	}
	:root[data-scene='midian'] #start.overlay .card.start-card { padding: 0 22px 24px; }
	:root[data-scene='midian'] #start .midian-intro-art { margin: 0 -22px 20px; height: 148px; border-radius: 15px 15px 0 0; }
	:root[data-scene='midian'] #start .controls { font-size: 11px; gap: 10px 12px; margin: 16px 0 20px; }
	:root[data-scene='midian'] #startBtn { width: 100%; }
	:root[data-scene='midian'] #hud .progress { padding: 8px 10px; font-size: 11px; }
}
@media (max-height: 540px) {
	:root[data-scene='midian'] #start .midian-intro-art,
	:root[data-scene='midian'] #start .midian-kicker { display: none; }
	:root[data-scene='midian'] #start.overlay .card.start-card { width: min(780px, 100%); padding: 20px 28px; }
	:root[data-scene='midian'] #start .controls { margin: 10px 0 14px; padding: 8px 0; font-size: 11px; }
	:root[data-scene='midian'] #start.overlay .card #startSubtitle { margin-bottom: 8px; font-size: 15px; line-height: 1.4; }
	:root[data-scene='midian'] #start.overlay .card #startTitle { font-size: 30px; margin-bottom: 8px; }
	:root[data-scene='midian'] #startIntro { font-size: 14px; line-height: 1.4; }
}
@media (prefers-reduced-motion: reduce) {
	:root[data-scene='midian'] .overlay:not(#chooser) .card { animation: none; }
	:root[data-scene='midian'] :is(.overlay:not(#chooser), #hud) * { transition-duration: 0ms !important; }
}

/* A phone on its side, the station card: it is laid out in two columns there
   (story on the left, question on the right), so the full-width head and foot
   of the upright card are set aside and each part simply takes its place. */
@media (min-width: 560px) and (max-height: 520px) {
	:root[data-scene='midian'] #station.overlay:not(#chooser) > .card:not(.start-card):not(.wide) {
		--px: 24px;
		--py: 16px;
		padding: var(--py) var(--px) !important;
		column-gap: 26px;
	}
	:root[data-scene='midian'] #station.overlay:not(#chooser) > .card:not(.start-card) > h2:first-of-type {
		position: static;
		margin: 0 0 6px;
		padding: 0 0 8px;
		font-size: 26px;
		line-height: 1.15;
		background: none;
		border-bottom: 1px solid #9f835238;
	}
	:root[data-scene='midian'] #station.overlay:not(#chooser) > .card:not(.start-card) > .actions:last-child {
		position: static;
		margin: 10px 0 0;
		padding: 10px 0 0;
		background: none;
		border-top: 1px solid #9f835238;
	}
	/* (rows as tall as what is in them: on a short screen the card scrolls
	   sooner than let the hint sit on top of the buttons) */
	:root[data-scene='midian'] #station.overlay:not(#chooser) > .card:not(.start-card):not(.wide) {
		grid-template-rows: auto auto 1fr auto;
		align-content: start;
	}
	:root[data-scene='midian'] #station.overlay:not(#chooser) .options {
		gap: 6px;
	}
	:root[data-scene='midian'] #station.overlay:not(#chooser) .options button {
		min-height: 0;
		padding: 7px 14px;
	}
	:root[data-scene='midian'] #station.overlay:not(#chooser) .feedback:empty {
		display: none;
	}
	:root[data-scene='midian'] #station.overlay:not(#chooser) :is(#stHint, .st-actions .btn) {
		min-height: 36px;
		padding-top: 6px;
		padding-bottom: 6px;
	}
	:root[data-scene='midian'] #station.overlay:not(#chooser) #stHint {
		margin-top: 8px;
	}
	:root[data-scene='midian'] #station.overlay:not(#chooser) .question {
		margin-top: 2px;
	}
}

/* Every panel carries its painted mark before its title, as on the other stops
   (the corner seal is put away here, the cross stands in its corner): the scroll
   for a station, the asking hand for a request, the jar, the chest, the wreath... */
:root[data-scene='midian'] .overlay:not(#chooser) > .card:not(.wide):not(.start-card) > h2:first-of-type {
	display: flex;
	align-items: center;
	gap: 12px;
}
:root[data-scene='midian'] .overlay:not(#chooser) > .card:not(.wide):not(.start-card) > h2:first-of-type::before {
	content: '';
	flex: none;
	width: 46px;
	height: 46px;
	background: var(--seal) center / contain no-repeat;
	filter: drop-shadow(0 2px 3px rgba(40, 20, 0, 0.35));
}
