* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: none;
  position: fixed;
  inset: 0;
  background: #070d1a;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

/* ── Фон ──────────────────────────────────────────────────────────────────── */
#game-container {
  width: 100vw;
  height: 100dvh;
  height: 100vh;
  overflow: hidden;
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(ellipse 60% 60% at 20% 30%, rgba(60, 40, 140, 0.18) 0%, transparent 70%),
    radial-gradient(ellipse 50% 50% at 80% 70%, rgba(20, 60, 120, 0.2) 0%, transparent 70%),
    radial-gradient(ellipse 80% 80% at 50% 50%, #101828 0%, #070d1a 100%);
}

#game-canvas {
  display: block;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.05),
    0 16px 48px rgba(0, 0, 0, 0.6),
    0 4px 12px rgba(0, 0, 0, 0.4);
}

/* ── Утилиты ──────────────────────────────────────────────────────────────── */
.hidden { display: none !important; }

/* ── Overlays — плавные переходы ─────────────────────────────────────────── */
.overlay {
  position: absolute;
  inset: 0;
  background: rgba(5, 9, 20, 0.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  transition: opacity 0.24s ease, transform 0.24s ease, visibility 0.24s;
  opacity: 1;
  visibility: visible;
  transform: scale(1);
}
/* Главное меню — фон на canvas, поэтому overlay прозрачный */
#main-menu {
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

/* Скрытый overlay — не display:none, чтобы работал transition */
.overlay.hidden {
  display: flex !important;
  opacity: 0 !important;
  pointer-events: none !important;
  visibility: hidden !important;
  transform: scale(0.97) !important;
}

/* ── Glassmorphism Panel ──────────────────────────────────────────────────── */
.overlay .panel {
  background: rgba(12, 20, 42, 0.78);
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
  padding: 1.75rem 2rem;
  border-radius: 20px;
  text-align: center;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow:
    0 0 0 0.5px rgba(255, 255, 255, 0.04) inset,
    0 1px 0 rgba(255, 255, 255, 0.06) inset,
    0 20px 60px rgba(0, 0, 0, 0.6),
    0 4px 16px rgba(0, 0, 0, 0.3);
  position: relative;
  overflow: hidden;
}
/* Едва видимый бликовый верхний край */
.overlay .panel::before {
  content: '';
  position: absolute;
  top: 0; left: 10%; right: 10%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.12), transparent);
  border-radius: 50%;
}

.overlay h2 {
  color: #eef2ff;
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 1.25rem;
  letter-spacing: 0.01em;
}

/* ── Кнопка «Далее» (победный экран) ─────────────────────────────────────── */
.overlay #btn-next {
  background: linear-gradient(160deg, #ffe55a 0%, #ffc400 60%, #f09000 100%);
  color: #1a1200;
  border: none;
  padding: 0.65rem 2rem;
  font-size: 1rem;
  font-weight: 700;
  border-radius: 12px;
  cursor: pointer;
  letter-spacing: 0.02em;
  box-shadow:
    0 0 20px rgba(255, 200, 0, 0.35),
    0 4px 12px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.25);
  transition: transform 0.12s ease, box-shadow 0.15s ease, filter 0.15s ease;
}
.overlay #btn-next:hover {
  filter: brightness(1.1);
  box-shadow: 0 0 28px rgba(255, 200, 0, 0.5), 0 6px 16px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.3);
}
.overlay #btn-next:active { transform: scale(0.96); }

/* ── Звёзды победы ────────────────────────────────────────────────────────── */
.victory-stars {
  display: flex;
  justify-content: center;
  gap: 0.4rem;
  margin: 0.25rem 0 1.1rem;
  font-size: 2.1rem;
  line-height: 1;
}
.victory-stars.hidden { display: none !important; }
.victory-stars .star {
  color: rgba(255,255,255,0.1);
  transition: color 0.35s ease, filter 0.35s ease, transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: inline-block;
}
.victory-stars .star.lit {
  color: #ffe55a;
  filter: drop-shadow(0 0 8px rgba(255, 220, 0, 0.8));
  transform: scale(1.15);
}

