/* =========================================================================
   ŻużelDLE — System designu i style
   ========================================================================= */

/* ---- Font (self-hosted — bez zapytań do Google Fonts) ----
   Outfit, font zmienny 300–900, licencja SIL OFL. Pliki: vendor/fonts/. */
@font-face {
  font-family: 'Outfit';
  font-style: normal;
  font-weight: 300 900;
  font-display: swap;
  src: url('vendor/fonts/outfit-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Outfit';
  font-style: normal;
  font-weight: 300 900;
  font-display: swap;
  src: url('vendor/fonts/outfit-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ---- Flagi narodowe (self-hosted) ----
   Emoji flagowe to para znaków "regional indicator" (np. 🇵 + 🇱), którą system
   ma złożyć w jeden glif. Windows nie ma glifów flag, więc Chrome i Edge
   pokazują gołe litery "PL" (Firefox nie, bo wozi własną czcionkę emoji).
   Dowozimy więc własną. unicode-range zawęża ją WYŁĄCZNIE do regional
   indicators, dzięki czemu cała reszta tekstu nadal renderuje się Outfitem.
   Twemoji Country Flags — projekt country-flag-emoji-polyfill (TalkJS),
   grafiki Twemoji na licencji CC-BY 4.0.

   UWAGA: czcionka jest podpinana WYŁĄCZNIE tam, gdzie system nie umie
   narysować flagi sam (klasa .flag-font-polyfill na <html>, ustawiana
   w app.js). Powód: to font kolorowy (COLR/CPAL), a WebKit (Safari na
   iOS) po narysowaniu takiego glifu potrafi zostawić ustawiony kolor
   wypełnienia i pomalować nim tekst stojący ZARAZ ZA flagą — nazwiska
   w podpowiedziach i "Polska" w kafelku narodowości wychodziły czerwone.
   Na iOS/macOS/Androidzie flagi są w systemowej czcionce emoji, więc
   polyfill jest tam po prostu niepotrzebny. */
@font-face {
  font-family: 'Twemoji Country Flags';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('vendor/fonts/twemoji-country-flags.woff2') format('woff2');
  unicode-range: U+1F1E6-1F1FF;
}

/* ---- Zmienne CSS ---- */
:root {
  /* Kolory tła */
  --bg-primary: #07060e;
  --bg-secondary: #0f0d1a;
  --bg-card: rgba(255, 255, 255, 0.04);
  --bg-card-hover: rgba(255, 255, 255, 0.07);

  /* Kolory akcentów – motyw ognia i prędkości */
  --accent-primary: #ff6b2c;
  --accent-secondary: #ffb347;
  --accent-gold: #ffd700;
  --accent-glow: rgba(255, 107, 44, 0.3);

  /* Kolory feedbacku */
  --color-correct: #00c853;
  --color-correct-bg: rgba(0, 200, 83, 0.18);
  --color-correct-border: rgba(0, 200, 83, 0.5);
  --color-partial: #ff9800;
  --color-partial-bg: rgba(255, 152, 0, 0.18);
  --color-partial-border: rgba(255, 152, 0, 0.5);
  --color-wrong: #ff1744;
  --color-wrong-bg: rgba(255, 23, 68, 0.15);
  --color-wrong-border: rgba(255, 23, 68, 0.4);

  /* Tekst */
  --text-primary: #f0eff4;
  --text-secondary: #9e9aaf;
  --text-muted: #5c5872;

  /* Bordery */
  --border-subtle: rgba(255, 255, 255, 0.06);
  --border-medium: rgba(255, 255, 255, 0.1);

  /* Cienie */
  --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 30px var(--accent-glow);

  /* Zaokrąglenia */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  /* Animacje */
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: 'Outfit', system-ui, -apple-system, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Czcionka flag musi stać PRZED Outfitem, bo przeglądarka bierze pierwszą
   z listy, która pokrywa dany znak. Jej unicode-range obejmuje tylko
   regional indicators, więc nie podbiera Outfitowi ani jednej litery.
   Klasę na <html> ustawia app.js — tylko gdy system sam nie rysuje flag. */
.flag-font-polyfill body {
  font-family: 'Twemoji Country Flags', 'Outfit', system-ui, -apple-system, sans-serif;
}

/* ---- Tło z subtelnymi efektami ---- */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background:
    radial-gradient(ellipse at 20% 0%, rgba(255, 107, 44, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 100%, rgba(255, 179, 71, 0.05) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 50%, rgba(15, 13, 26, 0.9) 0%, transparent 100%);
  pointer-events: none;
  z-index: 0;
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar {
  width: 6px;
}

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

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

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* ---- Layout ---- */
.app-container {
  position: relative;
  z-index: 1;
  max-width: 960px;
  margin: 0 auto;
  padding: 0 20px 60px;
}

/* ---- Header ---- */
.header {
  text-align: center;
  padding: 40px 0 10px;
}

.header__title {
  font-size: 3.2rem;
  font-weight: 900;
  letter-spacing: -1px;
  line-height: 1.1;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.header__title-text {
  background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 50%, var(--accent-gold) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 0 20px rgba(255, 107, 44, 0.3));
}

.header__logo {
  height: 1.25em;
  width: auto;
  flex: none;
}

.header__subtitle {
  font-size: 0.95rem;
  color: var(--text-secondary);
  font-weight: 300;
  margin-top: 6px;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.daily-countdown {
  margin-top: 10px;
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 500;
}

.daily-countdown__value {
  display: inline-block;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
  color: var(--accent-primary);
}

.header__nav {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 20px;
}

.header__btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.header__btn:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  border-color: var(--border-medium);
  transform: translateY(-1px);
}

/* ---- Mode Selector ---- */
.mode-selector {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 24px 0;
}

.mode-btn {
  padding: 10px 24px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s var(--ease-out-expo);
}

.mode-btn:hover {
  border-color: var(--border-medium);
  color: var(--text-primary);
}

.mode-btn.active {
  background: linear-gradient(135deg, rgba(255, 107, 44, 0.15), rgba(255, 179, 71, 0.1));
  border-color: var(--accent-primary);
  color: var(--accent-secondary);
  box-shadow: 0 0 20px rgba(255, 107, 44, 0.15);
}

/* ---- Difficulty Selector ---- */
.difficulty-selector {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin: -12px 0 16px;
}

.difficulty-selector__label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.diff-btn {
  padding: 6px 14px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s var(--ease-out-expo);
}

.diff-btn:hover {
  border-color: var(--border-medium);
  color: var(--text-primary);
}

.diff-btn.active {
  background: linear-gradient(135deg, rgba(255, 107, 44, 0.15), rgba(255, 179, 71, 0.1));
  border-color: var(--accent-primary);
  color: var(--accent-secondary);
  box-shadow: 0 0 20px rgba(255, 107, 44, 0.15);
}

#diffHardBtn.active {
  background: linear-gradient(135deg, rgba(199, 44, 65, 0.2), rgba(120, 20, 40, 0.15));
  border-color: #c72c41;
  color: #ff8a9b;
  box-shadow: 0 0 20px rgba(199, 44, 65, 0.2);
}

/* ---- Search Container ---- */
.search-container {
  position: relative;
  max-width: 500px;
  margin: 24px auto;
}

.search-input {
  width: 100%;
  padding: 16px 20px;
  padding-left: 48px;
  background: var(--bg-card);
  border: 2px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 1rem;
  font-weight: 400;
  outline: none;
  transition: all 0.3s ease;
}

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

.search-input:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 4px rgba(255, 107, 44, 0.12), var(--shadow-glow);
  background: rgba(255, 255, 255, 0.06);
}

.search-input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.2rem;
  color: var(--text-muted);
  pointer-events: none;
  transition: color 0.3s ease;
}

.search-input:focus ~ .search-icon {
  color: var(--accent-primary);
}

/* ---- Autocomplete ---- */
.autocomplete-list {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: #1a1730;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  max-height: 280px;
  overflow-y: auto;
  display: none;
  z-index: 100;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(20px);
}

.autocomplete-list.show {
  display: block;
  animation: slideDown 0.2s var(--ease-out-expo);
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.autocomplete-item {
  padding: 12px 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: background 0.15s ease;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.autocomplete-item:last-child {
  border-bottom: none;
}

.autocomplete-item:hover,
.autocomplete-item.highlighted {
  background: rgba(255, 107, 44, 0.1);
}

.autocomplete-item__flag {
  font-size: 1.2rem;
}

.autocomplete-item__name {
  font-weight: 500;
  font-size: 0.95rem;
  flex: 1;
}

.autocomplete-item__name mark {
  background: none;
  color: var(--accent-primary);
  font-weight: 700;
}

/* Zdjęcie zawodnika w podpowiedzi — surowa wersja: większe, płaskie
   pomarańczowe tło, bez dodatkowego kadrowania (contain = nic nie ucinamy).
   Inicjały jako fallback (onerror usuwa <img> przy braku pliku). */
.autocomplete-item__avatar {
  position: relative;
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  border-radius: 8px;
  overflow: hidden;
  background: var(--accent-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 800;
  color: #fff;
}

.autocomplete-item__photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: var(--accent-primary);
}

/* ---- Guesses Table ---- */
.guesses-section {
  margin-top: 32px;
}

.guesses-header {
  display: grid;
  grid-template-columns: 1.4fr 1fr 0.8fr 1.8fr 0.7fr 0.7fr 1fr;
  gap: 8px;
  padding: 10px 12px;
  margin-bottom: 8px;
}

.header-cell {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  text-align: center;
}

.guesses-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ---- Guess Row ---- */
.guess-row {
  display: grid;
  grid-template-columns: 1.4fr 1fr 0.8fr 1.8fr 0.7fr 0.7fr 1fr;
  gap: 8px;
  align-items: start;
  animation: rowSlideIn 0.4s var(--ease-out-expo);
}

@keyframes rowSlideIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ---- Guess Cell ---- */
.guess-cell {
  perspective: 600px;
  min-height: 84px;
}

.guess-cell__inner {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 84px;
  transform-style: preserve-3d;
  transition: transform 0.6s var(--ease-out-expo);
}

.guess-cell.revealed .guess-cell__inner {
  transform: rotateX(360deg);
}

.guess-cell__front,
.guess-cell__back {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  padding: 8px 6px;
  backface-visibility: hidden;
  text-align: center;
}

.guess-cell__front {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
}

.guess-cell__back {
  transform: rotateX(180deg);
}

/* Cell states */
.guess-cell.correct .guess-cell__front {
  background: var(--color-correct-bg);
  border-color: var(--color-correct-border);
}

.guess-cell.partial .guess-cell__front {
  background: var(--color-partial-bg);
  border-color: var(--color-partial-border);
}

.guess-cell.wrong .guess-cell__front {
  background: var(--color-wrong-bg);
  border-color: var(--color-wrong-border);
}

/* Cell content styling */
.cell-value {
  font-weight: 600;
  font-size: 0.85rem;
  line-height: 1.3;
}

.cell-flag {
  font-size: 1.6rem;
  line-height: 1;
  margin-bottom: 2px;
}

/* Strzałka kierunku (rocznik, IMŚ, DMP) — rysowana wektorem w app.js.
   Emoji ⬆️/⬇️ w tym rozmiarze było nieczytelne: kolorowy kafelek, w którym
   trzeba się było wpatrywać, w którą stronę leci grot. Biały grot na
   przygaszonym krążku czyta się od razu i wygląda tak samo w każdym systemie. */
.cell-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  margin-top: 3px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  vertical-align: middle; /* dla użycia w tekście instrukcji "Jak grać" */
}

.cell-arrow svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.cell-name {
  font-weight: 700;
  font-size: 0.8rem;
  line-height: 1.2;
}

.cell-rider-avatar {
  position: relative;
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  border-radius: 8px;
  overflow: hidden;
  background: var(--accent-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  font-weight: 800;
  margin-bottom: 4px;
  color: #fff;
}

/* Zdjęcie zawodnika (zdjecia/{id}.webp) — nakłada się na inicjały;
   contain = nic nie ucinamy; przy braku pliku onerror usuwa <img>
   i zostają inicjały. Pomarańczowe tło zasłania inicjały pod spodem
   w przezroczystych (~45%) miejscach zdjęcia — inaczej białe litery
   prześwitują przez sylwetkę. */
.cell-rider-photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: var(--accent-primary);
}

/* ---- Clubs cell: grows with content (absolute front would clip pills) ---- */
.guess-cell--clubs {
  min-height: 84px;
  height: auto;
}

.guess-cell--clubs .guess-cell__inner {
  height: auto;
  min-height: 84px;
}

.guess-cell--clubs .guess-cell__front {
  position: relative;
  inset: auto;
  height: auto;
  min-height: 84px;
  justify-content: center;
  padding: 6px 5px;
}

/* ---- Clubs pills ---- */
.clubs-container {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  justify-content: center;
  align-content: center;
  width: 100%;
}

.club-pill {
  font-size: 0.58rem;
  padding: 2px 5px;
  border-radius: 4px;
  font-weight: 600;
  line-height: 1.25;
  border: 1px solid transparent;
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.club-pill.match {
  background: rgba(0, 200, 83, 0.25);
  border-color: rgba(0, 200, 83, 0.5);
  color: #6fdf9e;
}

.club-pill.no-match {
  background: rgba(255, 23, 68, 0.12);
  border-color: rgba(255, 23, 68, 0.3);
  color: #ff7e9a;
}

.club-pill--more {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.14);
  color: var(--text-muted);
  cursor: default;
}

/* ---- Victory state ---- */
.guess-row.victory .guess-cell {
  animation: victoryPulse 0.6s ease forwards;
}

@keyframes victoryPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.06); }
  100% { transform: scale(1); }
}

