/* Night-concert falling notes: legend matches the teal (left) and gold (right) notes */
.hand-legend .hand-left::before { background: #3fd6cc !important; box-shadow: 0 0 8px #3fd6cc; }
.hand-legend .hand-right::before { background: #ffb24f !important; box-shadow: 0 0 8px #ffb24f; }
/* Full-width piano stage on the Mac (the website keeps its centred 16:9 box).
   Video export still uses the 16:9 layout so MP4s keep their proportions. */
html.signature-player body:not(.creating-piano-video) #pianoStage {
  width: 100% !important; max-width: none !important; aspect-ratio: auto !important;
  height: var(--piano-stage-height, 70vh) !important; align-self: stretch !important;
  border-radius: 0 !important; border-left: 0 !important; border-right: 0 !important;
}
/* glossy floor reflections under the 3D keyboard */
#signatureFloorFx { position: absolute; left: 0; right: 0; top: var(--signature-floor-top, 78%); bottom: 0; width: 100%; height: calc(100% - var(--signature-floor-top, 78%)); pointer-events: none; mix-blend-mode: screen; z-index: 2; }
/* ---------- Hand colours (one setting for notes, sheet, keys, legend) */
:root { --hand-left: #3fd6cc; --hand-right: #ffb24f; --hand-left-dark: #27857f; --hand-right-dark: #9e6e31; --hand-left-light: #e6fffb; --hand-right-light: #fff3d6; }
html.signature-player #piano .hand-left-on { background: linear-gradient(var(--hand-left-dark), var(--hand-left-light)) !important; }
html.signature-player #piano .hand-right-on { background: linear-gradient(var(--hand-right-dark), var(--hand-right-light)) !important; }
#handColorPicker { display: inline-flex; align-items: center; gap: 10px; margin-left: auto; white-space: nowrap; }
#handColorPicker .hc-swatch { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; font-size: 13px; }
#handColorPicker input[type=color] { width: 26px; height: 26px; padding: 0; border: 2px solid rgba(255,255,255,.55); border-radius: 50%; background: none; cursor: pointer; }
#handColorPicker input[type=color]::-webkit-color-swatch-wrapper { padding: 0; }
#handColorPicker input[type=color]::-webkit-color-swatch { border: none; border-radius: 50%; }
#handColorPicker select { max-width: 150px; }
/* ---------- Option C: night sheet music in Falling notes */
html.sheet-night body.falling-player #pianoStage .score-wrap { background: var(--signature-sheet-sky, linear-gradient(#040b10, #06151b)) top left / 100% 100% no-repeat, #040b10 !important; }
html.sheet-night body.falling-player #pianoStage .score-wrap * { scrollbar-color: #2b4a50 transparent; }
html.sheet-night body.falling-player .main-playhead { background: #fff1d6 !important; box-shadow: 0 0 12px rgba(255,230,190,.9), 0 0 2px #fff !important; opacity: .95 !important; width: 3px !important; }
#signatureSheetDim, #signatureSheetBeam { position: fixed; pointer-events: none; z-index: 25; display: none; }
#signatureSheetDim { background: rgba(5,14,19,.58); }
#signatureSheetBeam { background: linear-gradient(90deg, rgba(255,236,200,0), rgba(255,236,200,.13) 30%, rgba(255,236,200,0)); }
html.sheet-night body.falling-player #pianoStage #alphaTab { background: transparent !important; }
/* A fixed score band keeps every page turn above the same performance stage. */
html.signature-player #pianoStage { grid-template-rows: minmax(0, 32%) minmax(0, 1fr) !important; }
html.signature-player #pianoStage[data-sheet-hidden="true"] { grid-template-rows: 0 minmax(0, 1fr) !important; }
html.signature-player body.falling-player #pianoStage .score-wrap { overflow-y: hidden !important; }
/* No divider between the sheet music and the falling notes */
html.signature-player body.falling-player .score-wrap,
html.signature-player body.falling-player #pianoStage .score-wrap { border: 0 !important; border-radius: 0 !important; outline: 0 !important; box-shadow: none !important; }
html.signature-player body.falling-player #pianoStage #alphaTab,
html.signature-player body.falling-player #pianoStage #alphaTab > div { border: 0 !important; border-radius: 0 !important; outline: 0 !important; box-shadow: none !important; }
html.signature-player body:not(.creating-piano-video) #pianoStage { border: 0 !important; }
html.signature-player body.falling-player #pianoStage .instrument-view { border-top: 0 !important; }
/* the 3D hand engine's loading/status text is not shown in the Mac app */
html.signature-player #pianoHandsStatus { display: none !important; }
#sheetBarsSelect { max-width: 140px; }
html.sheet-night body.falling-player #pianoStage .score-wrap { overflow-x: hidden !important; }

/* Give the performance more room, with a balanced roll and hand viewport. */
html.signature-player #pianoStage #pianoHandsViewport { flex-basis: 46%; height: 46%; }
html.signature-player body.falling-player #fallingToolbar {
  background: linear-gradient(180deg, #142c32, #0c2027);
  padding: 9px 16px;
  border-bottom: 1px solid rgba(207,184,125,.16);
}
html.signature-player body.falling-player #fallingToolbar .btn {
  border-radius: 8px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.05);
}

.sheet-layout-control { display:inline-flex; align-items:center; gap:6px; font-size:13px; white-space:nowrap; }
html.sheet-night body.falling-player #pianoStage .score-wrap { overflow-x:auto !important; scrollbar-width:thin; }

/* Reading space: reserve a steady grand-staff band at a legible note size. */
html.signature-player #pianoStage { grid-template-rows:minmax(0, max(44%, 350px)) minmax(0, 1fr) !important; }
html.signature-player #pianoStage[data-sheet-hidden="true"] { grid-template-rows:0 minmax(0, 1fr) !important; }
@media (max-height:740px) {
  html.signature-player #pianoStage { grid-template-rows:minmax(0, 300px) minmax(0, 1fr) !important; }
}
html.signature-player body.falling-player #pianoStage .score-wrap { overflow-y:auto !important; }

/* On short windows, scroll the workspace instead of flattening the piano. */
html.signature-player body.falling-player #pianoStage { min-height:610px; }
@media (max-height:740px) {
  html.signature-player body.falling-player #pianoStage { min-height:540px; }
}

/* Match falling-note lanes to the gently wider 3D camera framing. */
html.signature-player body.falling-player #pianoStage:has(#pianoHandsViewport:not([hidden])) #fallingNotes {
  width:calc(100% / 1.06); align-self:center;
}

