/* ==========================================================================
   ИГРОТЕКА — Концепция «Вечерний лес»
   Стиль: Уютный сумеречный лес, тёплый янтарный свет, живые светлячки.
   ========================================================================== */

/* 1. ПЕРЕМЕННЫЕ И ПАЛИТРА
   -------------------------------------------------------------------------- */
:root {
  /* Палитра вечернего леса */
  --night-deep: #061214;
  --night: #0c1f24;
  --night-card: #10272b;
  --night-card-alt: #0a1b1d;
  --forest-dark: #122b27;
  --forest: #1a4235;
  --forest-light: #2d614e;
  --moss: #6fa35a;
  --moss-glow: rgba(111, 163, 90, 0.3);
  
  /* Тёплые янтарные акценты */
  --amber: #f4b860;
  --amber-bright: #ffc978;
  --amber-dark: #c98832;
  --amber-glow: rgba(244, 184, 96, 0.35);
  --amber-glow-strong: rgba(244, 184, 96, 0.65);
  --ember: #e8763a;
  
  /* Светлые тона и типографика */
  --cream: #fbf1d6;
  --cream-soft: #ebdcc0;
  --text-primary: #fbf1d6;
  --text-secondary: #9cbdb1;
  --text-muted: #6f8f83;

  /* Границы и тени */
  --card-border: rgba(244, 184, 96, 0.16);
  --card-border-hover: rgba(244, 184, 96, 0.75);
  --shadow-card: 0 16px 36px -10px rgba(2, 8, 9, 0.65);
  --shadow-hover: 0 22px 48px -8px rgba(0, 0, 0, 0.75), 0 0 26px rgba(244, 184, 96, 0.28);
  
  /* Шрифты */
  --font-heading: 'Rubik', system-ui, -apple-system, sans-serif;
  --font-body: 'Nunito', system-ui, -apple-system, sans-serif;

  /* Тайминги */
  --transition-normal: 0.25s cubic-bezier(0.2, 0, 0, 1);
}

/* 2. БАЗОВЫЙ СБРОС И ТИПОГРАФИКА
   -------------------------------------------------------------------------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
  background-color: var(--night-deep);
  color: var(--text-primary);
  font-family: var(--font-body);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  background-color: var(--night-deep);
  line-height: 1.6;
}

img, svg {
  display: block;
}

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

/* 3. HERO: ВЕЧЕРНИЙ ЛЕС
   -------------------------------------------------------------------------- */
