/* TuneHub — 深色、克制、一个强调色。 */
:root {
  --bg: #0b0c11;
  --panel: #12141c;
  --panel-2: #171a24;
  --line: rgba(255, 255, 255, 0.07);
  --text: #eef0f6;
  --dim: rgba(255, 255, 255, 0.42);
  --dimmer: rgba(255, 255, 255, 0.22);
  --accent: #ffd166;
  --accent-dim: rgba(255, 209, 102, 0.16);
  --bass: #6b7fd7;
  --harmony: #4ecdc4;
  --melody: #ffd166;
  --perc: #ff6b6b;
  --radius: 12px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0; min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
               "Microsoft YaHei", "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

#app {
  max-width: 880px;
  margin: 0 auto;
  padding: 22px 18px 34px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ---------- 头部 ---------- */
header { text-align: center; }

.brand { display: flex; align-items: baseline; justify-content: center; gap: 8px; }

.brand h1 {
  margin: 0;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 0.5px;
  background: linear-gradient(100deg, #fff 20%, var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand .zh {
  font-size: 13px;
  color: var(--dimmer);
  letter-spacing: 3px;
}

button.locale {
  margin-left: 6px;
  padding: 4px 8px;
  border-radius: 7px;
  color: var(--dim);
  font-size: 11px;
  line-height: 1;
}

.tagline {
  margin: 6px 0 0;
  font-size: 12.5px;
  color: var(--dim);
  letter-spacing: 0.5px;
}
.product-link {
  display: inline-block;
  margin-top: 9px;
  color: #a4e0c2;
  font-size: 11px;
  text-decoration: none;
}
.product-link:hover { color: #e8c998; }

/* ---------- 氛围场景 ---------- */
.ambient-picker {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
}
.eyebrow {
  margin: 0 0 3px;
  color: var(--accent);
  font-size: 10px;
  letter-spacing: 1.7px;
  text-transform: uppercase;
}
.section-heading h2 {
  margin: 0;
  font-size: 17px;
  letter-spacing: 0.2px;
}
.scene-status {
  max-width: 330px;
  margin: 0;
  color: var(--dim);
  font-size: 11.5px;
  line-height: 1.45;
  text-align: right;
}
.scenes {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}
.scene {
  min-width: 0;
  min-height: 64px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px;
  border-radius: 10px;
  background: var(--panel);
  color: var(--dim);
  text-align: left;
}
.scene:hover { color: var(--text); border-color: rgba(255, 255, 255, 0.2); }
.scene.active {
  border-color: var(--accent);
  background: linear-gradient(135deg, var(--accent-dim), rgba(255, 209, 102, 0.04));
  color: var(--text);
}
.scene-icon { font-size: 20px; line-height: 1; }
.scene-copy { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.scene-copy b { font-size: 12px; font-weight: 650; }
.scene-copy small { overflow: hidden; color: var(--dimmer); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- 舞台 ---------- */
.stage {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  height: clamp(200px, 34vh, 300px);
}

#viz { display: block; width: 100%; height: 100%; }

.hud {
  position: absolute;
  left: 12px; right: 12px; bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--dimmer);
  font-variant-numeric: tabular-nums;
  pointer-events: none;
  letter-spacing: 0.4px;
}
.hud .sep { opacity: 0.5; }

/* ---------- 控件 ---------- */
.controls {
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}

.knobs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }

.knob { display: flex; flex-direction: column; gap: 7px; }

.kname {
  font-size: 12px;
  color: var(--dim);
  letter-spacing: 2px;
  text-align: center;
}

.kends {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--dimmer);
}
.kends b { font-weight: 500; }

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.1);
  outline: none;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 17px; height: 17px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  cursor: grab;
  box-shadow: 0 0 0 4px var(--accent-dim);
  transition: transform 0.12s ease;
}
input[type="range"]::-webkit-slider-thumb:active { cursor: grabbing; transform: scale(1.12); }
input[type="range"]::-moz-range-thumb {
  width: 15px; height: 15px; border: none; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 0 4px var(--accent-dim);
}

.actions { display: flex; gap: 8px; flex-wrap: wrap; }

button {
  font-family: inherit;
  font-size: 13.5px;
  padding: 10px 18px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  cursor: pointer;
  transition: all 0.16s ease;
  white-space: nowrap;
}
button:hover { border-color: rgba(255, 255, 255, 0.2); background: #1d2130; }
button:active { transform: translateY(1px); }

button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #10121a;
  font-weight: 650;
  flex: 0 0 auto;
  min-width: 108px;
}
button.primary:hover { filter: brightness(1.07); background: var(--accent); }

button.endless { color: var(--dim); }
button.endless.active {
  border-color: var(--harmony);
  background: rgba(78, 205, 196, 0.12);
  color: var(--harmony);
}

button:disabled { opacity: 0.45; cursor: progress; }

/* ---------- 声部 ---------- */
.voices { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.voices > .voice { min-width: 0; }

.voice {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 9px 4px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  cursor: pointer;
  user-select: none;
  transition: all 0.16s ease;
}
.voice:hover { border-color: rgba(255, 255, 255, 0.18); }
.voice.muted { opacity: 0.34; }

.voice .vname { font-size: 11px; letter-spacing: 1.5px; color: var(--dim); }
.voice .vdot { width: 7px; height: 7px; border-radius: 50%; background: var(--vc, #fff); }
.voice .vlock {
  font-size: 9px;
  letter-spacing: 0;
  color: var(--dimmer);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  padding: 0 2px;
}
.voice.locked .vlock { color: var(--accent); }
.voice.muted .vname { text-decoration: line-through; }

/* ---------- 底部 ---------- */
footer { display: flex; flex-direction: column; gap: 9px; }

footer .row { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }

button.ghost {
  background: transparent;
  font-size: 12.5px;
  padding: 8px 14px;
  color: var(--dim);
}
button.ghost:hover { color: var(--text); }

.hint {
  margin: 2px 0 0;
  text-align: center;
  font-size: 11.5px;
  line-height: 1.75;
  color: var(--dimmer);
}
.hint.warn { color: #ffb4a2; }
.hint.good { color: var(--harmony); }

@media (max-width: 560px) {
  .knobs { gap: 10px; }
  .kname { letter-spacing: 1px; }
  button { padding: 9px 14px; font-size: 13px; }
  button.primary { min-width: 92px; }
  .voices { grid-template-columns: repeat(2, 1fr); }
  .scenes { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .section-heading { align-items: start; flex-direction: column; gap: 4px; }
  .scene-status { max-width: none; text-align: left; }
  .brand h1 { font-size: 22px; }
}
