/* =========================================================
   Variables
   ========================================================= */
:root {
  /* Color Palette - Dark Neon Gaming Theme */
  --color-bg: #050814;
  --color-bg-elevated: #090f23;
  --color-bg-alt: #050a18;

  --color-text: #f5f7ff;
  --color-text-muted: #9ca7d9;
  --color-text-soft: #6b749c;

  --color-primary: #32e5ff; /* neon cyan */
  --color-primary-soft: rgba(50, 229, 255, 0.14);
  --color-primary-strong: #00b8ff;

  --color-accent-purple: #8b5cff;
  --color-accent-purple-soft: rgba(139, 92, 255, 0.16);
  --color-accent-green: #37ff8b;
  --color-accent-green-soft: rgba(55, 255, 139, 0.16);

  --color-success: #37ff8b;
  --color-success-soft: rgba(55, 255, 139, 0.18);
  --color-warning: #ffc857;
  --color-warning-soft: rgba(255, 200, 87, 0.18);
  --color-danger: #ff4b6e;
  --color-danger-soft: rgba(255, 75, 110, 0.2);

  --gray-50: #f8fafc;
  --gray-100: #e2e8f0;
  --gray-200: #cbd5f5;
  --gray-300: #94a3b8;
  --gray-400: #64748b;
  --gray-500: #475569;
  --gray-600: #334155;
  --gray-700: #1f2937;
  --gray-800: #111827;
  --gray-900: #020617;

  /* Semantic Background Layers */
  --surface-0: var(--color-bg);
  --surface-1: var(--color-bg-elevated);
  --surface-2: #0c122a;

  /* Typography */
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji",
    "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
  --font-display: "Rajdhani", "Orbitron", system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", "Fira Code", ui-monospace, SFMono-Regular,
    Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;

  --font-size-xs: 0.75rem;   /* 12px */
  --font-size-sm: 0.875rem;  /* 14px */
  --font-size-md: 1rem;      /* 16px */
  --font-size-lg: 1.125rem;  /* 18px */
  --font-size-xl: 1.25rem;   /* 20px */
  --font-size-2xl: 1.5rem;   /* 24px */
  --font-size-3xl: 1.875rem; /* 30px */
  --font-size-4xl: 2.25rem;  /* 36px */
  --font-size-5xl: 3rem;     /* 48px */

  --line-height-tight: 1.1;
  --line-height-snug: 1.25;
  --line-height-normal: 1.5;
  --line-height-relaxed: 1.7;

  /* Spacing Scale (0–96px) */
  --space-0: 0;
  --space-1: 0.25rem;  /* 4px */
  --space-2: 0.5rem;   /* 8px */
  --space-3: 0.75rem;  /* 12px */
  --space-4: 1rem;     /* 16px */
  --space-5: 1.25rem;  /* 20px */
  --space-6: 1.5rem;   /* 24px */
  --space-8: 2rem;     /* 32px */
  --space-10: 2.5rem;  /* 40px */
  --space-12: 3rem;    /* 48px */
  --space-16: 4rem;    /* 64px */
  --space-20: 5rem;    /* 80px */
  --space-24: 6rem;    /* 96px */

  /* Radii */
  --radius-xs: 2px;
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 14px;
  --radius-xl: 22px;
  --radius-pill: 999px;

  /* Shadows / Glows */
  --shadow-soft:
    0 10px 40px rgba(0, 0, 0, 0.55);
  --shadow-strong:
    0 0 25px rgba(50, 229, 255, 0.32),
    0 22px 60px rgba(0, 0, 0, 0.9);
  --shadow-elevated:
    0 0 16px rgba(139, 92, 255, 0.25),
    0 20px 45px rgba(2, 6, 23, 0.95);
  --shadow-focus:
    0 0 0 1px rgba(5, 250, 255, 0.6),
    0 0 0 3px rgba(5, 250, 255, 0.25);

  /* Transitions */
  --transition-fast: 120ms ease-out;
  --transition-base: 180ms ease-out;
  --transition-slow: 260ms ease-out;
}

/* Reduced motion handling */
@media (prefers-reduced-motion: reduce) {
  :root {
    --transition-fast: 0ms;
    --transition-base: 0ms;
    --transition-slow: 0ms;
  }
}

