/* ==========================================================================
   Drift Team — launcher pages
   Sections: tokens / base / backdrop / topbar / ads / layout / cards /
             controls / player card / home / garage / shop / coins / settings /
             gamepad / logout / car / dialog / track select / sign in / admin / drawer / responsive
   ========================================================================== */

/* --- Tokens --------------------------------------------------------------- */

:root {
	--bg: #0c0c0e;
	--grit: url("../assets/grit-tile.png");
	--metal: #1c1c1f;
	--yellow: #ffcc1a;
	--yellow-2: #ffe14a;
	--yellow-deep: #e0a800;
	--red: #f31b20;
	--red-2: #f26065;
	--green: #2f8a3a;
	--gold: #f5d76e;
	--text: #f7f3ea;
	--text-dim: #c8bfae;
	--text-faint: #9a9284;
	--ink: #1a160f;
	--line: rgba(255, 255, 255, 0.14);
	--line-soft: rgba(255, 255, 255, 0.08);
	--edge-gold: rgba(255, 189, 15, 0.22);
	--surface: #141210;
	--surface-2: #1a1a1c;
	--shadow: 0 16px 28px rgba(0, 0, 0, 0.55);
	--radius: 14px;
	--radius-sm: 10px;
	--header-h: 64px;
	--panel-w: 540px;
	--wide-w: 1040px;
	--gap: 14px;
	--font-display: "Anton", "Barlow Condensed", sans-serif;
	--font-cond: "Barlow Condensed", "Anton", sans-serif;
	--font-ui: Inter, system-ui, sans-serif;
}

/* --- Base ----------------------------------------------------------------- */

*,
*::before,
*::after {
	box-sizing: border-box;
	margin: 0;
	padding: 0;
}

html,
body {
	min-height: 100%;
	background: var(--bg);
	color: var(--text);
	font-family: var(--font-ui);
}

body {
	/* `clip` rather than `hidden` so it does not become a scroll container and break position: sticky. */
	overflow-x: clip;
}

/*
 * The `hidden` attribute is the only visibility mechanism the page scripts use, so it has to beat every
 * component `display` rule below.  Without this, anything set to display:flex/grid stays on screen when hidden.
 */
[hidden] {
	display: none !important;
}

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

img {
	display: block;
	max-width: 100%;
}

:focus-visible {
	outline: 2px solid var(--yellow);
	outline-offset: 2px;
	border-radius: 4px;
}

.svg-defs {
	position: absolute;
	width: 0;
	height: 0;
	overflow: hidden;
}

/* --- Backdrop ------------------------------------------------------------- */

.page-bg {
	position: fixed;
	inset: 0;
	z-index: 0;
	overflow: hidden;
	pointer-events: none;
}

.page-bg img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: 58% 55%;
	filter: blur(6px) saturate(0.45);
}

.page-bg::after {
	content: "";
	position: absolute;
	inset: 0;
	background:
		radial-gradient(ellipse 52% 72% at 50% 42%, rgba(8, 6, 5, 0.42) 0%, rgba(8, 6, 5, 0.18) 58%, rgba(8, 6, 5, 0.5) 100%),
		linear-gradient(180deg, rgba(8, 6, 5, 0.28) 0%, transparent 18%, rgba(8, 6, 5, 0.45) 100%);
}

.grain {
	pointer-events: none;
	position: fixed;
	inset: 0;
	z-index: 80;
	opacity: 0.22;
	mix-blend-mode: overlay;
	background-image:
		var(--grit),
		url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)' opacity='.7'/></svg>");
	background-size: 280px 280px, 160px 160px;
}

.coins-pill {
	display: flex;
	align-items: center;
	flex: 0 0 auto;
	gap: 8px;
	height: 42px;
	padding: 0 12px 0 14px;
	border: 1px solid rgba(254, 223, 80, 0.22);
	border-radius: 999px;
	text-decoration: none;
	color: inherit;
	background:
		linear-gradient(180deg, rgba(70, 52, 12, 0.55), rgba(18, 14, 8, 0.9)),
		var(--grit),
		#16120a;
	background-size: auto, 140px 140px, auto;
	cursor: pointer;
	transition: box-shadow 0.18s;
}

.coins-pill:hover {
	box-shadow: 0 4px 14px rgba(224, 168, 0, 0.35);
}

.coins-value {
	font-family: var(--font-cond);
	font-weight: 700;
	font-size: 20px;
	letter-spacing: 0.04em;
	color: var(--gold);
	text-shadow: 0 0 12px rgba(254, 223, 80, 0.28);
	font-variant-numeric: tabular-nums;
}

.coin-img {
	width: 22px;
	height: 22px;
}

/* --- Ads ------------------------------------------------------------------ */

.ad-wrap {
	position: relative;
	z-index: 1;
	display: flex;
	justify-content: center;
	padding: 14px 16px 0;
}

/* Set on <html> before first paint, so VIPs never see the slot reserve space. */
.is-vip .ad-wrap {
	display: none;
}

