* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #2d3436 0%, #636e72 100%);
  min-height: 100vh;
  color: #333;
}

/* 頁面頭部 */
.header {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  padding: 1.5rem 0;
  text-align: center;
  margin-bottom: 2rem;
}

.header h1 {
  color: white;
  font-size: 2.5rem;
  font-weight: 300;
  margin-bottom: 0.5rem;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.header p {
  color: rgba(255, 255, 255, 0.8);
  font-size: 1.1rem;
}

/* 主容器 */
.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 2rem;
}

/* 新增鋼琴按鈕 */
.add-piano-section {
  text-align: center;
  margin-bottom: 2rem;
}

.add-piano-btn {
  background: linear-gradient(45deg, #ff6b6b, #ee5a24);
  color: white;
  border: none;
  padding: 1rem 2rem;
  border-radius: 50px;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 8px 25px rgba(255, 107, 107, 0.3);
}

.add-piano-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 35px rgba(255, 107, 107, 0.4);
}

.add-piano-btn i {
  margin-right: 0.5rem;
}

/* 鋼琴容器樣式重新設計 */
.piano-container {
  position: relative;
  margin: 2rem 0;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  border-radius: 24px;
  padding: 2rem;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.1), 0 8px 25px rgba(0, 0, 0, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.2);
  transition: all 0.3s ease;
}

.piano-container:hover {
  transform: translateY(-5px);
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.15), 0 12px 35px rgba(0, 0, 0, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

/* 保持原有鋼琴鍵盤樣式 */
:root {
  --white-key-width: calc(100% / 52);
  --black-key-width: calc(var(--white-key-width) * 0.6);
  --white-key-height: 160px;
  --black-key-height: 100px;
}

.white-keys {
  position: relative;
  display: flex;
  width: 100%;
  height: var(--white-key-height);
  margin: 1rem 0;
}

.white-key {
  width: var(--white-key-width);
  height: var(--white-key-height);
  background: white;
  border: 1px solid black;
  box-sizing: border-box;
  z-index: 1;
  position: relative;
  /* 修改：調整白鍵的佈局方式 */
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 10px;
  cursor: pointer;
}

.black-key {
  position: absolute;
  width: var(--black-key-width);
  height: var(--black-key-height);
  background-color: black;
  border-radius: 2px;
  z-index: 2;
  pointer-events: auto;
}

div.pressed {
  background-color: #33bae3 !important;
}

div.no-sound-pressed {
  background-color: #e74c3c !important;
}

.disabled {
  opacity: 0.4;
  pointer-events: none;
}

/* 控制面板重新設計 */
.piano-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid #f0f0f0;
}

.piano-title {
  font-size: 1.4rem;
  font-weight: 600;
  color: #2c3e50;
  display: flex;
  align-items: center;
}

.piano-title i {
  margin-right: 0.5rem;
  color: #3498db;
}

.delete-btn {
  background: linear-gradient(45deg, #e74c3c, #c0392b);
  color: white;
  border: none;
  padding: 0.7rem 1.5rem;
  border-radius: 25px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(231, 76, 60, 0.3);
}

.delete-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(231, 76, 60, 0.4);
}

.delete-btn i {
  margin-right: 0.5rem;
}

/* 控制面板網格布局 */
.controls-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
  margin-top: 1.5rem;
}

