/* ==========================================================================
   欧罗巴声学与乐律实验室 (Acoustic & Musicology Lab) - 样式表
   严格依循 Ad Fontes · Europa 原始古典主题（羊皮纸底色、古籍墨色、朱红刻印与古典衬线体）
   ========================================================================== */

:root {
  --bg: #E9E0C9;
  --panel: #F2EBD8;
  --ink: #35301F;
  --mut: #77704F;
  --acc: #7A2E1D;
  --acc2: #3E5C4B;
  --line: #C6BA92;
  --gold: #9A7B2D;
  --serif: "Palatino Linotype", Palatino, Georgia, "Songti SC", SimSun, serif;
  --sans: "Segoe UI", "Helvetica Neue", Arial, "Microsoft YaHei", sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --ease-out: cubic-bezier(.16, 1, .3, 1);
}

.acoustic-lab-root {
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: 24px 0 60px;
  color: var(--ink);
  font-family: var(--serif);
  background: transparent;
  box-sizing: border-box;
}

/* ==========================================================================
   顶部导言、声学音色台与物理示波器 (Acoustic Header & Timbre Console)
   ========================================================================== */
.lab-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 28px;
  margin-bottom: 26px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
  position: relative;
}

.lab-title-area {
  flex: 1 1 auto;
  min-width: 0;
}

.lab-kicker {
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: 0.22em;
  font-weight: 700;
  color: var(--acc);
  text-transform: uppercase;
  margin-bottom: 6px;
}

.lab-title-area h2 {
  font-family: var(--serif);
  font-size: clamp(24px, 3.4vw, 34px);
  letter-spacing: 0.06em;
  margin: 0 0 8px 0;
  color: var(--ink);
  font-weight: 600;
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 12px;
}

.lab-title-area h2 span.latin {
  font-family: var(--sans);
  font-size: 12px;
  font-style: normal;
  letter-spacing: 0.22em;
  font-weight: 700;
  color: var(--gold);
  text-transform: uppercase;
  border-left: 1px solid var(--line);
  padding-left: 12px;
}

.lab-title-area p {
  color: var(--mut);
  margin: 0;
  font-size: 14.5px;
  line-height: 1.75;
  max-width: 72ch;
}

/* 控制台组装区：声学音色台 + 赫姆霍兹示波器 */
.lab-control-deck {
  display: flex;
  gap: 16px;
  align-items: stretch;
  flex-shrink: 0;
}

@media (max-width: 1180px) {
  .lab-header {
    flex-direction: column;
  }
  .lab-control-deck {
    width: 100%;
    flex-wrap: wrap;
  }
}

/* 声学音色与空间混响选择控制台 (Vintage Acoustic Timbre Console) */
.lab-timbre-console {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 10px 14px;
  box-shadow: 0 3px 12px rgba(53, 48, 31, 0.07);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-width: 290px;
}

.console-label-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.console-kicker {
  font-family: var(--sans);
  font-size: 10.5px;
  letter-spacing: 0.14em;
  font-weight: 700;
  color: var(--acc);
  text-transform: uppercase;
}

.console-sub {
  font-family: var(--sans);
  font-size: 11px;
  color: var(--mut);
  font-weight: 600;
}

.timbre-btn-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 8px;
}

.timbre-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: color-mix(in srgb, var(--panel) 90%, var(--bg) 10%);
  border: 1px solid var(--line);
  border-radius: 3px;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.16s var(--ease-out);
}

.timbre-btn:hover {
  border-color: var(--gold);
  color: var(--acc);
  transform: translateY(-1px);
}

.timbre-btn.active {
  background: var(--acc);
  color: #FFF;
  border-color: var(--acc);
  box-shadow: 0 2px 6px rgba(122, 46, 29, 0.35);
}

.timbre-btn .inst-icon {
  font-size: 13px;
}

.space-control-row {
  border-top: 1px solid color-mix(in srgb, var(--line) 60%, transparent);
  padding-top: 6px;
}

.reverb-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 5px 8px;
  background: color-mix(in srgb, var(--panel) 85%, var(--acc2) 15%);
  border: 1px solid color-mix(in srgb, var(--line) 80%, var(--acc2) 20%);
  border-radius: 3px;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.reverb-btn:hover {
  border-color: var(--acc2);
}