.ad-slot {
	width: min(970px, 100%);
	min-height: 250px;
	display: grid;
	place-items: center;
	overflow: hidden;
	border-radius: var(--radius-sm);
	background: rgba(0, 0, 0, 0.28);
	box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

.ad-slot-mobile {
	display: none;
	width: 320px;
	min-height: 50px;
}

/* --- Layout --------------------------------------------------------------- */

.launcher {
	position: relative;
	z-index: 1;
	display: flex;
	justify-content: center;
	padding: 22px 16px 40px;
}

.panel {
	width: min(var(--panel-w), 100%);
	display: flex;
	flex-direction: column;
	gap: var(--gap);
}

/*
 * Two ways to use the extra room on a desktop screen:
 *   .panel-wide  — the whole page grows (car page, shop).
 *   .panel-bleed — one section grows out of an otherwise narrow page (the track carousel).
 */
@media (min-width: 1040px) {
	.panel-wide {
		width: min(var(--wide-w), 100%);
	}

	.panel-bleed {
		width: min(var(--wide-w), calc(100vw - 48px));
		margin-left: calc((min(var(--wide-w), 100vw - 48px) - 100%) / -2);
	}
}

.page-head {
	display: flex;
	align-items: center;
	gap: 10px;
	min-width: 0;
}

.page-back {
	display: grid;
	place-items: center;
	flex: 0 0 auto;
	width: 34px;
	height: 34px;
	border-radius: 50%;
	color: var(--text-dim);
	text-decoration: none;
	background: rgba(0, 0, 0, 0.35);
	border: 1px solid var(--line-soft);
	transition: color 0.18s, border-color 0.18s;
}

.page-back svg {
	width: 18px;
	height: 18px;
}

.page-back:hover {
	color: var(--yellow);
	border-color: rgba(255, 189, 15, 0.4);
}

.page-heading {
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	font-family: var(--font-display);
	font-size: 34px;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	line-height: 1.1;
	color: #f4f4f4;
	text-shadow: 0 2px 4px rgba(0, 0, 0, 0.65);
}

/* --- Cards ---------------------------------------------------------------- */

.card {
	border-radius: 12px;
	border: 1px solid var(--edge-gold);
	box-shadow: var(--shadow);
	padding: var(--gap);
	background:
		linear-gradient(180deg, rgba(255, 255, 255, 0.06), transparent 40%),
		var(--grit),
		var(--surface);
	background-size: auto, 170px 170px, auto;
}

.card-head {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 10px;
	flex-wrap: wrap;
	margin-bottom: 10px;
}

.card-kicker {
	font-family: var(--font-cond);
	font-weight: 700;
	letter-spacing: 0.16em;
	text-transform: uppercase;
	font-size: 13px;
	color: var(--text-dim);
}

.card-count {
	font-family: var(--font-cond);
	font-weight: 700;
	font-size: 13px;
	letter-spacing: 0.08em;
	color: var(--text-faint);
	font-variant-numeric: tabular-nums;
}

.card-note {
	margin-top: 10px;
	text-align: center;
	font-family: var(--font-cond);
	font-weight: 600;
	letter-spacing: 0.06em;
	font-size: 14px;
	color: var(--text-faint);
}

.card-msg {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 12px;
	padding: 20px var(--gap);
}

.card-msg-copy {
	font-family: var(--font-cond);
	font-weight: 600;
	letter-spacing: 0.06em;
	font-size: 16px;
	color: var(--text-dim);
	text-align: center;
}

.card-msg .btn {
	min-width: 160px;
}

/* --- Notifications ------------------------------------------------------- */

.notification-card {
	padding-bottom: 4px;
}

.text-btn {
	border: 0;
	background: none;
	color: var(--yellow);
	font-family: var(--font-cond);
	font-weight: 700;
	font-size: 14px;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	cursor: pointer;
}

.text-btn:hover {
	color: var(--yellow-2);
}

.notification-list {
	display: flex;
	flex-direction: column;
}

.notification-row {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 13px 2px;
	border-top: 1px solid var(--line-soft);
	transition: opacity 0.18s;
}

.notification-row.is-busy {
	opacity: 0.45;
	pointer-events: none;
}

.notification-copy {
	min-width: 0;
	flex: 1;
}

.notification-message {
	font-size: 14px;
	line-height: 1.45;
	color: var(--text-dim);
}

.notification-from {
	color: var(--text);
	font-weight: 700;
	text-decoration: none;
}

.notification-from:hover {
	color: var(--yellow);
}

.notification-when {
	display: block;
	margin-top: 3px;
	font-family: var(--font-cond);
	font-size: 13px;
	font-weight: 600;
	letter-spacing: 0.06em;
	color: var(--text-faint);
}

.notification-actions {
	display: flex;
	align-items: center;
	gap: 4px;
	flex: 0 0 auto;
}

.notification-view {
	padding: 7px 9px;
	border-radius: 7px;
	background: rgba(255, 204, 26, 0.12);
	color: var(--yellow);
	font-family: var(--font-cond);
	font-size: 13px;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-decoration: none;
	text-transform: uppercase;
}

.notification-view:hover {
	background: rgba(255, 204, 26, 0.2);
	color: var(--yellow-2);
}

.notification-dismiss {
	display: grid;
	place-items: center;
	width: 32px;
	height: 32px;
	border: 0;
	border-radius: 7px;
	background: transparent;
	color: var(--text-faint);
	cursor: pointer;
}

.notification-dismiss:hover {
	background: rgba(243, 27, 32, 0.14);
	color: var(--red-2);
}

.notification-dismiss svg {
	width: 18px;
	height: 18px;
}

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

.btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	padding: 12px 16px;
	border: 0;
	border-radius: var(--radius-sm);
	text-decoration: none;
	color: var(--text);
	cursor: pointer;
	font-family: var(--font-display);
	font-size: 20px;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	line-height: 1.1;
	background:
		linear-gradient(180deg, var(--red), var(--yellow)) 0 0 / 5px 100% no-repeat,
		linear-gradient(180deg, rgba(255, 255, 255, 0.09) 0%, rgba(255, 255, 255, 0) 18%, rgba(0, 0, 0, 0.28) 100%),
		var(--surface-2);
	transition: color 0.18s, filter 0.18s;
}

.btn svg {
	width: 22px;
	height: 22px;
	flex-shrink: 0;
}

.btn:hover {
	color: var(--yellow);
	filter: brightness(1.08);
}

.btn:disabled {
	opacity: 0.4;
	cursor: default;
	filter: none;
	color: var(--text);
}

.btn-primary {
	color: var(--ink);
	background: linear-gradient(180deg, var(--yellow-2), var(--yellow));
	box-shadow: 0 0 18px rgba(255, 189, 15, 0.22);
}

.btn-primary:hover {
	color: var(--ink);
}