/* ── HUD ──────────────────────────────────────────────────────────────────── */
.hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 11;
  pointer-events: none;
}
.hud.hidden { display: none !important; }
.hud button { pointer-events: auto; }

.hud-main {
  padding: 0.45rem 0.6rem 0.35rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  background: linear-gradient(to bottom, rgba(5,9,20,0.65) 0%, transparent 100%);
  min-width: 0;
}

.hud-top {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-width: 0;
  flex-shrink: 1;
  overflow: hidden;
}

#level-counter {
  color: rgba(200, 215, 245, 0.65);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
#move-counter {
  color: rgba(238, 242, 255, 0.9);
  font-size: 0.88rem;
  font-weight: 600;
}
/* Прогрессбар уровней под HUD */
.hud-progress {
  height: 2px;
  background: rgba(255, 255, 255, 0.06);
  position: relative;
  overflow: hidden;
}
#hud-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #ffc400, #ffe55a);
  border-radius: 0 2px 2px 0;
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 6px rgba(255, 200, 0, 0.6);
  width: 0%;
}

.hud-buttons {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}
#btn-fullscreen,
#btn-menu,
#btn-skip-level {
  background: rgba(255, 255, 255, 0.06);
  color: rgba(220, 230, 255, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.1);
  height: 2rem;
  border-radius: 10px;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: background 0.15s ease, border-color 0.15s ease;
}
#btn-fullscreen,
#btn-menu {
  width: 2rem;
}
#btn-skip-level {
  gap: 0.3rem;
  padding: 0 0.55rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
#btn-fullscreen svg { display: block; }
#btn-fullscreen:hover,
#btn-menu:hover,
#btn-skip-level:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.18);
}
/* На очень узких экранах (<=360px) скрываем текст кнопки "Пропустить" */
@media (max-width: 360px) {
  #btn-skip-level span[data-i18n] { display: none; }
  #btn-skip-level { padding: 0 0.4rem; }
  .hud-main { padding: 0.4rem 0.45rem 0.3rem; }
  .hud-buttons { gap: 0.2rem; }
}

/* ── Главное меню ─────────────────────────────────────────────────────────── */
.menu-panel { max-width: 290px; width: 88vw; }

.menu-title {
  font-size: 1.5rem;
  color: #eef2ff;
  margin-bottom: 2.5rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  text-shadow: 0 0 20px rgba(255, 220, 80, 0.25);
}
/* Подзаголовок (subtitle) под названием — необязательный элемент */
.menu-subtitle {
  color: rgba(180, 195, 230, 0.55);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 1.6rem;
}

.menu-buttons {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

/* Базовая кнопка меню — glassmorphism */
.menu-buttons button {
  background: rgba(255, 255, 255, 0.055);
  color: #dde6ff;
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 0.72rem 1.5rem;
  font-size: 0.97rem;
  font-weight: 500;
  border-radius: 12px;
  cursor: pointer;
  letter-spacing: 0.01em;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.12s ease;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.menu-buttons button:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.18);
}
.menu-buttons button:active { transform: scale(0.97); }

/* Главная CTA-кнопка (Играть / Продолжить) */
.menu-buttons #btn-play,
.menu-buttons #btn-continue {
  background: linear-gradient(160deg, #ffe55a 0%, #ffc400 60%, #f09000 100%);
  color: #1a1200;
  border: none;
  font-weight: 700;
  box-shadow:
    0 0 18px rgba(255, 196, 0, 0.3),
    0 4px 10px rgba(0, 0, 0, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
  transition: filter 0.15s ease, transform 0.12s ease, box-shadow 0.15s ease;
}
.menu-buttons #btn-play:hover,
.menu-buttons #btn-continue:hover {
  filter: brightness(1.08);
  box-shadow: 0 0 26px rgba(255, 196, 0, 0.45), 0 6px 14px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.35);
}
.menu-buttons #btn-play:active,
.menu-buttons #btn-continue:active { transform: scale(0.96); }

/* ── Выбор уровня ─────────────────────────────────────────────────────────── */
.level-panel {
  padding: 1.5rem 1.25rem 1.5rem;
  max-width: 340px;
  width: 92vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}
