/* ===== ОСНОВНЫЕ ОВЕРЛЕИ ===== */
.victory-overlay,
.level-overlay,
.wheel-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255, 245, 247, 0.96);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  overflow: hidden;
  padding: clamp(4px, 1vh, 10px);
}

/* Темная тема */
html[data-theme='dusk'] .victory-overlay,
html[data-theme='dusk'] .level-overlay,
html[data-theme='dusk'] .wheel-overlay {
  background: rgba(26, 15, 27, 0.96);
}

/* Скрытие оверлеев */
.victory-overlay.hidden,
.level-overlay.hidden,
.wheel-overlay.hidden {
  display: none !important;
}

/* ===== СТИЛИ КОНТЕНТА ОВЕРЛЕЕВ ===== */
.victory-content,
.level-content,
.wheel-content {
  background: var(--panel-bg);
  border-radius: 20px;
  padding: clamp(10px, 2vh, 22px) clamp(10px, 2vw, 18px);
  box-shadow: 0 18px 40px rgba(233, 30, 99, 0.35);
  text-align: center;
  max-width: 94%;
  max-height: 100dvh;
  border: 2px solid var(--panel-border);
  position: relative;
  overflow: hidden;
}

/* ===== КОЛЕСО ФОРТУНЫ ===== */
.wheel-overlay .wheel-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(4px, 1vh, 10px);
  box-shadow: none;
  width: min(94vw, 420px);
  max-height: 100dvh;
  padding-top: clamp(28px, 5vh, 40px);
}

/* Кнопка закрытия колеса (крестик в правом верхнем углу) */
.wheel-close-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: clamp(28px, 4.5vh, 36px);
  height: clamp(28px, 4.5vh, 36px);
  border-radius: 50%;
  border: 2px solid var(--panel-border);
  background: var(--btn-bg);
  color: var(--text-color);
  font-size: clamp(0.9rem, 2vh, 1.1rem);
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  z-index: 102;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
  transition:
    transform 0.12s ease,
    background 0.12s ease,
    color 0.12s ease;
}

.wheel-close-btn:hover {
  background: var(--primary-color);
  color: #fff;
}

.wheel-close-btn:active {
  transform: scale(0.92);
}

/* Заголовок колеса */
.wheel-title {
  font-size: clamp(1rem, 2.4vh, 1.5rem);
  font-weight: 900;
  color: var(--primary-color);
  margin: 0;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  line-height: 1.1;
}

/* XP под заголовком */
.wheel-xp {
  text-align: center;
  font-size: clamp(0.65rem, 1.3vh, 0.78rem);
  opacity: 0.65;
  margin: 0;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text-color);
}

/* Канвас колеса (адаптивный квадрат) */
#fortuneWheel {
  display: block;
  margin: 0 auto;
  width: min(300px, 72vw, 42vh);
  height: auto;
  aspect-ratio: 1 / 1;
  flex-shrink: 0;
}

/* Центральная кнопка */
.wheel-center-btn {
  margin: 0;
}

/* Информация о ежедневных прокрутках */
.wheel-daily-info {
  margin: 0;
  text-align: center;
  font-size: clamp(10px, 1.3vh, 12px);
  color: var(--muted-color);
  line-height: 1.25;
}

/* Стрелка на колесе */
.wheel-arrow {
  position: absolute;
  top: -25px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 2rem;
  color: var(--primary-color);
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
  z-index: 101;
}

/* Подсветка сектора */
.wheel-sector-highlight {
  position: absolute;
  width: 10px;
  height: 10px;
  background: gold;
  border-radius: 50%;
  box-shadow: 0 0 10px gold;
  pointer-events: none;
  z-index: 100;
}

/* Счетчик прокруток (скрыт) */
.wheel-spin-counter,
#wheelSpinsUsed,
#wheelSpinsTotal {
  display: none !important;
}

/* ===== РЕЗУЛЬТАТ КОЛЕСА ===== */
.wheel-result {
  font-weight: 700;
  font-size: clamp(0.85rem, 1.7vh, 1rem);
  margin: 0;
  padding: clamp(6px, 1vh, 10px) clamp(8px, 1.4vw, 14px);
  background: var(--bg2-color);
  border-radius: 10px;
  color: var(--text-color);
  border: 1px solid var(--panel-border);
  min-height: clamp(30px, 5vh, 44px);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  max-width: 100%;
  word-wrap: break-word;
}

/* Пока без текста — не занимать место */
.wheel-result:empty {
  display: none;
}

.wheel-result.hidden {
  display: none;
}

/* ===== ОВЕРЛЕЙ УРОВНЯ ===== */
.level-title {
  font-size: 1.5rem;
  color: var(--primary-color);
  margin-bottom: 8px;
  font-weight: 900;
}

.level-text {
  font-size: 0.95rem;
  margin-bottom: 12px;
  color: var(--text-color);
}

.level-stats {
  font-size: 0.85rem;
  text-align: left;
  margin: 0 auto 10px;
  max-width: 260px;
  line-height: 1.4;
  color: var(--text-color);
}

.level-countdown {
  font-weight: 700;
  margin-top: 4px;
  color: var(--text-color);
}

/* ===== ОВЕРЛЕЙ ПОБЕДЫ ===== */
.victory-title {
  font-size: 1.5rem;
  color: var(--primary-color);
  margin-bottom: 8px;
  font-weight: 900;
}

.victory-text {
  font-size: 0.95rem;
  margin-bottom: 12px;
  color: var(--text-color);
}

/* ===== АНИМАЦИИ ===== */
/* Мигание сектора колеса */
@keyframes sectorBlink {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

/* Анимация появления результата колеса */
@keyframes wheelResultIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

#wheelResult.anim {
  animation: wheelResultIn 160ms ease-out;
}

/* На очень низких экранах прячем второстепенное, чтобы всё помещалось */
@media (max-height: 560px) {
  .wheel-xp,
  .wheel-daily-info {
    display: none;
  }

  #fortuneWheel {
    width: min(260px, 64vw, 36vh);
  }
}

@media (max-height: 460px) {
  .wheel-title {
    display: none;
  }

  #fortuneWheel {
    width: min(220px, 60vw, 32vh);
  }
}