/* 更新控制面板結構 */
.control-section {
  background: rgba(255, 255, 255, 0.6);
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  backdrop-filter: blur(10px);
  overflow: hidden;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

.control-section:hover {
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
}

.control-section.collapsed {
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.control-section.collapsed:hover {
  transform: translateY(-1px);
}

/* 控制面板標題欄 */
.control-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem;
  background: rgba(255, 255, 255, 0.4);
  border-bottom: 1px solid rgba(255, 255, 255, 0.3);
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  z-index: 2;
}

.control-header:hover {
  background: rgba(255, 255, 255, 0.6);
}

.control-header h3 {
  color: #2c3e50;
  font-size: 1.1rem;
  margin: 0;
  display: flex;
  align-items: center;
  user-select: none;
  pointer-events: none;
  transition: color 0.3s ease;
}

.control-header h3 i {
  margin-right: 0.5rem;
  color: #3498db;
  pointer-events: none;
}

/* 齒輪樣式的摺疊按鈕 */
.toggle-btn {
  background: rgba(52, 152, 219, 0.1);
  border: 2px solid rgba(52, 152, 219, 0.3);
  color: #3498db;
  padding: 0.5rem;
  border-radius: 50%;
  cursor: pointer;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  font-size: 0.9rem;
  z-index: 10;
  position: relative;
  pointer-events: auto;
  overflow: hidden;
}

.toggle-btn:hover {
  background: rgba(52, 152, 219, 0.2);
  border-color: rgba(52, 152, 219, 0.5);
  transform: scale(1.1);
  box-shadow: 0 4px 15px rgba(52, 152, 219, 0.3);
}

.toggle-btn:focus {
  outline: 2px solid #3498db;
  outline-offset: 2px;
}

.toggle-btn:active {
  transform: scale(0.95);
  background: rgba(52, 152, 219, 0.3);
}

/* 齒輪圖示樣式 */
.toggle-btn i {
  transition: transform 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  pointer-events: none;
  font-size: 1rem;
}

/* 點擊時的旋轉動畫 */
.toggle-btn.rotating i {
  transform: rotate(180deg);
}

/* 展開狀態的齒輪顏色變化 */
.control-section:not(.collapsed) .toggle-btn {
  background: rgba(46, 204, 113, 0.1);
  border-color: rgba(46, 204, 113, 0.3);
  color: #27ae60;
}

.control-section:not(.collapsed) .toggle-btn:hover {
  background: rgba(46, 204, 113, 0.2);
  border-color: rgba(46, 204, 113, 0.5);
  box-shadow: 0 4px 15px rgba(46, 204, 113, 0.3);
}

/* 收起狀態的齒輪（稍微暗一些） */
.control-section.collapsed .toggle-btn {
  background: rgba(149, 165, 166, 0.1);
  border-color: rgba(149, 165, 166, 0.3);
  color: #95a5a6;
}

.control-section.collapsed .toggle-btn:hover {
  background: rgba(149, 165, 166, 0.2);
  border-color: rgba(149, 165, 166, 0.5);
  box-shadow: 0 4px 15px rgba(149, 165, 166, 0.3);
}

/* 特殊的齒輪旋轉動畫 */
@keyframes gearRotate {
  0% {
    transform: rotate(0deg);
  }
  25% {
    transform: rotate(90deg) scale(1.1);
  }
  50% {
    transform: rotate(180deg) scale(1.05);
  }
  75% {
    transform: rotate(270deg) scale(1.1);
  }
  100% {
    transform: rotate(360deg);
  }
}

.toggle-btn.gear-animate i {
  animation: gearRotate 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* 微妙的脈衝效果 */
@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(52, 152, 219, 0.4);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(52, 152, 219, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(52, 152, 219, 0);
  }
}

.toggle-btn.pulse {
  animation: pulse 0.6s;
}

/* 齒輪背景效果（可選的裝飾） */
.toggle-btn::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 60%;
  height: 60%;
  background: linear-gradient(
    45deg,
    transparent 30%,
    rgba(52, 152, 219, 0.1) 30%,
    rgba(52, 152, 219, 0.1) 70%,
    transparent 70%
  );
  border-radius: 50%;
  transform: translate(-50%, -50%) rotate(0deg);
  transition: transform 0.5s ease;
  pointer-events: none;
  opacity: 0;
}

.toggle-btn:hover::before {
  opacity: 1;
  transform: translate(-50%, -50%) rotate(45deg);
}

/* 控制標題懸停時齒輪的預覽旋轉 */
.control-header:hover .toggle-btn i {
  transform: rotate(30deg);
}

.control-section.collapsed .control-header:hover .toggle-btn i {
  transform: rotate(-30deg);
}

/* 控制面板內容 */
.control-content {
  max-height: none;
  overflow: hidden;
  transition: max-height 0.3s ease;
  padding: 0 1.5rem 1.5rem 1.5rem;
  position: relative;
  z-index: 1;
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.3s ease 0.1s, transform 0.3s ease 0.1s,
    max-height 0.3s ease;
}

/* 摺疊狀態 */
.control-section.collapsed .control-content {
  max-height: 0;
  padding-top: 0;
  padding-bottom: 0;
  opacity: 0;
  transform: translateY(-10px);
  transition: opacity 0.2s ease, transform 0.2s ease, max-height 0.3s ease 0.1s;
}

.control-section.collapsed .control-header {
  border-bottom: none;
}

.control-section.collapsed .control-header h3 {
  color: #7f8c8d;
}

.control-section:not(.collapsed) .control-header h3 {
  color: #2c3e50;
}

/* 狀態指示器 */
.control-header::after {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: linear-gradient(45deg, #3498db, #2ecc71);
  border-radius: 0 4px 4px 0;
  opacity: 1;
  transition: opacity 0.3s ease;
}

.control-section.collapsed .control-header::after {
  opacity: 0.3;
}

/* 基本控制內容 */
.basic-controls {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1rem;
}

/* 按鈕容器 - 讓按鈕排成一排 */
.control-row.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

/* 確保按鈕在一排中均勻分布 */
.control-row.button-row .btn {
  flex: 1;
  min-width: 120px;
  white-space: nowrap;
  justify-content: center;
  text-align: center;
}

.control-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.5rem; /* 減少行間距 */
}

.control-row label {
  font-weight: 600;
  color: #2c3e50;
  min-width: 80px;
}

.control-row select,
.control-row input[type="range"] {
  flex: 1;
  padding: 0.5rem;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  background: white;
  transition: all 0.3s ease;
}