.btn-buy {
	background:
		linear-gradient(180deg, var(--green), #1b5c24) 0 0 / 5px 100% no-repeat,
		linear-gradient(180deg, rgba(255, 255, 255, 0.09) 0%, rgba(255, 255, 255, 0) 18%, rgba(0, 0, 0, 0.28) 100%),
		#143318;
}

.btn-sell {
	background:
		linear-gradient(180deg, var(--red), #8a1216) 0 0 / 5px 100% no-repeat,
		linear-gradient(180deg, rgba(255, 255, 255, 0.09) 0%, rgba(255, 255, 255, 0) 18%, rgba(0, 0, 0, 0.28) 100%),
		#2a1212;
}

.chip-row {
	display: flex;
	gap: 6px;
	flex-wrap: wrap;
}

.chip {
	padding: 6px 12px;
	border: 1px solid rgba(255, 255, 255, 0.12);
	border-radius: 999px;
	background: rgba(0, 0, 0, 0.28);
	color: var(--text-dim);
	font-family: var(--font-cond);
	font-weight: 700;
	font-size: 13px;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	cursor: pointer;
	white-space: nowrap;
	transition: color 0.18s, border-color 0.18s;
}

.chip:hover {
	color: var(--text);
	border-color: rgba(255, 189, 15, 0.4);
}

.chip.is-selected {
	color: var(--ink);
	background: linear-gradient(180deg, var(--yellow-2), var(--yellow));
	border-color: var(--yellow);
}

.price {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	padding: 2px 8px;
	border-radius: 8px;
	background: rgba(0, 0, 0, 0.5);
	font-family: var(--font-cond);
	font-weight: 800;
	font-size: 17px;
	letter-spacing: 0.02em;
	color: var(--gold);
	font-variant-numeric: tabular-nums;
}

.price img {
	width: 17px;
	height: 17px;
}

.price-lg {
	font-size: 24px;
	padding: 4px 12px;
}

.price-lg img {
	width: 22px;
	height: 22px;
}

.short-coins {
	text-align: center;
	color: var(--red-2);
	font-family: var(--font-cond);
	font-weight: 800;
	font-size: 13px;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	margin-bottom: 10px;
}

.form-status {
	text-align: center;
	font-family: var(--font-cond);
	font-weight: 700;
	color: var(--yellow);
}

/* --- Player card ---------------------------------------------------------- */

.player-card {
	border-radius: 12px;
	border: 1px solid var(--edge-gold);
	box-shadow: var(--shadow);
}

.player-card > :first-child {
	border-top-left-radius: inherit;
	border-top-right-radius: inherit;
}

.player-card > :last-child {
	border-bottom-left-radius: inherit;
	border-bottom-right-radius: inherit;
}

.player-card-top {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	padding: 10px 12px;
	background:
		linear-gradient(180deg, rgba(255, 253, 243, 0.9), rgba(239, 230, 200, 0.86)),
		var(--grit),
		#efe6c8;
	background-size: auto, 170px 170px, auto;
	backdrop-filter: blur(3px);
}

.player-identity {
	display: flex;
	align-items: center;
	gap: 10px;
	min-width: 0;
	flex: 1;
	text-decoration: none;
	color: #5c5348;
}

.player-avatar {
	width: 42px;
	height: 42px;
	flex: 0 0 auto;
	border-radius: 50%;
	object-fit: cover;
	background: #efe6c8;
	border: 2px solid #f4ead4;
	box-shadow: 0 0 0 1px #c1b9a6;
}

.player-name {
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	font-family: var(--font-cond);
	font-weight: 600;
	font-size: 22px;
	letter-spacing: 0.03em;
}

.player-identity:hover .player-name {
	color: #8a6a10;
}

.player-card-bonus {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	min-height: 48px;
	padding: 10px 14px;
	background:
		linear-gradient(180deg, rgba(255, 255, 255, 0.06), transparent 40%),
		var(--grit),
		var(--surface);
	background-size: auto, 170px 170px, auto;
	backdrop-filter: blur(3px);
}

.player-card-bonus[role="button"] {
	cursor: pointer;
}

.player-card-bonus.is-claimable {
	padding-left: 18px;
	background:
		linear-gradient(180deg, var(--yellow-2), var(--yellow-deep)) 0 0 / 5px 100% no-repeat,
		linear-gradient(180deg, rgba(255, 204, 26, 0.14), transparent 55%),
		linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent 40%),
		var(--grit),
		var(--surface);
	background-size: 5px 100%, auto, auto, 170px 170px, auto;
	background-repeat: no-repeat, no-repeat, no-repeat, repeat, no-repeat;
	box-shadow:
		inset 0 1px 0 rgba(255, 255, 255, 0.16),
		inset 0 -2px 0 rgba(0, 0, 0, 0.45),
		0 0 18px rgba(255, 189, 15, 0.22);
	transition: filter 0.18s, transform 0.18s;
}

.player-card-bonus.is-claimable:hover {
	filter: brightness(1.08);
}

.player-card-bonus.is-claimable:active {
	transform: translateY(1px);
	filter: brightness(0.98);
}

.player-card-bonus.is-collecting {
	pointer-events: none;
}

.player-card-bonus.is-claimable .bonus-timer-label {
	display: none;
}

.player-card-bonus.is-claimable .bonus-countdown {
	color: var(--ink);
	font-family: var(--font-display);
	font-size: 20px;
	font-weight: 400;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	padding: 7px 14px;
	border-radius: var(--radius-sm);
	background: linear-gradient(180deg, var(--yellow-2), var(--yellow));
	box-shadow:
		inset 0 1px 0 rgba(255, 255, 255, 0.35),
		0 2px 8px rgba(0, 0, 0, 0.35);
}

.bonus-left,
.bonus-right {
	display: flex;
	align-items: center;
	gap: 8px;
}

.bonus-dot {
	width: 9px;
	height: 9px;
	border-radius: 50%;
	background: var(--yellow);
	box-shadow: 0 0 10px var(--yellow);
}

.player-card-bonus.is-claimable .bonus-dot {
	animation: bonus-pulse 1.8s ease-in-out infinite;
}

@keyframes bonus-pulse {
	0%, 100% { box-shadow: 0 0 6px var(--yellow); }
	50% { box-shadow: 0 0 16px var(--yellow); }
}

.bonus-kicker {
	font-family: var(--font-cond);
	font-weight: 700;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	font-size: 13px;
	color: var(--text-dim);
}

.bonus-num {
	font-family: var(--font-cond);
	font-weight: 800;
	font-size: 22px;
	color: var(--gold);
	letter-spacing: 0.03em;
	font-variant-numeric: tabular-nums;
}

.bonus-timer-label {
	font-family: var(--font-cond);
	font-weight: 600;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	font-size: 11px;
	color: var(--text-dim);
}

.bonus-countdown {
	font-family: var(--font-cond);
	font-weight: 800;
	font-size: 22px;
	letter-spacing: 0.04em;
	color: var(--yellow);
	font-variant-numeric: tabular-nums;
}

/* --- Home: mode buttons --------------------------------------------------- */

.modes {
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.mode {
	position: relative;
	display: block;
	width: 100%;
	border: 0;
	border-radius: var(--radius);
	overflow: hidden;
	color: inherit;
	text-decoration: none;
	background:
		linear-gradient(180deg, var(--red), var(--yellow)) 0 0 / 5px 100% no-repeat,
		linear-gradient(180deg, rgba(255, 255, 255, 0.09) 0%, rgba(255, 255, 255, 0) 18%, rgba(0, 0, 0, 0.28) 100%),
		var(--grit),
		var(--surface-2);
	background-size: 5px 100%, auto, 170px 170px, auto;
	background-repeat: no-repeat, no-repeat, repeat, no-repeat;
	cursor: pointer;
	text-align: left;
	filter: drop-shadow(0 12px 18px rgba(0, 0, 0, 0.48));
	box-shadow:
		inset 0 1px 0 rgba(255, 255, 255, 0.16),
		inset 0 -2px 0 rgba(0, 0, 0, 0.45);
	transition: transform 0.18s, filter 0.18s;
}

.mode::after {
	content: "";
	position: absolute;
	inset: 0;
	pointer-events: none;
	opacity: 0.28;
	mix-blend-mode: overlay;
	background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='120' height='120'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='1.1' numOctaves='3' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

.mode-body {
	position: relative;
	z-index: 1;
	display: flex;
	align-items: center;
	gap: 16px;
	padding: 18px 20px 18px 24px;
	min-height: 88px;
}

.mode-featured .mode-body {
	min-height: 100px;
}

.mode-icon {
	flex: 0 0 auto;
	width: 44px;
	height: 44px;
	display: grid;
	place-items: center;
}

.mode-icon svg {
	width: 36px;
	height: 36px;
	filter:
		drop-shadow(0 1px 0 rgba(255, 240, 180, 0.35))
		drop-shadow(0 2px 3px rgba(0, 0, 0, 0.55));
}

.mode-copy {
	display: flex;
	flex-direction: column;
	gap: 3px;
	min-width: 0;
}

.mode-title {
	font-family: var(--font-display);
	font-size: 30px;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	line-height: 1;
	color: #f4f4f4;
	padding-bottom: 7px;
	border-bottom: 1px solid rgba(255, 255, 255, 0.1);
	width: fit-content;
	text-shadow:
		0 1px 0 rgba(255, 255, 255, 0.12),
		0 2px 4px rgba(0, 0, 0, 0.65);
}

.mode-featured .mode-title {
	font-size: 32px;
}

.mode-sub {
	font-size: 13px;
	color: #b8b3a8;
}

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

.mode:hover {
	transform: translateY(-2px);
	filter: brightness(1.08) drop-shadow(0 14px 24px rgba(0, 0, 0, 0.45));
}

.mode:active {
	transform: translateY(1px);
}

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

.mode-small .mode-body {
	min-height: 78px;
	padding: 14px 16px;
	gap: 10px;
}

.mode-small .mode-title {
	font-size: 20px;
	border-bottom: 0;
	padding-bottom: 0;
}

.mode-small .mode-icon {
	width: 40px;
	height: 40px;
}

.mode-small .mode-icon svg {
	width: 32px;
	height: 32px;
}

/* --- Home: social + stats ------------------------------------------------- */

.social {
	display: flex;
	justify-content: space-between;
	gap: 8px;
}

.social-btn {
	flex: 1;
	height: 48px;
	display: grid;
	place-items: center;
	border-radius: 12px;
	border: 0;
	background:
		linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent 40%),
		var(--grit),
		var(--surface-2);
	background-size: auto, 160px 160px, auto;
	color: #fff;
	text-decoration: none;
	cursor: pointer;
	box-shadow:
		0 8px 16px rgba(0, 0, 0, 0.35),
		inset 0 1px 0 rgba(255, 255, 255, 0.12),
		inset 0 -2px 0 rgba(0, 0, 0, 0.4);
	transition: transform 0.18s, filter 0.18s;
}

.social-btn:nth-child(1) { color: #8ea1ff; }
.social-btn:nth-child(2) { color: #f4f4f4; }
.social-btn:nth-child(3) { color: #4c9dff; }
.social-btn:nth-child(4) { color: #7dcc88; }
.social-btn:nth-child(5) { color: var(--yellow); }

.social-btn svg {
	width: 22px;
	height: 22px;
}

.social-btn:hover {
	transform: translateY(-2px);
	filter: brightness(1.12);
}

.stats {
	position: relative;
	isolation: isolate;
	display: grid;
	grid-template-columns: 1fr 1fr;
	border-radius: 12px;
	background:
		linear-gradient(180deg, rgba(255, 255, 255, 0.05), transparent 40%),
		rgba(10, 10, 12, 0.58);
	border: 1px solid var(--line-soft);
	box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.07);
	overflow: hidden;
	backdrop-filter: blur(3px);
}

.stats::before {
	content: "";
	position: absolute;
	inset: 0;
	pointer-events: none;
	background-image:
		var(--grit),
		url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='140' height='140'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.95' numOctaves='4' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
	background-size: 200px 200px, 140px 140px;
	opacity: 0.28;
	mix-blend-mode: overlay;
}

.stat {
	position: relative;
	z-index: 1;
	padding: 16px 14px 18px;
	text-align: center;
	color: inherit;
	text-decoration: none;
	cursor: pointer;
	transition: background 0.18s, filter 0.18s;
}

.stat:hover {
	filter: brightness(1.12);
	background: rgba(255, 189, 15, 0.08);
}

.stat + .stat {
	border-left: 1px solid rgba(255, 255, 255, 0.12);
}

.stat-label {
	font-family: var(--font-cond);
	font-weight: 600;
	letter-spacing: 0.16em;
	text-transform: uppercase;
	font-size: 11px;
	color: var(--text-dim);
	margin-top: 6px;
}

.stat-value {
	font-family: var(--font-display);
	font-size: 34px;
	letter-spacing: 0.03em;
	line-height: 1;
	color: var(--gold);
	text-shadow: 0 2px 4px rgba(0, 0, 0, 0.7);
	font-variant-numeric: tabular-nums;
}

.footer-links {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 6px;
	padding-top: 2px;
}

.footer-link {
	display: block;
	text-align: center;
	padding: 4px 0 2px;
	font-family: var(--font-cond);
	font-weight: 700;
	letter-spacing: 0.16em;
	text-transform: uppercase;
	font-size: 12px;
	color: var(--text-dim);
	text-decoration: none;
}

.footer-link:hover {
	color: var(--yellow);
}

/* --- Garage --------------------------------------------------------------- */

.garage-banner {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	margin-bottom: 12px;
	padding: 10px 14px;
	border-radius: var(--radius-sm);
	text-decoration: none;
	font-family: var(--font-cond);
	font-weight: 800;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	font-size: 16px;
	color: var(--ink);
	background: linear-gradient(180deg, var(--yellow-2), var(--yellow));
	box-shadow: 0 0 18px rgba(255, 189, 15, 0.28);
}

.garage-banner svg {
	width: 18px;
	height: 18px;
}

.garage-buy {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 12px;
	padding: 10px 0 4px;
}

.garage-row {
	display: grid;
	grid-template-columns: minmax(0, 1fr) 116px;
	gap: 10px;
	align-items: start;
}

.garage-actions {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.garage-actions .btn {
	font-size: 18px;
	padding: 10px 12px;
}

.car-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(78px, 1fr));
	gap: 6px;
}

.car-tile {
	position: relative;
	display: grid;
	place-items: center;
	min-height: 96px;
	padding: 10px 6px;
	border: 2px solid transparent;
	border-radius: var(--radius-sm);
	background: rgba(0, 0, 0, 0.32);
	cursor: pointer;
	color: inherit;
	transition: background 0.18s, border-color 0.18s;
}

.car-tile img {
	max-width: 100%;
	max-height: 110px;
	width: auto;
	height: auto;
	object-fit: contain;
}

.car-tile:hover {
	background: rgba(255, 212, 112, 0.16);
}

.car-tile.is-selected {
	border-color: var(--yellow);
	background: rgba(255, 228, 168, 0.2);
	cursor: default;
	box-shadow: inset 0 0 0 1px rgba(255, 189, 15, 0.35);
}

.car-boost {
	position: absolute;
	right: 4px;
	bottom: 4px;
	display: flex;
	flex-direction: column;
	gap: 2px;
	min-width: 34px;
	padding: 3px 4px 4px;
	border-radius: 5px;
	font-family: var(--font-cond);
	font-weight: 800;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--ink);
	background: var(--yellow);
}

.car-boost.is-kers {
	background: #8ef0d2;
}

.car-boost-name {
	font-size: 8px;
	line-height: 1;
	text-align: center;
}

.car-boost-pips {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 1px;
	height: 3px;
}

.car-boost-pips span {
	border-radius: 1px;
	background: rgba(0, 0, 0, 0.22);
}

.car-boost-pips span.is-on {
	background: var(--ink);
}

/* --- Shop ----------------------------------------------------------------- */

.shop-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
	gap: 8px;
}

.shop-grid.is-garage {
	grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
}

.shop-tile {
	position: relative;
	display: flex;
	flex-direction: column;
	min-width: 0;
	padding: 8px 8px 6px;
	border: 1px solid var(--line-soft);
	border-radius: var(--radius-sm);
	background: rgba(255, 255, 255, 0.05);
	text-decoration: none;
	color: inherit;
	cursor: pointer;
	transition: background 0.18s, border-color 0.18s, transform 0.18s;
}

.shop-tile:hover {
	background: rgba(255, 212, 112, 0.14);
	border-color: rgba(255, 189, 15, 0.4);
	transform: translateY(-2px);
}

.shop-tile-media {
	position: relative;
	display: grid;
	place-items: center;
	min-height: 96px;
	padding-bottom: 6px;
}

.shop-grid.is-garage .shop-tile-media {
	min-height: 76px;
}

.shop-tile-media img {
	max-width: 100%;
	max-height: 100px;
	width: auto;
	height: auto;
	object-fit: contain;
}

.shop-grid.is-garage .shop-tile-media img {
	max-height: 74px;
}

.shop-tile-foot {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	min-height: 28px;
	padding-top: 6px;
	border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.shop-tile-action {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	font-family: var(--font-cond);
	font-weight: 700;
	font-size: 14px;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: var(--text-dim);
}

.shop-tile-action svg {
	width: 16px;
	height: 16px;
}

.shop-tile:hover .shop-tile-action {
	color: var(--yellow);
}

/* Owned, unaffordable and downgrade states are called out with a badge rather than only a price treatment. */
.shop-badge {
	position: absolute;
	top: 0;
	left: 0;
	display: inline-flex;
	align-items: center;
	gap: 4px;
	padding: 2px 7px;
	border-radius: 999px;
	font-family: var(--font-cond);
	font-weight: 800;
	font-size: 11px;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: var(--ink);
	background: var(--yellow);
}

.shop-badge svg {
	width: 11px;
	height: 11px;
}

.shop-badge.is-owned {
	background: #8ef0d2;
}

.shop-badge.is-locked {
	background: rgba(0, 0, 0, 0.72);
	color: var(--text-dim);
}

.shop-tile.is-locked {
	background: rgba(255, 255, 255, 0.03);
}

.shop-tile.is-locked .shop-tile-media img {
	filter: grayscale(0.85) brightness(0.55);
}

.shop-tile.is-locked .price {
	color: var(--text-faint);
}

.shop-tile.is-owned .price {
	opacity: 0.55;
}

.shop-tile.is-downgrade .shop-tile-media img {
	filter: brightness(0.75);
}

/* --- Coins history -------------------------------------------------------- */

.coins-history {
	container-type: inline-size;
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.coins-history-row {
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto;
	align-items: center;
	gap: 12px;
	min-height: 52px;
	padding: 10px 8px;
	border-radius: 8px;
	border-bottom: 1px solid var(--line-soft);
}

.coins-history-row:last-child {
	border-bottom: 0;
}

.coins-history-row.is-skeleton {
	min-height: 48px;
	border-bottom: 0;
}

.coins-history-copy {
	display: flex;
	flex-direction: column;
	gap: 2px;
	min-width: 0;
}

.coins-history-reason {
	font-family: var(--font-cond);
	font-weight: 700;
	font-size: 16px;
	letter-spacing: 0.04em;
	color: var(--text);
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.coins-history-when {
	font-size: 12px;
	letter-spacing: 0.04em;
	color: var(--text-faint);
}

.coins-history-nums {
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 2px;
	font-variant-numeric: tabular-nums;
}

.coins-history-change {
	font-family: var(--font-cond);
	font-weight: 800;
	font-size: 16px;
	letter-spacing: 0.04em;
}

.coins-history-change.is-credit {
	color: var(--yellow);
}

.coins-history-change.is-debit {
	color: var(--red-2);
}

.coins-history-balance {
	font-size: 12px;
	letter-spacing: 0.04em;
	color: var(--text-faint);
}

@container (min-width: 440px) {
	.coins-history-nums {
		flex-direction: row;
		align-items: baseline;
		gap: 24px;
	}

	.coins-history-change,
	.coins-history-balance {
		min-width: 8ch;
		text-align: right;
	}
}

/* --- Settings ------------------------------------------------------------- */

.setting-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	min-height: 44px;
}

.setting-label {
	font-family: var(--font-cond);
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	font-size: 15px;
	color: var(--text);
}

.setting-unit-options {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
	gap: 12px;
}

.setting-toggle {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	width: 100%;
	min-height: 48px;
	margin: 4px 0;
	padding: 10px 14px;
	border: 1px solid var(--line);
	border-radius: var(--radius-sm);
	background: var(--surface-2);
	color: var(--text-dim);
	font-family: var(--font-cond);
	font-size: 18px;
	font-weight: 700;
	letter-spacing: 0.04em;
	text-align: left;
	text-transform: uppercase;
	cursor: pointer;
	transition: background 0.18s, border-color 0.18s, color 0.18s;
}

.setting-toggle[aria-pressed="true"] {
	border-color: var(--green);
	background: #205e29;
	color: var(--text);
}

.setting-toggle:hover {
	border-color: var(--text-dim);
}

.setting-toggle-state {
	display: flex;
	align-items: center;
	gap: 8px;
	flex: 0 0 auto;
	font-size: 14px;
}

.setting-toggle-check {
	display: grid;
	place-items: center;
	width: 18px;
	height: 18px;
	border: 1px solid currentColor;
	border-radius: 3px;
	font-family: var(--font-ui);
	font-size: 14px;
	line-height: 1;
}

.setting-toggle[aria-pressed="false"] .setting-toggle-check {
	color: transparent;
	border-color: var(--text-faint);
}

.setting-toggle-value {
	min-width: 3ch;
}

.setting-note {
	margin: 0 0 8px;
	font-size: 13px;
	letter-spacing: 0.03em;
	color: var(--text-faint);
}

.setting-link {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin-top: 8px;
	padding: 12px 4px 4px;
	border-top: 1px solid var(--line-soft);
	text-decoration: none;
	color: inherit;
}

.setting-link .setting-note {
	margin: 2px 0 0;
	text-transform: none;
	font-family: var(--font-ui);
}

.setting-link > span {
	display: flex;
	flex-direction: column;
	min-width: 0;
}

.setting-link svg {
	width: 18px;
	height: 18px;
	flex: 0 0 auto;
	color: var(--text-faint);
}

.setting-link:hover .setting-label,
.setting-link:hover svg {
	color: var(--yellow);
}

.setting-text-btn {
	display: block;
	margin: 10px auto 0;
	padding: 0;
	border: 0;
	background: none;
	color: var(--yellow);
	cursor: pointer;
	font-family: var(--font-cond);
	font-weight: 700;
	font-size: 15px;
	letter-spacing: 0.04em;
	text-decoration: underline;
	text-underline-offset: 3px;
}

.tune-slider.is-disabled {
	opacity: 0.45;
	pointer-events: none;
}

/* --- Gamepad -------------------------------------------------------------- */

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

.gamepad-item,
.gamepad-axis,
.gamepad-btn-option {
	display: flex;
	align-items: center;
	width: 100%;
	padding: 10px 12px;
	border: 1px solid var(--line-soft);
	border-radius: 8px;
	background: rgba(0, 0, 0, 0.28);
	color: var(--text);
	cursor: pointer;
	text-align: left;
	font-family: var(--font-cond);
	font-weight: 600;
	letter-spacing: 0.03em;
}

.gamepad-item {
	overflow-wrap: anywhere;
	line-height: 1.5;
}

.gamepad-item.is-selected,
.gamepad-axis.is-selected,
.gamepad-btn-option.is-selected {
	border-color: var(--yellow);
	box-shadow: 0 0 0 1px rgba(255, 204, 26, 0.35);
}

.gamepad-pair {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 12px;
	margin-top: 10px;
}

.gamepad-subhead {
	margin: 0 0 6px;
	font-family: var(--font-cond);
	font-weight: 700;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	font-size: 12px;
	color: var(--text-faint);
}

.gamepad-axis {
	gap: 10px;
	margin-top: 8px;
}

.gamepad-axis-num {
	flex: 0 0 42px;
	font-variant-numeric: tabular-nums;
}

.gamepad-axis-track {
	flex: 1;
	height: 12px;
	border-radius: 999px;
	background: rgba(255, 255, 255, 0.08);
	overflow: hidden;
}

.gamepad-axis-bar {
	display: block;
	height: 100%;
	width: 50%;
	background: linear-gradient(90deg, var(--yellow-deep), var(--yellow));
}

.gamepad-invert {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	margin-top: 8px;
	font-family: var(--font-cond);
	font-weight: 600;
	font-size: 14px;
	color: var(--text-dim);
}

.gamepad-btn-option {
	justify-content: center;
	margin-top: 6px;
	text-transform: uppercase;
	font-size: 13px;
}

#mapCard .card-head {
	margin-top: 18px;
}

#mapCard .card-head:first-child {
	margin-top: 0;
}

.gamepad-waiting .card-msg-copy {
	margin: 12px 0 8px;
}

.gamepad-waiting .setting-note,
.gamepad-mapping-help {
	line-height: 1.6;
}

.gamepad-actions {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 20px 16px;
	margin: 22px 0;
	padding: 20px 0;
	border-top: 1px solid var(--line);
	border-bottom: 1px solid var(--line);
}

.gamepad-action-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 8px;
}

.gamepad-action-head .setting-text-btn {
	margin: 0;
	min-height: 32px;
}

.gamepad-button-options {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 6px;
}

.gamepad-button-options.is-mapped {
	grid-template-columns: 1fr;
}

.gamepad-button-options .gamepad-btn-option {
	margin-top: 0;
}

.gamepad-btn-option,
.gamepad-axis {
	min-height: 44px;
}

.gamepad-btn-option.is-pressed {
	background: var(--green);
	color: var(--text);
}

@media (max-width: 480px) {
	.gamepad-actions {
		grid-template-columns: 1fr;
	}
}

/* --- Logout --------------------------------------------------------------- */

.logout-card {
	display: flex;
	flex-direction: column;
	align-items: stretch;
	gap: 14px;
	text-align: center;
}

.logout-copy {
	margin: 0;
	font-size: 15px;
	line-height: 1.45;
	color: var(--text-dim);
}

.logout-copy strong {
	color: var(--text);
}

.logout-card .btn,
.logout-card .btn-primary,
.logout-card a.btn {
	width: 100%;
}

.logout-or {
	margin: 4px 0;
	text-align: center;
	font-family: var(--font-cond);
	font-weight: 700;
	letter-spacing: 0.16em;
	text-transform: uppercase;
	font-size: 12px;
	color: var(--text-faint);
}

/* --- Skeletons ------------------------------------------------------------ */

.is-skeleton {
	pointer-events: none;
	border-color: transparent;
	background: linear-gradient(90deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.04));
	background-size: 200% 100%;
	animation: skeleton 1.2s ease infinite;
}

