/* STRATA map: the game's own HUD (Client/UI.luau, GAME_DESIGN §8). Quiet, lowercase,
   grey, Builder Sans. Readouts are bare text with a soft halo, as in game; only the
   things you open (travel, walkers) sit on paper. Like the game's HUD, the whole
   palette turns light-on-dark in dark layers (data-hud, set from the layer). */

@font-face {
	font-family: "Builder Sans";
	src: url("assets/fonts/BuilderSans-Regular.otf") format("opentype");
	font-weight: 400;
	font-display: swap;
}
@font-face {
	font-family: "Builder Sans";
	src: url("assets/fonts/BuilderSans-Medium.otf") format("opentype");
	font-weight: 500;
	font-display: swap;
}
@font-face {
	font-family: "Builder Sans";
	src: url("assets/fonts/BuilderSans-Bold.otf") format("opentype");
	font-weight: 600 700;
	font-display: swap;
}

/* UI.c, light */
:root {
	--ink: #3c3c3e;
	--soft: #5a5a61;
	--faint: rgba(95, 95, 102, 0.72);
	--paper: rgba(245, 245, 243, 0.9);
	--paper-solid: #f5f5f3;
	--slot: #e4e4e2;
	--slot-hover: #dadad8;
	--selected: #ffffff;
	--accent: #5b6b8c;
	--line: rgba(0, 0, 0, 0.07);
	--hud: #56565a;
	--halo: rgba(255, 255, 255, 0.75);
	--shadow: 0 1px 2px rgba(0, 0, 0, 0.05), 0 10px 30px rgba(0, 0, 0, 0.08);
	--bg: #f2f2f2;
	--ease: cubic-bezier(0.25, 0.8, 0.3, 1);
	color-scheme: light;
}
/* UI.setTheme, dark */
:root[data-hud="dark"] {
	--ink: #eaebef;
	--soft: #c4c6ce;
	--faint: rgba(180, 184, 196, 0.72);
	--paper: rgba(26, 27, 31, 0.88);
	--paper-solid: #1a1b1f;
	--slot: #2c2d33;
	--slot-hover: #3a3c44;
	--selected: #3e4048;
	--accent: #9bacca;
	--line: rgba(235, 236, 242, 0.08);
	--hud: #e0e2ea;
	--halo: rgba(17, 18, 24, 0.7);
	--shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 10px 30px rgba(0, 0, 0, 0.35);
	--bg: #18181b;
	color-scheme: dark;
}

* {
	box-sizing: border-box;
}
a.tool { text-decoration: none; display: inline-flex; align-items: center; }
[hidden] {
	display: none !important;
}

html,
body {
	margin: 0;
	height: 100%;
	overflow: hidden;
	background: var(--bg);
	color: var(--ink);
	font: 15px/1.3 "Builder Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
	-webkit-font-smoothing: antialiased;
}

#view {
	position: fixed;
	inset: 0;
	width: 100%;
	height: 100%;
	display: block;
	touch-action: none;
	outline: none;
	cursor: grab;
}
#view:active {
	cursor: grabbing;
}
#view.looking {
	cursor: none;
}

button,
input {
	font: inherit;
	color: inherit;
}
button {
	cursor: pointer;
	border: 0;
	background: none;
	padding: 0;
}
:focus-visible {
	outline: 2px solid var(--accent);
	outline-offset: 2px;
	border-radius: 8px;
}

/* bare HUD text: a halo instead of a box, like TextStroke in game */
.readout,
.tools,
.hints {
	color: var(--hud);
	text-shadow: 0 0 3px var(--halo), 0 0 1px var(--halo);
	transition: color 0.6s var(--ease);
}

/* top centre, as the game's HUD: distance, coordinates, then the layer */
.readout {
	position: fixed;
	top: max(14px, env(safe-area-inset-top));
	left: 50%;
	transform: translateX(-50%);
	text-align: center;
	pointer-events: none;
	white-space: nowrap;
	font-variant-numeric: tabular-nums;
}
.readout .distance {
	font-size: 19px;
	font-weight: 500;
}
.readout .coords {
	font-size: 13px;
	opacity: 0.65;
	margin-top: 1px;
}
.readout .layer {
	font-size: 30px;
	font-weight: 400;
	margin-top: 10px;
	opacity: 0.55;
	transition: opacity 1.2s var(--ease);
}
.readout .layer.fresh {
	opacity: 1;
	transition-duration: 0.3s;
}
.readout .plane {
	font-size: 13px;
	opacity: 0.6;
	min-height: 16px;
}

