/* ============================================================
   EmotionChord · 情感和弦简谱播放器
   设计系统：深邃午夜底 + 流动光斑 + 金/品红/紫渐变强调
   ============================================================ */

:root {
  /* 背景与表面 */
  --bg-base: #08090f;
  --panel: rgba(20, 23, 38, 0.72);
  --surface: rgba(255, 255, 255, 0.045);
  --surface-2: rgba(255, 255, 255, 0.08);

  /* 描边 */
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.16);
  --border-gold: rgba(255, 203, 107, 0.32);

  /* 文字 */
  --text: #f5f2ea;
  --text-muted: #aab2c8;
  --text-dim: #6e7693;

  /* 强调色 */
  --gold: #ffcb6b;
  --gold-bright: #ffd98f;
  --magenta: #ff6b9d;
  --violet: #a78bfa;
  --cyan: #5eead4;
  --rose: #fb7185;
  --indigo: #6c8cff;

  /* 渐变 */
  --grad-warm: linear-gradient(135deg, #ffcb6b 0%, #ff6b9d 100%);
  --grad-text: linear-gradient(120deg, #ffcb6b 0%, #ff6b9d 55%, #a78bfa 100%);

  /* 圆角 */
  --radius-xl: 30px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 11px;

  /* 阴影 */
  --shadow-card: 0 24px 60px rgba(0, 0, 0, 0.45), 0 2px 8px rgba(0, 0, 0, 0.25);

  /* 字体 */
  --font-sans: "Segoe UI", "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  --font-mono: "SF Mono", "JetBrains Mono", "Cascadia Code", Consolas, monospace;

  /* range 进度（由 JS 写入） */
  --arp-progress: 30%;
}

/* ========== 基础重置 ========== */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-sans);
  color: var(--text);
  background: var(--bg-base);
  overflow-x: hidden;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* 固定渐变底 */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(900px 600px at 12% -10%, rgba(255, 203, 107, 0.14), transparent 60%),
    radial-gradient(900px 700px at 110% 10%, rgba(167, 139, 250, 0.16), transparent 55%),
    radial-gradient(800px 700px at 50% 120%, rgba(255, 107, 157, 0.1), transparent 60%),
    linear-gradient(180deg, #0a0c16 0%, #08090f 100%);
}

/* 流动光斑 */
.bg-orbs {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  overflow: hidden;
}
.bg-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.45;
  animation: orb-float 24s ease-in-out infinite;
}
.bg-orb--gold {
  width: 420px; height: 420px;
  top: -80px; left: -60px;
  background: radial-gradient(circle, rgba(255, 203, 107, 0.55), transparent 70%);
}
.bg-orb--magenta {
  width: 480px; height: 480px;
  top: 28%; right: -120px;
  background: radial-gradient(circle, rgba(255, 107, 157, 0.4), transparent 70%);
  animation-delay: -8s;
}
.bg-orb--violet {
  width: 520px; height: 520px;
  bottom: -160px; left: 28%;
  background: radial-gradient(circle, rgba(167, 139, 250, 0.38), transparent 70%);
  animation-delay: -16s;
}
@keyframes orb-float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(40px, -30px) scale(1.08); }
  66% { transform: translate(-30px, 40px) scale(0.95); }
}

/* ========== 顶部栏 ========== */
.topbar {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 14px 4px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand { display: flex; align-items: center; gap: 14px; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 44px; height: 44px;
  border-radius: 14px;
  color: #1a1408;
  background: var(--grad-warm);
  box-shadow: 0 8px 24px rgba(255, 107, 157, 0.35);
}
.brand-text { display: grid; line-height: 1.2; }
.brand-name { font-weight: 800; font-size: 1.06rem; letter-spacing: 0.02em; }
.brand-sub { font-size: 0.78rem; color: var(--text-dim); }
.brand-tag {
  padding: 8px 14px;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  font-family: var(--font-mono);
}

/* ========== 主容器 ========== */
.app {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 8px 0 40px;
}

h1, h2, p { margin-top: 0; }

/* ========== Hero ========== */
.hero {
  position: relative;
  padding: 28px 32px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xl);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.03));
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  overflow: hidden;
}
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(600px 300px at 90% -20%, rgba(255, 203, 107, 0.18), transparent 70%);
  pointer-events: none;
}