/* =========================================================
   Reset / Normalize
   ========================================================= */
*, *::before, *::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100vh;
}

h1, h2, h3, h4, h5, h6,
p, blockquote, figure,
ol, ul, dl,
pre {
  margin: 0;
}

ol[role="list"],
ul[role="list"],
ol,
ul {
  list-style: none;
  padding: 0;
}

img,
picture,
video,
canvas,
svg {
  display: block;
  max-width: 100%;
}

img,
video {
  height: auto;
}

button,
input,
select,
textarea {
  margin: 0;
  font: inherit;
  color: inherit;
}

button {
  border: none;
  background: none;
  padding: 0;
}

textarea {
  resize: vertical;
}

a {
  color: inherit;
  text-decoration: none;
}

table {
  border-collapse: collapse;
  border-spacing: 0;
}

:focus {
  outline: none;
}

:focus-visible {
  outline: none;
}

/* =========================================================
   Base Styles
   ========================================================= */
body {
  font-family: var(--font-sans);
  font-size: var(--font-size-md);
  line-height: var(--line-height-normal);
  background: radial-gradient(circle at top, #101633 0%, #050814 45%, #01030a 100%);
  color: var(--color-text);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

main {
  min-height: 60vh;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-text);
}

h1 {
  font-size: clamp(2.25rem, 5vw, 3.25rem);
  line-height: var(--line-height-tight);
  margin-bottom: var(--space-4);
}

h2 {
  font-size: clamp(1.75rem, 3.4vw, 2.25rem);
  line-height: var(--line-height-snug);
  margin-bottom: var(--space-3);
}

h3 {
  font-size: clamp(1.35rem, 2.4vw, 1.75rem);
  line-height: var(--line-height-snug);
  margin-bottom: var(--space-3);
}

h4 {
  font-size: var(--font-size-xl);
  line-height: var(--line-height-snug);
  margin-bottom: var(--space-2);
}

p {
  margin-bottom: var(--space-4);
  color: var(--color-text-muted);
}

strong {
  font-weight: 600;
}

code,
pre,
kbd,
samp {
  font-family: var(--font-mono);
}

a {
  position: relative;
  cursor: pointer;
  transition: color var(--transition-base),
    text-shadow var(--transition-base),
    opacity var(--transition-fast);
}

a:hover {
  color: var(--color-primary);
  text-shadow: 0 0 9px rgba(50, 229, 255, 0.6);
}

a:focus-visible {
  outline: none;
  box-shadow: var(--shadow-focus);
  border-radius: var(--radius-sm);
}

::selection {
  background: rgba(50, 229, 255, 0.35);
  color: #ffffff;
}

/* =========================================================
   Utilities
   ========================================================= */

/* Layout Helpers */
.container {
  width: 100%;
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--space-4);
  padding-right: var(--space-4);
  max-width: 1120px;
}

@media (min-width: 1200px) {
  .container {
    max-width: 1240px;
  }
}

@media (min-width: 1440px) {
  .container {
    max-width: 1340px;
  }
}

.section {
  padding-top: var(--space-10);
  padding-bottom: var(--space-10);
}

.section--compact {
  padding-top: var(--space-6);
  padding-bottom: var(--space-6);
}

/* Flexbox */
.flex {
  display: flex;
}

.inline-flex {
  display: inline-flex;
}

.flex-column {
  flex-direction: column;
}

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

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

.items-center {
  align-items: center;
}

.items-start {
  align-items: flex-start;
}

.items-end {
  align-items: flex-end;
}

.justify-center {
  justify-content: center;
}

.justify-between {
  justify-content: space-between;
}

.justify-around {
  justify-content: space-around;
}

.gap-2 {
  gap: var(--space-2);
}

.gap-3 {
  gap: var(--space-3);
}

.gap-4 {
  gap: var(--space-4);
}

.gap-6 {
  gap: var(--space-6);
}

/* Grid */
.grid {
  display: grid;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-6);
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-6);
}

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

/* Width helpers */
.w-full {
  width: 100%;
}

.text-center {
  text-align: center;
}

.text-right {
  text-align: right;
}

.m-auto {
  margin: auto;
}

