/* ============================================================
 * 烟花盛典 · Fireworks Show
 * 视觉样式：夜空渐变 / 发光标题 / 玻璃拟态控制面板
 * ============================================================ */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
}

body {
  font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  color: #eef1ff;
  /* 夜空背景：地平线处略带微光的深蓝黑渐变 */
  background: linear-gradient(180deg, #020208 0%, #050a1e 45%, #0a1230 75%, #101a3d 100%);
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

/* ---------- 画布 ---------- */
#sky {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  cursor: crosshair;
  touch-action: none;
}

/* ---------- 顶部标题 ---------- */
.hero {
  position: fixed;
  top: 28px;
  left: 0;
  right: 0;
  text-align: center;
  pointer-events: none;
  z-index: 2;
  transition: opacity 1.5s ease, visibility 1.5s ease;
}

/* 沉浸模式：开场数秒后整个标题区淡出，不再出现 */
.hero.is-hidden {
  opacity: 0;
  visibility: hidden;
}

.hero__title {
  font-size: clamp(28px, 5vw, 52px);
  font-weight: 700;
  letter-spacing: 0.35em;
  text-indent: 0.35em;
  background: linear-gradient(120deg, #ffd76e 0%, #ff9a8b 30%, #b18cff 65%, #6ecbff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  filter: drop-shadow(0 0 18px rgba(255, 200, 120, 0.35));
  animation: titleGlow 4s ease-in-out infinite alternate;
}

@keyframes titleGlow {
  from { filter: drop-shadow(0 0 10px rgba(255, 200, 120, 0.25)); }
  to   { filter: drop-shadow(0 0 26px rgba(177, 140, 255, 0.55)); }
}

.hero__hint {
  margin-top: 10px;
  font-size: clamp(12px, 1.6vw, 15px);
  letter-spacing: 0.2em;
  color: rgba(238, 241, 255, 0.65);
  transition: opacity 1.2s ease;
}

.hero__hint.is-hidden {
  opacity: 0;
}

/* ---------- 底部控制面板（玻璃拟态） ---------- */
.panel {
  position: fixed;
  left: 50%;
  bottom: 20px;
  /* 默认收起：移出屏幕下方 */
  transform: translate(-50%, calc(100% + 40px));
  opacity: 0;
  pointer-events: none;
  transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.35s ease;
  z-index: 3;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px 22px;
  max-width: min(940px, calc(100vw - 24px));
  padding: 14px 22px;
  border-radius: 18px;
  background: rgba(16, 22, 48, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.45);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  backdrop-filter: blur(14px) saturate(140%);
}

/* 面板展开态 */
.panel.is-open {
  transform: translate(-50%, 0);
  opacity: 1;
  pointer-events: auto;
}

/* ---------- 面板唤出按钮（沉浸模式常驻入口） ---------- */
.panel-toggle {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 4;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(16, 22, 48, 0.4);
  color: rgba(238, 241, 255, 0.75);
  font-size: 19px;
  line-height: 1;
  cursor: pointer;
  /* 常态极低存在感，不破坏沉浸感 */
  opacity: 0.28;
  transition: opacity 0.3s ease, transform 0.35s ease, box-shadow 0.3s ease;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.panel-toggle:hover {
  opacity: 1;
  box-shadow: 0 0 18px rgba(255, 200, 120, 0.4);
}

/* 面板展开时按钮高亮并旋转 */
.panel-toggle.is-active {
  opacity: 0.95;
  transform: rotate(45deg);
  box-shadow: 0 0 14px rgba(255, 154, 94, 0.5);
}

.panel__group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.panel__label {
  font-size: 12px;
  letter-spacing: 0.15em;
  color: rgba(238, 241, 255, 0.55);
  white-space: nowrap;
}

.pattern-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* ---------- 按钮 ---------- */
.btn {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.06);
  color: #dfe4ff;
  font-size: 13px;
  padding: 7px 14px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s ease, border-color 0.2s ease,
              box-shadow 0.2s ease, transform 0.1s ease;
}

.btn:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.3);
}

.btn:active {
  transform: scale(0.96);
}

.btn.is-active {
  background: linear-gradient(120deg, rgba(255, 183, 94, 0.9), rgba(255, 110, 145, 0.9));
  border-color: transparent;
  color: #fff;
  box-shadow: 0 0 14px rgba(255, 140, 110, 0.5);
}

.btn--accent {
  background: linear-gradient(120deg, #7b5cff, #4fb7ff);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 0 14px rgba(110, 140, 255, 0.45);
}

.btn--accent:hover {
  box-shadow: 0 0 22px rgba(110, 140, 255, 0.7);
  background: linear-gradient(120deg, #8d70ff, #66c3ff);
}

/* ---------- 开关 ---------- */
.switch {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.switch__track {
  position: relative;
  width: 40px;
  height: 22px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.2);
  transition: background 0.25s ease;
  flex: none;
}

.switch__track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.25s ease;
}

.switch input:checked + .switch__track {
  background: linear-gradient(120deg, #ff9a5e, #ff5e8a);
  border-color: transparent;
}

.switch input:checked + .switch__track::after {
  transform: translateX(18px);
}

.switch__text {
  font-size: 13px;
  color: #dfe4ff;
  white-space: nowrap;
}

/* ---------- 滑块 ---------- */
.panel__group--slider input[type="range"] {
  width: 110px;
  accent-color: #ff7e9d;
  cursor: pointer;
}

/* ---------- noscript ---------- */
.noscript {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 18px;
  color: #ffb3b3;
  z-index: 10;
}

/* ---------- 响应式 ---------- */
@media (max-width: 640px) {
  .panel {
    bottom: 10px;
    padding: 10px 14px;
    gap: 10px 14px;
    border-radius: 14px;
  }

  .hero {
    top: 16px;
  }

  .panel__group--slider input[type="range"] {
    width: 80px;
  }
}