.hero {
  position: relative;
  min-height: calc(100vh - 61px);   /* 61px — верхняя панель */
  min-height: calc(100dvh - 61px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  text-align: center;
  padding: clamp(32px, 6vw, 64px) 20px 24px;
  background: linear-gradient(
    180deg,
    #051114 0%,
    #0b2327 30%,
    #133734 60%,
    #234a3c 82%,
    #4a472c 94%,
    #664f28 100%
  );
  overflow: hidden;
}

/* Звёздное небо */
.sky-backdrop {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
}

.stars {
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(1.5px 1.5px at 12% 18%, rgba(255, 255, 255, 0.85), transparent),
    radial-gradient(1px 1px at 28% 12%, rgba(255, 248, 220, 0.7), transparent),
    radial-gradient(1.5px 1.5px at 45% 24%, rgba(255, 255, 255, 0.9), transparent),
    radial-gradient(1px 1px at 62% 15%, rgba(255, 240, 200, 0.65), transparent),
    radial-gradient(2px 2px at 78% 22%, rgba(255, 255, 255, 0.8), transparent),
    radial-gradient(1px 1px at 89% 10%, rgba(255, 255, 255, 0.7), transparent),
    radial-gradient(1.5px 1.5px at 20% 36%, rgba(255, 245, 210, 0.6), transparent),
    radial-gradient(1px 1px at 38% 42%, rgba(255, 255, 255, 0.75), transparent),
    radial-gradient(1.5px 1.5px at 72% 38%, rgba(255, 248, 220, 0.7), transparent),
    radial-gradient(1px 1px at 85% 32%, rgba(255, 255, 255, 0.6), transparent);
  opacity: 0.8;
  animation: starsTwinkle 8s ease-in-out infinite alternate;
}

@keyframes starsTwinkle {
  0% { opacity: 0.6; }
  100% { opacity: 0.95; }
}

/* Светлячки */
.fireflies-container {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
}

.firefly {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background-color: #fff9cf;
  box-shadow:
    0 0 6px var(--amber-bright),
    0 0 16px var(--amber-glow-strong),
    0 0 30px rgba(244, 184, 96, 0.4);
  animation:
    fireflyFloat var(--dur) ease-in-out infinite alternate,
    fireflyPulse calc(var(--dur) * 0.65) ease-in-out infinite alternate;
  animation-delay: var(--delay);
}

@keyframes fireflyFloat {
  0% {
    transform: translate(0, 0);
  }
  50% {
    transform: translate(var(--drift-x), calc(var(--drift-y) * 0.5));
  }
  100% {
    transform: translate(calc(var(--drift-x) * 1.2), var(--drift-y));
  }
}

@keyframes fireflyPulse {
  0% {
    opacity: 0.25;
    transform: scale(0.75);
  }
  50% {
    opacity: 1;
    transform: scale(1.3);
  }
  100% {
    opacity: 0.4;
    transform: scale(0.85);
  }
}

/* Содержимое Hero */
.hero-content {
  position: relative;
  z-index: 5;
  width: 100%;
  max-width: 820px;
  margin: auto 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}

.hero-intro {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

/* Широкий экран: две колонки — заголовок с кнопкой слева, письмо Совы справа */
@media (min-width: 1000px) {
  .hero-content {
    max-width: 1180px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: center;
    gap: clamp(32px, 5vw, 72px);
  }
  .hero-intro { align-items: flex-start; text-align: left; }
  .hero-intro .hero-subtitle { max-width: 460px; }
  .owl-letter { margin: 0; justify-self: end; }
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  border-radius: 999px;
  background-color: rgba(16, 42, 38, 0.7);
  border: 1px solid rgba(244, 184, 96, 0.3);
  backdrop-filter: blur(8px);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--amber);
  letter-spacing: 0.03em;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}

.badge-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: var(--amber);
  box-shadow: 0 0 8px var(--amber);
  animation: pulseDot 2s ease-in-out infinite;
}

@keyframes pulseDot {
  0%, 100% { opacity: 0.6; transform: scale(0.9); }
  50% { opacity: 1; transform: scale(1.3); }
}

.hero-title {
  font-family: var(--font-heading);
  font-size: clamp(3rem, 7.5vw, 5.5rem);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.02em;
  color: var(--cream);
  text-shadow:
    0 3px 12px rgba(4, 15, 17, 0.8),
    0 0 24px rgba(244, 184, 96, 0.25);
}

.hero-subtitle {
  font-size: clamp(1.125rem, 2.4vw, 1.45rem);
  color: var(--cream-soft);
  max-width: 540px;
  font-weight: 400;
  line-height: 1.5;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.6);
}

.hero-actions {
  margin-top: 12px;
}

/* Кнопка в Hero */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 1.05rem;
  border-radius: 999px;
  cursor: pointer;
  transition: transform var(--transition-normal), box-shadow var(--transition-normal), background-color var(--transition-normal);
}

.btn-primary {
  padding: 14px 34px;
  background: linear-gradient(135deg, var(--amber-bright) 0%, var(--amber) 50%, var(--amber-dark) 100%);
  color: #291804;
  border: 1px solid rgba(255, 255, 255, 0.3);
  box-shadow:
    0 8px 24px -4px rgba(0, 0, 0, 0.5),
    0 0 20px var(--amber-glow);
}

.btn-primary:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow:
    0 12px 28px -4px rgba(0, 0, 0, 0.6),
    0 0 32px var(--amber-glow-strong);
}

.btn-icon {
  transition: transform var(--transition-normal);
}

.btn-primary:hover .btn-icon {
  transform: translateY(3px);
}

/* Силуэты леса внизу Hero */
.forest-layers {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: clamp(140px, 22vw, 240px);
  pointer-events: none;
  z-index: 3;
}