.eyebrow {
  margin: 0 0 14px;
  color: var(--gold);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

h1 {
  position: relative;
  z-index: 1;
  margin-bottom: 18px;
  font-size: clamp(2.1rem, 5.4vw, 4.2rem);
  font-weight: 900;
  line-height: 1.05;
  letter-spacing: -0.01em;
}
.grad-text {
  background: var(--grad-text);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.description {
  position: relative;
  z-index: 1;
  max-width: 640px;
  margin-bottom: 0;
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1.6;
}

.hero-steps {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
}
.hero-steps li {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 7px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-muted);
  font-size: 0.86rem;
  font-weight: 600;
}
.hero-steps li span {
  color: #1a1408;
  font-weight: 800;
  font-family: var(--font-mono);
  background: var(--grad-warm);
  border-radius: 6px;
  padding: 1px 7px;
  font-size: 0.74rem;
}

/* 根音 / 调性 + 节奏：横向并排置于 hero 步骤说明之下作为全局首选控件 */
.hero-key {
  position: relative;
  z-index: 1;
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  max-width: 580px;
}
.hero-key .control { max-width: none; }

/* ========== 按钮 ========== */
button {
  font: inherit;
  padding: 11px 18px;
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--surface-2);
  cursor: pointer;
  font-weight: 700;
  transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}
button:hover { transform: translateY(-2px); background: rgba(255, 255, 255, 0.13); }
button:active { transform: translateY(0); }
button:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

.primary-button {
  color: #1a1408;
  border: 0;
  background: var(--grad-warm);
  font-weight: 900;
  box-shadow: 0 10px 28px rgba(255, 107, 157, 0.32);
}
.primary-button:hover {
  background: linear-gradient(135deg, var(--gold-bright), #ff80ad);
  box-shadow: 0 14px 36px rgba(255, 107, 157, 0.42);
}

.ghost-button {
  background: var(--surface);
  border-color: var(--border);
}

.secondary-button {
  color: var(--rose);
  background: rgba(251, 113, 133, 0.08);
  border-color: rgba(251, 113, 133, 0.3);
}
.secondary-button:hover { background: rgba(251, 113, 133, 0.16); }

/* ========== 通用 panel ========== */
.panel {
  margin-top: 14px;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--panel);
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.card-head h2,
.card-head h3 {
  margin: 0;
  font-size: 1.18rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}

/* 步骤徽章：标明区块在操作流程中的顺序 */
.step-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.85em;
  height: 1.85em;
  margin-right: 10px;
  padding: 0 0.35em;
  font-size: 0.72rem;
  font-weight: 800;
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
  color: #1a1408;
  background: var(--grad-warm);
  border-radius: 8px;
  vertical-align: middle;
}
.card-tag {
  padding: 5px 12px;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  font-family: var(--font-mono);
  white-space: nowrap;
}

/* ========== 控件区 ========== */
.controls-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  align-items: flex-start;
}
.control { display: grid; gap: 10px; flex: 1 1 200px; min-width: 160px; }
/* 琶音时长：横向更宽，给滑块足够空间 */
.control--range { flex: 2 1 280px; }
/* 卡片内嵌的控件行（当前和弦内的手动和弦类型 + 琶音时长 等） */
.card-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 14px;
}
/* 单控件不撑满整行（根音、情感词） */
.control--single { max-width: 360px; }
/* 情感进行卡片内嵌的「每音时长」滑块 */
.inline-range {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}
.control-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--text-muted);
  font-weight: 700;
  font-size: 0.82rem;
  letter-spacing: 0.04em;
}
.control-label em {
  font-style: normal;
  color: var(--gold);
  font-weight: 800;
  font-family: var(--font-mono);
}

select, input[type="range"] { width: 100%; font: inherit; }

select {
  appearance: none;
  -webkit-appearance: none;
  padding: 11px 38px 11px 12px;
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  outline: none;
  background-color: rgba(10, 12, 22, 0.6);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23aab2c8' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat;
  background-position: right 14px center;
  cursor: pointer;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
select:hover { border-color: var(--border-gold); }
select:focus-visible { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(255, 203, 107, 0.18); }
select option { background: #1a1d2c; color: var(--text); }

/* range 自定义 */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  height: 8px;
  border-radius: 999px;
  background:
    linear-gradient(90deg, var(--gold) 0%, var(--magenta) var(--arp-progress), rgba(255, 255, 255, 0.1) var(--arp-progress));
  outline: none;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--gold);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  transition: transform 0.15s ease;
}
input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.15); }
input[type="range"]::-moz-range-thumb {
  width: 20px; height: 20px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--gold);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

/* ========== 网格区 ========== */
.grid {
  display: grid;
  grid-template-columns: 0.85fr 1.15fr;
  gap: 14px;
  margin-top: 14px;
}
.grid > .panel { margin-top: 0; }

