@font-face { font-family: Andika; src: url(fonts/Andika-Regular.ttf); font-weight: 400; }
@font-face { font-family: Andika; src: url(fonts/Andika-Bold.ttf); font-weight: 700; }
@font-face { font-family: Bravura; src: url(fonts/Bravura-clefs.otf); }

:root {
  --page:#FBF3E4; --sheet:#FFFDF6; --ink:#131C44; --accent:#2559E8; --highlight:#FFE9C2; --staff:#D9C6A0;
  --pencil:#5B6478; --on-accent:#fff; --body:#e8e0cc;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--page); color: var(--ink);
  font-family: Andika, "Segoe UI", sans-serif; font-size: 18px; line-height: 1.45;
}
button { font: inherit; color: inherit; cursor: pointer; }
.music { font-family: Bravura; }
h1, h2, h3, p { margin: 0; }

.wrap { max-width: 1280px; margin: 0 auto; padding: 20px 28px 48px; }
.back { background: none; border: 0; color: var(--accent); font-weight: 700; font-size: 20px; padding: 8px 6px; border-radius: 4px; }
.back:hover, .linkbtn:hover { background: color-mix(in srgb, var(--accent) 12%, transparent); }
.linkbtn { background: none; border: 0; color: var(--accent); font-weight: 700; padding: 6px 8px; border-radius: 4px; }

/* ---- engraved staff strip ---- */
.strip { position: relative; width: 100%; }
.strip svg { position: absolute; left: 0; top: 0; height: 100%; }
.strip .lines { width: 100%; }
.strip .lines line { stroke: var(--ink); stroke-width: 1; vector-effect: non-scaling-stroke; opacity: .85; }
.strip .clef text { fill: var(--ink); }
.strip i { position: absolute; background: var(--ink); opacity: .9; }

/* ---- printed boxes ---- */
.box { background: var(--sheet); border: 1px solid color-mix(in srgb, var(--ink) 75%, transparent); border-radius: 3px; }
.box.sel { border: 3px solid var(--accent); }
.press { cursor: pointer; text-align: left; width: 100%; font: inherit; color: inherit; }
.press:hover { outline: 3px solid color-mix(in srgb, var(--accent) 35%, transparent); }
.btn {
  background: var(--sheet); border: 1.5px solid var(--ink); border-radius: 3px; padding: 11px 20px;
  font-weight: 700; font-size: 20px; text-align: center;
}
.btn:hover:not(:disabled) { background: color-mix(in srgb, var(--accent) 14%, var(--sheet)); }
.btn.filled { background: var(--accent); color: var(--on-accent); }
.btn:disabled { opacity: .4; cursor: default; }
.tag {
  display: inline-block; font-weight: 700; font-size: 15px; padding: 1px 8px; border-radius: 2px;
  border: 1px solid var(--c); background: color-mix(in srgb, var(--c) 22%, transparent);
}