.reverb-btn.active {
  background: color-mix(in srgb, var(--acc2) 22%, var(--panel) 78%);
  border-color: var(--acc2);
  color: var(--ink);
}

.reverb-btn strong {
  color: var(--acc2);
}

/* 物理声学示波器卡片 (Vintage Brass Helmholtz Acoustic Visualizer) */
.lab-visualizer-card {
  flex-shrink: 0;
  background: #1C1712;
  border: 2px solid #8C6F2A;
  border-radius: 5px;
  padding: 8px 10px;
  box-shadow: inset 0 0 14px rgba(0, 0, 0, 0.85), 0 4px 16px rgba(40, 30, 20, 0.25);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  width: 340px;
}

.vis-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  margin-bottom: 6px;
}

.vis-title {
  font-family: var(--sans);
  font-size: 10.5px;
  color: #D6C291;
  letter-spacing: 0.14em;
  font-weight: 700;
  text-transform: uppercase;
}

.action-btn-compact {
  padding: 2px 8px;
  font-family: var(--sans);
  font-size: 10.5px;
  background: #2E251C;
  border: 1px solid #735A22;
  color: #EBD699;
  border-radius: 2px;
  cursor: pointer;
  transition: all 0.14s ease;
}

.action-btn-compact:hover {
  background: #4A3C2A;
  color: #FFF;
}

.vis-canvas-frame {
  border: 1px solid #3D3122;
  border-radius: 3px;
  overflow: hidden;
  box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.9);
}

.lab-visualizer-card canvas {
  display: block;
  width: 100%;
  height: 86px;
  background: #15120E;
}

.lab-visualizer-status {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: #F5CE5D;
  margin-top: 5px;
  font-weight: 600;
  text-align: center;
}

/* ==========================================================================
   实验室导航选项卡 (Lab Navigation Tabs)
   ========================================================================== */
.lab-nav {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 24px;
  background: color-mix(in srgb, var(--panel) 75%, var(--bg) 25%);
  padding: 8px;
  border-radius: 6px;
  border: 1px solid var(--line);
  box-shadow: 0 2px 8px rgba(53, 48, 31, 0.05);
}

.lab-tab-btn {
  background: var(--panel);
  color: var(--mut);
  border: 1px solid var(--line);
  padding: 10px 14px;
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.03em;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.18s var(--ease-out);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: 0 1px 3px rgba(53, 48, 31, 0.04);
  text-align: center;
}

.lab-tab-btn .tab-roman {
  font-family: var(--serif);
  font-weight: 700;
  color: var(--gold);
  font-size: 13.5px;
  border-right: 1px solid var(--line);
  padding-right: 8px;
  flex-shrink: 0;
  line-height: 1;
}

.lab-tab-btn .tab-label {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
}

.lab-tab-btn .tab-en {
  font-size: 11px;
  font-family: var(--sans);
  color: var(--mut);
  font-weight: 500;
  opacity: 0.85;
}

.lab-tab-btn:hover {
  color: var(--ink);
  border-color: var(--acc);
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(53, 48, 31, 0.08);
}

.lab-tab-btn.active {
  color: #FFF !important;
  background: var(--acc);
  border-color: var(--acc);
  box-shadow: 0 3px 10px rgba(122, 46, 29, 0.35);
}

.lab-tab-btn.active .tab-roman {
  color: #FFE6A8;
  border-right-color: rgba(255, 255, 255, 0.35);
}

.lab-tab-btn.active .tab-label {
  color: #FFF !important;
}

.lab-tab-btn.active .tab-en {
  color: #F7E9C8;
  opacity: 0.95;
}

@media (max-width: 1080px) {
  .lab-nav {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .lab-nav {
    grid-template-columns: 1fr;
  }
}

/* 选项卡面板容器 */
.lab-panel {
  display: none;
  animation: labFadeIn 0.2s var(--ease-out) forwards;
}

.lab-panel.active {
  display: block;
}

@keyframes labFadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* 布局网格 */
.lab-grid-2 {
  display: grid;
  grid-template-columns: 1fr 390px;
  gap: 20px;
}

@media (max-width: 1040px) {
  .lab-grid-2 {
    grid-template-columns: 1fr;
  }
}

.lab-card, .harmonic-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 20px 22px;
  box-shadow: 0 3px 12px rgba(53, 48, 31, 0.05);
}

