@font-face {
	font-family: 'AppFont';
	src: url('/font.ttf') format('truetype');
	font-weight: 100 900;
	font-style: normal;
	font-display: swap;
}

html, body {
	margin: 0;
	padding: 0;
	height: 100%;
	background: #0b0b0b;
	color: #e6e6e6;
	font-family: 'AppFont', sans-serif;
	font-size: 115%;
}
/* Убираем скролл‑чейн/резиновый эффект на мобильных */
html, body { overscroll-behavior: none; }

/* Обеспечиваем единый шрифт и размер во всех полях/кнопках */
input, button, textarea, select { font-family: 'AppFont', sans-serif; font-size: inherit; }
::placeholder { font-family: 'AppFont', sans-serif; }

/* Отключить историю ввода через CSS нельзя — управляется атрибутами HTML. */

/* Глобально отключаем обводку при фокусе у полей ввода и убираем автозаполнение */
input, textarea, select { outline: none; box-shadow: none; }
input:focus, input:focus-visible,
textarea:focus, textarea:focus-visible,
select:focus, select:focus-visible { outline: none !important; box-shadow: none !important; }

/* Скрыть последние введённые значения/историю автозаполнения (где возможно) */
input::-webkit-contacts-auto-fill-button,
input::-webkit-credentials-auto-fill-button,
input::-webkit-calendar-picker-indicator { display: none !important; }
input::-webkit-autofill,
textarea::-webkit-autofill,
select::-webkit-autofill { transition: background-color 99999s ease-in-out 0s; }
input:-webkit-autofill,
textarea:-webkit-autofill,
select:-webkit-autofill { -webkit-text-fill-color: inherit; }

/* Гарантированно скрываем элементы с атрибутом hidden */
[hidden] { display: none !important; }

/* Корректная ширина для элементов с padding/border */
*, *::before, *::after { box-sizing: border-box; }

#canvas {
	position: fixed;
	top: 0;
	left: 0;
	width: 100vw;
	height: 100vh;
	display: block;
	background: #0b0b0b; /* фон вне мира — чёрный */
	cursor: pointer; /* как на ссылке в покое */
	/* отключаем жесты браузера поверх канваса */
	touch-action: none;
}

#canvas.dragging { cursor: grabbing; }

/* removed #hud and .pill styles */

#authButtons {
	position: fixed;
	top: 16px;
	right: 16px;
	display: grid;
	/* первая колонка для админ-кнопки, далее две равные */
	--auth-col-w: 70px;
	grid-template-columns: 44px var(--auth-col-w) var(--auth-col-w);
	column-gap: 8px;
	row-gap: 6px;
	z-index: 20;
}

/* Когда нет админки — две колонки фиксированной ширины */
#authButtons.no-admin {
	grid-template-columns: var(--auth-col-w) var(--auth-col-w);
	row-gap: 6px;
	column-gap: 8px;
}

#onlineBadge {
	position: fixed;
	top: 16px;
	left: 16px;
	z-index: 25;
	pointer-events: none;
	background: rgba(0,0,0,0.45);
	border: 1px solid rgba(255,255,255,0.18);
	border-radius: 999px;
	padding: 4px 10px;
	font-size: 12px;
	backdrop-filter: blur(6px);
	box-shadow: 0 6px 16px rgba(0,0,0,0.25);
	color: #fff;
}

/* Telegram round button under online badge */
#telegramButton.circle-btn {
	position: fixed;
	left: 16px;
	top: 60px; /* ниже бейджа онлайн */
	width: 48px;
	height: 48px;
	border-radius: 50%;
	background: url('/img/telegram.webp') center/cover no-repeat, url('/img/telegram.png') center/cover no-repeat;
	border: 1px solid rgba(255,255,255,0.22);
	box-shadow: 0 6px 16px rgba(0,0,0,0.25);
	display: grid;
	place-items: center;
	z-index: 25;
	cursor: pointer;
}
#telegramButton.circle-btn::before { content: none; }
#telegramButton.circle-btn:hover { filter: brightness(1.05); }
#telegramButton.circle-btn:active { filter: brightness(0.95); }

/* removed #zoomLabel style */

#authButtons .btn {
	font-weight: 400;
	font-size: 12px;
	padding: 10px 14px;
	border-radius: 14px;
	border-width: 1px;
	width: 100%;
	font-family: 'AppFont', sans-serif;
}

/* Admin small square button with letter A */
#authButtons .admin-btn {
	min-width: 44px;
	width: 44px;
	height: 44px;
	padding: 0;
	border-radius: 10px;
	font-weight: 800;
	font-size: 16px;
	letter-spacing: 1px;
}

