/* 识别排版层：Verovio SVG + 交互热区 */

#recognized-sheet {
  position: relative;
  width: 100%;
  /* Lean padding: the sheet is meant to own the left half of the screen. */
  padding: 20px clamp(12px, 1.6vw, 26px) 30px;
  background: #fff;
  box-shadow: 0 1px 3px rgba(35, 39, 42, .08), 0 12px 32px rgba(35, 39, 42, .08);
  /* One finger always selects; two fingers pan. Handling both here keeps a
     selection drag from being stolen by the browser's scroll gesture. */
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
#recognized-sheet[hidden] { display: none !important; }
#recognized-sheet svg { display: block; width: 100%; height: auto; }

#score-overlay { position: absolute; left: 0; top: 0; pointer-events: auto; }

.score-selection-band {
  position: absolute;
  background: rgba(22, 98, 79, .1);
  border: 0;
  pointer-events: none;
}
.score-measure-hit {
  position: absolute;
  border: 2px solid transparent;
  border-radius: 4px;
  background: transparent;
  pointer-events: auto;
  touch-action: none;
  transition: background-color .12s, border-color .12s;
}
.score-measure-hit:hover { background: rgba(22, 98, 79, .07); border-color: rgba(22, 98, 79, .28); }
.score-measure-hit.selected { background: transparent; border-color: transparent; }
.score-measure-hit.playing { background: rgba(192, 138, 46, .18); border-color: var(--gold); }

.score-note-hit {
  position: absolute; width: 30px; height: 30px; border-radius: 50%;
  pointer-events: auto; cursor: pointer; touch-action: none;
}
.score-note-hit:hover { background: rgba(22, 98, 79, .1); }

#recognized-sheet .note { cursor: pointer; }
#recognized-sheet .note.playing-note .notehead use { fill: #cf8a3c; }
#recognized-sheet .note.playing-note .stem path { stroke: #cf8a3c; }

.score-measure-error { position: absolute; border: 2px solid #c96942; background: rgba(201, 105, 66, .07); border-radius: 4px; }
.score-measure-error span {
  position: absolute; right: 0; top: 0; padding: 3px 6px; white-space: nowrap;
  background: #b4552f; color: #fff; font-size: 10px; font-weight: 700; line-height: 1.2;
  border-radius: 0 2px 0 6px;
}
.score-note-review { position: absolute; width: 28px; height: 28px; border-radius: 50%; border: 2px solid #c96942; background: rgba(201, 105, 66, .18); pointer-events: none; }

.sheet-error { padding: 32px 24px; font-size: 13px; line-height: 1.6; color: var(--danger); }

/* 全屏谱面：iPad Safari 没有元素级 Fullscreen API，用覆盖层模拟 */
.sheet-panel.expanded {
  position: fixed; inset: 0; z-index: 80;
  background: var(--paper-2); overflow: hidden;
  height: 100dvh; display: flex; flex-direction: column;
}
.sheet-panel.expanded .score-view { height: auto; flex: 1; }
.sheet-panel.expanded .score-view > #recognized-sheet,
.sheet-panel.expanded .score-view > #score-sheet { margin: 16px auto; }
/* Landscape iPads have room for the score to be wider than the panel; in
   full screen let it use the whole viewport. */
.sheet-panel.expanded .score-view > #recognized-sheet { max-width: calc(100% - 32px); }
.sheet-panel:fullscreen { background: var(--paper-2); overflow: hidden; height: 100dvh; display: flex; flex-direction: column; }
.sheet-panel:fullscreen .score-view { height: auto; flex: 1; }
.exit-fullscreen {
  position: absolute; z-index: 6;
  right: max(16px, env(safe-area-inset-right));
  top: calc(16px + env(safe-area-inset-top));
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 38px; padding: 0 14px 0 11px; border-radius: 999px;
  background: rgba(255, 253, 250, .94); border: 1px solid var(--line-strong);
  color: var(--ink-2); font-size: 12.5px; font-weight: 650;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 2px 10px rgba(35, 39, 42, .12);
}
.exit-fullscreen svg { width: 16px; height: 16px; }
#recognized-sheet, #recognized-sheet .score-measure-hit, #recognized-sheet .score-note-hit { touch-action: pan-y pinch-zoom; }
#recognized-sheet.touch-selecting, #recognized-sheet.touch-selecting .score-measure-hit, #recognized-sheet.touch-selecting .score-note-hit { touch-action: none; }