.lab-card-title {
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 600;
  color: var(--ink);
  margin: 0 0 14px 0;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 60%, transparent);
  padding-bottom: 10px;
}

.lab-card-badge {
  font-family: var(--sans);
  font-size: 12px;
  color: var(--acc);
  font-weight: 600;
}

.lab-card-hint {
  font-family: var(--sans);
  font-size: 12px;
  color: var(--mut);
}

/* 律制选择单选卡 */
.tuning-selector {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.tuning-chip {
  background: color-mix(in srgb, var(--panel) 94%, var(--bg) 6%);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 10px 12px;
  cursor: pointer;
  transition: all 0.16s ease;
  text-align: left;
}

.tuning-chip:hover {
  border-color: var(--acc);
  background: var(--panel);
  transform: translateY(-1px);
}

.tuning-chip.active {
  border-color: var(--acc);
  background: color-mix(in srgb, var(--panel) 88%, var(--acc) 12%);
  box-shadow: inset 0 0 0 1px var(--acc);
}

.tuning-chip-name {
  font-family: var(--sans);
  font-weight: 700;
  color: var(--acc);
  font-size: 13.5px;
  margin-bottom: 4px;
}

.tuning-chip-desc {
  font-size: 12px;
  color: var(--mut);
  line-height: 1.5;
}

.tuning-quote-box {
  font-size: 13.5px;
  color: var(--mut);
  margin: 0;
  line-height: 1.6;
  background: color-mix(in srgb, var(--panel) 88%, var(--bg) 12%);
  padding: 12px 14px;
  border-radius: 3px;
  border-left: 3px solid var(--acc);
}

/* ==========================================================================
   交互琴键系统 (Piano Keyboard with Fallboard & Pedal)
   ========================================================================== */
.stave-keyboard-section {
  margin-top: 14px;
  margin-bottom: 14px;
  box-shadow: 0 6px 18px rgba(35, 25, 15, 0.12);
  border-radius: 5px;
  overflow: hidden;
}

/* 琴盖实木翻板 (Mahogany Fallboard with Gold Foil Stamp) */
.keyboard-fallboard {
  background: linear-gradient(180deg, #3A2318 0%, #25160E 60%, #170C07 100%);
  border: 1px solid #1A0D06;
  border-bottom: 2px solid #9A7B2D;
  padding: 8px 16px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 14px;
  position: relative;
}

.fallboard-metal-accent {
  flex: 1 1 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(201, 162, 39, 0.5), transparent);
}

.fallboard-brand {
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: 0.26em;
  font-weight: 700;
  color: #EBD699;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
  user-select: none;
}

.keyboard-wrapper {
  background: #1A1510;
  padding: 10px 14px 16px;
  position: relative;
  user-select: none;
  width: 100%;
  box-sizing: border-box;
}

.keyboard {
  display: flex;
  position: relative;
  height: 185px;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.key {
  position: relative;
  cursor: pointer;
  border-radius: 0 0 4px 4px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  padding-bottom: 8px;
  font-family: var(--sans);
  transition: background 0.08s ease, transform 0.05s ease, box-shadow 0.08s ease;
  box-sizing: border-box;
}

.key:active, .key.pressed {
  transform: translateY(2.5px);
}

/* 象牙白键 (Ivory White Keys) */
.key.white {
  flex: 1 1 0;
  width: auto;
  height: 100%;
  min-width: 0;
  background: linear-gradient(180deg, #FAF8F2 0%, #F5EFE0 70%, #E8DEC5 100%);
  color: var(--ink);
  border: 1px solid #C4B58A;
  border-top: none;
  z-index: 1;
  box-shadow: inset 0 1px 0 #FFF, inset -1px 0 1px rgba(0,0,0,0.08), 0 4px 8px rgba(0, 0, 0, 0.2);
}

.key.white:hover {
  background: linear-gradient(180deg, #FFFFFF 0%, #FAF4E8 70%, #EFE5CD 100%);
}

.key.white:active, .key.white.pressed {
  background: linear-gradient(180deg, #9C3325 0%, #7A2E1D 70%, #5E1F13 100%) !important;
  color: #FFF !important;
  box-shadow: inset 0 3px 6px rgba(0, 0, 0, 0.55), 0 0 12px rgba(201, 162, 39, 0.45);
}

/* 黑檀木黑键 (Ebony Black Keys) */
.key.black {
  position: absolute;
  top: 0;
  height: 60%;
  width: clamp(28px, 6.2%, 52px);
  transform: translateX(-50%);
  background: linear-gradient(180deg, #302820 0%, #1A130F 80%, #0A0806 100%);
  color: #EBD699;
  z-index: 3;
  border: 1px solid #080604;
  border-top: none;
  border-radius: 0 0 3px 3px;
  box-shadow: 0 5px 12px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.key.black:hover {
  background: linear-gradient(180deg, #44372D 0%, #261D17 80%, #120E0A 100%);
}

.key.black:active, .key.black.pressed {
  background: linear-gradient(180deg, #9C3325 0%, #7A2E1D 70%, #5E1F13 100%) !important;
  color: #FFF !important;
  box-shadow: inset 0 3px 6px rgba(0, 0, 0, 0.6), 0 0 12px rgba(201, 162, 39, 0.5);
}

.key .key-note {
  font-weight: 700;
  font-size: 13px;
  line-height: 1.1;
}

/* 延音踏板控制栏 (Sustain Pedal Bar) */
.keyboard-pedal-bar {
  background: color-mix(in srgb, var(--panel) 90%, var(--bg) 10%);
  border: 1px solid var(--line);
  border-top: 1px solid color-mix(in srgb, var(--line) 60%, transparent);
  padding: 8px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.pedal-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: var(--panel);
  border: 1px solid #9A7B2D;
  border-radius: 3px;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: 0 2px 5px rgba(53, 48, 31, 0.08);
}

.pedal-btn .pedal-brass-icon {
  width: 14px;
  height: 8px;
  border-radius: 2px 2px 4px 4px;
  background: linear-gradient(180deg, #F5CE5D 0%, #C9A227 100%);
  border: 1px solid #8C6F2A;
  box-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.pedal-btn .pedal-kbd {
  background: color-mix(in srgb, var(--panel) 70%, var(--line) 30%);
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 1px 5px;
  font-size: 10px;
  font-family: var(--mono);
  color: var(--mut);
}

.pedal-btn:hover {
  border-color: var(--acc);
  color: var(--acc);
}

.pedal-btn.pressed {
  background: #7A2E1D;
  color: #FFF;
  border-color: #7A2E1D;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.35);
}

.pedal-btn.pressed strong {
  color: #FFE6A8;
}

.pedal-btn.pressed .pedal-kbd {
  background: rgba(255, 255, 255, 0.2);
  color: #FFF;
  border-color: rgba(255, 255, 255, 0.4);
}

.pedal-tip {
  font-family: var(--sans);
  font-size: 11.5px;
  color: var(--mut);
  line-height: 1.4;
}

.key .key-sub {
  font-size: 10px;
  font-family: var(--serif);
  color: var(--mut);
  margin-top: 2px;
  line-height: 1;
}

.key.black .key-sub {
  color: #C6BA92;
  font-size: 9.5px;
}

.key:active .key-sub, .key.pressed .key-sub {
  color: #FFF !important;
  opacity: 0.9;
}

.key .key-freq {
  font-size: 9.5px;
  font-family: var(--mono);
  color: var(--mut);
  margin-top: 2px;
  opacity: 0.85;
}

.key:active .key-freq, .key.pressed .key-freq {
  color: #FFF !important;
}

.key .key-cent {
  font-size: 10px;
  font-family: var(--mono);
  color: var(--acc);
  font-weight: 600;
  margin-top: 1px;
}

.key.black .key-cent {
  color: #D1A858;
}

.key:active .key-cent, .key.pressed .key-cent {
  color: #FFF !important;
}

/* 一键经典对比听辨按钮 */
.audition-pills {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 14px;
  align-items: center;
}

.audition-label {
  font-family: var(--sans);
  font-size: 12.5px;
  color: var(--acc);
  font-weight: 700;
  letter-spacing: 0.05em;
}

.audition-btn, .action-btn {
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--ink);
  padding: 7px 14px;
  border-radius: 3px;
  font-family: var(--sans);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: all 0.16s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.audition-btn:hover, .action-btn:hover {
  border-color: var(--acc);
  color: var(--acc);
  background: color-mix(in srgb, var(--panel) 92%, var(--acc) 8%);
  transform: translateY(-1px);
}

.audition-btn.danger {
  border-color: var(--acc);
  color: var(--acc);
}

.audition-btn.danger:hover {
  background: var(--acc);
  color: #FFF;
}

/* 音分数据分析表 */
.cents-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  font-family: var(--mono);
}

.cents-table th, .cents-table td {
  padding: 7px 8px;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 60%, transparent);
  text-align: right;
}

.cents-table th:first-child, .cents-table td:first-child {
  text-align: left;
}

.cents-table th {
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--acc);
  font-weight: 700;
  text-transform: uppercase;
  border-bottom: 2px solid var(--line);
}

.diff-pos { color: var(--acc); font-weight: 700; }
.diff-neg { color: var(--acc2); font-weight: 700; }
.diff-zero { color: var(--mut); }

/* 教会调式与拉格卡片系统 */
.mode-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}

#indian-thaats-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
}

@media (max-width: 1280px) {
  #indian-thaats-grid {
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  }
}

.mode-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 14px 16px;
  transition: all 0.16s ease;
  box-shadow: 0 2px 6px rgba(53, 48, 31, 0.04);
}

.mode-card:hover {
  border-color: var(--acc);
  transform: translateY(-1px);
}

.mode-card-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 6px;
}

.mode-name {
  font-family: var(--serif);
  font-weight: 700;
  color: var(--acc);
  font-size: 16px;
}

.mode-greek {
  font-family: var(--sans);
  font-size: 11px;
  color: var(--mut);
  letter-spacing: 0.08em;
}

.mode-formula {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--acc2);
  margin-bottom: 8px;
  font-weight: 600;
}

.mode-desc {
  font-size: 13px;
  color: var(--mut);
  line-height: 1.55;
  margin-bottom: 12px;
}

.play-mode-btn {
  background: color-mix(in srgb, var(--panel) 92%, var(--acc) 8%);
  border: 1px solid var(--line);
  color: var(--acc);
  padding: 6px 12px;
  border-radius: 3px;
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.16s;
  width: 100%;
}

.play-mode-btn:hover {
  background: var(--acc);
  border-color: var(--acc);
  color: #FFF;
}

.mode-section-title {
  font-family: var(--serif);
  font-size: 17px;
  color: var(--ink);
  font-weight: 600;
  margin: 18px 0 10px;
  border-left: 3px solid var(--gold);
  padding-left: 8px;
}

/* 谭普拉长音开关栏 */
.drone-switch-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: color-mix(in srgb, var(--panel) 90%, var(--acc2) 10%);
  padding: 14px 18px;
  border-radius: 4px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--acc2);
  margin-bottom: 22px;
}