/* top corners: travel on the left, the view switch on the right */
.tools {
	position: fixed;
	top: max(14px, env(safe-area-inset-top));
	display: flex;
	gap: 4px;
}
.tools.left {
	left: 16px;
}
.tools.right {
	right: 16px;
}
.admin-tools { position: relative; }
.admin-menu { position: absolute; right: 0; top: 100%; width: 240px; padding: 8px; border-radius: 12px; background: var(--paper-solid); color: var(--ink); text-shadow: none; box-shadow: var(--shadow); }
.admin-menu .tool { width: 100%; justify-content: space-between; text-align: left; font: inherit; }
.admin-menu .tool:hover { background: var(--slot); }
.admin-menu .tool:disabled { opacity: .5; cursor: default; }
.admin-menu p { margin: 6px 10px; font-size: 12px; color: var(--soft); }
.admin-menu .shortcut { color: var(--faint); float: right; }
#admin-button[data-active] { background: var(--paper); color: var(--ink); text-shadow: none; }
.tool {
	padding: 6px 10px;
	border-radius: 10px;
	font-size: 15px;
	color: inherit;
	transition: background 0.2s var(--ease), color 0.2s var(--ease);
}
.tool:hover,
.tool[aria-expanded="true"] {
	background: var(--paper);
	color: var(--ink);
	text-shadow: none;
}
.switch {
	display: flex;
	align-items: center;
	gap: 8px;
}
.knob {
	width: 26px;
	height: 15px;
	border-radius: 8px;
	background: var(--slot-hover);
	position: relative;
	transition: background 0.25s var(--ease);
	box-shadow: inset 0 0 0 1px var(--line);
}
.knob::after {
	content: "";
	position: absolute;
	top: 2px;
	left: 2px;
	width: 11px;
	height: 11px;
	border-radius: 50%;
	background: var(--paper-solid);
	transition: transform 0.25s var(--ease);
}
.switch[aria-checked="true"] .knob {
	background: var(--ink);
}
.switch[aria-checked="true"] .knob::after {
	transform: translateX(11px);
}

/* paper surfaces: the travel sheet and the walkers panel */
.sheet,
.panel {
	background: var(--paper);
	border-radius: 12px;
	box-shadow: var(--shadow);
	transition: background 0.6s var(--ease), color 0.6s var(--ease);
}

/* travel: every layer of every plane */
.sheet {
	position: fixed;
	top: calc(max(14px, env(safe-area-inset-top)) + 40px);
	left: 16px;
	width: 264px;
	max-height: calc(100vh - 140px);
	overflow-y: auto;
	padding: 6px;
	transform-origin: top left;
	animation: open 0.22s var(--ease);
	scrollbar-width: thin;
}
@keyframes open {
	from {
		opacity: 0;
		transform: translateY(-4px) scale(0.98);
	}
}
.sheet h3 {
	margin: 12px 10px 4px;
	font-size: 13px;
	font-weight: 400;
	color: var(--faint);
}
.sheet ol {
	list-style: none;
	margin: 0;
	padding: 0;
}
.row {
	width: 100%;
	display: grid;
	grid-template-columns: 12px 1fr auto;
	align-items: center;
	gap: 10px;
	padding: 6px 10px;
	border-radius: 8px;
	text-align: left;
	transition: background 0.15s var(--ease);
}
.row:hover {
	background: var(--slot);
}
.row[aria-current="true"] {
	background: var(--selected);
	box-shadow: 0 0 0 1px var(--line);
}
.row .swatch {
	width: 10px;
	height: 10px;
	border-radius: 3px;
	box-shadow: inset 0 0 0 1px var(--line);
}
.row.home .swatch {
	background: var(--ink);
	border-radius: 50%;
	transform: scale(0.6);
}
.row .name {
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
.row .far {
	color: var(--faint);
	font-size: 13px;
	font-variant-numeric: tabular-nums;
}

/* walkers */
.panel {
	position: fixed;
	left: 16px;
	bottom: max(16px, env(safe-area-inset-bottom));
	width: 264px;
	display: flex;
	flex-direction: column;
	overflow: hidden;
}
.panel-head {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 10px 14px;
	font-weight: 500;
	text-align: left;
}
.panel-head::after {
	content: "";
	width: 7px;
	height: 7px;
	border-right: 1.5px solid var(--faint);
	border-bottom: 1.5px solid var(--faint);
	transform: translateY(-2px) rotate(45deg);
	transition: transform 0.25s var(--ease);
}
.panel-head[aria-expanded="false"]::after {
	transform: translateY(2px) rotate(-135deg);
}
.panel-head[aria-expanded="false"] + #walker-body {
	display: none;
}
#walker-body {
	display: flex;
	flex-direction: column;
	min-height: 0;
	max-height: min(46vh, 380px);
	padding: 0 6px 6px;
}
#walker-search {
	margin: 0 4px 6px;
	padding: 7px 10px;
	border: 0;
	border-radius: 8px;
	background: var(--slot);
	color: var(--ink);
	outline: none;
	transition: background 0.15s var(--ease);
}
#walker-search::placeholder {
	color: var(--faint);
}
#walker-search:focus {
	background: var(--slot-hover);
}
#walker-search::-webkit-search-cancel-button {
	filter: grayscale(1);
}
#walker-list {
	list-style: none;
	margin: 0;
	padding: 0;
	overflow-y: auto;
	scrollbar-width: thin;
}
#walker-list .row {
	grid-template-columns: 1fr auto;
}
.empty {
	margin: 4px 10px 8px;
	color: var(--faint);
	font-size: 13px;
}

