/* =========================================
   Variables
   ========================================= */
:root {
  /* Color Palette */
  --color-background: #050814;
  --color-surface: #0b1020;
  --color-surface-elevated: #141a2e;
  --color-text: #f5f7ff;
  --color-text-muted: #a7b0d0;
  --color-border-subtle: #242b40;

  --color-primary: #4f46e5; /* gaming violet/indigo */
  --color-primary-soft: rgba(79, 70, 229, 0.16);
  --color-primary-strong: #6366f1;

  --color-success: #22c55e;
  --color-warning: #facc15;
  --color-danger: #ef4444;

  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2933;
  --gray-900: #111827;

  /* Typography */
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-display: "Rajdhani", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: 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-base: 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.15;
  --line-height-snug: 1.3;
  --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 */

  /* Radius */
  --radius-sm: 0.25rem;   /* 4px */
  --radius-md: 0.5rem;    /* 8px */
  --radius-lg: 0.75rem;   /* 12px */
  --radius-xl: 1rem;      /* 16px */
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.5);
  --shadow-md: 0 8px 20px rgba(0, 0, 0, 0.55);
  --shadow-lg: 0 18px 40px rgba(0, 0, 0, 0.7);

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

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

html,
body,
h1,
h2,
h3,
h4,
h5,
h6,
p,
figure,
blockquote,
dl,
dd,
ul,
ol,
li {
  margin: 0;
  padding: 0;
}

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

body {
  min-height: 100vh;
}

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

img,
video {
  height: auto;
}

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

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

ul,
ol {
  list-style: none;
}

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

fieldset {
  border: 0;
  margin: 0;
  padding: 0;
}

/* =========================================
   Base Styles
   ========================================= */
body {
  font-family: var(--font-sans);
  font-size: var(--font-size-base);
  line-height: var(--line-height-normal);
  background-color: var(--color-background);
  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: 600;
  line-height: var(--line-height-snug);
  color: var(--color-text);
}

h1 {
  font-size: clamp(var(--font-size-3xl), 4vw, var(--font-size-5xl));
  margin-bottom: var(--space-4);
}

h2 {
  font-size: clamp(var(--font-size-2xl), 3vw, var(--font-size-4xl));
  margin-top: var(--space-8);
  margin-bottom: var(--space-3);
}

h3 {
  font-size: var(--font-size-xl);
  margin-top: var(--space-6);
  margin-bottom: var(--space-2);
}

h4 {
  font-size: var(--font-size-lg);
  margin-top: var(--space-4);
  margin-bottom: var(--space-2);
}

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

strong,
b {
  font-weight: 600;
}

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

pre {
  padding: var(--space-3);
  border-radius: var(--radius-md);
  background: rgba(15, 23, 42, 0.9);
  overflow-x: auto;
}

a {
  color: var(--color-primary-strong);
  text-decoration: none;
  transition: color var(--transition-base),
              box-shadow var(--transition-base),
              background-color var(--transition-base);
}

a:hover {
  color: #a855f7;
}

a:focus-visible {
  outline: 2px solid var(--color-primary-strong);
  outline-offset: 2px;
}

hr {
  border: 0;
  border-top: 1px solid var(--color-border-subtle);
  margin: var(--space-6) 0;
}

/* =========================================
   Accessibility & Motion
   ========================================= */
:focus-visible {
  outline: 2px solid var(--color-primary-strong);
  outline-offset: 2px;
}

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

/* 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;
}

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

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

/* Flex helpers */
.flex {
  display: flex;
}

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

.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.flex-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

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

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

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

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

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

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

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

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

/* Spacing utilities (commonly used) */
.mt-0 { margin-top: 0; }
.mt-sm { margin-top: var(--space-2); }
.mt-md { margin-top: var(--space-4); }
.mt-lg { margin-top: var(--space-6); }

.mb-0 { margin-bottom: 0; }
.mb-sm { margin-bottom: var(--space-2); }
.mb-md { margin-bottom: var(--space-4); }
.mb-lg { margin-bottom: var(--space-6); }

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

/* =========================================
   Form Elements & Inputs
   ========================================= */
input[type="text"],
input[type="search"],
input[type="email"],
input[type="password"],
select,
textarea {
  width: 100%;
  padding: 0.6rem 0.8rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border-subtle);
  background-color: rgba(15, 23, 42, 0.9);
  color: var(--color-text);
  transition: border-color var(--transition-base),
              box-shadow var(--transition-base),
              background-color var(--transition-base);
}

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

input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: none;
  border-color: var(--color-primary-strong);
  box-shadow: 0 0 0 1px var(--color-primary-soft), 0 0 0 1px rgba(0, 0, 0, 0.7);
}