/* ---- Solved Banner ---- */
.solved-banner {
  text-align: center;
  padding: 30px 20px;
  margin-top: 24px;
  background: linear-gradient(135deg, rgba(0, 200, 83, 0.08), rgba(255, 215, 0, 0.06));
  border: 1px solid rgba(0, 200, 83, 0.2);
  border-radius: var(--radius-lg);
  animation: bannerFadeIn 0.6s var(--ease-out-expo);
}

@keyframes bannerFadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.solved-banner__avatar {
  position: relative;
  width: 84px;
  height: 84px;
  margin: 0 auto 8px;
  border-radius: 50%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.solved-banner__photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  border: 3px solid var(--color-correct);
}

.solved-banner__emoji {
  font-size: 3rem;
}

.solved-banner__title {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--color-correct);
  margin-bottom: 4px;
}

.solved-banner__subtitle {
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.solved-banner__subtitle:has(+ .solved-banner__timer) {
  margin-bottom: 6px;
}

.solved-banner__timer {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.solved-banner__timer-value {
  display: inline-block;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
  color: var(--accent-primary);
}

.solved-banner__actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

.btn {
  padding: 10px 24px;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s ease;
  border: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  color: #fff;
  box-shadow: 0 4px 16px rgba(255, 107, 44, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(255, 107, 44, 0.4);
}

.btn-secondary {
  background: var(--bg-card);
  border: 1px solid var(--border-medium);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background: var(--bg-card-hover);
  transform: translateY(-1px);
}

/* ---- Modals ---- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  padding: 20px;
}

.modal-overlay.show {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: linear-gradient(160deg, #1e1b2e, #14122a);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-xl);
  padding: 32px;
  max-width: 480px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  transform: scale(0.9) translateY(20px);
  transition: transform 0.3s var(--ease-spring);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6);
}

.modal-overlay.show .modal {
  transform: scale(1) translateY(0);
}

.modal__title {
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 16px;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.modal__close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-secondary);
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.modal__close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}

.modal p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 12px;
}

/* ---- Modal: udostępnianie ---- */
.share-modal {
  max-width: 420px;
}

.share-preview {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: #0b0913;
  border: 1px solid var(--border-medium);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 4px 0 18px;
}

.share-preview__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.share-preview__spinner {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.12);
  border-top-color: var(--accent-primary);
  animation: share-spin 0.8s linear infinite;
}

@keyframes share-spin {
  to { transform: rotate(360deg); }
}

.share-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.share-action {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 13px 16px;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid var(--border-medium);
  background: var(--bg-card);
  color: var(--text-primary);
  text-align: left;
}

.share-action:hover {
  background: var(--bg-card-hover);
  transform: translateY(-1px);
}

.share-action__icon {
  font-size: 1.25rem;
  line-height: 1;
  flex-shrink: 0;
}

.share-action--primary {
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  border-color: transparent;
  color: #fff;
  box-shadow: 0 4px 16px rgba(255, 107, 44, 0.3);
}

.share-action--primary:hover {
  box-shadow: 0 6px 24px rgba(255, 107, 44, 0.4);
}

.share-hint {
  font-size: 0.8rem !important;
  color: var(--text-muted) !important;
  text-align: center;
  margin: 14px 0 0 !important;
  min-height: 1em;
}

.modal .legend {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 16px 0;
}

.modal .legend-item {
  display: flex;
  align-items: center;
  gap: 12px;
}

.modal .legend-swatch {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
  flex-shrink: 0;
}

.modal .legend-swatch.correct {
  background: var(--color-correct-bg);
  border: 1px solid var(--color-correct-border);
  color: var(--color-correct);
}

.modal .legend-swatch.partial {
  background: var(--color-partial-bg);
  border: 1px solid var(--color-partial-border);
  color: var(--color-partial);
}

.modal .legend-swatch.wrong {
  background: var(--color-wrong-bg);
  border: 1px solid var(--color-wrong-border);
  color: var(--color-wrong);
}

.modal .legend-text {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* ---- Stats Modal ---- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin: 20px 0;
}

.stat-item {
  text-align: center;
  padding: 12px 6px;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.stat-value {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--accent-secondary);
}

.stat-label {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ---- Streak indicator ---- */
.streak-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 16px;
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.1), rgba(255, 107, 44, 0.08));
  border: 1px solid rgba(255, 215, 0, 0.2);
  border-radius: var(--radius-lg);
  margin: 12px auto;
  width: fit-content;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent-gold);
}