@keyframes skeleton {
	0% { background-position: 100% 0; }
	100% { background-position: -100% 0; }
}

/* --- Car page ------------------------------------------------------------- */

.car-layout {
	display: grid;
	gap: var(--gap);
	align-items: start;
}

.car-layout-main,
.car-layout-side {
	display: flex;
	flex-direction: column;
	gap: var(--gap);
	min-width: 0;
}

@media (min-width: 1000px) {
	.car-layout {
		grid-template-columns: minmax(0, 400px) minmax(0, 1fr);
	}

	.car-layout-main {
		position: sticky;
		top: calc(var(--header-h) + var(--gap));
	}
}

.car-hero {
	position: relative;
	display: grid;
	place-items: center;
	min-height: 190px;
	margin-bottom: 12px;
	padding: 16px 12px;
	border-radius: var(--radius-sm);
	background:
		radial-gradient(ellipse 60% 55% at 50% 55%, rgba(255, 189, 15, 0.1), transparent 70%),
		rgba(0, 0, 0, 0.38);
	overflow: hidden;
}

.car-hero img {
	position: relative;
	z-index: 2;
	max-width: 100%;
	max-height: 210px;
	width: auto;
	height: auto;
	object-fit: contain;
}

.car-price-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	margin-bottom: 12px;
}

