/* ============================================================
   Хэллоуин 2026 — оформление и «Охота за тыквенными монетами».
   Всё с префиксом hw-, включается классом html.hw-on из halloween.js.
   ============================================================ */

/* Переменные на :root, а не на html.hw-on: после ивента праздничного
   оформления нет, а рамкам, никам и блоку темы цвета всё равно нужны. */
:root {
  --hw-orange: #FF7A1A;
  --hw-orange-hi: #FFB15C;
  --hw-ember: #FFCF4D;
  --hw-purple: #8C69FB;
  --hw-night: #0C0A0E;
  --hw-surface: #1A171E;
  --hw-line: #302A3A;
  --hw-text: #EFEBF5;
  --hw-muted: #9A93A8;
}

/* --- Палитра: фиолетовый акцент шаблона → тыквенный ---------------- */
/* Свой акцент профиля задаётся inline-стилем и остаётся как был. */
html.hw-on .nh {
  --nh-accent: #FF7A1A;
  --nh-accent-hi: #FFB15C;
  --nh-wash: rgba(255, 122, 26, .13);
}
html.hw-on .np {
  --np-accent: #FF7A1A;
  --np-accent-hi: #FFB15C;
  --np-accent-rgb: 255, 122, 26;
  --np-on-accent: #1C0E04;
}
html.hw-on ::selection { background: var(--hw-orange); color: #140B04; }
html.hw-on #nprogress .bar { background: var(--hw-orange); }
html.hw-on #nprogress .peg { box-shadow: 0 0 10px var(--hw-orange), 0 0 5px var(--hw-orange); }
html.hw-on #nprogress .spinner-icon { border-top-color: var(--hw-orange); border-left-color: var(--hw-orange); }

/* --- Гирлянда в шапке ------------------------------------------------ */
.hw-garland {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 90px;
  overflow: hidden;
  pointer-events: none;
  z-index: 1210;
}
/* Под шапкой: висит от её нижнего края. z-index 1 — выпадающие
   подменю шапки (z-index 2) остаются поверх гирлянды. */
.hw-garland--header {
  top: 100%;
  height: 64px;
  z-index: 1;
}
.hw-garland__rope {
  position: absolute;
  inset: 0 0 auto 0;
  width: 100%;
  height: 40px;
}
.hw-garland__rope path {
  fill: none;
  stroke: #3a2f45;
  stroke-width: 2;
}
.hw-hang {
  position: absolute;
  top: 0;
  transform-origin: 50% 0;
  animation: hw-swing var(--hw-dur, 4s) ease-in-out var(--hw-delay, 0s) infinite alternate;
}
.hw-hang::before {
  content: '';
  display: block;
  width: 1px;
  height: var(--hw-len, 16px);
  margin: 0 auto;
  background: #3a2f45;
}
.hw-hang svg { display: block; }
.hw-hang--pumpkin svg { width: 30px; height: 30px; filter: drop-shadow(0 0 6px rgba(255, 140, 30, .55)); }
.hw-hang--bat svg { width: 34px; height: 18px; filter: drop-shadow(0 0 5px rgba(196, 163, 255, .45)); }
.hw-hang--spider svg { width: 18px; height: 18px; filter: drop-shadow(0 0 4px rgba(196, 163, 255, .4)); }
.hw-hang--spider { animation-name: hw-spider; }

@keyframes hw-swing {
  from { transform: rotate(-5deg); }
  to   { transform: rotate(5deg); }
}
@keyframes hw-spider {
  from { transform: translateY(-6px); }
  to   { transform: translateY(8px); }
}

/* --- Паутина в углах ---------------------------------------------- */
.hw-web {
  position: absolute;
  top: 0;
  width: 150px;
  height: 150px;
  pointer-events: none;
  z-index: 1205;
  opacity: .32;
}
.hw-web--header { top: 100%; z-index: 1; }
.hw-web--left { left: 0; }
.hw-web--right { right: 0; transform: scaleX(-1); }
.hw-web path { fill: none; stroke: #cfc6dd; stroke-width: .8; }

/* --- Летучие мыши, листья, туман --------------------------------- */
.hw-sky {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 1030;
}
.hw-leaf {
  position: absolute;
  top: -40px;
  left: var(--hw-x);
  width: var(--hw-size);
  height: var(--hw-size);
  opacity: .75;
  animation: hw-fall var(--hw-dur) linear var(--hw-delay) infinite;
}
.hw-leaf svg { width: 100%; height: 100%; display: block; }
@keyframes hw-fall {
  0%   { transform: translate(0, -5vh) rotate(0deg); }
  50%  { transform: translate(var(--hw-drift), 50vh) rotate(200deg); }
  100% { transform: translate(calc(var(--hw-drift) * -0.5), 108vh) rotate(420deg); }
}
.hw-bat {
  position: absolute;
  left: -60px;
  top: var(--hw-y);
  width: var(--hw-size);
  animation: hw-fly var(--hw-dur) linear var(--hw-delay) infinite;
  opacity: .85;
}
.hw-bat svg {
  display: block;
  width: 100%;
  height: auto;
  animation: hw-flap .22s ease-in-out infinite alternate;
  filter: drop-shadow(0 0 6px rgba(196, 163, 255, .5));
}
@keyframes hw-fly {
  0%   { transform: translate(0, 0); }
  25%  { transform: translate(28vw, -4vh); }
  50%  { transform: translate(55vw, 3vh); }
  75%  { transform: translate(82vw, -3vh); }
  100% { transform: translate(110vw, 0); }
}
@keyframes hw-flap {
  from { transform: scaleY(1); }
  to   { transform: scaleY(.45); }
}
.hw-fog {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 140px;
  background: linear-gradient(to top, rgba(140, 105, 251, .10), rgba(140, 105, 251, 0));
}

/* --- Фонарик: тёплое свечение вокруг курсора ---------------------- */
/* Страницу не затемняет. screen только осветляет то, что под ним,
   поэтому текст и кнопки остаются как были. */
.hw-torch {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1035;
  mix-blend-mode: screen;
  opacity: 0;
  transition: opacity .35s ease;
  background: radial-gradient(circle 230px at var(--hw-mx, -500px) var(--hw-my, -500px),
    rgba(255, 196, 120, .20) 0,
    rgba(255, 150, 60, .10) 35%,
    rgba(255, 130, 40, .035) 65%,
    rgba(255, 130, 40, 0) 100%);
}
.hw-torch--on { opacity: 1; }

/* --- Призрак ------------------------------------------------------ */
.hw-ghost {
  position: fixed;
  top: var(--hw-y, 50%);
  width: 64px;
  z-index: 1040;
  cursor: pointer;
  border: 0;
  padding: 0;
  background: none;
  opacity: .92;
  transition: transform .9s cubic-bezier(.2, .8, .2, 1), opacity .4s;
  filter: drop-shadow(0 0 12px rgba(220, 210, 255, .45));
}
.hw-ghost svg { display: block; width: 100%; height: auto; }
.hw-ghost--left  { left: 0;  transform: translateX(-110%) rotate(12deg); }
.hw-ghost--right { right: 0; transform: translateX(110%) rotate(-12deg); }
.hw-ghost--left.hw-ghost--in  { transform: translateX(-30%) rotate(12deg); }
.hw-ghost--right.hw-ghost--in { transform: translateX(30%) rotate(-12deg); }

/* --- Монеты ------------------------------------------------------- */
.hw-coin {
  position: absolute;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  cursor: pointer;
  z-index: 1020;
  opacity: .9;
  animation: hw-bob 3.2s ease-in-out infinite;
  transition: opacity .3s, transform .3s;
}
.hw-coin svg { display: block; width: 100%; height: 100%; }
.hw-coin::after {
  content: '';
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 207, 77, .35), rgba(255, 207, 77, 0) 70%);
  animation: hw-glint 4.5s ease-in-out infinite;
  pointer-events: none;
}
.hw-coin:hover { opacity: 1; transform: scale(1.15); }
.hw-coin:focus-visible { outline: 2px solid var(--hw-orange-hi); outline-offset: 3px; }
.hw-coin[disabled] { cursor: progress; }
.hw-coin--got {
  animation: hw-got .7s ease-out forwards;
  pointer-events: none;
}
@keyframes hw-bob {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-4px); }
}
@keyframes hw-glint {
  0%, 70%, 100% { opacity: 0; }
  80%           { opacity: 1; }
}
@keyframes hw-got {
  0%   { transform: scale(1); opacity: 1; }
  40%  { transform: scale(1.6) rotate(20deg); opacity: 1; }
  100% { transform: scale(.2) translateY(-60px); opacity: 0; }
}
.hw-plus {
  position: absolute;
  z-index: 1021;
  font: 700 14px/1 "Golos Text", Inter, sans-serif;
  color: var(--hw-ember);
  text-shadow: 0 1px 6px rgba(0, 0, 0, .8);
  pointer-events: none;
  animation: hw-plus 1.1s ease-out forwards;
}
@keyframes hw-plus {
  from { transform: translateY(0); opacity: 1; }
  to   { transform: translateY(-46px); opacity: 0; }
}

