:root {
	color-scheme: dark;
	--page-bg: #10151d;
	--panel: #17202b;
	--panel-2: #1c2836;
	--line: #2c3a4c;
	--text: #f3f7fb;
	--muted: #9aa8b8;
	--accent: #00e701;
	--sidebar-width: 260px;
	--topbar-height: 62px;
	--mobile-topbar-height: 60px;
	--mobile-footer-height: 68px;
}

* {
	box-sizing: border-box;
}

html,
body {
	width: 100%;
	height: 100%;
	margin: 0;
	overflow-x: hidden;
	background: var(--page-bg);
	color: var(--text);
	font-family:
		Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
	font: inherit;
}

.app-shell {
	display: grid;
	grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
	min-height: 100vh;
}

.sidebar {
	background: #111923;
	border-right: 1px solid var(--line);
	padding: 18px 14px;
}

.brand {
	height: 40px;
	display: flex;
	align-items: center;
	padding: 0 10px;
	color: var(--accent);
	font-size: 22px;
	font-weight: 800;
}

.nav-list {
	display: grid;
	gap: 6px;
	margin-top: 18px;
	color: var(--muted);
}

.nav-list span {
	padding: 11px 10px;
	border-radius: 6px;
	background: rgba(255, 255, 255, 0.03);
}

.main {
	min-width: 0;
	display: grid;
	grid-template-rows: var(--topbar-height) minmax(0, 1fr);
}

.topbar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	min-width: 0;
	padding: 9px 14px;
	background: var(--panel);
	border-bottom: 1px solid var(--line);
}

.url-field {
	min-width: 0;
	flex: 1 1 360px;
	display: grid;
	grid-template-columns: auto minmax(140px, 1fr) auto;
	align-items: center;
	gap: 8px;
	color: var(--muted);
}

input,
select {
	height: 36px;
	border: 1px solid var(--line);
	border-radius: 6px;
	background: #0f1721;
	color: var(--text);
	padding: 0 10px;
}

button {
	height: 36px;
	border: 0;
	border-radius: 6px;
	background: #2f4553;
	color: var(--text);
	padding: 0 14px;
	cursor: pointer;
}

button:hover {
	background: #3a5364;
}

.topbar-actions {
	display: flex;
	flex: 0 1 auto;
	min-width: 0;
	gap: 8px;
}

.content {
	min-width: 0;
	min-height: 0;
	display: grid;
	grid-template-rows: minmax(0, 1fr);
	background: #0f141c;
}

.toolbar {
	display: flex;
	align-items: center;
	gap: 8px;
	flex: 1 1 auto;
	flex-wrap: wrap;
	min-width: 0;
	padding: 0;
	background: transparent;
	border-bottom: 0;
	color: var(--muted);
}

.toolbar label {
	display: flex;
	align-items: center;
	gap: 8px;
}

.toolbar input[type="number"] {
	width: 82px;
}

.toolbar .toggle input {
	width: 16px;
	height: 16px;
}

.readout {
	margin-left: 4px;
	color: var(--text);
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
}

.status {
	min-width: 72px;
	color: var(--muted);
	font-size: 13px;
	text-align: right;
}

.game-stage {
	min-width: 0;
	min-height: 0;
	display: grid;
	place-items: center;
	padding: 8px;
	overflow: auto;
	background:
		linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
		linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px),
		#0b1017;
	background-size: 32px 32px;
}

.game-frame {
	width: min(100%, 1200px);
	aspect-ratio: 16 / 9;
	background: #000;
	box-shadow: 0 18px 60px rgba(0, 0, 0, 0.45);
	outline: 1px solid rgba(255, 255, 255, 0.12);
}

.game-frame iframe {
	display: block;
	width: 100%;
	height: 100%;
	border: 0;
	background: #000;
}

.game-frame:fullscreen {
	width: 100vw !important;
	height: 100vh !important;
	aspect-ratio: auto !important;
	box-shadow: none;
	outline: 0;
}

@media (max-width: 860px) {
	html,
	body {
		overflow: hidden;
	}

	.app-shell {
		grid-template-columns: 1fr;
		height: 100dvh;
		min-height: 100dvh;
	}

	.sidebar {
		display: none;
	}

	.main {
		height: 100dvh;
		grid-template-rows: var(--mobile-topbar-height) minmax(0, 1fr);
	}

	.topbar {
		position: sticky;
		top: 0;
		z-index: 20;
		height: var(--mobile-topbar-height);
		display: grid;
		grid-template-columns: auto minmax(0, 1fr);
		align-items: center;
		gap: 10px;
		padding: 8px 10px;
	}

	.topbar::before {
		content: "Stake";
		color: var(--accent);
		font-size: 20px;
		font-weight: 800;
		line-height: 1;
	}

	.url-field {
		grid-template-columns: minmax(0, 1fr) auto;
		gap: 8px;
	}

	.url-field label {
		display: none;
	}

	.url-field input,
	.url-field button,
	.topbar-actions button,
	.toolbar input,
	.toolbar select {
		height: 36px;
	}

	.url-field button,
	.topbar-actions button {
		padding: 0 10px;
	}

	.topbar-actions {
		display: none;
	}

	.content {
		min-height: 0;
		grid-template-rows: minmax(0, 1fr);
		padding-bottom: var(--mobile-footer-height);
	}

	.toolbar {
		position: fixed;
		left: 0;
		right: 0;
		bottom: 0;
		z-index: 20;
		height: var(--mobile-footer-height);
		flex-wrap: nowrap;
		gap: 10px;
		padding: 9px 10px;
		overflow-x: auto;
		overflow-y: hidden;
		white-space: nowrap;
		background: var(--panel-2);
		border-top: 1px solid var(--line);
		border-bottom: 0;
		-webkit-overflow-scrolling: touch;
	}

	.toolbar label {
		flex: 0 0 auto;
	}

	.toolbar input[type="number"] {
		width: 78px;
	}

	.game-stage {
		padding: 12px;
		overflow: hidden;
	}

	.game-frame {
		aspect-ratio: auto;
		box-shadow: none;
		outline: 0;
	}

	.readout {
		flex: 0 0 auto;
		margin-left: 0;
		font-size: 13px;
	}

	.status {
		flex: 0 0 auto;
		min-width: 56px;
	}
}
