:root {
	font-family:
		Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
		sans-serif;
	color: #f7f0dc;
	background: #090b12;
	font-synthesis: none;
}

* {
	box-sizing: border-box;
}

html,
body {
	min-height: 100%;
	margin: 0;
	background:
		radial-gradient(circle at 50% -10%, rgb(91 72 32 / 38%), transparent 42rem),
		#090b12;
}

button {
	font: inherit;
}

.shell {
	display: grid;
	grid-template-rows: auto minmax(0, 1fr) auto;
	width: 100%;
	min-height: 100dvh;
}

.topbar,
.controls {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	padding: max(0.75rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right))
		0.75rem max(1rem, env(safe-area-inset-left));
	border-color: rgb(214 184 103 / 20%);
	background: rgb(9 11 18 / 90%);
	backdrop-filter: blur(16px);
}

.topbar {
	border-bottom: 1px solid rgb(214 184 103 / 20%);
}

.topbar h1,
.privacy h2,
dialog h2 {
	margin: 0;
	font-family: Georgia, "Times New Roman", serif;
	font-weight: 600;
	letter-spacing: 0.02em;
}

.topbar h1 {
	font-size: clamp(1.3rem, 4vw, 1.8rem);
	color: #e1c574;
}

.eyebrow,
.label {
	margin: 0 0 0.15rem;
	color: #a9a69c;
	font-size: 0.68rem;
	font-weight: 700;
	letter-spacing: 0.14em;
	text-transform: uppercase;
}

.connection {
	padding: 0.45rem 0.7rem;
	border: 1px solid #4e4b42;
	border-radius: 999px;
	color: #c9c6bb;
	font-size: 0.78rem;
}

.connection[data-state="online"] {
	border-color: #4f8e69;
	color: #9fe0b6;
}

.connection[data-state="error"] {
	border-color: #9b4d4d;
	color: #ffb1aa;
}

.stage {
	position: relative;
	display: grid;
	min-height: 20rem;
	overflow: hidden;
	overscroll-behavior: contain;
	background: #020306;
}

.privacy,
.game-frame {
	grid-area: 1 / 1;
	width: 100%;
	height: 100%;
	min-height: 0;
}

.privacy {
	z-index: 2;
	display: grid;
	align-content: center;
	justify-items: center;
	padding: 2rem;
	text-align: center;
	background:
		radial-gradient(circle, rgb(44 47 58 / 42%), transparent 28rem),
		#020306;
}

.privacy[hidden] {
	display: none;
}

.crest {
	display: grid;
	place-items: center;
	width: 5rem;
	aspect-ratio: 1;
	margin-bottom: 1.25rem;
	border: 1px solid rgb(225 197 116 / 45%);
	border-radius: 50%;
	color: #e1c574;
	font-family: Georgia, "Times New Roman", serif;
	font-size: 1.5rem;
	box-shadow: 0 0 3rem rgb(225 197 116 / 12%);
}

.privacy h2 {
	font-size: clamp(1.35rem, 5vw, 2rem);
}

.privacy p {
	max-width: 34rem;
	margin: 0.75rem 0 0;
	color: #aaa89f;
	line-height: 1.55;
}

.privacy-login {
	margin-top: 1.25rem;
}

.game-frame {
	display: none;
	border: 0;
	background: #000;
}

.game-frame[data-visible="true"] {
	display: block;
	touch-action: none;
}

.controls {
	align-items: flex-end;
	padding-top: 0.85rem;
	padding-bottom: max(0.85rem, env(safe-area-inset-bottom));
	border-top: 1px solid rgb(214 184 103 / 20%);
}

.identity {
	display: flex;
	align-items: center;
	gap: 0.65rem;
	min-width: 8rem;
}

.colour-dot {
	width: 0.8rem;
	height: 0.8rem;
	border: 2px solid rgb(255 255 255 / 36%);
	border-radius: 50%;
	background: #555;
	box-shadow: 0 0 0.8rem currentcolor;
}

.value,
.status {
	margin: 0;
}

.value {
	font-weight: 700;
}

.status {
	max-width: 25rem;
	color: #aaa89f;
	font-size: 0.78rem;
	text-align: right;
}