/* 当前和弦卡片 */
.output-card {
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(420px 220px at 100% 0%, rgba(255, 203, 107, 0.12), transparent 70%),
    var(--panel);
}
.chord-name {
  margin: 4px 0 18px;
  font-size: clamp(3.2rem, 9vw, 6.5rem);
  font-weight: 900;
  line-height: 1;
  letter-spacing: -0.02em;
  background: var(--grad-text);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.jianpu {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 16px 18px;
  align-self: flex-start;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
}

.jianpu-note {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.7em;
  padding: 0.3em 0.5em;
  border-radius: 0.5em;
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  font-size: clamp(1.2rem, 3.5vw, 1.8rem);
  font-weight: 800;
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
  transition: transform 0.18s ease, background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.jianpu-note.is-active {
  color: #1a1408;
  background: var(--grad-warm);
  border-color: transparent;
  box-shadow: 0 0 0 4px rgba(255, 203, 107, 0.22), 0 8px 20px rgba(255, 107, 157, 0.35);
  transform: translateY(-3px) scale(1.1);
}

.note-names {
  margin: 18px 0 0;
  color: var(--text-muted);
  font-size: 1rem;
  letter-spacing: 0.14em;
  font-family: var(--font-mono);
}

/* 情感进行卡片 */
.progression-card { display: flex; flex-direction: column; }

.metric-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}
.metric-row > span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-muted);
  background: var(--surface);
  font-size: 0.86rem;
}
.metric-row strong { color: var(--text); font-weight: 800; }

/* metric 内嵌迷你进度条 */
.meter-mini { display: inline-flex; align-items: center; gap: 6px; }
.meter-mini-track {
  width: 52px;
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
}
.meter-mini-fill { display: block; height: 100%; border-radius: 999px; }
.meter-mini-fill--tension { background: linear-gradient(90deg, var(--gold), var(--rose)); }
.meter-mini-fill--brightness { background: linear-gradient(90deg, var(--indigo), var(--cyan)); }

.progression-output {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}
.progression-chip {
  padding: 10px 16px;
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--surface);
  font-weight: 800;
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
}
.progression-chip:hover {
  color: #1a1408;
  background: var(--grad-warm);
  border-color: transparent;
  transform: translateY(-2px);
}

.progression-jianpu {
  margin: 0;
  padding: 16px 18px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--border);
  color: var(--text-muted);
  line-height: 2;
  font-size: 0.95rem;
}
.progression-measure {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.progression-measure strong {
  color: var(--gold);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  margin-right: 2px;
}
.progression-jianpu .jianpu-note {
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
  font-size: 1rem;
  padding: 0.15em 0.4em;
}
.progression-jianpu .jianpu-note.is-active {
  background: var(--grad-warm);
  color: #1a1408;
}
.measure-divider {
  color: var(--text-dim);
  font-weight: 900;
  margin: 0 4px;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 14px;
}

.hint {
  margin: 12px 0 0;
  color: var(--text-dim);
  font-size: 0.88rem;
  line-height: 1.6;
}

/* ========== 参考资料分组 ========== */
.reference-group { margin-top: 14px; }
.reference-group-head {
  margin: 0 0 4px;
  padding: 2px 4px 12px;
}
.reference-group-head h2 {
  margin: 0 0 8px;
  font-size: 1.5rem;
  font-weight: 900;
  letter-spacing: -0.01em;
}
.reference-group-head h2 .step-badge {
  height: 1.6em;
  min-width: 1.6em;
  font-size: 0.78rem;
}
.reference-group-head p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.92rem;
  line-height: 1.6;
}

/* ========== 参考列表 ========== */
.reference .card-head { margin-bottom: 18px; }

.chord-list,
.emotion-list,
.progression-library {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 12px;
}
.progression-library {
  grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
}

.chord-list > span,
.emotion-list > span,
.progression-library > span {
  display: grid;
  gap: 6px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-muted);
  background: var(--surface);
  font-size: 0.86rem;
  line-height: 1.5;
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}
.chord-list > span:hover,
.emotion-list > span:hover,
.progression-library > span:hover {
  transform: translateY(-2px);
  border-color: var(--border-gold);
  background: var(--surface-2);
}

.chord-list strong,
.progression-library strong {
  color: var(--gold);
  font-size: 1rem;
  font-family: var(--font-mono);
  font-weight: 800;
}