.mt-4 {
  margin-top: var(--space-4);
}

.mb-4 {
  margin-bottom: var(--space-4);
}

.mt-6 {
  margin-top: var(--space-6);
}

.mb-6 {
  margin-bottom: var(--space-6);
}

/* Visually hidden (screen-reader only) */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Neon Divider / Accent Line */
.hr-neon {
  width: 72px;
  height: 2px;
  border: 0;
  border-radius: var(--radius-pill);
  background: linear-gradient(90deg, var(--color-primary), var(--color-accent-purple));
  box-shadow: 0 0 18px rgba(50, 229, 255, 0.8);
}

/* Utility: subtle glass layer */
.glass {
  background: linear-gradient(135deg, rgba(24, 33, 73, 0.8), rgba(5, 8, 20, 0.9));
  border-radius: var(--radius-lg);
  border: 1px solid rgba(99, 102, 241, 0.35);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(14px);
}

@media (prefers-reduced-motion: reduce) {
  .glass {
    backdrop-filter: none;
  }
}

/* =========================================================
   Components
   ========================================================= */

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.7rem 1.35rem;
  font-family: var(--font-display);
  font-size: var(--font-size-sm);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  white-space: nowrap;
  background: radial-gradient(circle at 0 0, rgba(50, 229, 255, 0.4), transparent 45%),
    linear-gradient(120deg, #0b1728, #050814);
  color: var(--color-text);
  box-shadow: 0 0 0 rgba(50, 229, 255, 0);
  transition:
    background var(--transition-base),
    transform var(--transition-fast),
    box-shadow var(--transition-base),
    border-color var(--transition-fast),
    color var(--transition-fast),
    opacity var(--transition-fast);
}

.btn::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, rgba(50, 229, 255, 0.9), rgba(139, 92, 255, 0.9));
  opacity: 0;
  transition: opacity var(--transition-base);
  z-index: -1;
}

.btn--primary {
  border-color: rgba(50, 229, 255, 0.7);
  box-shadow: 0 0 18px rgba(50, 229, 255, 0.45);
}

.btn--secondary {
  background: linear-gradient(135deg, rgba(139, 92, 255, 0.14), rgba(5, 8, 20, 0.96));
  border-color: rgba(139, 92, 255, 0.7);
}

.btn--ghost {
  background: transparent;
  border-color: rgba(148, 163, 184, 0.45);
  box-shadow: none;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-strong);
}

.btn--primary:hover::before,
.btn--secondary:hover::before {
  opacity: 0.18;
}

.btn:active {
  transform: translateY(0px) scale(0.99);
  box-shadow: 0 0 10px rgba(50, 229, 255, 0.4);
}

.btn:disabled,
.btn[aria-disabled="true"] {
  cursor: not-allowed;
  opacity: 0.6;
  box-shadow: none;
}

.btn:focus-visible {
  box-shadow: var(--shadow-focus);
}

/* Inputs & Form Controls */
.input,
.textarea,
.select {
  width: 100%;
  padding: 0.65rem 0.9rem;
  border-radius: var(--radius-md);
  border: 1px solid rgba(148, 163, 184, 0.32);
  background: radial-gradient(circle at top left, rgba(37, 99, 235, 0.25), transparent 55%),
    rgba(15, 23, 42, 0.96);
  color: var(--color-text);
  font-size: var(--font-size-sm);
  transition:
    border-color var(--transition-base),
    box-shadow var(--transition-base),
    background var(--transition-base),
    transform var(--transition-fast);
}

.input::placeholder,
.textarea::placeholder {
  color: var(--color-text-soft);
}

.input:focus-visible,
.textarea:focus-visible,
.select:focus-visible {
  border-color: var(--color-primary);
  box-shadow: var(--shadow-focus);
  outline: none;
}

.input--error,
.textarea--error,
.select--error {
  border-color: var(--color-danger);
  box-shadow: 0 0 0 1px rgba(255, 75, 110, 0.6);
}

.label {
  display: block;
  margin-bottom: var(--space-2);
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--color-text);
}

.field-description {
  margin-top: 0.25rem;
  font-size: var(--font-size-xs);
  color: var(--color-text-soft);
}

