:root {
	--bg: #0b0907;
	--panel: rgba(24, 18, 12, 0.92);
	--panel-border: #6b5428;
	--gold: #e3c27a;
	--gold-strong: #f5d98e;
	--text: #efe6d2;
	--muted: #b3a68b;
	--good: #8fc27a;
	--bad: #e07a6a;
	--focus: #ffe6a6;
	font-family: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
	color: var(--text);
	background: var(--bg);
}

* { box-sizing: border-box; }

html, body {
	margin: 0;
	height: 100%;
	overflow: hidden;
	background: var(--bg);
}

#canvas {
	position: fixed;
	inset: 0;
	width: 100vw;
	height: 100vh;
	height: 100dvh;
	display: block;
	outline: none;
	background: #000;
	/* game handles all touches and right clicks itself */
	touch-action: none;
	user-select: none;
	-webkit-user-select: none;
	image-rendering: auto;
}

.overlay {
	position: fixed;
	inset: 0;
	display: grid;
	place-items: center;
	padding: 16px;
	background:
		radial-gradient(ellipse at 50% 30%, rgba(120, 84, 30, 0.35), transparent 60%),
		linear-gradient(180deg, #120d08, #050403);
	z-index: 10;
	overflow-y: auto;
}

.overlay[hidden] { display: none; }

.panel {
	width: min(640px, 100%);
	padding: 32px clamp(20px, 5vw, 40px);
	background: var(--panel);
	border: 1px solid var(--panel-border);
	border-radius: 6px;
	box-shadow: 0 0 0 1px #000, 0 24px 80px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 220, 150, 0.08);
}

.brand { text-align: center; margin-bottom: 24px; }

.brand h1 {
	margin: 0;
	font-size: clamp(1.6rem, 4.5vw, 2.3rem);
	font-weight: 600;
	letter-spacing: 0.02em;
	color: var(--gold-strong);
	text-shadow: 0 2px 0 #000, 0 0 24px rgba(227, 194, 122, 0.25);
}

.brand h1 span { font-size: 0.7em; color: var(--gold); }

.subtitle { margin: 8px 0 0; color: var(--muted); font-style: italic; }

h2 { margin: 0 0 12px; font-size: 1.25rem; color: var(--gold); font-weight: 600; }

p { line-height: 1.5; }

code {
	font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
	font-size: 0.85em;
	background: rgba(0, 0, 0, 0.35);
	padding: 1px 5px;
	border-radius: 3px;
	overflow-wrap: anywhere;
}

.screen[hidden] { display: none; }

.hint { color: var(--muted); font-size: 0.92rem; }

.error { color: var(--bad); }

.checklist { list-style: none; padding: 0; margin: 0 0 20px; }
.checklist li { padding: 6px 0 6px 28px; position: relative; }
.checklist li::before {
	position: absolute;
	left: 4px;
	font-weight: bold;
}
.checklist li.ok::before { content: "\2713"; color: var(--good); }
.checklist li.missing::before { content: "\2715"; color: var(--bad); }
.checklist li.optional::before { content: "\2013"; color: var(--muted); }
.checklist.bad li::before { content: "\2715"; color: var(--bad); }

.actions {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
	justify-content: center;
	margin-top: 20px;
}

button, .button {
	font: inherit;
	cursor: pointer;
	border-radius: 4px;
	padding: 10px 22px;
	min-height: 44px;
	border: 1px solid var(--panel-border);
	color: var(--text);
	background: linear-gradient(180deg, #3a2c18, #241a0d);
	transition: transform 120ms ease-out, filter 120ms ease-out;
}

/* links that look like buttons */
.button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	text-decoration: none;
}
.button[hidden] { display: none; }

button:hover, .button:hover { filter: brightness(1.15); }
button:active, .button:active { transform: scale(0.97); }
button:focus-visible, .button:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
button:disabled { opacity: 0.5; cursor: default; filter: none; transform: none; }

button.primary, .button.primary {
	min-width: 180px;
	font-size: 1.2rem;
	color: #1a1205;
	font-weight: 600;
	border-color: #f2d48c;
	background: linear-gradient(180deg, #f2d48c, #b98d3a);
	box-shadow: 0 0 24px rgba(227, 194, 122, 0.25);
}

button.danger { border-color: #7a3328; background: linear-gradient(180deg, #4a1d16, #2c100c); }

.dropzone {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 4px;
	padding: 28px 16px;
	margin: 16px 0;
	border: 2px dashed var(--panel-border);
	border-radius: 6px;
	cursor: pointer;
	text-align: center;
	transition: background 120ms ease-out, border-color 120ms ease-out;
}

.dropzone strong { color: var(--gold-strong); font-size: 1.1rem; }
.dropzone span { color: var(--muted); }
.dropzone:hover, .dropzone.dragging { background: rgba(227, 194, 122, 0.08); border-color: var(--gold); }
.dropzone.disabled { pointer-events: none; opacity: 0.5; }

.progress .bar {
	height: 10px;
	background: rgba(0, 0, 0, 0.5);
	border: 1px solid var(--panel-border);
	border-radius: 5px;
	overflow: hidden;
	margin-top: 16px;
}

.progress .bar > div {
	height: 100%;
	width: 0;
	background: linear-gradient(90deg, #b98d3a, #f2d48c);
	transition: width 150ms linear;
}

.spinner {
	width: 44px;
	height: 44px;
	margin: 8px auto 16px;
	border: 3px solid rgba(227, 194, 122, 0.2);
	border-top-color: var(--gold);
	border-radius: 50%;
	animation: spin 0.9s linear infinite;
}

#screen-loading { text-align: center; }

@keyframes spin { to { transform: rotate(360deg); } }

.log {
	max-height: 200px;
	overflow: auto;
	font-size: 0.75rem;
	background: rgba(0, 0, 0, 0.5);
	padding: 8px;
	border-radius: 4px;
	white-space: pre-wrap;
	overflow-wrap: anywhere;
}

.corner-button {
	position: fixed;
	top: 8px;
	right: 8px;
	z-index: 5;
	width: 36px;
	height: 36px;
	min-height: 0;
	padding: 6px;
	opacity: 0;
	background: rgba(20, 14, 8, 0.75);
	transition: opacity 200ms ease-out;
}

.corner-button:hover, .corner-button:focus-visible { opacity: 1; }
.corner-button svg { width: 100%; height: 100%; fill: none; stroke: var(--gold); stroke-width: 2; }

@media (prefers-reduced-motion: reduce) {
	.spinner { animation-duration: 3s; }
	button, .button, .dropzone, .corner-button { transition: none; }
}