.drone-switch-bar span {
  font-size: 13.5px;
  color: var(--ink);
  line-height: 1.6;
}

/* 和声切片卡片 */
.harmonic-card {
  margin-bottom: 18px;
}

.harmonic-card h4 {
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 600;
  color: var(--acc);
  margin: 0 0 8px 0;
  border-left: 3px solid var(--acc);
  padding-left: 8px;
}

.harmonic-card p {
  font-size: 13.5px;
  color: var(--mut);
  line-height: 1.65;
  margin: 0 0 12px 0;
}

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

/* 勋伯格十二音序列矩阵计算机 (12-Tone Matrix Engine) */
.matrix-container {
  overflow-x: auto;
  margin-top: 14px;
  padding: 4px 0;
}

.matrix-grid {
  display: grid;
  grid-template-columns: 42px repeat(12, 38px);
  gap: 2px;
  background: var(--line);
  border: 2px solid var(--acc);
  border-radius: 4px;
  padding: 2px;
  width: fit-content;
  font-family: var(--mono);
  font-size: 12px;
  user-select: none;
}

.matrix-cell {
  background: var(--panel);
  color: var(--ink);
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.12s;
  font-weight: 500;
}

.matrix-cell:hover {
  background: color-mix(in srgb, var(--panel) 75%, var(--gold) 25%);
  color: var(--ink);
}

