/* A scroll-and-ink look: papyrus sheets, sepia ink, and the colours of the
   Tabernacle (gold, blue, purple, scarlet) for accents. */
:root {
	--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;
}

.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: 64px;
	width: 78px;
	height: 78px;
	font-size: 32px;
	background: var(--gold);
}

.pad.run {
	right: 112px;
	bottom: 26px;
	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;
}

.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;
	}
}
