:root {
	--bg: #07090d;
	--panel: rgba(20, 25, 34, 0.82);
	--panel-solid: #141922;
	--panel-light: #1d2430;
	--outline: rgba(78, 92, 116, 0.35);
	--outline-strong: rgba(78, 92, 116, 0.55);
	--accent: #4f8cff;
	--accent-dim: #2b5baf;
	--text: #e8ecf2;
	--text-dim: #9aa4b2;
	--text-faint: #5b6472;
	--green: #5fd068;
	--red: #ef5350;
	--radius: 14px;
	--radius-sm: 10px;
	--sidebar-w: 76px;
	--dock-h: 84px;
	font-family: "Segoe UI", "Noto Sans", sans-serif;
}

* { box-sizing: border-box; user-select: none; }

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

button, input, select {
	font-family: inherit;
	color: inherit;
}

::selection { background: rgba(79, 140, 255, 0.25); color: #fff; }

::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--panel-light); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent-dim); }

/* ---------- animated background ---------- */

.bg {
	position: fixed;
	inset: 0;
	z-index: 0;
	background:
		radial-gradient(1200px 500px at 70% -10%, rgba(79, 140, 255, 0.16), transparent 60%),
		radial-gradient(900px 500px at 10% 110%, rgba(43, 91, 175, 0.18), transparent 60%),
		linear-gradient(165deg, #0a0e15 0%, #0b1220 55%, #070a10 100%);
	overflow: hidden;
}

.bg-glow {
	position: absolute;
	left: 60%;
	top: 30%;
	width: 560px;
	height: 240px;
	transform: translate(-50%, -50%);
	background: radial-gradient(closest-side, rgba(79, 140, 255, 0.14), transparent);
	animation: pulse 5s ease-in-out infinite;
}

.bg-block {
	position: absolute;
	width: 18px;
	height: 18px;
	background: rgba(79, 140, 255, 0.10);
	border: 1px solid rgba(79, 140, 255, 0.16);
	border-radius: 3px;
	animation: float 14s linear infinite;
}

.b1 { left: 12%; animation-delay: 0s; }
.b2 { left: 28%; width: 12px; height: 12px; animation-delay: -4s; animation-duration: 18s; }
.b3 { left: 55%; animation-delay: -9s; }
.b4 { left: 74%; width: 26px; height: 26px; animation-delay: -2s; animation-duration: 20s; }
.b5 { left: 88%; width: 10px; height: 10px; animation-delay: -12s; animation-duration: 16s; }

@keyframes float {
	from { top: 105%; transform: rotate(0deg); }
	to { top: -6%; transform: rotate(200deg); }
}

@keyframes pulse {
	0%, 100% { opacity: 0.7; }
	50% { opacity: 1; }
}

/* ---------- App shell ---------- */

#launcher {
	position: fixed;
	inset: 0;
	z-index: 1;
	display: flex;
	flex-direction: column;
}

.shell-body {
	flex: 1;
	display: flex;
	min-height: 0;
}

/* ---------- Sidebar ---------- */

#sidebar {
	width: var(--sidebar-w);
	flex: 0 0 auto;
	display: flex;
	flex-direction: column;
	align-items: center;
	padding: 18px 0;
	border-right: 1px solid var(--outline);
	background: rgba(20, 25, 34, 0.45);
	backdrop-filter: blur(6px);
}

.logo-mark {
	width: 40px;
	height: 40px;
	border-radius: 9px;
	overflow: hidden;
	margin-bottom: 28px;
	flex-shrink: 0;
	border: 1px solid var(--outline);
}

.logo-mark img { width: 100%; height: 100%; display: block; object-fit: cover; }

.nav-group {
	display: flex;
	flex-direction: column;
	gap: 6px;
	flex: 1;
}

.nav-btn {
	position: relative;
	width: 46px;
	height: 46px;
	border-radius: var(--radius-sm);
	border: none;
	background: transparent;
	color: var(--text-dim);
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	transition: background 0.15s ease, color 0.15s ease;
}

.nav-btn svg { width: 20px; height: 20px; }

.nav-btn:hover { background: var(--panel-light); color: var(--text); }

.nav-btn.active { background: rgba(79, 140, 255, 0.14); color: var(--accent); }

.nav-btn.active::before {
	content: "";
	position: absolute;
	left: -12px;
	width: 3px;
	height: 20px;
	border-radius: 3px;
	background: var(--accent);
}

