/* A scroll-and-ink look: papyrus sheets, sepia ink, and the colours of the
   Tabernacle (gold, blue, purple, scarlet) for accents. */
:root {
	/* A dusk-lit illuminated manuscript: quiet umber, sunlit gold and deep indigo. */
	--night-ink: #1b1712;
	--sun-gold: #e5b14a;
	--sky-blue: #1e385f;
	--papyrus: #ecdcb0;
	--papyrus-light: #f7eed4;
	--papyrus-dark: #d6c08a;
	--ink: #33230f;
	--ink-soft: rgba(51, 35, 15, 0.55);
	--gold: #b8862b;
	--lapis: #1f3f7a;
	--purple: #5b2a6e;
	--scarlet: #9c2a22;
	--olive: #55702f;
	--serif: 'Palatino Linotype', Palatino, 'Book Antiqua', 'URW Palladio L', Georgia, serif;
	/* Fibres running both ways, a pale bloom and a stain, over warm reed colour */
	--sheet: repeating-linear-gradient(0deg, rgba(120, 90, 40, 0.07) 0 1px, transparent 1px 4px),
		repeating-linear-gradient(90deg, rgba(120, 90, 40, 0.09) 0 2px, transparent 2px 7px),
		radial-gradient(ellipse at 18% 8%, rgba(255, 250, 225, 0.6), transparent 55%),
		radial-gradient(ellipse at 88% 92%, rgba(150, 110, 50, 0.24), transparent 50%),
		linear-gradient(#f0e2b8, #e2ce96);
}

* {
	box-sizing: border-box;
}

html,
body {
	margin: 0;
	height: 100%;
	overflow: hidden;
	background: #d9b98a;
	color: var(--ink);
	font-family: var(--serif);
	-webkit-user-select: none;
	user-select: none;
	touch-action: none;
}

[hidden] {
	display: none !important;
}

#view {
	position: fixed;
	inset: 0;
	width: 100%;
	height: 100%;
	display: block;
	cursor: grab;
}

#view.dragging {
	cursor: grabbing;
}

.panel {
	background: var(--sheet);
	border: 2px solid var(--ink);
	border-radius: 5px 8px 6px 9px;
	box-shadow:
		inset 0 0 0 3px rgba(247, 238, 212, 0.7),
		0 4px 12px rgba(30, 15, 0, 0.4);
}

/* ---------- HUD ---------- */
#hud {
	position: fixed;
	inset: 0;
	pointer-events: none;
}

#hud button {
	pointer-events: auto;
}

.progress {
	position: absolute;
	top: 12px;
	left: 12px;
	padding: 9px 13px;
	min-width: 164px;
	font-size: 14px;
}

.progress .row {
	display: flex;
	justify-content: space-between;
	gap: 12px;
}

.progress strong {
	font-variant-numeric: tabular-nums;
}

.dots {
	display: flex;
	flex-wrap: wrap;
	gap: 4px;
	margin: 6px 0;
}

.dots span {
	width: 11px;
	height: 11px;
	border: 2px solid var(--ink);
	border-radius: 50%;
	background: transparent;
}

.dots span.done {
	background: var(--gold);
}

.hint,
.missions-head {
	margin-top: 6px;
	padding-top: 6px;
	border-top: 1px dashed var(--ink-soft);
}

.hint {
	font-size: 13px;
	font-style: italic;
	max-width: 200px;
}

.missions {
	margin: 2px 0 0;
	padding: 0;
	list-style: none;
	font-size: 13px;
	max-width: 200px;
}

.missions .done {
	color: var(--olive);
}

.missions .carrying {
	font-weight: 700;
}

.joy {
	display: flex;
	align-items: center;
	gap: 8px;
	margin-top: 6px;
}

.joy .bar {
	flex: 1;
	height: 9px;
	border: 2px solid var(--ink);
	border-radius: 999px;
	overflow: hidden;
	background: var(--papyrus-light);
}

.joy .bar div {
	width: 0;
	height: 100%;
	background: linear-gradient(90deg, var(--scarlet), var(--gold));
	transition: width 0.6s ease;
}

.top-right {
	position: absolute;
	top: 12px;
	right: 12px;
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 8px;
}

.chips {
	display: flex;
	gap: 6px;
}

#minimap {
	display: block;
	width: 104px;
	height: 160px;
}

.chip {
	font: inherit;
	font-size: 13px;
	font-weight: 700;
	padding: 5px 11px;
	color: var(--ink);
	background: var(--sheet);
	border: 2px solid var(--ink);
	border-radius: 999px;
	box-shadow: 0 2px 6px rgba(30, 15, 0, 0.35);
	cursor: pointer;
}

.chip.corner {
	position: absolute;
	top: 14px;
	right: 14px;
}

.prompt {
	position: absolute;
	left: 50%;
	bottom: 26px;
	transform: translateX(-50%);
	max-width: calc(100% - 32px);
	padding: 10px 20px;
	font: inherit;
	font-size: 16px;
	font-weight: 700;
	color: var(--ink);
	background: var(--sheet);
	border: 2px solid var(--ink);
	border-radius: 999px;
	box-shadow:
		inset 0 0 0 3px rgba(247, 238, 212, 0.7),
		0 4px 12px rgba(30, 15, 0, 0.45);
	cursor: pointer;
}

.yard-bar {
	position: absolute;
	left: 12px;
	right: 12px;
	bottom: 84px;
	width: fit-content;
	margin: 0 auto;
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	align-items: center;
	gap: 6px;
	padding: 6px 8px;
	background: var(--sheet);
	border: 2px solid var(--ink);
	border-radius: 10px;
	box-shadow: 0 4px 12px rgba(30, 15, 0, 0.45);
}

.yard-chip {
	width: 34px;
	height: 34px;
	padding: 0;
	font: inherit;
	font-size: 13px;
	font-weight: 700;
	color: var(--ink);
	background: var(--block, transparent);
	border: 2px solid var(--ink);
	border-radius: 5px;
	cursor: pointer;
}

.yard-chip.word {
	width: auto;
	padding: 0 10px;
}

.yard-chip.on {
	outline: 3px solid var(--ink);
	outline-offset: 2px;
}

.yard-count {
	min-width: 2ch;
	font-size: 13px;
	font-weight: 700;
	text-align: center;
}

.touch .yard-bar {
	bottom: 232px;
}

.prompt kbd {
	display: inline-block;
	margin-left: 8px;
	padding: 1px 7px;
	font: inherit;
	font-size: 12px;
	color: var(--papyrus-light);
	background: var(--ink);
	border-radius: 4px;
}

.prompt .tick {
	color: var(--olive);
	margin-right: 6px;
}

.toast {
	position: absolute;
	left: 50%;
	top: 16px;
	transform: translateX(-50%);
	max-width: min(440px, calc(100% - 360px));
	margin: 0;
	padding: 9px 16px;
	font-size: 15px;
	font-weight: 700;
	text-align: center;
	color: var(--papyrus-light);
	background: var(--lapis);
	border: 2px solid var(--gold);
	border-radius: 6px;
	box-shadow: 0 4px 12px rgba(30, 15, 0, 0.45);
}

/* ---------- Touch controls ---------- */
.stick {
	position: absolute;
	left: 20px;
	bottom: 24px;
	width: 136px;
	height: 136px;
	border: 3px solid rgba(51, 35, 15, 0.75);
	border-radius: 50%;
	background: rgba(247, 238, 212, 0.4);
	pointer-events: auto;
	touch-action: none;
}

.stick.active {
	background: rgba(247, 238, 212, 0.6);
}

.stick .arr {
	position: absolute;
	font-size: 15px;
	line-height: 1;
	color: rgba(51, 35, 15, 0.75);
	pointer-events: none;
}

.stick .up {
	top: 7px;
	left: 50%;
	transform: translateX(-50%);
}

.stick .down {
	bottom: 7px;
	left: 50%;
	transform: translateX(-50%);
}

.stick .left {
	left: 7px;
	top: 50%;
	transform: translateY(-50%);
}

.stick .right {
	right: 7px;
	top: 50%;
	transform: translateY(-50%);
}

