:root {
  color-scheme: light;
  --paper: #f3f0e7;
  --surface: #fffdf8;
  --ink: #17201f;
  --muted: #59635f;
  --rule: #c9c4b7;
  --soft-rule: #e1ddd2;
  --stage: #102320;
  --stage-ink: #f7f1df;
  --brass: #e8ae45;
  --brass-deep: #a86412;
  --focus: #2f6fed;
  --keep: #727b77;
  --add: #137b6c;
  --release: #b94032;
  --danger: #9d3028;
  --success-soft: #e5f3ed;
  --warning-soft: #fff1c9;
  --danger-soft: #f8e5e1;
  --mono: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  --sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --content: min(1240px, calc(100% - 40px));
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--paper);
  color: var(--ink);
  scroll-behavior: smooth;
  scroll-padding-top: 16px;
}

body {
  margin: 0;
  min-height: 100vh;
  font: 400 1rem/1.5 var(--sans);
  text-rendering: optimizeLegibility;
}

button,
select,
input {
  font: inherit;
}

button,
a,
select,
summary,
input {
  -webkit-tap-highlight-color: transparent;
}

button,
select,
summary {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: .55;
}

a {
  color: inherit;
  text-underline-offset: .18em;
}

a:hover {
  text-decoration-thickness: 2px;
}

button:focus-visible,
select:focus-visible,
input:focus-visible,
a:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

h1,
h2,
h3,
h4,
p,
dl,
dd,
ul {
  margin-top: 0;
}

h1,
h2,
h3,
h4 {
  line-height: 1.12;
  text-wrap: balance;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(1.9rem, 5vw, 2.75rem);
  letter-spacing: -.045em;
}

h2 {
  margin-bottom: .5rem;
  font-size: clamp(1.35rem, 2.5vw, 1.85rem);
  letter-spacing: -.025em;
}

h3 {
  margin-bottom: .55rem;
  font-size: 1rem;
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 8px;
  left: 8px;
  padding: 10px 14px;
  background: var(--ink);
  color: var(--surface);
  transform: translateY(-160%);
}

.skip-link:focus {
  transform: none;
}

.site-header {
  width: var(--content);
  margin: 0 auto;
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  border-bottom: 1px solid var(--rule);
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  color: var(--ink);
  text-decoration: none;
  font-size: .82rem;
  line-height: 1.05;
  letter-spacing: .02em;
}

.wordmark svg {
  width: 36px;
  height: 36px;
  fill: none;
  stroke: var(--brass-deep);
  stroke-width: 2.4;
}

.wordmark strong {
  font-size: .98rem;
}

.header-settings {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: .78rem;
  font-weight: 650;
}

.header-settings select {
  min-height: 44px;
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 0 30px 0 10px;
  background: var(--surface);
  color: var(--ink);
}

.quiet-link {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  padding: 0 8px;
}

main {
  width: var(--content);
  margin: 0 auto;
}

.intro {
  min-height: 126px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 520px);
  align-items: center;
  gap: 48px;
  padding: 22px 0 18px;
}