.nav-btn .tooltip {
	position: absolute;
	left: 58px;
	top: 50%;
	transform: translateY(-50%);
	background: var(--panel-solid);
	border: 1px solid var(--outline-strong);
	padding: 5px 10px;
	border-radius: 8px;
	font-size: 12px;
	white-space: nowrap;
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.12s ease;
	z-index: 20;
}

.nav-btn:hover .tooltip { opacity: 1; }

.version-tag {
	writing-mode: vertical-rl;
	text-orientation: mixed;
	font-size: 10px;
	letter-spacing: 0.08em;
	color: var(--text-faint);
	margin-top: 8px;
}

/* ---------- Main content ---------- */

#content {
	flex: 1;
	display: flex;
	flex-direction: column;
	min-width: 0;
	padding: 40px 56px 24px;
	overflow-y: auto;
}

.view { display: none; max-width: 760px; width: 100%; margin: 0 auto; }
.view.active { display: block; animation: fadein 0.18s ease; }

@keyframes fadein {
	from { opacity: 0; transform: translateY(4px); }
	to { opacity: 1; transform: translateY(0); }
}

.view-header { margin-bottom: 28px; }
.view-header h1 { font-size: 22px; margin: 0 0 6px; font-weight: 700; letter-spacing: 0.5px; }
.view-header p { margin: 0; color: var(--text-dim); font-size: 13.5px; }

/* ---------- Home ---------- */

.hero {
	border: 1px solid var(--outline);
	background: var(--panel);
	backdrop-filter: blur(6px);
	border-radius: 20px;
	padding: 48px 40px;
	text-align: center;
	margin-bottom: 24px;
}

.hero .wordmark {
	font-size: 40px;
	font-weight: 800;
	letter-spacing: 8px;
	padding-left: 8px;
	margin: 0 0 10px;
	color: #fff;
	text-shadow: 0 0 34px rgba(79, 140, 255, 0.45);
}

.hero .tagline {
	color: var(--text-dim);
	font-size: 14px;
	margin: 0 0 28px;
}

