/* ============================================================
   老鼠娶亲 · AI 奏乐  —— 样式
   风格：喜庆 · 红金 · 简约
   运行环境：教学一体机（触控优先），1920×1080 基准，全分辨率自适应
   ============================================================ */

:root {
  --red: #C8102E;
  --red-deep: #8C0F16;
  --red-dark: #5E0A10;
  --red-ink: #3A0008;
  --gold: #E8B22E;
  --gold-light: #FFE9A8;
  --gold-dark: #A87A16;
  --cream: #FFF6E5;

  /* 全局流式字号：1920 约 20px，4K 约 36px，小屏不低于 13px */
  font-size: clamp(13px, 1.05vw, 36px);

  --bd: clamp(112px, 10.4vw, 300px);        /* 泡泡直径 */
  --slot: clamp(66px, 5.4vw, 150px);        /* 槽位直径 */
  --radius: clamp(10px, 0.9vw, 26px);
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  height: 100%;
  touch-action: manipulation;
  overscroll-behavior: none;
}

body {
  font-family: "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", sans-serif;
  color: var(--cream);
  background:
    radial-gradient(120% 90% at 50% 0%, #A3121F 0%, #7A0C13 42%, #4C060C 100%),
    var(--red-dark);
  -webkit-user-select: none;
  user-select: none;
  overflow: hidden;
}

[hidden] { display: none !important; }

/* ---------------------------------------------------------- 背景装饰 */

.decor { position: fixed; inset: 0; pointer-events: none; z-index: 0; }

/* 金边画框 */
.decor::before {
  content: "";
  position: absolute;
  inset: clamp(6px, 0.7vw, 20px);
  border: clamp(2px, 0.16vw, 4px) solid rgba(232, 178, 46, 0.55);
  border-radius: clamp(8px, 0.8vw, 22px);
  box-shadow: inset 0 0 0 clamp(2px, 0.16vw, 4px) rgba(255, 233, 168, 0.14);
}

/* 四角窗花 */
.lattice {
  position: absolute;
  width: clamp(84px, 8vw, 220px);
  aspect-ratio: 1;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cg fill='none' stroke='%23E8B22E' stroke-width='2.6' stroke-linecap='square'%3E%3Cpath d='M0 0h66M0 0v66'/%3E%3Cpath d='M0 17h45M17 0v45'/%3E%3Cpath d='M0 34h23M34 0v23'/%3E%3Crect x='31' y='31' width='21' height='21'/%3E%3Cpath d='M31 31l21 21M52 31L31 52'/%3E%3C/g%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
  opacity: 0.5;
}
.corner-tl { top: clamp(8px, 0.9vw, 26px); left: clamp(8px, 0.9vw, 26px); }
.corner-tr { top: clamp(8px, 0.9vw, 26px); right: clamp(8px, 0.9vw, 26px); transform: scaleX(-1); }
.corner-bl { bottom: clamp(8px, 0.9vw, 26px); left: clamp(8px, 0.9vw, 26px); transform: scaleY(-1); }
.corner-br { bottom: clamp(8px, 0.9vw, 26px); right: clamp(8px, 0.9vw, 26px); transform: scale(-1); }

/* 灯笼 */
.lantern {
  position: absolute;
  top: 0;
  width: clamp(56px, 5.4vw, 148px);
  transform-origin: 50% 0;
  animation: sway 5.2s ease-in-out infinite;
  filter: drop-shadow(0 6px 18px rgba(0, 0, 0, 0.45));
}
.lantern svg { display: block; width: 100%; height: auto; }
.lantern-left { left: clamp(24px, 6vw, 190px); }
.lantern-right { right: clamp(24px, 6vw, 190px); animation-delay: -2.6s; }
@keyframes sway {
  0%, 100% { transform: rotate(-3.2deg); }
  50% { transform: rotate(3.2deg); }
}

/* 底部祥云 */
.cloud-band {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: clamp(46px, 5vw, 140px);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 80' preserveAspectRatio='none'%3E%3Cpath d='M0 80V46c22 0 24-16 46-16s24 14 44 14 20-22 46-22 26 20 50 20 24-14 46-14 22 16 46 16 24-12 46-12 26 14 46 14v34z' fill='%23C8102E' opacity='.5'/%3E%3Cpath d='M0 80V60c26 0 28-14 52-14s26 12 50 12 24-18 52-18 28 16 54 16 26-12 50-12 26 12 50 12 28-10 52-10v34z' fill='%23E8B22E' opacity='.16'/%3E%3C/svg%3E");
  background-size: 100% 100%;
  background-repeat: no-repeat;
}

/* ---------------------------------------------------------- 视图容器 */

#app { position: relative; z-index: 1; height: 100%; }

.view {
  display: none;
  flex-direction: column;
  height: 100%;
  padding: clamp(14px, 1.8vh, 42px) clamp(18px, 3vw, 76px);
}
.view.is-active { display: flex; animation: viewIn 0.32s ease-out; }
@keyframes viewIn { from { opacity: 0; transform: translateY(0.8rem); } to { opacity: 1; transform: none; } }

/* 通用按钮 */
.btn {
  font-family: inherit;
  font-size: 1rem;
  color: var(--cream);
  background: rgba(0, 0, 0, 0.22);
  border: clamp(1px, 0.12vw, 3px) solid rgba(232, 178, 46, 0.5);
  border-radius: 999px;
  padding: 0.6em 1.5em;
  cursor: pointer;
  transition: transform 0.14s ease, background 0.2s ease, box-shadow 0.2s ease, border-color 0.2s;
  line-height: 1.2;
}
.btn:active { transform: scale(0.95); }

.btn-primary {
  background: linear-gradient(180deg, #F6CE5E, #D89A16);
  color: #4C060C;
  font-weight: 700;
  border-color: var(--gold-light);
  box-shadow: 0 0.5rem 1.4rem rgba(0, 0, 0, 0.38), inset 0 0.12rem 0 rgba(255, 255, 255, 0.45);
  letter-spacing: 0.06em;
}
.btn-primary:disabled {
  background: rgba(255, 246, 229, 0.1);
  color: rgba(255, 246, 229, 0.38);
  border-color: rgba(232, 178, 46, 0.22);
  box-shadow: none;
  cursor: not-allowed;
}

.btn-lg { font-size: clamp(1.1rem, 1.5vw, 2rem); padding: 0.72em 2.4em; }
.btn-ghost { background: rgba(0, 0, 0, 0.2); font-size: 0.92rem; }
.btn-back { min-width: 5.6em; }

/* 视图头部 */
.view-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex: 0 0 auto;
  padding-bottom: clamp(8px, 1.2vh, 26px);
}
.head-center { text-align: center; flex: 1; min-width: 0; }
.head-center h2 {
  font-family: "STKaiti", "KaiTi", "Kaiti SC", "Songti SC", "SimSun", serif;
  font-size: clamp(1.5rem, 2.6vw, 3.6rem);
  color: var(--gold-light);
  letter-spacing: 0.12em;
  text-shadow: 0 0 1.4rem rgba(232, 178, 46, 0.5), 0 0.2rem 0.6rem rgba(0, 0, 0, 0.5);
  line-height: 1.15;
}
.head-center p { font-size: 0.86rem; color: rgba(255, 246, 229, 0.72); margin-top: 0.4em; letter-spacing: 0.05em; }
.head-center b { color: var(--gold-light); font-size: 1.08em; }
.head-spacer { min-width: 5.6em; }

/* ---------------------------------------------------------- 开场页 */

#view-intro { align-items: center; justify-content: center; }

.intro-card {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: clamp(1.6rem, 4vh, 4.4rem) clamp(2rem, 5vw, 6rem);
  border-radius: calc(var(--radius) * 1.6);
  background: radial-gradient(120% 120% at 50% 0%, rgba(200, 16, 46, 0.55), rgba(58, 0, 8, 0.72));
  border: clamp(2px, 0.16vw, 4px) solid rgba(232, 178, 46, 0.45);
  box-shadow: 0 1.6rem 4rem rgba(0, 0, 0, 0.45), inset 0 0 4rem rgba(255, 233, 168, 0.06);
  max-width: min(92vw, 62rem);
}
.intro-kicker {
  font-size: 0.78rem;
  letter-spacing: 0.34em;
  color: var(--gold);
  margin-bottom: 0.9em;
  text-indent: 0.34em;
}
.intro-title {
  font-family: "STKaiti", "KaiTi", "Kaiti SC", "Songti SC", "SimSun", serif;
  font-size: clamp(3rem, 8.4vw, 11rem);
  line-height: 1;
  letter-spacing: 0.14em;
  text-indent: 0.14em;
  background: linear-gradient(180deg, #FFF3CF 8%, #F0C24A 46%, #B57F0F 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0.24rem 0.5rem rgba(0, 0, 0, 0.55));
}
.intro-sub {
  font-size: clamp(0.95rem, 1.5vw, 2rem);
  letter-spacing: 0.5em;
  text-indent: 0.5em;
  color: var(--gold-light);
  margin: 0.7em 0 1.1em;
  opacity: 0.92;
}
.intro-text {
  font-size: clamp(0.82rem, 1.02vw, 1.32rem);
  line-height: 2;
  color: rgba(255, 246, 229, 0.82);
  margin-bottom: 2em;
}

.mouse {
  position: absolute;
  width: clamp(84px, 11vw, 300px);
  z-index: 1;
  filter: drop-shadow(0 1rem 1.6rem rgba(0, 0, 0, 0.4));
  animation: mouseBob 3.6s ease-in-out infinite;
}
.mouse-groom { left: clamp(10px, 7vw, 200px); bottom: clamp(30px, 8vh, 140px); }
.mouse-bride { right: clamp(10px, 7vw, 200px); bottom: clamp(30px, 8vh, 140px); animation-delay: -1.8s; }
@keyframes mouseBob { 0%, 100% { transform: translateY(0) rotate(-1.5deg); } 50% { transform: translateY(-1.1rem) rotate(1.5deg); } }

/* ---------------------------------------------------------- 场景选择页 */

.scene-grid {
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: clamp(12px, 1.5vw, 40px);
  min-height: 0;
}

.scene-card {
  width: clamp(200px, 21vw, 560px);
  border-radius: var(--radius);
  overflow: hidden;
  background: linear-gradient(180deg, rgba(140, 15, 22, 0.85), rgba(58, 0, 8, 0.9));
  border: clamp(2px, 0.14vw, 4px) solid rgba(232, 178, 46, 0.5);
  box-shadow: 0 0.9rem 2rem rgba(0, 0, 0, 0.4);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.24s ease, border-color 0.24s ease;
  text-align: left;
  font-family: inherit;
  color: inherit;
  padding: 0;
}
.scene-card:active { transform: scale(0.97); }
.scene-card:hover { border-color: var(--gold-light); box-shadow: 0 1.2rem 2.6rem rgba(0, 0, 0, 0.5), 0 0 2rem rgba(232, 178, 46, 0.28); }

.scene-card img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: var(--red-dark);
}
.scene-card-body { padding: 0.85em 1.1em 1.05em; }
.scene-card-no {
  font-size: 0.68rem;
  letter-spacing: 0.28em;
  color: var(--gold);
  margin-bottom: 0.3em;
}
.scene-card-name {
  font-family: "STKaiti", "KaiTi", "Kaiti SC", "Songti SC", serif;
  font-size: clamp(1.05rem, 1.55vw, 2.2rem);
  color: var(--gold-light);
  letter-spacing: 0.1em;
  margin-bottom: 0.4em;
}
.scene-card-desc {
  font-size: 0.76rem;
  line-height: 1.75;
  color: rgba(255, 246, 229, 0.72);
  margin-bottom: 0.7em;
}
.scene-card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.7rem;
  color: rgba(255, 233, 168, 0.85);
  border-top: 1px solid rgba(232, 178, 46, 0.22);
  padding-top: 0.6em;
}