.eyebrow,
.context-label {
  margin-bottom: .35rem;
  color: var(--muted);
  font-size: .73rem;
  font-weight: 750;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.promise {
  margin-bottom: 0;
  color: var(--muted);
  font-size: clamp(1rem, 1.8vw, 1.15rem);
  line-height: 1.55;
}

.status-banner {
  margin: 0 0 12px;
  border: 1px solid #d5a128;
  border-radius: 8px;
  padding: 10px 14px;
  background: var(--warning-soft);
  font-size: .9rem;
}

.status-banner[data-kind="error"] {
  border-color: var(--danger);
  background: var(--danger-soft);
}

.tool-modes {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border: 1px solid var(--rule);
  border-bottom: 0;
  border-radius: 12px 12px 0 0;
  overflow: hidden;
}

.tool-modes button {
  min-height: 52px;
  border: 0;
  border-right: 1px solid var(--rule);
  padding: 0 18px;
  background: #e9e5da;
  color: var(--muted);
  text-align: left;
  font-weight: 700;
}

.tool-modes button:last-child {
  border-right: 0;
}

.tool-modes button span {
  margin-right: 8px;
  font-family: var(--mono);
  font-size: .72rem;
}

.tool-modes button[aria-pressed="true"] {
  background: var(--ink);
  color: var(--surface);
}

.workbench {
  overflow: hidden;
  border: 1px solid var(--rule);
  border-radius: 0 0 12px 12px;
  background: var(--surface);
}

.note-picker {
  display: grid;
  grid-template-columns: minmax(110px, 1fr) minmax(240px, 1.7fr) minmax(110px, 1fr);
  align-items: stretch;
  border-bottom: 1px solid var(--rule);
}

.step-button {
  min-height: 62px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.step-button:first-child {
  border-right: 1px solid var(--rule);
}

.step-button:last-child {
  border-left: 1px solid var(--rule);
}

.step-button:hover:not(:disabled) {
  background: #f2efe7;
}

.note-select-label {
  display: grid;
  grid-template-columns: auto minmax(130px, 190px);
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 8px 14px;
  color: var(--muted);
  font-size: .75rem;
  font-weight: 750;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.note-select-label select {
  min-height: 44px;
  border: 1px solid var(--ink);
  border-radius: 8px;
  padding: 0 34px 0 12px;
  background: var(--surface);
  color: var(--ink);
  font: 700 1.1rem var(--mono);
  text-transform: none;
}

.note-rail-shell {
  position: relative;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 44px;
  align-items: stretch;
  border-bottom: 1px solid var(--rule);
  background: #f7f4ec;
}

.note-rail {
  display: flex;
  gap: 5px;
  overflow-x: auto;
  padding: 8px 6px;
  scrollbar-width: thin;
  scroll-snap-type: x proximity;
}

.note-button {
  flex: 0 0 auto;
  min-width: 48px;
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: 7px;
  padding: 0 7px;
  background: transparent;
  color: var(--muted);
  font: 700 .8rem var(--mono);
  scroll-snap-align: center;
}

.note-button:hover {
  border-color: var(--rule);
  background: var(--surface);
}

.note-button[aria-current="true"] {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--surface);
}

.rail-step {
  border: 0;
  background: #ede9df;
  color: var(--ink);
  font-size: 1.5rem;
}

.rail-step:hover {
  background: #dfdbd0;
}

.finder-layout {
  display: grid;
  grid-template-columns: minmax(220px, .8fr) minmax(350px, 1.35fr) minmax(260px, 1fr);
  min-height: 620px;
}

.pitch-pane,
.diagram-pane,
.answer-pane {
  padding: clamp(20px, 3vw, 34px);
}

.pitch-pane,
.diagram-pane {
  border-right: 1px solid var(--rule);
}

.current-note {
  margin: .3rem 0 .55rem;
  font: 750 clamp(3.5rem, 7.5vw, 5rem)/.95 var(--mono);
  letter-spacing: -.08em;
}

.staff-container {
  min-height: 142px;
  display: grid;
  place-items: center;
  margin: 12px 0 18px;
  border-top: 1px solid var(--soft-rule);
  border-bottom: 1px solid var(--soft-rule);
}

.staff-fallback {
  margin: 0;
  color: var(--muted);
}

.staff-svg {
  width: min(100%, 220px);
  height: auto;
}

.staff-line {
  stroke: var(--ink);
  stroke-width: 1.5;
}

.staff-clef {
  fill: var(--ink);
  font: 58px serif;
}

.staff-note {
  fill: var(--ink);
}

.staff-accidental {
  fill: var(--ink);
  font: 25px Georgia, "Times New Roman", serif;
  font-weight: 700;
}

.fatal-fallback {
  margin: 0 auto 24px;
  width: var(--content);
  border: 2px solid var(--danger, #8a2d2d);
  border-radius: 10px;
  padding: 18px 20px;
  background: var(--surface);
}

.fatal-fallback h2,
.fatal-fallback p {
  margin-top: 0;
}

.print-only-meta {
  display: none;
  color: var(--muted);
  font-size: .75rem;
}

.pitch-facts {
  margin-bottom: 18px;
}

.pitch-facts div {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 9px 0;
  border-bottom: 1px solid var(--soft-rule);
}

.pitch-facts dt {
  color: var(--muted);
  font-size: .8rem;
  font-weight: 700;
}

.pitch-facts dd {
  margin: 0;
  font: 700 .92rem var(--mono);
  text-align: right;
}

.transposition-note {
  margin-bottom: 0;
  color: var(--muted);
  font-size: .82rem;
}

.diagram-pane {
  background: var(--stage);
  color: var(--stage-ink);
}

.diagram-pane .context-label,
.compare-diagram-pane .context-label {
  color: #aebbb6;
}

.diagram-heading-row,
.answer-heading,
.compare-title-row,
.section-heading-row,
.dialog-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.icon-action,
.dialog-close,
.text-button {
  min-height: 44px;
  border: 1px solid currentColor;
  border-radius: 8px;
  padding: 0 12px;
  background: transparent;
  color: inherit;
  font-weight: 700;
}

.sax-stage {
  width: 100%;
  min-height: 440px;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.sax-svg {
  width: 100%;
  max-width: 440px;
  max-height: 480px;
  display: block;
  overflow: visible;
}

.static-sax-fallback {
  width: 100%;
  max-width: 440px;
  max-height: 480px;
  display: block;
  object-fit: contain;
}

.sax-neck,
.sax-bell-rim,
.sax-rod,
.sax-bridge,
.callout-line {
  fill: none;
  stroke: #b9b49f;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sax-neck {
  stroke: var(--brass);
  stroke-width: 22;
}

.sax-mouthpiece {
  fill: #171a19;
  stroke: #d5caa9;
  stroke-width: 3;
}

.sax-body,
.sax-bell {
  fill: #916117;
  stroke: var(--brass);
  stroke-width: 6;
}

.sax-bell-rim {
  stroke: #f0ca6e;
  stroke-width: 11;
}

.sax-rod {
  stroke-width: 6;
}

.sax-bridge,
.callout-line {
  stroke-width: 3;
}

.callout-line {
  stroke-dasharray: 4 6;
  opacity: .65;
}

.zone-label,
.diagram-key-label {
  fill: #c9d3ce;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: .06em;
}

.zone-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .12em;
}

.diagram-key .key-cap {
  fill: #f8f4e8;
  stroke: #a7a18f;
  stroke-width: 3;
  transform-box: fill-box;
  transform-origin: center;
  transition: fill 160ms ease-out, stroke 160ms ease-out, stroke-width 160ms ease-out, transform 160ms ease-out;
}

.diagram-key .state-mark {
  fill: var(--stage);
  font: 800 17px var(--mono);
  text-anchor: middle;
  pointer-events: none;
}

.diagram-key.is-pressed .key-cap,
.diagram-key.is-selected .key-cap {
  fill: var(--brass);
  stroke: #fff1bd;
  stroke-width: 5;
  transform: translateY(2px);
}

.diagram-key.is-required .key-cap {
  fill: var(--warning-soft);
  stroke: var(--brass);
  stroke-width: 6;
  stroke-dasharray: 8 5;
}

.diagram-key.is-keep .key-cap {
  fill: #a8b0ac;
  stroke: #f5f7f6;
  stroke-width: 5;
}

.diagram-key.is-add .key-cap {
  fill: #4bc4ae;
  stroke: #ddfff8;
  stroke-width: 6;
}

.diagram-key.is-release .key-cap {
  fill: #f2c1ba;
  stroke: #ff8072;
  stroke-width: 6;
  stroke-dasharray: 7 4;
}

.diagram-key.is-highlighted .key-cap {
  stroke: var(--focus);
  stroke-width: 7;
}

.tone-row {
  display: grid;
  gap: 8px;
  margin-top: 6px;
}

.primary-action,
.secondary-action {
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border-radius: 8px;
  padding: 0 15px;
  font-weight: 750;
  text-decoration: none;
}

.primary-action {
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--surface);
}

.diagram-pane .primary-action,
.compare-diagram-pane .primary-action {
  border-color: var(--brass);
  background: var(--brass);
  color: var(--stage);
}

.primary-action:hover:not(:disabled) {
  filter: brightness(1.08);
}

.secondary-action {
  border: 1px solid var(--rule);
  background: transparent;
  color: var(--ink);
}

.secondary-action:hover:not(:disabled) {
  border-color: var(--ink);
  background: #f2efe7;
}

.operation-status {
  margin: 0;
  color: #aebbb6;
  font-size: .75rem;
}

.answer-pane h3 {
  margin-top: 18px;
  color: var(--muted);
  font-size: .75rem;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.key-count {
  flex: 0 0 auto;
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 5px 9px;
  color: var(--muted);
  font: 700 .7rem var(--mono);
}

.variant-list {
  display: grid;
  gap: 8px;
  margin: 16px 0 10px;
}

.variant-button {
  min-height: 46px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 8px 12px;
  background: transparent;
  color: var(--ink);
  text-align: left;
  font-weight: 700;
}

.variant-button[aria-pressed="true"] {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--surface);
}

.variant-button small {
  font-weight: 500;
  opacity: .75;
}

.variant-use,
.result-caveat,
.source-line,
.suggestion-note,
.movement-summary {
  color: var(--muted);
  font-size: .82rem;
}

.key-summary {
  margin-bottom: 12px;
  font-size: .94rem;
}

.key-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0;
  list-style: none;
}

.key-chips li {
  border: 1px solid var(--ink);
  border-radius: 6px;
  padding: 4px 7px;
  font: 700 .72rem var(--mono);
}

.capability-notice {
  margin: 12px 0;
  border: 1px solid #cf9c22;
  border-radius: 8px;
  padding: 11px;
  background: var(--warning-soft);
  font-size: .84rem;
}

.capability-notice[data-kind="unavailable"] {
  border-color: var(--danger);
  background: var(--danger-soft);
}

.source-line {
  border-top: 1px solid var(--soft-rule);
  padding-top: 14px;
}

.source-line > span {
  color: var(--add);
  font-weight: 900;
}

.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}

