/*
  style.css
  設計方向：深色主題，呼應既有專案（遊戲展示網站）的視覺語彙。
  主色：近黑背景 + 科技藍強調；根音統一用暖紅標示，與強調色區隔開。
*/

:root {
  --bg: #0a0a0c;
  --surface: #131318;
  --surface-raised: #1a1a21;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text-primary: #f2f2f4;
  --text-secondary: #9b9ba5;
  --text-muted: #63636e;
  --accent: #4c8dff;
  --accent-bg: rgba(76, 141, 255, 0.14);
  --root-color: #ff5c5c;
  --root-bg: rgba(255, 92, 92, 0.14);
  --radius: 10px;
  --radius-lg: 16px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text-primary);
  font-family: 'JetBrains Mono', 'PingFang TC', 'Noto Sans TC', monospace;
  -webkit-font-smoothing: antialiased;
}

button {
  font-family: inherit;
  cursor: pointer;
  background: none;
  border: none;
  color: inherit;
}

#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding-bottom: 78px; /* 留給固定底部導覽列的空間 */
}

/* ---------- 主內容區 ---------- */
main {
  flex: 1;
  padding: 1rem 1rem 1.5rem;
}

.section-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem;
  margin-bottom: 12px;
}

/* ---------- 選調格狀按鈕 ---------- */
.key-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
  margin-bottom: 12px;
}

.key-btn {
  padding: 10px 0;
  font-size: 14px;
  font-weight: 500;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-raised);
  color: var(--text-primary);
  transition: background 0.15s, border-color 0.15s;
}

.key-btn.active {
  background: var(--accent-bg);
  border-color: var(--accent);
  color: var(--accent);
}

/* ---------- 大調/小調切換 ---------- */
.mode-toggle {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.mode-toggle button {
  flex: 1;
  padding: 9px 0;
  font-size: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-raised);
  color: var(--text-primary);
}

.mode-toggle button.active {
  background: var(--accent-bg);
  border-color: var(--accent);
  color: var(--accent);
}

/* ---------- 1-7 級和弦整排 ---------- */
.degree-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin-bottom: 12px;
}

.deg-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 2px 7px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-raised);
}

.deg-btn.active {
  background: var(--accent-bg);
  border-color: var(--accent);
}

.deg-num {
  font-size: 10px;
  color: var(--text-muted);
}

.deg-btn.active .deg-num {
  color: var(--accent);
}

.deg-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
}

.deg-btn.active .deg-name {
  color: var(--accent);
}

/* ---------- 結果卡片 ---------- */
.result-card {
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem 1.25rem;
  text-align: center;
  margin-bottom: 12px;
}

.result-label {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 0 0 4px;
}

.result-chord {
  font-size: 30px;
  font-weight: 600;
  margin: 0 0 6px;
  color: var(--accent);
}

.result-notes {
  font-size: 14px;
  color: var(--text-secondary);
  margin: 0;
  font-variant-numeric: tabular-nums;
}

/* ---------- 指型卡片滑動區 ---------- */
.carousel {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.carousel::-webkit-scrollbar {
  display: none;
}

.shape-card {
  flex: 0 0 100%;
  width: 100%;
  scroll-snap-align: center;
  padding-top: 4px;
}

.shape-label {
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
  margin: 0 0 4px;
}

.shape-box {
  position: relative;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0.5rem;
  display: flex;
  justify-content: center;
}

.shape-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  font-size: 16px;
}

.shape-nav:hover {
  color: var(--accent);
}

.shape-nav.prev {
  left: 8px;
}

.shape-nav.next {
  right: 8px;
}

.page-label {
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  margin: 10px 0 0;
}

.fingering-note {
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  margin: 6px 0 0;
}

/* ---------- 指型 SVG 內部樣式 ---------- */
.fret-string {
  stroke: var(--border-strong);
  stroke-width: 1;
}

.fret-line {
  stroke: var(--border-strong);
  stroke-width: 1;
}

.fret-line.nut {
  stroke-width: 3;
}

.fret-offset-label {
  font-size: 12px;
  fill: var(--text-secondary);
}

.mute-label {
  font-size: 13px;
  fill: var(--text-secondary);
}

.open-circle {
  fill: none;
  stroke: var(--text-secondary);
  stroke-width: 1.5;
}

.open-circle.root {
  stroke: var(--root-color);
}

.note-label {
  font-size: 11px;
  fill: var(--text-secondary);
}

.note-label.root {
  fill: var(--root-color);
}

.fret-dot {
  fill: var(--accent);
}

.fret-dot.root {
  fill: var(--root-color);
}

.dot-note {
  font-size: 11px;
  fill: #05070f;
  font-weight: 600;
}

/* ---------- 底部導覽列 ---------- */
.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  max-width: 480px;
  margin: 0 auto;
  background: rgba(19, 19, 24, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  display: flex;
  padding: 8px 6px calc(8px + env(safe-area-inset-bottom));
  gap: 4px;
  z-index: 10;
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 4px 0 2px;
  color: var(--text-muted);
}

.nav-icon {
  width: 38px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: background 0.15s;
}

.nav-icon svg {
  width: 19px;
  height: 19px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.7;
}

.nav-label {
  font-size: 10px;
  letter-spacing: 0.01em;
}

.nav-item.active {
  color: var(--accent);
}

.nav-item.active .nav-icon {
  background: var(--accent-bg);
}

.nav-item.disabled {
  opacity: 0.35;
}

/* ---------- 尚未建立的頁面佔位 ---------- */
.placeholder {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
  font-size: 13px;
}
