@font-face { font-family: 'Petaluma'; src: url('Petaluma.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: 'Leland'; src: url('Leland.otf') format('opentype'); font-display: swap; }
@font-face {
  font-family: 'Bravura';
  src: url('Bravura.woff2') format('woff2');
  font-display: block;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: #23252e; color: #e8e6df;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* ---------- chrome ---------- */
#chrome { position: sticky; top: 0; z-index: 30; background: #23252e; }
#topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 18px; background: #1a1c23;
  border-bottom: 1px solid #000;
}
.logo { font-size: 20px; }
.logo b { letter-spacing: .5px; }
.logo .tag { font-size: 12px; color: #9a97a8; margin-left: 10px; font-style: italic; }
.filebtns button {
  background: #2e313c; color: #e8e6df; border: 1px solid #454858; border-radius: 8px;
  padding: 7px 13px; margin-left: 6px; font-size: 13px; cursor: pointer;
}
.filebtns button:hover { background: #3a3e4c; }

#toolbar, #toolbar2 {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  padding: 6px 18px; background: #23252e;
}
#toolbar2 { border-bottom: 1px solid #14151a; padding-top: 0; }
#toolbar2 .grp button, #toolbar2 .grp select { font-size: 13px; }
.grp { display: flex; align-items: center; gap: 3px; background: #1d1f27; border-radius: 10px; padding: 4px; }
#toolbar button, #toolbar select, #toolbar input, #toolbar2 button, #toolbar2 select, #toolbar2 input {
  background: transparent; color: #e8e6df; border: none; border-radius: 7px;
  min-width: 30px; height: 32px; font-size: 15px; cursor: pointer; padding: 0 7px;
}
#toolbar select, #toolbar2 select { appearance: none; -webkit-appearance: none; }
#toolbar button:hover, #toolbar2 button:hover { background: #333642; }
#toolbar button.on, #toolbar2 button.on { background: #990814; color: #fff; }
#toolbar button.mus { font-family: 'Bravura'; font-size: 15px; line-height: 32px; }
#toolbar input[type=number], #toolbar2 input[type=number] { width: 46px; text-align: center; }
.slash { color: #777; }
.tempo { font-size: 14px; color: #cfccc2; display: flex; align-items: center; }
.tempo input { width: 60px; }
.modes button { font-size: 13px; padding: 0 12px; }
#playbtn { font-size: 16px; color: #7fe08d; }
#dotbtn { font-size: 26px; line-height: 30px; }

/* ---------- sheet ---------- */
#scorewrap { padding: 26px 10px 120px; display: flex; flex-direction: column; align-items: center; }
#sheet {
  --ink: #16130c; --paper: #fdfcf7; --soft: #444;
  background: var(--paper); color: var(--ink); width: 1160px; max-width: 98vw; overflow-x: auto;
  border-radius: 6px; box-shadow: 0 12px 40px rgba(0,0,0,.5); padding: 34px 0 40px;
}
#title { font-family: Georgia, 'Times New Roman', serif; text-align: center; font-size: 30px; margin: 0 60px 2px; outline: none; }
#composer { font-family: Georgia, serif; text-align: right; font-style: italic; font-size: 15px; margin: 0 48px 8px; min-height: 18px; outline: none; color: var(--soft); }
#composer:empty::before { content: attr(data-ph); color: #bbb; }
#title:focus, #composer:focus { background: #f3edd8; border-radius: 4px; }

#svgbox { position: relative; margin: 0 auto; width: 1160px; max-width: 100%; }
svg#score { display: block; }
svg#score .staffline { stroke: var(--ink); stroke-width: 1; }
svg#score .ledger { stroke: var(--ink); stroke-width: 1.2; }
svg#score .bar { stroke: var(--ink); stroke-width: 1.2; }
svg#score .barthick { fill: var(--ink); }
svg#score .stem { stroke: var(--ink); stroke-width: 1.4; }
svg#score .beam { fill: var(--ink); }
svg#score .tie { fill: none; stroke: var(--ink); stroke-width: 1.6; }
svg#score text.mus { font-family: 'Bravura'; font-size: 32px; fill: var(--ink); }
svg#score text.mus.dyn { font-size: 26px; }
svg#score text.mus.artic { font-size: 24px; }
svg#score .pname { font-family: Georgia, serif; font-size: 13px; fill: var(--ink); opacity: .85; }
svg#score .hit { fill: transparent; cursor: pointer; }
svg#score .ev.sel text.mus { fill: #2563eb; }
svg#score .ev.sel .hit { fill: rgba(37, 99, 235, .10); }
body.inputmode svg#score .hit { cursor: crosshair; }

#caret {
  display: none; position: absolute; width: 2.5px; background: #990814; z-index: 5;
  animation: blink 1.1s step-end infinite; pointer-events: none; border-radius: 2px;
}
@keyframes blink { 50% { opacity: .15; } }
#playhead { display: none; position: absolute; width: 2.5px; background: #2563eb; z-index: 6; pointer-events: none; border-radius: 2px; }
#inkcanvas { position: absolute; inset: 0; z-index: 8; pointer-events: none; touch-action: pan-y; }
body.inkmode #inkcanvas { touch-action: none; }
#lyricbox {
  display: none; position: absolute; z-index: 12; width: 84px; padding: 3px 6px;
  border: 1.5px solid #990814; border-radius: 6px; font-family: Georgia, serif; font-size: 13px;
  background: #fffdf4; color: #16130c; outline: none;
}
svg#score .tuplabel { font-family: Georgia, serif; font-style: italic; font-weight: bold; font-size: 12px; fill: var(--ink); }
svg#score .slur { fill: none; stroke: var(--ink); stroke-width: 1.7; }
svg#score .hair { stroke: var(--ink); stroke-width: 1.1; }
svg#score .ottline { stroke: var(--ink); stroke-width: 1.1; stroke-dasharray: 5 4; }
svg#score .otttxt { font-family: Georgia, serif; font-style: italic; font-weight: bold; font-size: 13px; fill: var(--ink); }
svg#score .volta { stroke: var(--ink); stroke-width: 1.4; }
svg#score .voltatxt { font-family: Georgia, serif; font-size: 12px; font-weight: bold; fill: var(--ink); }
svg#score .rdot { fill: var(--ink); }
svg#score .lyric { font-family: Georgia, serif; font-size: 13px; fill: var(--ink); }
svg#score .tempotxt { font-family: Georgia, serif; font-weight: bold; font-size: 14px; fill: var(--ink); }
svg#score .freetxt { font-family: Georgia, serif; font-style: italic; font-size: 13px; fill: var(--ink); }
svg#score .chordtxt { font-family: Georgia, serif; font-weight: bold; font-size: 14px; fill: var(--ink); }
svg#score .rehbox { fill: none; stroke: var(--ink); stroke-width: 1.3; }
svg#score .rehtxt { font-family: Georgia, serif; font-weight: bold; font-size: 13px; fill: var(--ink); }
svg#score .ev.rangesel .hit { fill: rgba(37, 99, 235, .10); }
svg#score .ev.v2 text.mus { fill: var(--ink); opacity: .82; }
body.inkmode #inkcanvas { cursor: crosshair; }
body.inkmode #sheet { box-shadow: 0 0 0 3px #990814, 0 12px 40px rgba(0,0,0,.5); }

#status {
  position: fixed; left: 18px; bottom: 14px; font-size: 13px; color: #b9b6ac;
  background: #1a1c23dd; padding: 7px 13px; border-radius: 9px; z-index: 20; max-width: 60vw;
}
#status:empty { display: none; }

#toast {
  position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%) translateY(80px);
  background: #16130c; color: #fdfcf7; padding: 11px 20px; border-radius: 12px;
  font-size: 14px; transition: transform .25s; z-index: 40; box-shadow: 0 6px 24px rgba(0,0,0,.5);
  max-width: 80vw;
}
#toast.show { transform: translateX(-50%) translateY(0); }

