/* ================================================================
   SYMULATOR FPV — style globalne
   ================================================================ */

body {
  margin: 0;
  overflow: hidden;
  background: #000;
  font-family: monospace;
  color: #0f0;
}

/* ─── Overlay / panel ─── */
#overlay {
  position: fixed; inset: 0; z-index: 100;
  background: #000; 
  display: flex; align-items: center; justify-content: center;
  color: #0f0; overflow-y: auto;
}

#overlay.hidden { display: none; }

#panel {
  position: relative;
  max-width: 820px; width: 95%;
  border: 2px solid #0f0; padding: 25px;
  background: #0a0a0a; border-radius: 8px;
  margin: 20px 0;
}
#panel h1 { color: #0ff; margin-top: 0; font-size: 22px; }
#panel h2 { color: #0ff; font-size: 17px; margin-top: 15px; }
#panel p, #panel li { line-height: 1.6; font-size: 14px; }
#panel button {
  padding: 10px 20px; font-size: 15px; cursor: pointer;
  background: #0f0; color: #000; border: none; border-radius: 6px;
  font-family: monospace; font-weight: bold; margin: 4px;
}
#panel button:hover { background: #0c0; }
#panel button.secondary { background: #066; color: #0ff; }
#panel button.danger { background: #a00; color: #fff; }
#panel button:disabled { background: #333; color: #666; cursor: not-allowed; }

.hint { color: #ff0; font-size: 13px; }

.step { display: none; }
.step.active { display: block; }

/* ─── Link do repozytorium ─── */
.repo-link {
  background: #0a1a0a;
  border: 1px solid #0f0;
  border-radius: 6px;
  padding: 12px 15px;
  margin: 15px 0;
  font-size: 13px;
  line-height: 1.6;
}
.repo-link a {
  color: #0ff;
  text-decoration: none;
  word-break: break-all;
  font-weight: bold;
}
.repo-link a:hover {
  color: #fff;
  text-decoration: underline;
}

/* ─── Przełącznik języka — sama flaga w prawym górnym rogu panelu ─── */
#langToggle.lang-toggle {
  position: absolute;
  top: 15px;
  right: 15px;
  width: auto;
  height: auto;
  padding: 4px 6px;
  background: transparent;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", "Segoe UI Symbol", sans-serif;
  font-size: 22px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease, filter 0.15s ease;
  margin: 0;
  z-index: 10;
  filter: drop-shadow(0 0 4px rgba(0, 255, 0, 0.4));
}
#langToggle.lang-toggle:hover {
  transform: scale(1.15);
  filter: drop-shadow(0 0 8px rgba(0, 255, 255, 0.8));
}
#langToggle.lang-toggle:active {
  transform: scale(0.95);
}