.car-price-label {
	font-family: var(--font-cond);
	font-weight: 700;
	letter-spacing: 0.16em;
	text-transform: uppercase;
	font-size: 12px;
	color: var(--text-dim);
}

.car-specs {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
	gap: 0 16px;
	margin-bottom: 14px;
}

.car-specs > div {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	gap: 8px;
	padding: 6px 0;
	border-bottom: 1px solid var(--line-soft);
}

.car-specs dt {
	font-family: var(--font-cond);
	font-weight: 600;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	font-size: 12px;
	color: var(--text-dim);
}

.car-specs dd {
	font-family: var(--font-cond);
	font-weight: 800;
	font-size: 15px;
	text-align: right;
}

.car-actions {
	display: flex;
	gap: 10px;
}

.car-actions .btn {
	flex: 1;
}

/* --- Car page: boost ------------------------------------------------------ */

.boost-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
	gap: 12px;
	align-items: start;
}

.boost-col {
	display: flex;
	flex-direction: column;
	align-items: center;
	text-align: center;
	gap: 8px;
	padding: 10px;
	border: 1px solid var(--line-soft);
	border-radius: var(--radius-sm);
	background: rgba(0, 0, 0, 0.22);
}

.boost-name {
	font-family: var(--font-cond);
	font-weight: 800;
	letter-spacing: 0.16em;
	text-transform: uppercase;
	font-size: 12px;
	color: var(--text-dim);
}