.field-error {
  margin-top: 0.25rem;
  font-size: var(--font-size-xs);
  color: var(--color-danger);
}

/* Card Component */
.card {
  position: relative;
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  background:
    radial-gradient(circle at top left, rgba(50, 229, 255, 0.16), transparent 55%),
    radial-gradient(circle at bottom right, rgba(139, 92, 255, 0.16), transparent 55%),
    linear-gradient(145deg, #050814, #0b1026);
  border: 1px solid rgba(63, 78, 137, 0.8);
  box-shadow: var(--shadow-elevated);
  overflow: hidden;
}

.card::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  border: 1px solid transparent;
  background: conic-gradient(from 210deg, rgba(50, 229, 255, 0.5), rgba(139, 92, 255, 0.2), rgba(55, 255, 139, 0.4), rgba(50, 229, 255, 0.6));
  opacity: 0;
  mix-blend-mode: screen;
  transition: opacity var(--transition-slow);
}

.card:hover::before {
  opacity: 0.22;
}

.card-header {
  margin-bottom: var(--space-4);
}

.card-title {
  font-size: var(--font-size-xl);
  margin-bottom: var(--space-2);
}

.card-meta {
  font-size: var(--font-size-xs);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--color-text-soft);
}

.card-body {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
}

/* Focus-visible (global) */
:where(button, [role="button"], a, input, textarea, select) :focus-visible,
:where(button, [role="button"], a, input, textarea, select):focus-visible {
  outline: none;
  box-shadow: var(--shadow-focus);
}

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

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

/* =========================================================
   Page-Level Theming Hooks (for future pages)
   ========================================================= */

/* Hero sections for Polish gaming CTA-heavy layouts */
.hero {
  position: relative;
  padding-top: var(--space-16);
  padding-bottom: var(--space-12);
  overflow: hidden;
}

.hero::before {
  content: "";
  position: absolute;
  inset: -40%;
  background:
    radial-gradient(circle at 10% 0%, rgba(50, 229, 255, 0.32), transparent 55%),
    radial-gradient(circle at 90% 20%, rgba(139, 92, 255, 0.4), transparent 60%),
    radial-gradient(circle at 50% 110%, rgba(55, 255, 139, 0.32), transparent 55%);
  opacity: 0.22;
  filter: blur(4px);
  pointer-events: none;
}

.hero-inner {
  position: relative;
  z-index: 1;
}

/* Leaderboard-style tables (rankingi graczy) */
.leaderboard-table {
  width: 100%;
  border-spacing: 0;
  border-collapse: collapse;
  font-size: var(--font-size-sm);
}

.leaderboard-table thead tr {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: var(--font-size-xs);
  color: var(--color-text-soft);
}

.leaderboard-table th,
.leaderboard-table td {
  padding: 0.7rem 0.9rem;
  border-bottom: 1px solid rgba(30, 64, 175, 0.6);
}

.leaderboard-table tbody tr:nth-child(even) {
  background: rgba(15, 23, 42, 0.7);
}

.leaderboard-table tbody tr:hover {
  background: rgba(30, 64, 175, 0.4);
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-pill);
  font-size: var(--font-size-xs);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: 1px solid rgba(148, 163, 184, 0.5);
  background: radial-gradient(circle at top, rgba(50, 229, 255, 0.32), transparent 55%);
}

.badge--primary {
  border-color: rgba(50, 229, 255, 0.9);
  color: var(--color-primary);
}

.badge--success {
  border-color: rgba(55, 255, 139, 0.9);
  color: var(--color-success);
}

.badge--danger {
  border-color: rgba(255, 75, 110, 0.9);
  color: var(--color-danger);
}

.progress-track {
  position: relative;
  width: 100%;
  height: 0.55rem;
  border-radius: var(--radius-pill);
  background: rgba(15, 23, 42, 0.95);
  overflow: hidden;
}

.progress-bar {
  position: absolute;
  inset: 0;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--color-accent-green), var(--color-primary));
  box-shadow: 0 0 16px rgba(55, 255, 139, 0.8);
  transition: width 220ms ease-out;
}

@media (prefers-reduced-motion: reduce) {
  .progress-bar {
    transition: none;
  }
}