.knob {
	position: absolute;
	left: 50%;
	top: 50%;
	width: 58px;
	height: 58px;
	margin: -29px 0 0 -29px;
	border: 3px solid var(--ink);
	border-radius: 50%;
	background: var(--sheet);
	box-shadow: 0 3px 8px rgba(30, 15, 0, 0.4);
	pointer-events: none;
}

.pad {
	position: absolute;
	display: grid;
	place-items: center;
	padding: 0;
	font: inherit;
	font-weight: 800;
	color: var(--ink);
	background: rgba(247, 238, 212, 0.85);
	border: 3px solid var(--ink);
	border-radius: 50%;
	box-shadow: 0 3px 8px rgba(30, 15, 0, 0.4);
	touch-action: none;
}

.pad.act {
	right: 22px;
	bottom: 96px;
	width: 78px;
	height: 78px;
	font-size: 32px;
	background: var(--gold);
}

.pad.run {
	right: 32px;
	bottom: 24px;
	width: 58px;
	height: 58px;
	font-size: 26px;
}

.pad.jump {
	right: 104px;
	bottom: 24px;
	width: 58px;
	height: 58px;
	font-size: 26px;
}

.pad.active {
	background: var(--ink);
	color: var(--papyrus-light);
}

.touch .prompt {
	bottom: 176px;
}

/* ---------- Scrolls: every card and dialog ---------- */
.overlay {
	position: fixed;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
	background: rgba(40, 24, 8, 0.45);
	-webkit-user-select: text;
	user-select: text;
	touch-action: auto;
}

.overlay.top {
	z-index: 5;
}

.card {
	position: relative;
	width: min(580px, 100%);
	max-height: 100%;
	overflow-y: auto;
	padding: 26px 30px;
	background: var(--sheet);
	border: 2px solid var(--ink);
	border-radius: 6px 11px 7px 13px / 12px 7px 11px 6px;
	box-shadow:
		inset 0 0 0 5px rgba(247, 238, 212, 0.75),
		inset 0 0 0 6px var(--ink-soft),
		inset 0 0 60px rgba(150, 110, 50, 0.18),
		0 14px 40px rgba(20, 10, 0, 0.55);
	font-size: 17px;
	line-height: 1.55;
}

.card.wide {
	width: min(700px, 100%);
}

.card h1,
.card h2 {
	margin: 0 0 10px;
	font-family: var(--serif);
	font-weight: 700;
	line-height: 1.15;
	color: var(--ink);
}

.card h1 {
	font-size: clamp(30px, 6.5vw, 44px);
	font-variant: small-caps;
	letter-spacing: 0.03em;
	text-align: center;
}

/* A rule with a star, as on an illuminated page */
.card h1::after {
	content: '✦';
	display: block;
	margin: 6px auto 0;
	font-size: 15px;
	line-height: 1;
	color: var(--gold);
	background:
		linear-gradient(var(--gold), var(--gold)) left center / calc(50% - 16px) 1px no-repeat,
		linear-gradient(var(--gold), var(--gold)) right center / calc(50% - 16px) 1px no-repeat;
}

.card h2 {
	font-size: clamp(23px, 5vw, 30px);
}

.card p {
	margin: 0 0 12px;
}

.lead {
	font-size: 18px;
	font-style: italic;
}

.card h1 + .lead {
	text-align: center;
}

.controls,
.clue {
	font-size: 15px;
	padding: 9px 12px;
	border: 1px dashed var(--ink-soft);
	border-radius: 5px;
	background: rgba(247, 238, 212, 0.45);
}

.ref {
	font-size: 14px;
	font-weight: 700;
	font-variant: small-caps;
	letter-spacing: 0.06em;
	color: var(--lapis);
}

.ref.big {
	font-size: 22px;
	text-align: center;
	margin: 4px 0 10px !important;
}

.quiz {
	margin-top: 4px;
	padding-top: 12px;
	border-top: 2px solid var(--ink);
}

.question {
	font-weight: 700;
}

.options {
	display: grid;
	gap: 8px;
}

.options button {
	font: inherit;
	text-align: left;
	padding: 10px 14px;
	color: var(--ink);
	background: rgba(247, 238, 212, 0.75);
	border: 2px solid var(--ink);
	border-radius: 6px;
	cursor: pointer;
}

.options button:hover:not(:disabled) {
	background: var(--papyrus-light);
	box-shadow: 0 2px 6px rgba(30, 15, 0, 0.3);
}

.options button.right {
	color: var(--papyrus-light);
	background: var(--olive);
}

.options button.wrong {
	color: var(--scarlet);
	border-color: var(--scarlet);
	text-decoration: line-through;
	opacity: 0.7;
}

.options button:disabled {
	cursor: default;
}

.feedback {
	min-height: 1.5em;
	margin: 10px 0 0;
	font-weight: 700;
}

.feedback.good {
	color: var(--olive);
}

.feedback.bad {
	color: var(--scarlet);
}

.btn {
	display: inline-block;
	margin-top: 8px;
	padding: 10px 22px;
	font: inherit;
	font-weight: 700;
	text-decoration: none;
	color: var(--papyrus-light);
	background: var(--lapis);
	border: 2px solid var(--ink);
	border-radius: 6px;
	box-shadow:
		inset 0 0 0 2px var(--gold),
		0 3px 8px rgba(30, 15, 0, 0.4);
	cursor: pointer;
}

.btn:hover {
	background: #27508f;
}

.btn.ghost {
	color: var(--ink);
	background: transparent;
	box-shadow: none;
}

.btn.ghost:hover {
	background: rgba(247, 238, 212, 0.6);
}

.btn.small {
	padding: 6px 12px;
	font-size: 14px;
	font-weight: 400;
}

.btn:focus-visible,
.chip:focus-visible,
.prompt:focus-visible,
.options button:focus-visible {
	outline: 3px solid var(--purple);
	outline-offset: 2px;
}

.actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px;
}

.totals {
	margin: 0 0 4px;
}

.totals div {
	display: flex;
	justify-content: space-between;
	padding: 3px 0;
}

.totals dd {
	margin: 0;
	font-weight: 700;
	font-variant-numeric: tabular-nums;
}

.totals .grand {
	margin-top: 4px;
	padding-top: 8px;
	border-top: 2px solid var(--ink);
	font-size: 21px;
}

.speech {
	font-size: 19px;
	font-style: italic;
}

/* ---------- Seeds, treasures and what they reveal ---------- */
.stars {
	margin: 0 0 6px !important;
	font-size: 30px;
	line-height: 1;
	letter-spacing: 0.12em;
	color: var(--gold);
	text-shadow: 0 1px 0 rgba(51, 35, 15, 0.5);
}

.tag {
	margin: 0 0 4px !important;
	font-size: 13px;
	font-weight: 700;
	font-variant: small-caps;
	letter-spacing: 0.08em;
}

.seed {
	margin: 4px 0 12px;
	padding: 10px 14px;
	border-left: 5px solid var(--gold);
	background: rgba(247, 238, 212, 0.55);
	border-radius: 0 6px 6px 0;
}

.seed .tag {
	color: var(--olive);
}

.verse {
	margin: 0 0 4px !important;
	font-size: 20px;
	font-style: italic;
	line-height: 1.35;
}

.revealed {
	margin: 0 0 14px;
	padding: 12px 14px;
	border: 2px solid var(--purple);
	border-radius: 6px;
	background: rgba(91, 42, 110, 0.07);
}

.revealed .tag {
	color: var(--purple);
	font-size: 15px;
}

.ahead {
	margin: 0 0 14px;
	padding: 10px 14px;
	border: 2px dashed var(--olive);
	border-radius: 6px;
	font-style: italic;
}

.ahead .tag {
	font-size: 15px;
	font-style: normal;
}

.ahead p:last-child,
.revealed p:last-child,
.seed p:last-child {
	margin-bottom: 0;
}

.answer {
	padding: 10px 14px;
	border-left: 5px solid var(--olive);
	background: rgba(247, 238, 212, 0.55);
	font-style: italic;
}

.book {
	margin: 0 0 10px;
	padding-left: 26px;
}

.book li {
	padding: 6px 0;
	border-bottom: 1px dashed var(--ink-soft);
}

.book li strong {
	display: block;
	color: var(--ink);
}