.control-row select:focus,
.control-row input[type="range"]:focus {
  outline: none;
  border-color: #3498db;
  box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

/* 滑桿樣式 */
input[type="range"] {
  -webkit-appearance: none;
  height: 8px;
  border-radius: 4px;
  background: linear-gradient(90deg, #3498db, #2ecc71);
  outline: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: white;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
  border: 3px solid #3498db;
}

/* 按鈕樣式 */
.btn {
  padding: 0.7rem 1.5rem;
  border: none;
  border-radius: 25px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-primary {
  background: linear-gradient(45deg, #3498db, #2980b9);
  color: white;
  box-shadow: 0 4px 15px rgba(52, 152, 219, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(52, 152, 219, 0.4);
}

.btn-success {
  background: linear-gradient(45deg, #2ecc71, #27ae60);
  color: white;
  box-shadow: 0 4px 15px rgba(46, 204, 113, 0.3);
}

.btn-success:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(46, 204, 113, 0.4);
}

.btn-warning {
  background: linear-gradient(45deg, #f39c12, #e67e22);
  color: white;
  box-shadow: 0 4px 15px rgba(243, 156, 18, 0.3);
}

.btn-warning:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(243, 156, 18, 0.4);
}

.btn.active {
  background: linear-gradient(45deg, #9b59b6, #8e44ad);
  color: white;
  box-shadow: 0 4px 15px rgba(155, 89, 182, 0.3);
}

/* MIDI 控制區域 */
.midi-controls {
  margin-top: 1rem;
}

.midi-upload {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

/* 統一的檔案輸入包裝器 */
.file-input-wrapper {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.file-input-wrapper input[type="file"] {
  position: absolute;
  left: -9999px;
}

/* 統一的按鈕樣式 */
.file-input-label,
.audio-folder-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1.5rem;
  background: linear-gradient(45deg, #3498db, #2980b9);
  color: white;
  border: none;
  border-radius: 25px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-weight: 600;
  box-shadow: 0 4px 15px rgba(52, 152, 219, 0.3);
  text-decoration: none;
  font-size: 0.9rem;
  white-space: nowrap;
  min-width: 160px;
  justify-content: center;
}

.file-input-label:hover,
.audio-folder-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(52, 152, 219, 0.4);
  background: linear-gradient(45deg, #2980b9, #3498db);
}

.audio-folder-btn {
  margin-left: 0.5rem;
}

.midi-status {
  padding: 0.5rem 1rem;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 20px;
  border: 2px solid #e0e0e0;
  font-weight: 600;
}

.midi-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* 載入動畫 */
.loading-spinner {
  display: none;
  width: 40px;
  height: 40px;
  border: 4px solid #f3f3f3;
  border-top: 4px solid #3498db;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 1rem auto;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* 錯誤訊息 */
.error-log {
  background: rgba(231, 76, 60, 0.1);
  color: #e74c3c;
  padding: 1rem;
  border-radius: 12px;
  border: 1px solid rgba(231, 76, 60, 0.3);
  margin-bottom: 1rem;
  display: none;
}

.error-log.show {
  display: block;
}

/* 響應式設計 */
@media (max-width: 768px) {
  .container {
    padding: 0 1rem;
  }

  .header h1 {
    font-size: 2rem;
  }

  .piano-container {
    padding: 1rem;
  }

  .controls-grid {
    grid-template-columns: 1fr;
  }

  .piano-header {
    flex-direction: column;
    gap: 1rem;
    align-items: stretch;
  }

  /* 手機版按鈕樣式 */
  .file-input-wrapper {
    flex-direction: column;
    align-items: stretch;
  }

  .file-input-label,
  .audio-folder-btn {
    margin-left: 0;
    margin-top: 0.5rem;
    min-width: auto;
    width: 100%;
  }

  .audio-folder-btn {
    margin-top: 0.5rem;
  }

  /* 齒輪按鈕響應式調整 */
  .control-header {
    padding: 1rem;
  }

  .control-content {
    padding: 0 1rem 1rem 1rem;
  }

  .control-header h3 {
    font-size: 1rem;
  }

  .toggle-btn {
    width: 35px;
    height: 35px;
    font-size: 0.8rem;
  }

  .toggle-btn i {
    font-size: 0.9rem;
  }
}

/* 鍵盤提示 */
.keyboard-hint {
  background: rgba(255, 255, 255, 0.6);
  padding: 1rem;
  border-radius: 12px;
  margin-top: 1rem;
  text-align: center;
  color: #2c3e50;
  font-size: 0.9rem;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.keyboard-hint strong {
  color: #3498db;
}

/* 互動式 MIDI 檔案選擇器 */

/* 遮罩層 */
.midi-selector-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(5px);
  z-index: 10000;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.midi-selector-overlay.show {
  opacity: 1;
}

/* 對話框 */
.midi-selector-dialog {
  background: white;
  border-radius: 20px;
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.3);
  max-width: 800px;
  width: 90%;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  transform: scale(0.9);
  transition: transform 0.3s ease;
}

.midi-selector-overlay.show .midi-selector-dialog {
  transform: scale(1);
}

/* 對話框標題 */
.midi-selector-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem 2rem;
  border-bottom: 2px solid #f0f0f0;
  background: linear-gradient(135deg, #3498db, #2980b9);
  color: white;
  border-radius: 20px 20px 0 0;
}

.midi-selector-header h3 {
  margin: 0;
  font-size: 1.3rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.close-btn {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  padding: 0.5rem;
  border-radius: 50%;
  cursor: pointer;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.close-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.1);
}

/* 對話框內容 */
.midi-selector-content {
  flex: 1;
  padding: 1.5rem 2rem;
  overflow-y: auto;
}

/* 檔案網格 */
.midi-files-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
  max-height: 400px;
  overflow-y: auto;
  padding: 0.5rem;
}

/* 檔案卡片 */
.midi-file-card {
  background: linear-gradient(135deg, #f8f9fa, #e9ecef);
  border: 2px solid #e9ecef;
  border-radius: 12px;
  padding: 1rem;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  position: relative;
  overflow: hidden;
}

.midi-file-card:hover {
  border-color: #3498db;
  box-shadow: 0 8px 25px rgba(52, 152, 219, 0.15);
  transform: translateY(-2px);
}

.midi-file-card.selected {
  border-color: #2ecc71;
  background: linear-gradient(135deg, #d5f4e6, #a8e6cf);
  box-shadow: 0 8px 25px rgba(46, 204, 113, 0.25);
}

/* 檔案圖示 */
.file-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  margin-bottom: 0.5rem;
}

.file-icon i {
  font-size: 2.5rem;
  color: #3498db;
  transition: color 0.3s ease;
}

.midi-file-card:hover .file-icon i,
.midi-file-card.selected .file-icon i {
  color: #2ecc71;
}

.file-type {
  position: absolute;
  bottom: -5px;
  right: -5px;
  background: #3498db;
  color: white;
  font-size: 0.7rem;
  padding: 0.2rem 0.4rem;
  border-radius: 8px;
  font-weight: 600;
}

.midi-file-card.selected .file-type {
  background: #2ecc71;
}

/* 檔案資訊 */
.file-info {
  text-align: center;
  flex: 1;
}

.file-name {
  font-weight: 600;
  color: #2c3e50;
  font-size: 0.9rem;
  margin-bottom: 0.25rem;
  word-break: break-all;
  line-height: 1.3;
}

.file-meta {
  color: #7f8c8d;
  font-size: 0.8rem;
}

/* 檔案操作 */
.file-actions {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.mini-btn {
  padding: 0.4rem 0.8rem;
  border: none;
  border-radius: 15px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  min-width: 35px;
  height: 35px;
}

.preview-btn {
  background: linear-gradient(45deg, #9b59b6, #8e44ad);
  color: white;
  box-shadow: 0 2px 8px rgba(155, 89, 182, 0.3);
}

.preview-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 3px 12px rgba(155, 89, 182, 0.4);
}

.select-btn {
  background: linear-gradient(45deg, #2ecc71, #27ae60);
  color: white;
  box-shadow: 0 2px 8px rgba(46, 204, 113, 0.3);
}

.select-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 3px 12px rgba(46, 204, 113, 0.4);
}

/* 對話框底部 */
.midi-selector-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem 2rem;
  border-top: 2px solid #f0f0f0;
  background: #f8f9fa;
  border-radius: 0 0 20px 20px;
}

.file-count {
  color: #7f8c8d;
  font-weight: 600;
}

.selector-buttons {
  display: flex;
  gap: 1rem;
}

.btn-secondary {
  background: linear-gradient(45deg, #95a5a6, #7f8c8d);
  color: white;
  box-shadow: 0 4px 15px rgba(149, 165, 166, 0.3);
}

.btn-secondary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(149, 165, 166, 0.4);
}

/* MIDI 預覽對話框 */
.midi-preview-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(5px);
  z-index: 10001;
  display: flex;
  justify-content: center;
  align-items: center;
}

.midi-preview-dialog {
  background: white;
  border-radius: 16px;
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.3);
  max-width: 500px;
  width: 90%;
  max-height: 70vh;
  overflow-y: auto;
}

.preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  background: linear-gradient(135deg, #9b59b6, #8e44ad);
  color: white;
  border-radius: 16px 16px 0 0;
}

.preview-header h4 {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.1rem;
}

.close-preview-btn {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  padding: 0.4rem;
  border-radius: 50%;
  cursor: pointer;
  width: 35px;
  height: 35px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.close-preview-btn:hover {
  background: rgba(255, 255, 255, 0.3);
}

.preview-content {
  padding: 1.5rem;
}

.preview-info {
  margin-bottom: 1.5rem;
}

.info-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0;
  border-bottom: 1px solid #f0f0f0;
}

.info-item:last-child {
  border-bottom: none;
}

.info-label {
  font-weight: 600;
  color: #2c3e50;
}

.info-value {
  color: #3498db;
  font-weight: 600;
}

.preview-tracks h5 {
  color: #2c3e50;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.track-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.4rem 0;
  border-bottom: 1px solid #f8f9fa;
}

.track-name {
  font-weight: 600;
  color: #34495e;
}

.track-notes {
  color: #7f8c8d;
  font-size: 0.9rem;
}

.preview-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid #f0f0f0;
  display: flex;
  justify-content: center;
}

.select-this-btn {
  background: linear-gradient(45deg, #2ecc71, #27ae60);
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 25px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: 0 4px 15px rgba(46, 204, 113, 0.3);
}

.select-this-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(46, 204, 113, 0.4);
}

/* 高級效果：漸層邊框 */
.control-section::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    135deg,
    rgba(52, 152, 219, 0.1),
    rgba(46, 204, 113, 0.1)
  );
  border-radius: 16px;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
  z-index: -1;
}

.control-section:hover::before {
  opacity: 1;
}

/* 確保內容在 z-index 上方 */
.control-header,
.control-content {
  position: relative;
  z-index: 1;
}

/* 確保摺疊按鈕在所有狀態下都可以點擊 */
.toggle-btn,
.control-header {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  -khtml-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

/* 對話框響應式設計 */
@media (max-width: 768px) {
  .midi-selector-dialog {
    width: 95%;
    margin: 0.5rem;
  }

  .midi-selector-header,
  .midi-selector-content,
  .midi-selector-footer {
    padding: 1rem;
  }

  .midi-files-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .midi-file-card {
    padding: 0.75rem;
  }

  .selector-buttons {
    flex-direction: column;
    gap: 0.5rem;
  }

  .midi-selector-footer {
    flex-direction: column;
    gap: 1rem;
    align-items: stretch;
  }

  .midi-preview-dialog {
    width: 95%;
    margin: 0.5rem;
  }

  .preview-header,
  .preview-content,
  .preview-footer {
    padding: 1rem;
  }
}

/* 滾動條美化 */
.midi-files-grid::-webkit-scrollbar,
.midi-preview-dialog::-webkit-scrollbar {
  width: 8px;
}

.midi-files-grid::-webkit-scrollbar-track,
.midi-preview-dialog::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.5);
  border-radius: 4px;
}

.midi-files-grid::-webkit-scrollbar-thumb,
.midi-preview-dialog::-webkit-scrollbar-thumb {
  background: rgba(52, 152, 219, 0.5);
  border-radius: 4px;
}

.midi-files-grid::-webkit-scrollbar-thumb:hover,
.midi-preview-dialog::-webkit-scrollbar-thumb:hover {
  background: rgba(52, 152, 219, 0.7);
}

/* 🎹 琴鍵標籤樣式 - 高音點在上方，低音點在下方 */
.key-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  user-select: none;
  pointer-events: none;
  z-index: 3;
  transition: all 0.2s ease;
  position: relative;
}

.numbered-notation {
  font-size: 18px;
  font-weight: 700;
  color: #3498db;
  text-shadow: 0 1px 3px rgba(255, 255, 255, 0.8);
  transition: all 0.2s ease;
  position: relative;
  /* 為上下標記預留空間 */
  margin: 12px 0;
}

/* 高音八度標記 - 在數字上方 */
.octave-mark[data-type="high"] {
  position: absolute;
  top: -5px;
  left: 50%;
  transform: translateX(-50%);
  color: #292828;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 1px;
  transition: all 0.2s ease;
  line-height: 1;
  white-space: nowrap;
}

/* 低音八度標記 - 在數字下方 */
.octave-mark[data-type="low"] {
  position: absolute;
  bottom: -5px;
  left: 50%;
  transform: translateX(-50%);
  color: #403f3f;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 1px;
  transition: all 0.2s ease;
  line-height: 1;
  white-space: nowrap;
}

/* 按鍵懸停效果 */
.white-key:hover .numbered-notation {
  color: #2980b9;
  transform: scale(1.1);
}

.white-key:hover .octave-mark[data-type="high"] {
  color: #c0392b;
  transform: translateX(-50%) scale(1.1);
}

.white-key:hover .octave-mark[data-type="low"] {
  color: #2980b9;
  transform: translateX(-50%) scale(1.1);
}

/* 按鍵按下時的樣式變化 */
.white-key.pressed .numbered-notation {
  color: white;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.6);
  transform: scale(1.2);
}

.white-key.pressed .octave-mark[data-type="high"] {
  color: rgba(255, 255, 255, 0.9);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  transform: translateX(-50%) scale(1.1);
}

.white-key.pressed .octave-mark[data-type="low"] {
  color: rgba(255, 255, 255, 0.9);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  transform: translateX(-50%) scale(1.1);
}

.white-key.no-sound-pressed .numbered-notation {
  color: white;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.6);
  transform: scale(1.1);
}