/* Admin в первой колонке на одной линии с профилем */
#btnAdmin { grid-column: 1; grid-row: 1; }
#btnLogin { grid-column: 2 / -1; grid-row: 1; }
#btnRegister { grid-column: 2 / -1; grid-row: 2; }

/* В режиме без админки логин занимает всю ширину */
#authButtons.no-admin { grid-template-columns: var(--auth-col-w) var(--auth-col-w); }
#authButtons.no-admin #btnLogin { grid-column: 1 / -1; }
#authButtons.no-admin #btnRegister { grid-column: 1 / -1; }
#authButtons.no-admin #btnChat { grid-column: 1; }
#authButtons.no-admin #btnTop { grid-column: 2; }
#authButtons.no-admin #btnClan { grid-column: 1 / -1; }

/* Чат | Топ в одной строке 50/50; Клан на ширину профиля (две колонки) */
/* Чтобы отступы между рядами были одинаковыми: используем row-gap и не добавляем дополнительную строку сверху */
#btnChat { grid-column: 2; grid-row: 2; }
#btnTop { grid-column: 3; grid-row: 2; }
#btnClan { grid-column: 2 / -1; grid-row: 3; }

/* Индикаторы непрочитанных для чатов */
#btnChat { position: relative; }
#btnChat.has-unread::after,
.chat-tab.has-unread::after {
	content: '';
	position: absolute;
	right: -2px;
	top: -2px;
	width: 12px;
	height: 12px;
	border-radius: 50%;
	background: #ff3b3b; /* по умолчанию — красный */
	box-shadow: 0 0 0 2px rgba(0,0,0,0.85), 0 2px 6px rgba(0,0,0,0.35);
	z-index: 2;
}
/* Цвета для разных каналов/типов */
#btnChat.has-unread.badge-blue::after, .chat-tab.has-unread.badge-blue::after { background: #43a5ff; }
#btnChat.has-unread.badge-purple::after, .chat-tab.has-unread.badge-purple::after { background: #9b59ff; }
#btnChat.has-unread.badge-green::after, .chat-tab.has-unread.badge-green::after { background: #29d17d; }

/* Более компактные кнопки на вертикальных экранах (портрет) */


@media (max-width: 480px) and (orientation: portrait) {
	/* 3 колонки: квадратная админка слева + две гибкие колонки; профиль/клан на всю правую ширину */
	#authButtons { --auth-col-w: 90px; --btn-h: 40px; top: 12px; right: 12px; row-gap: 4px; column-gap: 8px; grid-template-columns: var(--btn-h) 1fr 1fr; width: min(35vw, 140px); }
	#authButtons .btn { font-size: 11px; padding: 6px 10px; border-radius: 12px; width: 100%; min-height: var(--btn-h); }
	#authButtons .admin-btn { width: var(--btn-h); height: var(--btn-h); padding: 0; }
	/* Админка слева, профиль такой же ширины как "Клан" (две правые колонки) */
	#btnAdmin { grid-column: 1; grid-row: 1; }
	#btnLogin { grid-column: 2 / -1; grid-row: 1; }
	#btnRegister { grid-column: 2 / -1; grid-row: 4; }
	#btnChat { grid-column: 2; grid-row: 2; }
	#btnTop { grid-column: 3; grid-row: 2; }
	#btnClan { grid-column: 2 / -1; grid-row: 3; }

	/* Переносим подсказку авторизации вниз и уменьшаем */
	#loginHint { top: auto !important; bottom: 12px; left: 50%; transform: translateX(-50%); font-size: 10px; padding: 6px 8px; max-width: 90vw; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

	/* Когда админки нет — две правые колонки занимают всю ширину */
	#authButtons.no-admin { grid-template-columns: 1fr 1fr; width: min(35vw, 140px); }
	#authButtons.no-admin #btnRegister { grid-column: 1 / -1; grid-row: 2; }
	#authButtons.no-admin #btnLogin { grid-column: 1 / -1; }
	#authButtons.no-admin #btnChat { grid-column: 1; }
	#authButtons.no-admin #btnTop { grid-column: 2; }
	#authButtons.no-admin #btnClan { grid-column: 1 / -1; }
}

/* Admin tiles */
.admin-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; }
.admin-tile {
	background: rgba(255,255,255,0.06);
	color: #fff;
	border: 1px solid rgba(255,255,255,0.12);
	border-radius: 12px;
	padding: 16px;
	text-align: center;
	font-weight: 800;
	font-size: 14px;
	cursor: pointer;
}
.admin-tile:hover { background: rgba(255,255,255,0.09); }