/* --- Виджет охоты ------------------------------------------------- */
.hw-widget {
  position: fixed;
  left: 16px;
  bottom: 16px;
  z-index: 1045;
  font-family: "Golos Text", Inter, system-ui, sans-serif;
  color: var(--hw-text);
}
.hw-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px 7px 8px;
  border: 1px solid var(--hw-line);
  border-radius: 999px;
  background: rgba(26, 23, 30, .94);
  color: var(--hw-text);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 10px 28px -12px rgba(0, 0, 0, .9), 0 0 0 0 rgba(255, 122, 26, 0);
  transition: border-color .2s, box-shadow .2s;
}
.hw-pill:hover { border-color: var(--hw-orange); }
.hw-pill svg { width: 26px; height: 26px; }
.hw-pill b { color: var(--hw-orange-hi); font-variant-numeric: tabular-nums; }
.hw-pill--pulse { animation: hw-pulse .9s ease-out; }
@keyframes hw-pulse {
  from { box-shadow: 0 0 0 0 rgba(255, 122, 26, .7); }
  to   { box-shadow: 0 0 0 16px rgba(255, 122, 26, 0); }
}
.hw-panel {
  position: absolute;
  left: 0;
  bottom: calc(100% + 10px);
  width: 330px;
  max-width: calc(100vw - 32px);
  padding: 20px;
  border: 1px solid var(--hw-line);
  border-radius: 20px;
  background: radial-gradient(ellipse at top left, rgba(255, 159, 73, .07), transparent 65%), rgba(25, 21, 29, .97);
  backdrop-filter: blur(16px);
  box-shadow: 0 18px 40px -18px rgba(0, 0, 0, .95);
  font-size: 13px;
  line-height: 1.45;
}
.hw-panel[hidden] { display: none; }
.hw-panel h4 {
  margin: 0 0 4px;
  font: 650 16px/1.4 "Golos Text", sans-serif;
  color: var(--hw-text);
}
.hw-panel p { margin: 0 0 10px; color: var(--hw-muted); }
.hw-panel a { color: var(--hw-orange-hi); text-decoration: none; font-weight: 600; }
.hw-panel a:hover { text-decoration: underline; }
.hw-bar {
  height: 8px;
  margin: 10px 0 6px;
  border-radius: 999px;
  background: #26212E;
  overflow: hidden;
}
.hw-bar span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, #FF7A1A, #FFCF4D);
  transition: width .5s ease;
}
.hw-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
  color: var(--hw-muted);
}
.hw-row b { color: var(--hw-text); font-variant-numeric: tabular-nums; }
/* Список «Где ещё искать». Ширина задана явно: всё строго внутри панели. */
.hw-where {
  width: 100%;
  min-width: 0;
  margin: 6px 0 2px;
  box-sizing: border-box;
}
.hw-where__toggle {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  color: var(--hw-orange-hi);
  font: inherit;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}