.white-key.no-sound-pressed .octave-mark[data-type="high"],
.white-key.no-sound-pressed .octave-mark[data-type="low"] {
  color: rgba(255, 255, 255, 0.8);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  transform: translateX(-50%) scale(1.05);
}

/* 中央C (C4) 特殊標示 */
.white-key[data-number="60"] .numbered-notation {
  color: #e74c3c;
  font-weight: 800;
  text-decoration: underline;
  text-decoration-color: #e74c3c;
  text-decoration-thickness: 2px;
  text-underline-offset: 2px;
}

.white-key[data-number="60"] .key-label::after {
  content: "中央C";
  position: absolute;
  bottom: -25px;
  font-size: 8px;
  color: #e74c3c;
  font-weight: 600;
  white-space: nowrap;
}

/* 數字標記的動畫效果 */
@keyframes numberPulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.15);
  }
  100% {
    transform: scale(1);
  }
}

.white-key.pressed .numbered-notation {
  animation: numberPulse 0.3s ease-out;
}

/* 八度標記的脈衝動畫 - 高音 */
@keyframes octavePulseHigh {
  0% {
    transform: translateX(-50%) scale(1);
  }
  50% {
    transform: translateX(-50%) scale(1.3) translateY(-2px);
  }
  100% {
    transform: translateX(-50%) scale(1);
  }
}