/* ─── Lista osi (mapowanie) ─── */
.axis-row {
  display: flex; align-items: center; gap: 10px;
  margin: 8px 0; padding: 6px 10px;
  background: #111; border: 1px solid #333; border-radius: 4px;
}
.axis-label { width: 40px; color: #0ff; font-weight: bold; }
.axis-value { width: 60px; text-align: right; color: #ff0; font-size: 13px; }
.axis-bar {
  flex: 1; height: 16px; background: #222;
  border: 1px solid #444; border-radius: 3px;
  position: relative; overflow: hidden;
}
.axis-bar-fill {
  position: absolute; top: 0; height: 100%;
  background: linear-gradient(90deg, #066, #0f0);
  transition: left 0.05s linear, width 0.05s linear;
}
.axis-bar-center {
  position: absolute; top: 0; left: 50%; width: 1px; height: 100%;
  background: #666;
}
.axis-select {
  padding: 5px; background: #000; color: #0f0;
  border: 1px solid #0f0; font-family: monospace; font-size: 13px;
  width: 130px;
}
.axis-status { width: 20px; text-align: center; }

/* ─── Kalibracja ─── */
.calib-box {
  background: #111; border: 1px solid #0f0; padding: 20px;
  border-radius: 6px; margin: 15px 0; text-align: center;
}
.calib-instruction { font-size: 18px; color: #ff0; margin-bottom: 10px; }
.calib-progress {
  height: 24px; background: #222; border: 1px solid #444;
  border-radius: 4px; overflow: hidden; margin: 10px 0;
}
.calib-progress > div {
  height: 100%; background: #0f0; width: 0%;
  transition: width 0.1s linear;
}
.calib-values { color: #0ff; font-size: 13px; margin-top: 10px; }
.calib-timer { color: #ff0; font-size: 14px; margin-top: 5px; font-weight: bold; }
.calib-error { color: #f44; font-size: 14px; margin-top: 10px; display: none; }

/* ─── Schemat pada (SVG) ─── */
.pad-scheme {
  display: flex; justify-content: center; gap: 40px;
  margin: 15px 0 20px;
  background: #0a0a0a; border: 1px solid #333;
  border-radius: 6px; padding: 15px;
}
.pad-scheme svg { display: block; }
.pad-scheme .stick-highlight circle:first-of-type {
  stroke: #ff0; stroke-width: 3;
  filter: drop-shadow(0 0 6px #ff0);
}

/* ─── Wybór planszy ─── */
.world-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px; margin: 20px 0;
}
.world-card {
  padding: 15px;
  border-radius: 6px;
  cursor: pointer;
  transition: box-shadow 0.2s;
  user-select: none;
}
.world-card:hover { box-shadow: 0 0 15px #fff3; }
.world-card h3 { margin-top: 0; font-size: 18px; }
.world-card p { font-size: 12px; color: #aaa; margin-bottom: 0; }

.world-card[data-world="beginner"] {
  border: 2px solid #0f0; background: #0a1a0a;
}
.world-card[data-world="beginner"] h3 { color: #0f0; }

.world-card[data-world="intermediate"] {
  border: 2px solid #ff0; background: #1a1a0a;
}
.world-card[data-world="intermediate"] h3 { color: #ff0; }

.world-card[data-world="expert"] {
  border: 2px solid #f00; background: #1a0a0a;
}
.world-card[data-world="expert"] h3 { color: #f00; }

.world-card[data-world="expert_race"] {
  border: 2px solid #ff00ff;
  background: #1a0a1a;
}
.world-card[data-world="expert_race"] h3 {
  color: #ff00ff;
}

/* ─── HUD ─── */
#hud {
  position: absolute; top: 10px; left: 10px; color: #0f0;
  background: rgba(0,0,0,0.5); padding: 10px; font-size: 14px;
  border: 1px solid #0f0; pointer-events: none; line-height: 1.6;
  z-index: 50;
}
#hud.hidden { display: none; }
#hud.paused { border-color: #f00; color: #f44; }

/* ─── Przycisk Menu ─── */
#menuBtn {
  position: absolute; top: 10px; right: 10px; z-index: 50;
  padding: 8px 16px; background: #066; color: #0ff;
  border: 1px solid #0ff; cursor: pointer; font-family: monospace;
  font-size: 14px;
}
#menuBtn.hidden { display: none; }

/* ─── Banner rozłączenia ─── */
#reconnectBanner {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  background: rgba(0,0,0,0.92); border: 2px solid #f00;
  padding: 25px 40px; color: #f44; font-size: 18px; z-index: 60;
  border-radius: 8px; text-align: center; display: none;
}
#reconnectBanner.show { display: block; }
#reconnectBanner button {
  margin-top: 15px; padding: 10px 20px; background: #f00; color: #fff;
  border: none; border-radius: 6px; font-family: monospace; font-size: 15px;
  cursor: pointer; font-weight: bold;
}

/* ─── Celownik FPV (Spacja) ─── */
#crosshair {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none; z-index: 40;
  opacity: 0.9;
}
#crosshair.hidden { display: none; }

/* ─── Wskaźnik pauzy (P) ─── */
#pauseIndicator {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0,0,0,0.85); border: 2px solid #ff0;
  padding: 20px 35px; color: #ff0; font-size: 22px;
  font-weight: bold; border-radius: 8px; z-index: 55;
  text-align: center; font-family: monospace;
}
#pauseIndicator.hidden { display: none; }

/* ─── Toggle opcji (checkbox) ─── */
.options-row {
  margin: 15px 0;
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}

.option-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-family: monospace;
  font-size: 14px;
  color: #0f0;
  user-select: none;
}

.option-toggle input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: #0f0;
  cursor: pointer;
}

/* ─── Flash przy kolizji ─── */
#hud.collision {
  background: rgba(255, 0, 0, 0.5);
  border-color: #f00;
  color: #fff;
  animation: collisionFlash 0.3s ease-out;
}

@keyframes collisionFlash {
  0%   { background: rgba(255, 0, 0, 0.9); }
  100% { background: rgba(0, 0, 0, 0.5); }
}

/* === F1 — licznik bramek === */
#gate-counter,
#gate-timer {
  font-family: 'Courier New', monospace;
  color: #00ffcc;
  text-shadow: 0 0 6px #00ffcc88;
  font-size: 14px;
  line-height: 1.4;
}
#gate-counter.finished,
#gate-timer.finished {
  color: #ffcc00;
  text-shadow: 0 0 10px #ffcc00aa;
}

/* ─── Przyciski audio (M / N / B) ─── */
#mute-btn,
#music-btn {
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid #00ffcc88;
  color: #00ffcc;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 18px;
  cursor: pointer;
}
#mute-btn:hover,
#music-btn:hover {
  border-color: #00ffcc;
  box-shadow: 0 0 12px #00ffcc66;
}

