/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Tokens ── */
:root {
  --bg: #ffffff;
  --fg: #0a0a0a;
  --muted: #777;
  --border: #e8e8e8;
  --font-serif: 'EB Garamond', Georgia, serif;
  --font-mono: 'DM Mono', monospace;
}

/* ── Base ── */
html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-serif);
  font-size: 18px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

/* ── Layout ── */
.site-wrapper {
  max-width: 680px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ── Header ── */
header {
  padding: 80px 0 60px;
  border-bottom: 1px solid var(--border);
}

.name {
  font-family: var(--font-serif);
  font-size: clamp(2rem, 5vw, 2.8rem);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin-bottom: 10px;
}

.tagline {
  color: var(--muted);
  font-size: 0.95rem;
  font-family: var(--font-mono);
  font-weight: 300;
  letter-spacing: 0.01em;
}

/* Page header (inner pages) */
.page-header {
  padding: 60px 0 48px;
  border-bottom: 1px solid var(--border);
}

.back-link {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  text-decoration: none;
  display: inline-block;
  margin-bottom: 28px;
}
.back-link:hover { color: var(--fg); text-decoration: underline; text-underline-offset: 4px; }

.page-title {
  font-family: var(--font-serif);
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin-bottom: 8px;
}

.page-desc {
  color: var(--muted);
  font-size: 0.92rem;
  font-family: var(--font-mono);
  font-weight: 300;
}

/* ── Nav ── */
nav { padding: 22px 0; border-bottom: 1px solid var(--border); }
nav ul { list-style: none; display: flex; gap: 28px; flex-wrap: wrap; }
nav a {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 400;
  color: var(--fg);
  text-decoration: none;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
nav a:hover { text-decoration: underline; text-underline-offset: 4px; }

/* ── Sections ── */
section { padding: 64px 0; border-bottom: 1px solid var(--border); }
section:last-of-type { border-bottom: none; }

.section-label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 400;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 36px;
}

/* ── Useful Things ── */
.useful-item { display: flex; flex-direction: column; gap: 4px; margin-bottom: 28px; }
.useful-item:last-child { margin-bottom: 0; }
.useful-item a { font-size: 1rem; color: var(--fg); text-decoration: none; font-weight: 500; }
.useful-item a:hover { text-decoration: underline; text-underline-offset: 4px; }
.useful-item p { font-size: 0.88rem; color: #555; line-height: 1.55; }

/* ── Footer ── */
footer { padding: 40px 0 60px; }
footer.bordered { border-top: 1px solid var(--border); }
.footer-links { display: flex; gap: 20px; flex-wrap: wrap; }
.footer-links a {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--muted);
  text-decoration: none;
  letter-spacing: 0.04em;
}
.footer-links a:hover { color: var(--fg); text-decoration: underline; text-underline-offset: 4px; }

/* ── Ear Trainer ── */
.ear-trainer { padding: 56px 0; font-family: var(--font-mono); }

.et-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.et-row:last-of-type { margin-bottom: 36px; }

.et-label {
  font-size: 0.68rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
  min-width: 46px;
}

.et-btn-group { display: flex; gap: 6px; flex-wrap: wrap; }

.et-circle {
  width: 32px; height: 32px; border-radius: 50%;
  border: 1px solid var(--border); background: #fff; color: var(--fg);
  font-family: var(--font-mono); font-size: 0.72rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
}
.et-circle:hover:not(.active) { border-color: #bbb; background: #f8f8f8; }
.et-circle.active { background: var(--fg); color: #fff; border-color: var(--fg); }

.et-pill {
  height: 32px; padding: 0 13px; border-radius: 16px;
  border: 1px solid var(--border); background: #fff; color: var(--fg);
  font-family: var(--font-mono); font-size: 0.72rem; cursor: pointer;
  transition: all 0.15s; white-space: nowrap;
}
.et-pill:hover:not(.active) { border-color: #bbb; background: #f8f8f8; }
.et-pill.active { background: var(--fg); color: #fff; border-color: var(--fg); }

.et-key-select {
  height: 32px; padding: 0 26px 0 10px; border-radius: 16px;
  border: 1px solid var(--border); background: #fff; color: var(--fg);
  font-family: var(--font-mono); font-size: 0.72rem; cursor: pointer;
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23777' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}

.et-scale-toggle {
  display: flex;
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
}
.et-scale-btn {
  height: 30px; padding: 0 13px; border: none;
  background: #fff; color: var(--muted);
  font-family: var(--font-mono); font-size: 0.7rem;
  cursor: pointer; transition: all 0.15s;
}
.et-scale-btn.active { background: var(--fg); color: #fff; }
.et-scale-btn:hover:not(.active) { background: #f0f0f0; color: var(--fg); }

.et-action {
  height: 32px; padding: 0 14px; border-radius: 16px; border: 1px solid;
  font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.03em;
  cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
  transition: all 0.12s; white-space: nowrap;
}
.et-action:active { transform: scale(0.97); }

.et-action--new   { background: #e8edf5; color: #2a4a7f; border-color: #b8cadf; }
.et-action--new:hover   { background: #d8e2f0; }
.et-action--play  { background: #e6f2ec; color: #1e5e3a; border-color: #b2d9c2; }
.et-action--play:hover  { background: #d4eadc; }
.et-action--reveal { background: #faf0e0; color: #7a4f10; border-color: #e8cfa0; }
.et-action--reveal:hover { background: #f5e6ce; }

.et-song-name {
  font-size: 0.78rem; color: var(--muted); font-style: italic;
  min-height: 18px; margin-bottom: 16px; font-family: var(--font-mono);
}

.et-cards {
  display: flex; gap: 10px; min-height: 72px;
  margin-bottom: 20px; flex-wrap: wrap; align-items: flex-start;
}

.et-card {
  min-width: 56px; height: 56px; padding: 0 10px; border-radius: 8px;
  border: 1px solid var(--border); background: #fafafa;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-size: 0.85rem; color: var(--fg);
  transition: border-color 0.15s, background 0.15s;
}
.et-card.hidden  { color: transparent; background: #f4f4f4; border-color: #e4e4e4; }
.et-card.playing { border-color: #2a4a7f; background: #e8edf5; }
.et-card.revealed { background: #fff; border-color: #ccc; }

.et-status {
  font-size: 0.73rem; color: var(--muted);
  font-family: var(--font-mono); letter-spacing: 0.02em; min-height: 18px;
}

/* ── Responsive ── */
@media (max-width: 520px) {
  header { padding: 52px 0 40px; }
  .page-header { padding: 40px 0 36px; }
  section { padding: 48px 0; }
  .ear-trainer { padding: 40px 0; }
}