.book li span {
	font-style: italic;
}

.book .missing {
	opacity: 0.5;
}

.finale #fnBody p {
	font-size: 18px;
}

.finale #fnBody p:first-letter {
	font-size: 1.5em;
	font-weight: 700;
	color: var(--scarlet);
}

/* ---------- Inside the ark ---------- */
.items {
	margin: 0 0 12px;
	padding-left: 20px;
}

.tablets {
	display: flex;
	justify-content: center;
	gap: 10px;
	margin: 0 0 12px;
}

.tablets img {
	width: min(46%, 190px);
	border: 2px solid var(--ink);
	border-radius: 60px 60px 6px 6px;
}

.commandments {
	margin: 0 0 8px;
	padding-left: 24px;
	font-size: 15px;
}

.commandments .he {
	display: inline-block;
	min-width: 11em;
	margin-right: 10px;
	font-family: 'Times New Roman', 'Arial Hebrew', serif;
	font-size: 17px;
	font-weight: 700;
}

/* ---------- The map ---------- */
.journey {
	margin: 0 0 10px !important;
	font-size: 15px;
	font-weight: 700;
	text-align: center;
	color: var(--lapis);
}

.map svg {
	display: block;
	width: 100%;
	max-height: 50vh;
	border: 2px solid var(--ink);
	border-radius: 6px;
	background: #ead9a8;
	box-shadow: inset 0 0 40px rgba(150, 110, 50, 0.3);
}

.map .land {
	fill: #ead9a8;
}

.map .sea {
	fill: #a9c8c6;
	stroke: var(--ink);
	stroke-width: 2;
	stroke-linejoin: round;
}

.map .river {
	fill: none;
	stroke: #5f9aa3;
	stroke-width: 3;
	stroke-linecap: round;
}

.map .route {
	fill: none;
	stroke: var(--scarlet);
	stroke-width: 4;
	stroke-dasharray: 2 10;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.map text {
	font-family: var(--serif);
	fill: var(--ink);
	paint-order: stroke;
	stroke: #ead9a8;
	stroke-width: 5px;
	stroke-linejoin: round;
}

.map .region {
	font-size: 26px;
	letter-spacing: 0.3em;
	text-anchor: middle;
	opacity: 0.4;
}

.map .sea-name {
	font-size: 22px;
	font-style: italic;
	text-anchor: middle;
	fill: #2f5f66;
	stroke: #a9c8c6;
}

.map .place {
	outline: none;
}

.map .site {
	cursor: pointer;
}

.map .site .label {
	font-size: 23px;
	font-weight: 700;
}

.map .site .dot {
	fill: var(--papyrus-light);
	stroke: var(--ink);
	stroke-width: 3;
}

.map .site .halo {
	fill: transparent;
}

.map .done .dot {
	fill: var(--gold);
}

.map .check {
	font-size: 15px;
	font-weight: 700;
	stroke: none;
	pointer-events: none;
}

.map .next .dot {
	fill: var(--scarlet);
}

.map .next .halo {
	fill: rgba(156, 42, 34, 0.18);
	stroke: var(--scarlet);
	stroke-width: 2;
	transform-box: fill-box;
	transform-origin: center;
	animation: beckon 1.8s ease-in-out infinite;
}

@keyframes beckon {
	50% {
		transform: scale(1.35);
		opacity: 0.35;
	}
}

.map .locked .dot {
	fill: rgba(51, 35, 15, 0.18);
	stroke: rgba(51, 35, 15, 0.4);
	stroke-width: 2;
	stroke-dasharray: 3 3;
}

.map .mystery {
	font-size: 14px;
	font-weight: 700;
	fill: rgba(51, 35, 15, 0.55);
	stroke: none;
}

.map .site:hover .halo,
.map .site:focus-visible .halo {
	fill: rgba(184, 134, 43, 0.4);
	stroke: var(--ink);
	stroke-width: 2;
}

.caption {
	min-height: 3.1em;
	margin: 10px 0 4px !important;
	font-size: 15px;
}

.note {
	margin: 10px 0 0 !important;
	font-size: 13px;
	opacity: 0.7;
}

@media (prefers-reduced-motion: reduce) {
	.map .next .halo {
		animation: none;
	}

	.joy .bar div {
		transition: none;
	}
}

@media (max-width: 640px) {
	.toast {
		top: auto;
		bottom: 250px;
		max-width: calc(100% - 32px);
	}
}

@media (max-width: 520px) {
	.card {
		padding: 18px 18px;
		font-size: 16px;
	}

	.progress {
		min-width: 0;
		font-size: 13px;
	}

	.missions,
	.hint {
		max-width: 150px;
	}

	#minimap {
		width: 78px;
		height: 120px;
	}

	/* The buttons get a row of their own, so they never sit on the panel */
	.top-right {
		top: 8px;
		left: 8px;
		right: 8px;
	}

	.chips {
		flex-wrap: wrap;
		justify-content: flex-end;
		gap: 5px;
	}

	.chip {
		min-height: 32px;
		padding: 4px 10px;
	}

	.progress {
		top: 50px;
		left: 8px;
		max-width: calc(100% - 110px);
		padding: 8px 10px;
		font-size: 12px;
	}
}

/* Phones, upright or on their side: the panel shrinks to a strip so the scene
   stays in view; a tap opens the full list */
@media (max-width: 520px), (max-height: 520px) {
	.progress {
		pointer-events: auto;
		cursor: pointer;
	}

	.progress:not(.open) {
		display: flex;
		flex-wrap: wrap;
		align-items: center;
		gap: 2px 10px;
		min-width: 0;
		padding: 5px 9px;
		font-size: 12px;
	}

	.progress:not(.open) > * {
		display: none;
	}

	.progress:not(.open) > .dots,
	.progress:not(.open) > .keep {
		display: flex;
		margin: 0;
	}

	.progress:not(.open) > .keep::after {
		content: '▾';
		margin-left: -4px;
	}

	.progress:not(.open) #scoreLabel {
		display: none;
	}

	.progress:not(.open) > .hint {
		display: block;
		flex-basis: 100%;
		margin: 0;
		padding: 0;
		border: 0;
		font-size: 12px;
		max-width: 170px;
	}

	#minimap {
		width: 62px;
		height: 96px;
	}
}

/* Touch screens: the panels stay faint so the scene shows through, and come
   up to full strength for a few seconds when touched */
.touch .progress,
.touch #minimap,
.touch .chips {
	opacity: 0.5;
	pointer-events: auto;
	transition: opacity 0.3s ease;
}

.touch .progress.lit,
.touch .progress.open,
.touch #minimap.lit,
.touch .chips.lit {
	opacity: 1;
}

.touch .stick,
.touch .pad {
	opacity: 0.5;
	transition: opacity 0.3s ease;
}

.touch .stick.lit,
.touch .pad.lit {
	opacity: 1;
}

/* With a mouse the panels do the same on hover: faint until pointed at */
@media (hover: hover) {
	body:not(.touch) .progress,
	body:not(.touch) #minimap,
	body:not(.touch) .chips {
		opacity: 0.5;
		pointer-events: auto;
		transition: opacity 0.3s ease;
	}

	body:not(.touch) .progress:hover,
	body:not(.touch) #minimap:hover,
	body:not(.touch) .chips:hover,
	body:not(.touch) .chips:focus-within {
		opacity: 1;
	}
}

/* Phones: cards rise from the bottom edge as sheets, within reach of the thumb,
   with full-width buttons big enough to hit */