.level-panel h2 { margin-bottom: 1.1rem; flex-shrink: 0; }
.level-panel #btn-levels-back { flex-shrink: 0; }

.level-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.55rem;
  margin-bottom: 1rem;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 0.5rem;
  margin-right: -0.25rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 200, 0, 0.25) transparent;
}
.level-grid::-webkit-scrollbar {
  width: 4px;
}
.level-grid::-webkit-scrollbar-track {
  background: transparent;
}
.level-grid::-webkit-scrollbar-thumb {
  background: rgba(255, 200, 0, 0.25);
  border-radius: 2px;
}
.level-grid::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 200, 0, 0.45);
}

.level-grid button {
  aspect-ratio: 1;
  background: rgba(255, 255, 255, 0.05);
  color: #dde6ff;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 13px;
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.12s ease, box-shadow 0.15s ease;
  min-height: 3.4rem;
}
.level-grid button::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(circle at 50% 0%, rgba(255,255,255,0.08) 0%, transparent 60%);
  pointer-events: none;
}
.level-grid button:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
.level-grid button:active { transform: scale(0.95) translateY(0); }

/* Пройденный уровень */
.level-grid button.unlocked {
  color: #eef2ff;
}
/* Заблокированный */
.level-grid button.locked {
  opacity: 0.3;
  cursor: not-allowed;
  filter: grayscale(0.8);
}
.level-grid button.locked:hover {
  transform: none;
  box-shadow: none;
  background: rgba(255,255,255,0.05);
  border-color: rgba(255,255,255,0.1);
}
/* Пройденный уровень со звёздами */
.level-grid button.completed {
  border-color: rgba(255, 215, 0, 0.4);
  background: rgba(255, 215, 0, 0.07);
}
.level-grid button .ls-num {
  display: block;
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.2;
}
.level-grid button .ls-stars {
  display: block;
  font-size: 0.52rem;
  letter-spacing: 0.04em;
  color: #ffd700;
  line-height: 1;
  margin-top: 0.1rem;
}

/* Заголовки категорий на экране выбора уровней */
.level-category-header {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.7rem 0.1rem 0.25rem;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.4);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  margin-top: 0.1rem;
}
.level-category-header:first-child {
  border-top: none;
  padding-top: 0;
  margin-top: 0;
}
.lch-icon {
  font-size: 0.6rem;
  line-height: 1;
}
.level-category-header[data-diff="tutorial"] .lch-icon { color: rgba(160, 200, 255, 0.7); }
.level-category-header[data-diff="easy"]     .lch-icon { color: rgba(80, 220, 120, 0.8); }
.level-category-header[data-diff="medium"]   .lch-icon { color: rgba(255, 200, 60, 0.8); }
.level-category-header[data-diff="hard"]     .lch-icon { color: rgba(255, 90, 90, 0.85); }

#btn-levels-back {
  background: transparent;
  color: rgba(180, 195, 230, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 0.5rem 1.25rem;
  font-size: 0.9rem;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
#btn-levels-back:hover {
  background: rgba(255, 255, 255, 0.07);
  color: rgba(210, 220, 245, 0.9);
}

/* ── Настройки ────────────────────────────────────────────────────────────── */
.settings-panel { max-width: 270px; width: 88vw; }
.settings-panel h2 { margin-bottom: 1.1rem; }

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  color: #dde6ff;
  margin-bottom: 1rem;
  font-size: 0.95rem;
}
.setting-row input[type="checkbox"] {
  width: 1.1rem;
  height: 1.1rem;
  accent-color: #ffc400;
  cursor: pointer;
}
.setting-row input[type="range"] {
  width: 110px;
  accent-color: #ffc400;
  cursor: pointer;
}

#btn-settings-back {
  background: transparent;
  color: rgba(180, 195, 230, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 0.5rem 1.25rem;
  font-size: 0.9rem;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
#btn-settings-back:hover {
  background: rgba(255, 255, 255, 0.07);
  color: rgba(210, 220, 245, 0.9);
}