/* ---------------------------------------------------------- 乐器选择页：泡泡 */

.bubble-area {
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: clamp(8px, 1.3vw, 40px) clamp(6px, 0.9vw, 28px);
  min-height: 0;
  padding: clamp(4px, 1vh, 20px) 0;
}

.bubble-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.55em;
  width: var(--bd);
}

.bubble {
  position: relative;
  width: var(--bd);
  height: var(--bd);
  border-radius: 50%;
  padding: 0;
  cursor: pointer;
  background:
    radial-gradient(circle at 34% 26%, rgba(255, 233, 168, 0.34), rgba(200, 16, 46, 0.42) 46%, rgba(58, 0, 8, 0.8) 100%);
  border: clamp(2px, 0.16vw, 5px) solid rgba(232, 178, 46, 0.7);
  box-shadow:
    inset 0 0 clamp(10px, 0.9vw, 30px) rgba(255, 233, 168, 0.22),
    0 0.5rem 1.4rem rgba(0, 0, 0, 0.42);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.18s ease, box-shadow 0.22s ease, border-color 0.22s ease, opacity 0.22s ease, filter 0.22s ease;
  animation: floatXY var(--fdur, 9s) ease-in-out infinite;
  animation-delay: var(--fdelay, 0s);
}
.bubble::after {
  content: "";
  position: absolute;
  left: 18%;
  top: 12%;
  width: 30%;
  height: 22%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0) 72%);
  pointer-events: none;
}
.bubble img {
  width: 72%;
  height: 72%;
  object-fit: contain;
  pointer-events: none;
  filter: drop-shadow(0 0.3rem 0.6rem rgba(0, 0, 0, 0.42));
}
.bubble:active { transform: scale(0.93); }