@media (max-width: 520px) {
	.overlay {
		align-items: flex-end;
		padding: 0;
	}

	.card {
		width: 100%;
		max-height: 86dvh;
		padding: 22px 16px 18px;
		border-width: 2px 0 0;
		border-radius: 18px 18px 0 0;
		overscroll-behavior: contain;
		font-size: 16px;
		line-height: 1.5;
	}

	/* A small grip, the usual sign of a sheet */
	.card::before {
		content: '';
		position: absolute;
		top: 8px;
		left: 50%;
		width: 44px;
		height: 4px;
		margin-left: -22px;
		border-radius: 2px;
		background: var(--ink-soft);
		opacity: 0.5;
	}

	/* The map and the end-of-stop summary are whole screens, not sheets */
	#chooser .card,
	#finish .card {
		height: 100%;
		max-height: 100dvh;
		border: 0;
		border-radius: 0;
	}

	#chooser .card::before,
	#finish .card::before {
		display: none;
	}

	.card h1 {
		padding: 0 48px;
		font-size: 25px;
	}

	.card h2 {
		font-size: 20px;
	}

	.card h1 + .lead {
		font-size: 15px;
	}

	.chip {
		min-height: 36px;
	}

	.chip.corner {
		top: 12px;
		right: 10px;
	}

	.options {
		gap: 10px;
	}

	.options button {
		min-height: 48px;
		padding: 11px 14px;
	}

	.btn {
		display: block;
		width: 100%;
		min-height: 48px;
		text-align: center;
	}

	.btn.small {
		min-height: 40px;
	}

	.actions {
		flex-direction: column;
		align-items: stretch;
	}

	.toast {
		top: 104px;
		bottom: auto;
		left: 8px;
		max-width: calc(100% - 92px);
		transform: none;
		font-size: 14px;
		text-align: left;
	}
}

/* Phones on their side: little height, so cards tighten up and may fill it */
@media (max-height: 520px) and (min-width: 521px) {
	.overlay {
		padding: 8px;
	}

	.card {
		padding: 14px 20px;
		font-size: 15px;
		line-height: 1.45;
	}

	.card h1 {
		font-size: 24px;
	}

	.toast {
		top: 8px;
		bottom: auto;
		max-width: calc(100% - 420px);
	}
}

/* A quick dip to black when going through a door */
.fade {
	position: fixed;
	inset: 0;
	background: #120a04;
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.24s ease;
}

.fade.on {
	opacity: 1;
}

.help {
	margin: 0 0 12px;
	padding-left: 22px;
}

.help li {
	margin-bottom: 6px;
}

.credits {
	margin: 0 0 12px;
	font-size: 0.72rem;
	opacity: 0.7;
}

.credits a {
	color: inherit;
}

/* ---------- Presentation pass: cinematic manuscript ---------- */
body {
	background: #b88655;
}

/* A quiet lens-like frame makes the view feel composed without dimming controls. */
.cinematic-vignette {
	content: '';
	position: fixed;
	inset: 0;
	z-index: 0;
	pointer-events: none;
	box-shadow: inset 0 0 90px 22px rgba(11, 9, 13, 0.38);
	background: radial-gradient(ellipse at 50% 43%, transparent 45%, rgba(10, 8, 10, 0.18) 100%);
}
/* The cinema look darkens the edge of the picture itself */
body.cinema .cinematic-vignette {
	display: none;
}

#view,
#hud,
.overlay,
.fade {
	z-index: 1;
}

#view {
	filter: saturate(1.06) contrast(1.025);
}

.panel,
.chip,
.prompt {
	border-color: rgba(48, 31, 12, 0.92);
	box-shadow:
		inset 0 0 0 1px rgba(255, 240, 194, 0.85),
		inset 0 0 26px rgba(130, 79, 23, 0.11),
		0 10px 24px rgba(25, 13, 3, 0.28);
}

@supports (backdrop-filter: blur(1px)) {
	.progress,
	#minimap,
	.chips {
		backdrop-filter: blur(5px) saturate(0.82);
	}
}

.progress {
	min-width: 188px;
	padding: 11px 14px 10px;
	border-left: 4px solid var(--sun-gold);
}

.progress .row:first-child {
	font-size: 0.82em;
	letter-spacing: 0.045em;
	text-transform: uppercase;
}

.dots span {
	border-color: rgba(51, 35, 15, 0.78);
	box-shadow: inset 0 0 0 1px rgba(255, 240, 194, 0.7);
}