.boost-bottles {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	min-height: 90px;
}

.boost-bottle {
	display: block;
	object-fit: contain;
}

.boost-bottle.is-nitrous {
	width: 34px;
	height: 90px;
}

.boost-bottle.is-kers {
	width: 38px;
	height: 88px;
}

.boost-arrow {
	display: grid;
	place-items: center;
	color: var(--yellow);
}

.boost-arrow svg {
	width: 22px;
	height: 22px;
}

.boost-col .btn {
	width: 100%;
	font-size: 17px;
	padding: 9px 12px;
}

.boost-col .short-coins {
	margin: 0;
	font-size: 12px;
}

/* --- Car page: tune ------------------------------------------------------- */

.vip-gate {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 12px;
	padding: 8px 0 6px;
}

.vip-copy {
	text-align: center;
	color: #4af;
	font-family: var(--font-cond);
	font-weight: 800;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	font-size: 20px;
	text-shadow: 0 0 8px #25a;
}

.vip-gate .btn {
	min-width: 180px;
}

.tune-form {
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.tune-set {
	border: 1px solid rgba(255, 255, 255, 0.12);
	border-radius: var(--radius-sm);
	padding: 10px 12px 12px;
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.tune-set legend {
	font-family: var(--font-cond);
	font-weight: 800;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	font-size: 13px;
	color: var(--text-dim);
	padding: 0 6px;
}

.tune-subset {
	display: flex;
	flex-direction: column;
	gap: 10px;
	padding-left: 10px;
	border-left: 2px solid var(--line-soft);
}

.tune-slider,
.tune-select,
.tune-check {
	display: flex;
	align-items: center;
	gap: 8px;
	font-family: var(--font-cond);
	font-weight: 600;
	letter-spacing: 0.04em;
}

.tune-slider {
	flex-wrap: wrap;
}

.tune-slider > span {
	width: 100%;
	text-transform: uppercase;
	font-size: 13px;
	color: var(--text-dim);
}

.tune-slider small {
	display: block;
	font-weight: 500;
	letter-spacing: 0.04em;
	text-transform: none;
	color: var(--text-faint);
}

.tune-slider input[type="range"] {
	flex: 1;
	min-width: 0;
	accent-color: var(--yellow);
}

.tune-slider output {
	min-width: 68px;
	text-align: right;
	font-weight: 800;
	color: var(--yellow);
	font-variant-numeric: tabular-nums;
}

.tune-select {
	justify-content: space-between;
	text-transform: uppercase;
	font-size: 13px;
	color: var(--text-dim);
}

.tune-select select {
	background: var(--surface-2);
	color: var(--text);
	border: 1px solid rgba(255, 255, 255, 0.16);
	border-radius: 8px;
	padding: 7px 8px;
	font-family: var(--font-cond);
	font-weight: 700;
	font-size: 15px;
	max-width: 60%;
}

.tune-check {
	font-size: 15px;
	cursor: pointer;
}

.tune-check input[type="checkbox"] {
	accent-color: var(--yellow);
	width: 17px;
	height: 17px;
}

/* Colour pickers read as controls rather than bare swatches: label + checkbox + colour in one pill. */
.swatch-row {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(122px, 1fr));
	gap: 8px;
}

.swatch {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 6px 8px;
	border: 1px solid var(--line-soft);
	border-radius: 8px;
	background: rgba(0, 0, 0, 0.28);
	cursor: pointer;
}

.swatch input[type="checkbox"] {
	accent-color: var(--yellow);
	width: 16px;
	height: 16px;
	flex: 0 0 auto;
}

.swatch-label {
	flex: 1;
	min-width: 0;
	font-family: var(--font-cond);
	font-weight: 700;
	font-size: 13px;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--text-dim);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.swatch input[type="color"] {
	flex: 0 0 auto;
	width: 34px;
	height: 22px;
	border: 1px solid rgba(255, 255, 255, 0.2);
	border-radius: 5px;
	background: transparent;
	padding: 0;
	cursor: pointer;
}

.swatch:has(input[type="checkbox"]:not(:checked)) input[type="color"] {
	opacity: 0.3;
}

.swatch:has(input[type="checkbox"]:checked) {
	border-color: rgba(255, 189, 15, 0.4);
}

.swatch:has(input[type="checkbox"]:checked) .swatch-label {
	color: var(--text);
}

.tune-save {
	display: flex;
	flex-direction: column;
	gap: 8px;
	position: sticky;
	bottom: 0;
	padding-top: 8px;
	background: linear-gradient(180deg, transparent, var(--surface) 40%);
}

.tune-save .btn {
	width: 100%;
}

/* Dialog surfaces and headers live in dialogs.css. */

.confirm-actions {
	display: flex;
	gap: 8px;
}

.confirm-actions .btn {
	flex: 1;
}

/* --- Track select --------------------------------------------------------- */

.track-select {
	border-radius: 12px;
	border: 1px solid var(--edge-gold);
	box-shadow: var(--shadow);
	padding: var(--gap);
	background:
		linear-gradient(180deg, rgba(255, 255, 255, 0.06), transparent 40%),
		var(--grit),
		var(--surface);
	background-size: auto, 170px 170px, auto;
}

.track-select-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	flex-wrap: wrap;
	margin-bottom: 10px;
}

.track-select-kicker {
	font-family: var(--font-cond);
	font-weight: 700;
	letter-spacing: 0.16em;
	text-transform: uppercase;
	font-size: 13px;
	color: var(--text-dim);
}

.track-select-cats {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	padding-bottom: 2px;
}

.track-select-cats .chip {
	flex: 0 0 auto;
	min-height: 44px;
	padding: 10px 16px;
	border-radius: 8px;
	font: 600 13px/1.4 Inter, sans-serif;
	letter-spacing: 0;
	text-transform: none;
}

.track-select-custom-wrap {
	margin: 10px 0 2px;
}