.forest-svg {
  width: 100%;
  height: 100%;
}

/* Индикатор скролла */
.scroll-indicator {
  position: relative;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: var(--amber);
  opacity: 0.85;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-top: auto;
  padding: 8px 12px;
  transition: opacity var(--transition-normal), transform var(--transition-normal);
}

.scroll-indicator:hover {
  opacity: 1;
  transform: translateY(-2px);
}

.scroll-indicator-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  animation: scrollBounce 2s ease-in-out infinite;
}

@keyframes scrollBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(6px); }
}

/* 4. СЕКЦИЯ ИГР
   -------------------------------------------------------------------------- */
.games-section {
  scroll-margin-top: 61px;   /* без JS: якорь #games не уходит под верхнюю панель */
  position: relative;
  z-index: 4;
  background-color: var(--night-deep);
  background-image:
    radial-gradient(circle at 50% 0%, rgba(20, 52, 45, 0.4) 0%, transparent 60%),
    radial-gradient(circle at 10% 40%, rgba(15, 38, 34, 0.3) 0%, transparent 50%),
    radial-gradient(circle at 90% 70%, rgba(20, 48, 42, 0.3) 0%, transparent 50%);
  padding: clamp(48px, 8vw, 96px) 24px clamp(64px, 10vw, 112px);
}

.section-container {
  max-width: 1200px;
  margin: 0 auto;
}

.section-header {
  text-align: center;
  margin-bottom: clamp(36px, 6vw, 56px);
}

.section-eyebrow {
  display: inline-block;
  font-size: 0.875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--moss);
  margin-bottom: 8px;
}

.section-title {
  font-family: var(--font-heading);
  font-size: clamp(2rem, 4.5vw, 3rem);
  font-weight: 700;
  color: var(--cream);
  line-height: 1.15;
  margin-bottom: 12px;
}

.section-description {
  font-size: clamp(1rem, 1.8vw, 1.15rem);
  color: var(--text-secondary);
  max-width: 520px;
  margin: 0 auto;
}

/* 5. СЕТКА КАРТОЧЕК
   -------------------------------------------------------------------------- */
.games-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(24px, 3.5vw, 36px);
}

/* 6. УСТРОЙСТВО И СТИЛЬ КАРТОЧЕК
   -------------------------------------------------------------------------- */
.game-card {
  position: relative;
  background: linear-gradient(
    170deg,
    rgba(22, 52, 46, 0.75) 0%,
    rgba(12, 29, 31, 0.9) 60%,
    rgba(8, 20, 22, 0.95) 100%
  );
  border: 1px solid var(--card-border);
  border-radius: 24px;
  overflow: hidden;
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(14px);
  perspective: 1000px;
  transform-style: preserve-3d;
  transition:
    transform var(--transition-normal),
    border-color var(--transition-normal),
    box-shadow var(--transition-normal);
}

.game-card-link,
.game-card-inner {
  display: flex;
  flex-direction: column;
  height: 100%;
}

/* Поведение при наведении */
.game-card:not(.game-card--disabled):hover {
  transform: translateY(-8px) rotateX(1.5deg) rotateY(-0.8deg);
  border-color: var(--card-border-hover);
  box-shadow: var(--shadow-hover);
}

/* Заглушка «Скоро новая игра» */
.game-card--disabled {
  opacity: 0.72;
  border-style: dashed;
  border-color: rgba(244, 184, 96, 0.22);
  background: linear-gradient(
    170deg,
    rgba(16, 36, 33, 0.5) 0%,
    rgba(10, 22, 24, 0.75) 100%
  );
  cursor: default;
}

.game-card--disabled:hover {
  transform: none;
  box-shadow: var(--shadow-card);
}

/* Превью-иллюстрация вверху карточки */
.card-preview {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background-color: var(--night-card-alt);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.preview-svg {
  width: 100%;
  height: 100%;
}

/* Превью-картинка «Ночного леса» */
.card-preview--nightforest img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}
.game-card:hover .card-preview--nightforest img { transform: scale(1.04); }

