  :root {
    --brass: #e8b33d;
    --brass-bright: #ffd772;
    --brass-dim: #8a6a20;
    --bg: #0b0b0b;
  }
  html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    background: var(--bg);
    color: var(--brass);
    font-family: Georgia, 'Times New Roman', serif;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    min-width: 0;
    /* Guaranteed backstop: whatever else is or isn't shrinking properly
       further down, the page itself can never scroll or shift sideways. */
    overflow-x: hidden;
  }
  h1 {
    color: var(--brass-bright);
    font-size: 1.4em;
    letter-spacing: 0.04em;
    margin: 24px 0 20px;
    text-align: center;
  }
  a {
    color: var(--brass-dim);
    text-decoration: underline;
  }
  a:hover {
    color: var(--brass-bright);
  }
  .stage {
    width: 100%;
    max-width: 1500px;
    min-width: 0;
    padding: 0 16px;
    box-sizing: border-box;
  }
  .stage h3 {
    color: var(--brass-bright);
    font-size: 1em;
    margin: 18px 0 6px;
  }
  svg text {
    font-family: Georgia, 'Times New Roman', serif;
  }
  .toolbar {
    margin: 6px 0 18px;
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
  }
  .toolbar .divider {
    width: 1px;
    height: 24px;
    background: var(--brass-dim);
    margin: 0 4px;
  }
  .staff-scroll {
    width: 100%;
    overflow-x: auto;
    margin-bottom: 18px;
  }
  .panels {
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: center;
    width: 100%;
  }
  .panel-details {
    width: 100%;
    max-width: 1400px;
    min-width: 0;
    margin-bottom: 6px;
  }
  .panel-details summary {
    cursor: pointer;
    padding: 6px 4px;
    list-style-position: outside;
  }
  .panel-details summary h2 {
    display: inline;
    color: var(--brass-dim);
    font-size: 1.1em;
    margin: 0;
  }
  .panel-details[open] summary h2 {
    color: var(--brass-bright);
  }
  .panel-details summary .panel-note {
    display: inline;
    margin-left: 10px;
    color: var(--brass-dim);
    font-size: 0.82em;
  }
  .panel-body {
    padding: 6px 4px 12px;
    overflow-x: auto;
  }
  .trombone-svg {
    width: 100%;
    min-width: 480px;
    height: auto;
    display: block;
  }
  .position-list {
    width: 100%;
    overflow: hidden;
    height: 24px;
    position: relative;
    margin-bottom: 0;
    /* .panel-body has 4px of left padding that the staff doesn't share
       -- cancel it so noteX lines up in both places against the same
       zero point. */
    margin-left: -4px;
  }
  .pipe-wrap {
    width: 100%;
    max-width: 900px;
    margin: 6px 0 22px;
  }
  .pipe-label {
    max-width: 900px;
    margin: 0 0 4px;
    font-size: 0.9em;
    color: var(--brass);
  }
  .pipe-svg {
    display: block;
    width: 100%;
    height: auto;
  }
  .build-table-row {
    margin: 4px 0 14px;
  }
  .small-btn {
    padding: 6px 14px;
    font-size: 0.85em;
  }
  .live-reminder-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
    margin: 4px 0 14px;
  }
  .pipe-wrap-small {
    width: 320px;
    max-width: 100%;
  }
  .staff-thumb-small {
    display: flex;
    align-items: center;
    justify-content: center;
    /* Fixed regardless of which note is showing -- a pedal tone's
       ledger lines make a much taller SVG than an in-staff note's, and
       without a fixed frame that difference reflows the table below on
       every note change. 128px covers this page's full range (E1 to
       B♭4) at the live reminder's 1.8x scale, with a little headroom. */
    height: 132px;
  }
  .section-divider {
    width: 100%;
    max-width: 900px;
    border: none;
    border-top: 1px solid var(--brass-dim);
    margin: 8px 0 20px;
  }
  .freq-entry {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 4px 0 18px;
    flex-wrap: wrap;
  }
  .freq-entry input[type="range"] {
    width: 260px;
  }
  .freq-entry span {
    font-family: monospace;
    color: var(--brass);
    min-width: 3.5em;
    font-size: 0.95em;
  }
  .impedance-wrap {
    width: 100%;
    max-width: 900px;
    margin: 6px 0 22px;
  }
  .impedance-svg {
    display: block;
    width: 100%;
    height: auto;
  }
  /* Same alignment idea as .position-list (a row of SVG-text labels
     sharing the staff's own noteX coordinates), but for a container
     that doesn't sit inside .panel-body -- so it needs none of that
     class's -4px compensation for padding it doesn't have. */
  .number-row {
    width: 100%;
    overflow: hidden;
    height: 24px;
    position: relative;
    margin-bottom: 18px;
  }
  .position-list-svg {
    display: block;
  }
  .position-list-number {
    font-family: monospace;
    font-size: 15px;
    font-weight: bold;
    fill: var(--brass-dim);
  }
  .position-list-number.active {
    fill: #ff3b30;
    font-weight: bold;
  }
  button {
    background: linear-gradient(180deg, var(--brass-bright), var(--brass-dim));
    color: #1a1200;
    border: none;
    border-radius: 6px;
    padding: 10px 22px;
    font-size: 1em;
    font-weight: bold;
    cursor: pointer;
    font-family: inherit;
  }
  button:disabled {
    opacity: 0.5;
    cursor: default;
  }
  button:not(:disabled):hover {
    background: linear-gradient(180deg, #fff0c0, var(--brass));
  }
  select {
    background: #1a1400;
    color: var(--brass);
    border: 1px solid var(--brass-dim);
    border-radius: 4px;
    padding: 8px 10px;
    font-family: inherit;
  }
  .staff-note {
    fill: var(--brass);
    transition: fill 0.08s linear;
  }
  .staff-note.active {
    fill: #ff3b30;
  }
  .staff-label {
    fill: var(--brass-dim);
    transition: fill 0.08s linear;
  }
  .staff-label.active {
    fill: #ff3b30;
  }
  .expert-controls {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 4px 4px 18px;
    max-width: 900px;
  }
  .expert-controls label {
    display: grid;
    grid-template-columns: 220px 1fr 48px;
    align-items: center;
    gap: 10px;
  }
  .expert-label {
    text-align: right;
    font-size: 0.9em;
  }
  .expert-hint {
    display: block;
    color: var(--brass-dim);
    font-size: 0.82em;
  }
  .expert-value {
    font-family: monospace;
    text-align: right;
  }
  .how-it-works-body {
    max-width: 720px;
    margin: 0 auto;
    line-height: 1.5;
  }
  .how-it-works-body h3 {
    color: var(--brass-bright);
    font-size: 1em;
    margin: 18px 0 6px;
  }
  .how-it-works-body h3:first-child {
    margin-top: 4px;
  }
  .how-it-works-body p {
    margin: 0 0 10px;
    font-size: 0.92em;
  }
  .how-it-works-body ul {
    margin: 0 0 10px;
    padding-left: 1.2em;
    font-size: 0.92em;
  }
  .how-it-works-body li {
    margin-bottom: 6px;
  }
  .table-scroll {
    overflow-x: auto;
    margin: 4px 0 14px;
  }
  .note-list-scroll {
    width: fit-content;
    max-width: 100%;
    border: 1px solid var(--brass-dim);
    border-radius: 4px;
    margin: 4px 0 14px;
  }
  .note-table {
    width: auto;
    border-collapse: collapse;
  }
  .note-table th, .note-table td {
    border: 1px solid var(--brass-dim);
    padding: 3px 10px;
    text-align: left;
  }
  .note-table th {
    background: var(--bg);
    color: var(--brass-bright);
    font-weight: bold;
    font-size: 0.88em;
  }
  .note-thumb-cell {
    padding: 0 4px;
  }
  .note-thumb-svg {
    display: block;
  }
  .note-name-cell {
    font-weight: bold;
    color: var(--brass-bright);
    font-size: 1em;
    white-space: nowrap;
  }
  .note-positions-cell {
    font-family: monospace;
    font-weight: bold;
    color: var(--brass-bright);
    font-size: 1.15em;
    white-space: nowrap;
  }
  .note-positions-ellipsis {
    font-weight: normal;
    color: var(--brass-dim);
  }
  .how-it-works-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88em;
  }
  .how-it-works-table th, .how-it-works-table td {
    border: 1px solid var(--brass-dim);
    padding: 6px 8px;
    text-align: left;
    vertical-align: top;
  }
  .how-it-works-table th {
    color: var(--brass-bright);
    font-weight: bold;
  }
  .how-it-works-table code {
    color: var(--brass-bright);
    font-family: monospace;
    font-size: 0.95em;
  }
  .table-caption {
    margin: -8px 0 14px;
    color: var(--brass-dim);
    font-size: 0.8em;
    font-style: italic;
  }
  .input-row {
    width: 100%;
    max-width: 1400px;
    margin: 4px 0 20px;
    display: flex;
    gap: 28px;
    align-items: flex-start;
    flex-wrap: wrap;
  }
  .melody-entry {
    flex: 2 1 480px;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
  }
  .scale-entry {
    flex: 1 1 260px;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
  }
  .playback-row {
    width: 100%;
    max-width: 1400px;
    margin: 4px 0 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 24px;
    flex-wrap: wrap;
  }
  .tempo-entry, .position-entry {
    display: flex;
    align-items: center;
    gap: 10px;
  }
  .position-entry {
    margin: 4px 0 18px;
  }
  .tempo-entry label, .position-entry label, .freq-entry label {
    color: var(--brass-bright);
    font-size: 0.95em;
    white-space: nowrap;
  }
  .tempo-entry input[type="range"] {
    width: 220px;
  }
  .melody-entry label, .scale-entry label {
    color: var(--brass-bright);
    font-size: 0.95em;
  }
  .input-label-row {
    display: flex;
    align-items: baseline;
    justify-content: flex-start;
    gap: 14px;
    flex-wrap: wrap;
  }
  .input-label-row a {
    font-size: 0.85em;
  }
  .melody-entry textarea {
    width: 100%;
    box-sizing: border-box;
    background: #1a1400;
    color: var(--brass);
    border: 1px solid var(--brass-dim);
    border-radius: 4px;
    padding: 8px 10px;
    font-family: monospace;
    font-size: 0.9em;
    resize: vertical;
  }
  .melody-controls, .scale-controls {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
  }
  .melody-error {
    color: #ff6b5a;
    font-size: 0.85em;
  }
  .credits {
    width: 100%;
    max-width: 900px;
    margin: 30px auto 20px;
    color: var(--brass-dim);
    font-size: 0.8em;
    text-align: center;
  }
  /* On a narrow phone, the staff and surrounding controls otherwise
     dominate the page while the trombone graphics -- the actual point
     of the widget -- shrink down small: pull the controls back so the
     trombones get more of the visual weight (the staff's own size is
     handled separately, in JS, since it's rendered as an SVG at a
     computed pixel size rather than styled via CSS). */
  @media (max-width: 600px) {
    h1 {
      font-size: 1.1em;
      margin: 16px 0 12px;
    }
    .melody-entry label, .scale-entry label, .input-label-row a {
      font-size: 0.82em;
    }
    .melody-entry textarea {
      font-size: 0.78em;
    }
    select, button {
      font-size: 0.85em;
      padding: 7px 14px;
    }
    .tempo-entry input[type="range"] {
      width: 140px;
    }
    .panel-details summary h2 {
      font-size: 0.95em;
    }
    .panel-details summary .panel-note {
      font-size: 0.75em;
    }
  }
