/* Grand Pianist MID→FEM 線上轉換器 — 暗色主題 */

:root {
  --bg: #14161a;
  --bg-panel: #1d2026;
  --bg-panel-alt: #23272f;
  --border: #343a44;
  --text: #e4e7ec;
  --text-dim: #9aa3b0;
  --accent: #5aa9e6;
  --accent-hover: #79bdf0;
  --danger: #e06c75;
  --radius: 8px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", "Microsoft JhengHei", "PingFang TC", system-ui, sans-serif;
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ===== 頂部 ===== */
.site-header {
  padding: 1.5rem 1.5rem 1rem;
  border-bottom: 1px solid var(--border);
}
.site-header h1 {
  margin: 0 0 .4rem;
  font-size: 1.5rem;
}
.subtitle {
  margin: 0;
  color: var(--text-dim);
  font-size: .92rem;
  max-width: 60rem;
}

/* ===== 主版面 ===== */
.layout {
  flex: 1;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* ===== 模式切換 ===== */
.top-panel {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
}
.mode-switch {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
}
.mode-btn {
  flex: 1;
  min-width: 14rem;
  padding: .7rem 1rem;
  font-size: 1rem;
  background: var(--bg-panel-alt);
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.mode-btn:hover { border-color: var(--accent); }
.mode-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #0d1117;
  font-weight: 600;
}
.mode-desc {
  margin: .75rem 0 0;
  color: var(--text-dim);
  font-size: .88rem;
}

/* ===== 參數面板 ===== */
.params {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}
.param-group {
  flex: 1;
  min-width: 15rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .75rem 1rem 1rem;
  display: flex;
  flex-direction: column;
  gap: .55rem;
}
.param-group legend {
  padding: 0 .4rem;
  color: var(--text-dim);
  font-size: .85rem;
}
.param-group label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  font-size: .9rem;
}
.param-group .checkbox-label {
  justify-content: flex-start;
}
.param-group input[type="number"],
.param-group select {
  width: 7.5rem;
  padding: .3rem .5rem;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 5px;
  font-size: .9rem;
}
.param-group input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  accent-color: var(--accent);
}
.param-note {
  color: var(--text-dim);
  font-size: .78rem;
  margin-top: -.3rem;
}

/* 模式專屬區塊的顯示/隱藏由 body[data-mode] 控制 */
body[data-mode="std"] .mode-hifi-only { display: none; }
body[data-mode="hifi"] .mode-std-only { display: none; }

/* ===== 雙欄 ===== */
.columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  align-items: start;
}
.column {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
}
.column-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  flex-wrap: wrap;
}
.column-header h2 {
  margin: 0;
  font-size: 1.1rem;
}
.column-actions {
  display: flex;
  gap: .5rem;
}

/* ===== 按鈕 ===== */
.btn {
  padding: .45rem .9rem;
  background: var(--bg-panel-alt);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: .88rem;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.btn:hover { border-color: var(--accent); }
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #0d1117;
  font-weight: 600;
}
.btn-primary:hover { background: var(--accent-hover); }
.link-btn {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  font-size: inherit;
  padding: 0 .2em;
  text-decoration: underline;
}
.icon-btn {
  background: none;
  border: 1px solid transparent;
  border-radius: 5px;
  color: var(--text-dim);
  cursor: pointer;
  font-size: .95rem;
  padding: .15rem .45rem;
  transition: color .15s, border-color .15s;
}
.icon-btn:hover { color: var(--text); border-color: var(--border); }
.icon-btn.danger:hover { color: var(--danger); }

/* ===== 拖放區 ===== */
.drop-zone {
  margin-top: .9rem;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 1.5rem 1rem;
  text-align: center;
  color: var(--text-dim);
  transition: border-color .15s, background .15s;
}
.drop-zone.dragover {
  border-color: var(--accent);
  background: rgba(90, 169, 230, .08);
  color: var(--text);
}
.drop-zone p { margin: .25rem 0; }
.drop-hint { font-size: .85rem; }

