/* RaceWars admin panel: the game's menu look (MenuTheme) - dark chamfered panels,
   neon cyan accent, amber call to action, Exo 2 Italic headings, Rajdhani text. */

@font-face {
	font-family: "Exo 2";
	src: url("fonts/Exo2-Italic-Variable.ttf") format("truetype");
	font-style: italic;
	font-weight: 100 900;
	font-display: swap;
}
@font-face {
	font-family: "Rajdhani";
	src: url("fonts/Rajdhani-SemiBold.ttf") format("truetype");
	font-weight: 600;
	font-display: swap;
}
@font-face {
	font-family: "Rajdhani";
	src: url("fonts/Rajdhani-Bold.ttf") format("truetype");
	font-weight: 700;
	font-display: swap;
}

:root {
	color-scheme: dark;
	--bg: #070910;
	--panel: #0d121b;
	--panel-2: #131a26;
	--edge: rgba(255, 255, 255, 0.08);
	--edge-strong: rgba(255, 255, 255, 0.16);
	--text: #eff5fc;
	--text-dim: #a3b0c4;
	--muted: #7c889c;
	--accent: #21d4ff;
	--hot: #ffa11a;
	--green: #40db7a;
	--red: #ff4254;
	--gold: #ffcc42;
	--cash: #6bed85;
	--ink: #0a0b0f;
	/* charts (dataviz reference palette, dark steps, validated on --panel) */
	--grid: #1d2532;
	--axis: #2c3646;
	--series-1: #3987e5;
	--series-2: #d95926;
	--chamfer: 12px;
	--side: 220px;
}

* {
	box-sizing: border-box;
}

html,
body {
	margin: 0;
	background: var(--bg);
	color: var(--text);
	font-family: "Rajdhani", system-ui, "Segoe UI", sans-serif;
	font-weight: 600;
	font-size: 16px;
	line-height: 1.35;
}