.streak-indicator__fire {
  font-size: 1.1rem;
}

/* ---- Attempt counter ---- */
.attempt-counter {
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 12px;
  font-weight: 500;
}

/* ---- Confetti particles ---- */
.confetti-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9999;
  overflow: hidden;
}

.confetti {
  position: absolute;
  width: 10px;
  height: 10px;
  top: -10px;
  animation: confettiFall linear forwards;
}

@keyframes confettiFall {
  0% {
    transform: translateY(-10px) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translateY(110vh) rotate(720deg);
    opacity: 0;
  }
}

/* ---- Toast notification ---- */
.toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(-100px);
  background: #1e1b2e;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  padding: 12px 24px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  z-index: 10000;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  transition: transform 0.4s var(--ease-spring);
}

.toast.show {
  transform: translateX(-50%) translateY(0);
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .header__title {
    font-size: 2.4rem;
  }

  .guesses-header {
    display: none;
  }

  .guess-row {
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    padding: 12px;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
  }

  /* Pozostałe komórki wracają do niższej wysokości (bez dużego zdjęcia) */
  .guess-cell,
  .guess-cell__inner {
    min-height: 64px;
  }

  .guess-cell:first-child {
    grid-column: 1 / -1;
  }

  /* Pierwsza komórka jest pełnej szerokości — zdjęcie może być większe,
     komórka musi być wyższa, żeby 64-px zdjęcie + nazwisko się zmieściły */
  .guess-cell:first-child,
  .guess-cell:first-child .guess-cell__inner {
    min-height: 100px;
  }

  .cell-rider-avatar {
    width: 64px;
    height: 64px;
    border-radius: 10px;
    font-size: 1.2rem;
  }

  /* Clubs cell spans full width on mobile */
  .guess-cell:nth-child(4),
  .guess-cell--clubs {
    grid-column: 1 / -1;
  }

  .guess-cell--clubs .guess-cell__front {
    min-height: 64px;
  }

  .club-pill {
    font-size: 0.62rem;
    padding: 2px 6px;
  }

  .guess-cell__front {
    padding: 6px 4px;
  }

  .cell-label {
    display: block;
    font-size: 0.55rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-bottom: 2px;
    font-weight: 700;
  }

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

  .modal {
    padding: 24px 20px;
    border-radius: var(--radius-lg);
  }
}