.share-fallback {
  margin-top: 12px;
}

.share-fallback label {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: .78rem;
  font-weight: 700;
}

.share-fallback input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 0 10px;
  font: .75rem var(--mono);
}

.compare-controls {
  display: grid;
  grid-template-columns: minmax(170px, 1fr) minmax(170px, 1fr) auto minmax(170px, 1fr) minmax(170px, 1fr);
  gap: 10px;
  align-items: end;
  padding: 18px;
  border-bottom: 1px solid var(--rule);
}

.compare-controls label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: .75rem;
  font-weight: 750;
}

.compare-controls select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 0 32px 0 10px;
  background: var(--surface);
  color: var(--ink);
}

.swap-button {
  min-width: 70px;
  min-height: 44px;
  border: 1px solid var(--ink);
  border-radius: 8px;
  background: var(--ink);
  color: var(--surface);
  font-weight: 750;
}

.compare-layout {
  display: grid;
  grid-template-columns: minmax(380px, 1.35fr) minmax(280px, .8fr);
  min-height: 620px;
}

.compare-diagram-pane {
  padding: clamp(20px, 3vw, 34px);
  background: var(--stage);
  color: var(--stage-ink);
}

.compare-diagram-pane .secondary-action {
  border-color: #7c9188;
  color: var(--stage-ink);
}

