:root {
	color-scheme: dark;
	--nav-height: 56px;
}

.top-nav {
	position: relative;
	z-index: 20;
	height: var(--nav-height);
	background: #0f1115;
	border-bottom: 1px solid #2a2e38;
}

.nickname-gate {
	width: min(460px, calc(100vw - 28px));
	padding: 0;
	color: #eef1f6;
	background: #171a21;
	border: 1px solid #3b414d;
	border-radius: 14px;
	box-shadow: 0 24px 80px #000c;
}
.nickname-gate::backdrop { background: rgba(4, 5, 8, .92); }
.nickname-gate__card { padding: 28px; text-align: center; }
.nickname-gate__icons { display: flex; justify-content: center; align-items: center; gap: 12px; margin-bottom: 18px; font-size: 30px; }
.nickname-gate__icons b { color: #717a89; font-size: 20px; }
.nickname-gate h2 { margin: 0 0 8px; font-size: 21px; }
.nickname-gate p { margin: 0 0 20px; color: #aab1bd; }
.nickname-gate__row { display: flex; gap: 10px; }
.nickname-gate input { min-width: 0; flex: 1; padding: 11px 12px; color: #eef1f6; background: #101218; border: 1px solid #454c59; border-radius: 8px; font: inherit; }
.nickname-gate input:focus { outline: 2px solid #68a0ff; outline-offset: 1px; }
.nickname-gate button { padding: 10px 18px; color: #fff; background: #2f6bff; border: 0; border-radius: 8px; font: inherit; font-weight: 700; cursor: pointer; }
.nickname-gate button:disabled { opacity: .55; cursor: wait; }
.nickname-gate__message { min-height: 18px; margin-top: 10px; text-align: left; }
@media (max-width: 440px) {
	.nickname-gate__card { padding: 22px 18px; }
	.nickname-gate__row { flex-direction: column; }
}

.top-nav__inner {
	box-sizing: border-box;
	width: 100%;
	max-width: 1120px;
	height: 100%;
	margin: 0 auto;
	padding: 0 20px;
	display: flex;
	align-items: center;
	gap: 2px;
}

.top-nav a {
	box-sizing: border-box;
	display: flex;
	align-items: center;
	height: 32px;
	padding: 0 8px;
	border: 1px solid #0f1115;
	border-radius: 7px;
	color: #aeb4c0;
	font-size: 11.5px;
	font-weight: 600;
	text-decoration: none;
	white-space: nowrap;
	transition: color .15s ease, background .15s ease, border-color .15s ease;
}

.top-nav a:hover {
	color: #fff;
	background: #1b1e26;
}

.top-nav a[aria-current="page"] {
	color: #fff;
	background: #232732;
	border-color: #3a3f4b;
}

.notification-badge {
	display: inline-grid;
	place-items: center;
	min-width: 17px;
	height: 17px;
	box-sizing: border-box;
	margin-left: 5px;
	padding: 0 4px;
	border: 1px solid #ff8a8a;
	border-radius: 9px;
	background: #c93636;
	color: #fff;
	font-size: 10px;
	font-weight: 800;
	line-height: 1;
	box-shadow: 0 0 8px rgba(255, 70, 70, .35);
}

.top-nav [hidden] {
	display: none !important;
}

[hidden] {
	display: none !important;
}

.clan-mark {
	box-sizing: border-box;
	width: 44px;
	height: 44px;
	flex: none;
	display: grid;
	place-items: center;
	overflow: hidden;
	background: var(--clan-color, #555);
	border: 1px solid #5b6270;
	border-radius: 10px;
	color: #f0f2f6;
	font-weight: 800;
}

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

.top-nav__lang {
	margin-left: auto;
	position: relative;
	flex: none;
}

.avatar-frame {
	box-sizing: border-box;
	display: inline-grid;
	place-items: center;
	padding: 3px;
	border: 3px solid transparent;
	border-radius: 50%;
}

.player-avatar {
	box-sizing: border-box;
	display: inline-grid;
	place-items: center;
	width: 40px;
	height: 40px;
	padding: 2px;
	flex: none;
	overflow: hidden;
	border: 2px solid transparent;
	border-radius: 50%;
	background: #252a34;
	color: #dfe5ef;
	font-size: 12px;
	font-weight: 800;
}

.player-avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.player-avatar.compact { width: 30px; height: 30px; padding: 1px; border-width: 2px; font-size: 10px; }
.top-nav__player .player-avatar { width: 26px; height: 26px; padding: 1px; border-width: 2px; font-size: 9px; }
.player-cell-content { display: inline-flex; align-items: center; gap: 9px; }

.frame-bronze { border-color: #b7793f !important; box-shadow: inset 0 0 0 2px #e0ad78, 0 0 8px #8f4f2588; }
.frame-steel { border-color: #8793a3 !important; box-shadow: inset 0 0 0 2px #d4d9df, 0 0 8px #72809688; }
.frame-frost { border-color: #72d8ff !important; box-shadow: inset 0 0 0 2px #e9fbff, 0 0 12px #2bbcffaa; }
.frame-fire { border-color: #ff6a2a !important; box-shadow: inset 0 0 0 2px #ffd064, 0 0 14px #ff3b12cc; }
.frame-royal { border-color: #d7aa38 !important; box-shadow: inset 0 0 0 2px #fff0a4, 0 0 13px #bb6dffaa; }

.frame-shop { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.frame-option { min-height: 38px; border-width: 2px; }
.frame-option.selected { outline: 2px solid #fff; outline-offset: 2px; }
.frame-action { flex-basis: 100%; margin-top: 6px; justify-content: center; }

.manager-permanent-note {
	margin: 6px 0 14px;
	padding: 10px 12px;
	color: #dce8ff;
	background: #182235;
	border: 1px solid #38527b;
	border-radius: 8px;
	font-size: 13px;
}

.top-nav__lang-button {
	box-sizing: border-box;
	display: grid;
	place-items: center;
	width: 38px;
	height: 36px;
	padding: 0;
	border: 1px solid #3a3f4b;
	border-radius: 7px;
	background: #14171e;
	color: #aeb4c0;
	font: inherit;
	font-size: 17px;
	cursor: pointer;
}

.top-nav__lang-menu {
	position: absolute;
	top: calc(100% + 6px);
	right: 0;
	z-index: 50;
	box-sizing: border-box;
	min-width: 174px;
	padding: 6px;
	border: 1px solid #303642;
	border-radius: 8px;
	background: #14171e;
	box-shadow: 0 12px 32px rgba(0, 0, 0, .38);
}

.top-nav__lang-option {
	box-sizing: border-box;
	display: flex;
	align-items: center;
	width: 100%;
	height: 32px;
	padding: 0 9px;
	border: 0;
	border-radius: 6px;
	background: transparent;
	color: #aeb4c0;
	font: inherit;
	font-size: 12.5px;
	font-weight: 600;
	text-align: left;
	white-space: nowrap;
	cursor: pointer;
}

.top-nav__lang-option:hover,
.top-nav__lang-option[aria-selected="true"] {
	color: #fff;
	background: #232732;
}

.top-nav__online {
	margin-left: auto;
	display: inline-flex;
	align-items: center;
	height: 36px;
	padding: 0 10px;
	border: 1px solid #303642;
	border-radius: 7px;
	background: #171b22;
	color: #cfd5df;
	font-size: 12.5px;
	font-weight: 650;
	white-space: nowrap;
}

.top-nav__online:not([hidden]) ~ .top-nav__lang {
	margin-left: 4px;
}

.top-nav__lang-button:hover {
	color: #fff;
	border-color: #4a505e;
}

/* When the language picker is present it already claims the right edge, so the
   player badge no longer needs to. */
.top-nav__lang ~ .top-nav__player {
	margin-left: 8px;
}

.top-nav__player {
	position: relative;
	margin-left: auto;
	display: flex;
	align-items: center;
	gap: 8px;
	height: 36px;
	padding: 0 13px;
	border: 1px solid #3a3f4b;
	border-radius: 7px;
	background: #171b22;
	color: #aeb4c0;
	font-size: 12.5px;
	font-weight: 600;
	text-decoration: none;
	white-space: nowrap;
	transition: color .15s ease, background .15s ease, border-color .15s ease;
}

.top-nav__player:hover {
	color: #fff;
	background: #232732;
	border-color: #4a505e;
}

.top-nav__player:focus-visible {
	outline: 2px solid #68a0ff;
	outline-offset: 2px;
}

/* Hover panel that makes the player badge look like it expands downwards: it
   overlays the badge exactly (top/right -1px compensate the badge border) and
   draws two rows — the player row again, then the clan treasury row. One grid
   holds both rows, so their columns and width always match. If the clan row
   needs more room, the whole panel grows leftwards. */
.top-nav__clan-tip {
	box-sizing: border-box;
	position: absolute;
	top: -1px;
	right: -1px;
	min-width: calc(100% + 2px);
	width: max-content;
	max-width: 320px;
	z-index: 30;
	display: none;
	grid-template-columns: auto minmax(0, 1fr) auto auto;
	grid-auto-rows: 34px;
	align-items: center;
	column-gap: 8px;
	padding: 0 13px;
	background: #1b1e26;
	border: 1px solid #3a3f4b;
	border-radius: 7px;
	box-shadow: 0 8px 20px rgba(0, 0, 0, .45);
	color: #aeb4c0;
	font-size: 12.5px;
	font-weight: 600;
	white-space: nowrap;
}

.top-nav__player:hover .top-nav__clan-tip,
.top-nav__player:focus-visible .top-nav__clan-tip {
	display: grid;
}

.top-nav__tip-row {
	display: contents;
}

.top-nav__clan-tip .top-nav__nick {
	overflow: hidden;
	text-overflow: ellipsis;
}

.top-nav__clan-tip .clan-mark {
	width: 26px;
	height: 26px;
	border-radius: 7px;
	font-size: 9px;
}

.top-nav__nick {
	color: #fff;
}

.top-nav__stars {
	color: #ffd45e;
}

.silver-amount, .top-nav__silver {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	color: #dce4ee;
}

.silver-amount::before, .top-nav__silver::before {
	content: "";
	display: inline-block;
	width: 16px;
	height: 16px;
	flex: 0 0 16px;
	background: center / contain no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cdefs%3E%3CradialGradient id='g' cx='35%25' cy='28%25' r='75%25'%3E%3Cstop stop-color='%23fff'/%3E%3Cstop offset='.45' stop-color='%23dce4ee'/%3E%3Cstop offset='1' stop-color='%237e8998'/%3E%3C/radialGradient%3E%3C/defs%3E%3Ccircle cx='12' cy='12' r='10' fill='url(%23g)' stroke='%23f4f7fb'/%3E%3Ccircle cx='12' cy='12' r='7.4' fill='none' stroke='%2365707e' stroke-width='.8'/%3E%3Cpath d='M12 6v12M7 9l10 6M17 9 7 15' stroke='%235d6875' stroke-width='1.4' stroke-linecap='round'/%3E%3Ccircle cx='12' cy='12' r='2' fill='%23aeb9c6' stroke='%235d6875' stroke-width='.7'/%3E%3C/svg%3E");
}

dd.silver-amount {
	justify-self: stretch;
	justify-content: flex-end;
}

.top-nav__accounts {
	box-sizing: border-box;
	flex: none;
	height: 36px;
	margin-left: 4px;
	padding: 0 11px;
	border: 1px solid #3a3f4b;
	border-radius: 7px;
	background: #171b22;
	color: #aeb4c0;
	font: inherit;
	font-size: 12px;
	font-weight: 600;
	cursor: pointer;
}

.top-nav__accounts:hover { color: #fff; background: #232732; border-color: #4a505e; }
.top-nav__accounts:focus-visible { outline: 2px solid #68a0ff; outline-offset: 2px; }

.account-switcher {
	width: min(620px, calc(100vw - 28px));
	padding: 0;
	color: #eef1f6;
	background: #171a21;
	border: 1px solid #3b414d;
	border-radius: 14px;
	box-shadow: 0 24px 80px #000c;
}

.account-switcher::backdrop { background: rgba(4, 5, 8, .86); }
.account-switcher__card { padding: 24px; }
.account-switcher__header { display: flex; align-items: flex-start; gap: 18px; }
.account-switcher__header > div { flex: 1; min-width: 0; }
.account-switcher h2 { margin: 0 0 6px; font-size: 21px; }
.account-switcher p { margin: 0; color: #aab1bd; }
.account-switcher__close {
	width: 34px; height: 34px; padding: 0; border: 0; border-radius: 7px;
	background: #232732; color: #cbd1da; font: 22px/1 system-ui, sans-serif; cursor: pointer;
}
.account-switcher__create { display: flex; gap: 10px; margin-top: 20px; }
.account-switcher input {
	min-width: 0; flex: 1; padding: 10px 12px; color: #eef1f6; background: #101218;
	border: 1px solid #454c59; border-radius: 8px; font: inherit;
}
.account-switcher button:not(.account-switcher__close) {
	padding: 9px 13px; color: #fff; background: #2f6bff; border: 0;
	border-radius: 7px; font: inherit; font-weight: 700; cursor: pointer;
}
.account-switcher button:disabled { opacity: .55; cursor: default; }
.account-switcher__message { min-height: 18px; margin: 8px 0 4px; color: #aab1bd; font-size: 12px; }
.account-switcher__message.err { color: #ff7a7a; }
.account-switcher__list { display: grid; gap: 8px; max-height: min(410px, 50vh); overflow-y: auto; }
.account-switcher__empty { padding: 18px; text-align: center; border: 1px dashed #3b414d; border-radius: 8px; }
.account-switcher__account {
	display: grid; grid-template-columns: minmax(100px, 1fr) auto auto; align-items: center; gap: 8px;
	padding: 10px; background: #11141a; border: 1px solid #303642; border-radius: 9px;
}
.account-switcher__account.is-active { border-color: #3971df; background: #151c2a; }
.account-switcher__identity { display: flex; min-width: 0; flex-direction: column; }
.account-switcher__identity strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-switcher__identity small { color: #858e9c; }
.account-switcher .account-switcher__forget { background: #342126; color: #ffafb7; }

@media (max-width: 640px) {
	.top-nav {
		height: auto;
		overflow-x: auto;
	}

	.top-nav__inner {
		width: max-content;
		min-width: 100%;
		height: 52px;
		padding: 0 10px;
	}

	.top-nav a {
		height: 30px;
		padding: 0 6px;
		font-size: 11px;
	}

	.top-nav__accounts { height: 30px; padding: 0 7px; font-size: 11px; }
	.account-switcher__card { padding: 18px; }
	.account-switcher__create { flex-direction: column; }
	.account-switcher__account { grid-template-columns: minmax(80px, 1fr) auto; }
	.account-switcher__forget { grid-column: 2; }
}