.btn-secondary {
  display: block;
  width: 100%;
  background: transparent;
  color: rgba(180, 195, 230, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 0.5rem 1.25rem;
  font-size: 0.9rem;
  border-radius: 10px;
  cursor: pointer;
  margin-bottom: 0.6rem;
  transition: background 0.15s ease, color 0.15s ease;
}
.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.07);
  color: rgba(210, 220, 245, 0.9);
}

/* ── Все уровни пройдены ──────────────────────────────────────────────────── */
.all-complete-panel {
  max-width: 320px;
  width: 88vw;
  padding: 2rem 1.75rem;
}
.all-complete-panel h2 {
  font-size: 1.2rem;
  line-height: 1.5;
  margin-bottom: 1.5rem;
}

#btn-all-complete-menu {
  background: linear-gradient(160deg, #ffe55a 0%, #ffc400 60%, #f09000 100%);
  color: #1a1200;
  border: none;
  padding: 0.7rem 2.25rem;
  font-size: 1rem;
  font-weight: 700;
  border-radius: 12px;
  cursor: pointer;
  box-shadow: 0 0 18px rgba(255, 196, 0, 0.35), 0 4px 12px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.25);
  transition: filter 0.15s ease, transform 0.12s ease;
}
#btn-all-complete-menu:hover { filter: brightness(1.1); }
#btn-all-complete-menu:active { transform: scale(0.96); }

/* ── Туториал ─────────────────────────────────────────────────────────────── */
.tut-panel {
  max-width: 320px;
  width: 90vw;
  padding: 1.5rem 1.75rem 1.75rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}

.tut-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  margin-bottom: 1.25rem;
}