.compare-diagram-pane .secondary-action:hover {
  background: #1f3934;
}

.compare-stage {
  min-height: 460px;
}

.transition-sentence {
  margin: 6px 0 0;
  border-top: 1px solid #36524a;
  padding-top: 14px;
  color: #d9e4df;
  font-size: .95rem;
}

.delta-pane {
  padding: clamp(20px, 3vw, 34px);
}

.delta-block {
  border-bottom: 1px solid var(--soft-rule);
  padding: 8px 0 16px;
}

.delta-block h3 {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 8px;
  font-size: 1rem;
}

.delta-block h3 span {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 2px solid currentColor;
  border-radius: 50%;
  font: 900 1rem var(--mono);
}

.keep-block h3 { color: #515b57; }
.add-block h3 { color: var(--add); }
.release-block h3 { color: var(--release); }

.delta-block ul {
  margin-bottom: 0;
  padding-left: 21px;
  font-size: .86rem;
}

.delta-block li + li {
  margin-top: 4px;
}

.reverse-intro {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) minmax(280px, 1fr);
  gap: 36px;
  align-items: end;
  padding: 22px 28px;
  border-bottom: 1px solid var(--rule);
}

.reverse-intro p:last-child {
  margin-bottom: 0;
  color: var(--muted);
}