/* 八度標記的脈衝動畫 - 低音 */
@keyframes octavePulseLow {
  0% {
    transform: translateX(-50%) scale(1);
  }
  50% {
    transform: translateX(-50%) scale(1.3) translateY(2px);
  }
  100% {
    transform: translateX(-50%) scale(1);
  }
}

.white-key.pressed .octave-mark[data-type="high"] {
  animation: octavePulseHigh 0.3s ease-out;
}

.white-key.pressed .octave-mark[data-type="low"] {
  animation: octavePulseLow 0.3s ease-out;
}

/* 確保黑鍵在數字之上 */
.black-key {
  z-index: 4;
}

/* 特殊效果：高音和低音的光暈效果 */
.octave-mark[data-type="high"]::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 120%;
  height: 120%;
  background: radial-gradient(
    circle,
    rgba(231, 76, 60, 0.2) 0%,
    transparent 70%
  );
  border-radius: 50%;
  z-index: -1;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.octave-mark[data-type="low"]::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 120%;
  height: 120%;
  background: radial-gradient(
    circle,
    rgba(52, 152, 219, 0.2) 0%,
    transparent 70%
  );
  border-radius: 50%;
  z-index: -1;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.white-key:hover .octave-mark[data-type="high"]::before,
.white-key:hover .octave-mark[data-type="low"]::before {
  opacity: 1;
}