.dots span.done {
	background: radial-gradient(circle at 35% 30%, #fff2be, var(--sun-gold) 52%, #a66f1e);
	box-shadow: 0 0 10px rgba(229, 177, 74, 0.48);
}

.chip {
	transition:
		transform 160ms ease,
		background-color 160ms ease,
		box-shadow 160ms ease;
}

.chip:hover {
	transform: translateY(-1px);
	background: var(--papyrus-light);
	box-shadow: 0 7px 16px rgba(25, 13, 3, 0.31);
}

.prompt {
	border-color: var(--sun-gold);
	background: linear-gradient(90deg, rgba(255, 244, 205, 0.92), rgba(235, 213, 162, 0.94)),
		var(--sheet);
	animation: prompt-glow 2.8s ease-in-out infinite;
}

.toast {
	border-color: var(--sun-gold);
	background: linear-gradient(110deg, #203a62, var(--sky-blue));
	box-shadow: 0 10px 26px rgba(12, 19, 34, 0.42);
}

.overlay {
	background: radial-gradient(circle at center, rgba(64, 39, 15, 0.26), rgba(17, 11, 5, 0.72));
	backdrop-filter: blur(2px);
}

.card {
	border-color: rgba(53, 32, 9, 0.95);
	border-top: 5px solid var(--sun-gold);
	box-shadow:
		inset 0 0 0 2px rgba(255, 241, 199, 0.72),
		inset 0 0 70px rgba(134, 86, 31, 0.18),
		0 24px 64px rgba(15, 8, 1, 0.68);
	animation: card-arrival 260ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.card h1,
.card h2 {
	text-shadow: 0 1px 0 rgba(255, 244, 210, 0.8);
}

.card h2 {
	color: #2d210f;
}

.btn {
	border-color: #162540;
	background: linear-gradient(135deg, #31598c, #1d365f);
	box-shadow:
		inset 0 0 0 1px var(--sun-gold),
		0 5px 14px rgba(15, 20, 30, 0.32);
	transition:
		transform 160ms ease,
		filter 160ms ease;
}

.btn:hover {
	background: linear-gradient(135deg, #3d6ca3, #244370);
	filter: brightness(1.06);
	transform: translateY(-1px);
}

.btn.ghost {
	border-color: rgba(51, 35, 15, 0.5);
}

.options button {
	border-color: rgba(51, 35, 15, 0.72);
	transition:
		transform 150ms ease,
		background-color 150ms ease;
}

.options button:hover:not(:disabled) {
	transform: translateX(3px);
	background: #fff4d8;
}

/* Blurring and grading a live 3D canvas is costly on phone GPUs, so touch
   screens keep the look without those two effects */
.touch #view {
	filter: none;
}

.touch .progress,
.touch #minimap,
.touch .chips,
.touch .overlay {
	backdrop-filter: none;
}

@keyframes prompt-glow {
	50% {
		box-shadow:
			inset 0 0 0 1px rgba(255, 246, 211, 0.9),
			0 0 0 5px rgba(229, 177, 74, 0.12),
			0 10px 24px rgba(25, 13, 3, 0.36);
	}
}

@keyframes card-arrival {
	from {
		opacity: 0;
		transform: translateY(14px) scale(0.985);
	}
	to {
		opacity: 1;
		transform: translateY(0) scale(1);
	}
}

@media (prefers-reduced-motion: reduce) {
	#view,
	.chip,
	.btn,
	.options button {
		transition: none;
	}

	.prompt {
		animation: none;
	}

	.card {
		animation: none;
	}
}

/* ---------- Chapter title over the opening sweep ---------- */
.chapter {
	position: fixed;
	inset: 0;
	z-index: 2;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: flex-end;
	padding: 0 20px 14vh;
	text-align: center;
	color: var(--papyrus-light);
	background: linear-gradient(to top, rgba(14, 9, 4, 0.72), transparent 55%);
	text-shadow: 0 2px 10px rgba(10, 6, 2, 0.85);
	cursor: pointer;
	animation: chapter-in 1.2s ease both;
	transition: opacity 1s ease;
}

.chapter.out {
	opacity: 0;
}

.chapter p {
	margin: 0;
}

.chapter-no {
	font-size: 14px;
	letter-spacing: 0.22em;
	text-transform: uppercase;
	color: var(--sun-gold);
}

.chapter h1 {
	margin: 6px 0 4px;
	font-family: var(--serif);
	font-size: clamp(32px, 7vw, 60px);
	font-variant: small-caps;
	letter-spacing: 0.04em;
	line-height: 1.1;
}

.chapter h1::after {
	content: '';
	display: block;
	width: 120px;
	height: 2px;
	margin: 12px auto 10px;
	background: linear-gradient(90deg, transparent, var(--sun-gold), transparent);
}

.chapter-sub {
	font-size: clamp(16px, 3.4vw, 21px);
	font-style: italic;
}

.chapter-skip {
	margin-top: 22px !important;
	font-size: 13px;
	opacity: 0.7;
}

@keyframes chapter-in {
	from {
		opacity: 0;
		transform: translateY(12px);
	}
}

@media (prefers-reduced-motion: reduce) {
	.chapter {
		animation: none;
		transition: none;
	}
}

/* ---------- Icons ---------- */
.icon {
	flex: none;
	width: 17px;
	height: 17px;
}

.chip {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 5px;
}

/* The HD chip is a switch: lit in gold while it is on */
.chip.on,
.chip.on:hover {
	color: var(--papyrus-light);
	background: linear-gradient(135deg, #31598c, #1d365f);
	border-color: #162540;
	box-shadow:
		inset 0 0 0 1px var(--sun-gold),
		0 2px 6px rgba(30, 15, 0, 0.35);
}

.chip.on .icon {
	color: var(--sun-gold);
}

.pad .icon {
	width: 30px;
	height: 30px;
	stroke-width: 1.8;
}

.pad.act .icon {
	width: 38px;
	height: 38px;
}

/* On a phone a chip with a word keeps only its drawing */
@media (max-width: 520px) {
	.chip.wordy .label {
		display: none;
	}

	.icon {
		width: 18px;
		height: 18px;
	}
}

/* Shown while the camera is away watching something happen */
.skip-hint {
	position: absolute;
	left: 50%;
	bottom: 22px;
	transform: translateX(-50%);
	padding: 6px 16px;
	font: inherit;
	font-size: 13px;
	color: var(--papyrus-light);
	background: rgba(20, 14, 6, 0.55);
	border: 1px solid rgba(247, 238, 212, 0.5);
	border-radius: 999px;
	cursor: pointer;
}

/* ---------- The pointer to whatever comes next ---------- */
.guide {
	position: absolute;
	top: 12px;
	left: 50%;
	transform: translateX(-50%);
	display: flex;
	align-items: center;
	gap: 8px;
	/* (never wider than the room left between the panel and the buttons) */
	max-width: min(520px, calc(100% - 860px));
	padding: 6px 14px 6px 8px;
	font: inherit;
	font-size: 14px;
	font-weight: 700;
	color: var(--ink);
	background: var(--sheet);
	border: 2px solid var(--sun-gold);
	border-radius: 999px;
	box-shadow: 0 4px 12px rgba(30, 15, 0, 0.4);
	cursor: pointer;
}

.guide[hidden] {
	display: none;
}

.guide-arrow {
	flex: none;
	width: 22px;
	height: 22px;
	padding: 3px;
	fill: var(--papyrus-light);
	background: var(--lapis);
	border-radius: 50%;
	transition: transform 0.12s linear;
}

.guide-dist {
	flex: none;
	font-weight: 400;
	font-size: 12px;
	opacity: 0.75;
}

#guideText {
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

/* Announcements sit just under it */
.toast {
	top: 56px;
}

/* On a narrower window there is no room for it between the panel and the row of
   buttons, so it sits on a line of its own beneath them */
@media (min-width: 521px) and (max-width: 1180px) and (min-height: 521px) {
	.guide {
		top: 54px;
		left: 228px;
		right: 130px;
		width: fit-content;
		max-width: calc(100% - 358px);
		margin: 0 auto;
		transform: none;
	}

	.toast {
		top: 98px;
		max-width: min(440px, calc(100% - 372px));
	}
}

/* ---------- A scene's own tally, such as the ten plagues ---------- */
.tally {
	align-items: center;
}

.marks {
	display: flex;
	flex-wrap: wrap;
	gap: 2px;
}

.marks span {
	display: grid;
	place-items: center;
	width: 15px;
	height: 15px;
	font-size: 9px;
	line-height: 1;
	color: var(--ink-soft);
	border: 1px solid var(--ink-soft);
	border-radius: 50%;
}

.marks span.done {
	font-size: 10px;
	font-weight: 700;
	color: var(--papyrus-light);
	background: var(--olive);
	border-color: var(--olive);
}

@media (max-width: 520px) {
	.guide {
		top: 102px;
		left: 8px;
		transform: none;
		max-width: calc(100% - 92px);
		font-size: 13px;
	}

	.toast {
		top: 146px;
	}

	.progress:not(.open) > .tally {
		flex-basis: 100%;
	}

	.progress:not(.open) > .tally > #tallyLabel {
		display: none;
	}
}

@media (max-height: 520px) and (min-width: 521px) {
	.guide {
		top: 8px;
		max-width: calc(100% - 520px);
	}

	.toast {
		top: 48px;
	}
}

/* ---------- Map markers and the card for the chosen stop ---------- */
.map svg {
	max-height: 56vh;
}

.map .route {
	animation: road 1.4s linear infinite;
}

@keyframes road {
	to {
		stroke-dashoffset: -12;
	}
}

.map .place {
	cursor: pointer;
}

.map .halo {
	fill: transparent;
}

.map .tie {
	stroke: var(--ink);
	stroke-width: 1.5;
	opacity: 0.55;
}

.map .spot {
	fill: var(--ink);
	opacity: 0.7;
}

.map .site .dot {
	fill: var(--papyrus-light);
	stroke: var(--ink);
	stroke-width: 2.5;
}

.map .done .dot {
	fill: #f0d58a;
}

.map .next .dot {
	fill: #fbe9c9;
	stroke: var(--scarlet);
	stroke-width: 3.5;
}

.map .picto {
	fill: none;
	stroke: var(--ink);
	stroke-width: 1.9;
	stroke-linecap: round;
	stroke-linejoin: round;
	pointer-events: none;
}

.map .next .picto {
	stroke: var(--scarlet);
}

.map .locked .picto {
	stroke: rgba(51, 35, 15, 0.5);
}

.map .badge {
	fill: var(--olive);
	stroke: var(--papyrus-light);
	stroke-width: 1.5;
}

.map .check {
	font-size: 11px;
	fill: var(--papyrus-light);
}

.map .site .label {
	font-size: 25px;
}

.map .selected .dot {
	stroke: var(--lapis);
	stroke-width: 4;
}

.map .selected .halo {
	fill: rgba(31, 63, 150, 0.14);
	stroke: var(--lapis);
	stroke-width: 2;
}

.map .selected .label {
	fill: var(--lapis);
}

.map .place:hover .dot,
.map .place:focus-visible .dot {
	stroke-width: 4;
}

.place-card {
	display: flex;
	align-items: center;
	gap: 12px;
	margin-top: 10px;
	padding: 10px 12px;
	background: rgba(247, 238, 212, 0.75);
	border: 2px solid var(--lapis);
	border-radius: 8px;
}

.place-card.locked {
	border-style: dashed;
	border-color: var(--ink-soft);
}

.place-icon {
	flex: none;
	width: 46px;
	height: 46px;
	padding: 8px;
	color: var(--papyrus-light);
	background: var(--lapis);
	border-radius: 50%;
}

.place-card.locked .place-icon {
	background: var(--ink-soft);
}

.place-body {
	flex: 1;
	min-width: 0;
}

.card .place-body h2 {
	margin: 0;
	font-size: 19px;
}

.card .place-body p {
	margin: 2px 0 0;
	font-size: 14px;
	line-height: 1.35;
}

.card .place-stats {
	font-weight: 700;
	color: var(--lapis);
}

.place-card .btn {
	flex: none;
	width: auto;
	margin: 0;
}

@media (max-width: 520px) {
	.map svg {
		max-height: 60vh;
	}

	.place-card {
		flex-wrap: wrap;
	}

	.place-card .btn {
		width: 100%;
	}
}

/* Stops still ahead: shown, named and readable, but plainly not yet open */
.map .route.ahead {
	stroke: var(--ink);
	stroke-width: 2.5;
	opacity: 0.22;
	animation: none;
}

.map .locked .dot {
	fill: rgba(247, 238, 212, 0.7);
	stroke: rgba(51, 35, 15, 0.45);
	stroke-width: 2;
	stroke-dasharray: 4 3;
}

.map .locked .picto {
	stroke: rgba(51, 35, 15, 0.45);
}

.map .locked .label {
	font-size: 22px;
	font-weight: 400;
	font-style: italic;
	opacity: 0.6;
}

.map .lock-badge {
	fill: var(--ink-soft);
	stroke: var(--papyrus-light);
	stroke-width: 1.5;
}

.map .lock {
	fill: var(--papyrus-light);
}

.map .shackle {
	fill: none;
	stroke: var(--papyrus-light);
	stroke-width: 1.4;
}

.map .locked.selected .dot {
	stroke: var(--lapis);
	stroke-dasharray: none;
}

/* A narrow window that is not a phone: the buttons keep only their drawings and
   sit closer, so the row stays clear of the panel on the left */
@media (min-width: 521px) and (max-width: 760px) {
	.chip .label {
		display: none;
	}

	.chips {
		gap: 4px;
	}

	.chip {
		padding-left: 8px;
		padding-right: 8px;
	}
}

/* With the VR button present there are seven chips: tighten them on a phone */
@media (max-width: 520px) {
	.chips.many {
		gap: 3px;
	}

	.chips.many .chip {
		padding: 4px 7px;
	}

	.chips.many .chip .label {
		display: none;
	}
}

/* Phones: while the full list is open, the pointer steps aside and any
   announcement drops below it, so nothing sits on top of the list */
@media (max-width: 520px), (max-height: 520px) {
	.progress.open ~ .guide {
		display: none;
	}

	.progress.open ~ .toast {
		top: auto;
		bottom: 250px;
	}

	.progress.open {
		z-index: 2;
	}
}

/* The bar that fills while something is being shown, and marks that replay */
.skip-hint {
	display: flex;
	flex-direction: column;
	align-items: stretch;
	gap: 5px;
	min-width: 210px;
	padding: 7px 16px 8px;
	text-align: center;
}

.skip-hint[hidden] {
	display: none;
}

.skip-track {
	display: block;
	height: 4px;
	border-radius: 2px;
	background: rgba(247, 238, 212, 0.28);
	overflow: hidden;
}

#skipBar {
	display: block;
	width: 0;
	height: 100%;
	background: var(--sun-gold);
}

.marks span,
.marks button {
	display: grid;
	place-items: center;
	width: 20px;
	height: 20px;
	padding: 0;
	font: inherit;
	font-size: 10px;
	line-height: 1;
	color: var(--ink-soft);
	background: none;
	border: 1px solid var(--ink-soft);
	border-radius: 50%;
}

.marks .done {
	font-size: 12px;
	font-weight: 700;
	color: var(--papyrus-light);
	background: var(--olive);
	border-color: var(--olive);
}

.marks button {
	cursor: pointer;
	pointer-events: auto;
}

.marks button:hover,
.marks button:focus-visible {
	background: var(--lapis);
	border-color: var(--lapis);
}

.tally-hint {
	margin-top: 2px;
	font-size: 11px;
	font-style: italic;
	opacity: 0.75;
	max-width: 220px;
}

@media (max-width: 520px), (max-height: 520px) {
	.progress:not(.open) > .tally-hint {
		display: none;
	}
}

/* The mark for the sign of the staffs: its own little picture, no tick */
.marks .lead {
	font-size: 12px;
	background: var(--papyrus-light);
	border-color: var(--olive);
}

/* Phones: eleven marks must stay on one line inside the strip */
@media (max-width: 520px), (max-height: 520px) {
	.progress:not(.open) .marks {
		flex-wrap: nowrap;
		gap: 1px;
	}

	.progress:not(.open) .marks span,
	.progress:not(.open) .marks button {
		width: 18px;
		height: 18px;
		font-size: 9px;
	}

	.progress:not(.open) .marks .done {
		font-size: 11px;
	}
}

/* Blurring behind the panels and grading the picture made the browser redo
   that work on every frame of a moving 3D view; neither is worth its cost */
#view {
	filter: none;
}

.progress,
#minimap,
.chips,
.overlay {
	backdrop-filter: none;
}

/* While the scene is showing something there is nowhere to walk, so the touch
   controls step aside and leave the strip room */
.showing .stick,
.showing .pad {
	display: none;
}

.skip-hint {
	max-width: calc(100% - 24px);
}

/* The controls on the opening card: keys drawn as keys */
.controls {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 10px 20px;
}

.control {
	display: inline-flex;
	align-items: center;
	gap: 8px;
}

.control-name {
	font-weight: 700;
}

.controls kbd {
	display: inline-grid;
	place-items: center;
	min-width: 26px;
	height: 26px;
	padding: 0 6px;
	box-sizing: border-box;
	font: inherit;
	font-size: 13px;
	font-weight: 700;
	color: var(--ink);
	background: var(--papyrus-light);
	border: 1px solid var(--ink-soft);
	border-bottom-width: 3px;
	border-radius: 5px;
}

.controls kbd.wide {
	min-width: 64px;
}

.keypad {
	display: inline-grid;
	grid-template-columns: repeat(3, 26px);
	gap: 3px;
}

.keypad kbd:first-child {
	grid-column: 2;
}

.keypad kbd:nth-child(2) {
	grid-column: 1;
}

/* Opening a locked stop with a PIN */
.place-pin {
	display: flex;
	gap: 6px;
	align-items: center;
}

.place-pin[hidden] {
	display: none;
}

.place-pin input {
	width: 92px;
	padding: 8px 10px;
	font: inherit;
	font-size: 15px;
	text-align: center;
	letter-spacing: 0.2em;
	color: var(--ink);
	background: var(--papyrus-light);
	border: 1px solid var(--ink-soft);
	border-radius: 5px;
}

.place-pin input.shake {
	animation: pin-shake 0.3s;
	border-color: #a33a2a;
}

/* On a phone the PIN and its button take a row of their own under the words,
   which keep the full width beside the icon */
@media (max-width: 520px) {
	.place-card .place-body {
		flex: 1 1 60%;
	}

	.place-card .place-pin {
		flex: 1 1 100%;
	}

	.place-card .place-pin input {
		flex: 1;
		width: auto;
		min-width: 0;
	}

	.place-card .place-pin .btn {
		flex: none;
		width: auto;
	}
}

@keyframes pin-shake {
	25% {
		transform: translateX(-5px);
	}
	75% {
		transform: translateX(5px);
	}
}

/* The game's own tooltip, in place of the browser's */
.tooltip {
	position: fixed;
	z-index: 9999;
	max-width: min(260px, calc(100vw - 12px));
	padding: 6px 10px;
	font-family: inherit;
	font-size: 13px;
	line-height: 1.35;
	color: var(--papyrus-light);
	background: var(--ink);
	border: 1px solid rgba(200, 146, 42, 0.7);
	border-radius: 6px;
	box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
	pointer-events: none;
	animation: tooltip-in 0.12s ease-out;
}

.tooltip[hidden] {
	display: none;
}

.tooltip::after {
	content: '';
	position: absolute;
	left: var(--arrow, 50%);
	bottom: -5px;
	width: 8px;
	height: 8px;
	background: var(--ink);
	border-right: 1px solid rgba(200, 146, 42, 0.7);
	border-bottom: 1px solid rgba(200, 146, 42, 0.7);
	transform: translateX(-50%) rotate(45deg);
}

.tooltip.below::after {
	top: -5px;
	bottom: auto;
	transform: translateX(-50%) rotate(225deg);
}

@keyframes tooltip-in {
	from {
		opacity: 0;
		transform: translateY(3px);
	}
}

/* ---------- Scroll bars, in the gold and papyrus of the scrolls ---------- */
::-webkit-scrollbar {
	width: 12px;
	height: 12px;
}

::-webkit-scrollbar-track {
	background: rgba(51, 35, 15, 0.12);
	border-radius: 999px;
}

::-webkit-scrollbar-thumb {
	background: linear-gradient(180deg, var(--sun-gold), var(--gold));
	border: 2px solid var(--papyrus);
	border-radius: 999px;
	box-shadow: inset 0 0 0 1px rgba(51, 35, 15, 0.45);
}

::-webkit-scrollbar-thumb:hover {
	background: linear-gradient(180deg, #f2c869, #c9952f);
}

::-webkit-scrollbar-corner {
	background: transparent;
}

/* Browsers without those take the plain two-colour form */
@supports not selector(::-webkit-scrollbar) {
	* {
		scrollbar-width: thin;
		scrollbar-color: var(--gold) rgba(51, 35, 15, 0.12);
	}
}

/* ---------- A gain rises on the screen; the score answers with a beat ---------- */
.pop {
	position: fixed;
	left: 50%;
	top: 36%;
	z-index: 60;
	font-family: var(--serif);
	font-size: clamp(30px, 6vw, 54px);
	font-weight: 800;
	color: #ffe08a;
	-webkit-text-stroke: 1.5px #3a2204;
	paint-order: stroke fill;
	text-shadow:
		0 3px 0 rgba(58, 34, 4, 0.75),
		0 0 22px rgba(255, 200, 80, 0.85);
	pointer-events: none;
	animation: pop-rise 1.25s cubic-bezier(0.2, 0.8, 0.3, 1) forwards;
}

@keyframes pop-rise {
	0% {
		opacity: 0;
		transform: translate(-50%, 20px) scale(0.5);
	}

	18% {
		opacity: 1;
		transform: translate(-50%, 0) scale(1.18);
	}

	32% {
		transform: translate(-50%, -6px) scale(1);
	}

	100% {
		opacity: 0;
		transform: translate(-50%, -90px) scale(1);
	}
}

#score.bump {
	display: inline-block;
	animation: score-bump 0.5s ease-out;
}

@keyframes score-bump {
	30% {
		color: var(--gold);
		transform: scale(1.45);
	}
}

/* ---------- While the scene shows something: the frame of a film ---------- */
#hud::before,
#hud::after {
	content: '';
	position: fixed;
	left: 0;
	right: 0;
	z-index: -1;
	height: 9vh;
	background: #0b0806;
	pointer-events: none;
	transition: transform 0.7s ease;
}

#hud::before {
	top: 0;
	transform: translateY(-100%);
}