/* ─── Wskaźnik audio w HUD (silnik / muzyka) ─── */
#audio-status {
  display: flex;
  gap: 6px;
  margin-top: 4px;
  font-size: 14px;
}
#audio-status span {
  opacity: 0.9;
  transition: opacity 0.15s, filter 0.15s;
}
#audio-status span.muted {
  opacity: 0.25;
  filter: grayscale(1);
}

/* ─── Wideo w tle ─── */
#bgVideo {
  position: fixed; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  z-index: 0;
}
#bgShade {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 1;
}
#panel {
  z-index: 2;
  background: rgba(10, 10, 10, 0.82);
  backdrop-filter: blur(4px);
}


/* ─── Ghost Replay ─── */
#ghost-delta {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 14px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.35);
  transition: color 0.15s, background 0.15s;
}
#ghost-delta.ahead  { color: #66ff99; background: rgba(0, 80, 0, 0.4); }
#ghost-delta.behind { color: #ff6666; background: rgba(80, 0, 0, 0.4); }
#ghost-delta.hidden { display: none; }

/* ─── Ghost Replay: delta czasu w HUD ─── */
#ghost-delta {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 14px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.35);
  transition: color 0.15s, background 0.15s;
}
#ghost-delta.ahead  { color: #66ff99; background: rgba(0, 80, 0, 0.4); }
#ghost-delta.behind { color: #ff6666; background: rgba(80, 0, 0, 0.4); }
#ghost-delta.hidden { display: none; }

/* ─── Ghost intro: „Twój poprzedni wynik goni Cię!" ─── */
#ghost-intro {
  position: fixed;
  top: 15%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9000;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.35s ease, transform 0.35s ease;
}
#ghost-intro.hidden { display: none; }

#ghost-intro.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.ghost-intro-card {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 18px 32px;
  background: rgba(10, 20, 40, 0.85);
  border: 2px solid #66ccff;
  border-radius: 14px;
  box-shadow: 0 0 30px rgba(102, 204, 255, 0.55),
              0 0 60px rgba(102, 204, 255, 0.25);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: ghost-intro-pop 0.4s ease-out;
}

@keyframes ghost-intro-pop {
  0%   { transform: scale(0.85); opacity: 0; }
  60%  { transform: scale(1.05); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

.ghost-intro-icon {
  font-size: 48px;
  line-height: 1;
  filter: drop-shadow(0 0 12px rgba(102, 204, 255, 0.8));
  animation: ghost-intro-float 2s ease-in-out infinite;
}

@keyframes ghost-intro-float {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-6px); }
}

.ghost-intro-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ghost-intro-title {
  font-size: 20px;
  font-weight: 700;
  color: #e8f6ff;
  letter-spacing: 0.3px;
  text-shadow: 0 0 12px rgba(102, 204, 255, 0.7);
}

.ghost-intro-time-label {
  font-size: 13px;
  color: #a8c8e0;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  letter-spacing: 0.5px;
}