/* ---------- floating panels (mixer, scores) ---------- */
.floatpanel {
  display: none; position: fixed; top: 150px; right: 22px; z-index: 45;
  background: #1a1c23; border: 1px solid #3a3e4c; border-radius: 14px;
  padding: 12px 14px; min-width: 270px; max-height: 60vh; overflow: auto;
  box-shadow: 0 14px 40px rgba(0,0,0,.55);
}
.mxtitle { font-weight: 600; margin-bottom: 8px; display: flex; justify-content: space-between; align-items: center; }
.mxtitle button { background: #2e313c; color: #e8e6df; border: none; border-radius: 6px; width: 24px; height: 24px; cursor: pointer; }
.mxrow { display: flex; align-items: center; gap: 8px; padding: 5px 0; }
.mxname { flex: 1; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mxrow input[type=range] { width: 90px; accent-color: #990814; }
.mxrow button { background: #2e313c; color: #cfccc2; border: none; border-radius: 6px; width: 26px; height: 24px; font-size: 12px; cursor: pointer; }
.mxrow button.on { background: #990814; color: #fff; }
.sprow { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-top: 1px solid #262933; font-size: 13px; }
.spname { flex: 1; }
.spname em { color: #8f8ca0; font-style: normal; font-size: 11px; }
.spdate { color: #8f8ca0; font-size: 11px; }
.sprow button { background: #2e313c; color: #e8e6df; border: none; border-radius: 6px; height: 24px; padding: 0 8px; font-size: 12px; cursor: pointer; }
.sprow button:hover { background: #3a3e4c; }
#loopbtn.on, #clickbtn.on { background: #990814; color: #fff; }

/* ---------- help ---------- */
#help { display: none; position: fixed; inset: 0; background: rgba(10,10,14,.72); z-index: 50; }
#help.open { display: flex; align-items: center; justify-content: center; }
#help .card {
  background: #fdfcf7; color: #16130c; max-width: 860px; width: 92vw; max-height: 86vh; overflow: auto;
  border-radius: 14px; padding: 26px 30px; position: relative; font-size: 14.5px; line-height: 1.55;
}
#help h2 { margin: 0 0 6px; font-family: Georgia, serif; }
#help h3 { margin: 14px 0 4px; }
#help .cols { display: grid; grid-template-columns: 1fr 1fr; gap: 0 28px; }
#helpclose { position: absolute; top: 12px; right: 14px; border: none; background: #eee; border-radius: 8px; width: 30px; height: 30px; cursor: pointer; }
@media (max-width: 760px) { #help .cols { grid-template-columns: 1fr; } }

/* ---------- on-screen piano ---------- */
#piano {
  display: none; position: fixed; left: 0; right: 0; bottom: 0; z-index: 38;
  background: #1a1c23; border-top: 1px solid #000; padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
  overflow-x: auto; -webkit-overflow-scrolling: touch;
}
body.pianoopen #piano { display: block; }
body.pianoopen #scorewrap { padding-bottom: 240px; }
#pkeys { position: relative; height: 110px; width: max-content; margin: 0 auto; }
.pk { position: absolute; top: 0; border-radius: 0 0 6px 6px; cursor: pointer; user-select: none; -webkit-user-select: none; touch-action: none; }
.pk.w { width: 36px; height: 110px; background: #fdfcf7; border: 1px solid #555; z-index: 1; }
.pk.b { width: 24px; height: 66px; background: #16130c; border: 1px solid #000; z-index: 2; }
.pk.w:active, .pk.w.down { background: #d7d2c0; }
.pk.b:active, .pk.b.down { background: #444; }
.pk .pklabel { position: absolute; bottom: 4px; left: 0; right: 0; text-align: center; font-size: 10px; color: #888; pointer-events: none; }

/* ---------- mobile ---------- */
@media (max-width: 760px) {
  .logo { font-size: 17px; }
  .logo .tag { display: none; }
  #topbar { padding: 8px 10px; gap: 8px; }
  .filebtns { display: flex; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .filebtns::-webkit-scrollbar { display: none; }
  .filebtns button { padding: 6px 9px; font-size: 12px; white-space: nowrap; flex: none; }
  #toolbar, #toolbar2 { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; padding: 5px 8px; gap: 6px; scrollbar-width: none; }
  #toolbar::-webkit-scrollbar, #toolbar2::-webkit-scrollbar { display: none; }
  .grp { flex: none; }
  #toolbar button, #toolbar select, #toolbar2 button, #toolbar2 select { min-width: 34px; height: 36px; }
  #toolbar input[type=number], #toolbar2 input[type=number], #toolbar select, #toolbar2 select { font-size: 16px; }
  .grp.modes {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 36;
    justify-content: space-around; border-radius: 0; padding: 7px 6px calc(7px + env(safe-area-inset-bottom));
    background: #14161c; box-shadow: 0 -6px 20px rgba(0,0,0,.4);
  }
  .grp.modes button { height: 40px; font-size: 14px; }
  #notebtn { font-size: 13px; }
  html, body { overflow-x: hidden; }
  #scorewrap { padding: 12px 0 130px; overflow-x: hidden; width: 100%; }
  #sheet { padding: 18px 0 26px; border-radius: 0; max-width: none; overflow: visible; }
  .grp.modes button { font-size: 12px; white-space: nowrap; }
  #title { font-size: 22px; margin: 0 20px 2px; }
  #status { left: 8px; bottom: 66px; font-size: 12px; max-width: 80vw; }
  #toast { bottom: 72px; }
  .floatpanel { top: auto; bottom: 70px; right: 8px; left: 8px; min-width: 0; }
  #piano { bottom: 54px; padding-bottom: 8px; }
  body.pianoopen #scorewrap { padding-bottom: 300px; }
  #help .card { padding: 18px 16px; font-size: 13.5px; }
}
button, select { touch-action: manipulation; }

/* ---------- print ---------- */
@media print {
  body { background: #fff; }
  #topbar, #toolbar, #status, #toast, #help, #caret, #playhead, #inkcanvas { display: none !important; }
  #scorewrap { padding: 0; }
  #sheet { box-shadow: none; border-radius: 0; width: 100%; padding: 0; }
  #svgbox { width: 100%; }
  svg#score { width: 100%; height: auto; }
}

/* ---------- v5: accessibility, notation, dark sheet ---------- */
svg#score .ev:hover .hit { fill: rgba(37, 99, 235, .07); }
svg#score .melisma { stroke: var(--ink); stroke-width: 1.1; }
svg#score .arp { stroke: var(--ink); stroke-width: 1.5; fill: none; }
svg#score .trillg { font-size: 27px; }
svg#score .notename-in { font-family: -apple-system, sans-serif; font-size: 7.5px; font-weight: 700; fill: #fff; pointer-events: none; }
svg#score .notename-out { font-family: -apple-system, sans-serif; font-size: 9px; font-weight: 700; fill: var(--ink); pointer-events: none; }
svg#score.colornotes text.head.ns-C { fill: #e0304e; }
svg#score.colornotes text.head.ns-D { fill: #f2701d; }
svg#score.colornotes text.head.ns-E { fill: #d8a800; }
svg#score.colornotes text.head.ns-F { fill: #6aa823; }
svg#score.colornotes text.head.ns-G { fill: #1c8a48; }
svg#score.colornotes text.head.ns-A { fill: #6f42a8; }
svg#score.colornotes text.head.ns-B { fill: #cf3a8e; }
svg#score.colornotes .ev.sel text.head { fill: #2563eb; }
body.darksheet #sheet { --ink: #e3ded0; --paper: #1b1d24; --soft: #a09c8e; box-shadow: 0 12px 40px rgba(0,0,0,.7); }
body.darksheet #title:focus, body.darksheet #composer:focus { background: #2a2d38; }
body.darksheet svg#score .ev.sel text.mus, body.darksheet svg#score .ev.sel text.head { fill: #6ba1ff; }
#colorbtn.on, #namesbtn.on, #darkbtn.on, #speakbtn.on { background: #990814; color: #fff; }

/* ---------- playback note highlight ---------- */
svg#score .ev.playing text.mus, svg#score .ev.playing text.head { fill: #b30f1f; }
body.darksheet svg#score .ev.playing text.mus, body.darksheet svg#score .ev.playing text.head { fill: #ff8a7a; }

/* ---------- v10: color painting + focus mode ---------- */
svg#score .ev.tinted:not(.sel):not(.playing) text.mus,
svg#score .ev.tinted:not(.sel):not(.playing) text.head,
svg#score .ev.tinted:not(.sel):not(.playing) .notename-out { fill: currentColor; }
#toolbar2 input[type=color], #toolbar input[type=color] {
  width: 34px; height: 30px; padding: 2px; border: none; background: transparent; cursor: pointer; border-radius: 7px;
}
.mxrow input[type=color] { width: 26px; height: 24px; padding: 1px; border: none; background: transparent; cursor: pointer; }
body.focusmode #chrome, body.focusmode #status, body.focusmode #piano { display: none; }
body.focusmode #scorewrap { padding-top: 10px; }
body.focusmode .grp.modes { display: none; }

svg#score .ev.playing { filter: drop-shadow(0 0 3px rgba(179, 15, 31, .75)); }
body.darksheet svg#score .ev.playing { filter: drop-shadow(0 0 4px rgba(255, 138, 122, .8)); }
.mxrow .mxpan { width: 64px; accent-color: #2563eb; }
.mxrow .mxrev { width: 120px; accent-color: #2563eb; }

svg#score .barnum { font-family: Georgia, serif; font-size: 11px; fill: var(--ink); opacity: .65; }

/* ---------- v13: wizard, parts panel, saved pill ---------- */
#wizard { top: 90px; right: auto; left: 50%; transform: translateX(-50%); min-width: 320px; }
.wzrow { display: flex; align-items: center; gap: 8px; padding: 6px 0; font-size: 13px; }
.wzrow label { min-width: 40px; color: #b9b6ac; }
.wzrow input, .wzrow select { background: #2e313c; color: #e8e6df; border: 1px solid #454858; border-radius: 7px; padding: 6px 8px; font-size: 14px; flex: 1; }
.wzrow input[type=number] { flex: none; }
.wzgo { background: #990814 !important; color: #fff !important; border: none !important; font-weight: 600; padding: 9px 0 !important; width: 100%; cursor: pointer; }
#partspanel .ppname { background: #2e313c; color: #e8e6df; border: 1px solid #454858; border-radius: 6px; padding: 4px 7px; flex: 1; font-size: 13px; min-width: 90px; }
#partspanel .ppclef { background: #2e313c; color: #e8e6df; border: 1px solid #454858; border-radius: 6px; font-size: 12px; }
#partspanel button:disabled { opacity: .3; }
#savedpill {
  position: fixed; right: 16px; bottom: 14px; z-index: 20; font-size: 12px; color: #7fe08d;
  background: #1a1c23dd; padding: 5px 10px; border-radius: 8px; opacity: 0; transition: opacity .3s; pointer-events: none;
}
#savedpill.show { opacity: 1; }
svg#score .lyric { cursor: text; }
@media (max-width: 760px) { #wizard { left: 8px; right: 8px; transform: none; } }

/* ---------- v14: streamlined visual reskin ---------- */
#chrome { background: rgba(30, 32, 41, .88); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); box-shadow: 0 1px 0 rgba(255,255,255,.04), 0 8px 24px rgba(0,0,0,.35); }
#topbar { background: transparent; border-bottom: 1px solid rgba(255,255,255,.05); }
#toolbar, #toolbar2 { background: transparent; }
.logo b { background: linear-gradient(135deg, #f2efe6, #c9909a); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.grp { background: rgba(255,255,255,.045); border: 1px solid rgba(255,255,255,.05); }
.grp[data-cap] { position: relative; padding-top: 16px; }
.grp[data-cap]::before {
  content: attr(data-cap); position: absolute; top: 3px; left: 10px;
  font-size: 8.5px; letter-spacing: .14em; text-transform: uppercase; color: #767b8c; pointer-events: none;
}
#toolbar button, #toolbar2 button { transition: background .12s, transform .08s; }
#toolbar button:active, #toolbar2 button:active { transform: scale(.93); }
#toolbar button.on, #toolbar2 button.on { background: linear-gradient(160deg, #b30f1f, #8a0712); box-shadow: 0 2px 8px rgba(179,15,31,.35); }
.filebtns button { transition: background .12s, transform .08s; }
.filebtns button:active { transform: scale(.95); }
#playbtn { text-shadow: 0 0 12px rgba(127,224,141,.6); }
#sheet {
  box-shadow: 0 2px 4px rgba(0,0,0,.3), 0 18px 55px rgba(0,0,0,.55), inset 0 0 90px rgba(120, 95, 40, .05);
  background-image: repeating-linear-gradient(0deg, transparent 0 2px, rgba(120,95,40,.012) 2px 4px);
}
.floatpanel { animation: qpop .16s ease; }
@keyframes qpop { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
#wizard { animation: qpop .16s ease; }
@media (max-width: 760px) {
  .grp[data-cap] { padding-top: 4px; }
  .grp[data-cap]::before { display: none; }
  #chrome { backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
}

/* ---------- v15: stunning pass ---------- */
#flourish { text-align: center; color: var(--ink); opacity: .75; margin: 2px 0 6px; }
#fxcanvas { position: absolute; inset: 0; z-index: 7; pointer-events: none; }
#sheet[data-theme] { transition: background .4s; }
#sheet[data-theme="parchment"] {
  --ink: #3a2c18; --paper: #f2e6cb; --soft: #7a6647;
  background-image: radial-gradient(ellipse at 25% 15%, rgba(140,100,40,.10), transparent 55%), radial-gradient(ellipse at 80% 90%, rgba(120,80,30,.08), transparent 50%);
}
#sheet[data-theme="midnight"] { --ink: #e3ded0; --paper: #1b1d24; --soft: #a09c8e; }
#sheet[data-theme="blueprint"] {
  --ink: #eaf2ff; --paper: #14365c; --soft: #9db8d8;
  background-image: linear-gradient(rgba(255,255,255,.045) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.045) 1px, transparent 1px);
  background-size: 24px 24px;
}
#sheet[data-theme="candy"] {
  --ink: #5b2a49; --paper: #fdeef5; --soft: #b06a92;
  background-image: radial-gradient(circle at 15% 10%, rgba(255,160,200,.15), transparent 40%), radial-gradient(circle at 85% 85%, rgba(180,150,255,.12), transparent 40%);
}
#sheet[data-theme="blueprint"] svg#score .ev.sel text.mus, #sheet[data-theme="blueprint"] svg#score .ev.sel text.head { fill: #ffd66b; }
#sheet[data-theme="blueprint"] svg#score .ev.playing text.mus, #sheet[data-theme="blueprint"] svg#score .ev.playing text.head { fill: #ffb2a8; }
#sheet[data-theme="midnight"] svg#score .ev.playing text.mus { fill: #ff8a7a; }
.logo b { background: linear-gradient(120deg, #f2efe6 20%, #d9a3ab 40%, #f2efe6 60%); background-size: 200% 100%; -webkit-background-clip: text; background-clip: text; animation: shimmer 6s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
#playhead {
  background: linear-gradient(180deg, transparent, #2563eb 15%, #2563eb 85%, transparent);
  box-shadow: 0 0 10px rgba(37, 99, 235, .55), 0 0 26px rgba(37, 99, 235, .25);
  width: 3px;
}

/* ---------- v16: custom icon set ---------- */
.qicon { width: 19px; height: 19px; display: inline-block; vertical-align: middle; }
button.iconic { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
button.iconic .qlbl { font-size: 13px; }
#playbtn .qicon { width: 20px; height: 20px; }
.grp.modes button.iconic { min-width: 38px; }

/* ---------- v17: music font choices ---------- */
#sheet[data-mfont="petaluma"] svg#score text.mus { font-family: 'Petaluma', 'Bravura'; }
#sheet[data-mfont="leland"] svg#score text.mus { font-family: 'Leland', 'Bravura'; }

/* ---------- v19: tour, groove ---------- */
#tour { display: none; position: fixed; inset: 0; z-index: 60; pointer-events: none; }
#tourbox {
  position: absolute; width: 310px; background: #1a1c23; border: 1px solid #454858; border-radius: 14px;
  padding: 14px 16px; pointer-events: auto; box-shadow: 0 16px 44px rgba(0,0,0,.6); animation: qpop .2s ease;
}
#tourbox p { margin: 0 0 10px; font-size: 14px; line-height: 1.5; color: #e8e6df; }
.tourbtns { display: flex; justify-content: flex-end; gap: 8px; }
.tourbtns button { border: none; border-radius: 8px; padding: 7px 14px; cursor: pointer; font-size: 13px; }
#tourskip { background: #2e313c; color: #b9b6ac; }
#tournext { background: #990814; color: #fff; font-weight: 600; }
.tourglow { box-shadow: 0 0 0 3px #990814, 0 0 18px rgba(179,15,31,.65) !important; border-radius: 8px; position: relative; z-index: 61; }

/* ---------- v20: page view ---------- */
svg#score .page { fill: var(--paper); stroke: rgba(0,0,0,.14); stroke-width: 1; }
svg#score .pagenum { font-family: Georgia, serif; font-size: 12px; fill: var(--ink); opacity: .55; }
svg#score .svgtitle { font-family: Georgia, serif; font-weight: bold; font-size: 30px; fill: var(--ink); }
svg#score .svgcomposer { font-family: Georgia, serif; font-style: italic; font-size: 15px; fill: var(--soft); }
svg#score .svgflour { stroke: var(--ink); stroke-width: 1; fill: var(--ink); opacity: .75; }
body.pagedview #title, body.pagedview #composer, body.pagedview #flourish { display: none; }
body.pagedview #sheet { background: transparent !important; box-shadow: none; padding-top: 6px; background-image: none !important; }

/* ---------- v21: annotations + practice room ---------- */
body.annotmode #fxcanvas { cursor: crosshair; touch-action: none; }
body.annotmode #sheet { box-shadow: 0 0 0 3px #1c6fb5, 0 12px 40px rgba(0,0,0,.5); }
#stand { display: none; position: fixed; inset: 0; z-index: 70; background: #14161c; flex-direction: column; }
#standtop { display: flex; justify-content: space-between; align-items: center; padding: 10px 16px calc(10px + env(safe-area-inset-top)); background: #0e1014; color: #e8e6df; }
#standtitle { font-family: Georgia, serif; font-size: 17px; }
#standtop button { background: #2e313c; color: #e8e6df; border: none; border-radius: 9px; padding: 9px 18px; margin-left: 8px; font-size: 15px; cursor: pointer; }
#standplay { background: #990814 !important; color: #fff; font-weight: 600; }
#standbody { flex: 1; overflow: auto; padding: 14px; cursor: pointer; -webkit-overflow-scrolling: touch; }
#standsvg svg { display: block; }
#standcount {
  display: none; position: absolute; inset: 0; align-items: center; justify-content: center;
  font-size: 22vh; font-weight: bold; color: rgba(255,255,255,.9); background: rgba(10,10,14,.75);
  font-family: Georgia, serif; pointer-events: none;
}
body.standopen { overflow: hidden; }
@media print {
  svg#score .page { stroke: none; }
  body.pagedview #sheet { background: #fff !important; }
}

/* ---------- v22: tab staff + practice speed ---------- */
svg#score .tabclef { font-family: Georgia, serif; font-weight: bold; font-size: 13px; letter-spacing: 1px; fill: var(--ink); }
svg#score .tabnum { font-family: -apple-system, sans-serif; font-weight: 700; font-size: 11.5px; fill: var(--ink); }
svg#score .tabbg { fill: var(--paper); }
svg#score .ev.tinted .tabnum { fill: currentColor; }
.pctwrap { display: inline-flex; align-items: center; gap: 6px; padding: 0 6px; }
.pctwrap input[type=range] { width: 78px; accent-color: #990814; }
#playpctlbl { font-size: 11px; color: #b9b6ac; min-width: 32px; }

/* ---------- v23: install sheet ---------- */
#installbtn { background: #990814 !important; color: #fff; border-color: #990814 !important; font-weight: 600; }
#installsheet { display: none; position: fixed; inset: 0; z-index: 80; background: rgba(8,9,12,.75); align-items: center; justify-content: center; padding: 16px; }
#installsheet .card { background: #1a1c23; border: 1px solid #3a3e4c; border-radius: 16px; padding: 20px 22px; max-width: 380px; animation: qpop .18s ease; }
#installsheet h3 { margin: 0 0 10px; font-size: 17px; }
#installsheet ol { margin: 0 0 14px; padding-left: 20px; font-size: 14px; line-height: 1.7; color: #cfccc2; }
#installclose { background: #990814; color: #fff; border: none; border-radius: 9px; padding: 10px 18px; font-size: 14px; cursor: pointer; width: 100%; }

/* mobile: keep the perform bar docked (must come after .grp[data-cap] rules) */
@media (max-width: 760px) {
  .grp.modes[data-cap] {
    position: fixed; left: 0; right: 0; bottom: 0; top: auto; z-index: 36;
    justify-content: space-around; border-radius: 0; padding: 7px 6px calc(7px + env(safe-area-inset-bottom));
    background: #14161c; box-shadow: 0 -6px 20px rgba(0,0,0,.4); overflow-x: auto;
  }
  .grp.modes[data-cap]::before { display: none; }
  .grp.modes[data-cap] button.iconic .qlbl { display: none; }
  .grp.modes[data-cap] button { min-width: 34px; padding: 0 6px; flex: none; }
  .pctwrap input[type=range] { width: 58px; }
  /* backdrop-filter creates a containing block that traps position:fixed children */
  #chrome { backdrop-filter: none !important; -webkit-backdrop-filter: none !important; background: rgba(26,28,35,.97); }
}

/* ---------- v24: Dynamic Island / notch safe areas + entry pad ---------- */
#topbar { padding-top: calc(10px + env(safe-area-inset-top)); padding-left: calc(18px + env(safe-area-inset-left)); padding-right: calc(18px + env(safe-area-inset-right)); }
#toolbar, #toolbar2 { padding-left: calc(18px + env(safe-area-inset-left)); padding-right: calc(18px + env(safe-area-inset-right)); }
#standtop { padding-left: calc(16px + env(safe-area-inset-left)); padding-right: calc(16px + env(safe-area-inset-right)); }
@media (max-width: 760px) {
  #topbar { padding-left: calc(10px + env(safe-area-inset-left)); padding-right: calc(10px + env(safe-area-inset-right)); }
  #toolbar, #toolbar2 { padding-left: calc(8px + env(safe-area-inset-left)); padding-right: calc(8px + env(safe-area-inset-right)); }
  .grp.modes[data-cap] { padding-left: calc(6px + env(safe-area-inset-left)); padding-right: calc(6px + env(safe-area-inset-right)); }
  #piano { padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); }
  #status { bottom: calc(66px + env(safe-area-inset-bottom)); }
}
#padrow { display: flex; justify-content: center; gap: 8px; padding: 4px 0 10px; }
#padrow button {
  background: #2e313c; color: #e8e6df; border: 1px solid #454858; border-radius: 10px;
  min-width: 48px; height: 42px; font-size: 17px; cursor: pointer;
}
#padrow button.mus { font-family: 'Bravura'; }
#padrow button.on { background: #990814; border-color: #990814; color: #fff; }
#scanbtn { border-color: #6b4e9b !important; }

/* ---------- v25: melody mic ---------- */
#micsheet { display: none; position: fixed; inset: 0; z-index: 80; background: rgba(8,9,12,.75); align-items: center; justify-content: center; padding: 16px; }
#micsheet .card { background: #1a1c23; border: 1px solid #3a3e4c; border-radius: 16px; padding: 20px 22px; max-width: 380px; width: 100%; animation: qpop .18s ease; }
#micsheet h3 { margin: 0 0 8px; }
#micsheet p { font-size: 13.5px; color: #cfccc2; line-height: 1.5; margin: 0 0 10px; }
#miclive { text-align: center; font-family: Georgia, serif; font-size: 40px; min-height: 52px; color: #7fe08d; }
#micgo { background: #990814; color: #fff; border: none; border-radius: 9px; padding: 9px 18px; font-weight: 600; cursor: pointer; }
#miccancel { background: #2e313c; color: #b9b6ac; border: none; border-radius: 9px; padding: 9px 14px; cursor: pointer; }

/* ---- v26: symphonic composer pack ---- */
svg#score .techtxt { font-family: Georgia, serif; font-style: italic; font-size: 12.5px; fill: var(--ink); }
svg#score .harmtxt { font-family: Georgia, serif; font-size: 11px; fill: var(--ink); }
svg#score .tremsl { stroke: var(--ink); stroke-width: 2.6; stroke-linecap: round; }
svg#score .curvetxt { font-family: Georgia, serif; font-style: italic; font-weight: bold; font-size: 13.5px; fill: var(--ink); }
svg#score .head.oor { fill: #e11d2e !important; }
svg#score .hbar { fill: var(--ink); }
svg#score .multinum { font-family: Georgia, serif; font-weight: bold; font-size: 17px; fill: var(--ink); }
svg#score .fambrack { fill: var(--ink); }
svg#score .fambrackend { stroke: var(--ink); stroke-width: 2.4; fill: none; }
svg#score g.cueev { opacity: .5; }
svg#score g.cueev text.mus { font-size: 26px; }

/* ---- v27: full symphonic pack ---- */
svg#score .twordstxt { font-family: Georgia, serif; font-weight: bold; font-style: italic; font-size: 15px; fill: var(--ink); }
svg#score .jumptxt { font-family: Georgia, serif; font-weight: bold; font-style: italic; font-size: 12.5px; fill: var(--ink); }
svg#score .navglyph { fill: var(--ink); }
svg#score .clefsmall { fill: var(--ink); }
svg#score .breathg { fill: var(--ink); }
svg#score .glissline { stroke: var(--ink); stroke-width: 1.6; }
svg#score .glisstxt { font-family: Georgia, serif; font-style: italic; font-size: 10.5px; fill: var(--ink); }
svg#score .harpped { fill: var(--ink); }
#tgrp { width: 62px; }

/* ---- v28: flow pack ---- */
svg#score .simg { fill: var(--ink); }
#palette { display: none; position: fixed; inset: 0; background: rgba(10, 10, 16, .45); z-index: 300; align-items: flex-start; justify-content: center; padding-top: 12vh; backdrop-filter: blur(2px); }
#palcard { width: min(520px, 92vw); background: #23252e; border: 1px solid #3a3d49; border-radius: 14px; box-shadow: 0 18px 50px rgba(0,0,0,.5); overflow: hidden; }
#palinput { width: 100%; box-sizing: border-box; padding: 14px 16px; font-size: 16px; background: transparent; border: none; outline: none; color: #eceef4; border-bottom: 1px solid #3a3d49; }
#pallist { max-height: 46vh; overflow-y: auto; padding: 6px; }
.palrow { padding: 9px 12px; border-radius: 8px; color: #c9cdd8; font-size: 13.5px; cursor: pointer; }
.palrow.on, .palrow:hover { background: #b30f1f; color: #fff; }

/* ---- v29: teacher's pack ---- */
#subtitle { text-align: center; font-style: italic; font-size: 15px; opacity: .85; min-height: 18px; outline: none; }
#subtitle:empty::before, #composer:empty::before { content: attr(data-ph); opacity: .35; }
svg#score .fingtxt { font-family: Georgia, serif; font-weight: bold; font-size: 10.5px; fill: var(--ink); }
svg#score .bowg { fill: var(--ink); }
svg#score .pedg { fill: var(--ink); }
svg#score .fretbox line { stroke: var(--ink); stroke-width: .8; }
svg#score .fretbox line.nut { stroke-width: 2.2; }
svg#score .fretbox .fretdot { fill: var(--ink); }
svg#score .fretbox .fretxo { font-size: 7px; fill: var(--ink); font-family: Georgia, serif; }
svg#score .fretbox .fretnum { font-size: 8px; fill: var(--ink); font-family: Georgia, serif; }
svg#score .svgsubtitle { font-family: Georgia, serif; font-style: italic; font-size: 15px; fill: var(--ink); opacity: .85; }
svg#score .copytxt { font-family: Georgia, serif; font-size: 11px; fill: var(--ink); opacity: .75; }

/* ---- v30: parity pack ---- */
svg#score .cauttxt { font-family: Georgia, serif; font-size: 12px; fill: var(--ink); }
svg#score .slashbeat { stroke: var(--ink); stroke-width: 3.4; stroke-linecap: round; }

/* ---- v31: deep engine pack ---- */
svg#score .ossia .staffline { stroke-width: .8; }
svg#score .ossialbl { font-family: Georgia, serif; font-style: italic; font-size: 10px; fill: var(--ink); opacity: .8; }
svg#score .ossia .ledger { stroke-width: .9; }
svg#score .ossia .stem { stroke-width: 1.1; }

/* ---- v32: ease pack ---- */
body.simplemode .advctl { display: none !important; }
body.simplemode .grp:not(:has(> :not(.advctl))) { display: none !important; }
#bubble { display: none; position: absolute; z-index: 40; gap: 2px; background: #23252e; border: 1px solid #3a3d49; border-radius: 10px; padding: 4px; box-shadow: 0 6px 22px rgba(0,0,0,.35); }
#bubble button { min-width: 34px; height: 34px; border: none; border-radius: 7px; background: transparent; color: #e7e9f0; font-size: 15px; cursor: pointer; }
#bubble button:hover, #bubble button.on { background: #b30f1f; color: #fff; }
#emptyhint { display: none; position: absolute; top: 118px; left: 0; right: 0; z-index: 5; pointer-events: none; text-align: center; font-family: Georgia, serif; font-size: 15px; line-height: 2; color: var(--ink); opacity: .6; }
.toastact { margin-left: 12px; padding: 4px 14px; border: none; border-radius: 8px; background: #b30f1f; color: #fff; font-weight: bold; font-size: 13px; cursor: pointer; }

/* ---- v33: sleek & smooth pass ---- */
/* motion foundation */
#sheet, #sheet[data-theme] { transition: transform .32s cubic-bezier(.22,.9,.3,1), box-shadow .3s, background .4s; }
#sheet.pagein { animation: pagein .5s cubic-bezier(.2,.8,.25,1); }
@keyframes pagein { from { opacity: 0; transform: translateY(18px) scale(.985); } }
svg#score text.mus, svg#score text.head { transition: fill .14s ease; }
#caret { animation: caretblink 1.15s ease-in-out infinite; }
@keyframes caretblink { 0%, 100% { opacity: 1; } 55% { opacity: .18; } }
#playhead { animation: phpulse 1.6s ease-in-out infinite; }
@keyframes phpulse {
  0%, 100% { box-shadow: 0 0 10px rgba(37,99,235,.55), 0 0 26px rgba(37,99,235,.25); }
  50% { box-shadow: 0 0 14px rgba(37,99,235,.8), 0 0 34px rgba(37,99,235,.4); }
}
svg#score .ev.pop { animation: notepop .22s cubic-bezier(.3,1.6,.5,1); transform-box: fill-box; transform-origin: center; }
@keyframes notepop { from { transform: scale(.55); } }

/* chrome refinement */
.filebtns button {
  background: linear-gradient(180deg, #323644, #2a2d38);
  border-color: rgba(255,255,255,.09);
  box-shadow: 0 1px 2px rgba(0,0,0,.3), inset 0 1px 0 rgba(255,255,255,.05);
  transition: background .15s, transform .1s, box-shadow .15s;
}
.filebtns button:hover { background: linear-gradient(180deg, #3b4050, #31343f); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,.35), inset 0 1px 0 rgba(255,255,255,.07); }
.filebtns button:active { transform: translateY(0) scale(.96); }
.grp { transition: border-color .2s, background .2s; box-shadow: inset 0 1px 0 rgba(255,255,255,.03); }
.grp:hover { border-color: rgba(255,255,255,.11); background: rgba(255,255,255,.06); }
#toolbar button:hover, #toolbar2 button:hover { background: rgba(255,255,255,.1); }
#toolbar button, #toolbar2 button, #toolbar select, #toolbar2 select { transition: background .14s, transform .09s, color .14s; }

/* bubble: springy pop-in, glassier */
#bubble {
  background: rgba(32,34,43,.92); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-color: rgba(255,255,255,.12);
  box-shadow: 0 10px 30px rgba(0,0,0,.45), inset 0 1px 0 rgba(255,255,255,.06);
  animation: bubblein .2s cubic-bezier(.3,1.5,.5,1);
}
@keyframes bubblein { from { opacity: 0; transform: translateY(6px) scale(.9); } }
#bubble button { transition: background .12s, transform .09s; }
#bubble button:active { transform: scale(.88); }

/* palette: cinematic entrance */
#palette { backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); animation: palfade .18s ease; }
@keyframes palfade { from { opacity: 0; } }
#palcard { animation: palcard .22s cubic-bezier(.2,.9,.3,1.1); border-color: rgba(255,255,255,.1); box-shadow: 0 24px 70px rgba(0,0,0,.6), inset 0 1px 0 rgba(255,255,255,.05); }
@keyframes palcard { from { opacity: 0; transform: translateY(-14px) scale(.97); } }
.palrow { transition: background .1s, color .1s; }

/* toast: spring + gloss */
#toast {
  transition: transform .38s cubic-bezier(.2,1.4,.35,1);
  background: linear-gradient(180deg, #1d1a13, #14110b);
  border: 1px solid rgba(255,255,255,.08);
  box-shadow: 0 10px 34px rgba(0,0,0,.55), inset 0 1px 0 rgba(255,255,255,.05);
}
.toastact { transition: transform .1s, background .12s; }
.toastact:hover { background: #d31527; }
.toastact:active { transform: scale(.94); }

/* panels: glass */
.floatpanel {
  background: rgba(24,26,33,.94); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-color: rgba(255,255,255,.09);
  box-shadow: 0 18px 50px rgba(0,0,0,.55), inset 0 1px 0 rgba(255,255,255,.05);
}
.sprow button, .mxrow button, .mxtitle button { transition: background .12s, transform .09s; }
.sprow button:active, .mxrow button:active, .mxtitle button:active { transform: scale(.92); }

/* piano: dimensional keys */
.pk.w { background: linear-gradient(180deg, #ffffff, #f2efe4 82%, #ddd8c8); box-shadow: inset 0 -3px 5px rgba(0,0,0,.12), 0 2px 3px rgba(0,0,0,.35); transition: background .08s; }
.pk.b { background: linear-gradient(180deg, #2b2b32, #101014 85%); box-shadow: inset 0 -3px 4px rgba(255,255,255,.06), 0 3px 5px rgba(0,0,0,.5); transition: background .08s; }
.pk.w:active, .pk.w.down { background: linear-gradient(180deg, #efe9d5, #dcd5bd); }
.pk.b:active, .pk.b.down { background: linear-gradient(180deg, #4a4a55, #26262e); }

/* thin, quiet scrollbars */
#toolbar::-webkit-scrollbar, #toolbar2::-webkit-scrollbar { height: 0; }
.floatpanel::-webkit-scrollbar, #pallist::-webkit-scrollbar, #help .card::-webkit-scrollbar { width: 8px; }
.floatpanel::-webkit-scrollbar-thumb, #pallist::-webkit-scrollbar-thumb, #help .card::-webkit-scrollbar-thumb { background: rgba(255,255,255,.14); border-radius: 8px; }
.floatpanel::-webkit-scrollbar-track, #pallist::-webkit-scrollbar-track, #help .card::-webkit-scrollbar-track { background: transparent; }

/* misc gloss */
#savedpill { transition: opacity .3s, transform .3s; transform: translateY(4px); }
#savedpill.show { transform: none; }
#emptyhint { animation: hintfade .6s ease .15s backwards; }
@keyframes hintfade { from { opacity: 0; transform: translateY(8px); } to { opacity: .6; } }
#status { border: 1px solid rgba(255,255,255,.06); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
:focus-visible { outline: 2px solid #d31527; outline-offset: 2px; border-radius: 6px; }
#toolbar button:focus, #toolbar2 button:focus, .filebtns button:focus { outline: none; }
#toolbar button:focus-visible, #toolbar2 button:focus-visible, .filebtns button:focus-visible { outline: 2px solid #d31527; }

/* respect reduced-motion */
@media (prefers-reduced-motion: reduce) {
  #sheet.pagein, svg#score .ev.pop, #bubble, #palcard, #palette, #emptyhint { animation: none !important; }
  #playhead, #caret { animation: none !important; }
  #sheet, #toast { transition: none !important; }
  .logo b { animation: none !important; }
}

/* ---- v35: simplicity wave ---- */
#bubble2 { display: none; position: absolute; z-index: 40; gap: 2px; padding: 4px; border-radius: 10px;
  background: rgba(32,34,43,.92); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,.12); box-shadow: 0 10px 30px rgba(0,0,0,.45);
  animation: bubblein .2s cubic-bezier(.3,1.5,.5,1); }
#bubble2 button { min-width: 32px; height: 32px; border: none; border-radius: 7px; background: transparent;
  color: #e7e9f0; font-size: 14px; cursor: pointer; transition: background .12s, transform .09s; }
#bubble2 button:hover, #bubble2 button.on { background: #b30f1f; color: #fff; }
#bubble2 button:active { transform: scale(.88); }

#hintline { max-width: 1160px; margin: 10px auto 0; padding: 0 16px; text-align: center;
  font-size: 13px; color: #9a97a8; font-style: italic; }

/* big friendly choosers */
#addsheet, #startsheet, #setsheet { display: none; position: fixed; inset: 0; z-index: 200;
  background: rgba(8,9,12,.72); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  align-items: center; justify-content: center; padding: 16px; }
#addsheet .card, #startsheet .card, #setsheet .card { background: #1c1e26; border: 1px solid rgba(255,255,255,.1);
  border-radius: 18px; padding: 22px; max-width: 620px; width: 100%; max-height: 88vh; overflow: auto;
  box-shadow: 0 24px 70px rgba(0,0,0,.6); animation: palcard .24s cubic-bezier(.2,.9,.3,1.1); }
#addsheet h3, #startsheet h3, #setsheet h3 { margin: 0 0 16px; font-size: 19px; text-align: center; }
.waygrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.waygrid button { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 16px 8px;
  background: #262933; border: 1px solid rgba(255,255,255,.07); border-radius: 14px; color: #e8e6df;
  cursor: pointer; transition: background .14s, transform .1s, border-color .14s; }
.waygrid button:hover { background: #303543; border-color: rgba(255,255,255,.16); transform: translateY(-2px); }
.waygrid button:active { transform: scale(.96); }
.waygrid b { font-size: 26px; line-height: 1.1; }
.waygrid span { font-size: 14px; font-weight: 600; }
.waygrid em { font-size: 11px; opacity: .6; font-style: normal; text-align: center; }
.sheetclose { margin-top: 16px; width: 100%; padding: 11px; border: none; border-radius: 11px;
  background: #2e313c; color: #cfccc2; font-size: 14px; cursor: pointer; }
.sheetclose:hover { background: #3a3e4c; }
.setrow { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 2px;
  border-top: 1px solid rgba(255,255,255,.06); font-size: 14px; }
.setrow:first-child { border-top: none; }
.setrow input[type=range] { width: 130px; accent-color: #b30f1f; }
.setrow input[type=checkbox] { width: 20px; height: 20px; accent-color: #b30f1f; }
.setrow select { background: #2e313c; color: #e8e6df; border: 1px solid #454858; border-radius: 8px; padding: 6px 8px; }
#addnotesbtn { background: linear-gradient(160deg, #b30f1f, #8a0712) !important; color: #fff !important;
  font-weight: 600; padding: 0 14px !important; }
@media (max-width: 760px) {
  .waygrid { grid-template-columns: repeat(2, 1fr); }
  #hintline { font-size: 12px; padding: 0 10px; }
  #bubble2 { display: none !important; }
}
.minibtn { background: #2e313c; color: #e8e6df; border: none; border-radius: 8px; padding: 6px 10px; font-size: 12px; cursor: pointer; }
.minibtn:hover { background: #3a3e4c; }

/* ---- v37: mobile perform bar — five big targets, rest behind ⋯ ---- */
#mobilemore { display: none; }
@media (max-width: 760px) {
  .grp.modes .mob-hide { display: none !important; }
  #mobilemore { display: inline-flex !important; align-items: center; justify-content: center;
    min-width: 44px !important; font-size: 20px !important; }
  .grp.modes[data-cap] button { min-width: 44px !important; height: 44px; font-size: 15px; }
  .grp.modes[data-cap] { justify-content: space-evenly; overflow-x: visible; }
  #addnotesbtn { padding: 0 12px !important; }
}

/* ---- v39: iPhone / Safari sweep ---- */
/* no blue flash on tap, and no iOS text-callout fighting our long-press help */
button, select, .pk, .ev, .waygrid button, .palrow, #bubble button, #bubble2 button {
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
}
button, .waygrid button, .pk { -webkit-user-select: none; user-select: none; }
/* iOS zooms the whole page when a focused field is under 16px */
input, select, textarea { font-size: 16px; }
.wzrow input, .wzrow select, .setrow select { font-size: 16px; }
/* the compact desktop sizes are safe only where iOS can't zoom the page */
@media (min-width: 761px) {
  #toolbar button, #toolbar2 button { font-size: 15px; }
  #toolbar2 .grp button, #toolbar2 .grp select { font-size: 13px; }
  #toolbar input[type=number], #toolbar2 input[type=number] { font-size: 14px; }
}
.sprow button, .mxrow button, .mxtitle button, .minibtn { font-size: 12px; }
/* every focusable field on a phone must be at least 16px or Safari zooms in */
@media (max-width: 760px) {
  input, select, textarea,
  #toolbar input, #toolbar select, #toolbar2 input, #toolbar2 select { font-size: 16px !important; }
}
/* Safari needs the prefix; unprefixed alone silently does nothing on older iOS */
#palette { -webkit-backdrop-filter: blur(6px); }
/* fallback for Safari < 15.4 which has no :has() — JS marks all-advanced groups */
body.simplemode .grp.alladv { display: none !important; }
/* iOS: dynamic viewport units keep full-screen panels correct when the URL bar moves */
@supports (height: 100dvh) {
  #stand, #help, #palette, #addsheet, #startsheet, #setsheet, #installsheet, #micsheet { height: 100dvh; }
}
/* momentum scrolling inside every scrollable surface */
.floatpanel, #pallist, #help .card, #addsheet .card, #startsheet .card, #setsheet .card, #standbody {
  -webkit-overflow-scrolling: touch;
}

/* ---- v40: paper width is set in JS to match the engraved page ---- */
#sheet { max-width: none; }
@media (max-width: 760px) { #scorewrap { padding-left: 0; padding-right: 0; } }
