:root {
  --ink: #201b16;
  --muted: #756756;
  --paper: #e8dec7;
  --paper-deep: #d4c5a6;
  --night: #0d0d0d;
  --night-soft: #161616;
  --oxblood: #7a2825;
  --brass: #a7834c;
  --line: rgba(32, 27, 22, .2);
  --serif: Georgia, 'Times New Roman', serif;
  --sans: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }
html { background: var(--night); color-scheme: dark; }
body { margin: 0; min-width: 320px; min-height: 100vh; background: var(--night); color: var(--paper); font-family: var(--sans); }
button, select { font: inherit; }
button { cursor: pointer; }
button:focus-visible, a:focus-visible, select:focus-visible, summary:focus-visible { outline: 2px solid var(--brass); outline-offset: 4px; }
a { color: inherit; }

.ambient { position: fixed; pointer-events: none; inset: 0; opacity: .55; }
.ambient-left { background: radial-gradient(ellipse at 12% 45%, rgba(141, 91, 45, .12), transparent 32%); }
.ambient-right { background: radial-gradient(ellipse at 90% 65%, rgba(111, 31, 28, .12), transparent 28%); }
.masthead { position: fixed; z-index: 5; top: 0; left: 0; right: 0; display: flex; align-items: center; justify-content: space-between; padding: 22px clamp(18px, 4vw, 60px); color: rgba(232, 222, 199, .72); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; }
.wordmark { text-decoration: none; }
.wordmark span { color: var(--paper); }
.masthead-tools { display: flex; gap: 22px; align-items: center; }
.sound-note { color: rgba(232, 222, 199, .42); }
.text-button { border: 0; padding: 8px 0; background: transparent; color: inherit; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; text-decoration: underline; text-decoration-color: rgba(167, 131, 76, .55); text-underline-offset: 5px; }
.text-button:hover { color: var(--paper); text-decoration-color: var(--brass); }