.ghost-intro-time {
  color: #66ff99;
  font-weight: 700;
  text-shadow: 0 0 8px rgba(102, 255, 153, 0.6);
}

/* ─── Ghost result: wygrana/przegrana ─── */
#ghost-result {
  position: fixed;
  top: 22%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9001;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.35s ease, transform 0.35s ease;
}
#ghost-result.hidden { display: none; }

#ghost-result.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.ghost-result-card {
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 22px 40px;
  background: rgba(10, 20, 40, 0.9);
  border: 2px solid #66ccff;
  border-radius: 14px;
  box-shadow: 0 0 30px rgba(102, 204, 255, 0.55),
              0 0 60px rgba(102, 204, 255, 0.25);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: ghost-result-pop 0.45s ease-out;
}
#ghost-result.win  .ghost-result-card {
  border-color: #66ff99;
  box-shadow: 0 0 30px rgba(102, 255, 153, 0.65),
              0 0 60px rgba(102, 255, 153, 0.3);
}
#ghost-result.lose .ghost-result-card {
  border-color: #ff6666;
  box-shadow: 0 0 30px rgba(255, 102, 102, 0.6),
              0 0 60px rgba(255, 102, 102, 0.25);
}

@keyframes ghost-result-pop {
  0%   { transform: scale(0.7); opacity: 0; }
  60%  { transform: scale(1.08); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

.ghost-result-icon {
  font-size: 60px;
  line-height: 1;
  filter: drop-shadow(0 0 14px rgba(255, 255, 255, 0.6));
  animation: ghost-result-float 2.5s ease-in-out infinite;
}
#ghost-result.win  .ghost-result-icon { filter: drop-shadow(0 0 16px rgba(255, 215, 0, 0.9)); }
#ghost-result.lose .ghost-result-icon { filter: drop-shadow(0 0 14px rgba(255, 200, 50, 0.7)); }

@keyframes ghost-result-float {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50%      { transform: translateY(-6px) rotate(-4deg); }
}

.ghost-result-text {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ghost-result-title {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: 1px;
  text-shadow: 0 0 14px rgba(255, 255, 255, 0.5);
}
#ghost-result.win  .ghost-result-title { color: #a8ffcc; text-shadow: 0 0 16px rgba(102, 255, 153, 0.9); }
#ghost-result.lose .ghost-result-title { color: #ffbbbb; text-shadow: 0 0 16px rgba(255, 102, 102, 0.9); }

.ghost-result-subtitle {
  font-size: 14px;
  color: #c8d8e8;
  letter-spacing: 0.3px;
}

.ghost-result-times {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 13px;
  color: #a8c8e0;
}
.ghost-result-player-time { color: #66ff99; font-weight: 700; }
.ghost-result-ghost-time  { color: #ff9999; font-weight: 700; }
.ghost-result-vs          { color: #7a9ab8; font-size: 11px; letter-spacing: 1px; }

/* ─── Ghost destroyed: płomienie + tekst ─── */
#ghost-destroyed {
  position: fixed;
  inset: 0;
  z-index: 9002;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  opacity: 0;
  transition: opacity 0.25s ease;
}
#ghost-destroyed.hidden { display: none; }
#ghost-destroyed.show   { opacity: 1; }

.ghost-destroyed-flames {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  justify-content: center;
  font-size: 64px;
  line-height: 1;
}

.flame {
  animation: flame-dance 0.6s ease-in-out infinite;
  filter: drop-shadow(0 0 12px rgba(255, 120, 0, 0.9));
  transform-origin: bottom center;
}
.flame:nth-child(1) { animation-delay: 0s;    font-size: 48px; }
.flame:nth-child(2) { animation-delay: 0.08s; font-size: 64px; }
.flame:nth-child(3) { animation-delay: 0.16s; font-size: 56px; }
.flame:nth-child(4) { animation-delay: 0.24s; font-size: 72px; }
.flame:nth-child(5) { animation-delay: 0.32s; font-size: 56px; }
.flame:nth-child(6) { animation-delay: 0.40s; font-size: 64px; }
.flame:nth-child(7) { animation-delay: 0.48s; font-size: 48px; }

@keyframes flame-dance {
  0%, 100% { transform: scale(1) translateY(0); }
  50%      { transform: scale(1.15) translateY(-8px); }
}

.ghost-destroyed-text {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.ghost-destroyed-title {
  font-size: 38px;
  font-weight: 900;
  color: #ffdd88;
  letter-spacing: 2px;
  text-shadow: 0 0 20px rgba(255, 120, 0, 1),
               0 0 40px rgba(255, 60, 0, 0.8),
               0 0 60px rgba(255, 0, 0, 0.5);
  animation: destroyed-pulse 0.5s ease-in-out infinite;
}

@keyframes destroyed-pulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.06); }
}

.ghost-destroyed-subtitle {
  font-size: 18px;
  font-weight: 700;
  color: #66ff99;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  text-shadow: 0 0 12px rgba(102, 255, 153, 0.9);
}

/* ─── Screen shake po zniszczeniu ghosta ─── */
@keyframes screen-shake {
  0%, 100% { transform: translate(0, 0); }
  10%      { transform: translate(-6px, -4px); }
  20%      { transform: translate(5px, 3px); }
  30%      { transform: translate(-4px, 5px); }
  40%      { transform: translate(4px, -5px); }
  50%      { transform: translate(-3px, 2px); }
  60%      { transform: translate(3px, -3px); }
  70%      { transform: translate(-2px, 4px); }
  80%      { transform: translate(2px, -2px); }
  90%      { transform: translate(-1px, 1px); }
}
body.screen-shake {
  animation: screen-shake 0.5s ease-in-out;
}


/* ─── Ghost result: neutralny (pierwszy przejazd) ─── */
#ghost-result.neutral .ghost-result-card {
  border-color: #66ccff;
  box-shadow: 0 0 30px rgba(102, 204, 255, 0.6),
              0 0 60px rgba(102, 204, 255, 0.28);
}
#ghost-result.neutral .ghost-result-title {
  color: #a8e0ff;
  text-shadow: 0 0 16px rgba(102, 204, 255, 0.9);
}
#ghost-result.neutral .ghost-result-icon {
  filter: drop-shadow(0 0 14px rgba(102, 204, 255, 0.9));
}