/* 情感卡片：名称 + 双进度条 */
.emotion-card { gap: 10px !important; }
.emotion-list .emotion-card strong {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--text);
  font-size: 1rem;
  font-weight: 800;
}
.emotion-list .emotion-card .meter {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 8px;
  font-size: 0.74rem;
}
.meter-label {
  color: var(--text-dim);
  font-family: var(--font-mono);
}
.meter-track {
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}
.meter-fill {
  display: block;
  height: 100%;
  border-radius: 999px;
}
.meter-fill--tension { background: linear-gradient(90deg, var(--gold), var(--rose)); }
.meter-fill--brightness { background: linear-gradient(90deg, var(--indigo), var(--cyan)); }
.meter-value {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.74rem;
}

/* ========== 页脚 ========== */
.footer {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 4px 40px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  color: var(--text-dim);
  font-size: 0.82rem;
  border-top: 1px solid var(--border);
}

/* ========== 响应式 ========== */
@media (max-width: 980px) {
  .grid { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .hero {
    padding: 30px 24px;
  }
  .topbar { flex-wrap: wrap; }
  .panel { padding: 22px; }
  .control { flex-basis: 100%; }
  .footer { flex-direction: column; }
}

/* ========== 实例片段卡片 ========== */
.examples-card .hint { margin: 0 0 18px; }
.example-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 14px;
}
.example-card {
  display: grid;
  gap: 12px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}
.example-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-gold);
  background: var(--surface-2);
}
.example-info { display: grid; gap: 6px; }
.example-info strong {
  color: var(--gold);
  font-size: 1rem;
  font-weight: 800;
  font-family: var(--font-mono);
  letter-spacing: 0.01em;
}
.example-context {
  color: var(--text-muted);
  font-size: 0.86rem;
  line-height: 1.6;
}
.example-style {
  color: var(--text-dim);
  font-size: 0.76rem;
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
}
.example-melody {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid var(--border);
}
.example-melody .jianpu-note {
  position: relative;
  min-width: 1.6em;
  padding: 0.18em 0.4em;
  font-size: 1.05rem;
}
.example-melody .jianpu-note.is-active {
  color: #1a1408;
  background: var(--grad-warm);
  border-color: transparent;
  box-shadow: 0 0 0 3px rgba(255, 203, 107, 0.22), 0 6px 16px rgba(255, 107, 157, 0.32);
  transform: translateY(-2px) scale(1.08);
}
/* 八度点：高音上方加点，低音下方加点 */
.example-note[data-octave="5"]::before,
.example-note[data-octave="6"]::before {
  content: "";
  position: absolute;
  top: -3px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.8;
}
.example-note[data-octave="3"]::after,
.example-note[data-octave="2"]::after {
  content: "";
  position: absolute;
  bottom: -3px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.8;
}
.example-play-button {
  justify-self: start;
  padding: 10px 18px;
  color: #1a1408;
  border: 0;
  background: var(--grad-warm);
  font-weight: 800;
  font-size: 0.86rem;
  box-shadow: 0 8px 22px rgba(255, 107, 157, 0.28);
}
.example-play-button:hover {
  background: linear-gradient(135deg, var(--gold-bright), #ff80ad);
  box-shadow: 0 12px 30px rgba(255, 107, 157, 0.38);
}

/* ========== 音频情感识别卡片 ========== */
.audio-card .card-controls { align-items: flex-end; }
.audio-file-control { gap: 8px; }
input[type="file"] {
  width: 100%;
  padding: 10px 12px;
  color: var(--text-muted);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-md);
  background: rgba(10, 12, 22, 0.5);
  font-size: 0.86rem;
  cursor: pointer;
  transition: border-color 0.18s ease, color 0.18s ease;
}
input[type="file"]::-webkit-file-upload-button {
  margin-right: 12px;
  padding: 7px 14px;
  border: 0;
  border-radius: var(--radius-sm);
  color: #1a1408;
  background: var(--grad-warm);
  font-weight: 800;
  font-size: 0.82rem;
  cursor: pointer;
}
input[type="file"]::file-selector-button {
  margin-right: 12px;
  padding: 7px 14px;
  border: 0;
  border-radius: var(--radius-sm);
  color: #1a1408;
  background: var(--grad-warm);
  font-weight: 800;
  font-size: 0.82rem;
  cursor: pointer;
}
input[type="file"]:hover { border-color: var(--border-gold); color: var(--text); }
.audio-result { display: grid; gap: 12px; }
.audio-result .metric-row { margin-bottom: 0; }
.audio-meters {
  display: grid;
  gap: 10px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--border);
}
.audio-meters .meter {
  display: grid;
  grid-template-columns: 92px 1fr 48px;
  align-items: center;
  gap: 10px;
  font-size: 0.78rem;
}
.audio-error { color: var(--rose); }