/* Анимации в превью при наведении (150-300 мс) */
.preview-coin,
.preview-basket,
.preview-card-left,
.preview-card-right,
.preview-sparkles,
.preview-hourglass {
  transition: transform var(--transition-normal), opacity var(--transition-normal);
}

/* Монета покачивается и плавно опускается при наведении */
.game-card:hover .preview-coin {
  transform: translateY(5px) rotate(-4deg);
}

.game-card:hover .preview-sparkles {
  opacity: 1;
  transform: scale(1.08);
}

/* Карты раскрываются веером при наведении */
.game-card:hover .preview-card-left {
  transform: translate(103px, 98px) rotate(-11deg);
}

.game-card:hover .preview-card-right {
  transform: translate(210px, 100px) rotate(12deg);
}

/* Тело карточки */
.card-body {
  padding: 24px;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

/* Чипы-теги */
.card-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  background-color: rgba(255, 255, 255, 0.06);
  color: var(--text-secondary);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.chip--genre {
  background-color: rgba(111, 163, 90, 0.18);
  color: #92d07a;
  border-color: rgba(111, 163, 90, 0.35);
}

.chip--muted {
  background-color: rgba(244, 184, 96, 0.1);
  color: var(--amber);
  border-color: rgba(244, 184, 96, 0.2);
}

/* Название игры */
.card-title {
  font-family: var(--font-heading);
  font-size: clamp(1.35rem, 2.2vw, 1.6rem);
  font-weight: 700;
  color: var(--cream);
  line-height: 1.25;
  margin-bottom: 10px;
  transition: color var(--transition-normal);
}

.game-card:not(.game-card--disabled):hover .card-title {
  color: var(--amber);
}

/* Описание */
.card-text {
  font-size: 0.98rem;
  color: var(--text-secondary);
  line-height: 1.55;
  margin-bottom: 18px;
  flex-grow: 1;
}

/* Строка управления */
.card-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  padding: 10px 14px;
  background-color: rgba(6, 18, 20, 0.5);
  border-radius: 12px;
  margin-bottom: 20px;
}

.control-icon {
  color: var(--amber);
  flex-shrink: 0;
}

/* Кнопка «Играть» внутри карточки */
.card-action {
  margin-top: auto;
}

.btn-card {
  width: 100%;
  padding: 12px 20px;
  background-color: rgba(244, 184, 96, 0.12);
  color: var(--amber);
  border: 1px solid rgba(244, 184, 96, 0.3);
  font-size: 0.98rem;
  font-weight: 700;
  border-radius: 14px;
  justify-content: center;
  transition:
    background-color var(--transition-normal),
    color var(--transition-normal),
    border-color var(--transition-normal),
    box-shadow var(--transition-normal);
}

.btn-arrow {
  transition: transform var(--transition-normal);
}

.game-card:not(.game-card--disabled):hover .btn-card {
  background: linear-gradient(135deg, var(--amber-bright) 0%, var(--amber) 100%);
  color: #291804;
  border-color: var(--amber-bright);
  box-shadow: 0 4px 16px var(--amber-glow);
}

.game-card:not(.game-card--disabled):hover .btn-arrow {
  transform: translateX(4px);
}

.btn-card--disabled {
  background-color: rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
  border-color: rgba(255, 255, 255, 0.08);
  cursor: default;
}

.btn-lock {
  opacity: 0.7;
}

