* {
	margin: 0;
	padding: 0;
	box-sizing: border-box;
}

html {
	-webkit-text-size-adjust: 100%;
}

body {
	font-family: 'Segoe UI', Tahoma, sans-serif;
	background: radial-gradient(circle at top, #1b2735 0%, #090a0f 100%);
	color: #e6e6e6;
	min-height: 100vh;
	padding: 40px 20px;
	padding-left: max(20px, env(safe-area-inset-left));
	padding-right: max(20px, env(safe-area-inset-right));
	display: flex;
	justify-content: center;
	align-items: flex-start;
	overflow-x: hidden;
	background-image: url(background.jpg);
    background-blend-mode: darken;
    background-color: rgb(0 0 0 / 77%);
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
}

.container {
	/* width: 100%; */
	/* max-width: 960px; */
	position: relative;
}

.header {
	text-align: center;
	margin-bottom: 30px;
}

.header h1 {
	font-size: clamp(1.5rem, 6vw, 2rem);
	font-weight: 600;
	letter-spacing: 1px;
	background: #7859ab;
	/* background: linear-gradient(90deg, #00c6ff, #0072ff); */
	-webkit-background-clip: text;
	-webkit-text-fill-color: transparent;
	background-clip: text;
}

.header .subtitle {
	margin-top: 8px;
	color: #8a94a6;
	font-size: 0.95rem;
}

/* Кнопка "Обновить" */
.refresh-btn {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	margin-top: 16px;
	padding: 10px 18px;
	font-family: inherit;
	font-size: 0.9rem;
	font-weight: 600;
	letter-spacing: 0.3px;
	color: #e6e6e6;
	background: rgba(255, 255, 255, 0.05);
	border: 1px solid rgba(255, 255, 255, 0.12);
	border-radius: 5px;
	cursor: pointer;
	transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.15s ease;
	-webkit-tap-highlight-color: transparent;
}

.refresh-btn:hover:not(:disabled) {
	color: #ffffff;
	background: rgba(120, 89, 171, 0.15);
	border-color: rgba(120, 89, 171, 0.5);
	/* background: rgba(0, 114, 255, 0.15); */
	/* border-color: rgba(0, 114, 255, 0.5); */
}

.refresh-btn:active:not(:disabled) {
	transform: translateY(1px);
}

.refresh-btn:focus-visible {
	outline: 2px solid rgba(120, 89, 171, 0.6);
	/* outline: 2px solid rgba(0, 198, 255, 0.6); */
	outline-offset: 2px;
}

.refresh-btn:disabled {
	cursor: not-allowed;
	color: #8a94a6;
	background: rgba(255, 255, 255, 0.03);
	border-color: rgba(255, 255, 255, 0.08);
}

.refresh-btn__icon {
	flex-shrink: 0;
	color: currentColor;
	transition: transform 0.4s ease;
}

.refresh-btn.is-loading .refresh-btn__icon {
	animation: refresh-spin 0.9s linear infinite;
}

@keyframes refresh-spin {
	from { transform: rotate(0deg); }
	to   { transform: rotate(360deg); }
}

/* Карточка статуса */
.status-card {
	background: rgba(255, 255, 255, 0.04);
	border: 1px solid rgba(255, 255, 255, 0.08);
	border-radius: 16px;
	padding: 24px 28px;
	margin-bottom: 24px;
	backdrop-filter: blur(10px);
	-webkit-backdrop-filter: blur(10px);
	box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
}

.status-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	flex-wrap: wrap;
	gap: 12px;
	margin-bottom: 20px;
}

.status-title {
	min-width: 0;
	flex: 1 1 auto;
}

.status-header .hostname {
	font-size: 1.3rem;
	font-weight: 600;
	color: #ffffff;
	word-break: break-word;
}

.status-header .address {
	font-size: 0.85rem;
	color: #8a94a6;
	margin-top: 4px;
	word-break: break-all;
}

.badge {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 8px 16px;
	border-radius: 999px;
	font-size: 0.85rem;
	font-weight: 600;
	letter-spacing: 0.5px;
	white-space: nowrap;
	flex-shrink: 0;
}

.badge.online {
	background: rgba(0, 200, 83, 0.12);
	color: #00c853;
	border: 1px solid rgba(0, 200, 83, 0.3);
}

.badge.offline {
	background: rgba(255, 59, 48, 0.12);
	color: #ff3b30;
	border: 1px solid rgba(255, 59, 48, 0.3);
}

.badge .dot {
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: currentColor;
	box-shadow: 0 0 10px currentColor;
}

/* ====== Сетка статистики ====== */
/* Десктоп: строго 4 колонки × 2 ряда */
.stats {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 16px;
}

.stat {
	background: rgba(255, 255, 255, 0.03);
	border: 1px solid rgba(255, 255, 255, 0.06);
	border-radius: 12px;
	padding: 16px;
	text-align: center;
	transition: transform 0.2s ease, border-color 0.2s ease;
	min-width: 0;
	overflow: hidden;
}

.stat:hover {
	transform: translateY(-3px);
	border-color: rgba(120, 89, 171, 0.4);
	/* border-color: rgba(0, 114, 255, 0.4); */
}

