/* Sprunky · 小镇音乐台 */

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

.sound-btn {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  font-size: 18px;
  border: 3px solid var(--ink);
  border-radius: 50%;
  background: var(--card);
  cursor: pointer;
  box-shadow: 0 4px 0 var(--ink);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.sound-btn:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 var(--ink);
}

.music-main {
  max-width: 1180px;
  margin: 0 auto;
  padding: 12px 24px 20px;
}

.music-head h1 {
  margin: 0 0 10px;
  font-size: clamp(34px, 4.6vw, 52px);
  font-weight: 900;
  letter-spacing: -0.5px;
}

.music-sub {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  line-height: 1.7;
  color: var(--ink-soft);
}

/* ---------- 舞台 ---------- */
.stage {
  position: relative;
  margin-top: 22px;
  padding: 30px 26px 20px;
  border: 4px solid var(--ink);
  border-radius: 40px;
  background: radial-gradient(circle at 50% 0%, #4b3d78 0%, #2e2547 62%, #251d3a 100%);
  box-shadow: 0 14px 0 rgba(46, 37, 71, 0.16);
  overflow: hidden;
}

.stage-lights {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 18% 6%, rgba(255, 212, 59, 0.32), transparent 38%),
    radial-gradient(circle at 50% 0%, rgba(255, 140, 200, 0.24), transparent 44%),
    radial-gradient(circle at 84% 10%, rgba(77, 171, 247, 0.3), transparent 40%);
  pointer-events: none;
}

.stage.is-playing .stage-lights {
  animation: lights-pulse calc(var(--beat, 0.625s) * 2) ease-in-out infinite;
}

@keyframes lights-pulse {
  50% {
    opacity: 0.55;
  }
}

.slots {
  position: relative;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
  align-items: end;
}

.slot {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  height: 266px;
  padding: 16px 10px 14px;
  border: 3px dashed rgba(255, 255, 255, 0.34);
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
  -webkit-tap-highlight-color: transparent;
}

.slot:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.55);
}

.slot.is-filled {
  border-style: solid;
  border-color: rgba(255, 255, 255, 0.22);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.04));
}

.slot-char {
  display: block;
  width: 100%;
  text-align: center;
}

.slot-char .char-img {
  height: 158px;
  width: auto;
  margin: 0 auto;
  filter: drop-shadow(0 8px 12px rgba(0, 0, 0, 0.35));
}

.stage.is-playing .slot.is-filled .char-img {
  animation: groove var(--beat, 0.625s) ease-in-out infinite;
  animation-delay: calc(var(--i, 0) * 0.06s);
}

@keyframes groove {
  0%,
  100% {
    transform: translateY(0) rotate(0);
  }
  50% {
    transform: translateY(-13px) rotate(-2deg);
  }
}

.slot-name {
  display: block;
  max-width: 100%;
  font-size: 14px;
  font-weight: 900;
  line-height: 1.2;
  text-align: center;
  overflow-wrap: anywhere;
}

.slot-name em {
  display: block;
  font-style: normal;
  font-size: 11px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.66);
  margin-top: 3px;
}

.slot-remove {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 900;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.82);
  border: 2px solid var(--ink);
  border-radius: 50%;
}

.slot-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: rgba(255, 255, 255, 0.6);
}

.slot-plus {
  width: 62px;
  height: 62px;
  display: grid;
  place-items: center;
  font-size: 34px;
  font-weight: 900;
  border: 3px dashed rgba(255, 255, 255, 0.45);
  border-radius: 50%;
}

.slot-hint {
  font-size: 12px;
  font-weight: 800;
}

.slot--empty:hover .slot-plus {
  border-color: var(--yellow);
  color: var(--yellow);
}

.beat-row {
  position: relative;
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 18px;
}

.beat-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  transition: background 0.1s ease, transform 0.1s ease;
}

.beat-dot.is-on {
  background: var(--yellow);
  transform: scale(1.45);
  box-shadow: 0 0 14px rgba(255, 212, 59, 0.8);
}

/* ---------- 播放控制 ---------- */
.transport {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin: 24px 0 4px;
}

.play-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 210px;
  padding: 20px 38px;
  font-family: inherit;
  font-size: 24px;
  font-weight: 900;
  color: #fff;
  background: var(--orange);
  border: 3px solid var(--ink);
  border-radius: 999px;
  box-shadow: 0 7px 0 var(--ink);
  text-shadow: 0 2px 0 rgba(46, 37, 71, 0.22);
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
  -webkit-tap-highlight-color: transparent;
}

.play-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 9px 0 var(--ink);
}

.play-btn:active {
  transform: translateY(5px);
  box-shadow: 0 2px 0 var(--ink);
}

.play-btn.is-playing {
  background: var(--red);
}

.tempo {
  display: inline-flex;
  padding: 5px;
  gap: 4px;
  background: var(--card);
  border: 3px solid var(--ink);
  border-radius: 999px;
  box-shadow: 0 5px 0 rgba(46, 37, 71, 0.18);
}

.tempo-chip {
  padding: 9px 18px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 900;
  color: var(--ink-soft);
  background: transparent;
  border: none;
  border-radius: 999px;
  cursor: pointer;
}

.tempo-chip.is-active {
  color: var(--ink);
  background: var(--yellow);
}