.reverse-layout {
  display: grid;
  grid-template-columns: minmax(330px, 1fr) minmax(280px, .8fr) minmax(260px, .8fr);
  min-height: 620px;
}

.reverse-layout > section {
  padding: clamp(18px, 2.6vw, 30px);
  border-right: 1px solid var(--rule);
}

.reverse-layout > section:last-child {
  border-right: 0;
}

.reverse-layout > section:first-child {
  background: var(--stage);
  color: var(--stage-ink);
}

.reverse-stage {
  min-height: 470px;
}

.reverse-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.reverse-layout > section:first-child .secondary-action {
  border-color: #7c9188;
  color: var(--stage-ink);
}

.reverse-key-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}

.reverse-key-list h4 {
  grid-column: 1 / -1;
  margin: 14px 0 1px;
  color: var(--muted);
  font-size: .7rem;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.reverse-key-button {
  min-height: 44px;
  border: 1px solid var(--rule);
  border-radius: 7px;
  padding: 6px 8px;
  background: transparent;
  color: var(--ink);
  text-align: left;
  font-size: .76rem;
  font-weight: 700;
}

.reverse-key-button[aria-pressed="true"] {
  border-color: var(--ink);
  background: var(--brass);
  color: var(--ink);
}

.reverse-results {
  background: #f7f4ec;
}

.reverse-match {
  margin-top: 10px;
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 12px;
  background: var(--surface);
}

.reverse-match h4 {
  margin: 0 0 5px;
  font: 750 1.2rem var(--mono);
}

.reverse-match p {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: .82rem;
}

.reverse-match button {
  min-height: 44px;
  border: 1px solid var(--ink);
  border-radius: 7px;
  padding: 0 10px;
  background: var(--ink);
  color: var(--surface);
  font-weight: 700;
}

.reference-section,
.method-section {
  padding: clamp(54px, 8vw, 88px) 0;
  border-bottom: 1px solid var(--rule);
}

.reference-section > p {
  max-width: 780px;
  color: var(--muted);
}

.reference-section details {
  margin-top: 22px;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}

.reference-section summary {
  min-height: 54px;
  display: flex;
  align-items: center;
  font-weight: 750;
}

.table-scroll {
  overflow-x: auto;
  padding-bottom: 16px;
}

table {
  width: 100%;
  min-width: 800px;
  border-collapse: collapse;
  font-size: .82rem;
}

caption {
  padding: 10px 0;
  text-align: left;
  color: var(--muted);
}

th,
td {
  border-bottom: 1px solid var(--soft-rule);
  padding: 10px;
  text-align: left;
  vertical-align: top;
}

thead th {
  background: var(--ink);
  color: var(--surface);
  font-size: .72rem;
  letter-spacing: .04em;
}

tbody th {
  white-space: nowrap;
  font-family: var(--mono);
}

.method-section {
  display: grid;
  grid-template-columns: minmax(260px, .75fr) minmax(0, 1.45fr);
  gap: clamp(36px, 7vw, 92px);
}

.method-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 32px;
}