#hud::after {
	bottom: 0;
	transform: translateY(100%);
}

body.showing #hud::before,
body.showing #hud::after {
	transform: none;
}

/* Nothing can be examined while a scene plays, so nothing is offered */
body.showing .prompt,
body.showing .yard-bar {
	display: none !important;
}

/* The panels step back while it plays; the words and the way to skip stay */
body.showing .progress,
body.showing .top-right,
body.showing .guide {
	opacity: 0 !important;
	pointer-events: none;
	transition: opacity 0.5s ease;
}

@media (prefers-reduced-motion: reduce) {
	.pop {
		animation-duration: 0.9s;
		animation-timing-function: linear;
	}

	#score.bump {
		animation: none;
	}

	#hud::before,
	#hud::after {
		transition: none;
	}
}

/* ---------- A room: the expedition together ---------- */
.room-form {
	display: grid;
	gap: 10px;
	margin-bottom: 4px;
}

.room-form label {
	display: grid;
	gap: 4px;
	font-size: 14px;
	font-weight: 700;
}

.room-form input {
	padding: 9px 12px;
	font: inherit;
	font-size: 16px;
	color: var(--ink);
	background: rgba(247, 238, 212, 0.85);
	border: 2px solid var(--ink);
	border-radius: 6px;
}

#roomJoinCode {
	width: 7.5em;
	letter-spacing: 0.3em;
	text-transform: uppercase;
}