/* Мобильный скролл в админке */
@media (max-width: 768px) {
	/* Контент карты админки скроллится внутри карточки */
	#modalContent .clan-profile { max-height: calc(84vh - 80px); overflow-y: auto; -webkit-overflow-scrolling: touch; touch-action: pan-y; overscroll-behavior: contain; }
	#modalContent .admin-grid { max-height: calc(84vh - 140px); overflow-y: auto; -webkit-overflow-scrolling: touch; touch-action: pan-y; overscroll-behavior: contain; padding-right: 10px; }
	/* Тёмный скроллбар под тему */
	#modalContent .admin-grid::-webkit-scrollbar { width: 10px; }
	#modalContent .admin-grid::-webkit-scrollbar-track { background: rgba(255,255,255,0.10); border-radius: 8px; }
	#modalContent .admin-grid::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.40); border-radius: 8px; }
	#modalContent .admin-grid::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.55); }
	#modalContent .admin-grid { scrollbar-width: auto; scrollbar-color: rgba(255,255,255,0.40) rgba(255,255,255,0.10); }
}

/* Clan modal */
#clanModal {
	position: fixed;
	inset: 0;
	background: rgba(0,0,0,0.5);
	z-index: 45;
	display: grid;
	place-items: center;
}

#clanCard {
	width: min(94vw, 760px);
	height: 600px;
	background: rgba(0,0,0,0.65);
	color: #fff;
	border: 1px solid rgba(255,255,255,0.18);
	border-radius: 12px;
	box-shadow: 0 20px 60px rgba(0,0,0,0.35);
	display: grid;
	grid-template-rows: auto 1fr auto;
	backdrop-filter: blur(6px);
}
#clanHeader { display: flex; align-items: center; justify-content: space-between; padding: 16px 24px; border-bottom: none; }
#clanHeader span { font-weight: 700; font-size: 22px; }
#clanBody { padding: 10px 14px; overflow-y: auto; background: transparent; }
#clanActions { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; padding: 12px; background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.12); border-radius: 12px; box-shadow: 0 6px 20px rgba(0,0,0,0.15); }

.clan-item { padding: 12px; border: 1px solid rgba(255,255,255,0.12); background: rgba(255,255,255,0.06); border-radius: 10px; margin-bottom: 10px; display: flex; justify-content: space-between; align-items: center; box-shadow: 0 6px 20px rgba(0,0,0,0.15); }
.clan-item:hover { background: rgba(255,255,255,0.08); }
.clan-title { font-weight: 800; font-size: 18px; }
.muted { color: #bdbdbd; font-size: 12px; }

/* Плавное появление списка кланов, чтобы убрать «моргание» */
#clanBody { opacity: 1; transform: translateY(0); transition: opacity 220ms ease, transform 220ms ease; }
#clanBody.loading { opacity: 0; transform: translateY(6px); }

#clanActions #clanSearch {
	background: #0f0f0f;
	color: #ffffff;
	border: 1px solid rgba(255,255,255,0.12);
	border-radius: 10px;
	padding: 10px 12px;
	font-size: 14px;
	outline: none;
}
#clanActions #clanSearch:focus { outline: none; box-shadow: none; }

#clanBody .muted.title {
	font-weight: 600;
	font-size: 15px;
	color: #eaeaea;
	margin-bottom: 8px;
}

/* Chat modal */
#chatModal {
	position: fixed;
	inset: 0;
	background: rgba(0,0,0,0.5);
	z-index: 45;
	display: grid;
	place-items: center;
}

#chatCard {
	width: min(92vw, 520px);
	height: 600px;
	background: rgba(0,0,0,0.65);
	color: #fff;
	border: 1px solid rgba(255,255,255,0.18);
	border-radius: 12px;
	box-shadow: 0 20px 60px rgba(0,0,0,0.35);
	display: flex;
	flex-direction: column;
	backdrop-filter: blur(6px);
}

#chatHeader {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 16px 24px;
	border-bottom: 1px solid rgba(255,255,255,0.15);
}
#chatHeader .icon-btn { align-self: center; }