/* 簡譜數字切換按鈕樣式 */
[id^="numbered-notation-"] {
  background: linear-gradient(45deg, #8e44ad, #9b59b6);
  color: white;
  box-shadow: 0 4px 15px rgba(142, 68, 173, 0.3);
}

[id^="numbered-notation-"]:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(142, 68, 173, 0.4);
}

[id^="numbered-notation-"].active {
  background: linear-gradient(45deg, #27ae60, #2ecc71);
  box-shadow: 0 4px 15px rgba(39, 174, 96, 0.3);
}

[id^="numbered-notation-"].active:hover {
  box-shadow: 0 6px 20px rgba(39, 174, 96, 0.4);
}

/* 響應式調整 */
@media (max-width: 1200px) {
  .numbered-notation {
    font-size: 16px;
    margin: 10px 0;
  }

  .octave-mark[data-type="high"] {
    font-size: 11px;
    top: -10px;
  }

  .octave-mark[data-type="low"] {
    font-size: 11px;
    bottom: -10px;
  }
}

@media (max-width: 768px) {
  .white-key {
    padding-bottom: 6px;
  }

  .numbered-notation {
    font-size: 14px;
    margin: 8px 0;
  }

  .octave-mark[data-type="high"] {
    font-size: 10px;
    top: -8px;
  }

  .octave-mark[data-type="low"] {
    font-size: 10px;
    bottom: -8px;
  }

  .white-key[data-number="60"] .key-label::after {
    font-size: 6px;
    bottom: -20px;
  }
}

@media (max-width: 480px) {
  .numbered-notation {
    font-size: 12px;
    margin: 6px 0;
  }

  .octave-mark[data-type="high"] {
    font-size: 9px;
    top: -6px;
  }

  .octave-mark[data-type="low"] {
    font-size: 9px;
    bottom: -6px;
  }

  .white-key {
    padding-bottom: 4px;
  }
}

/* MIDI簡譜顯示區域 */
.notation-display {
  background: linear-gradient(135deg, #f8f9fa, #e9ecef);
  border: 2px solid #dee2e6;
  border-radius: 15px;
  padding: 20px;
  margin: 15px 0;
  min-height: 120px;
  position: relative;
  overflow-x: auto;
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.05);
  display: none; /* 預設隱藏，只有手動播放模式才顯示 */
}

.notation-display.active {
  display: block;
}

.notation-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  padding-bottom: 10px;
  border-bottom: 2px solid #dee2e6;
}

.notation-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: #2c3e50;
  display: flex;
  align-items: center;
  gap: 8px;
}

.notation-controls {
  display: flex;
  gap: 10px;
}

.reset-notation-btn {
  padding: 5px 12px;
  border: none;
  border-radius: 15px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.3s ease;
  background: linear-gradient(45deg, #e74c3c, #c0392b);
  color: white;
  box-shadow: 0 2px 8px rgba(231, 76, 60, 0.3);
}

.reset-notation-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(231, 76, 60, 0.4);
}

/* 簡譜音符容器 */
.notation-content {
  display: flex;
  flex-wrap: nowrap; /* 改為不換行，保持單排顯示 */
  gap: 8px;
  min-height: 60px;
  align-items: center;
  justify-content: flex-start; /* 改為靠左開始 */
  padding: 10px 0;
  padding-left: 10%; /* 新增：往右偏移10% */
  overflow-x: auto;
  overflow-y: hidden;
}

/* 音符組（同一時間點的音符） */
.note-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  min-width: 45px; /* 稍微增加寬度 */
  max-width: 45px; /* 限制最大寬度保持一致 */
  padding: 10px 8px; /* 增加上下間距 */
  border-radius: 12px; /* 稍微增加圓角 */
  background: rgba(255, 255, 255, 0.9);
  border: 2px solid transparent;
  transition: all 0.4s ease;
  position: relative;
  flex-shrink: 0; /* 防止收縮 */
}