.room-code {
	margin: 0 0 8px;
}

.room-code strong {
	margin-left: 8px;
	font-size: 30px;
	letter-spacing: 0.25em;
	color: var(--lapis);
}

/* ---------- Buttons that say what they are: a drawing, a name, a line below ---------- */
.btn.with-icon {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	text-align: left;
}

.btn.with-icon .icon {
	flex: none;
	width: 22px;
	height: 22px;
}

.btn.with-icon .label {
	display: grid;
	line-height: 1.2;
}

.hint-line {
	font-size: 12px;
	font-weight: 400;
	opacity: 0.78;
}

/* The one that cannot be undone stands apart, and quietly */
.actions .quiet {
	margin-left: auto;
	border-color: transparent;
	opacity: 0.7;
}

.actions .quiet .icon {
	width: 16px;
	height: 16px;
}

.actions .quiet:hover,
.actions .quiet:focus-visible {
	color: var(--scarlet);
	border-color: var(--scarlet);
	opacity: 1;
}

@media (max-width: 520px) {
	.actions .quiet {
		margin-left: 0;
		justify-content: center;
	}
}

/* ---------- The map's buttons, in even columns ---------- */
.map-actions {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
	gap: 10px;
	align-items: stretch;
}

.map-actions .btn {
	margin-top: 0;
}

.map-actions .quiet {
	grid-column: 1 / -1;
	justify-self: end;
	margin-left: 0;
}

/* ---------- The daily gift ---------- */
.gift {
	margin: 14px 0 12px;
}

.gift-btn {
	display: flex;
	align-items: center;
	gap: 14px;
	width: 100%;
	padding: 12px 18px;
	font: inherit;
	font-weight: 700;
	text-align: left;
	color: var(--ink);
	background: linear-gradient(110deg, #f6d98a, #eec25a 55%, #f8e3a6);
	border: 2px solid var(--gold);
	border-radius: 8px;
	box-shadow:
		inset 0 0 0 2px rgba(255, 248, 220, 0.7),
		0 4px 12px rgba(120, 80, 10, 0.3);
	cursor: pointer;
	animation: gift-glow 2.6s ease-in-out infinite;
}

.gift-btn[hidden],
.gift-word[hidden] {
	display: none;
}

.gift-btn .icon {
	flex: none;
	width: 30px;
	height: 30px;
	color: var(--scarlet);
}

.gift-btn .label {
	display: grid;
	gap: 2px;
	font-size: 17px;
	line-height: 1.2;
}

.gift-btn:hover {
	filter: brightness(1.05);
}

@keyframes gift-glow {
	50% {
		box-shadow:
			inset 0 0 0 2px rgba(255, 248, 220, 0.9),
			0 4px 22px rgba(229, 177, 74, 0.85);
	}
}

.gift-word {
	padding: 12px 18px;
	background: rgba(247, 238, 212, 0.7);
	border-left: 4px solid var(--gold);
	border-radius: 0 8px 8px 0;
}

.gift-word.fresh {
	animation: gift-open 0.7s ease-out;
}

@keyframes gift-open {
	from {
		opacity: 0;
		transform: scale(0.96);
		background: #fff3c4;
	}
}

.gift-label {
	margin: 0 0 4px;
	font-size: 12px;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--gold);
}

.gift-text {
	margin: 0;
	font-size: 17px;
	font-style: italic;
	line-height: 1.4;
}

.gift-note {
	margin: 6px 0 0;
	font-size: 12px;
	opacity: 0.7;
}

@media (prefers-reduced-motion: reduce) {
	.gift-btn,
	.gift-word.fresh {
		animation: none;
	}
}

/* ---------- The map on a wide screen: map on the left, the rest beside it,
   so the whole of it is in view without scrolling ---------- */