#chatList {
	padding: 10px 14px;
	overflow-y: auto;
	overflow-x: hidden;
	/* Улучшаем скролл на мобильных и явно разрешаем вертикальный пан */
	-webkit-overflow-scrolling: touch;
	touch-action: pan-y;
	background: transparent;
	flex: 1 1 auto;
	min-height: 0;
	/* обычный блочный поток, как у #clanBody */
	font-size: 85%;
	/* Тонкий стилизованный скролл */
	-ms-overflow-style: scrollbar; /* IE/Edge: показывать скролл */
	scrollbar-width: auto; /* Firefox: обычная ширина, видимый */
	scrollbar-color: rgba(255,255,255,0.28) rgba(255,255,255,0.06);
	overscroll-behavior: contain;
	/* Плавное появление/исчезновение при переключении вкладок чата */
	transition: opacity 200ms ease, transform 200ms ease;
}
/* WebKit (Chrome/Edge/Safari): тонкий скролл под тему */
#chatList::-webkit-scrollbar { width: 10px; }
#chatList::-webkit-scrollbar-track { background: rgba(255,255,255,0.10); border-radius: 8px; }
#chatList::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.40); border-radius: 8px; }
#chatList::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.55); }
/* Скрываем кнопки со стрелками у скроллбара (WebKit/Chromium) */
#chatList::-webkit-scrollbar-button,
#chatList::-webkit-scrollbar-button:single-button,
#chatList::-webkit-scrollbar-button:vertical:increment,
#chatList::-webkit-scrollbar-button:vertical:decrement,
#chatList::-webkit-scrollbar-button:start:decrement,
#chatList::-webkit-scrollbar-button:end:increment,
#chatList::-webkit-scrollbar-button:horizontal:increment,
#chatList::-webkit-scrollbar-button:horizontal:decrement {
	display: none;
	width: 0;
	height: 0;
	background: transparent;
}

/* Состояние анимации при смене вкладок чата */
#chatList.chat-switch { opacity: 0; transform: translateY(6px); }

/* Loading overlay */
#loadingOverlay {
	position: fixed;
	inset: 0;
	background: #ffffff;
	z-index: 20000;
	display: block;
	opacity: 1;
	transition: opacity 280ms ease;
}

#loadingOverlay.hide { opacity: 0; pointer-events: none; }

#loadingInner { position: static; display: contents; }
#loadingBrand { position: fixed; left: 50%; top: 18vh; transform: translateX(-50%); text-align: center; }
#loadingLogo { width: min(70vw, 360px); height: auto; image-rendering: -webkit-optimize-contrast; display: block; margin: 0 auto; }

#pixelWheel {
	position: fixed;
	left: 50%;
	top: 50%;
	transform: translate(-50%, -50%);
	width: 64px;
	height: 64px;
	animation: pixel-spin 1.1s steps(8, end) infinite;
}
#pixelWheel div {
	position: absolute;
	left: 50%;
	top: 50%;
	width: 10px;
	height: 10px;
	margin-left: -5px;
	margin-top: -5px;
	background: #000;
	image-rendering: pixelated;
}
#pixelWheel div:nth-child(1) { transform: rotate(0deg) translate(24px); }
#pixelWheel div:nth-child(2) { transform: rotate(45deg) translate(24px); }
#pixelWheel div:nth-child(3) { transform: rotate(90deg) translate(24px); }
#pixelWheel div:nth-child(4) { transform: rotate(135deg) translate(24px); }
#pixelWheel div:nth-child(5) { transform: rotate(180deg) translate(24px); }
#pixelWheel div:nth-child(6) { transform: rotate(225deg) translate(24px); }
#pixelWheel div:nth-child(7) { transform: rotate(270deg) translate(24px); }
#pixelWheel div:nth-child(8) { transform: rotate(315deg) translate(24px); }

@keyframes pixel-spin {
	from { transform: translate(-50%, -50%) rotate(0deg); }
	to { transform: translate(-50%, -50%) rotate(360deg); }
}

.chat-item { padding: 6px 0; border-bottom: 1px dashed rgba(255,255,255,0.06); flex: 0 0 auto; }
.chat-name { font-weight: 700; cursor: default; font-size: 1em; }
.chat-name.me { color: #ffaaaa; }
.chat-msg {
	white-space: pre-wrap;
	word-wrap: break-word;
	word-break: break-word;
}
.chat-item.mention { background: rgba(255,128,128,0.12); border-radius: 6px; padding: 6px; }

#chatForm { display: grid; grid-template-columns: 1fr auto; gap: 8px; padding: 10px 14px; }
#chatInput { border-radius: 8px; border: 1px solid rgba(255,255,255,0.15); background: #111; color: #fff; padding: 10px 12px; font-size: 14px; outline: none; }
#chatInput:focus { outline: none; box-shadow: none; }

.btn {
	background: rgba(0,0,0,0.65);
	color: #fff;
	border: 1px solid rgba(255,255,255,0.18);
	border-radius: 16px;
	padding: 8px 12px;
	font-size: 12px;
	cursor: pointer;
	box-shadow: 0 2px 8px rgba(0,0,0,0.08);
	backdrop-filter: blur(10px);
	font-family: 'AppFont', sans-serif;
	-webkit-tap-highlight-color: transparent;
}
.btn:hover { filter: brightness(0.95); }
.btn:active { filter: brightness(0.9); }
.btn:focus, .btn:focus-visible { outline: none !important; box-shadow: none !important; }
.icon-btn:focus, .icon-btn:focus-visible { outline: none !important; box-shadow: none !important; }

/* Отключаем нативный дабл‑тап зум на интерактивных элементах UI (канвас не трогаем) */
a, button, .btn, .icon-btn, #telegramButton.circle-btn, input, select, textarea, label {
	touch-action: manipulation;
}