.matrix-header {
  background: color-mix(in srgb, var(--panel) 82%, var(--acc) 18%);
  color: var(--acc);
  font-weight: 700;
  cursor: pointer;
}

.matrix-header:hover {
  background: var(--acc);
  color: #FFF;
}

.matrix-playing-cell {
  background: var(--acc) !important;
  color: #FFF !important;
  font-weight: 700;
  transform: scale(1.1);
  z-index: 5;
  box-shadow: 0 2px 8px rgba(122, 46, 29, 0.4);
}

/* ==========================================================================
   古典五线谱音阶视唱与交互演奏台 (Interactive Musical Stave)
   ========================================================================== */

.stave-card-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 6px;
}

.stave-scale-filters {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.stave-filter-chip {
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--mut);
  padding: 5px 11px;
  border-radius: 3px;
  font-family: var(--sans);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.16s ease;
}

.stave-filter-chip:hover {
  border-color: var(--acc);
  color: var(--ink);
  transform: translateY(-1px);
}

.stave-filter-chip.active {
  background: var(--acc);
  color: #FFF;
  border-color: var(--acc);
  box-shadow: 0 2px 5px rgba(122, 46, 29, 0.25);
}

.stave-svg-container {
  background: #FAF5E8;
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow-x: auto;
  box-shadow: inset 0 2px 5px rgba(53, 48, 31, 0.08);
  margin-bottom: 12px;
  padding: 4px;
}