@media (min-width: 900px) {
	#chooser .card.wide {
		display: grid;
		grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
		column-gap: 26px;
		align-content: start;
		width: min(1240px, 100%);
		padding: 20px 26px;
	}

	#chooser .card.wide > * {
		grid-column: 2;
	}

	#chooser .card.wide > .map {
		grid-column: 1;
		grid-row: 1 / span 12;
		align-self: start;
	}

	#chooser .map svg {
		max-height: calc(100vh - 84px);
	}

	#chooser h1 {
		margin: 0 80px 6px 0;
		font-size: clamp(22px, 2.3vw, 34px);
		line-height: 1.15;
		text-align: left;
	}

	#chooser h1::after {
		text-align: center;
	}

	#chooser .lead {
		margin: 0 0 6px;
		font-size: 14px;
		line-height: 1.4;
		text-align: left;
	}

	#chooser .journey {
		margin: 0 0 8px;
		font-size: 14px;
		text-align: left;
	}

	/* The stop's card: its words the full width, its button beneath them */
	#chooser .place-card {
		flex-wrap: wrap;
		gap: 8px 12px;
		margin-top: 0;
		padding: 8px 12px;
	}

	#chooser .place-card p {
		font-size: 14px;
		line-height: 1.4;
	}

	#chooser .place-card .btn,
	#chooser .place-pin {
		flex: 1 1 100%;
		text-align: center;
	}

	#chooser .caption {
		margin: 6px 0 0;
		font-size: 13px;
	}

	#chooser .gift {
		margin: 8px 0;
	}

	#chooser .gift-btn,
	#chooser .gift-word {
		padding: 8px 14px;
	}

	#chooser .gift-text {
		font-size: 15px;
	}

	/* Continue across the top, the other two side by side beneath it */
	#chooser .map-actions {
		grid-template-columns: 1fr 1fr;
		gap: 8px;
	}

	#chooser .map-actions .btn {
		padding: 8px 12px;
	}

	#chooser #pickNext {
		grid-column: 1 / -1;
		justify-content: center;
	}

	#chooser .note {
		margin: 2px 0 0;
		font-size: 12px;
	}
}

/* Wide but not tall, as in a laptop window: the opening words give way first */
@media (min-width: 900px) and (max-height: 860px) {
	#chooser .lead {
		display: none;
	}
}

@media (min-width: 900px) and (max-height: 640px) {
	#chooser .caption,
	#chooser .note {
		display: none;
	}

	#chooser .card.wide {
		padding: 12px 20px;
	}
}

/* ---------- How many are playing just now ---------- */
.online {
	display: flex;
	align-items: center;
	gap: 7px;
	margin: 0 0 8px;
	font-size: 13px;
	font-weight: 700;
	color: var(--olive);
}

.online[hidden] {
	display: none;
}

.online::before {
	content: '';
	width: 9px;
	height: 9px;
	background: #5fa83a;
	border-radius: 50%;
	box-shadow: 0 0 0 3px rgba(95, 168, 58, 0.25);
}

.card:not(.wide) .online,
#chooser .online {
	justify-content: center;
}

@media (min-width: 900px) {
	#chooser .online {
		justify-content: flex-start;
	}
}

/* ---------- A word cut in stone: each of the ten, as it is spoken ---------- */
.stone {
	position: absolute;
	left: 50%;
	/* (below where an announcement would show) */
	top: max(124px, 20vh);
	width: min(440px, calc(100% - 40px));
	padding: 26px 28px 22px;
	text-align: center;
	color: #2c2924;
	background: radial-gradient(circle at 22% 18%, rgba(255, 255, 255, 0.35), transparent 42%),
		radial-gradient(circle at 78% 82%, rgba(40, 36, 30, 0.22), transparent 48%),
		repeating-linear-gradient(17deg, rgba(60, 54, 46, 0.06) 0 2px, transparent 2px 7px),
		linear-gradient(160deg, #b9b3a6, #8f897d 60%, #7b756a);
	border: 2px solid #5d574d;
	border-radius: 50% 50% 10px 10px / 30% 30% 10px 10px;
	box-shadow:
		inset 0 2px 0 rgba(255, 255, 255, 0.45),
		inset 0 -6px 14px rgba(40, 34, 26, 0.35),
		0 16px 36px rgba(0, 0, 0, 0.55);
	transform: translateX(-50%);
	pointer-events: none;
}

.stone[hidden] {
	display: none;
}

.stone.struck {
	animation: stone-struck 0.55s cubic-bezier(0.2, 0.9, 0.3, 1);
}

@keyframes stone-struck {
	0% {
		filter: brightness(2.4);
		transform: translateX(-50%) scale(1.12);
	}

	100% {
		filter: none;
		transform: translateX(-50%) scale(1);
	}
}

/* Letters cut into the face: dark within, a line of light on the lower edge */
.stone-no,
.stone-he,
.stone-text {
	display: block;
	margin: 0;
	text-shadow:
		0 1px 0 rgba(255, 255, 255, 0.5),
		0 -1px 0 rgba(30, 26, 20, 0.45);
}

.stone-no {
	font-family: var(--serif);
	font-size: 30px;
	font-weight: 700;
	letter-spacing: 0.12em;
	color: #4a453d;
}

.stone-he {
	margin-top: 4px;
	font-family: 'Times New Roman', 'Arial Hebrew', serif;
	font-size: 22px;
	color: #4a453d;
}

.stone-text {
	margin-top: 8px;
	font-family: var(--serif);
	font-size: clamp(20px, 3.4vw, 28px);
	font-weight: 700;
	line-height: 1.25;
}

@media (max-height: 520px) {
	.stone {
		top: 96px;
		padding: 16px 22px 12px;
	}

	.stone-he {
		display: none;
	}
}

@media (prefers-reduced-motion: reduce) {
	.stone.struck {
		animation: none;
	}
}

/* ---------- On a television: read from the sofa, driven by the remote ---------- */
body.tv #hud,
body.tv .overlay .card {
	zoom: 1.25;
}

body.tv #chooser .card.wide {
	zoom: 1.1;
}

/* What the remote is on must be plain from across the room */
body.tv :focus,
body.tv :focus-visible {
	outline: 4px solid var(--sun-gold);
	outline-offset: 3px;
	box-shadow: 0 0 0 7px rgba(30, 20, 5, 0.55);
}

body.tv .map [tabindex]:focus {
	outline: none;
	filter: drop-shadow(0 0 5px var(--sun-gold)) drop-shadow(0 0 2px #fff);
}

/* (no pointer to hover with: the panels are always in full view) */
body.tv .progress,
body.tv #minimap,
body.tv .chips {
	opacity: 1 !important;
}

body.tv #view {
	cursor: none;
}

/* ---------- Sound panel: opened by the music button ---------- */
.sound-panel {
	position: fixed;
	top: 58px;
	right: 12px;
	z-index: 6;
	display: flex;
	flex-direction: column;
	gap: 10px;
	width: min(240px, calc(100vw - 24px));
	padding: 12px 14px;
	color: var(--ink);
	background: var(--papyrus-light);
	border: 2px solid var(--gold, #c9a24a);
	border-radius: 10px;
	box-shadow: 0 6px 18px rgba(20, 14, 6, 0.3);
	pointer-events: auto;
}

.sound-panel[hidden] {
	display: none;
}

.sound-panel label {
	display: flex;
	align-items: center;
	gap: 10px;
	font-weight: 700;
	font-size: 15px;
}

.sound-panel input[type='range'] {
	flex: 1;
	min-width: 0;
	height: 28px;
	accent-color: var(--lapis);
}

.sound-panel .btn {
	width: 100%;
	margin: 0;
}

/* ---------- The leaderboard ---------- */
.board-you {
	margin: 0 0 10px;
	font-weight: 700;
	color: var(--lapis);
}

.board-list {
	max-height: min(52vh, 420px);
	margin: 0 0 10px;
	padding: 0;
	overflow-y: auto;
	list-style: none;
	border-top: 1px solid rgba(60, 44, 20, 0.25);
}

.board-list li {
	display: flex;
	align-items: baseline;
	gap: 10px;
	padding: 7px 6px;
	border-bottom: 1px solid rgba(60, 44, 20, 0.16);
}

.board-list li.plain {
	display: block;
	padding: 14px 6px;
	font-style: italic;
}

.board-list li.me {
	font-weight: 700;
	background: rgba(184, 134, 43, 0.2);
	border-radius: 5px;
}

.board-list .place {
	flex: none;
	width: 2em;
	text-align: right;
	font-variant-numeric: tabular-nums;
	color: var(--ink-soft);
}

.board-list .name {
	flex: 1;
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.board-list .time {
	flex: none;
	font-size: 0.85em;
	font-variant-numeric: tabular-nums;
	color: var(--ink-soft);
}

.board-list .score {
	flex: none;
	font-weight: 700;
	font-variant-numeric: tabular-nums;
}

/* The first three stand out */
.board-list li:nth-child(-n + 3):not(.plain) .place {
	color: var(--gold);
	font-weight: 700;
}