.method-grid p {
  border-top: 1px solid var(--rule);
  padding-top: 14px;
  color: var(--muted);
}

.method-grid strong {
  color: var(--ink);
}

.site-footer {
  width: var(--content);
  margin: 0 auto;
  min-height: 150px;
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 30px;
  color: var(--muted);
  font-size: .8rem;
}

.site-footer strong {
  color: var(--ink);
}

.site-footer p {
  margin: 4px 0 0;
}

.site-footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
}

dialog {
  width: min(760px, calc(100% - 32px));
  max-height: min(84vh, 900px);
  border: 1px solid var(--rule);
  border-radius: 12px;
  padding: 0;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 18px 70px rgb(23 32 31 / .28);
}

dialog::backdrop {
  background: rgb(16 35 32 / .72);
}

.dialog-header {
  position: sticky;
  z-index: 2;
  top: 0;
  padding: 18px 22px;
  border-bottom: 1px solid var(--rule);
  background: var(--surface);
}

.dialog-header h2 {
  margin: 0;
}

.info-dialog-body {
  padding: 24px;
}

.info-dialog-body section > h3 {
  font-size: 1.45rem;
}

.info-dialog-body p,
.info-dialog-body li {
  color: var(--muted);
}

.info-dialog-body strong,
.info-dialog-body h4 {
  color: var(--ink);
}

.source-list {
  padding-left: 22px;
}

.source-list li + li {
  margin-top: 9px;
}

.text-button {
  min-height: 44px;
  padding: 0 8px;
  text-decoration: underline;
}

.focus-dialog {
  width: min(900px, calc(100% - 24px));
}

.focus-dialog .dialog-header {
  background: var(--stage);
  color: var(--stage-ink);
  border-color: #36524a;
}

.focus-diagram {
  min-height: 70vh;
  display: grid;
  place-items: center;
  padding: 18px;
  background: var(--stage);
}

.focus-diagram .sax-svg {
  width: min(100%, 600px);
  max-width: none;
  max-height: 72vh;
}

.focus-keys {
  margin: 0;
  padding: 16px 22px;
  background: var(--stage);
  color: var(--stage-ink);
  text-align: center;
  font-family: var(--mono);
}

.noscript-notice,
.noscript-legal {
  width: var(--content);
  margin: 20px auto;
  border: 1px solid var(--rule);
  padding: 20px;
  background: var(--surface);
}

.error-page {
  display: grid;
  place-items: center;
  padding: 20px;
}

.error-page main {
  width: min(680px, 100%);
  border: 1px solid var(--rule);
  border-radius: 12px;
  padding: clamp(28px, 8vw, 74px);
  background: var(--surface);
}

.error-page h1 {
  margin-bottom: 20px;
}

.error-page .primary-action {
  margin-top: 18px;
}

@media (max-width: 1020px) {
  :root {
    --content: min(100% - 24px, 920px);
  }

  .header-settings > label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
  }

  .finder-layout {
    grid-template-columns: minmax(190px, .7fr) minmax(360px, 1.3fr);
  }

  .answer-pane {
    grid-column: 1 / -1;
    border-top: 1px solid var(--rule);
  }

  .pitch-pane {
    border-right: 1px solid var(--rule);
  }

  .diagram-pane {
    border-right: 0;
  }

  .compare-controls {
    grid-template-columns: 1fr 1fr;
  }

  .swap-button {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .reverse-layout {
    grid-template-columns: minmax(340px, 1fr) minmax(300px, 1fr);
  }

  .reverse-results {
    grid-column: 1 / -1;
    border-top: 1px solid var(--rule);
  }
}