#modalBackdrop {
	position: fixed;
	inset: 0;
	background: rgba(0,0,0,0.5);
	z-index: 30;
}

#modal {
	position: fixed;
	inset: 0;
	display: grid;
	place-items: center;
	z-index: 40;
}

#modalContent {
	width: min(94vw, 760px);
	background: rgba(0,0,0,0.65);
	color: #fff;
	border: 1px solid rgba(255,255,255,0.18);
	border-radius: 12px;
	padding: 24px;
	box-shadow: 0 20px 60px rgba(0,0,0,0.3);
	backdrop-filter: blur(6px);
}

#modalContent.top-card { width: min(94vw, 760px); height: min(84vh, 680px); display: flex; flex-direction: column; }
.top-card .tabs { flex-shrink: 0; position: relative; z-index: 2; }
#topViewport { position: relative; flex: 1 1 auto; min-height: 220px; overflow: hidden; z-index: 1; contain: layout paint; }
.topPane {
	position: absolute;
	inset: 0;
	overflow: auto;
	opacity: 0;
	transform: translateY(6px);
	will-change: opacity, transform;
	transition: opacity 220ms ease, transform 260ms ease;
	backface-visibility: hidden;
}
.topPane.active { opacity: 1; transform: translateY(0); z-index: 1; }
.topPane.no-anim { transition: none !important; }
.topPane.from-left { transform-origin: 50% 0; }
.topPane.exit-left { opacity: 0; transform: translateY(-4px); z-index: 0; }
.topPane.exit-right { opacity: 0; transform: translateY(-4px); z-index: 0; }

/* Тёмный скроллбар в меню Топа (кросс‑браузер) */
.topPane {
	-webkit-overflow-scrolling: touch;
	touch-action: pan-y;
	-ms-overflow-style: scrollbar; /* IE/Edge */
	scrollbar-width: auto; /* Firefox */
	scrollbar-color: rgba(255,255,255,0.28) rgba(255,255,255,0.06); /* Firefox */
}
.topPane::-webkit-scrollbar { width: 10px; }
.topPane::-webkit-scrollbar-track { background: rgba(255,255,255,0.10); border-radius: 8px; }
.topPane::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.40); border-radius: 8px; }
.topPane::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.55); }
.topPane::-webkit-scrollbar-button,
.topPane::-webkit-scrollbar-button:single-button,
.topPane::-webkit-scrollbar-button:vertical:increment,
.topPane::-webkit-scrollbar-button:vertical:decrement,
.topPane::-webkit-scrollbar-button:start:decrement,
.topPane::-webkit-scrollbar-button:end:increment,
.topPane::-webkit-scrollbar-button:horizontal:increment,
.topPane::-webkit-scrollbar-button:horizontal:decrement {
	display: none;
	width: 0;
	height: 0;
	background: transparent;
}

/* Плавное появление содержимого вкладки Топа после загрузки данных */
.topPane .top-rows { opacity: 0; transform: translateY(4px); transition: opacity 220ms ease, transform 220ms ease; padding-right: 12px; }
.topPane.content-ready .top-rows { opacity: 1; transform: translateY(0); }
.topPane .top-rows.loading { opacity: 0.85; transform: none; transition: none; }

.modal-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 12px;
}

.modal-header h2 { font-weight: 700; font-size: 22px; line-height: 1; margin: 0; letter-spacing: 0; }