.note-group.current {
  background: linear-gradient(135deg, #74b9ff, #0984e3);
  border-color: #0984e3;
  transform: scale(1.15); /* 稍微增加放大倍數 */
  box-shadow: 0 10px 30px rgba(116, 185, 255, 0.5);
  animation: pulse 1.5s infinite ease-in-out;
  z-index: 10; /* 確保當前音符在最上層 */
}

.note-group.played {
  background: rgba(149, 165, 166, 0.2);
  color: #95a5a6;
  transform: scale(0.85);
  opacity: 0.4;
  border-color: #bdc3c7;
  display: none; /* 已播放的音符完全隱藏 */
}

.note-group.next {
  background: rgba(46, 204, 113, 0.15);
  border-color: #2ecc71;
  transform: scale(1.02); /* 略微放大未來的音符 */
}

/* 個別音符 */
.notation-note {
  background: white;
  color: #2c3e50;
  padding: 6px 10px; /* 增加內距 */
  border-radius: 10px; /* 增加圓角 */
  font-weight: 800; /* 增加字體粗細 */
  font-size: 1.2rem; /* 增加字體大小 */
  min-width: 28px;
  text-align: center;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.15);
  position: relative;
  transition: all 0.3s ease;
}

.note-group.current .notation-note {
  background: white;
  color: #0984e3;
  animation: noteGlow 1s infinite ease-in-out alternate;
  font-size: 1.3rem; /* 當前音符更大 */
  font-weight: 900;
}

.note-group.played .notation-note {
  background: #ecf0f1;
  color: #95a5a6;
}

/* 八度標記 */
.octave-indicator {
  font-size: 0.75rem;
  color: #7f8c8d;
  margin-top: 3px;
  font-weight: 700;
  height: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.note-group.current .octave-indicator {
  color: white;
  font-size: 0.8rem;
}

/* 時間標記 */
.time-marker {
  position: absolute;
  bottom: -18px; /* 稍微往下移動 */
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.65rem;
  color: #95a5a6;
  background: rgba(255, 255, 255, 0.95);
  padding: 2px 5px;
  border-radius: 4px;
  white-space: nowrap;
  font-weight: 600;
}

/* 動畫效果 */
@keyframes noteGlow {
  0% {
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.15);
  }
  100% {
    box-shadow: 0 6px 20px rgba(116, 185, 255, 0.8);
  }
}

@keyframes slideOut {
  0% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(0.8) translateY(-10px);
    opacity: 0.7;
  }
  100% {
    transform: scale(0.6) translateY(-20px);
    opacity: 0;
  }
}

.note-group.removing {
  animation: slideOut 0.5s ease-out forwards;
}

/* 滾動條美化 */
.notation-content::-webkit-scrollbar {
  height: 6px;
}

.notation-content::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.3);
  border-radius: 3px;
}

.notation-content::-webkit-scrollbar-thumb {
  background: rgba(52, 152, 219, 0.6);
  border-radius: 3px;
}

.notation-content::-webkit-scrollbar-thumb:hover {
  background: rgba(52, 152, 219, 0.8);
}

/* 響應式設計優化 */
@media (max-width: 768px) {
  .notation-content {
    padding-left: 5%; /* 手機版減少偏移 */
    gap: 6px;
    justify-content: center;
  }

  .note-group {
    min-width: 40px;
    max-width: 40px;
    padding: 8px 6px;
  }

  .notation-note {
    font-size: 1.1rem;
    padding: 5px 8px;
  }

  .note-group.current .notation-note {
    font-size: 1.2rem;
  }
}

@media (max-width: 480px) {
  .notation-content {
    padding-left: 3%;
    gap: 4px;
  }

  .note-group {
    min-width: 35px;
    max-width: 35px;
    padding: 6px 4px;
  }

  .notation-note {
    font-size: 1rem;
    padding: 4px 6px;
  }
}

/* ===== 3. CSS 樣式 - 添加到你的主要 CSS 檔案中 ===== */

/* 歌詞顯示區域 */
.lyrics-display {
  font-size: 1rem;
  color: #333;
  padding: 0.5rem;
  margin-top: 0.5rem;
  min-height: 1.2em;
  transition: opacity 0.3s;
}

.lyrics-display.active {
  opacity: 1 !important;
  max-height: 400px !important;
  transform: translateY(0) !important;
}

/* 歌詞標題欄 */
.lyrics-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 20px;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.lyrics-title {
  display: flex;
  align-items: center;
  gap: 10px;
  color: white;
  font-weight: 600;
  font-size: 16px;
}

.lyrics-title i {
  font-size: 18px;
  color: #ffd700;
}

.lyrics-controls {
  display: flex;
  gap: 10px;
}

.lyrics-toggle-btn,
.lyrics-size-btn {
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: white;
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 5px;
}

.lyrics-toggle-btn:hover,
.lyrics-size-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: translateY(-1px);
}

.lyrics-toggle-btn.active {
  background: rgba(255, 215, 0, 0.3);
  border-color: rgba(255, 215, 0, 0.5);
  color: #ffd700;
}

/* 歌詞內容區域 */
.lyrics-content {
  padding: 20px;
  min-height: 200px;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.lyrics-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
}

/* 當前歌詞 */
.lyrics-current {
  text-align: center;
  min-height: 80px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
}

