  * { box-sizing: border-box; margin: 0; padding: 0; }
  body {
    font-family: 'Segoe UI', system-ui, sans-serif;
    background: #0a0a0a;
    color: #d4b87a;
    min-height: 100vh;
  }
  header {
    background: #0d0d0d;
    border-bottom: 1px solid #5c4000;
    padding: 14px 32px;
    font-weight: 600;
    color: #f0d060;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
  }
  header .logo { font-size: 1.3rem; color: inherit; text-decoration: none; }
  header .logo:hover { color: #fff; }
  .top-nav { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
  .top-nav a { font-size: .85rem; font-weight: 500; color: #a89060; text-decoration: none; }
  .top-nav a:hover { color: #f0d060; }
  .container { max-width: 980px; margin: 0 auto; padding: 24px; }
  .card {
    background: #111111;
    border: 1px solid #3c2800;
    border-radius: 12px;
    padding: 22px 24px;
    margin-bottom: 18px;
  }
  /* Controls card pins to the top so transport stays reachable while
     scrolling the score (esp. on tablets). Full music width is preserved. */
  #controls-card {
    position: sticky;
    top: 0;
    z-index: 20;
    box-shadow: 0 6px 16px rgba(0,0,0,.45);
  }
  h2 {
    font-size: .78rem;
    font-weight: 600;
    color: #8b6914;
    text-transform: uppercase;
    letter-spacing: .07em;
    margin-bottom: 12px;
  }
  /* ── level buttons ── */
  .level-grid { display: flex; flex-wrap: wrap; gap: 8px; }
  .level-btn {
    min-width: 52px; height: 52px; padding: 0 10px;
    border-radius: 10px;
    border: 2px solid #5c4000;
    background: #0d0d0d;
    color: #a89060;
    font-size: 1rem; font-weight: 600;
    cursor: pointer; transition: all .15s;
    white-space: nowrap;
  }
  .level-btn:hover { border-color: #c9a227; color: #f0d060; background: #1a1000; }
  .level-btn.active { border-color: #c9a227; background: #1c1400; color: #f5d060;
                       box-shadow: 0 0 0 3px rgba(201,162,39,.20); }
  .section-label { font-size:.72rem; color:#6b5020; letter-spacing:.07em; margin-bottom:6px; }
  /* ── key buttons ── */
  .key-grid { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
  .key-grid .random-btn { margin-left: auto; }
  .key-label { font-size: .72rem; color: #6b5020; margin-bottom: 4px; margin-top: 8px; }
  .key-btn {
    padding: 5px 11px;
    border-radius: 7px;
    border: 1.5px solid #5c4000;
    background: #0d0d0d;
    color: #a89060;
    font-size: .82rem; font-weight: 600;
    cursor: pointer; transition: all .13s;
  }
  .key-btn:hover { border-color: #c9a227; color: #f0d060; }
  .key-btn.active { border-color: #c9a227; background: #1c1400; color: #f5d060; }
  /* ── notation toggles ── */
  .notation-grid { display: flex; flex-wrap: wrap; gap: 6px; }
  .notation-btn {
    padding: 5px 13px;
    border-radius: 7px;
    border: 1.5px solid #5c4000;
    background: #0d0d0d;
    color: #6b5020;
    font-size: .84rem; font-weight: 600;
    cursor: pointer; transition: all .13s;
  }
  .notation-btn:hover { border-color: #c9a227; color: #f0d060; }
  .notation-btn.active { border-color: #c9a227; background: #1c1400; color: #f5d060; }
  /* ── bottom row ── */
  .row { display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap; margin-top: 18px; }
  .field label { display: block; font-size: .78rem; color: #8b6914; margin-bottom: 5px; }
  .field input {
    background: #0d0d0d; border: 1px solid #5c4000; border-radius: 7px;
    color: #f0d060; padding: 8px 11px; font-size: .88rem; width: 120px;
  }
  .btn {
    padding: 9px 26px;
    border: none; border-radius: 8px;
    font-size: .93rem; font-weight: 600; cursor: pointer; transition: background .13s;
  }
  .btn-primary { background: #c9a227; color: #000; }
  .btn-primary:hover { background: #b08d1a; }
  .btn-primary:disabled { background: #3c2800; color: #6b5020; cursor: not-allowed; }
  .btn-secondary { background: #1a1000; color: #c9a227; border: 1px solid #5c4000; }
  .btn-secondary:hover { background: #2a1e00; }
  .icon-btn { padding: 9px 14px; font-size: 1.15rem; line-height: 1; }
  /* Transport icons render as inline SVG so they take the brand gold (currentColor)
     instead of falling back to OS emoji glyphs that ignore the theme color. */
  .icon-btn svg { width: 1em; height: 1em; fill: currentColor; display: block; }
  #status { margin-top: 10px; font-size: .82rem; color: #8b6914; min-height: 16px; }
  #status.error { color: #f87171; }
  /* ── score ── */
  #score-card { display: none; }
  #score-meta { color: #8b6914; font-size: .82rem; margin-bottom: 6px; }
  #score-wrap { background: white; border-radius: 6px; padding: 6px; overflow-x: auto; }
  #score svg { display: block; width: 100%; height: auto; }

  /* ── pagination (fit a screen, turn pages on tablets) ── */
  #score-card { position: relative; padding: 10px 12px; }
  #score-wrap.paged { overflow: hidden; }
  /* Page break rendered like a PDF gutter: a dark band in the inter-system gap so
     the peek below reads as a separate sheet. Positioned by goToPage(). */
  #page-break {
    position: absolute; left: 12px; right: 12px; height: 16px;
    background: #0a0a0a; pointer-events: none; z-index: 15;
    box-shadow: inset 0 7px 6px -6px rgba(0,0,0,.6), inset 0 -7px 6px -6px rgba(0,0,0,.6);
  }
  /* Page nav sits in the controls strip (far right) so it never covers music. */
  #pager { display: inline-flex; align-items: center; gap: 8px; margin-left: auto; }
  #pager button {
    background: none; border: none; color: #c9a227;
    font-size: 1.4rem; line-height: 1; cursor: pointer; padding: 0 4px;
  }
  #pager button:disabled { color: #5c4000; cursor: default; }
  #pg-label { color: #d4b87a; font-size: .82rem; min-width: 70px; text-align: center; }

  /* ── slim transport bar (more room for music) ── */
  #controls-card { padding: 8px 16px; margin-bottom: 8px; }
  #status:empty { display: none; }
  .action-row { margin-top: 4px; gap: 10px; align-items: center; }
  #tempo-field { display: flex; flex-direction: row; align-items: center; gap: 6px; }
  #tempo-field label { margin: 0; }
  #tempo-field input { width: 62px; }

  @media print {
    body { background: white; }
    .no-print { display: none !important; }
    header { display: none; }
    .container { padding: 0; max-width: none; }
    #score-card { display: block !important; border: none; padding: 0; background: transparent; }
    #score-meta { display: none; }
    #score-wrap { padding: 0; border-radius: 0; }
    /* Un-window the score so the FULL piece prints, not just the visible page. */
    #score-wrap.paged { height: auto !important; overflow: visible !important; }
    /* Undo any on-screen zoom so the printout is full-size. */
    #score svg { width: 100% !important; margin: 0 !important; }
  }