/* 7. ВЕРХНЯЯ ПАНЕЛЬ (бывший футер) И ПИСЬМО СОВЫ
   -------------------------------------------------------------------------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px clamp(16px, 4vw, 40px);
  background-color: rgba(5, 17, 20, 0.78);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(244, 184, 96, 0.12);
}

.topbar-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--cream);
  text-decoration: none;
  min-width: 0;
}

.topbar-brand img { flex: none; border-radius: 9px; }

.topbar-brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.topbar-brand-text b { font-family: var(--font-heading); font-size: 1rem; font-weight: 700; }
.topbar-brand-text small { font-size: 0.78rem; color: var(--amber); font-weight: 700; }

.topbar-links { display: flex; align-items: center; gap: 8px; }

.topbar-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 40px;
  padding: 6px 14px;
  border: 1px solid rgba(156, 189, 177, 0.35);
  border-radius: 999px;
  color: var(--cream-soft);
  font-family: var(--font-heading);
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color var(--transition-normal), box-shadow var(--transition-normal), color var(--transition-normal), border-color var(--transition-normal);
}

.topbar-link svg { flex: none; color: var(--text-secondary); }
.topbar-link:hover { background-color: rgba(156, 189, 177, 0.1); color: var(--cream); }

.topbar-link--support { border-color: var(--amber-glow-strong); color: var(--amber-bright); }
.topbar-link--support svg { color: var(--ember); }
.topbar-link--support:hover { background-color: rgba(244, 184, 96, 0.12); box-shadow: 0 0 18px var(--amber-glow); color: var(--cream); }

@media (max-width: 560px) {
  .topbar-link svg { width: 18px; height: 18px; }
}

.topbar-link { cursor: pointer; background: none; }
.topbar-link--nick.is-set { color: var(--cream); border-color: rgba(111, 163, 90, 0.55); }
.topbar-link--nick.is-set svg { color: var(--moss); }
#nick-label { max-width: 14ch; overflow: hidden; text-overflow: ellipsis; }

@media (max-width: 760px) {
  .topbar-link--nick span, .topbar-link span { display: none; }   /* узко: только значки (подписи — в aria-label) */
  .topbar-link { padding: 6px 11px; }
}
@media (max-width: 420px) {
  .topbar-brand-text { display: none; }
  .topbar-links { gap: 6px; }
}

