/* css/style.css - 吉他和弦工具 */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html { font-size: 16px; }

body {
  background: #e8e2d8;
  min-height: 100vh;
  padding-bottom: calc(40px + env(safe-area-inset-bottom, 0px));
  min-height: 100dvh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  padding: 20px;
  color: #2c2c2c;
  overflow-x: hidden;
}

.app-container {
  max-width: 1100px;
  width: 100%;
  background: #fdfaf5;
  border-radius: 16px;
  box-shadow: 0 2px 24px rgba(0,0,0,0.05);
  padding: 32px 28px 36px;
}

.app-title {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.4rem;
  letter-spacing: 0.5px;
  color: #3a5a40;
  margin-bottom: 24px;
}

.app-title span {
  background: #3a5a40;
  color: #fff;
  font-size: 1.1rem;
  padding: 5px 18px;
  border-radius: 20px;
}

.title-short { display: none; }
.title-full { display: inline; }

/* ==================== 标签导航 ==================== */
.tab-nav {
  display: flex;
  justify-content: center;
  gap: 0;
  margin-bottom: 24px;
  border-bottom: 1px solid #e0d8cc;
  padding-bottom: 0;
}

.tab-btn {
  background: transparent;
  border: none;
  padding: 12px 24px;
  font-weight: 500;
  font-size: 0.88rem;
  color: #999;
  cursor: pointer;
  min-width: 0;
  transition: all 0.2s ease;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.tab-btn.active {
  color: #3a5a40;
  font-weight: 600;
  border-bottom-color: #3a5a40;
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ==================== 搜索面板 ==================== */
.search-panel {
  background: #faf6ef;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 24px;
}

.search-row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid #e8e0d4;
}

.root-select {
  background: #fff;
  border: 1px solid #e0d8cc;
  padding: 10px 18px;
  border-radius: 20px;
  font-weight: 600;
  font-size: 0.9rem;
  color: #2c2c2c;
  outline: none;
  cursor: pointer;
  min-width: 0;
  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="%23555"><path d="M7 10l5 5 5-5z"/></svg>');
  background-repeat: no-repeat;
  background-position: right 14px center;
  appearance: none;
  padding-right: 38px;
}

.chord-search-input {
  flex: 1;
  min-width: 130px;
  padding: 10px 18px;
  border: 1px solid #e0d8cc;
  border-radius: 20px;
  font-size: 0.9rem;
  color: #2c2c2c;
  outline: none;
  background: #fff;
  transition: border-color 0.2s ease;
}

.chord-search-input:focus { border-color: #3a5a40; }
.chord-search-input::placeholder { color: #c0b8a8; }

.chord-search-btn {
  background: #3a5a40;
  border: none;
  color: #fff;
  padding: 10px 16px;
  border-radius: 20px;
  font-size: 0.9rem;
  cursor: pointer;
  min-width: 0;
  transition: all 0.2s ease;
}

.chord-search-btn:hover { background: #4a6a50; }

/* 移动端分类列表（一级） */
.chord-type-popup-btn { display: block; background: #fff; border: 1px solid #e0d8cc; padding: 8px 14px; border-radius: 18px; font-size: 0.85rem; cursor: pointer; outline: none; }
.chord-type-popup-btn:active { transform: scale(0.94); }

.chord-category-list { display: flex; flex-direction: column; gap: 2px; }
.chord-cat-btn { display: flex; align-items: center; width: 100%; background: none; border: none; padding: 12px 4px; cursor: pointer; font-size: 0.9rem; border-bottom: 1px solid #f0e8dc; color: #333; text-align: left; }
.chord-cat-btn:last-child { border-bottom: none; }
.chord-cat-btn:active { background: #f0e8dc; border-radius: 8px; }
.chord-cat-back-btn { background: none; border: none; font-size: 0.88rem; font-weight: 600; color: #3a5a40; padding: 8px 4px; cursor: pointer; text-align: left; }

/* ==================== 和弦类型选择 ==================== */

/* 分类列表（移动端一级菜单） */

.chord-type-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 280px;
  overflow-y: auto;
  margin-bottom: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid #e8e0d4;
}

.chord-category { padding-bottom: 4px; }
.chord-category:last-child { border-bottom: none; }

.chord-category-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 3px 0;
  margin-bottom: 4px;
}

.chord-category-title {
  font-weight: 600;
  font-size: 0.7rem;
  color: #aaa;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.chord-category-toggle {
  background: none;
  border: 1px solid #d0c8b8;
  padding: 2px 10px;
  border-radius: 10px;
  font-size: 0.62rem;
  color: #aaa;
  cursor: pointer;
  min-width: 0;
  transition: all 0.15s ease;
}

.chord-category-toggle:hover { background: #f0e8dc; }

.chord-type-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  padding: 2px 0;
}

.chord-type-btn {
  background: #fff;
  border: 1px solid #e8e0d4;
  padding: 5px 12px;
  border-radius: 20px;
  font-weight: 500;
  font-size: 0.73rem;
  color: #666;
  cursor: pointer;
  min-width: 0;
  transition: all 0.2s ease;
  white-space: nowrap;
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.chord-type-btn .abbr { font-weight: 700; color: #3a5a40; }
.chord-type-btn .cn-name { font-size: 0.7em; opacity: 0.6; }
.chord-type-btn:hover { background: #e8e0d4; border-color: #d0c8b8; }
.chord-type-btn.active { background: #3a5a40; color: #fff; border-color: #3a5a40; }
.chord-type-btn.active .abbr { color: #fff; }
.chord-type-btn.active .cn-name { color: rgba(255,255,255,0.85); opacity: 1; }

/* ==================== 转位筛选 ==================== */
#inversionGroup {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  background: transparent;
  padding: 0;
  border-radius: 0;
  position: relative;
}

.inversion-btn {
  background: #fff;
  border: 1px solid #e0d8cc;
  padding: 7px 14px;
  border-radius: 20px;
  font-weight: 500;
  font-size: 0.76rem;
  color: #666;
  cursor: pointer;
  min-width: 0;
  transition: all 0.2s ease;
  white-space: nowrap;
  min-height: 32px;
}

.inversion-btn:hover { background: #f0e8dc; }
.inversion-btn.active { background: #3a5a40; color: #fff; border-color: #3a5a40; }

.slash-menu {
  display: none;
  flex-wrap: wrap;
  gap: 3px;
  padding: 8px;
  background: #fff;
  border: 1px solid #e0d8cc;
  border-radius: 12px;
  margin-top: 6px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.06);
}

/* ==================== 信息面板 ==================== */
.info-panel {
  background: #fff;
  border-radius: 12px;
  padding: 20px 24px;
  margin-bottom: 24px;
  box-shadow: 0 1px 6px rgba(0,0,0,0.04);
  text-align: center;
}

.chord-name-main {
  font-size: 1.8rem;
  font-weight: 700;
  color: #2c2c2c;
  margin-bottom: 6px;
}

.stats-row {
  display: flex;
  justify-content: center;
  gap: 24px;
  flex-wrap: wrap;
  margin: 10px 0;
  font-size: 0.84rem;
  color: #aaa;
}

.stats-row span { font-weight: 600; color: #666; }

.intervals-row {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.intervals-row span {
  background: #f0e8dc;
  padding: 3px 14px;
  border-radius: 12px;
  font-size: 0.78rem;
  color: #777;
}

/* ==================== 分页 ==================== */
.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin: 20px 0 8px;
}

.page-btn {
  background: #fff;
  border: 1px solid #e0d8cc;
  color: #666;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.page-btn:hover { background: #f0e8dc; border-color: #d0c8b8; }
.page-btn:disabled { opacity: 0.25; cursor: not-allowed; }

.page-info {
  font-weight: 500;
  color: #aaa;
  font-size: 0.85rem;
  min-width: 110px;
  text-align: center;
}

/* ==================== 和弦图网格 ==================== */
.chord-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 14px;
  justify-items: center;
  margin: 20px 0;
}

.chord-card {
  position: relative;
  background: #fff;
  border: 1px solid #e8e2d8;
  border-radius: 10px;
  padding: 12px 6px 10px;
  box-shadow: 0 1px 6px rgba(0,0,0,0.04);
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  min-width: 0;
  transition: all 0.25s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  width: 100%;
  max-width: 230px;
}

.chord-card:active { transform: scale(0.98); }
.chord-card:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,0.06); border-color: #d0c8b8; }
.chord-card-label { font-size: 0.78rem; color: #999; margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chord-card.selected { border-left: 3px solid #3a5a40; border-top-color: #e8e2d8; border-right-color: #e8e2d8; border-bottom-color: #e8e2d8; }

.chord-canvas { display: block; width: 200px; height: 220px; }

.chord-card-label { font-weight: 600; font-size: 0.8rem; color: #999; margin-top: 8px; }

.no-result { text-align: center; color: #c0b8a8; padding: 50px; font-size: 0.9rem; grid-column: 1 / -1; }

/* ==================== 占位页面 ==================== */
.placeholder-page { text-align: center; padding: 80px 20px; color: #aaa; }
.placeholder-page h2 { font-size: 1.4rem; margin-bottom: 12px; color: #666; }
.placeholder-page p { font-size: 0.9rem; color: #bbb; }

/* ==================== 和弦构建页面 ==================== */
.builder-container {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.builder-fretboard-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 1px 6px rgba(0,0,0,0.04);
  overflow: hidden;
}

.builder-string-canvas {
  display: block;
  background: #faf6ef;
}

.builder-fret-canvas {
  display: block;
  background: #faf6ef;
  cursor: pointer;
  min-width: 0;
  touch-action: none;
}

.builder-selected,
.builder-results {
  background: #fff;
  border-radius: 12px;
  padding: 12px 16px;
  box-shadow: 0 1px 6px rgba(0,0,0,0.04);
}

.builder-label {
  font-weight: 600;
  font-size: 0.8rem;
  color: #888;
  margin-bottom: 8px;
}

.builder-notes-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.builder-note-item {
  font-weight: 600;
  font-size: 0.9rem;
  color: #888;
  padding: 4px 0;
  cursor: default;
}

.builder-note-item.selectable {
  color: #3a5a40;
  cursor: pointer;
  min-width: 0;
  padding: 4px 10px;
  border-radius: 14px;
  background: #f0f4ef;
  transition: all 0.15s;
}

.builder-note-item.selectable:hover {
  background: #d8e8d8;
}

.builder-note-item.root-selected {
  background: #3a5a40;
  color: #fff;
  font-weight: 700;
}

.builder-results-list-item {
  padding: 8px 0;
  font-size: 0.85rem;
  color: #555;
}

.builder-results-list-item.best {
  font-weight: 700;
  color: #3a5a40;
  font-size: 1rem;
}

.builder-solmization {
  font-size: 0.8rem;
  color: #999;
  margin-top: 2px;
}

.builder-confidence {
  font-size: 0.75rem;
  color: #aaa;
}

.builder-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.action-btn:active, .tab-btn:active, .page-btn:active, .inversion-btn:active { transform: scale(0.94); }

.action-btn {
  background: #3a5a40;
  border: none;
  color: #fff;
  padding: 10px 20px;
  border-radius: 20px;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  min-width: 0;
  transition: all 0.2s ease;
}

.action-btn:hover { background: #4a6a50; }

.action-btn.secondary {
  background: #fff;
  border: 1px solid #e0d8cc;
  color: #666;
}

.action-btn.secondary:hover { background: #f0e8dc; }

/* ==================== 移动端适配 ==================== */
@media (max-width: 768px) {
  .app-container { border-radius: 12px; padding: 24px 16px; }
  .chord-grid { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
  .chord-card { max-width: 210px; }
  .chord-canvas { width: 190px; height: 210px; }
  .chord-type-container { min-width: 100%; max-height: 260px; }
}

@media (max-width: 640px) and (orientation: landscape) {
  .chord-grid { grid-template-columns: repeat(3, 1fr); gap: 10px; }
  .app-container { padding: 16px 12px; }
  .chord-canvas { width: 170px; height: 190px; }
}

@media (max-width: 540px) {
  .title-full { display: none; }
  .title-short { display: inline; }
  .chord-type-popup-btn { display: none; }
  .chord-type-container { display: flex; flex-direction: column; gap: 6px; }

  .slash-menu {
    position: fixed; top: auto; left: auto; right: 8px; z-index: 1001;
    background: #fff; border-radius: 12px; padding: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.10);
    width: max-content; flex-direction: column;
  }

  .tab-btn {
    white-space: nowrap; text-align: center;
    padding: 8px 5px; font-size: 0.72rem; flex: 1; min-width: 0; width: auto;
  }
  
  .search-row { gap: 6px; padding-bottom: 10px; margin-bottom: 10px; }
  .chord-type-container { padding-bottom: 10px; margin-bottom: 10px; }
  .chord-search-input { min-width: 80px; font-size: 0.8rem; padding: 9px 12px; }
  .chord-search-btn { padding: 9px 12px; font-size: 0.9rem; }
  .root-select { padding: 9px 12px; font-size: 0.8rem; }
  
  #inversionGroup { flex-wrap: nowrap; overflow-x: auto; gap: 4px; }
  .inversion-btn { flex-shrink: 0; font-size: 0.72rem; padding: 6px 10px; min-height: 28px; }
  
  .chord-grid { grid-template-columns: repeat(2, 1fr); gap: 6px; }
  .chord-card { max-width: 100%; min-width: 0; padding: 6px 3px 4px; box-sizing: border-box; position: relative; }
  .chord-card-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 0.72rem; }
  .chord-canvas { width: 100%; max-width: 200px; display: block; }
  .prog-diagrams { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .s-controls-row { gap: 4px; }
  .s-controls-row .s-select { font-size: 0.72rem; padding: 5px 8px; min-width: 50px; }
  .s-controls-row .s-wide { min-width: 90px; }
  .s-controls-row .s-fret-label { font-size: 0.72rem; }
}

@media (max-width: 400px) {
  body { padding: 8px; }
  .app-container { border-radius: 10px; padding: 16px 8px 20px; }
  .chord-grid { gap: 8px; }
  .chord-card { padding: 10px 3px 6px; }
  .chord-canvas { width: 150px; height: 190px; display: block; }
  .root-select { padding: 8px 10px; font-size: 0.75rem; }
  .chord-search-input { padding: 8px 10px; font-size: 0.75rem; }
  .chord-search-btn { padding: 8px 10px; font-size: 0.85rem; }
  .tab-btn { padding: 7px 4px; font-size: 0.68rem; white-space: nowrap; width: auto; }
}

@media (max-width: 340px) {
  .chord-canvas { width: 140px; height: 180px; display: block; }
  .chord-card { padding: 8px 2px 4px; }
}

/* ==================== 和声进行页面 ==================== */
.prog-container { display: flex; flex-direction: column; gap: 16px; }

.prog-controls { background: #faf6ef; border-radius: 12px; padding: 16px; }
.prog-controls-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.prog-controls-row label { font-weight: 600; font-size: 0.78rem; color: #888; }
.prog-select { background: #fff; border: 1px solid #e0d8cc; padding: 8px 14px; border-radius: 18px; font-size: 0.85rem; cursor: pointer; outline: none; }
.prog-preset-wide { min-width: 180px; }
.prog-add-row { display: flex; gap: 8px; }
.prog-chord-input { flex: 1; min-width: 100px; padding: 8px 14px; border: 1px solid #e0d8cc; border-radius: 18px; font-size: 0.85rem; outline: none; background: #fff; }
.prog-chord-input:focus { border-color: #3a5a40; }

.prog-btn { border: none; padding: 8px 16px; border-radius: 18px; font-weight: 600; font-size: 0.82rem; cursor: pointer; transition: all 0.2s; }
.prog-btn:disabled { opacity: 0.4; cursor: default; }
.prog-btn-clear { background: #fff; border: 1px solid #e0d8cc; color: #c0392b; }
.prog-btn-clear:hover { background: #fde8e8; }
.prog-btn-add { background: #3a5a40; color: #fff; }
.prog-btn-add:hover { background: #4a6a50; }
.prog-btn-play { background: #3a5a40; color: #fff; }
.prog-btn-play:hover { background: #4a6a50; }
.prog-btn-stop { background: #c0392b; color: #fff; }
.prog-btn-stop:hover { background: #d94a3a; }
.prog-btn-more { background: transparent; border: 1px solid #e0d8cc; color: #888; font-size: 0.75rem; padding: 4px 12px; display: none; }
.prog-btn-more:hover { background: #f0e8dc; }

.prog-advanced { display: inline; }
.prog-advanced.open { display: inline; }

/* 和弦序列 */
.prog-chord-list { display: flex; gap: 10px; flex-wrap: wrap; padding: 4px 0; min-height: 80px; }
.prog-empty { width: 100%; text-align: center; color: #c0b8a8; padding: 24px; font-size: 0.85rem; }
.prog-chord-item { display: flex; align-items: center; gap: 8px; background: #fff; border: 1px solid #e8e2d8; border-radius: 12px; padding: 10px 12px; box-shadow: 0 1px 4px rgba(0,0,0,0.03); transition: all 0.25s; min-width: 120px; }
.prog-chord-item.prog-playing { border-color: #3a5a40; border-width: 2px; background: #f0f8f0; }
.prog-chord-item.prog-no-voicing { opacity: 0.6; }
.prog-degree { font-weight: 700; font-size: 1.1rem; color: #3a5a40; min-width: 28px; text-align: center; }
.prog-chord-info { flex: 1; }
.prog-chord-name { font-weight: 600; font-size: 0.9rem; color: #2c2c2c; }
.prog-alt-row { margin-top: 3px; }
.prog-alt-select { background: #faf6ef; border: 1px solid #e0d8cc; padding: 2px 8px; border-radius: 10px; font-size: 0.72rem; cursor: pointer; outline: none; color: #666; max-width: 80px; }
.prog-shared-badge { background: #e8f5e9; color: #2e7d32; font-size: 0.68rem; padding: 2px 8px; border-radius: 8px; font-weight: 600; white-space: nowrap; }
.prog-remove-btn { background: none; border: 1px solid transparent; color: #ccc; font-size: 0.75rem; cursor: pointer; padding: 4px 6px; border-radius: 8px; transition: all 0.15s; line-height: 1; }
.prog-remove-btn:hover { color: #c0392b; border-color: #e0d8cc; background: #fdf0ee; }

/* 播放栏 */
.prog-playback { background: #faf6ef; border-radius: 12px; padding: 14px 16px; }
.prog-playback-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.prog-bpm-group { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.prog-bpm-group label { font-weight: 600; font-size: 0.78rem; color: #888; }
.prog-bpm-slider { width: 100px; accent-color: #3a5a40; cursor: pointer; }
.prog-bpm-value { font-weight: 700; font-size: 1rem; color: #3a5a40; min-width: 30px; text-align: right; }

/* 指板图区 */
.prog-diagrams { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; padding: 4px 0 8px; }
.prog-diag-item { text-align: center; transition: all 0.25s; padding: 8px; border-radius: 12px; border: 2px solid transparent; }
.prog-diag-item.prog-playing { border-color: #3a5a40; background: #f0f8f0; }
.prog-diag-label { font-weight: 600; font-size: 0.82rem; color: #555; margin-bottom: 6px; }
.prog-diag-canvas { display: block; width: 100%; aspect-ratio: 230 / 290; max-width: 230px; margin: 0 auto; }
.prog-diag-frets { font-size: 0.72rem; color: #aaa; margin-top: 4px; font-family: monospace; }
.prog-no-result { color: #ccc; font-size: 0.78rem; padding: 40px 20px; }

@media (max-width: 540px) {
  .prog-diagrams { grid-template-columns: repeat(2, 1fr); gap: 10px; }

  .prog-btn-more { display: inline-block; }
  .prog-advanced { display: none; flex-wrap: wrap; align-items: center; gap: 6px; width: 100%; padding: 8px 0; border-top: 1px solid #e8e0d4; margin-top: 6px; }
  .prog-advanced.open { display: flex; }
  .prog-advanced label { font-weight: 600; font-size: 0.72rem; color: #888; }
  .prog-advanced .prog-select { font-size: 0.75rem; padding: 6px 10px; }
  .prog-advanced .prog-btn-more { margin-left: auto; }
}

/* ==================== 音阶参考页面 ==================== */
.scale-container { display: flex; flex-direction: column; gap: 12px; }
.s-controls-row { background: #faf6ef; border-radius: 12px; padding: 12px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.s-controls-row label { font-weight: 600; font-size: 0.76rem; color: #888; white-space: nowrap; }
.s-select { background: #fff; border: 1px solid #e0d8cc; padding: 6px 10px; border-radius: 14px; font-size: 0.8rem; cursor: pointer; outline: none; }
.s-wide { min-width: 130px; }
.s-dir { min-width: 70px; }
.s-fret-label { font-weight: 700; font-size: 0.85rem; color: #3a5a40; margin-left: auto; white-space: nowrap; }
/* s-fret-stepper removed, using scrollbar instead */

.s-canvas-wrap { background: #fdfaf5; border-radius: 12px; padding: 8px; overflow-x: auto; }
.s-canvas-wrap canvas { display: block; cursor: pointer; }

.s-info { background: #fff; border-radius: 10px; padding: 10px 14px; }
.s-label-toggle { display: flex; gap: 6px; margin-bottom: 6px; }
.s-toggle { background: #fff; border: 1px solid #e0d8cc; padding: 4px 14px; border-radius: 14px; font-size: 0.78rem; font-weight: 600; color: #888; cursor: pointer; transition: all 0.15s; }
.s-toggle.active { background: #3a5a40; border-color: #3a5a40; color: #fff; }
.s-toggle:hover { background: #f0e8dc; }
.s-toggle.active:hover { background: #4a6a50; }
.s-notes-row { display: flex; gap: 5px; flex-wrap: wrap; align-items: center; }
.s-note-chip { background: #f5f0e8; padding: 3px 10px; border-radius: 12px; font-size: 0.82rem; font-weight: 600; color: #555; transition: all 0.1s ease; }
.s-note-root { background: #3a5a40; color: #fff; }
.s-note-playing { background: #e67e22; color: #fff; transform: scale(1.12); }
.s-note-count { font-size: 0.75rem; color: #bbb; }

.s-play-row { background: #faf6ef; border-radius: 12px; padding: 10px 14px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.s-play-row label { font-weight: 600; font-size: 0.76rem; color: #888; white-space: nowrap; }
.s-bpm-slider { width: 90px; accent-color: #3a5a40; cursor: pointer; }
.s-bpm-val { font-weight: 700; font-size: 0.95rem; color: #3a5a40; min-width: 28px; text-align: right; }
.s-btn { border: none; padding: 7px 14px; border-radius: 18px; font-weight: 600; font-size: 0.8rem; cursor: pointer; transition: all 0.2s; }
.s-btn:disabled { opacity: 0.4; cursor: default; }
.s-play { background: #3a5a40; color: #fff; }
.s-play:hover { background: #4a6a50; }
.s-stop { background: #c0392b; color: #fff; }
.s-stop:hover { background: #d94a3a; }

@media (max-width: 540px) {
  .s-controls-row { gap: 4px; padding: 8px; }
  .s-select { font-size: 0.7rem; padding: 4px 8px; }
  .s-wide { min-width: 90px; }
}

/* ==================== 工具页面 ==================== */
.tools-container { display: flex; flex-direction: column; gap: 16px; }
.tools-section { background: #fff; border-radius: 12px; padding: 16px; box-shadow: 0 1px 6px rgba(0,0,0,0.04); }
.tools-section-title { font-size: 1rem; color: #3a5a40; margin-bottom: 12px; font-weight: 700; }

/* 节拍器 */
.metro-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.metro-row label { font-weight: 600; font-size: 0.78rem; color: #888; }
.metro-slider { width: 130px; accent-color: #3a5a40; cursor: pointer; }
.metro-bpm-val { font-weight: 700; font-size: 1.2rem; color: #3a5a40; min-width: 36px; text-align: right; }
.metro-unit { font-size: 0.78rem; color: #aaa; }
.metro-btn { border: none; padding: 7px 14px; border-radius: 18px; font-weight: 600; font-size: 0.8rem; cursor: pointer; transition: all 0.2s; }
.metro-btn:disabled { opacity: 0.4; cursor: default; }
.metro-play { background: #3a5a40; color: #fff; }
.metro-play:hover { background: #4a6a50; }
.metro-stop { background: #c0392b; color: #fff; }
.metro-stop:hover { background: #d94a3a; }
.metro-indicator { display: flex; gap: 8px; justify-content: center; margin-top: 12px; }
.metro-dot { width: 20px; height: 20px; border-radius: 50%; background: #e8e0d4; transition: all 0.08s; }
.metro-dot.active { background: #3a5a40; transform: scale(1.3); }
.metro-dot.active:first-child { background: #e67e22; }

/* 调音器 */
.tuner-status { text-align: center; }
.tuner-note { font-size: 3rem; font-weight: 700; color: #2c2c2c; margin: 8px 0 4px; }
.tuner-octave { font-size: 1rem; color: #888; }
.tuner-meter { width: 100%; max-width: 300px; height: 12px; background: #e8e0d4; border-radius: 6px; margin: 10px auto; position: relative; overflow: hidden; }
.tuner-meter::after { content: ''; position: absolute; left: 50%; top: 0; width: 2px; height: 100%; background: #888; transform: translateX(-50%); }
.tuner-meter-bar { height: 100%; width: 0%; border-radius: 6px; transition: width 0.05s; background: #e67e22; }
.tuner-cents { font-size: 0.85rem; color: #bbb; margin-bottom: 10px; }
.tuner-ref { text-align: center; font-size: 0.75rem; color: #bbb; margin-top: 8px; font-family: monospace; }

/* ==================== 关于页面 ==================== */
.about-container { max-width: 500px; margin: 0 auto; padding: 24px 8px; }
.about-title { text-align: center; font-size: 1.3rem; color: #3a5a40; margin-bottom: 24px; }
.about-section { margin-bottom: 20px; }
.about-section h3 { font-size: 0.85rem; color: #888; margin-bottom: 8px; font-weight: 600; }
.about-list { list-style: none; padding: 0; }
.about-list li { padding: 5px 0; font-size: 0.85rem; color: #555; line-height: 1.5; }
.about-list li b { color: #3a5a40; }
.about-list a { color: #3a5a40; text-decoration: underline; }
.about-version { text-align: center; padding-top: 12px; }
.about-badge { background: #3a5a40; color: #fff; padding: 3px 14px; border-radius: 12px; font-size: 0.8rem; font-weight: 700; margin-right: 8px; }
.about-date { font-size: 0.78rem; color: #bbb; }
.about-donate { text-align: center; }
.about-donate-text { font-size: 0.85rem; color: #888; }
.about-donate-text small { color: #bbb; }
.about-qrcode { margin: 12px auto; max-width: 200px; }
.about-qrcode img { width: 100%; border-radius: 12px; box-shadow: 0 2px 12px rgba(0,0,0,0.08); }

/* ==================== 节奏编辑 ==================== */
.prog-rhythm { background: #faf6ef; border-radius: 12px; padding: 12px 14px; margin-top: 8px; }
.prog-rhythm-header { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.prog-rhythm-toggle { display: flex; align-items: center; gap: 4px; font-size: 0.85rem; cursor: pointer; font-weight: 600; color: #555; }
.prog-rhythm-toggle input[type="checkbox"] { width: 18px; height: 18px; accent-color: #3a5a40; cursor: pointer; }
.prog-rhythm-grid { display: flex; flex-direction: column; gap: 6px; padding: 6px 0; }
.rhythm-row { display: flex; gap: 4px; margin-bottom: 4px; }
.rhythm-beat { display: flex; gap: 3px; flex: 1; }
.rhythm-cell { flex: 1; aspect-ratio: 1; background: #e8e2d8; border-radius: 6px; cursor: pointer; transition: all 0.15s; display: flex; align-items: center; justify-content: center; font-size: 0.6rem; color: #ccc; min-height: 32px; border: 1px solid transparent; }
.rhythm-cell.on { background: #3a5a40; border-color: #2a4a30; color: #fff; }
.rhythm-cell:active { transform: scale(0.92); }

@media (max-width: 540px) {
  .prog-rhythm-grid { gap: 4px; padding-bottom: 4px; }
  .rhythm-beat { min-width: 60px; }
  .rhythm-cell { min-height: 22px; font-size: 0.5rem; }
}

/* ==================== 和弦图放大 ==================== */
.chord-zoom-btn { position: absolute; top: 4px; right: 4px; background: rgba(0,0,0,0.35); border: none; border-radius: 14px; width: 28px; height: 28px; font-size: 0.75rem; cursor: pointer; display: flex; align-items: center; justify-content: center; color: #fff; z-index: 2; line-height: 1; }
.chord-zoom-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 2000; background: rgba(0,0,0,0.6); display: flex; align-items: center; justify-content: center; cursor: pointer; animation: fadeIn 0.2s; }
.chord-zoom-card { background: #fffbf5; border-radius: 20px; padding: 16px; box-shadow: 0 12px 48px rgba(0,0,0,0.3); text-align: center; max-width: 320px; width: 85vw; }
.chord-zoom-card canvas { width: 240px; height: 264px; display: block; margin: 0 auto; }
.chord-zoom-label { margin-top: 10px; font-weight: 600; font-size: 0.9rem; color: #555; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ==================== 辅助 ==================== */
input, select, button, textarea { font-size: 16px; }
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d8d0c0; border-radius: 2px; }
::selection { background: rgba(58,90,64,0.12); color: #2c2c2c; }

@media print {
  body { background: #fff; }
  .app-container { box-shadow: none; }
  .search-panel, .pagination-bar, .tab-nav { display: none; }
  .chord-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
  .chord-card { break-inside: avoid; box-shadow: 0 0 0 1px #e0d8cc; }
}