:root {
	--ink: #f4eee3;
	--muted: #b9c2d0;
	--panel: rgba(18, 26, 40, 0.78);
	--line: rgba(255, 255, 255, 0.14);
	--accent: #f2b632;
	--coral: #e86f5a;
	--sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
	--serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
}

* { box-sizing: border-box; }

html, body {
	margin: 0;
	height: 100%;
	overflow: hidden;
	background: #060b16;
	color: var(--ink);
	font-family: var(--sans);
	font-size: 16px;
	line-height: 1.5;
}

#scene {
	position: fixed;
	inset: 0;
	width: 100%;
	height: 100%;
	display: block;
	touch-action: none;
	-webkit-user-select: none;
	user-select: none;
	cursor: grab;
}
#scene.hot { cursor: pointer; }
#scene.dragging { cursor: grabbing; }

button { font: inherit; color: inherit; cursor: pointer; }
svg { width: 20px; height: 20px; fill: currentColor; display: block; }

.glass, #top .buttons button, #top .info, #top .site, #card, #tour, #tip, #intro .panel {
	background: var(--panel);
	border: 1px solid var(--line);
	-webkit-backdrop-filter: blur(14px);
	backdrop-filter: blur(14px);
}

/* ---------- top bar ---------- */

#top {
	position: fixed;
	top: 0; left: 0; right: 0;
	display: flex;
	justify-content: space-between;
	align-items: flex-start;
	padding: max(14px, env(safe-area-inset-top)) 16px 0;
	pointer-events: none;
}
#top .title { text-shadow: 0 1px 12px rgba(0, 0, 0, 0.7); }
#top .title strong { display: block; font-family: var(--serif); font-size: 22px; font-weight: 600; letter-spacing: 0.01em; }
#top .title span { color: var(--muted); font-size: 13px; }
#top .buttons { display: flex; gap: 8px; align-items: center; pointer-events: auto; }
#top .buttons button, #top .info {
	width: 40px; height: 40px;
	border-radius: 50%;
	display: grid; place-items: center;
	padding: 0;
	color: var(--ink);
	transition: transform 0.15s ease, color 0.15s ease;
}
#top .buttons button:hover, #top .info:hover { transform: scale(1.08); color: var(--accent); }
#top .buttons button.off { color: #77808f; }
#btn-sound.off .waves { display: none; }
#top .site {
	height: 40px;
	display: grid; place-items: center;
	padding: 0 16px;
	border-radius: 20px;
	color: var(--ink);
	text-decoration: none;
	font-size: 14px;
}
#top .site:hover { color: var(--accent); }

/* ---------- hover label ---------- */

#tip {
	position: fixed;
	left: 0; top: 0;
	padding: 5px 11px;
	border-radius: 14px;
	font-size: 13px;
	white-space: nowrap;
	pointer-events: none;
	opacity: 0;
	transition: opacity 0.15s ease;
	transform: translate(-50%, -150%);
}
#tip.on { opacity: 1; }

/* ---------- story card ---------- */

#card {
	position: fixed;
	top: 76px; right: 16px;
	width: 360px;
	max-height: calc(100% - 170px);
	overflow-y: auto;
	padding: 22px 24px 20px;
	border-radius: 18px;
	box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
	opacity: 0;
	transform: translateX(24px);
	pointer-events: none;
	transition: opacity 0.3s ease, transform 0.3s ease;
}
#card.open { opacity: 1; transform: none; pointer-events: auto; }
#card-close {
	position: absolute;
	top: 12px; right: 12px;
	width: 32px; height: 32px;
	border: none; border-radius: 50%;
	background: transparent;
	display: grid; place-items: center;
	color: var(--muted);
}
#card-close:hover { color: var(--ink); background: rgba(255, 255, 255, 0.08); }
#card-more { display: none; }
.kicker {
	margin: 0 0 6px;
	color: var(--accent);
	font-size: 12px;
	font-weight: 600;
	letter-spacing: 0.12em;
	text-transform: uppercase;
}
#card h2 { margin: 0 34px 12px 0; font-family: var(--serif); font-size: 25px; font-weight: 600; line-height: 1.2; }
#card-body p { margin: 0 0 12px; color: #e3e0d8; font-size: 15px; }
#card-body .money { color: #6fe09a; font-weight: 600; white-space: nowrap; }
.hint {
	margin: 0 0 12px;
	padding: 8px 12px;
	border-radius: 10px;
	background: rgba(242, 182, 50, 0.12);
	color: #f6d78b;
	font-size: 13.5px;
}
.hint:empty { display: none; }
.links { margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.links a {
	padding: 6px 12px;
	border: 1px solid var(--line);
	border-radius: 16px;
	color: var(--ink);
	font-size: 13.5px;
	text-decoration: none;
	transition: border-color 0.15s ease, color 0.15s ease;
}
.links a:hover { border-color: var(--accent); color: var(--accent); }
.visits { margin: 14px 0 0; font-size: 12.5px; opacity: 0.6; }
.visits:empty { display: none; }

/* ---------- tour bar ---------- */

#tour {
	position: fixed;
	left: 50%; bottom: max(18px, env(safe-area-inset-bottom));
	transform: translateX(-50%);
	display: flex;
	align-items: center;
	gap: 4px;
	padding: 5px;
	border-radius: 28px;
	box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
	max-width: calc(100% - 24px);
}
#tour button {
	height: 40px;
	border: none;
	border-radius: 20px;
	background: transparent;
	display: grid; place-items: center;
}
#tour-prev, #tour-next { width: 40px; padding: 0; flex: none; }
#tour-label { padding: 0 14px; font-size: 14.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
#tour button:hover { background: rgba(255, 255, 255, 0.09); color: var(--accent); }
#found {
	padding: 0 14px 0 10px;
	border-left: 1px solid var(--line);
	color: var(--muted);
	font-size: 13px;
	white-space: nowrap;
}
#found.done { color: #6fe09a; }