.stat .label {
	font-size: 0.75rem;
	text-transform: uppercase;
	letter-spacing: 1px;
	color: #8a94a6;
	margin-bottom: 8px;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.stat .value {
	font-size: 1.4rem;
	font-weight: 700;
	color: #ffffff;
	word-break: break-word;
}

.stat .value.accent {
	color: #7859ab;
	/* color: #00c6ff; */
}

/* Таблица игроков */
.players-card {
	background: rgba(255, 255, 255, 0.04);
	border: 1px solid rgba(255, 255, 255, 0.08);
	border-radius: 16px;
	padding: 24px 28px;
	backdrop-filter: blur(10px);
	-webkit-backdrop-filter: blur(10px);
	box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
}

.players-card h2 {
	font-size: 1.1rem;
	font-weight: 600;
	margin-bottom: 16px;
	color: #ffffff;
	display: flex;
	align-items: center;
	gap: 10px;
	flex-wrap: wrap;
}

.players-card h2 .count {
	font-size: 0.8rem;
	color: #8a94a6;
	font-weight: 400;
}

/* Горизонтальный скролл для таблицы на узких экранах */
.table-wrap {
	width: 100%;
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
}

.table-wrap::-webkit-scrollbar {
	height: 6px;
}

.table-wrap::-webkit-scrollbar-thumb {
	background: rgba(255, 255, 255, 0.15);
	border-radius: 3px;
}

table {
	width: 100%;
	border-collapse: collapse;
	min-width: 320px;
}

thead th {
	text-align: left;
	font-size: 0.75rem;
	text-transform: uppercase;
	letter-spacing: 1px;
	color: #8a94a6;
	padding: 10px 12px;
	border-bottom: 1px solid rgba(255, 255, 255, 0.08);
	font-weight: 500;
	white-space: nowrap;
}

tbody td {
	padding: 12px;
	font-size: 0.92rem;
	border-bottom: 1px solid rgba(255, 255, 255, 0.04);
	color: #d0d6e0;
}

tbody tr:last-child td {
	border-bottom: none;
}

tbody tr:hover {
	background: rgba(120, 89, 171, 0.06);
	/* background: rgba(0, 114, 255, 0.06); */
}

.id-col {
	color: #8a94a6;
	width: 50px;
}

.nick {
	color: #ffffff;
	font-weight: 500;
	word-break: break-word;
}

.score {
	color: #7859ab;
	/* color: #00c6ff; */
	font-weight: 600;
	white-space: nowrap;
}

.ping {
	color: #ffb020;
	font-weight: 500;
}

.empty {
	text-align: center;
	padding: 30px;
	color: #8a94a6;
	font-size: 0.9rem;
}

.footer {
	text-align: center;
	margin-top: 24px;
	font-size: 0.8rem;
	color: #5a6376;
	line-height: 1.5;
}

.lang-btn {
	position: absolute;
	top: 12px;
	right: 12px;
	z-index: 10;

	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 42px;
	padding: 6px 12px;
	font-size: 0.85rem;
	font-weight: 600;
	color: #7859ab;
	background: transparent;
	border: 1px solid #7859ab;
	border-radius: 8px;
	text-decoration: none;
	transition: background 0.15s, color 0.15s;
	line-height: 1;
}

.lang-btn:hover {
	background: #7859ab;
	color: #fff;
}

/* ====== Адаптив ====== */

/* Планшеты */
@media (max-width: 900px) {
	body {
		padding: 28px 16px;
		padding-left: max(16px, env(safe-area-inset-left));
		padding-right: max(16px, env(safe-area-inset-right));
	}

	.stats {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 12px;
	}

	.status-card,
	.players-card {
		padding: 20px 22px;
	}
}

/* Телефоны */
@media (max-width: 600px) {
	body {
		padding: 18px 12px;
		padding-left: max(12px, env(safe-area-inset-left));
		padding-right: max(12px, env(safe-area-inset-right));
	}

	.header {
		margin-bottom: 20px;
	}

	.header .subtitle {
		font-size: 0.85rem;
	}

	.refresh-btn {
		margin-top: 12px;
		padding: 9px 16px;
		font-size: 0.85rem;
	}

	.status-card,
	.players-card {
		padding: 16px 16px;
		border-radius: 14px;
		margin-bottom: 16px;
	}

	.status-header {
		align-items: flex-start;
		gap: 10px;
	}

	.status-header .hostname {
		font-size: 1.05rem;
	}

	.badge {
		padding: 6px 12px;
		font-size: 0.75rem;
	}

	.stats {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 10px;
	}

	.stat {
		padding: 12px 10px;
		border-radius: 10px;
	}

	.stat:hover {
		transform: none;
	}

	.stat .label {
		font-size: 0.68rem;
		letter-spacing: 0.5px;
		margin-bottom: 6px;
	}

	.stat .value {
		font-size: 1.1rem;
	}

	.players-card h2 {
		font-size: 1rem;
		margin-bottom: 12px;
	}

	thead th {
		padding: 8px 10px;
		font-size: 0.7rem;
	}

	tbody td {
		padding: 10px;
		font-size: 0.88rem;
	}

	.empty {
		padding: 22px 12px;
	}

	.footer {
		font-size: 0.72rem;
		margin-top: 18px;
	}
	
	.lang-btn {
		top: 8px;
		right: 8px;
		padding: 5px 10px;
		font-size: 0.8rem;
	}
}

/* Очень узкие экраны */
@media (max-width: 380px) {
	.stats {
		grid-template-columns: minmax(0, 1fr);
	}

	.status-header .hostname {
		font-size: 1rem;
	}
}