/* Зимнее оформление Starquake — включается/выключается независимо в админке */

/* 1. Морозный иней на шапке и гирлянда под .topbar */
html.sq-winter-theme .topbar {
  border-bottom-color: rgba(154, 224, 255, 0.42);
  box-shadow:
    inset 0 2px 12px rgba(176, 236, 255, 0.14),
    inset 0 -1px 0 rgba(214, 246, 255, 0.25),
    0 8px 24px rgba(1, 10, 26, 0.65);
}

html.sq-winter-theme.sq-winter-garland .topbar::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  height: 11px;
  pointer-events: none;
  z-index: 4;
  background-image:
    linear-gradient(180deg, rgba(162, 224, 255, 0.24) 0 1px, transparent 1px),
    radial-gradient(circle 3.2px at 12px 5px, #ffe084 0%, rgba(255, 214, 102, 0.55) 48%, transparent 100%),
    radial-gradient(circle 3.2px at 38px 6px, #72e7ff 0%, rgba(114, 231, 255, 0.5) 48%, transparent 100%),
    radial-gradient(circle 3.2px at 64px 5px, #ff708c 0%, rgba(255, 112, 140, 0.5) 48%, transparent 100%),
    radial-gradient(circle 3.2px at 90px 6px, #6ef4b5 0%, rgba(110, 244, 181, 0.5) 48%, transparent 100%);
  background-size: 100% 100%, 104px 11px, 104px 11px, 104px 11px, 104px 11px;
  background-repeat: no-repeat, repeat-x, repeat-x, repeat-x, repeat-x;
  opacity: 0.9;
  animation: sq-winter-garland-twinkle 3.8s ease-in-out infinite;
}

@keyframes sq-winter-garland-twinkle {
  0%, 100% {
    opacity: 0.78;
    filter: brightness(0.95);
  }
  50% {
    opacity: 1;
    filter: brightness(1.18) drop-shadow(0 2px 6px rgba(154, 230, 255, 0.24));
  }
}

body:has(.battle-scene) html.sq-winter-theme.sq-winter-garland .topbar::after,
html.sq-winter-theme.sq-winter-garland:has(.battle-scene) .topbar::after {
  opacity: 0.25;
  animation: none !important;
}

/* 2. Зимняя станция «Омега» и северное сияние за ней */
html.sq-winter-theme .station-aura {
  background: radial-gradient(
    ellipse,
    rgba(116, 230, 255, 0.24),
    rgba(104, 240, 198, 0.14) 36%,
    rgba(255, 208, 128, 0.08) 54%,
    transparent 74%
  );
}

html.sq-winter-theme.sq-winter-station-art .station-image {
  filter:
    brightness(1.02)
    saturate(1.06)
    contrast(1.08)
    drop-shadow(0 12px 18px #010812eb)
    drop-shadow(0 0 26px rgba(110, 224, 255, 0.28));
}

/* 2b. Живая подсветка гирлянд и голографической ёлочки поверх зимней «Омеги» */
.sq-winter-station-fx {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2;
  mix-blend-mode: screen;
  animation: stationFloat 9s ease-in-out infinite;
  user-select: none;
}

.sq-winter-station-fx .sq-bulb {
  transform-box: fill-box;
  transform-origin: center;
  animation: sq-winter-bulb-pulse 3.4s ease-in-out infinite;
}

.sq-winter-station-fx .sq-bulb.sq-p0 { animation-delay: 0s; }
.sq-winter-station-fx .sq-bulb.sq-p1 { animation-delay: -0.85s; }
.sq-winter-station-fx .sq-bulb.sq-p2 { animation-delay: -1.7s; }
.sq-winter-station-fx .sq-bulb.sq-p3 { animation-delay: -2.55s; }

.sq-winter-station-fx .sq-bulb-tree {
  animation-duration: 2.6s;
}

.sq-winter-station-fx .sq-tree-aura {
  transform-box: fill-box;
  transform-origin: center;
  animation: sq-winter-tree-breath 4.4s ease-in-out infinite;
}

.sq-winter-station-fx .sq-tree-ring {
  fill: none;
  stroke: rgba(126, 255, 232, 0.72);
  stroke-width: 1.6;
  animation: sq-winter-ring-glow 3.2s ease-in-out infinite;
}

.sq-winter-station-fx .sq-tree-star {
  transform-box: fill-box;
  transform-origin: center;
  animation: sq-winter-star-twinkle 2.8s ease-in-out infinite;
}

.sq-winter-station-fx .sq-tree-star-rays {
  stroke: #e8fffb;
  stroke-width: 1.35;
  stroke-linecap: round;
  opacity: 0.92;
}

@keyframes sq-winter-bulb-pulse {
  0%, 100% {
    opacity: 0.42;
    transform: scale(0.84);
  }
  45% {
    opacity: 1;
    transform: scale(1.16);
  }
  70% {
    opacity: 0.78;
    transform: scale(0.98);
  }
}

@keyframes sq-winter-tree-breath {
  0%, 100% {
    opacity: 0.62;
    transform: scale(0.96);
  }
  50% {
    opacity: 0.98;
    transform: scale(1.06);
  }
}

@keyframes sq-winter-ring-glow {
  0%, 100% {
    opacity: 0.48;
    stroke-width: 1.3;
  }
  50% {
    opacity: 0.96;
    stroke-width: 2.1;
  }
}

@keyframes sq-winter-star-twinkle {
  0%, 100% {
    opacity: 0.74;
    transform: scale(0.9) rotate(0deg);
  }
  50% {
    opacity: 1;
    transform: scale(1.18) rotate(12deg);
  }
}

html.sq-perf-hidden .sq-winter-station-fx,
html.sq-perf-hidden .sq-winter-station-fx *,
html.sq-perf-low .sq-winter-station-fx,
html.sq-perf-low .sq-winter-station-fx * {
  animation: none !important;
}

html.sq-perf-low .sq-winter-station-fx .sq-bulb {
  opacity: 0.72;
}

/* 3. Ледяные уголки HUD */
html.sq-winter-theme .hud-corners::before,
html.sq-winter-theme .hud-corners::after {
  border-color: rgba(168, 234, 255, 0.72);
  filter: drop-shadow(0 0 5px rgba(132, 222, 255, 0.36));
}

/* 4. Северное сияние на экране входа */
html.sq-winter-theme .auth-nebula::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 68% 36% at 24% 12%, rgba(92, 242, 214, 0.16), transparent 72%),
    radial-gradient(ellipse 56% 32% at 74% 16%, rgba(120, 206, 255, 0.15), transparent 70%),
    radial-gradient(ellipse 46% 24% at 50% 4%, rgba(178, 146, 255, 0.1), transparent 75%);
  animation: sq-winter-aurora 14s ease-in-out infinite alternate;
}

@keyframes sq-winter-aurora {
  0% {
    opacity: 0.72;
    transform: translateY(0) scaleX(1);
  }
  100% {
    opacity: 1;
    transform: translateY(-6px) scaleX(1.04);
  }
}

/* 5. Атлас галактики — праздничная Омега */
html.sq-winter-theme .atlas-omega {
  border-color: rgba(162, 235, 255, 0.68);
  box-shadow: 0 0 18px rgba(114, 226, 255, 0.25), inset 0 0 12px rgba(162, 235, 255, 0.12);
}

html.sq-winter-theme .atlas-omega::after {
  content: "❄";
  position: absolute;
  top: 4px;
  right: 6px;
  font-size: 10px;
  line-height: 1;
  color: #bdeeff;
  text-shadow: 0 0 6px rgba(130, 226, 255, 0.75);
  pointer-events: none;
}

/* 6. Космический снег (фоновый, не мешает кликам, скрыт в бою) */
canvas.sq-winter-snow-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 3;
  transition: opacity 0.25s ease;
}

body:has(.auth-portal) canvas.sq-winter-snow-canvas {
  z-index: 1001;
  opacity: 0.78;
}

body:has(.battle-scene, .trial-shell) canvas.sq-winter-snow-canvas {
  opacity: 0;
}

html.sq-perf-hidden .topbar::after,
html.sq-perf-hidden .auth-nebula::after,
html.sq-perf-low .topbar::after,
html.sq-perf-low .auth-nebula::after {
  animation: none !important;
}

html.sq-perf-low canvas.sq-winter-snow-canvas {
  display: none !important;
}

/* 7. Админка — вкладка «Зимний режим» */
.sq-admin-winter-wrap {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.sq-admin-winter-card {
  padding: 15px 18px;
  border-radius: 8px;
  background: rgba(12, 22, 35, 0.92);
  border: 1px solid rgba(145, 206, 235, 0.24);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sq-admin-winter-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.sq-admin-winter-kicker {
  font-family: "Exo 2", sans-serif;
  font-size: calc(10px * var(--sq-font-scale, 1));
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: #8fd4ef;
  margin-bottom: 4px;
}

.sq-admin-winter-head h3 {
  margin: 0;
  font-size: calc(18px * var(--sq-font-scale, 1));
  color: #ecf7ff;
}

.sq-admin-winter-master {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 8px;
  background: rgba(8, 17, 29, 0.9);
  border: 1px solid rgba(138, 198, 226, 0.26);
  cursor: pointer;
  user-select: none;
}

.sq-admin-winter-master.is-on {
  border-color: rgba(124, 235, 255, 0.72);
  background: linear-gradient(135deg, rgba(20, 56, 78, 0.92), rgba(14, 34, 54, 0.94));
  box-shadow: 0 0 18px rgba(102, 220, 255, 0.22);
}

.sq-winter-switch {
  position: relative;
  width: 48px;
  height: 26px;
  border-radius: 999px;
  background: rgba(120, 148, 172, 0.34);
  border: 1px solid rgba(154, 194, 220, 0.35);
  transition: background 0.2s ease, border-color 0.2s ease;
  flex-shrink: 0;
}

.sq-winter-switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #d8eaf7;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.45);
  transition: transform 0.2s ease, background 0.2s ease;
}

.sq-admin-winter-master.is-on .sq-winter-switch {
  background: linear-gradient(135deg, #27b4d8, #57e0b8);
  border-color: #a8f5ff;
}

.sq-admin-winter-master.is-on .sq-winter-switch::after {
  transform: translateX(22px);
  background: #ffffff;
}

.sq-admin-winter-master input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.sq-admin-winter-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.sq-admin-winter-opt {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 13px;
  border-radius: 7px;
  background: rgba(7, 15, 26, 0.8);
  border: 1px solid rgba(135, 183, 206, 0.18);
  cursor: pointer;
}

.sq-admin-winter-opt input {
  margin-top: 3px;
}

.sq-admin-winter-opt strong {
  display: block;
  font-size: calc(13px * var(--sq-font-scale, 1));
  color: #e4f3fc;
}

.sq-admin-winter-opt span {
  display: block;
  margin-top: 2px;
  font-size: calc(11px * var(--sq-font-scale, 1));
  color: #8aa8be;
  line-height: 1.35;
}

.sq-admin-winter-preview {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}

.sq-admin-winter-preview-box {
  padding: 12px;
  border-radius: 7px;
  background: radial-gradient(circle at 50% 45%, rgba(30, 68, 104, 0.38), rgba(6, 13, 24, 0.96) 72%);
  border: 1px solid rgba(135, 183, 206, 0.22);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sq-admin-winter-preview-box.is-selected {
  border-color: rgba(124, 235, 255, 0.68);
  box-shadow: 0 0 16px rgba(102, 220, 255, 0.18);
}

.sq-admin-winter-preview-box small {
  font-size: calc(11px * var(--sq-font-scale, 1));
  color: #9ec0d6;
}

.sq-admin-winter-preview-box img {
  width: 100%;
  height: 88px;
  object-fit: contain;
}

.sq-admin-winter-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: calc(12px * var(--sq-font-scale, 1));
  background: rgba(24, 62, 84, 0.55);
  border: 1px solid rgba(128, 224, 255, 0.35);
  color: #cdeeff;
}

.sq-admin-winter-note {
  font-size: calc(12px * var(--sq-font-scale, 1));
  color: #88a4bb;
  line-height: 1.45;
}