.bubble.is-picked {
  border-color: var(--gold-light);
  box-shadow:
    inset 0 0 clamp(14px, 1.2vw, 40px) rgba(255, 233, 168, 0.45),
    0 0 clamp(14px, 1.3vw, 44px) rgba(232, 178, 46, 0.6);
  animation-play-state: paused;
}
.bubble.is-dim { opacity: 0.34; filter: grayscale(0.55); }

.bubble-check {
  position: absolute;
  right: 4%;
  bottom: 6%;
  width: 26%;
  height: 26%;
  border-radius: 50%;
  background: linear-gradient(180deg, #F6CE5E, #D89A16);
  color: #4C060C;
  font-weight: 900;
  font-size: 0.85rem;
  display: none;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0.2rem 0.6rem rgba(0, 0, 0, 0.45);
}
.bubble.is-picked .bubble-check { display: flex; }

.bubble-name {
  font-family: "STKaiti", "KaiTi", "Kaiti SC", "Songti SC", serif;
  font-size: clamp(0.82rem, 1.15vw, 1.7rem);
  color: var(--gold-light);
  letter-spacing: 0.14em;
  text-indent: 0.14em;
  text-shadow: 0 0.14rem 0.4rem rgba(0, 0, 0, 0.55);
}
.bubble-slot.is-dim .bubble-name { opacity: 0.4; }

@keyframes floatXY {
  0%   { transform: translate(0, 0); }
  25%  { transform: translate(var(--fx, 10px), calc(var(--fy, 14px) * -1)); }
  50%  { transform: translate(calc(var(--fx, 10px) * -0.7), var(--fy, 14px)); }
  75%  { transform: translate(calc(var(--fx, 10px) * -1), calc(var(--fy, 14px) * 0.4)); }
  100% { transform: translate(0, 0); }
}

/* ---------------------------------------------------------- 乐器选择页：底部收集栏 */

.pick-bar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(16px, 3vw, 80px);
  flex-wrap: wrap;
  padding: clamp(10px, 1.4vh, 26px) clamp(14px, 2vw, 48px);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(58, 0, 8, 0.72), rgba(58, 0, 8, 0.9));
  border: clamp(2px, 0.14vw, 4px) solid rgba(232, 178, 46, 0.42);
  box-shadow: 0 -0.4rem 1.6rem rgba(0, 0, 0, 0.35);
}

