/* ═══════════════════════════════════════════════════════════════
   Сезонное оформление. Тему выбирает администратор в Мастерской
   (Оформление), сервер ставит её на <html data-theme="…">. Тема меняет
   палитру фона, шапки и карточек, акцентный цвет, украшает логотип,
   первый экран главной; падающие листья, снег и т. п. рисует
   lib/season.js. Переменные палитры заданы на [data-theme], а не только
   на html, — так плитки в Мастерской показывают тему у себя внутри.
   ═══════════════════════════════════════════════════════════════ */

[data-theme='autumn'] {
  --bg-0: #150811;
  --bg-1: #250c1b;
  --bg-2: #341226;
  --panel: rgba(64, 22, 42, 0.72);
  --panel-solid: #2e1020;
  --panel-2: rgba(98, 38, 58, 0.5);
  --text-2: #f3d8cc;
  --text-3: #c99a92;
  --purple: #ec6a2c;
  --purple-hi: #ff9455;
  --purple-lo: #c24c16;
  --accent-rgb: 236, 106, 44;
  --accent-hi-rgb: 255, 148, 85;
  --panel-rgb: 64, 22, 42;
  --surf-rgb: 92, 34, 54;
  --deep-rgb: 30, 9, 20;
  --th-rgb: 21, 8, 17;
  --th-glow-1: rgba(255, 118, 40, 0.3);
  --th-glow-2: rgba(214, 40, 57, 0.18);
  --th-glow-3: rgba(255, 186, 64, 0.1);
  --th-nav: rgba(32, 10, 22, 0.76);
  --th-hero-1: rgba(118, 36, 34, 0.92);
  --th-hero-2: rgba(66, 18, 36, 0.78);
  --th-hero-3: rgba(32, 10, 24, 0.55);
  --th-title: linear-gradient(90deg, #ffd23f, #ff7a2b, #e3342f, #ff7a2b, #ffd23f);
  --th-accent: #ff8a3c;
}

[data-theme='halloween'] {
  --bg-0: #07040d;
  --bg-1: #120a1c;
  --bg-2: #1b0f2a;
  --panel: rgba(32, 16, 46, 0.74);
  --panel-solid: #1c1029;
  --panel-2: rgba(62, 32, 86, 0.5);
  --text-2: #e4d4f2;
  --text-3: #a38cbd;
  --purple: #8f4dff;
  --purple-hi: #b086ff;
  --purple-lo: #6a2ee0;
  --orange: #ff7a1a;
  --accent-rgb: 143, 77, 255;
  --accent-hi-rgb: 176, 134, 255;
  --panel-rgb: 32, 16, 46;
  --surf-rgb: 58, 28, 84;
  --deep-rgb: 12, 6, 20;
  --th-rgb: 7, 4, 13;
  --th-glow-1: rgba(128, 56, 255, 0.3);
  --th-glow-2: rgba(110, 220, 60, 0.08);
  --th-glow-3: rgba(255, 110, 20, 0.2);
  --th-nav: rgba(12, 6, 20, 0.8);
  --th-hero-1: rgba(58, 22, 92, 0.92);
  --th-hero-2: rgba(28, 12, 46, 0.8);
  --th-hero-3: rgba(14, 6, 22, 0.6);
  --th-title: linear-gradient(90deg, #ffb02e, #ff6a00, #ff3d1f, #ff6a00, #ffb02e);
  --th-accent: #ff7a1a;
}

[data-theme='winter'] {
  --bg-0: #050a1c;
  --bg-1: #0a1533;
  --bg-2: #0f1f48;
  --panel: rgba(22, 40, 92, 0.68);
  --panel-solid: #12214c;
  --panel-2: rgba(44, 76, 150, 0.45);
  --text-2: #d4e4ff;
  --text-3: #8fa8d6;
  --purple: #3f9bff;
  --purple-hi: #7cc0ff;
  --purple-lo: #2470d8;
  --accent-rgb: 63, 155, 255;
  --accent-hi-rgb: 124, 192, 255;
  --panel-rgb: 22, 40, 92;
  --surf-rgb: 34, 62, 130;
  --deep-rgb: 6, 14, 34;
  --th-rgb: 5, 10, 28;
  --th-glow-1: rgba(80, 160, 255, 0.32);
  --th-glow-2: rgba(255, 77, 97, 0.12);
  --th-glow-3: rgba(140, 220, 255, 0.12);
  --th-nav: rgba(8, 16, 40, 0.78);
  --th-hero-1: rgba(30, 64, 140, 0.92);
  --th-hero-2: rgba(16, 34, 84, 0.78);
  --th-hero-3: rgba(8, 16, 44, 0.55);
  --th-title: linear-gradient(90deg, #ffffff, #9fd8ff, #ff6b7d, #9fd8ff, #ffffff);
  --th-accent: #7cc0ff;
}

[data-theme='spring'] {
  --bg-0: #10081a;
  --bg-1: #1d0d2b;
  --bg-2: #2a123a;
  --panel: rgba(56, 24, 74, 0.7);
  --panel-solid: #2a1239;
  --panel-2: rgba(96, 42, 116, 0.5);
  --text-2: #f4d8ec;
  --text-3: #c29cc4;
  --purple: #f0609f;
  --purple-hi: #ff8fc2;
  --purple-lo: #cc3d7d;
  --accent-rgb: 240, 96, 159;
  --accent-hi-rgb: 255, 143, 194;
  --panel-rgb: 56, 24, 74;
  --surf-rgb: 88, 36, 104;
  --deep-rgb: 20, 8, 30;
  --th-rgb: 16, 8, 26;
  --th-glow-1: rgba(255, 110, 180, 0.28);
  --th-glow-2: rgba(120, 220, 120, 0.13);
  --th-glow-3: rgba(170, 130, 255, 0.14);
  --th-nav: rgba(24, 10, 36, 0.76);
  --th-hero-1: rgba(108, 36, 104, 0.9);
  --th-hero-2: rgba(56, 20, 76, 0.76);
  --th-hero-3: rgba(28, 10, 42, 0.55);
  --th-title: linear-gradient(90deg, #ffe066, #ff8fc2, #ff5fa2, #ff8fc2, #ffe066);
  --th-accent: #ff8fc2;
}

[data-theme='summer'] {
  --bg-0: #031019;
  --bg-1: #072034;
  --bg-2: #0b2c46;
  --panel: rgba(14, 54, 86, 0.68);
  --panel-solid: #0b2a44;
  --panel-2: rgba(28, 92, 130, 0.45);
  --text-2: #d0eef6;
  --text-3: #8bbccb;
  --purple: #17bccb;
  --purple-hi: #4fdde6;
  --purple-lo: #0b93a3;
  --accent-rgb: 23, 188, 203;
  --accent-hi-rgb: 79, 221, 230;
  --panel-rgb: 14, 54, 86;
  --surf-rgb: 22, 82, 120;
  --deep-rgb: 4, 20, 32;
  --th-rgb: 3, 16, 25;
  --th-glow-1: rgba(40, 200, 210, 0.22);
  --th-glow-2: rgba(255, 190, 60, 0.26);
  --th-glow-3: rgba(255, 120, 60, 0.12);
  --th-nav: rgba(4, 22, 36, 0.76);
  --th-hero-1: rgba(14, 92, 120, 0.9);
  --th-hero-2: rgba(10, 48, 80, 0.78);
  --th-hero-3: rgba(6, 24, 42, 0.55);
  --th-title: linear-gradient(90deg, #ffe066, #ffb020, #ff7a3c, #ffb020, #ffe066);
  --th-accent: #ffc23f;
}

/* ─── Общее для всех тем ─── */

html[data-theme] {
  scrollbar-color: rgba(255, 255, 255, 0.22) transparent;
}

html[data-theme] body {
  background-color: var(--bg-0);
  background-image:
    radial-gradient(1200px 700px at 12% -10%, var(--th-glow-1), transparent 60%),
    radial-gradient(900px 600px at 100% 0%, var(--th-glow-2), transparent 60%),
    radial-gradient(1000px 800px at 50% 110%, var(--th-glow-3), transparent 60%),
    linear-gradient(180deg, var(--bg-1) 0%, var(--bg-0) 70%);
}

html[data-theme] #nav {
  background: var(--th-nav);
}

html[data-theme] .hero {
  background: linear-gradient(120deg, var(--th-hero-1) 0%, var(--th-hero-2) 52%, var(--th-hero-3) 100%);
}

html[data-theme] .hero-title span {
  background-image: var(--th-title);
}

html[data-theme] .kicker {
  color: var(--th-accent);
}

html[data-theme] .home-bgv::after {
  background:
    linear-gradient(180deg, rgba(var(--th-rgb), 0.55) 0%, rgba(var(--th-rgb), 0.1) 30%, rgba(var(--th-rgb), 0.25) 70%, rgba(var(--th-rgb), 0.85) 100%),
    radial-gradient(1100px 700px at 15% 0%, var(--th-glow-1), transparent 65%),
    radial-gradient(900px 600px at 100% 10%, var(--th-glow-2), transparent 60%);
}

/* Украшение в углу первого экрана главной */
html[data-theme] .hero::before {
  content: '';
  position: absolute;
  pointer-events: none;
  background: no-repeat center / contain;
}

/* Холст с листьями, снегом и т. п.: поверх страницы, под шапкой и окнами */
.season-fx {
  position: fixed;
  inset: 0;
  z-index: 45;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

body.in-game .season-fx {
  display: none;
}

/* ─── Логотип: шапка, тыква, листок, цветок, очки ─── */

.logo-mark .lm-acc {
  display: none;
}

[data-theme='winter'] .logo-mark .lm-winter,
[data-theme='halloween'] .logo-mark .lm-halloween,
[data-theme='autumn'] .logo-mark .lm-autumn,
[data-theme='spring'] .logo-mark .lm-spring,
[data-theme='summer'] .logo-mark .lm-summer {
  display: inline;
}

[data-theme='halloween'] .logo-mark .lm-eye,
[data-theme='summer'] .logo-mark .lm-eye {
  display: none;
}

[data-theme='halloween'] .logo-mark {
  filter: drop-shadow(0 4px 12px rgba(255, 110, 20, 0.5));
}

/* ─── Осень ─── */

html[data-theme='autumn'] .hero::before {
  top: -18px;
  right: -22px;
  width: 300px;
  height: 210px;
  background-image: url(/img/season/leaves.svg);
  opacity: 0.9;
}

html[data-theme='autumn'] .hero::after {
  background: radial-gradient(circle, rgba(255, 140, 40, 0.24), transparent 65%);
}

/* ─── Хеллоуин ─── */

html[data-theme='halloween'] .hero::before {
  top: 0;
  left: 0;
  width: 240px;
  height: 240px;
  background-image: url(/img/season/web.svg);
  opacity: 0.55;
}

/* Луна вместо жёлтого блика */
html[data-theme='halloween'] .hero::after {
  background:
    radial-gradient(circle at 46% 46%, rgba(255, 240, 205, 0.5) 0, rgba(255, 214, 150, 0.36) 13%, rgba(240, 170, 90, 0.3) 16.5%, transparent 17.5%),
    radial-gradient(circle, rgba(255, 150, 60, 0.3), transparent 62%);
}

/* Паук спускается на нитке из-под шапки */
html[data-theme='halloween'] #nav::after {
  content: '';
  position: absolute;
  top: 100%;
  /* на широком экране — в поле справа от содержимого */
  right: max(24px, calc((100vw - 1240px) / 2 - 56px));
  width: 40px;
  height: 200px;
  pointer-events: none;
  background: url(/img/season/spider.svg) no-repeat 50% -106px / 40px 306px;
  animation: spiderBob 9s ease-in-out infinite;
}

@keyframes spiderBob {
  0%,
  100% {
    background-position-y: -250px;
  }
  45%,
  60% {
    background-position-y: -106px;
  }
}

/* ─── Зима и Новый год ─── */

/* Гирлянда под шапкой */
html[data-theme='winter'] #nav::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  height: 26px;
  margin-top: -3px;
  pointer-events: none;
  background: url(/img/season/garland.svg) repeat-x 0 0 / 240px 26px;
}

/* Снег на крыше первого экрана и карточек режимов */
html[data-theme='winter'] .hero::before {
  top: 0;
  left: 0;
  right: 0;
  height: 26px;
  background: url(/img/season/snowcap.svg) repeat-x 0 0 / 200px 26px;
  opacity: 0.95;
}

html[data-theme='winter'] .mode-card {
  background:
    url(/img/season/snowcap.svg) repeat-x 0 0 / 200px 22px,
    linear-gradient(160deg, var(--mc1), var(--mc2));
}

html[data-theme='winter'] .hero::after {
  background: radial-gradient(circle, rgba(140, 210, 255, 0.24), transparent 65%);
}

/* ─── Весна ─── */

html[data-theme='spring'] .hero::before {
  top: -6px;
  right: -8px;
  width: 320px;
  height: 210px;
  background-image: url(/img/season/blossom.svg);
  opacity: 0.95;
}

html[data-theme='spring'] .hero::after {
  background: radial-gradient(circle, rgba(255, 143, 194, 0.22), transparent 65%);
}

/* ─── Лето ─── */

/* Солнце с медленно вращающимися лучами */
html[data-theme='summer'] .hero::after {
  background: radial-gradient(circle, rgba(255, 246, 205, 0.85) 0 6%, rgba(255, 214, 110, 0.45) 10%, rgba(255, 180, 60, 0.18) 24%, transparent 60%);
}

/* центр лучей совпадает с солнцем (.hero::after) */
html[data-theme='summer'] .hero::before {
  width: 900px;
  height: 900px;
  right: -330px;
  top: -350px;
  border-radius: 50%;
  background: repeating-conic-gradient(rgba(255, 220, 120, 0.09) 0 5deg, transparent 5deg 15deg);
  mask-image: radial-gradient(circle, #000 8%, transparent 62%);
  -webkit-mask-image: radial-gradient(circle, #000 8%, transparent 62%);
  animation: sunSpin 90s linear infinite;
}

@keyframes sunSpin {
  to {
    transform: rotate(360deg);
  }
}

/* ─── Телефон ─── */

@media (max-width: 760px) {
  html[data-theme='autumn'] .hero::before,
  html[data-theme='spring'] .hero::before {
    width: 190px;
    height: 134px;
    opacity: 0.7;
  }

  html[data-theme='halloween'] .hero::before {
    width: 150px;
    height: 150px;
  }

  html[data-theme='halloween'] #nav::after {
    right: 18px;
  }

  html[data-theme='winter'] .mode-card {
    background:
      url(/img/season/snowcap.svg) repeat-x 0 0 / 150px 16px,
      linear-gradient(160deg, var(--mc1), var(--mc2));
  }
}

@media (prefers-reduced-motion: reduce) {
  html[data-theme] #nav::after,
  html[data-theme] .hero::before {
    animation: none;
  }
}