.hw-where__toggle::before { content: '▸ '; }
.hw-where--open .hw-where__toggle::before { content: '▾ '; }
.hw-where__list {
  display: none;
  width: 100%;
  margin-top: 6px;
  max-height: 168px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #4a3f5c transparent;
}
.hw-where--open .hw-where__list { display: block; }
.hw-where__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  padding: 3px 2px;
  border-bottom: 1px solid #26212E;
  color: var(--hw-muted);
}
.hw-where__item span,
.hw-where__item a {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.hw-where__item a { color: var(--hw-text); font-weight: 500; }
.hw-where__item b {
  flex: none;
  display: inline;
  margin: 0;
  padding: 0;
  color: var(--hw-ember);
  font-variant-numeric: tabular-nums;
}
.hw-count { margin: 8px 0 12px; color: var(--hw-ember); font-weight: 600; font-variant-numeric: tabular-nums; }
.hw-toggles {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid #26212E;
}
.hw-toggles { gap: 8px 18px; }

/* --- Тумблер ------------------------------------------------------ */
.hw-switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--hw-muted);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}
.hw-switch__track {
  position: relative;
  flex: none;
  width: 34px;
  height: 20px;
  border-radius: 999px;
  background: #3a3344;
  transition: background .2s;
}
.hw-switch__knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #9A93A8;
  transition: transform .2s, background .2s;
}
.hw-switch[aria-checked="true"] { color: var(--hw-text); }
.hw-switch[aria-checked="true"] .hw-switch__track { background: var(--hw-orange); }
.hw-switch[aria-checked="true"] .hw-switch__knob { transform: translateX(14px); background: #fff; }
.hw-switch:focus-visible .hw-switch__track { outline: 2px solid var(--hw-orange-hi); outline-offset: 2px; }
.hw-switch__label:empty { display: none; }
.hw-note {
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(140, 105, 251, .12);
  color: #C4A3FF;
  font-size: 12px;
}

/* --- Награды в виджете ------------------------------------------- */
.hw-rewards {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid #26212E;
}
.hw-rewards__title {
  margin-bottom: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--hw-muted);
}
.hw-reward {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 28px;
  color: var(--hw-text);
}
.hw-reward b { color: var(--hw-muted); font-weight: 600; font-variant-numeric: tabular-nums; }
.hw-btn {
  padding: 5px 11px;
  border: 1px solid var(--hw-line);
  border-radius: 999px;
  background: transparent;
  color: var(--hw-text);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.hw-btn:hover { border-color: var(--hw-orange); }
.hw-btn--main { border-color: var(--hw-orange); background: var(--hw-orange); color: #1C0E04; }
.hw-btn--main:hover { filter: brightness(1.08); }
.hw-btn[disabled] { opacity: .6; cursor: progress; }

/* --- Рамка аватара «Тыква» -------------------------------------- */
img.hw-frame {
  box-shadow: 0 0 0 2px var(--hw-orange), 0 0 12px 2px rgba(255, 122, 26, .55) !important;
  animation: hw-frame-pulse 2.8s ease-in-out infinite;
}
@keyframes hw-frame-pulse {
  0%, 100% { box-shadow: 0 0 0 2px var(--hw-orange), 0 0 10px 1px rgba(255, 122, 26, .45); }
  50%      { box-shadow: 0 0 0 2px var(--hw-orange-hi), 0 0 18px 4px rgba(255, 140, 40, .7); }
}
.hw-frame-host { position: relative; }
.hw-frame-pumpkin {
  position: absolute;
  z-index: 2;
  pointer-events: none;
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, .7));
}
.hw-frame-pumpkin svg { display: block; width: 100%; height: 100%; }

