/* =========================================================================
   Garagum Games design tokens and shared base rules.

   The palette, radii and fonts follow the Garagum Launcher (Colors.xaml and
   DesignLab.xaml in the launcher project): slate blue surfaces, the launcher
   accent #5bc8f4, blue gradient primary buttons, small corner radii.

   Linked last in <head> on every page, so these values win over the older
   per-page :root blocks. The legacy names further down are aliases that make
   older page styles follow the same palette without rewriting them.
   ========================================================================= */

:root {
	color-scheme: dark;

	/* Surfaces: navy page with a blue light from the top, cards #1c2533 */
	--gg-surface-0: #141a22;
	--gg-surface-1: #1d242d;
	--gg-surface-2: #1c2533;
	--gg-surface-3: #24303f;
	--gg-surface-4: #2c394c;
	--gg-head: #161d26;
	--gg-input: #141b24;
	--gg-line: #2a3647;
	--gg-line-strong: #3a4a60;
	--gg-row: rgba(255, 255, 255, 0.04);
	--gg-row-hover: rgba(255, 255, 255, 0.086);
	--gg-selection: #24364a;
	--gg-page-base: #111923;
	--gg-page-bg:
		radial-gradient(1400px 720px at 50% -160px, rgba(91, 200, 244, 0.2), rgba(91, 200, 244, 0.05) 45%, transparent 75%),
		radial-gradient(1000px 900px at -15% 1000px, rgba(57, 120, 237, 0.09), transparent 70%),
		radial-gradient(1000px 900px at 115% 1900px, rgba(91, 200, 244, 0.07), transparent 70%),
		linear-gradient(180deg, #172231 0, #131c28 1100px, var(--gg-page-base) 100%);

	/* Text */
	--gg-text-1: #ffffff;
	--gg-text-2: #c5c5c5;
	--gg-text-3: #8a96a6;

	/* Accent: the launcher accent and its blue button gradient */
	--gg-accent: #5bc8f4;
	--gg-accent-light: #91d3ee;
	--gg-accent-soft: rgba(91, 200, 244, 0.12);
	--gg-blue-1: #399aed;
	--gg-blue-2: #245ecf;
	--gg-blue-border: #4fa9f2;
	--gg-blue-hover-1: #46befe;
	--gg-blue-hover-2: #3081e0;
	--gg-on-accent: #ffffff;
	--gg-gradient: linear-gradient(180deg, var(--gg-blue-1), var(--gg-blue-2));

	/* Statuses and places */
	--gg-ok: #57cb6a;
	--gg-warn: #f2b33d;
	--gg-danger: #e05a4f;
	--gg-gold: #f5c542;
	--gg-silver: #c9d1db;
	--gg-bronze: #d08a4f;
	--gg-purple: #9b6cf2;
	--gg-live: var(--gg-danger);
	--gg-soon: var(--gg-warn);

	/* Typography: Segoe UI for text, Bahnschrift for headings, as in the launcher */
	--gg-font: "Segoe UI", "Segoe UI Variable", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
	--gg-font-display: Bahnschrift, "DIN Alternate", "Roboto Condensed", "Arial Narrow", sans-serif-condensed, var(--gg-font);
	--gg-fs-display: clamp(34px, 5.2vw, 58px);
	--gg-fs-h1: clamp(30px, 4.2vw, 44px);
	--gg-fs-h2: clamp(24px, 3.2vw, 34px);
	--gg-fs-h3: 20px;
	--gg-fs-title: 18px;
	--gg-fs-body-l: 17px;
	--gg-fs-body: 15px;
	--gg-fs-small: 14px;
	--gg-fs-caption: 12px;

	/* Spacing scale */
	--gg-space-1: 4px;
	--gg-space-2: 8px;
	--gg-space-3: 12px;
	--gg-space-4: 16px;
	--gg-space-5: 24px;
	--gg-space-6: 32px;
	--gg-space-7: 48px;
	--gg-space-8: 64px;
	--gg-space-9: 96px;

	/* Radius: the launcher uses 5px buttons and 8-10px cards */
	--gg-radius-s: 5px;
	--gg-radius-m: 8px;
	--gg-radius-l: 10px;
	--gg-radius-xl: 12px;
	--gg-radius-pill: 999px;

	/* Elevation */
	--gg-shadow-1: 0 2px 8px rgba(0, 0, 0, 0.3);
	--gg-shadow-2: 0 10px 28px rgba(0, 0, 0, 0.38);
	--gg-shadow-3: 0 24px 60px rgba(0, 0, 0, 0.5);
	--gg-glow: 0 0 0 1px rgba(91, 200, 244, 0.35), 0 10px 30px rgba(57, 154, 237, 0.2);
	--gg-focus-color: var(--gg-accent);

	--gg-container: 1240px;
	--gg-header-h: 64px;

	/* ---- Legacy aliases: shared ---- */
	--bg-dark: var(--gg-surface-1);
	--bg-light: rgba(28, 37, 51, 0.92);
	--primary-color: var(--gg-accent);
	--secondary-color: var(--gg-blue-1);
	--text-light: var(--gg-text-1);
	--text-dark: var(--gg-text-2);
	--esport-accent: var(--gg-accent);
	--font-main: var(--gg-font);
	--default-font: var(--gg-font);
	--heading-font: var(--gg-font-display);
	--nav-font: var(--gg-font);

	/* ---- Legacy aliases: tournaments and about ---- */
	--page-bg: var(--gg-surface-1);
	--section-bg: var(--gg-surface-1);
	--card-bg: var(--gg-surface-2);
	--card-2: var(--gg-surface-3);
	--card-dark: var(--gg-head);
	--accent-main: var(--gg-accent);
	--accent-secondary: var(--gg-blue-1);
	--accent-2: var(--gg-blue-1);
	--accent-gold: var(--gg-gold);
	--glow-blue: rgba(91, 200, 244, 0.35);
	--glow-gold: rgba(245, 197, 66, 0.5);
	--text: var(--gg-text-1);
	--text-main: var(--gg-text-1);
	--muted: var(--gg-text-3);
	--text-muted: var(--gg-text-3);
	--border: var(--gg-line);
	--line-inactive: var(--gg-line-strong);
	--panel-color: var(--gg-surface-2);
	--card-radius: var(--gg-radius-l);
	--text-color-strong: var(--gg-text-1);
	--muted-color: var(--gg-text-3);
}

/* =========================================================================
   Base
   ========================================================================= */

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

html {
	background: var(--gg-page-base);
	scroll-padding-top: calc(var(--gg-header-h) + 16px);
}

body {
	margin: 0;
	min-height: 100vh;
	background: var(--gg-page-bg);
	background-color: var(--gg-page-base);
	color: var(--gg-text-1);
	font-family: var(--gg-font);
	font-size: var(--gg-fs-body);
	line-height: 1.55;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	text-rendering: optimizeLegibility;
}

h1,
h2,
h3,
h4 {
	font-family: var(--gg-font-display);
	font-weight: 600;
	letter-spacing: 0.005em;
	line-height: 1.15;
}

a {
	color: inherit;
}

img {
	max-width: 100%;
}

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

/* Page styles set display on many blocks; keep the hidden attribute working. */
[hidden] {
	display: none !important;
}

/* Visually hidden, still read by screen readers and search engines. */
.gg-sr-only {
	position: absolute !important;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
	border: 0;
}

::selection {
	background: rgba(91, 200, 244, 0.3);
	color: var(--gg-text-1);
}

/* Visible keyboard focus everywhere. Mouse clicks do not trigger it. */
:focus-visible {
	outline: 2px solid var(--gg-focus-color) !important;
	outline-offset: 3px;
}

/* Thin grey scrollbar, as in the launcher (DL_ScrollBarGray) */
* {
	scrollbar-width: thin;
	scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

::-webkit-scrollbar {
	width: 8px;
	height: 8px;
}

::-webkit-scrollbar-thumb {
	background: rgba(255, 255, 255, 0.2);
	border-radius: 4px;
}

::-webkit-scrollbar-track {
	background: transparent;
}

/* =========================================================================
   Layout helpers
   ========================================================================= */

.gg-container {
	width: 100%;
	max-width: var(--gg-container);
	margin: 0 auto;
	padding: 0 var(--gg-space-5);
}

@media (max-width: 600px) {
	.gg-container {
		padding: 0 var(--gg-space-4);
	}
}

.gg-section {
	padding: var(--gg-space-8) 0;
}

.gg-section--tight {
	padding: var(--gg-space-7) 0;
}

.gg-section__head {
	display: flex;
	align-items: flex-end;
	justify-content: space-between;
	gap: var(--gg-space-4);
	margin-bottom: var(--gg-space-5);
}

.gg-eyebrow {
	display: inline-flex;
	align-items: center;
	gap: var(--gg-space-2);
	margin: 0 0 var(--gg-space-3);
	color: var(--gg-accent);
	font-size: var(--gg-fs-caption);
	font-weight: 700;
	letter-spacing: 0.12em;
	text-transform: uppercase;
}

.gg-title {
	margin: 0;
	font-size: var(--gg-fs-h2);
}

.gg-lead {
	margin: var(--gg-space-3) 0 0;
	max-width: 640px;
	color: var(--gg-text-2);
	font-size: var(--gg-fs-body-l);
}

.gg-link {
	color: var(--gg-accent);
	font-size: var(--gg-fs-small);
	font-weight: 600;
	text-decoration: none;
	white-space: nowrap;
}

.gg-link:hover {
	color: var(--gg-accent-light);
	text-decoration: underline;
}

/* =========================================================================
   Shared components
   ========================================================================= */

/* Buttons: DL_PrimaryButton / DL_SecondaryButton / DL_FlatButton */
.gg-btn {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: var(--gg-space-2);
	min-height: 40px;
	padding: 0 var(--gg-space-5);
	border: 1px solid transparent;
	border-radius: var(--gg-radius-s);
	font: 600 var(--gg-fs-small) / 1 var(--gg-font);
	text-decoration: none;
	white-space: nowrap;
	cursor: pointer;
	transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, filter 0.15s ease;
}

.gg-btn svg {
	flex: 0 0 auto;
}

.gg-btn--lg {
	min-height: 48px;
	padding: 0 var(--gg-space-6);
	font-size: var(--gg-fs-body);
}

.gg-btn--sm {
	min-height: 34px;
	padding: 0 var(--gg-space-4);
	font-size: 13px;
}

.gg-btn--primary {
	background: var(--gg-gradient);
	border-color: var(--gg-blue-border);
	color: var(--gg-on-accent);
}

.gg-btn--primary:hover {
	background: linear-gradient(180deg, var(--gg-blue-hover-1), var(--gg-blue-hover-2));
}

.gg-btn--primary:active {
	filter: brightness(0.85);
}

.gg-btn--secondary,
.gg-btn--ghost {
	background: #232a34;
	border-color: #3c424a;
	color: #e6e9ed;
}

.gg-btn--secondary:hover,
.gg-btn--ghost:hover {
	background: #2b3440;
	border-color: #4a5260;
	color: var(--gg-text-1);
}

.gg-btn--flat {
	background: rgba(255, 255, 255, 0.055);
	border-color: rgba(255, 255, 255, 0.2);
	color: var(--gg-text-2);
	font-weight: 400;
}

.gg-btn--flat:hover {
	background: rgba(255, 255, 255, 0.1);
	color: var(--gg-text-1);
}

/* Card */
.gg-card {
	background: var(--gg-surface-2);
	border: 1px solid var(--gg-line);
	border-radius: var(--gg-radius-l);
}

/* Chip, as the launcher genre filters */
.gg-chip {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 4px 12px;
	border: 1px solid var(--gg-line);
	border-radius: var(--gg-radius-pill);
	background: rgba(255, 255, 255, 0.03);
	color: var(--gg-text-2);
	font-size: 13px;
	line-height: 1.4;
}

/* Badge: small status label */
.gg-badge {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 3px 8px;
	border-radius: var(--gg-radius-s);
	background: var(--gg-accent-soft);
	color: var(--gg-accent);
	font-size: var(--gg-fs-caption);
	font-weight: 700;
	line-height: 1.3;
}

/* Online indicator: green dot and a number, as "Игроки онлайн" in the launcher */
.gg-online {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	color: var(--gg-text-2);
	font-size: 13px;
	font-weight: 600;
	white-space: nowrap;
}

.gg-online__dot {
	position: relative;
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: var(--gg-ok);
	box-shadow: 0 0 0 3px rgba(87, 203, 106, 0.18);
}

.gg-online__dot::after {
	content: "";
	position: absolute;
	inset: 0;
	border-radius: 50%;
	background: var(--gg-ok);
	animation: ggPulse 2s ease-out infinite;
}

.gg-online__value {
	color: var(--gg-text-1);
	font-variant-numeric: tabular-nums;
}

@keyframes ggPulse {
	from {
		transform: scale(1);
		opacity: 0.7;
	}
	to {
		transform: scale(2.6);
		opacity: 0;
	}
}

/* Empty state block (tournaments and any list without data) */
.gg-empty {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: var(--gg-space-3);
	max-width: 560px;
	margin: 0 auto;
	padding: var(--gg-space-7) var(--gg-space-5);
	border: 1px dashed var(--gg-line-strong);
	border-radius: var(--gg-radius-l);
	background: rgba(28, 37, 51, 0.6);
	text-align: center;
}

.gg-empty__icon {
	display: grid;
	place-items: center;
	width: 52px;
	height: 52px;
	border-radius: var(--gg-radius-l);
	background: var(--gg-accent-soft);
	color: var(--gg-accent);
}

.gg-empty__title {
	margin: 0;
	font-size: var(--gg-fs-title);
	font-weight: 600;
	color: var(--gg-text-1);
}

.gg-empty__text {
	margin: 0;
	font-size: var(--gg-fs-small);
	line-height: 1.6;
	color: var(--gg-text-3);
}

.gg-empty .gg-btn {
	margin-top: var(--gg-space-2);
}

/* "Available in the launcher" call to action, used where the site has no own version */
.gg-launcher-cta {
	display: grid;
	grid-template-columns: auto 1fr auto;
	align-items: center;
	gap: var(--gg-space-5);
	padding: var(--gg-space-5) var(--gg-space-6);
	border: 1px solid var(--gg-line);
	border-radius: var(--gg-radius-l);
	background:
		radial-gradient(120% 140% at 0% 0%, rgba(91, 200, 244, 0.12), transparent 55%),
		var(--gg-surface-2);
}

.gg-launcher-cta__icon {
	display: grid;
	place-items: center;
	width: 56px;
	height: 56px;
	border-radius: var(--gg-radius-l);
	background: var(--gg-accent-soft);
	color: var(--gg-accent);
}

.gg-launcher-cta__title {
	margin: 0 0 4px;
	font-size: var(--gg-fs-title);
}

.gg-launcher-cta__text {
	margin: 0;
	color: var(--gg-text-3);
	font-size: var(--gg-fs-small);
}

@media (max-width: 700px) {
	.gg-launcher-cta {
		grid-template-columns: 1fr;
		text-align: left;
	}
}

/* Page left where a removed site feature used to be (sign-in, profile, cloud disk):
   points to the launcher instead */
.gg-stub {
	display: grid;
	place-items: center;
	min-height: calc(100vh - var(--gg-header-h) - 220px);
	padding: var(--gg-space-8) 0;
}

.gg-stub__box {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: var(--gg-space-4);
	max-width: 620px;
	padding: var(--gg-space-7) var(--gg-space-6);
	border: 1px solid var(--gg-line);
	border-radius: var(--gg-radius-xl);
	background:
		radial-gradient(90% 80% at 50% 0%, rgba(57, 154, 237, 0.14), transparent 65%),
		var(--gg-surface-2);
	text-align: center;
}

.gg-stub__box h1 {
	margin: 0;
	font-size: var(--gg-fs-h2);
}

.gg-stub__box p {
	margin: 0;
	color: var(--gg-text-2);
}

.gg-stub__actions {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: var(--gg-space-3);
	margin-top: var(--gg-space-2);
}

/* Mobile app banner (home page, Android only) */
.gg-app-banner {
	position: fixed;
	left: var(--gg-space-3);
	right: var(--gg-space-3);
	bottom: calc(var(--gg-space-3) + env(safe-area-inset-bottom, 0px));
	z-index: 9999;
	display: flex;
	align-items: center;
	gap: var(--gg-space-3);
	max-width: 480px;
	margin: 0 auto;
	padding: var(--gg-space-3);
	border: 1px solid var(--gg-line-strong);
	border-radius: var(--gg-radius-l);
	background: rgba(22, 29, 38, 0.97);
	box-shadow: var(--gg-shadow-3);
	-webkit-backdrop-filter: blur(12px);
	backdrop-filter: blur(12px);
	animation: ggBannerIn 0.35s ease-out both;
}

.gg-app-banner__icon {
	flex: 0 0 44px;
	width: 44px;
	height: 44px;
	border-radius: var(--gg-radius-m);
}

.gg-app-banner__text {
	flex: 1;
	min-width: 0;
	font-size: 13px;
	line-height: 1.35;
	color: var(--gg-text-3);
}

.gg-app-banner__text strong {
	display: block;
	font-size: var(--gg-fs-small);
	color: var(--gg-text-1);
}

.gg-app-banner .gg-btn {
	min-height: 34px;
	padding: 0 var(--gg-space-4);
	font-size: 13px;
}

.gg-app-banner__close {
	flex: 0 0 32px;
	width: 32px;
	height: 32px;
	border: 0;
	border-radius: var(--gg-radius-s);
	background: transparent;
	color: var(--gg-text-3);
	font-size: 20px;
	line-height: 1;
	cursor: pointer;
}

.gg-app-banner__close:hover {
	color: var(--gg-text-1);
	background: rgba(255, 255, 255, 0.06);
}

@keyframes ggBannerIn {
	from {
		opacity: 0;
		transform: translateY(16px);
	}
}

/* Reveal on scroll: include.js marks <html> with .gg-js and adds .is-visible */
.gg-js .gg-reveal {
	opacity: 0;
	transform: translateY(14px);
	transition: opacity 0.5s ease, transform 0.5s ease;
}

.gg-js .gg-reveal.is-visible {
	opacity: 1;
	transform: none;
}

/* =========================================================================
   Motion
   ========================================================================= */

@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;
	}

	.gg-js .gg-reveal {
		opacity: 1;
		transform: none;
	}
}