.play-btn {
	appearance: none;
	border: none;
	cursor: pointer;
	padding: 14px 44px;
	border-radius: 999px;
	font-size: 15px;
	font-weight: 800;
	letter-spacing: 2px;
	color: #fff;
	background: linear-gradient(180deg, #5d97ff, #3c78e8);
	box-shadow: 0 6px 26px rgba(79, 140, 255, 0.35);
	transition: transform 0.06s ease, box-shadow 0.15s ease, filter 0.15s ease;
}

.play-btn:hover { filter: brightness(1.08); box-shadow: 0 8px 32px rgba(79, 140, 255, 0.5); }
.play-btn:active { transform: scale(0.98); }

.stat-row { display: flex; gap: 12px; }

.stat-card {
	flex: 1;
	border: 1px solid var(--outline);
	background: var(--panel);
	border-radius: var(--radius);
	padding: 16px 18px;
}

.stat-card .num { font-size: 20px; font-weight: 700; }
.stat-card .label { font-size: 12px; color: var(--text-dim); margin-top: 2px; }

/* ---------- Servers ---------- */

.server-card {
	display: flex;
	align-items: center;
	gap: 14px;
	padding: 14px 16px;
	border: 1px solid var(--outline);
	background: var(--panel);
	border-radius: var(--radius);
	margin-bottom: 10px;
	cursor: pointer;
	transition: background 0.12s ease, border-color 0.12s ease;
}

.server-card:hover { background: var(--panel-light); border-color: var(--outline-strong); }

.server-icon {
	width: 42px;
	height: 42px;
	border-radius: 10px;
	background: linear-gradient(180deg, #5d97ff, #3c78e8);
	display: flex;
	align-items: center;
	justify-content: center;
	font-weight: 700;
	flex-shrink: 0;
	color: #fff;
}

.server-info { flex: 1; min-width: 0; }
.server-name { font-size: 14px; font-weight: 600; }
.server-addr { font-size: 12px; color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.server-actions { display: flex; gap: 6px; opacity: 0; transition: opacity 0.12s ease; }
.server-card:hover .server-actions { opacity: 1; }

.icon-btn {
	width: 32px;
	height: 32px;
	border-radius: 8px;
	border: 1px solid var(--outline);
	background: var(--panel-solid);
	color: var(--text-dim);
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
}

.icon-btn:hover { color: var(--text); border-color: var(--outline-strong); }
.icon-btn.danger:hover { color: var(--red); border-color: var(--red); }
.icon-btn svg { width: 15px; height: 15px; }

.empty-state {
	text-align: center;
	padding: 40px 20px;
	color: var(--text-dim);
	font-size: 13.5px;
	border: 1px dashed var(--outline);
	border-radius: var(--radius);
}

.add-server-btn {
	width: 100%;
	padding: 12px;
	border-radius: var(--radius);
	border: 1px dashed var(--outline-strong);
	background: transparent;
	color: var(--text-dim);
	cursor: pointer;
	font-size: 13px;
	font-weight: 600;
	margin-top: 6px;
	transition: color 0.12s ease, border-color 0.12s ease;
}

.add-server-btn:hover { color: var(--accent); border-color: var(--accent); }

/* ---------- Forms ---------- */

.form-panel {
	border: 1px solid var(--outline);
	background: var(--panel);
	border-radius: var(--radius);
	padding: 20px;
	margin-bottom: 16px;
}

.field { margin-bottom: 14px; }
.field:last-child { margin-bottom: 0; }

.field label {
	display: block;
	font-size: 12px;
	font-weight: 600;
	color: var(--text-dim);
	margin-bottom: 6px;
	text-transform: uppercase;
	letter-spacing: 0.04em;
}

.field input {
	width: 100%;
	padding: 11px 13px;
	border-radius: var(--radius-sm);
	border: 1px solid var(--outline-strong);
	background: var(--panel-solid);
	font-size: 14px;
	outline: none;
	transition: border-color 0.12s ease;
}

.field input:focus { border-color: var(--accent); }

.form-actions { display: flex; gap: 10px; margin-top: 18px; }

.btn {
	padding: 10px 20px;
	border-radius: var(--radius-sm);
	border: 1px solid var(--outline-strong);
	background: transparent;
	color: var(--text);
	font-size: 13.5px;
	font-weight: 600;
	cursor: pointer;
}

.btn:hover { background: var(--panel-light); }

.btn.primary {
	border: none;
	color: #fff;
	background: linear-gradient(180deg, #5d97ff, #3c78e8);
}

.btn.primary:hover { filter: brightness(1.08); }

/* ---------- Dock (persistent launch bar) ---------- */

.dock {
	flex: 0 0 auto;
	z-index: 2;
	display: grid;
	grid-template-columns: 1fr auto 1fr;
	align-items: center;
	gap: 16px;
	background: var(--panel);
	border-top: 1px solid var(--outline);
	backdrop-filter: blur(10px);
	padding: 14px 24px;
}

.dock-left, .dock-right {
	display: flex;
	flex-direction: column;
	gap: 5px;
	min-width: 210px;
}

.dock-right { align-items: flex-end; }

.dock-label {
	font-size: 10px;
	letter-spacing: 2px;
	color: var(--text-dim);
}

.dock-select {
	background: var(--panel-solid);
	color: var(--text);
	border: 1px solid var(--outline);
	border-radius: 10px;
	padding: 9px 12px;
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
	min-width: 210px;
}

.dock-select:focus { outline: none; border-color: var(--accent); }

.launch {
	justify-self: center;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 2px;
	min-width: 220px;
	padding: 12px 40px;
	border: none;
	border-radius: 999px;
	background: linear-gradient(180deg, #5d97ff, #3c78e8);
	color: #fff;
	cursor: pointer;
	box-shadow: 0 6px 26px rgba(79, 140, 255, 0.35);
	transition: transform 0.06s, box-shadow 0.15s, filter 0.15s;
}

.launch:hover { filter: brightness(1.08); box-shadow: 0 8px 32px rgba(79, 140, 255, 0.5); }
.launch:active { transform: scale(0.98); }

.launch-label { font-size: 18px; font-weight: 800; letter-spacing: 5px; }
.launch-sub { font-size: 11px; opacity: 0.85; }

/* ---------- Game container ---------- */

#game_frame {
	position: fixed;
	inset: 0;
	display: none;
	background: #000;
	z-index: 50;
}

#game_frame.active { display: block; }

#back-to-launcher {
	position: fixed;
	top: 12px;
	left: 12px;
	z-index: 60;
	padding: 6px 12px;
	font-size: 11px;
	border-radius: 999px;
	border: 1px solid var(--outline-strong);
	background: rgba(7, 9, 13, 0.75);
	color: var(--text-dim);
	cursor: pointer;
	display: none;
}

#back-to-launcher.active { display: block; }

/* ---------- Toast ---------- */

#toast {
	position: fixed;
	bottom: calc(var(--dock-h) + 20px);
	left: 50%;
	transform: translateX(-50%) translateY(10px);
	background: var(--panel-solid);
	border: 1px solid var(--outline-strong);
	padding: 10px 18px;
	border-radius: 999px;
	font-size: 12.5px;
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.2s ease, transform 0.2s ease;
	z-index: 100;
}

#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
