/* ═══════════════════════════════════════════════════════════════
   halloween.css — Хэллоуин-ивент «Охота на духов»
   Работает поверх переменных style.css (тёмная/светлая темы).
═══════════════════════════════════════════════════════════════ */

/* ─── Слой, по которому летают духи ─────────────────────────── */
.hw-layer {
  position: fixed;
  inset: 0;
  z-index: 9000;
  overflow: hidden;
  pointer-events: none;
}

.hw-ghost {
  position: absolute;
  width: 84px;
  height: 104px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  pointer-events: auto;
  animation: hw-float 4s ease-in-out infinite;
  will-change: transform;
  -webkit-tap-highlight-color: transparent;
}

.hw-ghost-inner {
  display: block;
  width: 100%;
  height: 100%;
  opacity: 0;
  transform: scale(0.6);
  filter: drop-shadow(0 0 14px rgba(140, 200, 255, 0.7));
  transition: opacity 0.32s ease, transform 0.32s cubic-bezier(0.2, 1.4, 0.4, 1);
}

.hw-ghost-inner svg { display: block; width: 100%; height: 100%; }

.hw-ghost-in .hw-ghost-inner { opacity: 0.94; transform: scale(1); }

.hw-ghost-rare  { width: 92px; height: 112px; }
.hw-ghost-rare .hw-ghost-inner  { filter: drop-shadow(0 0 18px rgba(80, 190, 255, 0.9)); }
.hw-ghost-golden { width: 100px; height: 122px; }
.hw-ghost-golden .hw-ghost-inner { filter: drop-shadow(0 0 22px rgba(255, 190, 60, 0.95)); }

.hw-ghost-caught .hw-ghost-inner { transform: scale(1.6); opacity: 0; }
.hw-ghost-out .hw-ghost-inner    { transform: translateY(-44px) scale(0.85); opacity: 0; }

.hw-ghost:hover .hw-ghost-inner { transform: scale(1.08); }

@keyframes hw-float {
  0%, 100% { transform: translate(0, 0); }
  50%      { transform: translate(var(--hw-dx, 0px), var(--hw-dy, -24px)); }
}

@media (prefers-reduced-motion: reduce) {
  .hw-ghost { animation: none; }
}