/* --- Тлеющий ник ------------------------------------------------- */
.hw-glow {
  text-shadow: 0 0 5px rgba(255, 122, 26, .75), 0 0 12px rgba(255, 90, 0, .45);
  animation: hw-ember 2.4s ease-in-out infinite;
}
@keyframes hw-ember {
  0%, 100% { text-shadow: 0 0 4px rgba(255, 122, 26, .6), 0 0 10px rgba(255, 90, 0, .35); }
  35%      { text-shadow: 0 0 7px rgba(255, 170, 70, .95), 0 0 18px rgba(255, 100, 0, .6); }
  60%      { text-shadow: 0 0 5px rgba(255, 122, 26, .7), 0 0 13px rgba(255, 90, 0, .45); }
}

/* --- Блок темы в окне «Оформление профиля» ------------------------ */
.hw-np-theme {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  padding: 12px 14px;
  border: 1px solid rgba(255, 122, 26, .45);
  border-radius: 14px;
  background: linear-gradient(120deg, rgba(255, 122, 26, .14), rgba(140, 105, 251, .10));
}
.hw-np-theme__icon { flex: none; width: 34px; height: 34px; }
.hw-np-theme__icon svg { width: 100%; height: 100%; display: block; }
.hw-np-theme__text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; font-size: 12.5px; color: var(--hw-muted); }
.hw-np-theme__text b { color: var(--hw-text); font-size: 14px; }
.hw-np-theme .np_btn { flex: none; }

/* --- Уведомление -------------------------------------------------- */
.hw-toast {
  position: fixed;
  left: 50%;
  bottom: 84px;
  z-index: 1060;
  max-width: min(420px, calc(100vw - 32px));
  padding: 12px 18px;
  border: 1px solid var(--hw-line);
  border-radius: 14px;
  background: rgba(20, 17, 24, .97);
  color: var(--hw-text);
  font: 500 14px/1.45 "Golos Text", Inter, sans-serif;
  text-align: center;
  box-shadow: 0 18px 40px -18px rgba(0, 0, 0, .95);
  transform: translate(-50%, 20px);
  opacity: 0;
  transition: transform .3s, opacity .3s;
}
.hw-toast--in { transform: translate(-50%, 0); opacity: 1; }
.hw-toast--win { border-color: var(--hw-orange); }
.hw-toast a { color: var(--hw-orange-hi); font-weight: 600; }

/* --- Спокойный режим и адаптив ----------------------------------- */
html.hw-calm .hw-sky,
html.hw-calm .hw-ghost { display: none; }
html.hw-calm .hw-hang,
html.hw-calm .hw-coin,
html.hw-calm .hw-coin::after,
html.hw-calm img.hw-frame,
html.hw-calm .hw-glow { animation: none; }

@media (prefers-reduced-motion: reduce) {
  .hw-hang, .hw-coin, .hw-coin::after, .hw-bat svg, img.hw-frame, .hw-glow { animation: none; }
}

@media (max-width: 767.98px) {
  .hw-garland { height: 64px; }
  .hw-hang--pumpkin svg { width: 22px; height: 22px; }
  .hw-hang--bat svg { width: 26px; height: 14px; }
  .hw-web { width: 90px; height: 90px; }
  .hw-widget { left: 12px; bottom: 12px; }
  .hw-coin { width: 34px; height: 34px; }
}