/* Final Concert blend: one black stage, with camera geometry independent of sheet visibility. */
html.signature-player body.falling-player #pianoStage {
  --concert-sheet-height:240px;
  display:grid!important;
  grid-template-rows:var(--concert-sheet-height) minmax(0,1fr)!important;
  min-height:calc(var(--concert-sheet-height) + var(--concert-hands-height,310px) + 220px)!important;
  background:#000!important;
}
html.signature-player body.falling-player #pianoStage[data-sheet-hidden="true"] {
  grid-template-rows:0 minmax(0,1fr)!important;
}
html.signature-player body.falling-player #pianoStage .score-wrap,
html.signature-player body.falling-player #pianoStage .instrument-view.show,
html.signature-player body.falling-player #pianoStage #pianoHandsViewport { background:#000!important; }
html.signature-player body.falling-player #pianoStage .score-wrap {overflow:auto!important;}
html.signature-player body.falling-player #pianoStage #pianoHandsViewport {
  height:var(--concert-hands-height,310px)!important;
  flex:0 0 var(--concert-hands-height,310px)!important;
}
html.signature-player body.falling-player #pianoStage:has(#pianoHandsViewport:not([hidden])) #fallingNotes {
  width:calc(100% / 1.015)!important;align-self:center;
}
html.signature-player body.falling-player #signatureSheetDim,
html.signature-player body.falling-player #signatureSheetBeam {display:none!important;}