main { min-height: 100vh; }
.screen { min-height: 100vh; padding: 104px clamp(18px, 5vw, 72px) 58px; }
.screen[hidden], .drawer[hidden], .reference-card[hidden] { display: none; }
.title-screen { display: grid; place-items: center; background: radial-gradient(ellipse at center, #252019 0%, #0d0d0d 65%); }
.title-layout { width: min(1120px, 100%); display: grid; grid-template-columns: minmax(0, .9fr) minmax(380px, 1.1fr); gap: clamp(34px, 8vw, 112px); align-items: center; }
.title-copy { max-width: 500px; }
.eyebrow { margin: 0 0 15px; color: var(--brass); font-size: 10px; font-weight: 600; letter-spacing: .22em; line-height: 1.5; text-transform: uppercase; }
h1, h2, p { margin-top: 0; }
h1, h2 { font-family: var(--serif); font-weight: 400; letter-spacing: -.035em; }
h1 { margin-bottom: 22px; color: var(--paper); font-size: clamp(68px, 10vw, 132px); line-height: .82; }
h1 em { color: var(--brass); font-style: italic; }
.dek { max-width: 380px; color: rgba(232, 222, 199, .74); font-family: var(--serif); font-size: clamp(18px, 2vw, 23px); line-height: 1.35; }
.title-rule { display: flex; gap: 12px; align-items: center; max-width: 240px; margin: 26px 0; color: var(--brass); }
.title-rule span { flex: 1; height: 1px; background: rgba(167, 131, 76, .55); }
.title-rule i { font-size: 12px; font-style: normal; }
.invitation { color: rgba(232, 222, 199, .52); font-size: 13px; line-height: 1.6; }
.choice-grid { display: grid; gap: 10px; margin-top: 28px; }
.choice, .button { border: 1px solid rgba(232, 222, 199, .42); background: transparent; color: var(--paper); }
.choice { display: flex; align-items: baseline; justify-content: space-between; gap: 18px; padding: 17px 18px; text-align: left; transition: border-color .2s, background .2s, transform .2s; }
.choice:hover { border-color: var(--brass); background: rgba(167, 131, 76, .12); transform: translateX(4px); }
.choice-primary { border-color: var(--brass); background: rgba(167, 131, 76, .13); }
.choice-label { font-family: var(--serif); font-size: 17px; }
.choice-detail { color: rgba(232, 222, 199, .5); font-size: 11px; }
.title-note { margin-top: 23px; max-width: 410px; color: rgba(232, 222, 199, .52); font-size: 12px; line-height: 1.6; }
.title-note summary { cursor: pointer; color: var(--brass); font-size: 10px; letter-spacing: .14em; text-transform: uppercase; }
.title-note p { margin: 10px 0 0; }
.title-plate { position: relative; min-height: 440px; padding: 18px; border: 1px solid rgba(167, 131, 76, .34); background: rgba(14, 13, 11, .68); box-shadow: 18px 18px 0 rgba(0, 0, 0, .22); transform: rotate(1.2deg); }
.title-plate::after { content: ''; position: absolute; inset: 9px; border: 1px solid rgba(232, 222, 199, .12); pointer-events: none; }
.title-plate img { display: block; width: 100%; height: 100%; min-height: 400px; object-fit: cover; filter: sepia(.25) contrast(.92); }
.plate-caption { position: absolute; right: 28px; bottom: 25px; color: rgba(232, 222, 199, .75); font-family: var(--serif); font-size: 12px; line-height: 1.4; text-align: right; }
.plate-caption span { color: var(--brass); font-size: 10px; letter-spacing: .1em; text-transform: uppercase; }

.story-screen, .practice-screen, .game-screen, .end-screen { background: var(--paper); color: var(--ink); }
.story-wrap, .end-screen > * { width: min(650px, 100%); margin-left: auto; margin-right: auto; }
.story-screen { padding-top: clamp(150px, 23vh, 240px); }
.story-wrap { margin: 0 auto; }
.story-screen h2, .end-screen h2 { margin-bottom: 28px; font-size: clamp(44px, 7vw, 78px); line-height: .95; }
.story-text { font-family: var(--serif); font-size: 18px; line-height: 1.75; }
.story-text p { margin: 0 0 20px; }
.story-text em { color: var(--oxblood); }
.story-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 20px; margin-top: 36px; }
.button { min-height: 44px; padding: 12px 20px; color: var(--ink); border-color: var(--ink); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; }
.button-primary { background: var(--ink); color: var(--paper); }
.button-primary:hover { background: var(--oxblood); border-color: var(--oxblood); }
.story-actions .text-button, .practice-screen .text-button, .game-screen .text-button, .end-screen .text-button { color: var(--ink); }

.practice-screen { padding-top: 132px; }
.section-heading { width: min(980px, 100%); display: flex; justify-content: space-between; gap: 25px; align-items: start; margin: 0 auto 20px; border-bottom: 1px solid var(--line); padding-bottom: 20px; }
.section-heading h2 { margin: 0; font-size: clamp(48px, 7vw, 78px); line-height: .9; }
.section-lede { width: min(620px, 100%); margin: 0 auto 34px; color: #574b3d; font-family: var(--serif); font-size: 17px; line-height: 1.65; }
.shape-reference { width: min(720px, 100%); display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 0 auto 16px; }
.shape-card { display: grid; place-items: center; gap: 7px; min-height: 116px; border: 1px solid var(--line); background: rgba(255,255,255,.22); }
.shape-card strong { font-family: var(--serif); font-size: 16px; }
.shape-card small { color: var(--muted); font-size: 10px; }
.shape-mark { width: 28px; height: 28px; background: var(--ink); }
.shape-mark.fa { clip-path: polygon(4% 7%, 96% 92%, 4% 92%); }
.shape-mark.sol { border-radius: 50%; }
.shape-mark.la { width: 32px; height: 24px; }
.shape-mark.mi { transform: rotate(45deg) scale(.72); }
.scale-note { width: min(720px, 100%); margin: 0 auto 30px; padding: 13px 16px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); color: #574b3d; font-family: var(--serif); font-size: 13px; line-height: 1.8; text-align: center; }
.scale-note span { margin: 0 8px; color: var(--oxblood); font-family: var(--sans); font-size: 9px; letter-spacing: .16em; text-transform: uppercase; }
.practice-list { width: min(900px, 100%); display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 0 auto; }
.practice-card { display: flex; justify-content: space-between; align-items: center; gap: 16px; min-height: 72px; padding: 14px 16px; border: 1px solid var(--line); background: rgba(255,255,255,.15); color: var(--ink); text-align: left; }
.practice-card:hover { border-color: var(--brass); background: rgba(167, 131, 76, .1); }
.practice-name { font-family: var(--serif); font-size: 16px; }
.practice-meta { color: var(--muted); font-size: 10px; text-align: right; }
.quiet-note { color: var(--muted); font-size: 12px; line-height: 1.6; }
.practice-screen > .quiet-note { text-align: center; }

.game-screen { padding-top: 118px; }
.game-topline, .game-heading, .book-panel, .game-controls, .game-footer { width: min(1080px, 100%); margin-left: auto; margin-right: auto; }
.game-topline { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; margin-bottom: 32px; color: var(--muted); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; }
.game-topline > :nth-child(2) { text-align: center; }
.game-topline > :last-child { justify-self: end; }
.game-heading { display: flex; justify-content: space-between; gap: 25px; align-items: end; margin-bottom: 28px; }
.game-heading h2 { margin: 0 0 8px; font-size: clamp(42px, 6vw, 74px); line-height: .9; }
.tune-meta { margin: 0; color: var(--muted); font-family: var(--serif); font-size: 13px; }
.bench-state { flex: 0 0 196px; display: grid; gap: 7px; justify-items: stretch; }
.bench-state-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.bench-label { color: var(--muted); font-size: 9px; letter-spacing: .16em; text-transform: uppercase; white-space: nowrap; }
.bench-risk { max-width: 122px; color: var(--muted); font-family: var(--serif); font-size: 11px; font-style: italic; line-height: 1.15; text-align: right; }
.hollow-square-map { position: relative; width: 100%; height: 110px; border: 1px solid rgba(33, 23, 15, .52); background: rgba(235, 207, 153, .22); box-shadow: inset 0 0 0 4px rgba(235, 207, 153, .12); }
.hollow-square-map::before { content: ''; position: absolute; left: 50%; top: 50%; width: 44px; height: 27px; border: 1px solid rgba(33, 23, 15, .4); transform: translate(-50%, -50%); background: rgba(221, 193, 138, .26); }
.hollow-square-map::after { content: ''; }
.square-bench { position: absolute; display: block; color: var(--ink); font-family: var(--serif); font-size: 10px; line-height: 1; text-transform: capitalize; }
.square-bench-north, .square-bench-south { left: 50%; width: 94px; height: 26px; transform: translateX(-50%); }
.square-bench-north { top: 7px; }
.square-bench-south { bottom: 7px; }
.square-bench-west, .square-bench-east { top: 50%; width: 26px; height: 94px; transform: translateY(-50%); }
.square-bench-west { left: 7px; }
.square-bench-east { right: 7px; }
.bench-seat { position: absolute; display: block; border: 1px solid rgba(33, 23, 15, .8); background: linear-gradient(180deg, rgba(185, 138, 77, .82), rgba(116, 72, 34, .7)); box-shadow: inset 0 2px 0 rgba(255, 239, 195, .2), 2px 2px 0 rgba(33, 23, 15, .12); }
.square-bench-north .bench-seat, .square-bench-south .bench-seat { inset: 0 0 auto; height: 13px; }
.square-bench-south .bench-seat { top: auto; bottom: 0; }
.square-bench-west .bench-seat, .square-bench-east .bench-seat { inset: 0 auto 0 0; width: 13px; }
.square-bench-east .bench-seat { left: auto; right: 0; }
.bench-empty-mark { display: none; position: absolute; z-index: 2; width: 16px; height: 16px; border-top: 1px solid var(--oxblood); border-bottom: 1px solid var(--oxblood); transform: rotate(-14deg); }
.square-bench-north .bench-empty-mark, .square-bench-south .bench-empty-mark { left: 50%; top: -2px; transform: translateX(-50%) rotate(-14deg); }
.square-bench-west .bench-empty-mark, .square-bench-east .bench-empty-mark { top: 50%; left: 7px; transform: translateY(-50%) rotate(76deg); }
.square-bench-east .bench-empty-mark { left: auto; right: 7px; }
.square-bench.lost .bench-seat { border-color: var(--oxblood); background: repeating-linear-gradient(166deg, rgba(116, 53, 35, .15) 0 3px, rgba(33, 23, 15, .58) 3px 5px, rgba(116, 53, 35, .08) 5px 8px); box-shadow: none; opacity: .7; }
.square-bench.lost .bench-empty-mark { display: block; }
.bench-loss .book-panel { animation: bench-loss-shudder .46s ease-out; }
.bench-loss .square-bench:not(.lost) .bench-seat { animation: bench-loss-pulse .62s ease-out; }
@keyframes bench-loss-shudder {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px) rotate(-.2deg); }
  55% { transform: translateX(3px) rotate(.16deg); }
  78% { transform: translateX(-1px); }
}
@keyframes bench-loss-pulse {
  0%, 100% { box-shadow: inset 0 0 0 2px rgba(232, 220, 192, .35); }
  45% { box-shadow: 0 0 0 5px rgba(116, 53, 35, .2), inset 0 0 0 2px rgba(116, 53, 35, .45); }
}
.book-panel { display: grid; grid-template-columns: 72px 1fr; min-height: 260px; border: 1px solid rgba(32,27,22,.35); background: linear-gradient(90deg, rgba(148,121,79,.16), rgba(255,255,255,.22)); box-shadow: 8px 8px 0 rgba(32,27,22,.1); }
.book-margin { display: flex; flex-direction: column; justify-content: space-between; padding: 20px 12px; border-right: 1px solid var(--line); color: var(--oxblood); font-family: var(--serif); font-size: 12px; font-style: italic; writing-mode: vertical-rl; transform: rotate(180deg); }
.staff-wrap { padding: clamp(25px, 5vw, 54px) clamp(18px, 5vw, 72px) 22px; overflow: hidden; }
.lyric { margin: 26px 0 0; color: rgba(32,27,22,.72); font-family: var(--serif); font-size: clamp(16px, 2vw, 20px); font-style: italic; line-height: 1.4; }
.game-feedback { width: min(720px, 100%); min-height: 62px; margin: 26px auto 12px; color: var(--oxblood); font-family: var(--serif); font-size: 18px; line-height: 1.45; text-align: center; }
.game-feedback.is-error { color: var(--oxblood); }
.game-controls { display: grid; grid-template-columns: 1fr auto; gap: 26px; align-items: end; margin-top: 12px; }
.shape-keys { display: grid; grid-template-columns: repeat(5, minmax(58px, 1fr)); gap: 8px; }
.shape-key { min-height: 74px; display: grid; place-items: center; gap: 5px; border: 1px solid rgba(32,27,22,.45); background: rgba(255,255,255,.18); color: var(--ink); }
.shape-key:hover:not(:disabled), .shape-key:focus-visible:not(:disabled) { border-color: var(--oxblood); background: rgba(122,40,37,.08); }
.shape-key:disabled { cursor: default; opacity: .35; }
.shape-key .shape-mark { width: 20px; height: 20px; }
.shape-key .shape-mark.la { width: 24px; height: 16px; }
.shape-key .key-name { font-family: var(--serif); font-size: 12px; }
.shape-key .key-shortcut { color: var(--muted); font-size: 9px; letter-spacing: .12em; text-transform: uppercase; }
.utility-controls { display: grid; gap: 12px; justify-items: end; }
.button-quiet { color: var(--ink); background: transparent; white-space: nowrap; }
.button-quiet:hover { background: var(--ink); color: var(--paper); }
.game-footer { display: flex; justify-content: space-between; margin-top: 24px; color: var(--muted); font-size: 10px; letter-spacing: .11em; text-transform: uppercase; }