/* ===== 檔案列表 ===== */
.file-list {
  list-style: none;
  margin: .9rem 0 0;
  padding: 0;
}
.file-list li {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .45rem .25rem;
  border-bottom: 1px solid var(--border);
  font-size: .88rem;
}
.file-list li.list-head {
  color: var(--text-dim);
  font-size: .78rem;
  border-bottom: 1px solid var(--border);
}
.file-list li.file-row:hover { background: var(--bg-panel-alt); }
/* 播放中的列：流光動畫高亮 */
.file-list li.file-row.playing {
  border-radius: 6px;
  background: linear-gradient(
    100deg,
    rgba(90, 169, 230, .14) 0%,
    rgba(90, 169, 230, .32) 40%,
    rgba(121, 189, 240, .42) 50%,
    rgba(90, 169, 230, .32) 60%,
    rgba(90, 169, 230, .14) 100%
  );
  background-size: 220% 100%;
  animation: playing-flow 2.2s linear infinite;
  box-shadow: 0 0 10px rgba(90, 169, 230, .28), inset 0 0 0 1px rgba(90, 169, 230, .5);
}
.file-list li.file-row.playing .col-name { color: var(--accent-hover); font-weight: 600; }
.file-list li.file-row.playing .col-notes,
.file-list li.file-row.playing .col-stats { color: var(--accent-hover); }
@keyframes playing-flow {
  0%   { background-position: 120% 0; }
  100% { background-position: -120% 0; }
}
@media (prefers-reduced-motion: reduce) {
  .file-list li.file-row.playing { animation: none; }
}
.col-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.col-size { width: 5.5rem; text-align: right; color: var(--text-dim); }
.col-notes { width: 7.5rem; text-align: right; color: var(--text-dim); }
.col-notes.error { color: var(--danger); }
.col-stats { flex: 1; color: var(--text-dim); font-size: .8rem; }
.col-actions {
  display: flex;
  gap: .2rem;
  justify-content: flex-end;
  white-space: nowrap;
}
.empty-hint {
  color: var(--text-dim);
  font-size: .85rem;
  text-align: center;
  margin: .9rem 0 .2rem;
}

/* ===== 轉換說明面板 ===== */
.guide-panel {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem 1rem;
}
.guide-panel details {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0;
  overflow: hidden;
}
.guide-panel summary {
  padding: .8rem 1.25rem;
  cursor: pointer;
  font-size: .95rem;
  color: var(--text);
  user-select: none;
  list-style: none;
}
.guide-panel summary::-webkit-details-marker { display: none; }
.guide-panel summary:hover { color: var(--accent); }
.guide-content {
  padding: .5rem 1.25rem 1.25rem;
  font-size: .9rem;
  line-height: 1.7;
  color: var(--text-dim);
}
.guide-content h3 {
  color: var(--text);
  font-size: .95rem;
  margin: 1.2rem 0 .5rem;
}
.guide-content h3:first-child { margin-top: 0; }
.guide-content p { margin: .4rem 0; }
.guide-content b { color: var(--text); }
.guide-content code {
  background: var(--bg);
  padding: .1rem .35rem;
  border-radius: 4px;
  font-size: .85rem;
  color: var(--accent);
}
.guide-content ul { padding-left: 1.5rem; }
.guide-content li { margin: .3rem 0; }
.guide-table {
  width: 100%;
  border-collapse: collapse;
  margin: .6rem 0;
  font-size: .85rem;
}
.guide-table th, .guide-table td {
  border: 1px solid var(--border);
  padding: .4rem .6rem;
  text-align: left;
}
.guide-table th { color: var(--text); background: var(--bg-panel-alt); }
.guide-table td { color: var(--text-dim); }
.guide-code {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: .6rem .8rem;
  font-family: "Consolas", "Monaco", monospace;
  font-size: .85rem;
  color: var(--accent);
  margin: .5rem 0;
  white-space: pre;
}

/* ===== 底部 ===== */
.site-footer {
  border-top: 1px solid var(--border);
  padding: .8rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.status-bar {
  color: var(--text-dim);
  font-size: .85rem;
}
.doc-links {
  display: flex;
  gap: 1.25rem;
}
.doc-links a {
  color: var(--accent);
  font-size: .85rem;
  text-decoration: none;
}
.doc-links a:hover { text-decoration: underline; }
.doc-links .credit { color: var(--text-dim); font-size: .78rem; align-self: center; }

/* ===== 響應式 ===== */
@media (max-width: 800px) {
  .columns { grid-template-columns: 1fr; }
  .site-header h1 { font-size: 1.25rem; }
}

/* 實機命名編號輸入框 */
.dev-num {
  width: 3.2em;
  padding: 3px 4px;
  font-size: 12px;
  text-align: center;
  color: inherit;
  background: var(--bg-panel-alt);
  border: 1px solid var(--border);
  border-radius: 5px;
}
.dev-num:focus { border-color: var(--accent); outline: none; }
