:root {
  --bg: #fbfaf7; --ink: #1d1c1a; --muted: #5d5a54; --line: #e4e0d8; --card: #fff;
  --accent: #b4432c; --accent-ink: #fff; --good: #1f8a4c; --radius: 14px;
  --font-head: Georgia, "Times New Roman", serif;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 17px/1.65 var(--font-body); }
a { color: var(--accent); }
img { max-width: 100%; height: auto; }
.wrap { max-width: 780px; margin: 0 auto; padding: 0 20px; }
header.site { border-bottom: 1px solid var(--line); background: var(--card); }
header.site .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 60px; flex-wrap: wrap; }
.brand { font: 700 20px/1 var(--font-head); color: var(--ink); text-decoration: none; letter-spacing: -.01em; }
.brand span { color: var(--accent); }
nav.top { display: flex; gap: 14px; flex-wrap: wrap; font-size: 15px; }
nav.top a { color: var(--muted); text-decoration: none; }
nav.top a:hover, nav.top a[aria-current] { color: var(--ink); }
h1, h2, h3 { font-family: var(--font-head); line-height: 1.2; letter-spacing: -.01em; }
h1 { font-size: clamp(28px, 5vw, 40px); margin: 28px 0 8px; }
h2 { font-size: 26px; margin: 40px 0 10px; }
h3 { font-size: 20px; margin: 26px 0 6px; }
.lede { color: var(--muted); margin: 0 0 20px; font-size: 18px; }
main { padding-bottom: 40px; }
.crumbs { font-size: 14px; color: var(--muted); margin-top: 16px; }
.crumbs a { color: var(--muted); }
table { width: 100%; border-collapse: collapse; margin: 14px 0 22px; font-size: 16px; background: var(--card); }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); }
th { font-weight: 600; background: rgba(0,0,0,.03); }
.faq details { border-bottom: 1px solid var(--line); padding: 12px 0; }
.faq summary { cursor: pointer; font-weight: 600; }
.faq details p { margin: 8px 0 0; }
.links { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; padding: 0; list-style: none; }
.links a { display: block; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); text-decoration: none; color: var(--ink); }
.links a:hover { border-color: var(--accent); }
.links small { display: block; color: var(--muted); }
footer.site { border-top: 1px solid var(--line); padding: 26px 0 40px; color: var(--muted); font-size: 14px; }
footer.site a { color: var(--muted); }
footer.site .wrap > div { margin-bottom: 8px; }

/* Tool card shared by tuner + metronome */
.tool { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; margin: 10px 0 26px; box-shadow: 0 1px 2px rgba(0,0,0,.04); }
.btn { appearance: none; border: 0; border-radius: 999px; padding: 13px 26px; font: 600 17px/1 var(--font-body); background: var(--accent); color: var(--accent-ink); cursor: pointer; }
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn.on { background: var(--ink); }
.btn:focus-visible, .tn-string:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* Tuner */
.tn-display { text-align: center; padding: 6px 0 14px; }
.tn-gauge { position: relative; height: 120px; overflow: hidden; margin: 0 auto 6px; max-width: 320px; }
.tn-arc { position: absolute; left: 50%; bottom: -150px; width: 300px; height: 300px; margin-left: -150px; border-radius: 50%; border: 2px solid var(--line); }
.tn-tick { position: absolute; left: 50%; bottom: 0; width: 2px; height: 116px; margin-left: -1px; background: linear-gradient(var(--good) 0 22px, transparent 22px); }
.tn-needle { position: absolute; left: 50%; bottom: 0; width: 3px; height: 112px; margin-left: -1.5px; background: var(--ink); transform-origin: 50% 100%; transition: transform .12s ease-out; border-radius: 2px; }
.in-tune .tn-needle { background: var(--good); }
.tn-note { font: 700 64px/1 var(--font-head); position: relative; display: inline-block; }
.tn-note::after { content: attr(data-octave); font-size: 22px; position: absolute; right: -16px; bottom: 6px; color: var(--muted); }
.in-tune .tn-note { color: var(--good); }
.tn-cents { font-weight: 600; margin-top: 4px; }
.tn-freq { color: var(--muted); font-size: 15px; }
.tn-strings { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 16px 0; }
.tn-string { appearance: none; border: 1px solid var(--line); background: var(--bg); border-radius: 12px; padding: 9px 14px; min-width: 66px; cursor: pointer; font: inherit; color: var(--ink); }
.tn-string strong { display: block; font-size: 19px; }
.tn-string span { font-size: 13px; color: var(--muted); }
.tn-string.active { border-color: var(--accent); background: var(--accent); color: var(--accent-ink); }
.tn-string.active span { color: var(--accent-ink); }
.tn-string.near:not(.active) { border-color: var(--good); }
.tn-controls { display: flex; justify-content: center; align-items: center; gap: 14px; flex-wrap: wrap; }
.tn-controls label { font-size: 14px; color: var(--muted); }
.tn-a4 { width: 70px; padding: 6px; border: 1px solid var(--line); border-radius: 8px; font: inherit; }
.tn-status { text-align: center; color: var(--muted); font-size: 14px; margin: 12px 0 0; min-height: 1.4em; }

/* Metronome */
.mt-top { display: flex; align-items: center; justify-content: center; gap: 14px; }
.mt-bpm { font: 700 76px/1 var(--font-head); min-width: 3ch; text-align: center; }
.mt-unit { display: block; text-align: center; color: var(--muted); font-size: 14px; margin-top: -2px; }
.mt-step { appearance: none; width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); background: var(--bg); font-size: 22px; cursor: pointer; color: var(--ink); }
.mt-tempo-name { text-align: center; font-weight: 600; color: var(--accent); margin: 2px 0 10px; }
.mt-slider { width: 100%; accent-color: var(--accent); margin: 8px 0 16px; }
.mt-dots { display: flex; justify-content: center; gap: 10px; margin: 6px 0 18px; }
.mt-dot { width: 18px; height: 18px; border-radius: 50%; background: var(--line); transition: background .05s; }
.mt-dot.on { background: var(--ink); }
.mt-dot.accent.on { background: var(--accent); }
.mt-row { display: flex; justify-content: center; align-items: center; gap: 12px; flex-wrap: wrap; }
.mt-row label { font-size: 14px; color: var(--muted); display: flex; gap: 6px; align-items: center; }
.mt-row select, .mt-row input[type=range] { font: inherit; }
.mt-row select { padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); }
.mt-keys { text-align: center; font-size: 13px; color: var(--muted); margin: 14px 0 0; }
.tempo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 8px; padding: 0; list-style: none; }
.tempo-grid a { display: block; text-align: center; padding: 9px 4px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); text-decoration: none; color: var(--ink); font-weight: 600; }
.tempo-grid a[aria-current] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