.slots { display: flex; align-items: center; gap: clamp(8px, 1vw, 26px); }
.slot-plus { font-size: 1.6rem; color: rgba(255, 233, 168, 0.6); font-weight: 700; }

.slot {
  width: var(--slot);
  height: var(--slot);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 0.15em;
  border: clamp(2px, 0.14vw, 4px) dashed rgba(232, 178, 46, 0.55);
  background: rgba(0, 0, 0, 0.24);
  color: rgba(255, 233, 168, 0.55);
  font-size: 0.72rem;
  transition: border-color 0.24s, box-shadow 0.24s, background 0.24s;
  overflow: hidden;
  position: relative;
}
.slot.is-filled {
  border-style: solid;
  border-color: var(--gold);
  background: radial-gradient(circle at 36% 28%, rgba(255, 233, 168, 0.3), rgba(140, 15, 22, 0.7));
  box-shadow: 0 0 clamp(10px, 0.9vw, 30px) rgba(232, 178, 46, 0.4);
}
.slot img { width: 72%; height: 72%; object-fit: contain; }
.slot-name {
  position: absolute;
  bottom: 6%;
  font-size: 0.62rem;
  color: var(--gold-light);
  text-shadow: 0 0.1rem 0.3rem rgba(0, 0, 0, 0.8);
  letter-spacing: 0.06em;
}