.track-select-custom {
	width: 100%;
	padding: 9px 12px;
	border-radius: var(--radius-sm);
	border: 1px solid var(--line);
	background: rgba(0, 0, 0, 0.35);
	color: var(--text);
	font-family: var(--font-cond);
	font-weight: 700;
	font-size: 15px;
	letter-spacing: 0.06em;
}

.track-select-stage {
	position: relative;
	margin-top: 12px;
}

.track-select-scroller {
	display: flex;
	gap: 10px;
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	scrollbar-width: none;
	-webkit-overflow-scrolling: touch;
	padding: 2px 2px 6px;
	touch-action: pan-x pan-y pinch-zoom;
}

.track-select-scroller::-webkit-scrollbar {
	display: none;
}

.track-select-nav {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	z-index: 2;
	width: 34px;
	height: 34px;
	border: 0;
	border-radius: 50%;
	display: grid;
	place-items: center;
	cursor: pointer;
	color: var(--ink);
	background: linear-gradient(180deg, var(--yellow-2), var(--yellow));
	box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
	transition: opacity 0.18s;
}

.track-select-nav svg {
	width: 16px;
	height: 16px;
	fill: none;
	stroke: currentColor;
	stroke-width: 2.2;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.track-select-nav.is-prev {
	left: -6px;
}

.track-select-nav.is-next {
	right: -6px;
}

.track-select-nav:disabled {
	opacity: 0;
	pointer-events: none;
}

.track-select-sentinel {
	flex: 0 0 1px;
	width: 1px;
	align-self: stretch;
}

.track-item {
	flex: 0 0 210px;
	width: 210px;
	scroll-snap-align: start;
	list-style: none;
}

.track-card {
	position: relative;
	display: flex;
	flex-direction: column;
	width: 100%;
	overflow: hidden;
	border-radius: 12px;
	clip-path: inset(0 round 12px);
	isolation: isolate;
	text-decoration: none;
	color: inherit;
	background: #0d0c0b;
	border: 1px solid var(--line-soft);
	box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
	transition: transform 0.16s, border-color 0.16s;
}

.track-card:hover {
	transform: translateY(-2px);
	border-color: rgba(255, 189, 15, 0.45);
}

.track-card-thumb,
.track-card-body {
	min-width: 0;
	max-width: 100%;
}

.track-card-thumb {
	position: relative;
	aspect-ratio: 1;
	width: 100%;
	overflow: hidden;
	border-radius: 12px;
	background:
		radial-gradient(ellipse at 50% 40%, rgba(255, 189, 15, 0.12), transparent 60%),
		#0d0c0b;
}

.track-card-thumb.is-empty {
	background:
		repeating-linear-gradient(-45deg, rgba(255, 255, 255, 0.04) 0 8px, transparent 8px 16px),
		#121110;
}

.track-card-img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: contain;
	border-radius: 12px;
}

.track-card-body {
	display: flex;
	flex-direction: column;
	gap: 3px;
	padding: 12px 10px;
	overflow: hidden;
	background: #171719;
}

.track-card-head {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 8px;
	min-width: 0;
}

.track-card-creator {
	font-family: var(--font-cond);
	font-weight: 800;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	font-size: 14px;
	color: var(--yellow);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	min-width: 0;
}

.track-card-length {
	flex-shrink: 0;
	font-family: var(--font-cond);
	font-weight: 700;
	font-size: 13px;
	letter-spacing: 0.04em;
	color: #f7f3ea;
}

.track-card-desc {
	min-width: 0;
	min-height: 2.6em;
	font-size: 12px;
	line-height: 1.3;
	color: #e8e0d2;
	overflow: hidden;
	overflow-wrap: anywhere;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	line-clamp: 2;
	-webkit-box-orient: vertical;
}

.track-card-desc.is-empty {
	font-style: italic;
	opacity: 0.7;
}

.track-card-meta {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	min-width: 0;
	font-family: var(--font-cond);
	font-weight: 700;
	letter-spacing: 0.04em;
	font-size: 13px;
}

.track-card-coins {
	display: flex;
	align-items: center;
	gap: 4px;
	color: var(--yellow);
}

.track-card-coin {
	width: 14px;
	height: 14px;
}

.track-carousel-loading {
	flex: 0 0 210px;
	width: 210px;
	min-height: 310px;
	border-radius: 12px;
	scroll-snap-align: start;
}

@media (prefers-reduced-motion: reduce) { .track-carousel-loading { animation: none; } }

.track-select-status.is-loading {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
}

.track-select-status {
	font-family: var(--font-cond);
	font-weight: 600;
	letter-spacing: 0.06em;
	font-size: 15px;
	color: var(--text-dim);
	text-align: center;
	padding: 10px 4px 2px;
}

.track-admin-link {
	display: block;
	margin-top: 4px;
	font-size: 11px;
	line-height: 1.2;
	color: var(--text-dim);
	text-decoration: underline;
	text-underline-offset: 2px;
}

/* --- Sign in -------------------------------------------------------------- */

.signin-card {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 14px;
	text-align: center;
}

.signin-lock {
	display: grid;
	place-items: center;
	width: 44px;
	height: 44px;
	border-radius: 50%;
	color: var(--yellow);
	background: rgba(0, 0, 0, 0.35);
	border: 1px solid var(--line-soft);
}

.signin-lock svg {
	width: 22px;
	height: 22px;
}

.signin-title {
	margin: 0;
	font-family: var(--font-display);
	font-size: 28px;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: #f4f4f4;
}

.signin-copy {
	margin: 0;
	max-width: 32em;
	font-family: var(--font-cond);
	font-weight: 600;
	letter-spacing: 0.04em;
	font-size: 16px;
	color: var(--text-dim);
}

.signin-note,
.signin-tip {
	margin: 0;
	max-width: 32em;
	font-size: 13px;
	line-height: 1.45;
	color: var(--text-faint);
}

.signin-providers {
	display: flex;
	flex-direction: column;
	align-items: stretch;
	gap: 10px;
	width: min(100%, 280px);
}

.signin-or {
	font-family: var(--font-cond);
	font-weight: 700;
	letter-spacing: 0.16em;
	text-transform: uppercase;
	font-size: 12px;
	color: var(--text-faint);
}

.signin-provider {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 44px;
	padding: 10px 14px;
	border-radius: var(--radius-sm);
	border: 1px solid rgba(255, 255, 255, 0.16);
	cursor: pointer;
	font-family: var(--font-cond);
	font-weight: 700;
	font-size: 16px;
	letter-spacing: 0.04em;
}

.signin-provider:disabled {
	opacity: 0.45;
	cursor: default;
}

.signin-provider-google {
	color: #1f1f1f;
	background: #fff;
}

.signin-provider-discord {
	color: #fff;
	background: #5865f2;
	border-color: #5865f2;
}

.signin-form {
	display: flex;
	flex-direction: column;
	gap: 18px;
	width: 100%;
	text-align: left;
}

.signin-form .btn {
	align-self: center;
	min-width: 180px;
	margin-top: 4px;
}

#profileDetails {
	display: flex;
	flex-direction: column;
	gap: 18px;
	width: 100%;
	min-width: 0;
}

.signin-identity {
	display: flex;
	align-items: center;
	gap: 12px;
}

.signin-photo {
	display: grid;
	padding: 0;
	border: 0;
	background: none;
	font-family: var(--font-ui);
	justify-items: center;
	gap: 4px;
	flex: 0 0 auto;
	cursor: pointer;
	font-size: 11px;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--text-faint);
}

.signin-photo img {
	width: 64px;
	height: 64px;
	border-radius: 50%;
	object-fit: cover;
	background: rgba(0, 0, 0, 0.35);
	border: 1px solid var(--line-soft);
}

.signin-name,
.signin-select {
	display: flex;
	flex-direction: column;
	gap: 8px;
	flex: 1;
	min-width: 0;
	font-family: var(--font-cond);
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	font-size: 12px;
	color: var(--text-dim);
}