/* ---------- intro ---------- */

#intro {
	position: fixed;
	inset: 0;
	display: grid;
	place-items: end center;
	padding: 20px 20px max(34px, env(safe-area-inset-bottom));
	background: linear-gradient(to top, rgba(6, 11, 22, 0.75), rgba(6, 11, 22, 0) 65%);
	transition: opacity 0.8s ease;
}
#intro.gone { opacity: 0; pointer-events: none; }
body.intro #tour, body.intro #top .buttons { opacity: 0; pointer-events: none; }
#tour, #top .buttons { transition: opacity 0.8s ease; }
#intro .panel {
	max-width: 460px;
	padding: 26px 34px 22px;
	border-radius: 22px;
	text-align: center;
	box-shadow: 0 24px 70px rgba(0, 0, 0, 0.5);
}
#intro h1 { margin: 0 0 14px; font-family: var(--serif); font-size: 34px; font-weight: 600; line-height: 1.15; }
#intro p { margin: 0 0 12px; color: #e3e0d8; }
#intro .how { color: var(--muted); font-size: 14px; }
#enter {
	margin-top: 10px;
	padding: 12px 30px;
	border: none;
	border-radius: 26px;
	background: var(--accent);
	color: #1c1a14;
	font-size: 16px;
	font-weight: 700;
	transition: transform 0.15s ease, background 0.15s ease;
}
#enter:hover { transform: scale(1.05); background: #ffc94f; }
#enter[disabled] { opacity: 0.4; pointer-events: none; }
#intro .loading { margin: 12px 0 0; color: var(--muted); font-size: 13px; min-height: 20px; }

#flash {
	position: fixed;
	inset: 0;
	background: #fff;
	opacity: 0;
	pointer-events: none;
}
#flash.go { animation: flash 0.5s ease-out; }
@keyframes flash { 0% { opacity: 0.85; } 100% { opacity: 0; } }

/* ---------- phones ---------- */

@media (max-width: 700px) {
	#top { padding-left: 12px; padding-right: 12px; }
	#top .title strong { font-size: 18px; }
	#top .title span { font-size: 12px; }
	#top .site { display: none; }
	#top .buttons button, #top .info { width: 38px; height: 38px; }

	/* On a phone the card is a short strip above the tour bar: the title and the hint. "More"
	   opens the story and its links; "Less" folds it away again. */
	#card {
		top: auto; right: 8px; left: 8px;
		bottom: calc(max(18px, env(safe-area-inset-bottom)) + 58px);
		width: auto;
		max-height: 46%;
		padding: 9px 14px 10px;
		border-radius: 14px;
		transform: translateY(24px);
	}
	#card .kicker { display: none; }
	#card h2 { font-size: 17px; margin: 0 104px 3px 0; }
	#card-body p { font-size: 14px; margin-bottom: 8px; }
	#card .hint { font-size: 12.5px; margin: 3px 0 0; padding: 5px 9px; }
	#card:not(.full) #card-body, #card:not(.full) #card-links, #card:not(.full) #card-visits { display: none; }
	#card .visits { margin-top: 9px; font-size: 12px; }
	#card.full #card-body { margin-top: 6px; }
	#card.full .hint { margin-bottom: 9px; }
	#card-close { top: 4px; right: 5px; }
	#card-more {
		display: block; position: absolute; top: 8px; right: 42px;
		padding: 3px 10px; border: 1px solid var(--line); border-radius: 12px;
		background: transparent; color: var(--ink); font: inherit; font-size: 12px;
	}
	#found { display: none; }
	#intro h1 { font-size: 28px; }
	#intro .panel { padding: 26px 22px 22px; }
}