/* bottom centre: who the camera is following, like the game's prompt pill */
.following {
	position: fixed;
	left: 50%;
	bottom: max(16px, env(safe-area-inset-bottom));
	transform: translateX(-50%);
	display: flex;
	align-items: center;
	gap: 6px;
	padding: 4px 4px 4px 14px;
	background: var(--paper);
	border-radius: 15px;
	box-shadow: var(--shadow);
	white-space: nowrap;
	animation: open 0.22s var(--ease);
}
.following .who {
	font-weight: 500;
}
.following .tool {
	padding: 4px 10px;
	color: var(--soft);
}
.following .tool:hover {
	background: var(--slot);
}

/* bottom right: hints, like the game's status corner */
.hints {
	position: fixed;
	right: 22px;
	bottom: max(18px, env(safe-area-inset-bottom));
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 2px;
	font-size: 13px;
	pointer-events: none;
}
.hints .keys {
	opacity: 0.6;
}
.hints #loading {
	opacity: 0.6;
	font-variant-numeric: tabular-nums;
}
.keys.touch {
	display: none;
}
@media (pointer: coarse) {
	.keys.mouse {
		display: none;
	}
	.keys.touch {
		display: inline;
	}
}

.error {
	position: fixed;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	max-width: min(380px, calc(100vw - 32px));
	padding: 16px 20px;
	background: var(--paper-solid);
	border-radius: 12px;
	box-shadow: var(--shadow);
	text-align: center;
}

@media (max-width: 720px) {
	.readout .layer {
		font-size: 24px;
		margin-top: 6px;
	}
	.hints {
		display: none;
	}
	.panel {
		right: 16px;
		width: auto;
	}
	/* the walkers panel spans the bottom here; sit under the readout instead */
	.following {
		bottom: auto;
		top: calc(max(14px, env(safe-area-inset-top)) + 150px);
	}
	#walker-body {
		max-height: 32vh;
	}
	.sheet {
		right: 16px;
		width: auto;
	}
}

/* phones: the corners and the readout would touch; drop the readout a row */
@media (max-width: 480px) {
	.readout {
		top: calc(max(14px, env(safe-area-inset-top)) + 38px);
	}
}

@media (prefers-reduced-motion: reduce) {
	*,
	*::before,
	*::after {
		animation: none !important;
		transition: none !important;
	}
}
.report-review { position: fixed; left: 16px; bottom: 54px; z-index: 20; max-width: min(460px, calc(100vw - 32px)); padding: 14px 16px; border-radius: 14px; background: #f5f5f3; color: #3c3c3e; box-shadow: 0 4px 20px #0002; font-size: 14px; }
.report-review p { margin: 0 0 10px; }
.report-review .report-note { font-size: 12px; color: #5f5f66; line-height: 1.4; }
.report-review div { display: flex; flex-wrap: wrap; gap: 6px; }
.report-review .tool { position: static; display: inline-flex; font-size: 12px; color: #3c3c3e; background: #e4e4e2; }
