:root {
  --bg-primary: #0a0a0f;
  --bg-secondary: #14141f;
  --bg-tertiary: #1e1e2e;
  --text-primary: #ffffff;
  --text-secondary: #a0a0b0;
  --text-muted: #606070;
  --accent: #00d4ff;
  --accent-secondary: #00ff88;
  --danger: #ff4466;
  --focus-ring: #00d4ff;
  --focus-glow: rgba(0, 212, 255, 0.4);
  --radius-md: 12px;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body {
  width: 600px; height: 600px; overflow: hidden;
  background: #000;
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
#app { width: 100%; height: 100%; position: relative; }
.screen { width: 100%; height: 100%; position: absolute; top: 0; left: 0; display: flex; flex-direction: column; }
.screen.hidden { display: none; }
.focusable { transition: all 0.15s ease; border: 2px solid transparent; cursor: pointer; outline: none; }
.focusable:focus { border-color: var(--focus-ring); box-shadow: 0 0 20px var(--focus-glow); }
.hidden { display: none !important; }

/* ---- Top bar ---- */
.topbar {
  padding: 20px 24px 14px;
  background: linear-gradient(180deg, var(--bg-tertiary), var(--bg-secondary));
  border-bottom: 1px solid #2a2a3a;
}
.brand { font-size: 28px; font-weight: 700; letter-spacing: 0.2px; display: flex; align-items: center; gap: 10px; }
.brand-icon { color: var(--accent); font-size: 30px; }
.subtitle { margin-top: 4px; font-size: 16px; color: var(--text-secondary); }

/* ---- Home list ---- */
.list { flex: 1; display: flex; flex-direction: column; gap: 10px; padding: 16px 20px; overflow: hidden; }
.cat-row {
  height: 60px; min-height: 44px;
  display: flex; align-items: center; gap: 14px;
  padding: 0 18px;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 20px; font-weight: 600;
  text-align: left;
}
.cat-name { flex: 1; }
.cat-meta { font-size: 15px; font-weight: 500; color: var(--text-muted); }
.chev { font-size: 26px; color: var(--accent); margin-left: 6px; }
.fav-row .star { color: var(--accent-secondary); }

.hint { padding: 10px 0 16px; text-align: center; font-size: 14px; color: var(--text-muted); }

/* ---- Category grid ---- */
.grid {
  flex: 1;
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
  padding: 18px 20px; align-content: start; overflow: hidden;
}
.chord-cell {
  height: 84px; min-height: 44px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  color: var(--text-primary);
}
.chord-cell .cc-name { font-size: 30px; font-weight: 700; }
.chord-cell .cc-fav { font-size: 16px; color: var(--accent-secondary); height: 18px; }
.grid-empty {
  grid-column: 1 / -1; text-align: center; color: var(--text-secondary);
  font-size: 18px; padding: 48px 12px;
}
.back-btn {
  height: 60px; margin: 4px 20px 18px;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  color: var(--text-primary); font-size: 20px; font-weight: 600;
}

/* ---- Detail ---- */
.detail-head { padding: 14px 24px 10px; display: flex; flex-direction: row; align-items: baseline; gap: 14px; }
.chord-name { font-size: 40px; font-weight: 800; color: var(--accent); }
.chord-full { font-size: 18px; color: var(--text-secondary); }
.diagram-wrap { flex: 1; display: flex; align-items: center; justify-content: center; }
#fretboard { display: block; }
.notes-row { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; padding: 4px 16px 12px; }
.note-chip {
  min-width: 42px; height: 36px; padding: 0 10px;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-tertiary); border: 1px solid #33334a;
  border-radius: 8px; font-size: 18px; font-weight: 600; color: var(--text-secondary);
}
.note-chip.root { background: rgba(0,212,255,0.16); border-color: var(--accent); color: #fff; }

.actionbar {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px;
  padding: 10px 16px 18px;
  background: var(--bg-primary); border-top: 1px solid #2a2a3a;
}
.act {
  height: 84px; min-height: 44px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  background: var(--bg-secondary); border-radius: var(--radius-md);
  color: var(--text-primary);
}
.act-ic { font-size: 26px; line-height: 1; color: var(--accent); }
.act-lb { font-size: 14px; font-weight: 600; color: var(--text-secondary); }
.act.is-fav .act-ic { color: var(--accent-secondary); }