.actions {
	display: flex;
	justify-content: center;
	gap: 0.6rem;
}

.mobile-inputs {
	display: none;
}

.mobile-inputs[hidden] {
	display: none;
}

.admin-actions {
	display: flex;
	align-items: flex-end;
	justify-content: center;
	gap: 0.6rem;
}

.admin-actions[hidden] {
	display: none;
}

.battle-status {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 0.75rem;
	padding: 0.55rem 0.75rem;
	border: 1px solid rgb(225 197 116 / 30%);
	border-radius: 0.65rem;
	background: rgb(225 197 116 / 8%);
}

.battle-status[hidden] {
	display: none;
}

.battle-status .value {
	max-width: 22rem;
	font-size: 0.82rem;
}

.admin-actions label {
	display: grid;
	gap: 0.25rem;
}

.admin-actions select {
	min-height: 2.75rem;
	padding: 0.55rem;
	border: 1px solid #4c5362;
	border-radius: 0.5rem;
	color: #fff;
	background: #0e1118;
}

.button {
	min-height: 2.75rem;
	padding: 0.7rem 1rem;
	border: 1px solid transparent;
	border-radius: 0.55rem;
	color: #fff;
	font-weight: 750;
	cursor: pointer;
	touch-action: manipulation;
}

.button:disabled {
	cursor: wait;
	opacity: 0.55;
}

.button-primary {
	border-color: #b99c50;
	background: linear-gradient(#9a7934, #694d1e);
}

.button-danger {
	border-color: #9c5147;
	background: linear-gradient(#853f37, #57251f);
}

.button-secondary {
	border-color: #4c5362;
	background: #252a35;
}

dialog {
	max-width: min(30rem, calc(100% - 2rem));
	padding: 1.3rem;
	border: 1px solid #8e7642;
	border-radius: 0.8rem;
	color: #f7f0dc;
	background: #171a22;
	box-shadow: 0 1.5rem 5rem rgb(0 0 0 / 65%);
}

dialog::backdrop {
	background: rgb(0 0 0 / 78%);
	backdrop-filter: blur(5px);
}

dialog p:not(.eyebrow) {
	color: #bdb9ac;
	line-height: 1.5;
}

.field {
	display: grid;
	gap: 0.4rem;
	margin-top: 1rem;
	color: #c9c6bb;
	font-size: 0.8rem;
	font-weight: 700;
}

.field input {
	width: 100%;
	min-height: 2.8rem;
	padding: 0.65rem 0.75rem;
	border: 1px solid #4c5362;
	border-radius: 0.5rem;
	color: #fff;
	background: #0e1118;
	font: inherit;
}

.field input:focus {
	border-color: #d7b968;
	outline: 2px solid rgb(215 185 104 / 24%);
}

.form-error {
	min-height: 1.2rem;
	margin: 0.7rem 0 0;
	color: #ffb1aa;
	font-size: 0.8rem;
}

.dialog-actions {
	display: flex;
	justify-content: flex-end;
	gap: 0.65rem;
	margin-top: 1.2rem;
}

@media (orientation: portrait), (max-width: 760px), (pointer: coarse) {
	.shell {
		grid-template-rows: auto minmax(18rem, 1fr) auto;
	}

	.controls {
		display: grid;
		grid-template-columns: 1fr;
		align-items: stretch;
	}

	.actions {
		grid-row: 1;
	}

	.mobile-inputs {
		display: grid;
		grid-row: 2;
		grid-template-columns: repeat(4, minmax(0, 1fr));
		gap: 0.5rem;
	}

	.mobile-inputs .button {
		min-width: 0;
		padding-inline: 0.55rem;
	}

	.admin-actions {
		grid-row: 3;
		flex-wrap: wrap;
	}

	.battle-status {
		grid-row: 3;
		justify-content: space-between;
	}

	.actions .button {
		flex: 1;
	}

	.identity {
		grid-row: 4;
	}

	.status {
		grid-row: 5;
		max-width: none;
		text-align: left;
	}
}

@media (max-width: 30rem) {
	.mobile-inputs {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}