.pick-info { display: flex; flex-direction: column; align-items: center; gap: 0.6em; }
.base-note {
  font-size: 0.72rem;
  color: rgba(255, 246, 229, 0.62);
  letter-spacing: 0.04em;
}
.base-note b { color: var(--gold-light); }
.btn-generate { font-size: clamp(1rem, 1.28vw, 1.8rem); padding: 0.62em 2.2em; }
.btn-generate:not(:disabled) { animation: pulseGlow 2.1s ease-in-out infinite; }
@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 0.5rem 1.4rem rgba(0, 0, 0, 0.38), 0 0 0 rgba(232, 178, 46, 0); }
  50% { box-shadow: 0 0.5rem 1.4rem rgba(0, 0, 0, 0.38), 0 0 2rem rgba(255, 233, 168, 0.65); }
}

/* ---------------------------------------------------------- 播放页 */

.player-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(10px, 1.6vh, 30px);
  min-height: 0;
}

.player-insts {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(20px, 4vw, 110px);
  flex-wrap: wrap;
}

.player-inst {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5em;
  width: clamp(120px, 12vw, 320px);
}
.player-inst-img {
  width: clamp(96px, 9.4vw, 250px);
  aspect-ratio: 1;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 34% 26%, rgba(255, 233, 168, 0.3), rgba(140, 15, 22, 0.66));
  border: clamp(2px, 0.16vw, 5px) solid rgba(232, 178, 46, 0.75);
  box-shadow: 0 0 clamp(12px, 1vw, 34px) rgba(232, 178, 46, 0.32);
}
.player-inst-img img { width: 74%; height: 74%; object-fit: contain; }
.player-inst-name {
  font-family: "STKaiti", "KaiTi", "Kaiti SC", "Songti SC", serif;
  font-size: clamp(1rem, 1.4vw, 2rem);
  color: var(--gold-light);
  letter-spacing: 0.16em;
  text-indent: 0.16em;
}
.player-inst-intro {
  font-size: 0.7rem;
  line-height: 1.7;
  color: rgba(255, 246, 229, 0.6);
  text-align: center;
  max-width: 20em;
}
.player-inst-badge {
  font-size: 0.62rem;
  color: rgba(255, 233, 168, 0.75);
  letter-spacing: 0.1em;
}