/* Floating sheet: overlay the roll; reserve the keyboard independently. */
html.signature-player body.falling-player #pianoStage {
  position:relative!important;display:block!important;
  min-height:calc(var(--concert-hands-height,310px) + 300px)!important;
  height:var(--piano-stage-height,70vh)!important;
}
html.signature-player body.falling-player #pianoStage .instrument-view.show {
  position:absolute!important;inset:0!important;height:100%!important;
}
html.signature-player body.falling-player #pianoStage .score-wrap {
  position:absolute!important;top:12px!important;left:0!important;width:100%!important;
  height: min(330px, 48%)!important;z-index:5!important;
  background:linear-gradient(#000e 70%,#000a 90%,transparent)!important;
  overflow-x:auto!important;overflow-y:hidden!important;
}
html.signature-player body.falling-player #pianoStage:not([data-sheet-hidden="true"]) #fallingCanvas {
  mask-image:linear-gradient(to bottom,rgba(0,0,0,.08),rgba(0,0,0,.12) 45%,#000 78%);
}
html.signature-player body.falling-player #pianoStage[data-sheet-hidden="true"] #fallingCanvas {mask-image:none;}

/* Keep geometry stable on small and short viewports. */
html.signature-player body.falling-player #pianoStage {min-height:220px!important;max-width:100%;}
#scoreWrap,#instrumentView {position:relative;}
/* Copyright watermark: faint repeating mark across the whole score + a credit line that stays at the bottom. */
.signature-watermark-tile {position:absolute;left:0;top:0;right:0;z-index:6;pointer-events:none;user-select:none;background-repeat:repeat;background-size:420px 240px;}
.signature-credit {position:sticky;bottom:0;z-index:7;display:flex;flex-wrap:wrap;justify-content:center;gap:0 6px;padding:6px 10px;background:linear-gradient(to top,rgba(255,255,255,.96),rgba(255,255,255,.78));font:600 12px/1.35 Inter,system-ui,sans-serif;color:#355;letter-spacing:.02em;text-align:center;}
.signature-credit a {color:#0b6b73;text-decoration:none;}
.signature-credit a:hover {text-decoration:underline;}
body.is-admin:not(.public-player) .signature-watermark-tile,body.is-admin:not(.public-player) .signature-credit {display:none;}
body:not(.is-admin) #videoExportControls,body.public-player #videoExportControls {display:none!important;}
@media(max-width:800px){
 #fallingToolbar {gap:6px!important;padding:6px!important;flex-wrap:wrap!important;}
 #fallingToolbar button,#fallingToolbar select {font-size:12px!important;padding:6px!important;min-height:34px;}
 html.signature-player body.falling-player #pianoStage .score-wrap {height:min(270px,52%)!important;top:4px!important;}
 .controls {flex-wrap:wrap;gap:4px!important;max-width:100vw;box-sizing:border-box;}
 .controls button,.controls select {min-height:32px;font-size:12px;}
 #instrumentView, #pianoStage, #scoreWrap {min-width:0;max-width:100%;box-sizing:border-box;}
}
@media(max-height:540px){
 html.signature-player body.falling-player #pianoStage .score-wrap {height:54%!important;}
 #fallingToolbar {max-height:80px;overflow:auto;}
}

@media(max-width:800px){
 .topbar {overflow-x:auto!important;scrollbar-width:thin;}
 .controls .primary-actions,.controls .secondary-actions {max-width:100%;min-width:0;overflow-x:auto;flex-wrap:nowrap!important;scrollbar-width:thin;}
 .controls .primary-actions>*,.controls .secondary-actions>* {flex-shrink:0;}
}