.signin-name input,
.signin-select input,
.signin-select select {
	width: 100%;
	min-height: 42px;
	padding: 8px 10px;
	border-radius: var(--radius-sm);
	border: 1px solid var(--line-soft);
	background: rgba(0, 0, 0, 0.35);
	color: var(--text);
	font-family: var(--font-ui);
	font-size: 16px;
	text-transform: none;
	letter-spacing: 0;
	font-weight: 500;
}

.signin-country-row {
	display: flex;
	align-items: center;
	gap: 10px;
}

.signin-country-row select {
	flex: 1;
	min-width: 0;
	width: auto;
}

.signin-flag {
	width: 72px;
	height: 36px;
	flex: 0 0 auto;
	object-fit: cover;
	border: 1px solid var(--line-soft);
	background: rgba(0, 0, 0, 0.35);
}

.signin-choice {
	margin: 0;
	padding: 0;
	border: 0;
	min-width: 0;
	width: 100%;
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.signin-choice-label {
	padding: 0;
	margin: 0;
	font-family: var(--font-cond);
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	font-size: 12px;
	color: var(--text-dim);
}

.signin-age.is-pending,
#ageField.is-pending {
	gap: 12px;
}

.signin-age.is-pending .signin-choice-label,
#ageField.is-pending .signin-choice-label {
	width: 100%;
	font-family: var(--font-cond);
	font-weight: 500;
	font-size: 18px;
	letter-spacing: 0.04em;
	color: #f4f4f4;
}

.signin-choice .chip-row {
	width: 100%;
	flex-wrap: nowrap;
	gap: 8px;
}

.signin-choice .chip {
	flex: 1;
	min-height: 48px;
	padding: 12px 16px;
	font-size: 16px;
}

.signin-choice .chip.is-selected {
	background: rgba(255, 204, 26, 0.08);
	border-color: var(--gold);
	color: var(--gold);
}

.signin-form-error {
	margin: 0;
	text-align: center;
	color: #ff8b8b;
	font-family: var(--font-cond);
	font-weight: 700;
}

.signin-link {
	padding: 0;
	border: 0;
	background: none;
	color: var(--yellow);
	cursor: pointer;
	font-family: var(--font-cond);
	font-weight: 700;
	font-size: 15px;
	letter-spacing: 0.04em;
	text-decoration: underline;
	text-underline-offset: 3px;
}

.signin-token-value {
	margin: 8px 0 0;
	padding: 10px;
	overflow-x: auto;
	border-radius: var(--radius-sm);
	border: 1px solid var(--line-soft);
	background: rgba(0, 0, 0, 0.4);
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	font-size: 13px;
	text-align: center;
	white-space: pre-wrap;
	word-break: break-all;
	color: var(--text);
}

.signin-photo.is-disabled {
	opacity: 0.35;
	pointer-events: none;
}

.signin-name.is-disabled input {
	opacity: 0.45;
}

/* --- Admin ---------------------------------------------------------------- */

.admin-kicker {
	font-family: var(--font-cond);
	font-weight: 700;
	letter-spacing: 0.16em;
	text-transform: uppercase;
	font-size: 13px;
	color: var(--text-dim);
	margin-top: -4px;
}

.admin-tools {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.admin-tool {
	display: block;
	width: 100%;
	padding: 14px 18px;
	border: 0;
	border-radius: var(--radius);
	color: inherit;
	text-decoration: none;
	text-align: left;
	cursor: pointer;
	font-family: var(--font-display);
	font-size: 22px;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	line-height: 1.1;
	background:
		linear-gradient(180deg, var(--red), var(--yellow)) 0 0 / 5px 100% no-repeat,
		linear-gradient(180deg, rgba(255, 255, 255, 0.09) 0%, rgba(255, 255, 255, 0) 18%, rgba(0, 0, 0, 0.28) 100%),
		var(--grit),
		var(--surface-2);
	background-size: 5px 100%, auto, 170px 170px, auto;
	background-repeat: no-repeat, no-repeat, repeat, no-repeat;
	box-shadow:
		inset 0 1px 0 rgba(255, 255, 255, 0.16),
		inset 0 -2px 0 rgba(0, 0, 0, 0.45);
	filter: drop-shadow(0 8px 14px rgba(0, 0, 0, 0.4));
	transition: transform 0.18s, filter 0.18s;
}

.admin-tool:hover {
	transform: translateY(-2px);
	filter: brightness(1.08) drop-shadow(0 12px 18px rgba(0, 0, 0, 0.45));
}

.admin-tool:active {
	transform: translateY(1px);
}

.admin-track-img {
	display: block;
	width: min(100%, 420px);
	margin: 12px auto 16px;
	border-radius: 12px;
	background: #0d0c0b;
	border: 1px solid var(--line-soft);
}

.admin-track-creator {
	font-family: var(--font-cond);
	font-weight: 800;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	font-size: 18px;
	color: var(--yellow);
	margin-bottom: 4px;
}

.admin-track-meta {
	font-family: var(--font-cond);
	font-weight: 600;
	font-size: 14px;
	color: var(--text-dim);
	margin-bottom: 8px;
}

.admin-track-desc {
	font-size: 14px;
	line-height: 1.4;
	color: var(--text);
	margin-bottom: 12px;
	white-space: pre-wrap;
}

.admin-track-actions {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.admin-track-actions .btn {
	width: 100%;
}

/* --- Responsive ----------------------------------------------------------- */

@media (max-width: 970px) {
	.ad-slot-desktop {
		display: none;
	}

	.ad-slot-mobile {
		display: grid;
		width: min(320px, 100%);
		min-height: 50px;
	}
}

@media (max-width: 720px) {
	:root {
		--header-h: 56px;
		--gap: 12px;
	}



	.page-bg img {
		object-position: 78% 58%;
	}


	.player-name {
		font-size: 18px;
	}

	.coins-value {
		font-size: 16px;
	}


	.coins-pill {
		height: 38px;
		padding: 0 8px 0 10px;
	}

	.ad-wrap {
		padding: 10px 12px 0;
	}

	.launcher {
		padding: 12px 14px 28px;
	}

	.page-heading {
		font-size: 28px;
	}

	.coins-history-row {
		min-height: 48px;
		padding: 8px 4px;
	}

	.coins-history-reason,
	.coins-history-change {
		font-size: 15px;
	}

	.gamepad-pair {
		grid-template-columns: 1fr;
	}

	.setting-row {
		flex-wrap: wrap;
	}

	.mode-title {
		font-size: 26px;
	}

	.mode-featured .mode-title {
		font-size: 28px;
	}

	.mode-featured .mode-body,
	.mode-body {
		min-height: 84px;
	}

	.mode-small .mode-title {
		font-size: 16px;
	}

	.stat-value {
		font-size: 26px;
	}

	.shop-grid {
		grid-template-columns: repeat(auto-fill, minmax(124px, 1fr));
	}

	.shop-grid.is-garage {
		grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
	}

	.track-item {
		flex-basis: 188px;
		width: 188px;
	}

	.track-select-nav {
		width: 30px;
		height: 30px;
	}

	.admin-tool {
		font-size: 18px;
		padding: 12px 14px;
	}

	.bonus-num,
	.bonus-countdown {
		font-size: 18px;
	}

	.bonus-kicker {
		display: none;
	}
}

@media (max-width: 520px) {
	.garage-row {
		grid-template-columns: 1fr;
	}

	.garage-actions {
		flex-direction: row;
	}

	.garage-actions .btn {
		flex: 1;
	}

	.car-specs {
		grid-template-columns: 1fr;
	}
}

@media (max-width: 420px) {
	.mode-pair {
		gap: 8px;
	}

	.bonus-timer-label {
		display: none;
	}

	.player-avatar {
		width: 36px;
		height: 36px;
	}

	.coins-pill {
		height: 34px;
		padding: 0 8px 0 10px;
	}

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

@media (prefers-reduced-motion: reduce) {
	*,
	*::before,
	*::after {
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.01ms !important;
		scroll-behavior: auto !important;
	}
}
