:root {
  --paper: #f6efe3;
  --ink: #2b2420;
  --soft: #6f6258;
  --accent: #c4553b;
  --accent-ink: #fff8f0;
  --gold: #e3a530;
  --green: #4f8a55;
  --red: #c23b3b;
  --wood: #7a4a2b;
  --wood-dark: #53311c;
  --fret: #cfc6b8;
  --line: #e4d8c6;
  --card: #fffaf2;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--paper); color: var(--ink); }
body {
  font: 17px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  background-image: radial-gradient(circle at 20% 0%, #fbf5ea 0, transparent 60%);
  min-height: 100dvh;
}
main { max-width: 30rem; margin: 0 auto; padding: max(2rem, env(safe-area-inset-top)) 1.25rem 3rem; }
.screen { animation: rise 0.5s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.15; margin: 0.2em 0 0.5em; }
h1 { font-size: 2.4rem; }
h2 { font-size: 1.9rem; }
h3 { font-size: 1.3rem; }
.eyebrow { font-size: 0.8rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent); font-weight: 600; margin: 0; }
.lede { font-family: var(--serif); font-size: 1.25rem; }
.small { font-size: 0.9rem; color: var(--soft); }
.q { font-family: var(--serif); font-size: 1.25rem; margin: 1.6rem 0 0.6rem; }
b { font-weight: 650; }

button { font: inherit; color: inherit; border: 0; cursor: pointer; touch-action: manipulation; }
.primary, .secondary, .choices button {
  border-radius: 999px; padding: 0.8rem 1.4rem; font-weight: 600;
  transition: transform 0.08s ease, background 0.2s;
}
.primary { background: var(--accent); color: var(--accent-ink); box-shadow: 0 3px 0 #8f3a26; }
.secondary { background: var(--card); border: 1.5px solid var(--line); }
.primary:active, .secondary:active, .choices button:active { transform: translateY(2px); }
.primary:disabled { opacity: 0.5; }
.screen > .primary { margin-top: 1rem; width: 100%; padding: 1rem; font-size: 1.1rem; }
.link { background: none; color: var(--soft); text-decoration: underline; padding: 0.4rem; font-size: 0.9rem; }

.choices { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; }
.choices button { background: var(--card); border: 1.5px solid var(--line); padding: 0.9rem 0.5rem; }
.choices button.wrong { border-color: var(--red); color: var(--red); opacity: 0.6; text-decoration: line-through; }
.choices button.right { background: var(--green); border-color: var(--green); color: #fff; }
.choices.chords { grid-template-columns: repeat(5, 1fr); gap: 0.4rem; }
.choices.chords button { padding: 1rem 0; font-family: var(--serif); font-size: 1.2rem; border-radius: 14px; }

.hint {
  background: #fdf3d8; border-left: 4px solid var(--gold); border-radius: 8px;
  padding: 0.7rem 0.9rem; margin: 1rem 0 0; font-size: 0.95rem;
}
.hint::before { content: "Hint · "; font-weight: 700; color: #a8761a; }
.pop { animation: pop 0.35s ease; }
@keyframes pop { 0% { transform: scale(0.97); opacity: 0.4; } 100% { transform: none; opacity: 1; } }
.result { font-family: var(--serif); font-size: 1.1rem; margin: 1rem 0 0; }
.footer { display: flex; justify-content: space-between; margin-top: 1rem; min-height: 2rem; }

.neckwrap { margin-top: 1rem; }
.neck { display: block; width: 100%; max-width: 20rem; margin: 0 auto; user-select: none; -webkit-user-select: none; }
.neck .wood { fill: var(--wood); }
.neck .nut { fill: #efe6d6; }
.neck .fret { stroke: var(--fret); stroke-width: 3; }
.neck .inlay { fill: #e9dcc5; opacity: 0.8; }
.neck .string { stroke: #ddd5c8; }
.neck .fretnum { font: 13px var(--sans); fill: var(--soft); text-anchor: middle; }
.neck .hit { fill: transparent; }
.neck .dot circle { fill: var(--accent); stroke: #fff8f0; stroke-width: 2.5; transition: fill 0.2s; }
.neck .dot text { font: 700 15px var(--sans); fill: #fff; text-anchor: middle; pointer-events: none; }
.neck .dot.open circle { fill: var(--paper); stroke: var(--soft); stroke-width: 2; }
.neck .dot.open text { fill: var(--ink); font-size: 13px; }
.neck .dot circle, .neck .dot text { pointer-events: none; }
.neck .dot.good circle { fill: var(--green); }
.neck .dot.bad circle { fill: var(--red); }
.neck .dot.open.good circle { fill: #dcebd9; stroke: var(--green); }
.neck .dot.open.bad circle { fill: #f6d6d3; stroke: var(--red); }
.row { display: flex; gap: 0.6rem; margin-top: 1rem; }
.row .primary { flex: 2; padding: 1rem; font-size: 1.1rem; }
.row .secondary { flex: 1; }

.slots { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.5rem; margin: 1.2rem 0; }
.slots span {
  height: 3.6rem; border-radius: 14px; border: 2px dashed var(--line);
  display: grid; place-items: center; font-family: var(--serif); font-size: 1.4rem; font-weight: 600;
}
.slots span.right { border: 2px solid var(--green); background: #e5f0e3; color: var(--green); }
.slots span.wrong { border: 2px solid var(--red); background: #f8e1de; color: var(--red); animation: shake 0.3s; }
@keyframes shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }

/* reveal */
.reveal { text-align: center; }
.reveal .lede { margin-bottom: 1.4rem; }
.banjo { width: 9rem; display: block; margin: 0 auto 1rem; overflow: visible; }
.banjo .b-wood, .banjo .b-head { fill: var(--wood); }
.banjo .b-pegs circle, .banjo .b-fifth circle { fill: #d9c7a5; stroke: var(--wood-dark); stroke-width: 2; }
.banjo .b-frets line { stroke: #d8cbb6; stroke-width: 2; }
.banjo .b-rim { fill: var(--wood-dark); }
.banjo .b-headskin { fill: #f3ead9; stroke: #c9b796; stroke-width: 3; }
.banjo .b-bridge, .banjo .b-tail { fill: var(--wood-dark); }
.banjo .b-strings line, .banjo .b-fifth line { stroke: #8f8577; stroke-width: 1.4; }
.banjo.go .b-neck { animation: fadeup 0.6s ease both; }
.banjo.go .b-strings { animation: fadeup 0.6s 0.2s ease both; }
.banjo.go .b-pot { transform-origin: 110px 440px; animation: grow 0.7s 0.6s cubic-bezier(.3,1.5,.5,1) both; }
.banjo.go .b-fifth { animation: fadeup 0.5s 1.3s ease both; }
@keyframes fadeup { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes grow { from { opacity: 0; transform: scale(0.2); } to { opacity: 1; transform: none; } }

.video { margin: 0 -0.25rem 1.5rem; border-radius: 16px; overflow: hidden; background: #1c1714; box-shadow: 0 10px 30px rgba(60, 35, 20, 0.25); }
.video video { display: block; width: 100%; max-height: 75dvh; background: #1c1714; }
.missing { color: #f3ead9; padding: 3rem 1rem; margin: 0; }
.card { background: var(--card); border: 1.5px solid var(--line); border-radius: 16px; padding: 1.2rem 1rem; margin-bottom: 1rem; }
.diagrams { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.4rem; margin: 0.6rem 0; }
.diagram { width: 100%; }
.diagram .dname { font: 700 16px var(--serif); text-anchor: middle; fill: var(--ink); }
.diagram .dnut { stroke: var(--ink); stroke-width: 5; }
.diagram .dfret { stroke: #bdb2a2; stroke-width: 1.5; }
.diagram .dstring { stroke: var(--soft); stroke-width: 1.5; }
.diagram .ddot { fill: var(--accent); }
.diagram .dopen { font: 13px var(--sans); text-anchor: middle; fill: var(--soft); }
.sig { font-family: var(--serif); font-size: 1.2rem; margin: 0.8rem 0 0; }

#confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 10; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; } }