#ghost-grace {
  color: #ffcc66;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 14px;
  padding: 2px 8px;
  background: rgba(80, 60, 0, 0.4);
  border-radius: 4px;
  font-weight: 600;
}
#ghost-grace.hidden { display: none; }

#toast {
  position: fixed;
  top: 12%;
  left: 50%;
  transform: translateX(-50%) translateY(-10px);
  background: rgba(10, 20, 40, 0.92);
  color: #a8e0ff;
  border: 2px solid #66ccff;
  border-radius: 10px;
  padding: 12px 24px;
  font-family: monospace;
  font-size: 16px;
  z-index: 9500;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  box-shadow: 0 0 20px rgba(102, 204, 255, 0.5);
}
#toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}


/* ─── Cookie banner (RODO) ─── */
#cookie-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 14px 22px;
  background: rgba(10, 20, 10, 0.94);
  border-top: 2px solid #0f0;
  font-family: monospace;
  color: #d8ffd8;
  font-size: 14px;
  line-height: 1.4;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transform: translateY(100%);
  opacity: 0;
  transition: transform 0.35s ease, opacity 0.35s ease;
}
#cookie-banner.show {
  transform: translateY(0);
  opacity: 1;
}
#cookie-banner.hidden {
  display: none;
}

#cookie-banner .cookie-text {
  flex: 1;
  min-width: 0;
}

#cookie-banner .cookie-actions {
  display: flex;
  gap: 10px;
  flex-shrink: 0;
}

#cookie-banner .cookie-btn {
  padding: 8px 18px;
  font-family: monospace;
  font-size: 14px;
  font-weight: bold;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  transition: transform 0.12s ease, filter 0.12s ease;
}
#cookie-banner .cookie-btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.15);
}
#cookie-banner .cookie-btn.accept {
  background: #0f0;
  color: #000;
}
#cookie-banner .cookie-btn.reject {
  background: transparent;
  color: #0f0;
  border: 1px solid #0f0;
}

@media (max-width: 640px) {
  #cookie-banner {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
    padding: 14px;
  }
  #cookie-banner .cookie-actions {
    justify-content: center;
  }
}