/* ========== 减弱动效（无障碍） ========== */
@media (prefers-reduced-motion: reduce) {
  .bg-orb { animation: none; }
  html { scroll-behavior: auto; }
}

/* ========== 涂鸦旋律卡片 ========== */
.doodle-card .hint { margin-bottom: 16px; }
.doodle-card .hint strong { color: var(--gold); font-weight: 800; }

.doodle-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  margin-bottom: 14px;
}
.doodle-palette {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.palette-swatch {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 7px 9px 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: pointer;
  transition: transform .15s ease, border-color .15s ease, background .15s ease, box-shadow .15s ease;
}
.palette-swatch:hover { transform: translateY(-2px); border-color: var(--border-gold); }
.palette-swatch.is-active {
  border-color: var(--gold);
  background: var(--surface-2);
  box-shadow: 0 0 0 2px rgba(255, 203, 107, .25);
}
.palette-dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .28);
  box-shadow: 0 2px 6px rgba(0, 0, 0, .35);
}
.palette-label {
  font-size: .72rem;
  font-weight: 800;
  font-family: var(--font-mono);
  color: var(--text-muted);
  letter-spacing: .02em;
}
.doodle-brush {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: .82rem;
  font-weight: 700;
  white-space: nowrap;
}
.doodle-brush .control-label { font-size: .82rem; }
.doodle-brush input[type="range"] { width: 110px; }
.doodle-brush em {
  font-style: normal;
  color: var(--gold);
  font-family: var(--font-mono);
  font-weight: 800;
}
.doodle-brush input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--gold);
  cursor: pointer;
}

.doodle-canvas-wrap {
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-strong);
  background-color: rgba(8, 9, 15, .7);
  background-image:
    linear-gradient(rgba(255, 255, 255, .035), rgba(255, 255, 255, .035)),
    repeating-linear-gradient(90deg, transparent 0, transparent calc(100%/32 - 1px), rgba(255, 255, 255, .06) calc(100%/32 - 1px), rgba(255, 255, 255, .06) calc(100%/32));
}
.doodle-canvas-wrap::before {
  content: "高八度";
  position: absolute;
  left: 10px; top: 6px;
  z-index: 2;
  font-size: .68rem;
  font-family: var(--font-mono);
  color: var(--text-dim);
  letter-spacing: .04em;
  pointer-events: none;
}
.doodle-canvas-wrap::after {
  content: "低八度";
  position: absolute;
  left: 10px; bottom: 6px;
  z-index: 2;
  font-size: .68rem;
  font-family: var(--font-mono);
  color: var(--text-dim);
  letter-spacing: .04em;
  pointer-events: none;
}
#doodleCanvas {
  display: block;
  width: 100%;
  height: auto;
  cursor: crosshair;
  touch-action: none;
  position: relative;
  z-index: 1;
}

.doodle-melody {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  margin: 16px 0 4px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, .025);
  border: 1px solid var(--border);
  min-height: 56px;
}
.doodle-melody-empty {
  color: var(--text-dim);
  font-size: .88rem;
}
.doodle-note {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.5em;
  padding: .22em .38em;
  border-radius: .42em;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, .05);
  color: var(--text);
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: .9rem;
  transition: transform .15s ease, background .15s ease, color .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.doodle-note.is-rest {
  color: var(--text-dim);
  background: transparent;
  border-style: dashed;
}
.doodle-note.is-active {
  color: #1a1408;
  background: var(--grad-warm);
  border-color: transparent;
  transform: translateY(-3px) scale(1.14);
  box-shadow: 0 0 0 3px rgba(255, 203, 107, .22), 0 6px 16px rgba(255, 107, 157, .32);
}
/* 小节分隔（第 16 步起为第二小节） */
.doodle-note[data-bar-sep]::after {
  content: "";
  position: absolute;
  left: -3px; top: 10%; bottom: 10%;
  width: 2px;
  border-radius: 2px;
  background: rgba(255, 203, 107, .55);
}
/* 八度点：高八度上方点，低八度下方点 */
.doodle-note[data-octave="1"]::before,
.doodle-note[data-octave="2"]::before {
  content: "";
  position: absolute;
  top: -3px; left: 50%;
  transform: translateX(-50%);
  width: 4px; height: 4px;
  border-radius: 50%;
  background: currentColor;
  opacity: .85;
}
.doodle-note[data-octave="-1"]::before,
.doodle-note[data-octave="-2"]::before {
  content: "";
  position: absolute;
  bottom: -3px; left: 50%;
  transform: translateX(-50%);
  width: 4px; height: 4px;
  border-radius: 50%;
  background: currentColor;
  opacity: .85;
}