.tut-step {
  color: rgba(160, 176, 200, 0.6);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.tut-skip-btn {
  background: transparent;
  color: rgba(160, 176, 200, 0.5);
  border: none;
  font-size: 0.78rem;
  cursor: pointer;
  padding: 0.2rem 0.4rem;
  border-radius: 6px;
  transition: color 0.15s;
}
.tut-skip-btn:hover { color: rgba(200, 215, 235, 0.85); }

.tut-visual {
  width: 100px;
  height: 100px;
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
}

/* Иконки туториала */
.tut-icon-source {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #ffe87a 0%, #ffc200 55%, #e8850a 100%);
  box-shadow: 0 0 0 8px rgba(255,200,0,0.12), 0 0 0 18px rgba(255,200,0,0.06), 0 0 30px 6px rgba(255,200,0,0.4);
}
.tut-icon-source::before {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  width: 4px;
  height: 40px;
  background: linear-gradient(to top, rgba(255,220,80,0), rgba(255,220,80,0.7));
  transform: translate(-50%, -100%) rotate(0deg);
  transform-origin: bottom center;
  border-radius: 2px;
}
.tut-icon-mirror {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, #7eb8e8 0%, #3a7abf 50%, #1e4d80 100%);
  transform: rotate(45deg);
  border-radius: 4px;
  box-shadow: 0 0 16px rgba(100, 170, 240, 0.5), inset 0 1px 0 rgba(255,255,255,0.3);
}
.tut-icon-target {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: radial-gradient(circle, #fffde0 0%, #ffe066 28%, #1e2a3e 30%, #1e2a3e 58%, rgba(255,220,80,0.4) 60%, transparent 62%);
  box-shadow: 0 0 20px rgba(255, 220, 80, 0.5);
}
.tut-icon-button-wall {
  display: flex;
  gap: 10px;
  align-items: center;
}
.tut-icon-btn-dot {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #c992e8 0%, #9333c8 60%, #5a1a80 100%);
  box-shadow: 0 0 14px rgba(160, 80, 220, 0.6);
}
.tut-icon-wall-block {
  width: 28px;
  height: 40px;
  background: linear-gradient(180deg, #4a5568 0%, #2d3748 100%);
  border-radius: 4px;
  border: 1px solid rgba(120, 140, 170, 0.4);
  box-shadow: 0 0 8px rgba(0,0,0,0.4);
}
.tut-icon-arrow {
  font-size: 1rem;
  color: rgba(180, 200, 230, 0.6);
}
.tut-icon-blackhole {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: radial-gradient(circle, #0a0a0f 0%, #0d0d1a 40%, #1a0d2e 70%, rgba(80,20,140,0.3) 100%);
  box-shadow:
    0 0 0 3px rgba(100,30,180,0.3),
    0 0 20px rgba(80,20,140,0.5),
    inset 0 0 14px rgba(0,0,0,0.9);
  animation: tut-bh-pulse 2s ease-in-out infinite;
}
@keyframes tut-bh-pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(100,30,180,0.3), 0 0 20px rgba(80,20,140,0.5), inset 0 0 14px rgba(0,0,0,0.9); }
  50%       { box-shadow: 0 0 0 6px rgba(100,30,180,0.15), 0 0 32px rgba(80,20,140,0.7), inset 0 0 14px rgba(0,0,0,0.9); }
}

.tut-title {
  color: #eef2ff;
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 0.6rem;
  text-align: center;
}
.tut-text {
  color: rgba(200, 215, 235, 0.8);
  font-size: 0.9rem;
  line-height: 1.6;
  text-align: center;
  margin-bottom: 1.5rem;
  min-height: 4em;
}
.tut-footer {
  width: 100%;
  display: flex;
  justify-content: flex-end;
}
.tut-next-btn {
  background: linear-gradient(160deg, #ffe55a 0%, #ffc400 60%, #f09000 100%);
  color: #1a1200;
  border: none;
  padding: 0.62rem 1.75rem;
  font-size: 0.97rem;
  font-weight: 700;
  border-radius: 11px;
  cursor: pointer;
  box-shadow: 0 0 16px rgba(255,196,0,0.3), 0 4px 10px rgba(0,0,0,0.25), inset 0 1px 0 rgba(255,255,255,0.25);
  transition: filter 0.15s ease, transform 0.12s ease;
}
.tut-next-btn:hover { filter: brightness(1.1); }
.tut-next-btn:active { transform: scale(0.96); }

/* ── Таблица лидеров ──────────────────────────────────────────────────────── */
.leaderboard-panel {
  max-width: 320px;
  width: 90vw;
  padding: 1.5rem 1.25rem 1.5rem;
}
.leaderboard-panel h2 { margin-bottom: 1rem; }

.lb-content {
  min-height: 4rem;
  margin-bottom: 1rem;
}

.lb-loading,
.lb-msg {
  color: rgba(180, 195, 230, 0.6);
  font-size: 0.9rem;
  text-align: center;
  padding: 1.5rem 0;
}

.lb-header {
  display: flex;
  gap: 0.6rem;
  padding: 0 0.6rem 0.5rem;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  margin-bottom: 0.35rem;
  color: rgba(140, 160, 200, 0.45);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.lb-header .lb-rank { min-width: 1.5rem; text-align: center; }
.lb-header .lb-name { flex: 1; text-align: left; }
.lb-header .lb-score { white-space: nowrap; }

.lb-entry {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.45rem 0.6rem;
  border-radius: 10px;
  margin-bottom: 0.2rem;
  border: 1px solid transparent;
  transition: background 0.15s;
}
.lb-entry:hover { background: rgba(255,255,255,0.04); }
.lb-entry.me {
  background: rgba(255, 200, 0, 0.08);
  border-color: rgba(255, 200, 0, 0.18);
}

.lb-rank {
  color: rgba(180, 195, 230, 0.45);
  font-size: 0.78rem;
  font-weight: 600;
  min-width: 1.5rem;
  text-align: center;
}
.lb-entry.me .lb-rank { color: #ffc400; }

.lb-name {
  color: #dde6ff;
  font-size: 0.88rem;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
}
.lb-entry.me .lb-name {
  color: #ffe55a;
  font-weight: 600;
}

.lb-score {
  color: rgba(200, 215, 240, 0.65);
  font-size: 0.82rem;
  font-weight: 500;
  white-space: nowrap;
}
.lb-entry.me .lb-score { color: #ffc400; }

#btn-leaderboard-back {
  background: transparent;
  color: rgba(180, 195, 230, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 0.5rem 1.25rem;
  font-size: 0.9rem;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
#btn-leaderboard-back:hover {
  background: rgba(255, 255, 255, 0.07);
  color: rgba(210, 220, 245, 0.9);
}