.lyric-text {
  color: white;
  font-size: 24px;
  font-weight: 600;
  line-height: 1.4;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
  margin-bottom: 8px;
  opacity: 0;
  transform: translateY(20px);
  animation: lyricFadeIn 0.6s ease forwards;
}

.lyric-index {
  color: rgba(255, 255, 255, 0.7);
  font-size: 12px;
  background: rgba(255, 255, 255, 0.1);
  padding: 4px 8px;
  border-radius: 12px;
  backdrop-filter: blur(5px);
}

/* 歌詞動畫 */
@keyframes lyricFadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.lyrics-current.lyric-animate .lyric-text {
  animation: lyricPulse 0.8s ease;
}

@keyframes lyricPulse {
  0% {
    transform: scale(1);
  }
  30% {
    transform: scale(1.05);
  }
  100% {
    transform: scale(1);
  }
}

/* 下一句歌詞預覽 */
.lyrics-preview {
  text-align: center;
  opacity: 0.7;
}

.next-lyric-label {
  color: rgba(255, 255, 255, 0.6);
  font-size: 12px;
  margin-bottom: 5px;
}

.next-lyric-text {
  color: rgba(255, 255, 255, 0.8);
  font-size: 16px;
  font-style: italic;
}

/* 無歌詞狀態 */
.no-lyrics-text {
  color: rgba(255, 255, 255, 0.6);
  font-style: italic;
  font-size: 16px;
  text-align: center;
}

/* 歌詞時間軸 */
.lyrics-timeline {
  border-top: 1px solid rgba(255, 255, 255, 0.2);
  padding-top: 15px;
  max-height: 120px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
}

.lyrics-timeline::-webkit-scrollbar {
  width: 4px;
}

.lyrics-timeline::-webkit-scrollbar-track {
  background: transparent;
}

.lyrics-timeline::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.3);
  border-radius: 2px;
}

.timeline-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 0;
  transition: all 0.3s ease;
  border-radius: 6px;
  margin: 2px 0;
}

.timeline-item.current {
  background: rgba(255, 215, 0, 0.2);
  border-left: 3px solid #ffd700;
  padding-left: 12px;
  transform: scale(1.02);
}

.timeline-item.played {
  opacity: 0.5;
}

.timeline-item.upcoming {
  opacity: 0.7;
}

.timeline-time {
  color: rgba(255, 255, 255, 0.8);
  font-size: 11px;
  font-family: "Courier New", monospace;
  min-width: 40px;
  background: rgba(255, 255, 255, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
  text-align: center;
}

.timeline-text {
  color: rgba(255, 255, 255, 0.9);
  font-size: 13px;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 字體大小變化 */
.lyrics-content.lyrics-size-small .lyric-text {
  font-size: 18px;
}

.lyrics-content.lyrics-size-medium .lyric-text {
  font-size: 24px;
}

.lyrics-content.lyrics-size-large .lyric-text {
  font-size: 30px;
}

.lyrics-content.lyrics-size-extra-large .lyric-text {
  font-size: 36px;
}

/* 小字體時調整預覽文字 */
.lyrics-content.lyrics-size-small .next-lyric-text {
  font-size: 14px;
}

.lyrics-content.lyrics-size-large .next-lyric-text {
  font-size: 18px;
}

.lyrics-content.lyrics-size-extra-large .next-lyric-text {
  font-size: 20px;
}

/* 響應式設計 */
@media (max-width: 768px) {
  .lyrics-header {
    padding: 12px 15px;
    flex-direction: column;
    gap: 10px;
    align-items: stretch;
  }

  .lyrics-controls {
    justify-content: center;
  }

  .lyrics-content {
    padding: 15px;
  }

  .lyric-text {
    font-size: 20px;
  }

  .lyrics-content.lyrics-size-large .lyric-text,
  .lyrics-content.lyrics-size-extra-large .lyric-text {
    font-size: 24px;
  }

  .timeline-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .timeline-time {
    align-self: flex-end;
  }
}

/* 歌詞載入動畫 */
.lyrics-display.loading {
  pointer-events: none;
}

.lyrics-display.loading .lyrics-content::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.1) 50%,
    transparent 100%
  );
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(100%);
  }
}

/* 高對比度模式支援 */
@media (prefers-contrast: high) {
  .lyrics-display {
    background: #000;
    border: 2px solid #fff;
  }

  .lyric-text {
    color: #fff;
    text-shadow: none;
  }

  .timeline-item.current {
    background: #333;
    border-left: 3px solid #fff;
  }
}

/* 減少動畫偏好支援 */
@media (prefers-reduced-motion: reduce) {
  .lyrics-display,
  .timeline-item,
  .lyric-text,
  .lyrics-toggle-btn,
  .lyrics-size-btn {
    transition: none;
  }

  .lyric-text {
    animation: none;
  }

  .lyrics-current.lyric-animate .lyric-text {
    animation: none;
  }
}

/* MIDI 選擇器搜尋欄 */
.midi-selector-search {
  padding: 0 2rem 1rem;
}
.midi-selector-search input {
  width: 100%;
  padding: 0.5rem 1rem;
  font-size: 1rem;
  border: 1px solid #ccc;
  border-radius: 8px;
}