body {
	min-height: 100vh;
	background: radial-gradient(ellipse at 50% -10%, #0e1726 0%, var(--bg) 60%) fixed;
}

a {
	color: var(--accent);
	text-decoration: none;
}

a:hover {
	text-decoration: underline;
}

h1,
h2,
h3,
.heading {
	font-family: "Exo 2", "Rajdhani", sans-serif;
	font-style: italic;
	font-weight: 700;
	letter-spacing: 0.01em;
	margin: 0;
}

h1 {
	font-size: 30px;
	text-transform: uppercase;
}

h2 {
	font-size: 19px;
	text-transform: uppercase;
}

.caption {
	font-size: 12px;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: var(--text-dim);
}

.muted {
	color: var(--muted);
}

.dim {
	color: var(--text-dim);
}

.num {
	font-variant-numeric: tabular-nums;
}

/* --- Shell ---------------------------------------------------------------------------- */

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

.side {
	position: sticky;
	top: 0;
	height: 100vh;
	display: flex;
	flex-direction: column;
	gap: 28px;
	padding: 24px 16px;
	background: rgba(8, 11, 17, 0.92);
	border-right: 1px solid var(--edge);
}

.brand {
	display: flex;
	flex-direction: column;
	color: var(--text);
	text-decoration: none !important;
}

.brand-race {
	font-family: "Exo 2", sans-serif;
	font-style: italic;
	font-weight: 800;
	font-size: 26px;
	letter-spacing: 0.02em;
}

.brand-admin {
	font-size: 12px;
	letter-spacing: 0.3em;
	color: var(--accent);
}

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

.nav a {
	display: block;
	padding: 10px 14px;
	color: var(--text-dim);
	font-family: "Exo 2", sans-serif;
	font-style: italic;
	font-weight: 600;
	font-size: 16px;
	text-transform: uppercase;
	text-decoration: none;
	clip-path: polygon(10px 0, 100% 0, calc(100% - 10px) 100%, 0 100%);
}

.nav a:hover {
	color: var(--text);
	background: rgba(255, 255, 255, 0.04);
}

.nav a.active {
	color: var(--text);
	background: linear-gradient(90deg, rgba(33, 212, 255, 0.28), rgba(33, 212, 255, 0.06));
	box-shadow: inset 3px 0 0 var(--accent);
}

.who {
	margin-top: auto;
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.who-name {
	font-size: 17px;
}

.who-role {
	font-size: 12px;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: var(--accent);
	margin-bottom: 8px;
}

.main {
	padding: 28px 32px 64px;
	min-width: 0;
	transition: opacity 0.2s;
}

.refreshing {
	opacity: 0.6;
	transition: opacity 0.2s;
}

.page-head {
	display: flex;
	align-items: flex-end;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 12px;
	margin-bottom: 20px;
}

.page-head .sub {
	color: var(--muted);
	font-size: 14px;
}

/* --- Panels, tiles ---------------------------------------------------------------------- */

.panel {
	background: var(--panel);
	border: 1px solid var(--edge);
	clip-path: polygon(var(--chamfer) 0, 100% 0, 100% calc(100% - var(--chamfer)), calc(100% - var(--chamfer)) 100%,
		0 100%, 0 var(--chamfer));
	padding: 18px 20px;
	min-width: 0;
}

.panel.accent {
	box-shadow: inset 3px 0 0 var(--accent);
}

.panel.hot {
	box-shadow: inset 3px 0 0 var(--hot);
}

.panel.danger {
	box-shadow: inset 3px 0 0 var(--red);
}

.panel > h2 {
	margin-bottom: 4px;
}

.panel > .panel-sub {
	color: var(--muted);
	font-size: 14px;
	margin-bottom: 14px;
}

.grid {
	display: grid;
	gap: 16px;
	margin-bottom: 16px;
}

.grid.two {
	grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid.three {
	grid-template-columns: repeat(3, minmax(0, 1fr));
}

.tiles {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
	gap: 12px;
	margin-bottom: 16px;
}

.tile {
	background: var(--panel);
	border: 1px solid var(--edge);
	padding: 14px 16px 12px;
	clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);
}

.tile .label {
	font-size: 12px;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: var(--text-dim);
}

.tile .value {
	font-family: "Exo 2", sans-serif;
	font-style: italic;
	font-weight: 700;
	font-size: 30px;
	line-height: 1.15;
	margin: 4px 0 2px;
}

.tile .detail {
	font-size: 13px;
	color: var(--muted);
}

.tile .key {
	display: inline-block;
	width: 10px;
	height: 10px;
	margin-right: 6px;
	border-radius: 2px;
	vertical-align: 0;
}

/* --- Controls ----------------------------------------------------------------------------- */

.btn {
	--btn: var(--accent);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	min-height: 40px;
	padding: 0 20px;
	border: 0;
	background: var(--btn);
	color: var(--ink);
	font-family: "Exo 2", sans-serif;
	font-style: italic;
	font-weight: 700;
	font-size: 15px;
	text-transform: uppercase;
	letter-spacing: 0.02em;
	cursor: pointer;
	clip-path: polygon(9px 0, 100% 0, calc(100% - 9px) 100%, 0 100%);
	transition: filter 0.15s;
}

.btn:hover {
	filter: brightness(1.12);
}

.btn:disabled {
	opacity: 0.45;
	cursor: default;
	filter: none;
}

.btn.hot {
	--btn: var(--hot);
}

.btn.danger {
	--btn: var(--red);
	color: #fff;
}

.btn.green {
	--btn: var(--green);
}

.btn.ghost {
	background: rgba(255, 255, 255, 0.07);
	color: var(--text);
	box-shadow: inset 0 0 0 1px var(--edge-strong);
}

.btn.small {
	min-height: 32px;
	padding: 0 14px;
	font-size: 13px;
}

input,
select,
textarea {
	font: inherit;
	color: var(--text);
	background: #0a0e15;
	border: 1px solid var(--edge-strong);
	border-radius: 0;
	padding: 8px 10px;
	min-height: 40px;
	outline: none;
	min-width: 0;
}

input:focus,
select:focus,
textarea:focus {
	border-color: var(--accent);
	box-shadow: 0 0 0 1px var(--accent);
}

input[type="checkbox"] {
	min-height: 0;
	width: 18px;
	height: 18px;
	accent-color: var(--accent);
	vertical-align: -3px;
}

label.field {
	display: flex;
	flex-direction: column;
	gap: 4px;
	font-size: 12px;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: var(--text-dim);
	min-width: 0;
}

label.field input,
label.field select {
	font-size: 16px;
	letter-spacing: 0;
	text-transform: none;
}

label.check {
	display: inline-flex;
	gap: 8px;
	align-items: center;
	color: var(--text-dim);
	font-size: 15px;
}

.form-row {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	align-items: flex-end;
}

.form-row > * {
	flex: 1 1 120px;
}

.form-row > .btn,
.form-row > .fit {
	flex: 0 0 auto;
}

.filters {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	margin-bottom: 14px;
}

.filters input[type="search"] {
	flex: 1 1 280px;
}

.error-text {
	color: var(--red);
	min-height: 1.35em;
	font-size: 14px;
}

/* --- Tables -------------------------------------------------------------------------------- */

.table-wrap {
	overflow-x: auto;
	margin: 0 -4px;
}

table {
	width: 100%;
	border-collapse: collapse;
	font-size: 15px;
}

th {
	text-align: left;
	font-size: 11px;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: var(--muted);
	font-weight: 700;
	padding: 8px;
	border-bottom: 1px solid var(--axis);
	white-space: nowrap;
}

td {
	padding: 8px;
	border-bottom: 1px solid var(--grid);
	vertical-align: middle;
}

td:first-child {
	white-space: nowrap;
}

td.num,
th.num {
	text-align: right;
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
}

tbody tr.link {
	cursor: pointer;
}

tbody tr.link:hover td {
	background: rgba(33, 212, 255, 0.06);
}

.empty {
	color: var(--muted);
	padding: 18px 8px;
	text-align: center;
}

.pager {
	display: flex;
	align-items: center;
	justify-content: flex-end;
	gap: 10px;
	margin-top: 12px;
	color: var(--muted);
	font-size: 14px;
}

/* --- Chips --------------------------------------------------------------------------------- */

.chip {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	padding: 1px 8px;
	font-size: 12px;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	border: 1px solid var(--edge-strong);
	color: var(--text-dim);
	white-space: nowrap;
	clip-path: polygon(5px 0, 100% 0, calc(100% - 5px) 100%, 0 100%);
	padding-inline: 10px;
}

.chip.on {
	border-color: rgba(64, 219, 122, 0.6);
	color: var(--green);
}

.chip.bad {
	border-color: rgba(255, 66, 84, 0.6);
	color: #ff8d97;
}

.chip.signed {
	border-color: rgba(33, 212, 255, 0.5);
	color: var(--accent);
}

.chip.warn {
	border-color: rgba(255, 161, 26, 0.6);
	color: var(--hot);
}

.dot {
	display: inline-block;
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: var(--green);
	box-shadow: 0 0 6px var(--green);
	margin-right: 6px;
	vertical-align: 1px;
}

.chips {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	align-items: center;
}

/* --- Player page ------------------------------------------------------------------------- */

.player-head {
	display: flex;
	flex-direction: column;
	gap: 8px;
	margin-bottom: 18px;
}

.player-head h1 {
	font-size: 36px;
	text-transform: none;
}

.facts {
	display: flex;
	flex-wrap: wrap;
	gap: 6px 22px;
	color: var(--text-dim);
	font-size: 14px;
}

.facts b {
	color: var(--text);
	font-weight: 700;
}

.copy {
	border: 0;
	background: none;
	color: var(--accent);
	font: inherit;
	font-size: 13px;
	cursor: pointer;
	padding: 0 4px;
}

.cars {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
	gap: 12px;
}

.car {
	background: var(--panel-2);
	border: 1px solid var(--edge);
	padding: 12px 14px;
	clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
}

.car h3 {
	font-size: 17px;
	text-transform: uppercase;
	margin-bottom: 6px;
}

.levels {
	display: grid;
	grid-template-columns: auto 1fr;
	gap: 2px 10px;
	font-size: 13px;
	color: var(--text-dim);
}

.pips {
	display: flex;
	gap: 3px;
	align-items: center;
}

.pips i {
	display: block;
	width: 18px;
	height: 6px;
	background: rgba(255, 255, 255, 0.1);
	transform: skewX(-20deg);
}

.pips i.on {
	background: var(--accent);
}

.ban-box {
	border: 1px solid rgba(255, 66, 84, 0.5);
	background: rgba(255, 66, 84, 0.08);
	padding: 10px 14px;
	margin-bottom: 12px;
}

.stack {
	display: flex;
	flex-direction: column;
	gap: 14px;
}

.action + .action {
	border-top: 1px solid var(--grid);
	padding-top: 14px;
}

.action h3 {
	font-size: 15px;
	text-transform: uppercase;
	margin-bottom: 8px;
	color: var(--text-dim);
}

.signed-pos {
	color: var(--green);
}

.signed-neg {
	color: #ff8d97;
}

/* --- Charts --------------------------------------------------------------------------------- */

.chart {
	position: relative;
}

.chart svg {
	display: block;
	width: 100%;
	overflow: visible;
}

.chart text {
	fill: var(--muted);
	font-family: "Rajdhani", sans-serif;
	font-weight: 600;
	font-size: 12px;
	font-variant-numeric: tabular-nums;
}

.chart .end-label {
	fill: var(--text-dim);
	font-size: 13px;
}

.chart .bar-label {
	fill: var(--text-dim);
	font-size: 14px;
}

.chart .bar-name {
	fill: var(--text-dim);
	font-size: 14px;
}

.chart .hit {
	fill: transparent;
	cursor: default;
	outline: none;
}

.chart .bar.lit {
	filter: brightness(1.25);
}

.legend {
	display: flex;
	flex-wrap: wrap;
	gap: 4px 18px;
	margin: 2px 0 10px;
	font-size: 14px;
	color: var(--text-dim);
}

.legend span::before {
	content: "";
	display: inline-block;
	width: 14px;
	height: 2px;
	margin-right: 6px;
	vertical-align: 4px;
	background: var(--key);
}

.tip {
	position: absolute;
	pointer-events: none;
	background: #05070b;
	border: 1px solid var(--edge-strong);
	padding: 8px 10px;
	font-size: 13px;
	min-width: 130px;
	white-space: nowrap;
	z-index: 5;
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

.tip .tip-title {
	color: var(--muted);
	margin-bottom: 4px;
}

.tip .tip-row {
	display: flex;
	align-items: center;
	gap: 8px;
}

.tip .tip-row b {
	font-size: 16px;
	font-variant-numeric: tabular-nums;
	min-width: 28px;
}

.tip .tip-row i {
	display: inline-block;
	width: 12px;
	height: 2px;
	background: var(--key);
}

details.data {
	margin-top: 8px;
	font-size: 14px;
	color: var(--muted);
}

details.data summary {
	cursor: pointer;
	width: max-content;
}

details.data .table-wrap {
	max-height: 260px;
	overflow: auto;
	margin-top: 6px;
}

/* --- Sign-in, dialogs, toasts ------------------------------------------------------------- */

.login {
	min-height: 100vh;
	display: grid;
	place-items: center;
	padding: 16px;
}

.login .panel {
	width: min(400px, 100%);
	display: flex;
	flex-direction: column;
	gap: 14px;
	padding: 28px;
	box-shadow: inset 3px 0 0 var(--accent);
}

.login .brand {
	margin-bottom: 6px;
}

dialog {
	border: 1px solid var(--edge-strong);
	background: var(--panel);
	color: var(--text);
	padding: 22px 24px;
	width: min(460px, calc(100vw - 32px));
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6), inset 3px 0 0 var(--hot);
}

dialog::backdrop {
	background: rgba(2, 3, 6, 0.72);
}

dialog h2 {
	margin-bottom: 8px;
}

dialog p {
	color: var(--text-dim);
	margin: 0 0 16px;
	white-space: pre-line;
}

dialog .form-row {
	justify-content: flex-end;
	margin-top: 8px;
}

.toasts {
	position: fixed;
	right: 16px;
	bottom: 16px;
	display: flex;
	flex-direction: column;
	gap: 8px;
	z-index: 50;
}

.toast {
	background: #05070b;
	border: 1px solid var(--edge-strong);
	padding: 10px 16px;
	max-width: 380px;
	box-shadow: inset 3px 0 0 var(--green), 0 10px 30px rgba(0, 0, 0, 0.5);
}

.toast.bad {
	box-shadow: inset 3px 0 0 var(--red), 0 10px 30px rgba(0, 0, 0, 0.5);
}

/* --- Phones and narrow windows ------------------------------------------------------------ */

@media (max-width: 1100px) {
	.grid.three {
		grid-template-columns: minmax(0, 1fr);
	}
}

@media (max-width: 860px) {
	.shell {
		grid-template-columns: minmax(0, 1fr);
	}

	.side {
		position: static;
		height: auto;
		flex-direction: row;
		flex-wrap: wrap;
		align-items: center;
		gap: 10px 16px;
		padding: 12px 16px;
		border-right: 0;
		border-bottom: 1px solid var(--edge);
	}

	.nav {
		flex-direction: row;
		flex-wrap: wrap;
		order: 3;
		width: 100%;
	}

	.nav a {
		padding: 8px 12px;
		font-size: 14px;
	}

	.who {
		margin: 0 0 0 auto;
		flex-direction: row;
		align-items: center;
		gap: 10px;
	}

	.who-role {
		margin: 0;
	}

	.main {
		padding: 18px 16px 48px;
	}

	.grid.two {
		grid-template-columns: minmax(0, 1fr);
	}

	h1 {
		font-size: 24px;
	}

	.player-head h1 {
		font-size: 28px;
	}
}