.player-card {
  width: min(92vw, 52rem);
  padding: clamp(12px, 1.6vh, 30px) clamp(16px, 2.4vw, 52px) clamp(14px, 1.8vh, 34px);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(58, 0, 8, 0.72), rgba(58, 0, 8, 0.92));
  border: clamp(2px, 0.14vw, 4px) solid rgba(232, 178, 46, 0.42);
  box-shadow: 0 1rem 2.4rem rgba(0, 0, 0, 0.42);
}

.progress {
  position: relative;
  height: clamp(8px, 0.72vw, 20px);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.42);
  overflow: hidden;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(232, 178, 46, 0.28);
}
.progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, #A87A16, #FFE9A8);
  box-shadow: 0 0 1rem rgba(255, 233, 168, 0.6);
  transition: width 0.12s linear;
}

.time-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.76rem;
  color: rgba(255, 233, 168, 0.82);
  margin: 0.55em 0 0.2em;
  font-variant-numeric: tabular-nums;
}

.controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(14px, 2vw, 46px);
  margin-top: clamp(6px, 0.8vh, 16px);
}

.btn-round, .btn-play {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  padding: 0;
  border: clamp(2px, 0.12vw, 3px) solid rgba(232, 178, 46, 0.6);
  background: rgba(0, 0, 0, 0.26);
}
.btn-round { width: clamp(46px, 3.6vw, 96px); height: clamp(46px, 3.6vw, 96px); }
.btn-round svg { width: 52%; height: 52%; fill: var(--gold-light); }

