:root {
	color-scheme: dark;
	font-family: Calibri, "Segoe UI", Arial, sans-serif;
	--page: #211a18;
	--page-soft: #2a211e;
	--panel: #352823;
	--panel-raised: #453530;
	--text: #f4ebe4;
	--muted: #c7b9ae;
	--border: #6b5750;
	--accent: #b28270;
	--accent-strong: #d4aa95;
	--cream: #e6d9cf;
	--danger: #c27373;
	--danger-panel: #4a2929;
	--success: #a9c8af;
	--success-panel: #294033;
	--shadow: 0 1.4rem 3.5rem rgb(10 6 5 / 28%);
	background: var(--page);
	color: var(--text);
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--page); }
body {
	min-height: 100vh;
	margin: 0;
	background:
		radial-gradient(circle at 12% 8%, rgb(144 111 98 / 16%), transparent 28rem),
		radial-gradient(circle at 92% 88%, rgb(107 87 80 / 12%), transparent 32rem),
		linear-gradient(145deg, var(--page), #181210 74%);
	color: var(--text);
}
body::before {
	position: fixed;
	z-index: -1;
	inset: 0;
	background-image: linear-gradient(rgb(230 217 207 / 2.5%) 1px, transparent 1px), linear-gradient(90deg, rgb(230 217 207 / 2.5%) 1px, transparent 1px);
	background-size: 36px 36px;
	content: "";
	mask-image: linear-gradient(to bottom, black, transparent 80%);
}

.site-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 1.5rem;
	min-height: 5.4rem;
	padding: 0.8rem clamp(1rem, 4vw, 3rem);
	border-bottom: 1px solid rgb(212 198 186 / 18%);
	background: rgb(33 26 24 / 88%);
	box-shadow: 0 0.5rem 2rem rgb(0 0 0 / 18%);
	backdrop-filter: blur(18px);
}
.brand { display: inline-flex; align-items: center; gap: 0.8rem; color: var(--text); text-decoration: none; }
.brand img { width: 3.2rem; height: 3.2rem; filter: drop-shadow(0 0.35rem 0.4rem rgb(0 0 0 / 22%)); }
.brand span { display: grid; }
.brand strong { font-size: clamp(1.15rem, 2.5vw, 1.45rem); letter-spacing: 0.01em; line-height: 1; }
.brand small { margin-top: 0.28rem; color: var(--muted); font-size: 0.72rem; letter-spacing: 0.12em; text-transform: uppercase; }
.header-actions { display: flex; align-items: center; justify-content: flex-end; gap: 1rem; }
.environment-badge {
	padding: 0.28rem 0.62rem;
	border: 1px solid var(--border);
	border-radius: 999px;
	background: rgb(69 53 48 / 70%);
	color: var(--muted);
	font-family: Lekton, Consolas, monospace;
	font-size: 0.72rem;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
}
.environment-test { border-color: #a58a54; color: #efd397; }
.environment-prod { border-color: var(--danger); color: #efb0b0; }

nav { display: flex; align-items: center; gap: 0.35rem; flex-wrap: wrap; }
nav a, .link-button {
	padding: 0.55rem 0.7rem;
	border-radius: 0.45rem;
	color: var(--cream);
	font-weight: 700;
	text-decoration: none;
	transition: background 150ms ease, color 150ms ease;
}
nav a:hover, nav a:focus-visible, .link-button:hover, .link-button:focus-visible { background: var(--panel-raised); color: #fff; }
nav form, .inline, .compact-actions form { display: inline; margin: 0; }
.link-button { min-height: auto; border: 0; background: none; }

.page { width: min(1180px, calc(100% - 2rem)); margin: clamp(1.5rem, 4vw, 3.5rem) auto; }
.page-heading { margin-bottom: 1.35rem; }
.page-heading h1 { margin-bottom: 0.35rem; }
.page-heading p { max-width: 46rem; margin: 0; color: var(--muted); }

.card {
	position: relative;
	overflow: hidden;
	padding: clamp(1.25rem, 3vw, 2rem);
	border: 1px solid rgb(199 185 174 / 20%);
	border-radius: 1rem;
	background: linear-gradient(145deg, rgb(69 53 48 / 92%), rgb(53 40 35 / 96%));
	box-shadow: var(--shadow);
}
.card::before {
	position: absolute;
	top: 0;
	left: 1.25rem;
	width: 4rem;
	height: 2px;
	background: var(--accent);
	content: "";
}
.narrow { max-width: 660px; margin-inline: auto; }
.wide { grid-column: 1 / -1; }
.admin-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 1.15rem; }
.auth-card { max-width: 720px; padding: clamp(1.5rem, 5vw, 3rem); }
.auth-brand { display: block; width: min(100%, 31rem); height: auto; margin: 0 auto 2rem; }
.auth-card h1 { margin-bottom: 0.35rem; text-align: center; }
.auth-card > p { max-width: 34rem; margin: 0.5rem auto 1.5rem; color: var(--muted); text-align: center; }
.auth-card form { max-width: 28rem; margin-inline: auto; }
.choice-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.85rem; margin-top: 1.5rem; }
.choice {
	display: grid;
	gap: 0.35rem;
	padding: 1.1rem;
	border: 1px solid var(--border);
	border-radius: 0.75rem;
	background: rgb(33 26 24 / 45%);
	color: var(--text);
	text-decoration: none;
	transition: transform 150ms ease, border-color 150ms ease, background 150ms ease;
}
.choice:hover, .choice:focus-visible { transform: translateY(-2px); border-color: var(--accent-strong); background: var(--panel-raised); }
.choice strong { font-size: 1.05rem; }
.choice span { color: var(--muted); font-size: 0.9rem; }

h1, h2, h3 { color: var(--text); line-height: 1.15; }
h1 { margin-top: 0; font-size: clamp(2rem, 4vw, 3rem); letter-spacing: -0.035em; }
h2 { margin-top: 0; font-size: 1.35rem; }
h3 { margin: 1.25rem 0 0.5rem; color: var(--cream); font-size: 1.05rem; }
p { line-height: 1.55; }
code, .technical, .metadata-list { font-family: Lekton, Consolas, monospace; }

form { display: grid; gap: 0.9rem; margin-block: 1rem; }
label { display: grid; gap: 0.38rem; color: var(--cream); font-weight: 700; }
input, select, button, .button {
	min-height: 2.85rem;
	padding: 0.68rem 0.85rem;
	border: 1px solid var(--border);
	border-radius: 0.5rem;
	font: inherit;
}
input, select {
	width: 100%;
	background: rgb(27 20 18 / 72%);
	color: var(--text);
	outline: none;
	transition: border-color 150ms ease, box-shadow 150ms ease, background 150ms ease;
}
input::placeholder { color: #9f8f87; }
input:focus, select:focus { border-color: var(--accent-strong); background: #211a18; box-shadow: 0 0 0 3px rgb(178 130 112 / 22%); }
button, .button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: fit-content;
	border-color: var(--accent);
	background: linear-gradient(180deg, #b28270, #8f6759);
	box-shadow: 0 0.35rem 0.9rem rgb(0 0 0 / 18%);
	color: #211a18;
	cursor: pointer;
	font-weight: 800;
	text-decoration: none;
	transition: transform 120ms ease, filter 120ms ease, box-shadow 120ms ease;
}
button:hover, .button:hover { transform: translateY(-1px); filter: brightness(1.09); box-shadow: 0 0.5rem 1.1rem rgb(0 0 0 / 24%); }
button:active, .button:active { transform: translateY(0); }
button.secondary, .button.secondary { border-color: var(--border); background: var(--panel-raised); color: var(--text); }
button.danger { border-color: var(--danger); background: var(--danger-panel); color: #ffdada; }
button:disabled { opacity: 0.38; cursor: default; filter: none; transform: none; }
.button-row, .compact-actions { display: flex; gap: 0.55rem; flex-wrap: wrap; }

.selection-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.85rem; margin-block: 1rem; }
.position-field { padding: 0.9rem; border: 1px solid rgb(199 185 174 / 16%); border-radius: 0.65rem; background: rgb(33 26 24 / 38%); }
.position-number { color: var(--accent-strong); font-family: Lekton, Consolas, monospace; font-size: 0.78rem; letter-spacing: 0.08em; text-transform: uppercase; }
.selection-actions { display: flex; justify-content: flex-end; margin-top: 0.25rem; }

.game-list { display: grid; gap: 0.85rem; }
.game-row { padding: 1rem; border: 1px solid rgb(199 185 174 / 18%); border-radius: 0.7rem; background: rgb(33 26 24 / 35%); }
.game-edit { grid-template-columns: minmax(160px, 0.6fr) minmax(260px, 1.4fr) auto; align-items: end; }
.section-intro { margin-top: -0.35rem; color: var(--muted); }

.flash { padding: 0.85rem 1rem; border: 1px solid transparent; border-radius: 0.6rem; box-shadow: 0 0.5rem 1.2rem rgb(0 0 0 / 18%); }
.flash-error { border-color: rgb(194 115 115 / 45%); background: var(--danger-panel); color: #ffc8c8; }
.flash-success { border-color: rgb(169 200 175 / 35%); background: var(--success-panel); color: #c9e7ce; }
.metadata-list { padding-left: 1.25rem; color: var(--muted); font-size: 0.88rem; }
.secret-output { overflow-wrap: anywhere; padding: 1rem; border: 1px solid var(--border); border-radius: 0.5rem; background: var(--page); color: var(--text); }
.empty-state { padding: 1rem; border: 1px dashed var(--border); border-radius: 0.65rem; color: var(--muted); text-align: center; }
.site-footer { padding: 0.5rem 1rem 1.5rem; color: #8f7f77; font-size: 0.78rem; letter-spacing: 0.08em; text-align: center; text-transform: uppercase; }

@media (max-width: 760px) {
	.site-header { align-items: flex-start; flex-direction: column; gap: 0.7rem; }
	.header-actions { width: 100%; align-items: flex-start; justify-content: space-between; }
	nav { justify-content: flex-end; }
	.game-edit, .selection-grid { grid-template-columns: 1fr; }
	.choice-grid { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
	.page { width: min(100% - 1rem, 1180px); margin-block: 1rem; }
	.card { padding: 1.1rem; border-radius: 0.8rem; }
	.brand small { display: none; }
	.header-actions { align-items: stretch; flex-direction: column; }
	nav { justify-content: flex-start; }
}
