
  /* "Baskerville" exists natively on Apple devices; Libre Baskerville is the web fallback */
  .jsm-baskerville-probe{font-family:'Baskerville','Libre Baskerville',Georgia,serif}


  :root{
    --jsm-blue:#29ABE2;
    --jsm-pink:#C7398B;
    --jsm-text:#1d1d1f;
    --jsm-grey:#6e6e73;
    --jsm-bg:#F5F5F7;
    --jsm-card:#ffffff;
    --jsm-radius:18px;
    --jsm-radius-sm:10px;
    --jsm-shadow:0 8px 30px rgba(0,0,0,.08);
  }
  *{box-sizing:border-box;margin:0;padding:0}
  body{
    font-family:'Manrope',-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif;
    background:var(--jsm-bg);
    color:var(--jsm-text);
    min-height:100vh;
    padding:24px 16px 60px;
  }
  .jsm-player{
    max-width:980px;
    margin:0 auto;
  }
  .jsm-player__head{
    display:flex;
    align-items:baseline;
    justify-content:space-between;
    flex-wrap:wrap;
    gap:8px;
    margin-bottom:14px;
    padding:0 4px;
  }
  .jsm-player__title{
    font-size:22px;
    font-weight:800;
    letter-spacing:-.02em;
  }
  .jsm-player__badge{
    font-size:12px;
    font-weight:700;
    color:var(--jsm-grey);
    background:#fff;
    border:1px solid rgba(0,0,0,.07);
    border-radius:999px;
    padding:4px 12px;
  }
  /* ---------- Control bar ---------- */
  .jsm-controls{
    background:var(--jsm-card);
    border-radius:var(--jsm-radius);
    box-shadow:var(--jsm-shadow);
    padding:14px 16px;
    display:flex;
    align-items:center;
    flex-wrap:wrap;
    gap:14px;
    margin-bottom:16px;
    position:sticky;
    top:10px;
    z-index:20;
  }
  .jsm-btn{
    border:none;
    cursor:pointer;
    font-family:inherit;
    font-weight:700;
    font-size:14px;
    border-radius:999px;
    padding:10px 20px;
    display:inline-flex;
    align-items:center;
    gap:8px;
    transition:transform .12s ease, box-shadow .12s ease, background .12s ease;
    -webkit-tap-highlight-color:transparent;
  }
  .jsm-btn:active{transform:scale(.96)}
  .jsm-btn:focus-visible{outline:3px solid rgba(41,171,226,.45);outline-offset:2px}
  .jsm-btn--play{
    background:var(--jsm-blue);
    color:#fff;
    min-width:110px;
    justify-content:center;
  }
  .jsm-btn--play.is-playing{background:var(--jsm-pink)}
  .jsm-btn--ghost{
    background:#f0f0f3;
    color:var(--jsm-text);
  }
  .jsm-btn--ghost:hover{background:#e7e7ec}
  .jsm-group{
    display:flex;
    align-items:center;
    gap:8px;
  }
  .jsm-group__label{
    font-size:12px;
    font-weight:700;
    color:var(--jsm-grey);
    text-transform:uppercase;
    letter-spacing:.05em;
  }
  .jsm-step{
    display:flex;
    align-items:center;
    background:#f0f0f3;
    border-radius:999px;
    overflow:hidden;
  }
  .jsm-step button{
    border:none;
    background:transparent;
    cursor:pointer;
    font-size:18px;
    font-weight:800;
    width:38px;
    height:38px;
    color:var(--jsm-text);
    transition:background .12s;
  }
  .jsm-step button:hover{background:#e2e2e8}
  .jsm-step__value{
    min-width:64px;
    text-align:center;
    font-size:14px;
    font-weight:800;
    color:var(--jsm-blue);
  }
  .jsm-tempo{
    display:flex;
    align-items:center;
    gap:10px;
  }
  .jsm-tempo input[type=range]{
    width:120px;
    accent-color:var(--jsm-blue);
  }
  .jsm-tempo__bpm{
    font-size:13px;
    font-weight:800;
    min-width:64px;
    color:var(--jsm-text);
  }
  .jsm-spacer{flex:1}
  /* ---------- Score card ---------- */
  .jsm-score-card{
    background:transparent;
    border-radius:var(--jsm-radius);
    padding:0;
    min-height:300px;
    position:relative;
    overflow-x:auto;
    overflow-y:hidden;
  }
  /* The score is engraved on a fixed-width "sheet of paper" (2100px = A4 @ print scale),
     then the whole sheet is scaled down to fit the screen — like viewing a PDF. */
  #osmd-container{
    width:1050px;            /* engraving width = BASE_W / zoom, set at runtime */
    transform-origin:0 0;
  }
  #osmd-container svg{
    display:block;
    background:#fff;
    border-radius:14px;
    box-shadow:0 10px 50px rgba(0,0,0,.12);
    margin:0 0 55px;
  }
  .jsm-loading{
    position:absolute;
    inset:0;
    display:flex;
    align-items:center;
    justify-content:center;
    flex-direction:column;
    gap:12px;
    color:var(--jsm-grey);
    font-weight:600;
    background:var(--jsm-card);
    border-radius:var(--jsm-radius);
    box-shadow:var(--jsm-shadow);
    z-index:5;
  }
  .jsm-loading__dot{
    width:44px;height:44px;
    border-radius:50%;
    border:4px solid #e8e8ee;
    border-top-color:var(--jsm-blue);
    animation:spin 1s linear infinite;
  }
  @keyframes spin{to{transform:rotate(360deg)}}
  .jsm-error{
    color:var(--jsm-pink);
    font-weight:700;
    text-align:center;
    padding:0 20px;
  }
  /* ---------- Footer note ---------- */
  .jsm-note{
    margin-top:14px;
    font-size:13px;
    color:var(--jsm-grey);
    text-align:center;
    line-height:1.5;
  }
  input[type=file]{display:none}
  @media (max-width:640px){
    .jsm-controls{gap:10px;padding:12px}
    .jsm-tempo input[type=range]{width:90px}
  }
  /* ---------- Print: only the score ---------- */
  @media print{
    /* no @page override → the browser uses its defaults: A4 with normal margins */
    html,body{ background:#fff; }
    .jsm-controls,.jsm-player__head,.jsm-note{ display:none !important }
    .jsm-player{ max-width:none; margin:0; padding:0 }
    .jsm-score-card{ box-shadow:none; border-radius:0; padding:0; margin:0; overflow:visible; height:auto !important }
    #osmd-container{ transform:none !important; width:auto !important }
    /* the SVG has an A4-ratio viewBox, so width:100% scales it to fit the
       printable area (within the default margins) with no distortion */
    #osmd-container svg{
      display:block;
      width:100%;
      height:auto;
      box-shadow:none;
      border-radius:0;
      margin:0 auto;
      page-break-after:always;
      break-after:page;
    }
    #osmd-container svg:last-of-type{ page-break-after:auto; break-after:auto }
  }
  @media (prefers-reduced-motion:reduce){
    .jsm-loading__dot{animation:none}
    .jsm-btn{transition:none}
  }


/* two hands buttons: active one highlighted in brand blue */
.jsm-hands{ display:inline-flex; gap:6px; }
.jsm-btn--ghost.is-active{
  background:#29ABE2; border-color:#29ABE2; color:#fff;
}
.jsm-btn--ghost.is-active:hover{ background:#1f9bd1; border-color:#1f9bd1; }