.end-screen { display: grid; align-content: center; justify-items: center; min-height: 100vh; text-align: center; }
.end-screen .eyebrow { margin-top: 0; }
.end-screen h2 { width: min(750px, 100%); }
.end-screen .story-text { width: min(650px, 100%); }
.end-mark { margin-bottom: 16px; color: var(--oxblood); font-size: 40px; }

.drawer, .reference-card { position: fixed; z-index: 20; inset: 0; }
.drawer-scrim { position: absolute; inset: 0; background: rgba(0,0,0,.64); }
.drawer-panel, .reference-panel { position: absolute; top: 0; right: 0; bottom: 0; width: min(430px, 92vw); padding: 42px 30px; overflow: auto; background: var(--paper); color: var(--ink); box-shadow: -16px 0 30px rgba(0,0,0,.24); }
.drawer-heading { display: flex; justify-content: space-between; gap: 20px; align-items: start; border-bottom: 1px solid var(--line); padding-bottom: 20px; }
.drawer-heading h2 { margin: 0; font-size: 36px; }
.close-button { border: 0; background: transparent; color: var(--ink); font-size: 28px; line-height: 1; }
.drawer-copy { margin: 23px 0; color: #574b3d; font-family: var(--serif); font-size: 16px; line-height: 1.6; }
.settings-form { display: grid; gap: 20px; }
.settings-form label { display: grid; gap: 8px; color: var(--ink); font-size: 12px; line-height: 1.4; }
.settings-form select { min-height: 42px; padding: 8px 10px; border: 1px solid rgba(32,27,22,.42); border-radius: 0; background: transparent; color: var(--ink); }
.check-row { grid-template-columns: 18px 1fr !important; align-items: start; }
.check-row input { width: 18px; height: 18px; margin: 0; accent-color: var(--oxblood); }
.drawer-foot { margin-top: 30px; padding-top: 18px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; line-height: 1.6; }
.reference-content { padding-top: 24px; font-family: var(--serif); font-size: 17px; line-height: 1.65; }
.reference-tune { color: var(--oxblood); font-size: 21px; }

@media (max-width: 820px) {
  .title-layout { grid-template-columns: 1fr; }
  .title-copy { max-width: 620px; margin: 0 auto; }
  .title-plate { min-height: 290px; max-width: 620px; width: 100%; margin: 0 auto; }
  .title-plate img { min-height: 250px; }
  .game-controls { grid-template-columns: 1fr; }
  .utility-controls { grid-template-columns: 1fr auto; align-items: center; justify-items: stretch; }
  .utility-controls .text-button { justify-self: end; }
}
@media (max-width: 560px) {
  .masthead { padding: 18px; }
  .sound-note { display: none; }
  .screen { padding-left: 18px; padding-right: 18px; }
  .title-screen { padding-top: 90px; }
  h1 { font-size: clamp(64px, 22vw, 100px); }
  .choice { display: grid; gap: 5px; }
  .title-plate { min-height: 220px; padding: 10px; }
  .title-plate img { min-height: 200px; }
  .shape-reference { grid-template-columns: repeat(2, 1fr); }
  .practice-list { grid-template-columns: 1fr; }
  .section-heading { align-items: end; }
  .section-heading h2 { font-size: 52px; }
  .game-topline { grid-template-columns: 1fr auto; gap: 10px; }
  .game-topline > :nth-child(2) { display: none; }
  .game-topline > :last-child { grid-column: 2; grid-row: 1; }
  .game-heading { align-items: start; }
  .game-heading h2 { font-size: 45px; }
  .bench-state { flex-basis: 168px; padding-top: 5px; }
  .bench-label { font-size: 8px; letter-spacing: .12em; }
  .bench-risk { max-width: 105px; font-size: 10px; }
  .hollow-square-map { height: 96px; }
  .square-bench-north, .square-bench-south { width: 78px; height: 23px; }
  .square-bench-west, .square-bench-east { height: 78px; width: 23px; }
  .book-panel { grid-template-columns: 42px 1fr; }
  .book-margin { padding: 13px 8px; font-size: 10px; }
  .staff-wrap { padding: 24px 13px 18px; overflow-x: auto; }
  .staff { min-width: 630px; }
  .lyric { max-width: 630px; }
  .shape-keys { gap: 5px; }
  .shape-key { min-height: 68px; }
  .shape-key .key-name { font-size: 11px; }
  .game-footer { font-size: 9px; }
  .game-footer span:last-child { text-align: right; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

/* The original Hollow Square UI is part of the fiction: a single old page
   surrounded by a dark room. Keep the newer flow, but return to that grammar. */
body { overflow-y: auto; background: #070605; color: #241c12; font-family: 'Iowan Old Style', 'Palatino Linotype', Palatino, Georgia, serif; }
.ambient { opacity: .45; }
.masthead { position: absolute; top: 13px; left: 50%; right: auto; width: min(960px, 96vw); transform: translateX(-50%); padding: 0 12px; color: rgba(232, 220, 192, .55); font-family: var(--sans); font-size: 10px; letter-spacing: .13em; }
.on-title .masthead { visibility: hidden; }
.wordmark { color: rgba(232, 220, 192, .55); }
.wordmark span { color: rgba(232, 220, 192, .8); }
.text-button { color: inherit; font-family: var(--sans); font-variant: small-caps; font-size: 11px; letter-spacing: .13em; }
.screen { position: relative; width: min(960px, 96vw); min-height: 0; margin: clamp(32px, 6vh, 58px) auto; padding: 34px 48px 40px; background: radial-gradient(ellipse 120% 90% at 50% 30%, #e8dcc0 0%, #d8c9a6 85%, #c4b28d 100%); color: #241c12; box-shadow: 0 0 0 1px #1a1408, 0 8px 60px rgba(0,0,0,.9), inset 0 0 80px rgba(80,60,20,.25), inset 0 0 8px rgba(60,40,10,.3); }
.screen::after { content: ''; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(circle 90px at 88% 12%, rgba(90,60,20,.10), transparent 70%), radial-gradient(circle 140px at 8% 90%, rgba(70,45,15,.12), transparent 70%), radial-gradient(circle 60px at 15% 8%, rgba(90,60,20,.08), transparent 70%); }
.story-screen::before, .practice-screen::before, .game-screen::before, .end-screen::before { content: ''; position: absolute; inset: 0; pointer-events: none; z-index: 0; background: none; opacity: 0; }
.screen > *, .drawer-panel > *, .reference-panel > * { position: relative; z-index: 1; }
.title-screen { display: block; background: radial-gradient(ellipse 120% 90% at 50% 30%, #e8dcc0 0%, #d8c9a6 85%, #c4b28d 100%); }
.title-layout { width: 100%; display: flex; flex-direction: column; gap: 20px; align-items: stretch; }
.title-copy { max-width: none; text-align: center; }
.eyebrow { color: #705523; font-variant: small-caps; font-size: 11px; letter-spacing: .18em; }
h1, h2 { color: #241c12; }
h1 { margin: 7px 0 4px; font-size: clamp(40px, 5.4vw, 58px); font-style: normal; font-weight: 600; letter-spacing: .16em; line-height: 1; text-transform: uppercase; }
h1 em { color: inherit; font-style: normal; }
.dek { max-width: 680px; margin: 8px auto; color: #241c12; font-size: 15px; line-height: 1.65; }
.title-rule { max-width: none; margin: 10px auto; gap: 0; }
.title-rule span { background: rgba(36,28,18,.7); }
.title-rule i { display: none; }
.invitation { color: #241c12; font-size: 13px; font-style: italic; }
.choice-grid { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; margin-top: 24px; }
.choice { display: grid; gap: 5px; min-width: 185px; padding: 10px 30px; border: 1.5px solid #241c12; color: #241c12; text-align: center; }
.choice:hover { background: #241c12; color: #e8dcc0; transform: none; }
.choice-primary { background: transparent; }
.choice-label { font-size: 16px; font-variant: small-caps; letter-spacing: .13em; }
.choice-detail { color: inherit; font-size: 11px; opacity: .7; }
.title-note { width: min(680px, 100%); margin: 15px auto 0; color: rgba(36,28,18,.72); text-align: center; }
.title-note summary { color: #5f491f; }
.title-plate { width: min(680px, 100%); min-height: 250px; margin: 4px auto 0; padding: 10px; border: 1px solid rgba(36,28,18,.35); background: rgba(255,255,255,.16); box-shadow: none; transform: none; }
.title-plate::after { inset: 5px; border-color: rgba(36,28,18,.25); }
.title-plate img { min-height: 230px; filter: none; opacity: .78; }
.plate-caption { right: 19px; bottom: 14px; color: rgba(36,28,18,.78); }
.plate-caption span { color: #705523; }

.story-screen { padding-top: 40px; }
.story-wrap { width: min(620px, 100%); }
.story-screen h2, .end-screen h2 { font-size: 22px; font-weight: 600; letter-spacing: .24em; line-height: 1.2; text-align: center; text-transform: uppercase; }
.story-screen .eyebrow, .end-screen .eyebrow { text-align: center; }
.story-text { font-size: 17.5px; line-height: 1.85; text-align: justify; }
.story-text p { text-indent: 2em; }
.story-text p:first-child { text-indent: 0; }
.story-illustration { width: min(620px, 100%); margin: 18px auto 26px; border: 1px solid rgba(36, 28, 18, .38); background: #d8c8a6; box-shadow: 6px 6px 0 rgba(36, 28, 18, .1); }
.story-illustration img { display: block; width: 100%; height: auto; filter: saturate(1.04) contrast(1.02); }
.story-actions { justify-content: center; }
.story-actions .text-button, .practice-screen .text-button, .game-screen .text-button, .end-screen .text-button { color: #241c12; }
.button { border: 1.5px solid #241c12; color: #241c12; font-family: inherit; font-variant: small-caps; }
.button-primary { background: transparent; color: #241c12; }
.button-primary:hover { background: #241c12; color: #e8dcc0; border-color: #241c12; }

.practice-screen { padding-top: 38px; }
.section-heading { width: 100%; align-items: center; margin-bottom: 14px; padding-bottom: 0; border-bottom: 0; }
.section-heading h2 { font-size: 20px; font-weight: 600; letter-spacing: .24em; text-transform: uppercase; }
.section-heading .text-button { border: 1.5px solid #241c12; padding: 8px 14px; text-decoration: none; }
.section-lede { max-width: 680px; margin: 14px auto 18px; color: #241c12; font-size: 15px; line-height: 1.65; text-align: center; }
.shape-reference { gap: 8px; max-width: 680px; margin-bottom: 18px; }
.shape-card { min-height: 80px; border: 1px solid rgba(36,28,18,.45); background: rgba(255,255,255,.08); }
.shape-card strong { font-variant: small-caps; letter-spacing: .12em; }
.shape-card small { font-size: 11px; }
.scale-note { max-width: 680px; margin-bottom: 18px; border-color: #241c12; font-size: 13px; }
.practice-list { max-width: 760px; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.practice-card { min-height: 58px; padding: 10px 12px; border: 1px solid rgba(36,28,18,.45); background: rgba(255,255,255,.08); }
.practice-name { font-variant: small-caps; letter-spacing: .08em; }
.practice-card:hover { background: rgba(138,109,47,.12); }

.game-screen { padding-top: 34px; }
.game-topline { width: 100%; margin-bottom: 18px; font-family: var(--sans); font-size: 10px; }
.game-heading { width: 100%; margin-bottom: 20px; }
.game-heading h2 { margin-bottom: 5px; font-size: 24px; letter-spacing: .14em; text-transform: uppercase; }
.tune-meta { font-size: 12px; }
.book-panel { width: 100%; min-height: 220px; background: rgba(255,255,255,.18); box-shadow: inset 0 0 24px rgba(80,60,20,.1); }
.book-margin { color: #5a1212; }
.staff-wrap { padding: 38px 36px 20px; }
.staff { min-height: 122px; }
.lyric { margin-top: 18px; font-size: 16px; }
.game-feedback { min-height: 54px; margin: 18px auto 8px; font-size: 16px; }
.game-controls { width: 100%; }
.shape-key { min-height: 64px; border: 1px solid rgba(36,28,18,.45); background: rgba(255,255,255,.08); }
.button-quiet { border: 1.5px solid #241c12; }
.game-footer { width: 100%; margin-top: 16px; }

.end-screen { display: grid; align-content: center; background: radial-gradient(ellipse 120% 90% at 50% 30%, #e8dcc0 0%, #d8c9a6 85%, #c4b28d 100%); }
.end-screen h2 { width: 100%; }
.end-mark { color: #5a1212; }
.drawer-panel, .reference-panel { background: #e8dcc0; color: #241c12; }

@media (max-width: 700px) {
  .story-screen::before, .practice-screen::before, .game-screen::before, .end-screen::before { background-size: min(72vw, 360px) auto; background-position: right 3% bottom 2%; opacity: .075; }
}

@media (max-width: 700px) {
  .masthead { width: 96vw; }
  .screen { width: min(960px, 96vw); padding: 24px 18px 30px; }
  .title-screen { padding-top: 34px; }
  .title-plate { min-height: 190px; }
  .title-plate img { min-height: 170px; }
  .story-illustration { margin-top: 14px; margin-bottom: 20px; box-shadow: 4px 4px 0 rgba(36, 28, 18, .1); }
  .choice-grid { display: grid; }
  .choice { width: 100%; }
  .practice-list { grid-template-columns: 1fr; }
  .game-controls { grid-template-columns: 1fr; }
}

/* Exact opening-page treatment from the earlier build. */
.legacy-frame { border: 2px solid #241c12; outline: 1px solid #241c12; outline-offset: 5px; padding: 42px 36px 36px; text-align: center; }
.legacy-frame .title-copy { text-align: center; }
.legacy-frame .smallcaps { font-variant: small-caps; letter-spacing: .14em; }
.legacy-frame h1 { margin: 8px 0 2px; font-size: clamp(34px, 5.4vw, 58px); letter-spacing: .16em; font-weight: 600; }
.legacy-frame .sub { margin: 8px 0; font-size: 15px; font-style: italic; }
.legacy-frame .decl { margin: 10px 0; font-size: 13px; letter-spacing: .08em; line-height: 1.9; }
.legacy-frame .legacy-italic { font-style: italic; }
.legacy-frame .legacy-meta { font-size: 12px; }
.legacy-frame .rule { border: none; border-top: 1px solid #241c12; width: 60%; margin: 10px auto; }
.legacy-frame .rule.short { width: 22%; }
.legacy-frame .rule.dbl { width: 74%; border-top: 3px double #241c12; }
.legacy-frame .choice-grid { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; margin-top: 26px; }
.legacy-frame .choice { display: block; min-width: 0; padding: 10px 30px; border: 1.5px solid #241c12; background: transparent; color: #241c12; font-family: inherit; font-size: 16px; letter-spacing: .18em; font-variant: small-caps; }
.legacy-frame .choice-primary { border-color: #8a6d2f; color: #5f491f; }
.legacy-frame .choice:hover { background: #241c12; color: #e8dcc0; }
.legacy-frame .choice-primary:hover { background: #8a6d2f; color: #e8dcc0; }
.keys-hint { margin-top: 14px; color: #241c12; font-family: var(--sans); font-size: 12px; opacity: .75; letter-spacing: .1em; }
.warn { margin-top: 20px; color: #5a1212; font-size: 12.5px; font-style: italic; letter-spacing: .05em; }
.legacy-frame .title-plate { width: min(520px, 100%); min-height: 0; margin: 22px auto 0; padding: 0; border: 0; outline: 0; background: transparent; box-shadow: none; }
.legacy-frame .title-plate::after { display: none; }
.legacy-frame .title-plate img { display: block; width: 100%; height: auto; min-height: 0; object-fit: contain; opacity: 1; mix-blend-mode: normal; filter: none; }
@media (max-width: 700px) {
  .legacy-frame { padding: 28px 14px 30px; }
  .legacy-frame .choice-grid { display: grid; }
  .legacy-frame .choice { width: 100%; }
}

/* Carry the vignette's hand-inked, well-used book language through the play
   surfaces without turning the controls into illustrations. */
.story-screen, .practice-screen, .game-screen, .end-screen {
  background-color: #e8dcc0;
  background-image:
    repeating-linear-gradient(9deg, rgba(63, 43, 20, .018) 0 1px, transparent 1px 7px),
    repeating-linear-gradient(101deg, transparent 0 13px, rgba(255, 255, 255, .045) 13px 14px, transparent 14px 27px),
    radial-gradient(ellipse 120% 90% at 50% 30%, #e8dcc0 0%, #d8c9a6 85%, #c4b28d 100%);
}
.story-screen::after, .practice-screen::after, .game-screen::after, .end-screen::after {
  background:
    repeating-linear-gradient(173deg, transparent 0 21px, rgba(45, 32, 18, .025) 21px 22px, transparent 22px 43px),
    radial-gradient(circle 90px at 88% 12%, rgba(90,60,20,.10), transparent 70%),
    radial-gradient(circle 140px at 8% 90%, rgba(70,45,15,.12), transparent 70%);
}
.story-screen::before, .practice-screen::before, .game-screen::before, .end-screen::before { opacity: 0; }
.story-wrap, .section-heading, .section-lede, .shape-reference, .scale-note,
.practice-list, .game-topline, .game-heading, .book-panel, .game-controls, .game-footer,
.end-screen > * { text-shadow: 0 1px rgba(255, 250, 232, .2); }
.button, .choice, .practice-card, .shape-key, .book-panel, .drawer-panel, .reference-panel {
  background-image: repeating-linear-gradient(168deg, transparent 0 13px, rgba(45, 32, 18, .018) 13px 14px, transparent 14px 28px);
}
.button, .choice, .practice-card, .shape-key { box-shadow: inset 0 0 0 1px rgba(255, 248, 224, .11); }
.book-panel { border-color: rgba(36, 28, 18, .52); box-shadow: 8px 8px 0 rgba(36, 28, 18, .1), inset 0 0 30px rgba(80, 60, 20, .13); }
.book-margin { border-right-color: rgba(36, 28, 18, .28); }
.staff { background: repeating-linear-gradient(to bottom, transparent 0, transparent 24px, rgba(32,27,22,.23) 25px, transparent 26px), repeating-linear-gradient(169deg, transparent 0 17px, rgba(45,32,18,.025) 17px 18px, transparent 18px 36px); }
.game-feedback { text-shadow: 0 1px rgba(255, 250, 232, .35); }
.first-play-cue { margin: -2px auto 16px; color: var(--muted); font-family: var(--serif); font-size: 13px; font-style: italic; text-align: center; }
.bench-dot { box-shadow: inset 0 0 0 2px rgba(232, 220, 192, .35); }
.drawer-panel, .reference-panel { background-color: #e8dcc0; background-image: repeating-linear-gradient(9deg, rgba(63, 43, 20, .018) 0 1px, transparent 1px 7px); }

/* UI palette pulled from the illustration plates: forest cloth, candle gold,
   old wood, and near-black printed ink. */
:root { --ink: #21170f; --paper: #ddc18a; --paper-deep: #b98a4d; --muted: #68472c; --oxblood: #743523; --brass: #b8782e; --forest: #294536; }
.screen, .drawer-panel, .reference-panel { color: var(--ink); }
.title-screen, .story-screen, .practice-screen, .game-screen, .end-screen, .drawer-panel, .reference-panel { background-color: var(--paper); }
.title-screen, .end-screen { background-image: radial-gradient(ellipse 120% 90% at 50% 30%, #e3c995 0%, #c9a265 85%, #9d7542 100%); }
.story-screen, .practice-screen, .game-screen { background-image: repeating-linear-gradient(9deg, rgba(63, 43, 20, .026) 0 1px, transparent 1px 7px), repeating-linear-gradient(101deg, transparent 0 13px, rgba(255, 239, 195, .07) 13px 14px, transparent 14px 27px), radial-gradient(ellipse 120% 90% at 50% 30%, #ddc18a 0%, #c49b5e 85%, #9f7542 100%); }
.eyebrow, .book-margin, .reference-tune { color: var(--forest); }
.story-text em, .game-feedback, .end-mark { color: var(--oxblood); }
.story-illustration { border: 2px solid var(--ink); background: #d8c397; box-shadow: 7px 7px 0 rgba(33, 23, 15, .18), inset 0 0 0 1px rgba(255, 243, 207, .24); }
.story-illustration img { filter: saturate(1.1) contrast(1.06); }
.story-screen h2, .practice-screen h2, .game-screen h2, .end-screen h2, .drawer-heading h2 { color: var(--forest); }
.button, .choice, .practice-card, .shape-key, .button-quiet { border-color: var(--ink); color: var(--ink); }
.button-primary, .choice-primary { border-color: var(--forest); color: var(--forest); }
.button-primary:hover, .choice:hover, .choice-primary:hover, .button-quiet:hover { background: var(--forest); color: var(--paper); border-color: var(--forest); }
.choice-primary { background: rgba(48, 71, 55, .06); }
.book-panel { border: 2px solid var(--ink); background: #a9723e; box-shadow: 8px 8px 0 rgba(33, 23, 15, .2), inset 0 0 30px rgba(80, 38, 12, .2); }
.staff-wrap { background: rgba(235, 207, 153, .46); }
.book-margin { border-right: 1px solid rgba(33, 23, 15, .45); }
.staff { border-top: 2px solid rgba(33, 23, 15, .7); border-bottom: 2px solid rgba(33, 23, 15, .7); }
.shape-key, .practice-card { background-color: rgba(235, 207, 153, .2); }
.shape-key:hover:not(:disabled), .shape-key:focus-visible:not(:disabled), .practice-card:hover { border-color: var(--forest); background: rgba(48, 71, 55, .18); }
.shape-key .key-shortcut, .tune-meta, .practice-meta, .quiet-note { color: var(--muted); }

/* Keep the HTML hidden state authoritative for controls as well as screens. */
[hidden] { display: none !important; }

/* The primary line is an SVG engraving so stems, clefs, meters, bars, and
   ledger lines stay in one coordinate system at every viewport width. */
.staff {
  display: block;
  min-height: 154px;
  padding: 0;
  border: 0;
  background: none;
  overflow: visible;
}
.osmd-staff { display: block; width: 100%; min-width: 760px; min-height: 190px; color: var(--ink); }
.osmd-staff svg { display: block; width: 100%; height: auto; min-height: 190px; overflow: visible; }
.osmd-staff .vf-stave path,
.osmd-staff .vf-stave line,
.osmd-staff .vf-clef path,
.osmd-staff .vf-timesignature path,
.osmd-staff .vf-timesignature text,
.osmd-staff .vf-keysignature path,
.osmd-staff .vf-keysignature text,
.osmd-staff .vf-stem,
.osmd-staff .vf-beam,
.osmd-staff .vf-flag { stroke: var(--ink); fill: var(--ink); }
.osmd-staff .vf-stave path,
.osmd-staff .vf-stave line { stroke-width: 1.4px; }
.svg-clef-path { fill: none; stroke: var(--ink); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; }
.svg-clef-path.bass-clef { stroke-width: 3.5; }
.osmd-staff .note-blot { fill: var(--ink); opacity: .86; pointer-events: none; }
.osmd-staff .note-blot .blot-edge { fill: var(--oxblood); opacity: .28; }
.osmd-staff .note-blot .blot-scratch { fill: none; stroke: var(--ink); stroke-width: 1.2px; opacity: .58; }
.osmd-staff .note-eye { pointer-events: none; }
.osmd-staff .note-eye .eye-outer { fill: var(--ink); stroke: var(--oxblood); stroke-width: 1.4px; }
.osmd-staff .note-eye .eye-lid { fill: none; stroke: var(--paper); stroke-width: 1.4px; stroke-linecap: round; opacity: .74; }
.osmd-staff .note-eye .eye-iris { fill: var(--paper); stroke: var(--oxblood); stroke-width: 1px; }
.osmd-staff .note-eye .eye-pupil { fill: var(--oxblood); }
.staff-accessibility { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.staff-note-label { display: block; }

.harmony-tools { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 16px; margin: 14px 0 0; }
.harmony-tools .button { min-height: 36px; padding: 7px 12px; }
.harmony-status { color: var(--muted); font-family: var(--serif); font-size: 12px; }
.harmony-plate { margin: 16px 0 0; padding: 12px 10px 8px; border: 1px solid rgba(33, 23, 15, .55); background: rgba(235, 207, 153, .38); overflow-x: auto; }
.harmony-engraving { display: block; width: 100%; min-width: 680px; height: auto; color: var(--ink); }
.harmony-engraving .mini-lines { stroke: rgba(33, 23, 15, .62); stroke-width: 1.25; vector-effect: non-scaling-stroke; }
.harmony-engraving .mini-bar { stroke: rgba(33, 23, 15, .55); stroke-width: 1; vector-effect: non-scaling-stroke; }
.harmony-engraving .mini-note { fill: var(--ink); }
.harmony-engraving .mini-stem { stroke: var(--ink); stroke-width: 1.2; vector-effect: non-scaling-stroke; }
.harmony-engraving .mini-label, .harmony-engraving .mini-time { fill: var(--muted); font-family: var(--serif); }
.harmony-engraving .mini-label { font-size: 13px; font-variant: small-caps; letter-spacing: .08em; }
.harmony-engraving .mini-time { font-size: 11px; }
.harmony-scroll-note { display: none; margin: 7px 2px 0; color: var(--muted); font-family: var(--serif); font-size: 11px; font-style: italic; }

@media (max-width: 700px) {
  .staff { min-width: 630px; }
  .osmd-staff { min-width: 760px; }
  .osmd-staff svg { min-height: 190px; }
  .harmony-tools { align-items: flex-start; }
  .harmony-status { flex-basis: 100%; }
  .harmony-scroll-note { display: block; }
}