/* ---- home ---- */
.hero h1 { font-size: 44px; line-height: 1.1; }
.hero .sub { font-size: 22px; color: var(--pencil); }
.hero .strip { margin-top: 10px; }
.hero-actions { margin-top: 14px; display: flex; flex-wrap: wrap; gap: 12px; }
.family { display: flex; align-items: center; gap: 12px; margin: 30px 0 12px; }
.family .bar { width: 10px; height: 28px; background: var(--c); }
.family h2 { font-size: 26px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.card { padding: 10px 12px 12px; }
.card .row { display: flex; gap: 10px; align-items: center; margin-top: 4px; }
.card .tab { width: 6px; height: 36px; background: var(--c); flex: none; }
.card .name { font-size: 22px; font-weight: 700; line-height: 1.2; }
.card .sub { font-size: 15px; color: var(--pencil); }

/* ---- chart ---- */
.topbar { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.topbar .grow { flex: 1; }
.seg { display: flex; border: 1.5px solid var(--ink); border-radius: 3px; overflow: hidden; }
.seg button { background: var(--sheet); border: 0; width: 56px; height: 44px; font-size: 24px; font-family: Andika, sans-serif; }
.seg button.on { background: var(--highlight); }
.chart { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 22px; align-items: start; }
.chart.tall { grid-template-columns: 300px 200px minmax(0, 1fr); }
.chart > div { min-width: 0; }
.picker { padding: 8px 6px; touch-action: none; user-select: none; }
.picker svg { width: 100%; height: auto; display: block; cursor: ns-resize; max-height: calc(100vh - 230px); }
.arrows { display: flex; gap: 12px; margin-top: 12px; }
.arrows .btn { flex: 1; }
.hint { font-size: 14px; color: var(--pencil); margin-top: 8px; text-align: center; }
.pic { padding: 8px; }
.pic svg { width: 100%; height: auto; display: block; max-height: calc(100vh - 150px); }
.note-title .inst { font-size: 22px; font-weight: 700; color: var(--pencil); }
.note-title .big { font-size: 78px; font-weight: 700; line-height: 1.05; }
.note-title .oct { font-size: 26px; font-weight: 700; color: var(--pencil); margin-left: 3px; }
.note-title .meta { display: inline-block; margin-left: 18px; vertical-align: 16px; font-weight: 700; }
.note-title .meta .hot { color: #C0392B; display: block; }
.note-title .small { font-size: 18px; color: var(--pencil); }
.how { padding: 16px 18px; margin-top: 14px; }
.how h2, .more h2 { font-size: 24px; }
.how .step { font-size: 22px; font-weight: 700; margin-top: 8px; }
.how ul { margin: 6px 0 0; padding: 0; list-style: none; }
.how li { font-size: 20px; padding-left: 22px; position: relative; }
.how li::before { content: "•"; position: absolute; left: 4px; color: var(--accent); font-weight: 700; }
.how .use { color: var(--pencil); margin-top: 10px; }
.how .head { display: flex; align-items: center; }
.how .head h2 { flex: 1; }
.tip { position: relative; margin-top: 14px; padding: 4px 0 4px 26px; }
.tip::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 2px; background: var(--ink); }
.tip::after { content: ""; position: absolute; left: 5px; top: 0; bottom: 0; width: 5px; background: var(--ink); }
.tip b { color: var(--accent); }
.more { margin-top: 20px; }
.more .head { display: flex; align-items: center; margin-bottom: 8px; }
.more .head h2 { flex: 1; }
.alt { display: flex; gap: 14px; padding: 10px 12px; margin-top: 10px; align-items: center; }
.alt .mini { flex: none; }
.alt .txt { display: grid; gap: 4px; }
.alt .how2 { font-weight: 700; }
.alt .shown { font-size: 14px; color: var(--accent); font-weight: 700; }
.legend { margin-top: 20px; padding: 12px 16px; }
.legend summary { font-weight: 700; cursor: pointer; }
.legend p { margin-top: 8px; }
.legend .cat { display: flex; gap: 8px; align-items: flex-start; margin-top: 8px; font-size: 16px; }
.legend .cat .tag { flex: none; }

/* ---- themes ---- */
.themes { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; margin-top: 16px; }
.theme { padding: 0; overflow: hidden; }
.theme .pv { height: 96px; }
.theme .pv svg { width: 100%; height: 100%; display: block; }
.theme .nm { padding: 10px 12px; font-weight: 700; display: flex; justify-content: space-between; align-items: center; }

@media (max-width: 980px) {
  .chart, .chart.tall { grid-template-columns: 1fr; }
  .picker svg { max-height: 60vh; width: auto; margin: 0 auto; }
  .pic svg { max-height: 60vh; width: auto; margin: 0 auto; }
}
.alt .txt .tag { justify-self: start; }
.tag { white-space: nowrap; }
.theme .pv { height: auto; aspect-ratio: 200 / 96; }
.card .grow { flex: 1; min-width: 0; }
.ico { display: inline-block; color: var(--c, var(--ink)); }
.ico svg { width: 100%; height: 100%; display: block; }
.card .ico { width: 48px; height: 48px; flex: none; }
.ico.sm { width: 34px; height: 34px; vertical-align: middle; margin-right: 10px; color: var(--ink); }
.card .ico { width: 56px; height: 56px; }
.ico img { width: 100%; height: 100%; object-fit: contain; display: block; }
.card .ico { width: 64px; height: 64px; }
.ico.sm { width: 42px; height: 42px; }
.card .ico { width: 96px; height: 64px; }
.ico.sm { width: 68px; height: 46px; }

/* ---- pass 2: framed plates, steadier rhythm (still printed music, no ruled paper) ---- */
:root { --gap: 20px; }
.wrap { padding: 28px 32px 64px; }
.box { box-shadow: inset 0 0 0 4px var(--sheet), inset 0 0 0 5px color-mix(in srgb, var(--ink) 16%, transparent); border-radius: 2px; }
.box.sel { box-shadow: inset 0 0 0 3px var(--sheet), inset 0 0 0 4px var(--accent); }
.card { padding: 16px 18px 16px; }
.grid { gap: var(--gap); grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.hero h1 { font-size: 56px; letter-spacing: -.01em; }
.hero .sub { font-size: 24px; margin-top: 8px; }
.hero .strip { margin-top: 18px; }
.hero-actions { margin-top: 22px; }
.family { margin: 44px 0 16px; padding-bottom: 8px; border-bottom: 2px solid var(--ink); }
.family .bar { width: 12px; height: 30px; }
.btn { padding: 13px 24px; border-width: 2px; box-shadow: 3px 3px 0 var(--ink); transition: transform .1s, box-shadow .1s; }
.btn:active:not(:disabled) { transform: translate(3px, 3px); box-shadow: none; }
.btn.filled { box-shadow: 3px 3px 0 color-mix(in srgb, var(--accent) 55%, black); }
.btn:disabled { box-shadow: none; }
.seg { border-width: 2px; }
.how { padding: 20px 22px; }
.how .step { margin-top: 12px; }
.note-title .big { font-size: 88px; letter-spacing: -.02em; }
.topbar { margin-bottom: 14px; }
.chart { gap: 28px; }
.tag { border-radius: 2px; }
@media (max-width: 600px) { .wrap { padding: 16px 16px 48px; } .hero h1 { font-size: 40px; } .note-title .big { font-size: 68px; } }
@media (prefers-reduced-motion: reduce) { .btn { transition: none; } }

.advanced-switch { display: flex; gap: 14px; align-items: center; margin: 34px 0 10px; font-size: 17px; cursor: pointer; }
.opt-switch { margin: 14px 0 0; font-size: 16px; }
.advanced-switch input { width: 26px; height: 26px; accent-color: var(--accent); flex: none; }
.advanced-switch span { color: var(--pencil); }
.advanced-switch b { color: var(--ink); font-size: 19px; }
/* ---- pass 3: one design language with Tuner Buddy (see docs/design-language.md) ---- */
:root { --radius: 16px; --lip: 3px; --edge: color-mix(in srgb, var(--ink) 18%, var(--page)); }
.box { border: 2px solid var(--edge); border-radius: var(--radius); box-shadow: inset 0 0 0 4px var(--sheet), inset 0 0 0 5px color-mix(in srgb, var(--ink) 12%, transparent), 0 var(--lip) 0 var(--edge); }
.box.sel { border-color: var(--accent); box-shadow: inset 0 0 0 4px var(--sheet), inset 0 0 0 5px var(--accent), 0 var(--lip) 0 var(--accent); }
.btn { border: 2px solid var(--edge); border-radius: 999px; box-shadow: 0 4px 0 var(--edge); padding: 13px 26px; }
.btn:active:not(:disabled) { transform: translateY(4px); box-shadow: none; }
.btn.filled { background: var(--accent); border-color: var(--accent); box-shadow: 0 4px 0 color-mix(in srgb, var(--accent) 72%, black); }
.btn:disabled { box-shadow: none; }
.seg { border: 2px solid var(--edge); border-radius: 999px; padding: 3px; background: var(--sheet); gap: 2px; }
.seg button { border-radius: 999px; }
.seg button.on { background: var(--highlight); box-shadow: 0 2px 0 color-mix(in srgb, var(--accent) 40%, var(--highlight)); }
.tag { border-radius: 999px; padding: 2px 11px; }
.family { border-bottom: 2px solid var(--edge); }
.family .bar { width: 12px; height: 12px; border-radius: 50%; }
.hero h1, .family h2 { letter-spacing: -.01em; }
.arrows .btn { border-radius: 28px; }