.acoustic-stave-svg {
  display: block;
  min-width: 720px;
  width: 100%;
  height: auto;
  user-select: none;
}

.staff-note-node {
  cursor: pointer;
  outline: none;
  transition: transform 0.12s ease;
}

.staff-note-node:hover .stave-notehead {
  fill: var(--acc);
  stroke: var(--gold);
  stroke-width: 1.5px;
}

.staff-note-node:hover text {
  font-weight: 700;
}

.staff-note-node.playing .stave-notehead {
  fill: #8C2B1F !important;
  stroke: #9A7B2D !important;
  stroke-width: 2.2px !important;
  filter: drop-shadow(0 0 6px rgba(140, 43, 31, 0.65));
}

.staff-note-node.playing .stave-stem {
  stroke: #8C2B1F !important;
  stroke-width: 1.8px !important;
}

@keyframes staveRingExpand {
  0% { r: 6px; opacity: 1; stroke-width: 2.8px; }
  100% { r: 26px; opacity: 0; stroke-width: 0.5px; }
}

.stave-sound-ring {
  animation: staveRingExpand 0.65s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  pointer-events: none;
}

.stave-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  background: color-mix(in srgb, var(--panel) 88%, var(--bg) 12%);
  padding: 8px 12px;
  border-radius: 4px;
  border: 1px solid var(--line);
}

.stave-play-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.stave-status-pill {
  font-family: var(--sans);
  font-size: 12px;
  color: var(--acc);
  font-weight: 600;
}

.stave-keyboard-divider {
  font-family: var(--serif);
  font-size: 15px;
  color: var(--ink);
  margin: 16px 0 10px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  border-top: 1px solid color-mix(in srgb, var(--line) 60%, transparent);
  padding-top: 12px;
}

/* 泛音滑杆与拍频粗糙度滑杆 (Parchment Styled Sliders) */
input[type="range"] {
  accent-color: var(--acc);
  cursor: pointer;
}

.harmonic-row-item:hover {
  background: color-mix(in srgb, var(--panel) 92%, var(--gold) 8%);
}

/* 历史三大音差微音听辨卡片 */
.comma-audition-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.comma-item {
  background: color-mix(in srgb, var(--panel) 75%, var(--bg) 25%);
  padding: 10px 12px;
  border-radius: 4px;
  border: 1px solid var(--line);
}

.comma-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 4px;
}

.comma-header strong {
  font-family: var(--serif);
  font-size: 13px;
  color: var(--ink);
}

.comma-ratio {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--acc);
  font-weight: 700;
}

.comma-desc {
  font-size: 11px;
  color: var(--mut);
  line-height: 1.45;
  margin: 0 0 8px;
}

/* 五度相生环与微音裂缝 SVG */
.tuning-circle-svg {
  display: block;
  width: 220px;
  height: 220px;
  user-select: none;
}

.circle-node-group {
  cursor: pointer;
  transition: transform 0.12s ease;
}

.circle-node-group:hover circle {
  fill: var(--acc);
}