/* Окна: ник и рекорды */
.owl-dialog {
  margin: auto;                      /* общий сброс обнуляет margin, а <dialog> центрируется именно им */
  width: min(92vw, 420px);
  padding: clamp(18px, 4vw, 26px);
  border: 1px solid rgba(244, 184, 96, 0.3);
  border-radius: 20px;
  background: linear-gradient(180deg, #10272b, #0a1b1d);
  color: var(--cream);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6);
}
.owl-dialog--wide { width: min(94vw, 560px); }
.owl-dialog::backdrop { background: rgba(2, 8, 9, 0.7); backdrop-filter: blur(3px); }
.owl-dialog h2 { margin: 0 0 8px; font-family: var(--font-heading); font-size: 1.4rem; }
.owl-dialog-text { margin: 0 0 14px; color: var(--cream-soft); font-size: 0.95rem; line-height: 1.5; }
.owl-dialog-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.owl-dialog-head h2 { margin: 0; }
.owl-close {
  width: 38px; height: 38px; border-radius: 50%; border: 1px solid rgba(156, 189, 177, 0.35);
  background: none; color: var(--cream-soft); font-size: 1.4rem; line-height: 1; cursor: pointer;
}
.owl-close:hover { color: var(--cream); background: rgba(156, 189, 177, 0.1); }
.owl-input {
  width: 100%; box-sizing: border-box; padding: 12px 14px; border-radius: 12px;
  border: 1px solid rgba(244, 184, 96, 0.35); background: rgba(0, 0, 0, 0.3); color: var(--cream);
  font: 600 1.05rem var(--font-body);
}
.owl-input:focus { outline: 2px solid var(--amber); outline-offset: 1px; }
.owl-dialog-error { min-height: 1.3em; margin: 6px 0 4px; color: #ff9d7a; font-size: 0.88rem; }
.owl-dialog-actions { display: flex; justify-content: flex-end; gap: 10px; }
.owl-btn {
  padding: 10px 18px; border-radius: 999px; border: 1px solid rgba(156, 189, 177, 0.35);
  background: none; color: var(--cream-soft); font: 600 0.95rem var(--font-heading); cursor: pointer;
}
.owl-btn:hover { color: var(--cream); background: rgba(156, 189, 177, 0.1); }
.owl-btn--primary { background: linear-gradient(135deg, var(--amber-bright), var(--amber-dark)); color: #2a1a08; border-color: transparent; }
.owl-btn--primary:hover { filter: brightness(1.06); color: #2a1a08; }

.records-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.records-tab, .records-chip {
  padding: 7px 14px; border-radius: 999px; border: 1px solid rgba(156, 189, 177, 0.3);
  background: none; color: var(--cream-soft); font: 600 0.9rem var(--font-heading); cursor: pointer;
}
.records-tab.is-active { background: rgba(244, 184, 96, 0.16); border-color: var(--amber); color: var(--amber-bright); }
.records-sub { display: flex; gap: 6px; margin-bottom: 8px; }
.records-sub[hidden] { display: none; }
.records-chip { padding: 4px 12px; font-size: 0.82rem; }
.records-chip.is-active { background: rgba(111, 163, 90, 0.2); border-color: var(--moss); color: var(--cream); }
.records-body { min-height: 120px; max-height: min(52vh, 420px); overflow-y: auto; }
.records-note { margin: 28px 0; text-align: center; color: var(--text-secondary); }
.records-table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.records-table th { text-align: left; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); padding: 6px 8px; }
.records-table td { padding: 8px; border-top: 1px solid rgba(255, 255, 255, 0.06); }
.records-table .rank { width: 2.5em; font-weight: 700; color: var(--amber); }
.records-table .nick { font-weight: 600; overflow-wrap: anywhere; }
.records-table th:last-child { text-align: right; }
.records-table .score { text-align: right; white-space: nowrap; color: var(--cream-soft); }
.records-table tr.is-me td { background: rgba(244, 184, 96, 0.12); }
.records-table tr.is-me .nick::after { content: " (ты)"; color: var(--amber); font-weight: 400; }
.records-me { margin: 10px 0 0; color: var(--cream-soft); font-size: 0.9rem; }
.link-btn { background: none; border: none; padding: 0; color: var(--amber-bright); font: inherit; font-weight: 700; text-decoration: underline; cursor: pointer; }

/* Письмо Совы в шапке */
.owl-letter {
  max-width: 600px;
  margin: 4px 0 0;
  padding: clamp(16px, 3vw, 22px) clamp(18px, 3.5vw, 28px);
  text-align: left;
  background-color: rgba(10, 27, 29, 0.62);
  border: 1px solid rgba(244, 184, 96, 0.22);
  border-radius: 18px;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.owl-letter blockquote { margin: 0; }
.owl-letter p {
  margin: 0 0 10px;
  font-size: clamp(0.95rem, 1.8vw, 1.05rem);
  line-height: 1.6;
  color: var(--cream-soft);
}

.owl-letter figcaption {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 6px 16px;
  margin-top: 4px;
  font-size: 0.9rem;
}

.owl-letter figcaption span { color: var(--amber); font-weight: 700; font-style: italic; }
.owl-letter figcaption a { color: var(--text-secondary); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.owl-letter figcaption a:hover { color: var(--cream); }

/* 8. ДОСТУПНОСТЬ: FOCUS-VISIBLE
   -------------------------------------------------------------------------- */
a:focus-visible,
button:focus-visible,
.btn:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 4px;
}

.game-card-link:focus-visible {
  outline: none;
}

.game-card:has(.game-card-link:focus-visible) {
  outline: 2px solid var(--amber);
  outline-offset: 4px;
  border-color: var(--card-border-hover);
  box-shadow: var(--shadow-hover);
}

/* 9. АДАПТИВНОСТЬ
   -------------------------------------------------------------------------- */
/* От 700 px: 2 колонки */
@media (min-width: 700px) {
  .games-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* От 1100 px: 3 колонки */
@media (min-width: 1100px) {
  .games-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* 10. PREFERS-REDUCED-MOTION: REDUCE
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .stars,
  .badge-dot,
  .scroll-indicator-arrow,
  .fireflies-container {
    display: none;
  }

  .btn,
  .btn-icon,
  .btn-arrow,
  .game-card,
  .preview-coin,
  .preview-basket,
  .preview-card-left,
  .preview-card-right,
  .preview-sparkles {
    transition: none;
  }

  .game-card:not(.game-card--disabled):hover {
    transform: none;
  }

  .game-card:hover .preview-coin,
  .game-card:hover .preview-card-left,
  .game-card:hover .preview-card-right {
    transform: none;
  }
}