/* ─── Leaderboard (TOP 3) — HUD kokpitowy ─── */
#leaderboard {
  position: absolute;
  top: 56px;
  right: 10px;
  min-width: 102px;
  padding: 6px 10px 7px 10px;

  /* praktycznie przezroczyste tło — efekt szkła */
  background: rgba(0, 12, 24, 0.18);
  border: 1px solid rgba(120, 220, 255, 0.28);
  border-radius: 6px;

  /* HUD-owy glow — subtelny */
  box-shadow:
    0 0 12px rgba(102, 204, 255, 0.10),
    inset 0 0 8px rgba(102, 204, 255, 0.06);

  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 12px;
  line-height: 1.5;
  letter-spacing: 0.3px;
  color: #cfe9ff;

  z-index: 55;
  pointer-events: none;
  user-select: none;

  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.75);

  /* auto-fade (wariant C) */
  opacity: 1;
  transition: opacity 0.6s ease, transform 0.25s ease;
  overflow: hidden;
}

#leaderboard.hidden { display: none; }

/* ─── Nagłówek ─── */
.lb-header {
  display: flex;
  align-items: center;
  margin-bottom: 4px;
  padding-bottom: 3px;
  border-bottom: 1px solid rgba(120, 220, 255, 0.18);
}

.lb-title {
  display: block;                    /* ✅ span → block, zajmuje całą szerokość */
  text-align: right; 
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.2px;
  color: #ffdd88;
  text-transform: uppercase;
  text-shadow:
    0 0 8px rgba(255, 221, 136, 0.55),
    0 1px 2px rgba(0, 0, 0, 0.85);
}

/* ─── Lista czasów ─── */
.lb-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.lb-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.lb-medal {
  width: 18px;
  text-align: center;
  font-size: 14px;
  filter: drop-shadow(0 0 3px rgba(0, 0, 0, 0.85));
}

.lb-time {
  font-weight: 700;
  color: #e8f6ff;
  font-variant-numeric: tabular-nums;   /* cyfry równe — zero drgań */
}

.lb-empty {
  color: rgba(200, 220, 255, 0.30);
  font-weight: 400;
}

/* ─── Kolory czasów wg miejsca ─── */
.lb-rank-1 .lb-time {
  color: #ffd966;
  text-shadow: 0 0 8px rgba(255, 217, 102, 0.60),
               0 1px 2px rgba(0, 0, 0, 0.85);
}
.lb-rank-2 .lb-time {
  color: #e0e8f0;
  text-shadow: 0 0 6px rgba(224, 232, 240, 0.45),
               0 1px 2px rgba(0, 0, 0, 0.85);
}
.lb-rank-3 .lb-time {
  color: #e0b088;
  text-shadow: 0 0 6px rgba(224, 176, 136, 0.45),
               0 1px 2px rgba(0, 0, 0, 0.85);
}



/* ─── Wariant B: skan-line (kineskop) ─── */
#leaderboard::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    transparent 0%,
    rgba(120, 220, 255, 0.08) 48%,
    rgba(120, 220, 255, 0.14) 50%,
    rgba(120, 220, 255, 0.08) 52%,
    transparent 100%
  );
  pointer-events: none;
  border-radius: inherit;
  animation: lb-scan 4.5s linear infinite;
}

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

/* ─── Wariant C: pulse przy nowym rekordzie ─── */
#leaderboard.pulse {
  animation: lb-pulse 0.7s ease-out;
}

@keyframes lb-pulse {
  0% {
    box-shadow: 0 0 12px rgba(102, 204, 255, 0.10),
                inset 0 0 8px rgba(102, 204, 255, 0.06);
    border-color: rgba(120, 220, 255, 0.28);
  }
  50% {
    box-shadow: 0 0 22px rgba(102, 255, 153, 0.85),
                inset 0 0 14px rgba(102, 255, 153, 0.40);
    border-color: rgba(102, 255, 153, 0.95);
  }
  100% {
    box-shadow: 0 0 12px rgba(102, 204, 255, 0.10),
                inset 0 0 8px rgba(102, 204, 255, 0.06);
    border-color: rgba(120, 220, 255, 0.28);
  }
}
