/* 音符修正弹窗 */

#note-editor {
  width: min(720px, calc(100vw - 28px));
  max-height: calc(100dvh - 40px);
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--card);
  color: var(--ink);
  box-shadow: var(--shadow-lg);
}
#note-editor::backdrop { background: rgba(24, 28, 27, .42); backdrop-filter: blur(3px); }
#note-editor h2 { font-size: 18px; font-weight: 700; letter-spacing: -.2px; }

.edit-heading-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.edit-heading-row h2 { margin: 0; }
#edit-add {
  display: inline-flex; align-items: center; gap: 6px; flex: none;
  min-height: 38px; padding: 0 14px; border-radius: 999px;
  border: 1px solid var(--line-strong); background: var(--card);
  color: var(--accent-ink); font-size: 13px; font-weight: 650;
}
#edit-add svg { width: 15px; height: 15px; }
#edit-add[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }

#edit-preview {
  position: relative; width: 100%; height: 320px; overflow: hidden;
  border: 1px solid var(--line); border-radius: 12px; background: #fff;
  margin-bottom: 12px; touch-action: none;
}
#edit-preview > svg.edit-preview-svg,
#edit-preview svg.definition-scale { display: block; width: 100%; height: 100%; }

.edit-note-ghost {
  position: absolute; z-index: 3; width: 18px; height: 13px; border-radius: 50%;
  background: rgba(22, 98, 79, .72); border: 2px solid var(--accent-ink);
  transform: translate(-50%, -50%) rotate(-17deg); pointer-events: none;
}
.edit-note-ghost::after {
  content: ""; position: absolute; width: 2px; height: 34px; right: -2px; bottom: 6px;
  background: var(--accent-ink); transform: rotate(17deg); transform-origin: bottom;
}
.edit-note-ghost[hidden] { display: none; }
#edit-preview .drag-source { opacity: .35; }

.edit-pitch-marker {
  position: absolute; width: 22px; height: 16px; border: 2px solid var(--accent); border-radius: 50%;
  background: rgba(22, 98, 79, .3); transform: translate(-50%, -50%); pointer-events: none;
}
.edit-inline-controls {
  position: absolute; z-index: 4; display: flex; gap: 3px; padding: 3px;
  background: rgba(255, 255, 255, .96); border: 1px solid var(--line-strong);
  border-radius: 10px; box-shadow: 0 6px 18px rgba(35, 39, 42, .16); white-space: nowrap;
}
.edit-inline-controls[hidden] { display: none; }
.edit-inline-controls button {
  min-width: 32px; min-height: 30px; padding: 0 7px; border-radius: 7px;
  border: 1px solid var(--line); background: var(--card); color: var(--ink-2);
  font-size: 12px; line-height: 1;
}
.edit-inline-controls button:hover { background: var(--paper); }
.edit-inline-controls button[data-edit-action="delete"] { color: var(--danger); border-color: #edcfc9; }

.edit-note-hits { position: absolute; inset: 0; pointer-events: none; }
.edit-note-hit { position: absolute; width: 34px; height: 34px; border-radius: 50%; pointer-events: auto; cursor: grab; touch-action: none; }
.edit-note-hit:active { cursor: grabbing; }

#edit-error { min-height: 18px; margin: 0 0 10px; font-size: 12px; color: var(--danger); }

.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }
.dialog-actions button {
  min-height: 42px; padding: 0 18px; border-radius: 999px;
  border: 1px solid var(--line-strong); background: var(--card);
  font-size: 14px; font-weight: 650; color: var(--ink-2);
}
.dialog-actions button:hover { background: var(--paper); }
.dialog-actions #edit-undo { margin-right: auto; display: inline-flex; align-items: center; gap: 6px; }
.dialog-actions #edit-undo svg { width: 15px; height: 15px; }
.dialog-actions .edit-confirm { background: var(--accent); border-color: var(--accent); color: #fff; }
.dialog-actions .edit-confirm:hover { background: var(--accent-ink); }
.dialog-actions button[type=submit] { background: var(--accent); border-color: var(--accent); color: #fff; }

@media (max-width: 640px) {
  #note-editor { padding: 16px; border-radius: 18px; }
  #edit-preview { height: 250px; }
  .edit-heading-row { flex-wrap: wrap; }
}
.beam-toolbar, .beam-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 10px 0; }
.beam-toolbar button, .beam-actions button { min-height: 44px; padding: 0 14px; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--card); color: var(--ink); }
.beam-toolbar button[aria-pressed="true"], #beam-connect:not(:disabled) { background: var(--accent); color: white; }
#edit-mode-hint, #beam-options p { font-size: 13px; color: var(--ink-2); }
#beam-options { padding: 10px 14px; margin-bottom: 10px; background: var(--paper); border-radius: 12px; }
#beam-options[hidden] { display: none; }
#beam-options p { margin: 0 0 10px; }
#beam-options label { display: flex; align-items: center; gap: 8px; min-height: 44px; }
#beam-count { margin-right: auto; }
.edit-note-hit.beam-selected { background: rgba(22,98,79,.16); outline: 2px solid var(--accent); }
.edit-note-hit.beam-selected::after { content: attr(data-order); position: absolute; right: -7px; top: -12px; background: var(--accent); color: #fff; font-size: 12px; min-width: 20px; height: 20px; text-align: center; line-height: 20px; border-radius: 50%; }
#note-editor .edit-inline-controls button { min-height: 44px; min-width: 44px; }

#edit-note-actions .edit-inline-controls { position: static; box-shadow: none; width: fit-content; margin: 0 0 10px; }
.edit-note-ghost::before { content: attr(data-pitch); position: absolute; bottom: 42px; left: -7px; transform: rotate(17deg); padding: 3px 7px; border-radius: 6px; font-size: 12px; background: var(--accent); color: #fff; white-space: nowrap; }

#note-editor { overflow-y: auto; overscroll-behavior: contain; }
#edit-preview { height: clamp(230px, 43dvh, 420px); flex-shrink: 0; }
#note-editor .dialog-actions { position: sticky; bottom: -20px; padding: 12px 0; background: var(--card); z-index: 5; }
#edit-symbols { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
#edit-symbols button, .accidental-actions select { min-height: 40px; border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; background: var(--card); }
.edit-inline-controls { flex-wrap: wrap; white-space: normal; }
.accidental-actions { display: flex; flex-wrap: wrap; gap: 4px; }