@media (max-width: 760px) {
  :root {
    --content: calc(100% - 16px);
  }

  html {
    scroll-padding-bottom: 80px;
  }

  .site-header {
    min-height: 66px;
  }

  .header-settings {
    gap: 4px;
  }

  .header-settings select {
    min-height: 44px;
    padding: 0 24px 0 8px;
    color: var(--ink);
    font-size: .7rem;
  }

  #spellingSelect {
    width: 96px;
  }

  #highFSharpSelect {
    width: 112px;
  }

  .site-header {
    gap: 8px;
  }

  .quiet-link {
    display: none;
  }

  .intro {
    min-height: 0;
    display: block;
    padding: 18px 0 16px;
  }

  .intro .eyebrow {
    margin-bottom: .2rem;
  }

  .promise {
    margin-top: 10px;
    font-size: .94rem;
  }

  .tool-modes {
    overflow-x: auto;
    display: flex;
  }

  .tool-modes button {
    flex: 1 0 auto;
    min-height: 50px;
    padding: 0 12px;
    font-size: .8rem;
  }

  .note-picker {
    grid-template-columns: 56px minmax(0, 1fr) 56px;
  }

  .step-button {
    min-height: 58px;
    gap: 0;
  }

  .step-button span:not([aria-hidden="true"]) {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
  }

  .note-select-label {
    grid-template-columns: 1fr;
    gap: 2px;
    text-align: center;
  }

  .note-select-label > span {
    font-size: .63rem;
  }

  .note-select-label select {
    width: 100%;
    min-height: 44px;
    border: 0;
    padding: 0 24px 0 4px;
    text-align: center;
  }

  .note-rail-shell {
    grid-template-columns: 44px minmax(0, 1fr) 44px;
  }

  .finder-layout,
  .compare-layout,
  .reverse-layout,
  .method-section {
    display: block;
  }

  .pitch-pane,
  .diagram-pane,
  .answer-pane,
  .reverse-layout > section {
    border-right: 0;
    border-bottom: 1px solid var(--rule);
  }

  .pitch-pane {
    display: grid;
    grid-template-columns: minmax(100px, .7fr) minmax(170px, 1.3fr);
    gap: 4px 18px;
    padding: 18px;
  }

  .pitch-pane .context-label,
  .current-note,
  .transposition-note {
    grid-column: 1;
  }

  .staff-container {
    grid-column: 2;
    grid-row: 1 / span 3;
    min-height: 112px;
    margin: 0;
    border-top: 0;
  }

  .pitch-facts {
    grid-column: 1 / -1;
    margin-top: 10px;
  }

  .current-note {
    margin: 0;
    font-size: 3rem;
  }

  .transposition-note {
    display: none;
  }

  .diagram-pane {
    padding: 18px;
  }

  .sax-stage {
    min-height: 330px;
  }

  .sax-svg {
    max-height: 360px;
  }

  .tone-row {
    position: sticky;
    z-index: 4;
    bottom: max(8px, env(safe-area-inset-bottom));
    padding: 8px;
    border: 1px solid #4b625b;
    border-radius: 10px;
    background: rgb(16 35 32 / .96);
  }

  .answer-pane {
    padding: 20px 18px 28px;
  }

  .compare-controls {
    grid-template-columns: 1fr 1fr;
    padding: 12px;
  }

  .compare-controls label:nth-of-type(2),
  .compare-controls label:nth-of-type(4) {
    grid-column: auto;
  }

  .swap-button {
    min-height: 44px;
  }

  .compare-diagram-pane,
  .delta-pane {
    padding: 18px;
  }

  .compare-stage,
  .reverse-stage {
    min-height: 360px;
  }

  .reverse-intro {
    display: block;
    padding: 18px;
  }

  .reverse-key-list {
    grid-template-columns: 1fr 1fr;
  }

  .section-heading-row {
    align-items: end;
  }

  .reference-section,
  .method-section {
    padding: 52px 0;
  }

  .method-grid {
    display: block;
    margin-top: 26px;
  }

  .site-footer {
    min-height: 220px;
    display: block;
    padding: 36px 0;
  }

  .site-footer nav {
    margin: 24px 0;
  }
}