.circle-node-group:hover text {
  fill: #FFF;
}

/* ==========================================================================
   面板 2-6 补白与声学扩展组件样式 (Ad Fontes Parchment System)
   ========================================================================== */

.sub-panel-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 16px 18px;
  margin-bottom: 18px;
  box-shadow: 0 2px 8px rgba(53, 48, 31, 0.04);
}

.sub-panel-card h4 {
  font-family: var(--serif);
  font-size: 15px;
  font-weight: 600;
  color: var(--acc);
  margin: 0 0 8px 0;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  border-left: 3px solid var(--acc);
  padding-left: 8px;
}

.sub-panel-card p {
  font-size: 12.5px;
  color: var(--mut);
  line-height: 1.6;
  margin: 0 0 10px 0;
}

/* 傅里叶公式标尺框 */
.waveform-formula-box {
  font-family: var(--mono);
  font-size: 11px;
  background: color-mix(in srgb, var(--bg) 60%, var(--panel) 40%);
  border: 1px dashed var(--line);
  padding: 7px 10px;
  border-radius: 3px;
  color: var(--ink);
  margin: 8px 0 10px;
  line-height: 1.5;
}

/* 曼海姆 / 拉莫四部终止式网格 (Cadence Grid) */
.cadence-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.cadence-item-card {
  background: color-mix(in srgb, var(--panel) 75%, var(--bg) 25%);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.cadence-item-card strong {
  font-family: var(--serif);
  font-size: 13px;
  color: var(--ink);
  display: block;
  margin-bottom: 3px;
}

.cadence-item-card .roman-nums {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--acc);
  font-weight: 700;
  margin-bottom: 4px;
}

.cadence-item-card p {
  font-size: 11px;
  color: var(--mut);
  line-height: 1.4;
  margin: 0 0 8px;
  flex: 1;
}

/* 约翰·凯奇预置钢琴按键 (Prepared Piano Tactile Keys) */
.prepared-piano-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.prepared-key-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 10px 8px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: #FAF5E8;
  color: var(--ink);
  cursor: pointer;
  transition: all 0.15s;
  text-align: center;
  font-family: var(--sans);
}

.prepared-key-btn:hover {
  background: color-mix(in srgb, #FAF5E8 85%, var(--acc) 15%);
  border-color: var(--acc);
  transform: translateY(-1px);
}

.prepared-key-btn:active {
  transform: translateY(1px);
}

.prepared-key-btn .key-icon {
  font-size: 18px;
  margin-bottom: 4px;
}

.prepared-key-btn .key-title {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--ink);
}

.prepared-key-btn .key-sub {
  font-size: 10px;
  color: var(--mut);
}

/* 勋伯格十二音序列双栏综合工作台 (Panel 6 Matrix Dashboard Grid) */
.matrix-dashboard-grid {
  display: grid;
  grid-template-columns: minmax(480px, 1.15fr) 1fr;
  gap: 22px;
  align-items: start;
  margin-top: 14px;
}

@media (max-width: 1080px) {
  .matrix-dashboard-grid {
    grid-template-columns: 1fr;
  }
}

.matrix-side-card {
  background: color-mix(in srgb, var(--panel) 80%, var(--bg) 20%);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 14px 16px;
  margin-bottom: 14px;
}

.matrix-side-card h4 {
  font-family: var(--serif);
  font-size: 14.5px;
  color: var(--acc);
  margin: 0 0 6px 0;
  border-left: 3px solid var(--acc);
  padding-left: 8px;
}

.matrix-side-card p {
  font-size: 12px;
  color: var(--mut);
  line-height: 1.55;
  margin: 0 0 10px 0;
}

/* 圭多手与斯鲁提展示卡片 */
.mode-theory-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 24px;
}

@media (max-width: 900px) {
  .mode-theory-grid {
    grid-template-columns: 1fr;
  }
}

/* 避免主站全局悬浮翻卷条遮挡声学实验室琴键与踏板 */
body:has(#v-lab.on) .mirror-switch,
body:has(#v-lab.active) .mirror-switch {
  opacity: 0.25;
  transition: opacity 0.2s ease;
}

body:has(#v-lab.on) .mirror-switch:hover,
body:has(#v-lab.active) .mirror-switch:hover {
  opacity: 1;
}