input[disabled],
select[disabled],
textarea[disabled] {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Search-specific styling for on-site guide search bars */
.input-search {
  position: relative;
}

.input-search input[type="search"] {
  padding-left: 2.2rem;
}

.input-search-icon {
  position: absolute;
  left: 0.7rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.9rem;
  color: var(--color-text-muted);
  pointer-events: none;
}

/* =========================================
   Buttons
   ========================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.55rem 1.1rem;
  border-radius: var(--radius-full);
  border: 1px solid transparent;
  font-size: var(--font-size-sm);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: background-color var(--transition-base),
              color var(--transition-base),
              box-shadow var(--transition-base),
              transform var(--transition-fast),
              border-color var(--transition-base);
  white-space: nowrap;
}

.btn-primary {
  background: radial-gradient(circle at top, #6366f1 0, #4f46e5 45%, #312e81 100%);
  color: #f9fafb;
  box-shadow: 0 0 0 1px rgba(79, 70, 229, 0.3), var(--shadow-md);
}

.btn-primary:hover {
  background: radial-gradient(circle at top, #818cf8 0, #4f46e5 40%, #312e81 100%);
  transform: translateY(-1px);
  box-shadow: 0 0 0 1px rgba(129, 140, 248, 0.4), var(--shadow-lg);
  color: white !important;
}

.btn-secondary {
  background-color: rgba(15, 23, 42, 0.8);
  border-color: var(--color-border-subtle);
  color: var(--color-text);
}

.btn-secondary:hover {
  background-color: rgba(31, 41, 55, 0.9);
  border-color: var(--color-primary-soft);
}

.btn-ghost {
  background: transparent;
  color: var(--color-text-muted);
}

.btn-ghost:hover {
  color: var(--color-text);
  background-color: rgba(15, 23, 42, 0.7);
}

.btn:focus-visible {
  outline: 2px solid var(--color-primary-strong);
  outline-offset: 2px;
}

.btn[disabled],
.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

/* =========================================
   Cards & Surfaces
   ========================================= */
.card {
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.95), rgba(15, 23, 42, 0.98));
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  border: 1px solid rgba(79, 70, 229, 0.15);
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
}

.card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at top left, rgba(79, 70, 229, 0.18), transparent 55%);
  opacity: 0.75;
  pointer-events: none;
}

.card > * {
  position: relative;
}

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

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

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

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

/* =========================================
   Badges / Labels (for categories, difficulty, etc.)
   ========================================= */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.55rem;
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-muted);
  background-color: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.2);
}

.badge-primary {
  color: #c7d2fe;
  background-color: rgba(79, 70, 229, 0.16);
  border-color: rgba(79, 70, 229, 0.5);
}

.badge-success {
  color: #bbf7d0;
  background-color: rgba(34, 197, 94, 0.12);
  border-color: rgba(34, 197, 94, 0.6);
}

.badge-warning {
  color: #fef3c7;
  background-color: rgba(250, 204, 21, 0.12);
  border-color: rgba(250, 204, 21, 0.6);
}

/* =========================================
   Tables (for rankings & comparison tables)
   ========================================= */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--font-size-sm);
}

thead {
  background: rgba(15, 23, 42, 0.95);
}

thead th {
  text-align: left;
  padding: 0.7rem 0.8rem;
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border-bottom: 1px solid var(--color-border-subtle);
}

tbody tr {
  border-bottom: 1px solid rgba(31, 41, 55, 0.85);
}

tbody tr:nth-child(odd) {
  background-color: rgba(15, 23, 42, 0.9);
}

tbody tr:nth-child(even) {
  background-color: rgba(15, 23, 42, 0.85);
}

td {
  padding: 0.65rem 0.8rem;
  color: var(--color-text-muted);
}

/* =========================================
   Chips / Filters (for categories like Poradniki, Rankingi)
   ========================================= */
.filter-group {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.3rem 0.8rem;
  border-radius: var(--radius-full);
  border: 1px solid rgba(148, 163, 184, 0.3);
  background-color: rgba(15, 23, 42, 0.85);
  color: var(--color-text-muted);
  font-size: 0.75rem;
  cursor: pointer;
  transition: background-color var(--transition-base),
              border-color var(--transition-base),
              color var(--transition-base);
}

.filter-chip.is-active {
  border-color: rgba(79, 70, 229, 0.8);
  background-color: rgba(79, 70, 229, 0.18);
  color: #e0e7ff;
}

.filter-chip:focus-visible {
  outline: 2px solid var(--color-primary-strong);
  outline-offset: 2px;
}

/* =========================================
   Alerts / Info Blocks (for disclaimers, business model notes)
   ========================================= */
.alert {
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  font-size: var(--font-size-sm);
  display: flex;
  gap: var(--space-3);
  align-items: flex-start;
}

.alert-info {
  background-color: rgba(59, 130, 246, 0.08);
  border: 1px solid rgba(59, 130, 246, 0.4);
  color: #dbeafe;
}

.alert-warning {
  background-color: rgba(250, 204, 21, 0.08);
  border: 1px solid rgba(250, 204, 21, 0.4);
  color: #fef9c3;
}

.alert-danger {
  background-color: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #fee2e2;
}

/* =========================================
   Misc Utilities
   ========================================= */
.text-center { text-align: center; }
.text-right { text-align: right; }

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

.shadow-sm { box-shadow: var(--shadow-sm); }
.shadow-md { box-shadow: var(--shadow-md); }
.shadow-lg { box-shadow: var(--shadow-lg); }

.rounded-sm { border-radius: var(--radius-sm); }
.rounded-md { border-radius: var(--radius-md); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-full { border-radius: var(--radius-full); }

.bg-surface {
  background-color: var(--color-surface);
}

.bg-surface-elevated {
  background-color: var(--color-surface-elevated);
}

/* Subtle neon edge for selected / active elements */
.glow-primary {
  box-shadow: 0 0 0 1px rgba(79, 70, 229, 0.65), 0 0 18px rgba(79, 70, 229, 0.28);
}