@media (min-width: 769px) {
  .cell-label {
    display: none;
  }
}

/* ---- Utility ---- */
.hidden {
  display: none !important;
}

/* ---- Ranking: konto ---- */
.ranking-auth {
  margin-bottom: 16px;
  padding: 12px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  background: var(--bg-card);
}

.ranking-auth p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

.ranking-auth__note {
  margin: 10px 0 0;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.ranking-auth__note a {
  color: var(--text-secondary);
}

.ranking-auth__error {
  margin: 10px 0 0;
  font-size: 0.8rem;
  color: #ff6b6b;
}

/* Google wymaga własnego logo na jasnym lub białym tle — stąd wyłom
   z pomarańczowej palety reszty przycisków. */
.btn-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  background: #fff;
  color: #1f1f1f;
  border: 1px solid rgba(0, 0, 0, 0.12);
}

.btn-google:hover:not(:disabled) {
  background: #f2f2f2;
}

.btn-google:disabled {
  opacity: 0.6;
  cursor: default;
}

.btn-google__mark {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.ranking-me__head {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.ranking-me__label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.ranking-me__nick {
  font-size: 1rem;
  font-weight: 700;
  color: var(--accent-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ranking-me__stats {
  margin: 6px 0 0 !important;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.ranking-me__actions {
  display: flex;
  gap: 16px;
  margin-top: 10px;
}

.ranking-me__link {
  padding: 0;
  border: none;
  background: none;
  font-family: inherit;
  font-size: 0.78rem;
  color: var(--text-muted);
  text-decoration: underline;
  cursor: pointer;
}

.ranking-me__link:hover {
  color: var(--text-primary);
}

.ranking-me__link--danger:hover,
.ranking-me__link.is-armed {
  color: #ff6b6b;
  font-weight: 600;
}

.ranking-join__form {
  display: flex;
  gap: 8px;
}

.ranking-join__input {
  flex: 1;
  min-width: 0;
  padding: 10px 14px;
  background: var(--bg-card);
  border: 2px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.9rem;
  outline: none;
}

.ranking-join__input:focus {
  border-color: var(--accent-primary);
}

.ranking-join__error {
  margin-top: 8px;
  font-size: 0.8rem;
  color: #ff6b6b;
}

.ranking-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.ranking-tab {
  flex: 1;
  padding: 8px 16px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s var(--ease-out-expo);
}

.ranking-tab.active {
  background: linear-gradient(135deg, rgba(255, 107, 44, 0.15), rgba(255, 179, 71, 0.1));
  border-color: var(--accent-primary);
  color: var(--accent-secondary);
}

.ranking-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-lg);
  margin-bottom: 4px;
  background: var(--bg-card);
  border: 1px solid transparent;
}

.ranking-row.me {
  border-color: var(--accent-primary);
  background: linear-gradient(135deg, rgba(255, 107, 44, 0.12), rgba(255, 179, 71, 0.08));
}

.ranking-row__pos {
  width: 32px;
  text-align: center;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.ranking-row__nick {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-primary);
}

.ranking-row__value {
  font-size: 0.8rem;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.ranking-empty {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  padding: 16px 0;
}

.text-gradient {
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Loading shimmer for cells before reveal */
.guess-cell.loading .guess-cell__front {
  background: linear-gradient(
    90deg,
    var(--bg-card) 25%,
    rgba(255, 255, 255, 0.06) 50%,
    var(--bg-card) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

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

/* =========================================================================
   Stopka i strony prawne (regulamin.html, prywatnosc.html)
   ========================================================================= */

.footer {
  margin-top: 48px;
  padding: 20px 12px 28px;
  border-top: 1px solid var(--border-subtle);
  text-align: center;
}

.footer__disclaimer {
  color: var(--text-muted);
  font-size: 0.72rem;
  line-height: 1.5;
  max-width: 560px;
  margin: 0 auto 12px;
}

.footer__links {
  display: flex;
  justify-content: center;
  gap: 10px;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.footer__links a {
  color: var(--text-secondary);
  text-decoration: none;
}

.footer__links a:hover {
  color: var(--accent-secondary);
  text-decoration: underline;
}

.legal {
  max-width: 720px;
  margin: 0 auto;
  padding: 32px 20px 48px;
  color: var(--text-primary);
}

/* Strony tekstowe (regulamin, polityka prywatności) są dłuższe niż jeden
   ekran — środkowa, ciemna winieta z body::before jest position:fixed
   względem viewportu, więc przy scrollu zasłania tekst na środku okna.
   Usuwamy ją tu, zostawiając tylko delikatne narożne poświaty. */
body:has(.legal)::before {
  background:
    radial-gradient(ellipse at 20% 0%, rgba(255, 107, 44, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 100%, rgba(255, 179, 71, 0.05) 0%, transparent 50%);
}

.legal h1 {
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 4px;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.legal .legal__updated {
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-bottom: 24px;
}

.legal h2 {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 28px 0 10px;
  color: var(--text-primary);
}

/* Podsekcja wewnątrz rozdziału — wyraźnie niżej w hierarchii niż h2,
   żeby nie czytała się jak osobny punkt regulaminu. */
.legal h3 {
  font-size: 0.95rem;
  font-weight: 700;
  margin: 20px 0 8px;
  color: var(--text-secondary);
}

.legal p, .legal li {
  font-size: 0.9rem;
  line-height: 1.65;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

.legal ul, .legal ol {
  padding-left: 22px;
  margin-bottom: 12px;
}

.legal li { margin-bottom: 6px; }

.legal a { color: var(--accent-secondary); }

.legal code {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 0.8rem;
}

.legal .legal__back {
  display: inline-block;
  margin-bottom: 20px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.85rem;
}

.legal .legal__back:hover { color: var(--accent-secondary); }