/* ─── Всплывающие «+N» над пойманным духом ──────────────────── */
.hw-float {
  position: absolute;
  z-index: 9002;
  transform: translate(-50%, -50%);
  font-size: 1.1rem;
  font-weight: 800;
  color: #ffd166;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.6);
  pointer-events: none;
  animation: hw-float-up 0.9s ease-out forwards;
}
.hw-float-golden { color: #ffb020; font-size: 1.35rem; }
.hw-float-miss   { color: rgba(255, 255, 255, 0.6); font-size: 0.85rem; }

@keyframes hw-float-up {
  0%   { opacity: 0; transform: translate(-50%, -50%) scale(0.7); }
  25%  { opacity: 1; transform: translate(-50%, -90%) scale(1.15); }
  100% { opacity: 0; transform: translate(-50%, -170%) scale(1); }
}

/* ─── HUD ─────────────────────────────────────────────────────── */
/* Десктоп: слева снизу сайдбар сайта, справа снизу — панель ввода чата,
   поэтому держимся правого нижнего угла, но выше нижних панелей */
.hw-hud {
  position: fixed;
  right: 16px;
  bottom: calc(92px + env(safe-area-inset-bottom, 0px));
  z-index: 9001;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 999px;
  background: var(--modal-bg, rgba(17, 21, 30, 0.95));
  border: 1px solid var(--card-border, rgba(255, 255, 255, 0.08));
  box-shadow: var(--shadow, 0 8px 32px rgba(0, 0, 0, 0.5));
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  color: var(--txt-primary, rgba(255, 255, 255, 0.95));
  font-size: 0.85rem;
  line-height: 1;
}

.hw-hud-title { font-size: 1.05rem; }
.hw-hud-candy { font-weight: 700; white-space: nowrap; }
.hw-hud-candy b { color: #ffd166; }
.hw-hud-streak { color: #ff9d3d; font-weight: 700; white-space: nowrap; font-size: 0.8rem; }
.hw-hud-cap { color: var(--txt-secondary, rgba(255, 255, 255, 0.62)); font-size: 0.78rem; white-space: nowrap; }

.hw-hud-btn {
  border: 1px solid var(--glass-border, rgba(255, 255, 255, 0.09));
  background: var(--glass-bg, rgba(255, 255, 255, 0.05));
  color: inherit;
  font: inherit;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s ease, transform 0.2s ease;
}
.hw-hud-btn:hover { background: var(--glass-hover, rgba(255, 255, 255, 0.08)); }
.hw-hud-btn:active { transform: scale(0.96); }
.hw-hud-btn-done { opacity: 0.55; cursor: default; }

/* ─── Модалка рейтинга ────────────────────────────────────────── */
.hw-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 99970;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(5, 7, 12, 0.62);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity 0.22s ease;
}
.hw-modal-overlay.hw-visible { opacity: 1; }

.hw-modal {
  position: relative;
  width: 100%;
  max-width: 440px;
  max-height: calc(100vh - 40px);
  overflow: hidden auto;
  padding: 20px;
  background: var(--card-bg, #151A23);
  border: 1px solid var(--card-border, rgba(255, 255, 255, 0.08));
  border-radius: var(--radius-lg, 20px);
  box-shadow: var(--shadow, 0 8px 32px rgba(0, 0, 0, 0.5));
  transform: translateY(12px) scale(0.97);
  opacity: 0;
  transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.25s ease;
}
.hw-modal-overlay.hw-visible .hw-modal { transform: translateY(0) scale(1); opacity: 1; }

.hw-modal-title {
  margin: 0 0 4px;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--txt-primary, rgba(255, 255, 255, 0.95));
}
.hw-modal-sub {
  margin-bottom: 14px;
  font-size: 0.85rem;
  color: var(--txt-secondary, rgba(255, 255, 255, 0.62));
}

.hw-modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: var(--glass-bg, rgba(255, 255, 255, 0.05));
  color: var(--txt-primary, rgba(255, 255, 255, 0.95));
  font-size: 0.95rem;
  cursor: pointer;
}
.hw-modal-close:hover { background: var(--glass-hover, rgba(255, 255, 255, 0.08)); }

.hw-modal-list { display: flex; flex-direction: column; gap: 6px; }
.hw-loading { color: var(--txt-secondary, rgba(255, 255, 255, 0.62)); font-size: 0.88rem; padding: 8px 0; }

.hw-rank {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 12px;
  background: var(--glass-bg, rgba(255, 255, 255, 0.05));
  border: 1px solid transparent;
}
.hw-rank-me { border-color: rgba(178, 59, 255, 0.55); background: rgba(178, 59, 255, 0.12); }

.hw-rank-pos { min-width: 26px; font-weight: 700; color: var(--txt-secondary, rgba(255, 255, 255, 0.62)); }
.hw-rank-av {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--surface-1, #1B212C);
}
.hw-rank-av-letter {
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--txt-primary, rgba(255, 255, 255, 0.95));
}
.hw-rank-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
  color: var(--txt-primary, rgba(255, 255, 255, 0.95));
}
.hw-rank-ms { margin-left: 6px; }
.hw-rank-fire { margin-left: 6px; font-size: 0.8rem; color: #ff9d3d; }
.hw-rank-candy { font-weight: 700; color: #ffd166; white-space: nowrap; }

/* ─── Хэллоуин-тема сайта (по тумблеру в админке) ────────────── */
body.halloween {
  --accent-1:    #FF8A3D;
  --accent-2:    #FFB067;
  --accent-3:    #E8631A;
  --accent-grad: linear-gradient(135deg, #FF8A3D, #B23BFF);
  --accent-glow: 0 4px 20px rgba(178, 59, 255, 0.35);
}

@media (max-width: 700px) {
  /* На мобильных снизу фиксированное меню сайта (64px) — поднимаем HUD над ним */
  .hw-hud {
    left: 12px;
    right: auto;
    bottom: calc(76px + env(safe-area-inset-bottom, 0px));
    font-size: 0.78rem;
    padding: 6px 8px;
    gap: 6px;
  }
  .hw-hud-title { display: none; }
}

/* На узких телефонах HUD со всеми цифрами не помещается —
   оставляем только иконки у кнопок */
@media (max-width: 430px) {
  .hw-hud-lbl { display: none; }
  .hw-hud-btn { padding: 5px 8px; }
}

@media (max-width: 480px) {
  .hw-modal { padding: 16px; }
}