@media (max-width: 430px) {
  .wordmark span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
  }

  .tool-modes button span {
    display: none;
  }

  .pitch-pane {
    grid-template-columns: 96px minmax(160px, 1fr);
  }

  .result-actions > * {
    flex: 1 1 44%;
  }

  .compare-controls {
    grid-template-columns: 1fr;
  }

  .swap-button {
    grid-column: 1;
    grid-row: auto;
  }

  .reverse-key-list {
    grid-template-columns: 1fr;
  }

  .section-heading-row {
    display: block;
  }

  .section-heading-row button {
    margin-top: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
  }
}

@media (forced-colors: active) {
  .tool-modes button[aria-pressed="true"],
  .note-button[aria-current="true"],
  .variant-button[aria-pressed="true"],
  .reverse-key-button[aria-pressed="true"],
  .primary-action {
    border: 2px solid ButtonText;
    background: Highlight;
    color: HighlightText;
  }

  .diagram-key .key-cap {
    fill: Canvas;
    stroke: CanvasText;
  }

  .diagram-key.is-pressed .key-cap,
  .diagram-key.is-selected .key-cap,
  .diagram-key.is-add .key-cap,
  .diagram-key.is-keep .key-cap,
  .diagram-key.is-release .key-cap {
    fill: Highlight;
    stroke: HighlightText;
    stroke-width: 7;
  }
}

@media print {
  @page {
    size: auto;
    margin: 12mm;
  }

  :root {
    --paper: #fff;
    --surface: #fff;
    --ink: #000;
    --muted: #222;
    --rule: #555;
    --stage: #fff;
    --stage-ink: #000;
    --brass: #bbb;
  }

  body {
    background: #fff;
    color: #000;
    font-size: 10pt;
  }

  .site-header,
  .intro .promise,
  .tool-modes,
  .note-rail-shell,
  .note-picker,
  .tone-row,
  .result-actions,
  .icon-action,
  .reference-section .secondary-action,
  .method-section,
  .site-footer,
  dialog,
  .status-banner,
  .share-fallback {
    display: none !important;
  }

  .print-only-meta {
    display: block;
  }

  main {
    width: 100%;
  }

  .intro {
    display: block;
    min-height: 0;
    padding: 0 0 10mm;
  }

  .workbench {
    border: 0;
  }

  .finder-layout {
    min-height: 0;
    grid-template-columns: 1fr 1.2fr 1.1fr;
    break-inside: avoid;
  }

  .pitch-pane,
  .diagram-pane,
  .answer-pane,
  .compare-diagram-pane,
  .delta-pane {
    padding: 8mm 5mm;
    color: #000;
    background: #fff;
  }

  .sax-stage {
    min-height: 110mm;
  }

  .sax-svg {
    max-height: 115mm;
  }

  .zone-label,
  .diagram-key-label {
    fill: #000;
  }

  .sax-body,
  .sax-bell {
    fill: #ddd;
    stroke: #000;
  }

  .sax-neck,
  .sax-rod,
  .sax-bridge,
  .callout-line,
  .sax-bell-rim {
    stroke: #000;
  }

  .reference-section {
    padding: 10mm 0 0;
    break-before: page;
  }

  .reference-section details {
    border: 0;
  }

  .reference-section summary {
    display: none;
  }

  .reference-section details:not([open]) > *:not(summary) {
    display: block;
  }

  .table-scroll {
    overflow: visible;
  }

  table {
    min-width: 0;
    font-size: 7.5pt;
  }

  th,
  td {
    padding: 3.2pt;
  }

  thead th {
    background: #ddd;
    color: #000;
  }

  body[data-print-scope="current"] .reference-section {
    display: none;
  }

  body[data-print-scope="full"] .workbench {
    display: none;
  }
}