.icon-btn {
	background: transparent;
	border: none;
	color: #aaa;
	font-size: 22px;
	line-height: 1;
	cursor: pointer;
	font-family: 'AppFont', sans-serif;
}
.icon-btn:hover { color: #fff; }

/* Top modal list */
.top-rows { display: grid; gap: 8px; }
.top-head, .top-row { display: grid; grid-template-columns: 40px 1fr 120px; align-items: center; gap: 10px; }
.top-head { color: #999; font-weight: 700; border-bottom: 1px solid rgba(255,255,255,0.1); padding-bottom: 6px; }
.top-row { padding: 6px 0; border-bottom: 1px dashed rgba(255,255,255,0.06); }
.top-row .rank { text-align: right; font-weight: 700; color: #ccc; font-variant-numeric: tabular-nums; }
.top-head .rank { text-align: right; font-variant-numeric: tabular-nums; }
.top-row .main { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-row .value { text-align: right; font-variant-numeric: tabular-nums; }

/* Skeleton for first load of Top */
.top-skeleton { display: grid; gap: 8px; }
.top-skeleton .sk { height: 14px; border-radius: 6px; background: linear-gradient(90deg, rgba(255,255,255,0.10), rgba(255,255,255,0.18), rgba(255,255,255,0.10)); background-size: 200% 100%; animation: shimmer 1.2s ease-in-out infinite; }
.top-skeleton .row { display: grid; grid-template-columns: 40px 1fr 120px; gap: 10px; align-items: center; }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* Fade/slide animation for top content */
/* legacy fade (unused now) */
#topList.top-anim { opacity: 0; transform: translateY(6px); transition: opacity 160ms ease, transform 200ms ease; }
#topList.top-anim.show { opacity: 1; transform: translateY(0); }

/* Active tab look reused via .btn-primary */
.tabs .btn.btn-primary { background: #fff; color: #000; border-color: rgba(255,255,255,0.18); }

/* Confirm modal layout */
.confirm-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 12px; }
.btn-primary {
	background: #fff;
	color: #000;
	border-color: rgba(255,255,255,0.18);
}
.btn-secondary {
	background: rgba(0,0,0,0.85);
	color: #fff;
}

/* Narrow confirm card width matching chat style */
#modalContent.confirm-card { width: min(92vw, 520px); background: rgba(0,0,0,0.65); }

/* Более компактный Топ на вертикальных и маленьких экранах */
@media (max-width: 480px) and (orientation: portrait) {
	#modalContent.top-card { width: min(96vw, 520px); height: min(82vh, 560px); padding: 16px; }
	.top-card .tabs { margin-bottom: 8px; }
	.top-card .tabs .btn { font-size: 11px; padding: 6px 10px; border-radius: 12px; }
	.topPane .top-rows { font-size: 90%; }
	.top-head, .top-row { grid-template-columns: 28px 1fr 90px; gap: 8px; }
	.top-row { padding: 4px 0; }
}

@media (max-width: 360px) and (orientation: portrait) {
	.topPane .top-rows { font-size: 85%; }
	.top-head, .top-row { grid-template-columns: 26px 1fr 82px; gap: 6px; }
	.top-row { padding: 3px 0; }
}

.value-box {
	padding: 10px 12px;
	background: #0f0f0f;
	border: 1px solid rgba(255,255,255,0.12);
	border-radius: 8px;
	font-size: 14px;
}

/* Toasts */
#toastHost {
	position: fixed;
	left: 0;
	right: 0;
	bottom: 24px;
	display: grid;
	place-items: center;
	z-index: 50;
	pointer-events: none;
}
.toast {
	min-width: 260px;
	max-width: min(92vw, 560px);
	background: rgba(15,15,15,0.88);
	color: #fff;
	border: 1px solid rgba(255,255,255,0.16);
	border-radius: 12px;
	padding: 12px 14px;
	box-shadow: 0 18px 48px rgba(0,0,0,0.45);
	font-size: 14px;
	line-height: 1.35;
	opacity: 0;
	transform: translateY(12px);
	transition: opacity 180ms ease, transform 180ms ease, background 180ms ease;
	pointer-events: auto;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.success { background: rgba(7,38,21,0.9); color: #d1ffe0; border-color: rgba(0,255,128,0.2); }
.toast.warn { background: rgba(38,34,7,0.9); color: #fff2c6; border-color: rgba(255,216,0,0.25); }

/* Pixel info popup */
#pixelInfo {
	position: fixed;
	left: 0;
	top: 0;
	z-index: 9999;
	pointer-events: none;
}
#pixelInfoCard {
	position: absolute;
	min-width: 220px;
	max-width: 320px;
	background: rgba(0,0,0,0.65);
	color: #fff;
	border: 1px solid rgba(255,255,255,0.18);
	border-radius: 16px;
	padding: 10px 12px;
	box-shadow: 0 12px 30px rgba(0,0,0,0.35);
	font-size: 12px;
	line-height: 1.4;
	opacity: 0;
	transform: translateY(4px);
	transition: opacity 120ms ease, transform 120ms ease;
	backdrop-filter: blur(6px);
}
#pixelInfoCard.show { opacity: 1; transform: translateY(0); }

.form-grid {
	display: grid;
	grid-template-columns: 1fr;
	gap: 12px;
}

.field label { font-size: 13px; color: #cfcfcf; display: block; margin-bottom: 6px; }
.field input {
	width: 100%;
	padding: 10px 12px;
	border-radius: 8px;
	border: 1px solid rgba(255,255,255,0.15);
	background: #111;
	color: #fff;
	font-size: 14px;
	box-sizing: border-box;
}

.row {
	display: flex;
	justify-content: flex-end;
	gap: 8px;
	margin-top: 8px;
}

/* Баннер про вход */
#loginHint {
	position: fixed;
	top: 16px;
	left: 50%;
	transform: translateX(-50%);
	background: rgba(0,0,0,0.75);
	color: #fff;
	border: 1px solid rgba(255,255,255,0.15);
	border-radius: 12px;
	padding: 10px 14px;
	font-size: 14px;
	z-index: 15;
	max-width: 90vw;
}

/* Палитра снизу справа */
#dock {
	position: fixed;
	right: 16px;
	bottom: 16px;
	display: grid;
	grid-template-rows: auto auto auto;
	gap: 10px;
	z-index: 20;
	width: fit-content;
}
#paletteRow { display: flex; gap: 10px; align-items: center; justify-content: flex-end; }
#coords .bar {
	width: 100%;
	background: rgba(0,0,0,0.65);
	border: 1px solid rgba(255,255,255,0.18);
	border-radius: 18px;
	padding: 6px 10px;
	position: relative;
	box-shadow: 0 2px 8px rgba(0,0,0,0.08);
	backdrop-filter: blur(10px);
}
#coords .label {
	position: relative;
	text-align: center;
	color: #fff;
	font-weight: 400;
	font-size: 12px;
}

#cooldown .bar {
	width: 100%;
	min-width: 0;
	max-width: none;
	background: rgba(0,0,0,0.65);
	border: 1px solid rgba(255,255,255,0.18);
	border-radius: 18px;
	padding: 6px;
	position: relative;
	box-shadow: 0 2px 8px rgba(0,0,0,0.08);
	backdrop-filter: blur(10px);
}
#cooldown .fill {
	position: absolute;
	left: 6px;
	top: 6px;
	bottom: 6px;
	right: 6px;
	border-radius: 12px;
	background: #0a4;
	opacity: 0.8;
	transform-origin: 0 50%;
	transform: scaleX(1);
	transition: transform 120ms linear, background 120ms ease;
}
#cooldown .label {
	position: relative;
	text-align: center;
	color: #fff;
	font-weight: 400;
	font-size: 12px;
}

