:root {
  --bg: #faf8f5;
  --panel: #ffffff;
  --ink: #241f1c;
  --muted: #6b625b;
  --accent: #2f5d50;
  --accent-ink: #ffffff;
  --border: #e4ddd4;
  --black-key: #2a2622;
  --white-key: #ffffff;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17140f;
    --panel: #221e19;
    --ink: #f2ede6;
    --muted: #b4aa9f;
    --accent: #7fbfa8;
    --accent-ink: #10201b;
    --border: #38322b;
    --black-key: #0c0a08;
    --white-key: #2e2a25;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
}

.wrap {
  max-width: 880px;
  margin: 0 auto;
  padding: 2rem 1.25rem 4rem;
}

header h1 {
  margin: 0 0 0.25rem;
  font-size: 1.9rem;
}

header p.tagline {
  margin: 0 0 2rem;
  color: var(--muted);
}

section {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.25rem;
}

section h2 {
  margin-top: 0;
  font-size: 1.1rem;
}

section p.hint {
  color: var(--muted);
  font-size: 0.9rem;
  margin-top: -0.5rem;
}

#scale-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.chip {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--ink);
  border-radius: 999px;
  padding: 0.4rem 0.9rem;
  font-size: 0.9rem;
  cursor: pointer;
}

.chip.selected {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
}

#note-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.note-btn {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  border: 1px solid var(--border);
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
}

.note-btn.white-key {
  background: var(--white-key);
  color: var(--ink);
}

.note-btn.black-key {
  background: var(--black-key);
  color: #f2ede6;
}

.note-btn.selected {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
}

.genre-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.genre-filters label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.95rem;
}

#find-btn {
  background: var(--accent);
  color: var(--accent-ink);
  border: none;
  border-radius: 8px;
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
}

#results-summary {
  color: var(--muted);
  margin-bottom: 1rem;
}

#results {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
}

.card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem;
  background: var(--bg);
}

.card h3 {
  margin: 0.4rem 0 0.15rem;
  font-size: 1.05rem;
}

.card .composer {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.card .meta {
  margin: 0.4rem 0 0.75rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.sheet-link {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
  font-size: 0.9rem;
}

.sheet-link:hover {
  text-decoration: underline;
}

.badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  background: var(--border);
  color: var(--ink);
}

footer {
  color: var(--muted);
  font-size: 0.85rem;
  text-align: center;
  margin-top: 2rem;
}