.clear-btn {
  font-size: 15px;
  padding: 13px 22px;
  box-shadow: 0 4px 0 rgba(46, 37, 71, 0.35);
}

/* ---------- 角色台 ---------- */
.dock {
  margin-top: 34px;
  padding: 22px 24px 24px;
  background: var(--card);
  border: 3px solid var(--ink);
  border-radius: 32px;
  box-shadow: var(--shadow-soft);
}

.dock-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.dock-head h2 {
  margin: 0;
  font-size: 24px;
  font-weight: 900;
}

.dock-head p {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-soft);
}

.dock-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.dock-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 12px 6px 10px;
  font-family: inherit;
  color: var(--ink);
  background: var(--cream);
  border: 3px solid rgba(46, 37, 71, 0.14);
  border-radius: 20px;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.dock-card:hover {
  transform: translateY(-4px);
  border-color: rgba(46, 37, 71, 0.45);
}

.dock-card.is-on {
  background: #fff6d6;
  border-color: var(--ink);
}

.dock-card .char-img {
  height: 78px;
  width: auto;
  margin: 0 auto;
}

.dock-name {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  font-size: 12px;
  font-weight: 900;
  line-height: 1.15;
  text-align: center;
  overflow-wrap: anywhere;
}

.dock-role {
  font-size: 10px;
  font-weight: 800;
  color: var(--ink-soft);
}

.dock-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  padding: 1px 7px;
  font-size: 9px;
  font-weight: 900;
  color: var(--ink);
  background: var(--yellow);
  border: 2px solid var(--ink);
  border-radius: 999px;
}

@media (max-width: 900px) {
  .dock-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  .slot {
    height: 230px;
  }

  .slot-char .char-img {
    height: 132px;
  }
}

@media (max-width: 640px) {
  .music-main {
    padding: 8px 16px 16px;
  }

  .stage {
    padding: 20px 16px 16px;
    border-radius: 30px;
  }

  .slots {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .slot {
    height: 196px;
    border-radius: 22px;
  }

  .slot-char .char-img {
    height: 112px;
  }

  .transport {
    gap: 10px;
  }

  .play-btn {
    width: 100%;
    font-size: 21px;
    padding: 17px 28px;
  }

  .dock {
    padding: 18px 16px;
  }

  .dock-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
  }

  .dock-card .char-img {
    height: 54px;
  }

  .dock-name {
    min-height: 24px;
    font-size: 11px;
  }
}

/* ---------- 细节增强 ---------- */
.viz {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0.5;
  pointer-events: none;
}

.stage-foot {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  margin-top: 16px;
}

.beat-row {
  margin-top: 0;
}

.step-strip {
  display: flex;
  gap: 5px;
}

.step-strip span {
  width: 9px;
  height: 9px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.16);
  transition: background 0.06s linear, transform 0.06s linear;
}

.step-strip span.is-bar {
  background: rgba(255, 255, 255, 0.38);
}

.step-strip span.is-on {
  background: var(--yellow);
  transform: scale(1.25);
  box-shadow: 0 0 10px rgba(255, 212, 59, 0.9);
}

.bar-count {
  min-height: 16px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 1px;
  color: rgba(255, 255, 255, 0.62);
}

.slot {
  cursor: pointer;
}

.slot-ctrl {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  margin-top: 4px;
}

.slot-mute {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  padding: 0;
  font-size: 11px;
  line-height: 1;
  color: #fff;
  background: rgba(255, 255, 255, 0.16);
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-radius: 50%;
  cursor: pointer;
}

.slot-mute:hover {
  background: rgba(255, 255, 255, 0.28);
}

.slot-vol {
  width: 64px;
  height: 16px;
  accent-color: var(--yellow);
  cursor: pointer;
}

.slot.is-muted .char-img {
  opacity: 0.38;
  filter: grayscale(0.65);
}

.slot.is-muted .slot-name {
  opacity: 0.55;
}

.tool-btn {
  padding: 12px 20px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 900;
  color: var(--ink);
  background: var(--card);
  border: 3px solid var(--ink);
  border-radius: 999px;
  box-shadow: 0 4px 0 rgba(46, 37, 71, 0.22);
  cursor: pointer;
  transition: background 0.14s ease, transform 0.12s ease, box-shadow 0.12s ease;
}

.tool-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 0 rgba(46, 37, 71, 0.22);
}

.tool-btn:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 rgba(46, 37, 71, 0.22);
}

.tool-btn.is-active {
  background: var(--yellow);
  box-shadow: 0 4px 0 var(--ink);
}

.presets {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 16px;
}

.presets-label {
  font-size: 13px;
  font-weight: 800;
  color: var(--ink-soft);
}

.preset-chip {
  padding: 8px 16px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 900;
  color: var(--ink);
  background: var(--card);
  border: 3px solid rgba(46, 37, 71, 0.16);
  border-radius: 999px;
  cursor: pointer;
  transition: border-color 0.14s ease, transform 0.14s ease;
}

.preset-chip:hover {
  border-color: var(--ink);
  transform: translateY(-2px);
}

@media (max-width: 900px) {
  .slots {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .slot {
    height: 262px;
  }
}

@media (max-width: 640px) {
  .slot {
    height: 200px;
  }

  .slot-vol {
    width: 48px;
  }

  .step-strip span {
    width: 7px;
    height: 7px;
  }

  .tool-btn {
    padding: 10px 16px;
    font-size: 13px;
  }
}