#palette {
	position: relative;
	right: auto;
	bottom: auto;
	display: grid;
	grid-template-columns: repeat(5, 44px);
	gap: 10px;
	background: rgba(0,0,0,0.65);
	color: #fff;
	border: 1px solid rgba(255,255,255,0.18);
	border-radius: 18px;
	padding: 12px;
	box-shadow: 0 2px 8px rgba(0,0,0,0.08);
	backdrop-filter: blur(10px);
	z-index: 20;
}
#btnLang {
	position: fixed;
	left: 16px;
	bottom: 16px;
	top: auto;
	right: auto;
	z-index: 26;
	min-width: 44px;
	width: 44px;
	height: 44px;
	padding: 0;
	border-radius: 10px;
	font-weight: 800;
	font-size: 12px;
}
.swatch, .picker-wrap {
	width: 44px;
	height: 44px;
	display: grid;
	place-items: center;
	border-radius: 10px;
	border: 2px solid rgba(255,255,255,0.6);
	cursor: pointer;
}
.swatch.selected { outline: 3px solid rgba(255,255,255,0.7); outline-offset: -3px; }

.picker-wrap input[type="color"] {
	appearance: none;
	width: 36px;
	height: 36px;
	border: none;
	background: transparent;
	padding: 0;
	cursor: pointer;
	border-radius: 8px;
}
.picker-wrap input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
.picker-wrap input[type="color"]::-webkit-color-swatch { border: none; border-radius: 8px; }

#clanProfileModal { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 46; display: grid; place-items: center; }
#banOverlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 46; display: grid; place-items: center; }
#chatModal, #clanModal, #clanProfileModal, #modal, #banOverlay {
	opacity: 1;
	will-change: opacity;
	transition: opacity 200ms ease;
}
.modal-open { opacity: 0.0001; }
.modal-open.show { opacity: 1; }
/* Повышаем специфичность, чтобы перебить #id {opacity:1} */
#chatModal.modal-open, #clanModal.modal-open, #clanProfileModal.modal-open, #modal.modal-open, #banOverlay.modal-open { opacity: 0.0001; }
#chatModal.modal-open.show, #clanModal.modal-open.show, #clanProfileModal.modal-open.show, #modal.modal-open.show, #banOverlay.modal-open.show { opacity: 1; }
.modal-open { opacity: 0.0001; }
.modal-open.show { opacity: 1; }
.modal-closing { pointer-events: none; }

#chatCard, #clanCard, #clanProfileCard, #modalContent, #banCard {
	transform: translateY(6px) scale(0.98);
	opacity: 0;
	will-change: transform, opacity;
	transition: opacity 220ms ease, transform 260ms ease;
}
.modal-open.show #chatCard,
.modal-open.show #clanCard,
.modal-open.show #clanProfileCard,
.modal-open.show #modalContent,
.modal-open.show #banCard { transform: translateY(0) scale(1); opacity: 1; }
#modalContent.top-card { transform-origin: 50% 38%; }
.modal-open.show #modalContent.top-card { transition: opacity 220ms ease, transform 260ms cubic-bezier(0.16, 1, 0.3, 1); }