.btn-play {
  width: clamp(66px, 5.6vw, 150px);
  height: clamp(66px, 5.6vw, 150px);
  background: linear-gradient(180deg, #F6CE5E, #D89A16);
  border-color: var(--gold-light);
  box-shadow: 0 0.6rem 1.6rem rgba(0, 0, 0, 0.42), 0 0 2rem rgba(255, 233, 168, 0.32);
}
.btn-play svg { width: 48%; height: 48%; fill: #4C060C; }
.btn-play .ico-pause { display: none; }
.btn-play.is-playing .ico-play { display: none; }
.btn-play.is-playing .ico-pause { display: block; }

.btn-round.is-muted svg { opacity: 0.32; }

.volume { width: clamp(90px, 10vw, 300px); display: flex; align-items: center; }
.volume input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: clamp(8px, 0.66vw, 18px);
  border-radius: 999px;
  background: linear-gradient(90deg, #FFE9A8 var(--vol, 90%), rgba(0, 0, 0, 0.42) var(--vol, 90%));
  outline: none;
  cursor: pointer;
}
.volume input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: clamp(20px, 1.7vw, 44px);
  height: clamp(20px, 1.7vw, 44px);
  border-radius: 50%;
  background: linear-gradient(180deg, #FFF3CF, #D89A16);
  border: 2px solid #8C0F16;
  box-shadow: 0 0.2rem 0.6rem rgba(0, 0, 0, 0.45);
}
.volume input[type="range"]::-moz-range-thumb {
  width: clamp(20px, 1.7vw, 44px);
  height: clamp(20px, 1.7vw, 44px);
  border-radius: 50%;
  background: linear-gradient(180deg, #FFF3CF, #D89A16);
  border: 2px solid #8C0F16;
}

/* ---------------------------------------------------------- AI 生成动画 */

.gen-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(110% 90% at 50% 45%, rgba(58, 0, 8, 0.86), rgba(20, 0, 3, 0.96));
  backdrop-filter: blur(3px);
  animation: overlayIn 0.28s ease-out;
}
@keyframes overlayIn { from { opacity: 0; } to { opacity: 1; } }
.gen-overlay.is-out { animation: overlayOut 0.34s ease-in forwards; }
@keyframes overlayOut { to { opacity: 0; transform: scale(1.04); } }

.gen-stage { display: flex; flex-direction: column; align-items: center; gap: clamp(12px, 2.2vh, 40px); }

.gen-orbit {
  position: relative;
  width: min(46vh, 30vw);
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4%;
  animation: genIn 0.5s ease-out both;
}
@keyframes genIn { from { transform: scale(0.72); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.gen-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px dashed rgba(255, 233, 168, 0.45);
  animation: spin 6s linear infinite;
}
.gen-ring-2 {
  inset: 13%;
  border-style: solid;
  border-color: rgba(232, 178, 46, 0.3);
  animation-duration: 4s;
  animation-direction: reverse;
}
@keyframes spin { to { transform: rotate(360deg); } }

.gen-core {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 30%;
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 233, 168, 0.92), rgba(232, 178, 46, 0.18) 58%, rgba(232, 178, 46, 0) 74%);
  animation: corePulse 1.5s ease-in-out infinite;
}
@keyframes corePulse {
  0%, 100% { transform: translate(-50%, -50%) scale(0.82); opacity: 0.75; }
  50% { transform: translate(-50%, -50%) scale(1.18); opacity: 1; }
}

.gen-inst {
  position: relative;
  z-index: 2;
  width: 34%;
  height: 34%;
  object-fit: contain;
  filter: drop-shadow(0 0 1rem rgba(255, 233, 168, 0.6));
  animation: instBob 1.5s ease-in-out infinite;
}
.gen-inst-b { animation-delay: -0.75s; }
@keyframes instBob { 0%, 100% { transform: translateY(-5%); } 50% { transform: translateY(5%); } }

.gen-spark {
  position: absolute;
  width: 3.2%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--gold-light);
  box-shadow: 0 0 0.8rem rgba(255, 233, 168, 0.9);
  animation: spark 2.2s ease-in-out infinite;
}
.gen-spark.s1 { left: 50%; top: -2%; animation-delay: 0s; }
.gen-spark.s2 { right: -2%; top: 50%; animation-delay: -0.55s; }
.gen-spark.s3 { left: 50%; bottom: -2%; animation-delay: -1.1s; }
.gen-spark.s4 { left: -2%; top: 50%; animation-delay: -1.65s; }
@keyframes spark {
  0%, 100% { opacity: 0.25; transform: scale(0.7); }
  50% { opacity: 1; transform: scale(1.4); }
}

.gen-title {
  font-family: "STKaiti", "KaiTi", "Kaiti SC", "Songti SC", serif;
  font-size: clamp(1.2rem, 2vw, 3rem);
  color: var(--gold-light);
  letter-spacing: 0.14em;
  text-shadow: 0 0 1.4rem rgba(232, 178, 46, 0.55);
}
.gen-sub { font-size: 0.82rem; color: rgba(255, 246, 229, 0.7); letter-spacing: 0.08em; margin-top: -0.4em; }

.gen-bar {
  width: min(46vh, 32vw);
  height: clamp(6px, 0.5vw, 14px);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.45);
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(232, 178, 46, 0.3);
}
.gen-bar-fill {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, #A87A16, #FFE9A8);
  box-shadow: 0 0 1rem rgba(255, 233, 168, 0.7);
  animation: genBar 3s linear forwards;
}
@keyframes genBar { to { width: 100%; } }

/* ---------------------------------------------------------- 小屏兜底 */

@media (max-width: 900px) {
  .mouse { display: none; }
  .lantern { width: clamp(40px, 8vw, 70px); }
  .scene-card { width: min(46vw, 260px); }
  .bubble-area { gap: 0.5rem; }
  :root { --bd: clamp(88px, 26vw, 140px); }
}