/* При закрытии Топа не убираем контент мгновенно — плавно гасим список и вкладки */
#modal.modal-open.modal-closing #modalContent.top-card .tabs,
#modal.modal-open.modal-closing #modalContent.top-card #topViewport,
#modal.modal-open.modal-closing #modalContent.top-card .topPane,
#modal.modal-open.modal-closing #modalContent.top-card .top-rows,
#modal.modal-open.modal-closing #modalContent.top-card .top-skeleton {
	opacity: 0;
	transform: translateY(6px);
	transition: opacity 160ms ease, transform 200ms ease;
}
#clanProfileCard { width: min(94vw, 760px); max-height: min(80vh, 650px); background: rgba(0,0,0,0.45); color: #fff; border: 1px solid rgba(255,255,255,0.18); border-radius: 12px; box-shadow: 0 20px 60px rgba(0,0,0,0.35); display: grid; grid-template-rows: auto 1fr; padding: 24px; }
#clanProfileCard { background: rgba(0,0,0,0.65); }
#clanProfileCard { backdrop-filter: blur(6px); }
#clanProfileHeader { display: flex; align-items: center; justify-content: space-between; padding: 0; margin-bottom: 12px; border-bottom: none; }
#clanProfileHeader > h2 { font-weight: 700; font-size: 22px !important; line-height: 1; margin: 0; letter-spacing: 0; }
#clanProfileHeader .icon-btn { align-self: center; }
#clanProfileBody { padding: 0; overflow-y: auto; background: transparent; }


/* --- Clan profile redesigned --- */

.clan-profile {
	background: rgba(0,0,0,0.65);
	border: 1px solid rgba(255,255,255,0.18);
	border-radius: 12px;
	padding: 14px;
	margin: 16px 0;
	box-shadow: 0 6px 20px rgba(0,0,0,0.25);
}
.clan-profile .clan-header { display: flex; align-items: center; justify-content: center; gap: 14px; }


.clan-profile .emblem {
	width: 68px; height: 68px; border-radius: 14px; display: grid; place-items: center;
	background: linear-gradient(135deg, #1a1a1a, #0e0e0e);
	border: 1px solid rgba(255,255,255,0.18);
	color: #fff; font-weight: 800; font-size: 24px;
}
.clan-profile .titles .name { font-weight: 800; font-size: 22px; }
.clan-profile .titles .tag { color: #cfcfcf; font-size: 14px; margin-top: 4px; }
.clan-profile .clan-stats {
	margin-top: 12px; display: flex; flex-wrap: wrap; gap: 8px; justify-content: center;
}
.clan-profile .clan-stats .stat { background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.12); border-radius: 10px; padding: 12px; text-align: center; width: 160px; }
.clan-profile .clan-stats .num { font-weight: 800; font-size: 18px; color: #fff; display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clan-profile .clan-stats .label { font-size: 12px; color: #c9c9c9; }
.clan-profile .owner { margin-top: 10px; text-align: center; }
.clan-profile .clan-actions { margin-top: 12px; display: flex; gap: 8px; align-items: center; justify-content: center; flex-wrap: wrap; }

/* Invite block: transparent with blur, full clickable */
.invite-block {
	margin: 12px auto 0;
	width: min(100%, 520px);
	background: rgba(0,0,0,0.35);
	border: 1px solid rgba(255,255,255,0.18);
	border-radius: 12px;
	padding: 6px 10px;
	backdrop-filter: blur(6px);
	display: flex;
	align-items: center;
	gap: 8px;
	cursor: pointer;
}
.invite-block .invite-url {
	flex: 1 1 auto;
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	color: #eaeaea;
	font-size: 12px;
	line-height: 1.1;
}
.invite-block .copy-badge {
	flex: 0 0 auto;
	background: rgba(255,255,255,0.10);
	border: 1px solid rgba(255,255,255,0.18);
	border-radius: 10px;
	padding: 4px 8px;
	font-size: 11px;
	color: #fff;
}
.invite-block:hover { background: rgba(0,0,0,0.45); }

.invite-hint { margin-top: 6px; font-size: 12px; line-height: 1.1; width: min(100%, 520px); margin-left: auto; margin-right: auto; text-align: center; }

/* Center titles within clan header */
.clan-profile .titles { text-align: center; }

/* Bigger action button */
.btn.btn-big {
	padding: 12px 16px;
	font-size: 14px;
	border-radius: 18px;
}


