.annotation-editor {
  min-width: 0;
  min-height: 0;
  grid-row: 2;
  padding: 12px;
  overflow: hidden;
  background: radial-gradient(circle at 45% 12%, #2b2924 0%, #111316 68%);
}
.annotation-editor[hidden] { display: none; }
.stage.annotation-editing .stage-header,
.stage.annotation-editing .viewer-shell,
.stage.annotation-editing .page-status,
.stage.annotation-editing .score-editor { display: none !important; }
.stage.annotation-editing { grid-template-rows: minmax(0, 1fr); }
.stage.annotation-editing .annotation-editor { grid-row: 1; }
.annotation-editor-shell {
  width: 100%;
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid #3b3f45;
  border-radius: 16px;
  background: #15171a;
  box-shadow: 0 20px 55px #000a;
}
.annotation-editor-header {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 16px;
  border-bottom: 1px solid #30343a;
  background: #202329;
}
.annotation-editor-heading { min-width: 0; }
.annotation-editor-heading small,
.annotation-card small { color: var(--accent); font-size: 8px; font-weight: 850; letter-spacing: 1px; text-transform: uppercase; }
.annotation-editor-heading h2 { margin: 3px 0 0; overflow: hidden; font-size: 20px; text-overflow: ellipsis; white-space: nowrap; }
.annotation-editor-heading p { margin: 3px 0 0; color: var(--muted); font-size: 9px; }
.annotation-editor-header-actions { flex: 0 0 auto; display: flex; align-items: center; gap: 8px; }
.annotation-icon-button {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid #4b4f56;
  border-radius: 10px;
  background: #272a2f;
  color: #d8d4cc;
  cursor: pointer;
}
.annotation-icon-button.primary { border-color: #80612e; background: #3b301d; color: #f1cb7f; }
.annotation-icon-button svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.annotation-icon-button:active { transform: scale(.96); }
.annotation-editor-launch { background: #252a2f; border-color: #495058; color: #e7e2d8; }
.annotation-editor-launch:hover { border-color: #8a6a32; color: #f1cb7f; }

.annotation-editor-content {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(330px, 31vw, 430px);
  overflow: hidden;
}
.annotation-document-panel { min-width: 0; min-height: 0; display: grid; grid-template-rows: auto minmax(0, 1fr); background: #0e1012; }
.annotation-document-toolbar {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 5px 12px;
  border-bottom: 1px solid #292d31;
  background: #17191c;
}
.annotation-document-toolbar strong { min-width: 58px; color: #ded9d0; font-size: 10px; text-align: center; }
.annotation-document-toolbar > span { margin-left: auto; color: #7dc3aa; font-size: 8px; }
.annotation-document-toolbar > span.dirty { color: #efc777; }
.annotation-document-toolbar > span.error { color: #e39088; }
.annotation-tool-button {
  width: 32px;
  height: 30px;
  display: grid;
  place-items: center;
  padding: 0 0 2px;
  border: 1px solid #3d4147;
  border-radius: 8px;
  background: #24272c;
  color: #eee9e0;
  font-size: 21px;
  cursor: pointer;
}
.annotation-tool-button:disabled { opacity: .32; cursor: default; }
.annotation-document-scroller {
  min-width: 0;
  min-height: 0;
  display: grid;
  place-items: center;
  overflow: auto;
  padding: 20px;
  background: radial-gradient(circle at center, #2c3035, #0e1012 72%);
  scrollbar-color: #53575d transparent;
  touch-action: pan-y pinch-zoom;
}
.annotation-page-surface {
  position: relative;
  width: min(100%, 920px);
  min-width: 240px;
  overflow: hidden;
  background: #f5f0e6;
  box-shadow: 0 18px 44px #000c;
  touch-action: pan-y pinch-zoom;
  user-select: none;
}
.annotation-page-surface.placing { cursor: default; }
.annotation-page-surface.selecting { cursor: crosshair; touch-action: none; }
/* The inactive PDF/image renderer must not consume a full page before the
   active source. Author display:block otherwise overrides the hidden attribute. */
.annotation-page-surface > canvas:not([hidden]),
.annotation-page-surface > img:not([hidden]) { width: 100%; height: 100%; display: block; object-fit: contain; pointer-events: none; }
.annotation-page-surface > canvas[hidden],
.annotation-page-surface > img[hidden] { display: none; }
.annotation-layer { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
.annotation-selection-marquee {
  position: absolute;
  z-index: 3;
  border: 2px solid #d7a44a;
  border-radius: 4px;
  background: #d7a44a24;
  box-shadow: 0 0 0 1px #15120b99, inset 0 0 0 1px #fff2;
  pointer-events: none;
}
.annotation-selection-marquee[hidden] { display: none; }
.annotation-chord {
  position: absolute;
  z-index: 2;
  display: block;
  padding: 2px 4px;
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  font-weight: 850;
  line-height: 1;
  white-space: nowrap;
  transform: translate(-50%, -50%);
  pointer-events: auto;
  cursor: grab;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  text-shadow: 0 1px 1px #fff8;
}
.annotation-chord[data-size="s"] { font-size: clamp(12px, 1.35vw, 18px); }
.annotation-chord[data-size="m"] { font-size: clamp(16px, 1.8vw, 24px); }
.annotation-chord[data-size="l"] { font-size: clamp(20px, 2.35vw, 31px); }
.annotation-chord[data-size="xl"] { font-size: clamp(25px, 3vw, 40px); }
.annotation-chord[data-color="black"] { color: #08090a; }
.annotation-chord[data-color="red"] { color: #b31e24; text-shadow: 0 1px 1px #fff; }
.annotation-chord[data-color="white"] { color: #fff; text-shadow: 0 1px 3px #000, 0 0 2px #000; }
.annotation-chord.selected { border-color: #d7a44a; background: #d7a44a26; box-shadow: 0 0 0 2px #10121499; cursor: grabbing; }
.annotation-chord.row-linked::after { content: ""; position: absolute; left: 50%; bottom: -5px; width: 4px; height: 4px; border-radius: 50%; background: #d7a44a; transform: translateX(-50%); }
.annotation-loading { position: absolute; inset: 0; z-index: 4; display: grid; place-items: center; padding: 20px; background: #f3eee5; color: #292722; font-size: 15px; font-weight: 750; text-align: center; }
.annotation-loading[hidden] { display: none; }

.annotation-tool-panel { min-width: 0; min-height: 0; display: grid; grid-template-rows: auto minmax(0, 1fr); overflow: hidden; border-left: 1px solid #30343a; background: linear-gradient(180deg, #1b1e22, #141619); }
.annotation-tabs { display: grid; grid-template-columns: .85fr 1.25fr 1fr; gap: 4px; padding: 8px; border-bottom: 1px solid #2f3338; }
.annotation-tabs button { min-width: 0; min-height: 38px; padding: 5px 7px; border: 1px solid transparent; border-radius: 8px; background: transparent; color: #92979f; font-size: 9px; font-weight: 780; cursor: pointer; }
.annotation-tabs button.active { border-color: #8a682e; background: #3d301b; color: #f0ca7b; }
.annotation-tab-panel { min-height: 0; overflow-y: auto; padding: 10px; scrollbar-color: #4b4f55 transparent; }
.annotation-tab-panel[hidden] { display: none; }
.annotation-control-row { display: grid; gap: 7px; }
.annotation-control-row-top { grid-template-columns: 1fr 1.35fr; }
.annotation-segmented { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 3px; padding: 3px; border: 1px solid #33373d; border-radius: 9px; background: #111316; }
.annotation-segmented button { min-height: 30px; padding: 4px 7px; border: 0; border-radius: 6px; background: transparent; color: #8f949c; font-size: 9px; font-weight: 760; cursor: pointer; }
.annotation-segmented button.active { background: #d7a44a; color: #19140c; }
.annotation-card { margin-top: 9px; padding: 10px; border: 1px solid #34383e; border-radius: 10px; background: #1c1f23; }
.chord-current-card { display: grid; grid-template-columns: minmax(92px, .72fr) minmax(0, 1.28fr); align-items: stretch; gap: 10px; }
.chord-current-card strong { display: block; margin-top: 3px; color: #f0c979; font-size: 24px; }
.chord-current-card p { margin: 4px 0 0; color: var(--muted); font-size: 7px; line-height: 1.35; }
.annotation-current-chord-summary { min-width: 0; display: flex; flex-direction: column; justify-content: center; }
.annotation-current-chord-summary [hidden] { display: none; }
.chord-current-card.selection-active { grid-template-columns: minmax(0, 1fr); }
.chord-current-card.selection-active #annotationCurrentChordLabel {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0;
  line-height: 1.45;
  text-transform: none;
}
.annotation-current-selection { min-width: 0; display: grid; align-content: center; gap: 6px; padding-left: 10px; border-left: 1px solid #34383e; }
.chord-current-card.selection-active .annotation-current-selection { padding: 8px 0 0; border-left: 0; border-top: 1px solid #34383e; }
.annotation-current-selection > small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.annotation-current-selection .annotation-action-grid button { min-height: 27px; }
#annotationClipboardCopy, #annotationPaste { white-space: normal; line-height: 1.25; }
.annotation-chord-palette { display: grid; gap: 7px; margin-top: 9px; }
.annotation-palette-group { display: grid; grid-template-columns: 45px minmax(0, 1fr); gap: 6px; align-items: stretch; }
.annotation-palette-group > strong { display: grid; place-items: center; border: 1px solid #3a3e44; border-radius: 7px; background: #1b1e22; color: #a9adb4; font-size: 8px; }
.annotation-palette-buttons { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 4px; }
.annotation-palette-buttons button,
.annotation-pro-options button { min-width: 0; min-height: 31px; padding: 3px; border: 1px solid #3a3e44; border-radius: 7px; background: #24272c; color: #e4dfd6; font-size: 9px; font-weight: 760; cursor: pointer; }
.annotation-palette-buttons button.active,
.annotation-pro-options button.active { border-color: #a97e37; background: #44351e; color: #ffd88c; box-shadow: inset 0 0 0 1px #d7a44a33; }
.annotation-pro-builder { display: grid; gap: 7px; margin-top: 9px; }
.annotation-chord-palette[hidden],
.annotation-pro-builder[hidden] { display: none; }
.annotation-pro-group { padding: 8px; border: 1px solid #34383e; border-radius: 9px; background: #191c20; }
.annotation-pro-group h3 { margin: 0 0 6px; color: #999ea6; font-size: 8px; letter-spacing: .65px; text-transform: uppercase; }
.annotation-pro-options { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; }
.annotation-format-grid { display: grid; grid-template-columns: 1.25fr .75fr; gap: 8px; }
.annotation-size-options,
.annotation-color-options { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; }
.annotation-size-options button,
.annotation-color-options button,
.annotation-action-grid button,
.annotation-transpose-controls button { min-height: 31px; padding: 3px 6px; border: 1px solid #3d4147; border-radius: 7px; background: #25282d; color: #cfcac1; font-size: 8px; font-weight: 750; cursor: pointer; }
.annotation-size-options button.active,
.annotation-color-options button.active { border-color: #9b7332; background: #40321c; color: #f2ce86; }
.annotation-color-options i { width: 15px; height: 15px; display: block; margin: auto; border: 1px solid #777; border-radius: 50%; }
.annotation-color-options i.black { background: #08090a; }
.annotation-color-options i.red { background: #b31e24; }
.annotation-color-options i.white { background: #fff; }
.annotation-card-heading { margin-bottom: 7px; }
.annotation-action-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; }
.annotation-action-grid.three { grid-template-columns: repeat(3, 1fr); }
.annotation-action-grid button:disabled { opacity: .32; cursor: default; }
.annotation-action-grid button.active { border-color: #986f30; background: #3d301c; color: #f1ca79; }
.annotation-transpose-card > div:first-child { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.annotation-transpose-card strong { color: #f0c979; font-size: 18px; }
.annotation-transpose-controls { display: grid; grid-template-columns: 42px 1fr 42px; gap: 5px; margin-top: 8px; }
.annotation-transpose-controls button:first-child,
.annotation-transpose-controls button:last-child { font-size: 18px; }
.annotation-placeholder { display: grid; align-content: center; justify-items: center; gap: 8px; padding: 28px; color: #d7d2c9; text-align: center; }
.annotation-placeholder strong { color: #efc777; font-size: 16px; }
.annotation-placeholder p { max-width: 290px; margin: 0; color: var(--muted); font-size: 10px; line-height: 1.55; }

@media (max-width: 1050px) {
  .annotation-editor { padding: 7px; }
  .annotation-editor-content { grid-template-columns: minmax(0, 1fr) minmax(305px, 38vw); }
  .annotation-editor-header { min-height: 62px; padding: 8px 10px; }
  .annotation-editor-heading h2 { font-size: 16px; }
  .annotation-editor-heading p { display: none; }
  .annotation-document-scroller { padding: 10px; }
  .annotation-palette-buttons { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}

@media (orientation: portrait), (max-width: 760px) {
  .annotation-editor { overflow-y: auto; padding: 5px; }
  .annotation-editor-shell { height: auto; min-height: 100%; overflow: visible; border-radius: 11px; }
  .annotation-editor-header { position: sticky; top: 0; z-index: 8; }
  .annotation-editor-heading small, .annotation-editor-heading p { display: none; }
  .annotation-editor-header-actions .navigation-back b { display: none; }
  .annotation-editor-content { display: block; overflow: visible; }
  .annotation-document-panel { height: 62vh; min-height: 430px; }
  .annotation-tool-panel { min-height: 530px; border-top: 1px solid #30343a; border-left: 0; }
  .annotation-page-surface { width: min(100%, 680px); }
  .annotation-tabs { position: sticky; top: 62px; z-index: 7; background: #1b1e22; }
  .annotation-tab-panel { overflow: visible; }
}

/* Editor2: the established Band-IT library column becomes the editor panel. */
.app.annotation-editing .library {
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  min-width: 320px;
  visibility: visible;
  max-height: none;
}
.app.annotation-editing .library > :not(.annotation-library-panel) {
  display: none !important;
}
.annotation-library-panel {
  min-width: 0;
  min-height: 0;
  height: 100%;
  display: grid;
  /* Long score titles must fit this column instead of widening its auto track. */
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto auto auto minmax(0, 1fr);
  overflow: hidden;
  background: linear-gradient(180deg, #181a1e 0%, #121417 100%);
}
.annotation-library-panel[hidden] { display: none; }
.annotation-panel-header {
  min-width: 0;
  min-height: 78px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px 10px 16px;
  border-bottom: 1px solid var(--line);
  background: #181a1e;
}
.annotation-panel-heading { flex: 1 1 0%; min-width: 0; overflow: hidden; }
.annotation-panel-heading small {
  color: var(--accent);
  font-size: 7px;
  font-weight: 850;
  letter-spacing: .9px;
  text-transform: uppercase;
}
.annotation-panel-heading h2 {
  margin: 3px 0 0;
  overflow: hidden;
  font-size: 18px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.annotation-panel-heading p {
  margin: 3px 0 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 8px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.annotation-panel-header-actions {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 5px;
}
.annotation-panel-header-actions .annotation-icon-button {
  width: 34px;
  height: 34px;
  border-radius: 9px;
}
.annotation-panel-header-actions .annotation-icon-button svg { width: 17px; height: 17px; }
.annotation-panel-toolbar {
  min-height: 48px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px;
  padding: 6px 10px;
  border-bottom: 1px solid var(--line);
  background: #141619;
}
.annotation-page-controls { display: flex; align-items: center; gap: 5px; }
.annotation-page-controls strong {
  min-width: 48px;
  color: #ded9d0;
  font-size: 9px;
  text-align: center;
}
.annotation-panel-toolbar > span {
  min-width: 0;
  overflow: hidden;
  color: #7dc3aa;
  font-size: 7px;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.annotation-panel-toolbar > span.dirty { color: #efc777; }
.annotation-panel-toolbar > span.error { color: #e39088; }
.annotation-view-switch {
  display: grid;
  grid-template-columns: repeat(2, 32px);
  gap: 4px;
}
.annotation-view-switch button,
.annotation-anchor-toggle,
.annotation-placement-actions > button {
  min-width: 0;
  height: 32px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid #3d4147;
  border-radius: 8px;
  background: #24272c;
  color: #a8adb5;
  cursor: pointer;
}
.annotation-view-switch button.active,
.annotation-anchor-toggle[aria-pressed="true"] {
  border-color: #80612e;
  background: #3b301d;
  color: #f1cb7f;
  box-shadow: inset 0 0 0 1px #d7a44a22;
}
.annotation-view-switch svg,
.annotation-anchor-toggle svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.annotation-library-panel .annotation-tabs {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  padding: 8px 10px 7px;
  border-bottom: 1px solid var(--line);
}
.annotation-library-panel .annotation-tabs button {
  height: 35px;
  min-height: 35px;
  border: 0;
  border-radius: 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}
.annotation-library-panel .annotation-tabs button.active {
  border: 0;
  background: var(--accent);
  color: #1b160d;
  box-shadow: 0 4px 16px #d7a44a20;
}
.annotation-panel-body {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
}
.annotation-chord-fixed {
  grid-row: 1;
  min-width: 0;
  padding: 7px 10px 8px;
  border-bottom: 1px solid var(--line);
  background: #17191c;
}
.annotation-chord-fixed[hidden] { display: none; }
.annotation-panel-body > .annotation-tab-panel {
  grid-row: 2;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 7px 10px 16px;
  scrollbar-color: #4b4f55 transparent;
}
.annotation-panel-body > .annotation-placeholder {
  grid-row: 1 / 3;
}
.annotation-control-row-top { min-height: 38px; grid-template-columns: minmax(70px, 1fr) 60px auto; align-items: stretch; gap: 4px; }
.annotation-control-row-top .annotation-segmented { height: 38px; }
.annotation-control-row-top .annotation-segmented button { min-width: 0; padding-inline: 3px; }
.annotation-history-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; }
.annotation-history-actions .annotation-icon-button { width: 100%; height: 38px; border-radius: 8px; }
.annotation-history-actions .annotation-icon-button svg { width: 17px; height: 17px; }
.annotation-history-actions .annotation-icon-button:disabled { opacity: .32; cursor: default; }
.annotation-placement-actions { display: grid; grid-template-columns: 32px 46px 60px; align-items: stretch; gap: 4px; }
.annotation-placement-actions > button {
  height: 38px;
}
#annotationNewRow,
#annotationMeasureCount {
  padding: 0 3px;
  color: #cfcac1;
  font-size: 8px;
  font-weight: 750;
}
#annotationMeasureCount:disabled {
  border-color: #34383d;
  background: #1e2125;
  color: #777c84;
  cursor: default;
  opacity: 1;
}
.annotation-chord-fixed .chord-current-card { margin-top: 7px; }
.annotation-action-grid.four { grid-template-columns: repeat(2, 1fr); }
.annotation-layer-actions button.danger {
  border-color: #75453f;
  background: #35211f;
  color: #efaaa2;
}

/* The stage remains the document canvas; no second editor card is introduced. */
.stage.annotation-editing {
  grid-template-rows: minmax(0, 1fr);
}
.stage.annotation-editing .stage-header,
.stage.annotation-editing .viewer-shell,
.stage.annotation-editing .page-status,
.stage.annotation-editing .score-editor { display: none !important; }
.stage.annotation-editing .annotation-editor {
  grid-row: 1;
  padding: 0;
  background: radial-gradient(circle at 50% 35%, #282b30 0%, #121417 72%);
}
.stage.annotation-editing .annotation-editor-shell {
  height: 100%;
  display: block;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
.stage.annotation-editing .annotation-document-panel { height: 100%; grid-template-rows: minmax(0, 1fr); }
.annotation-document-scroller {
  place-items: center;
  padding: 16px;
  overflow: hidden;
}
.annotation-document-scroller.view-width {
  place-items: start center;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 14px 26px 70px;
}
.annotation-page-surface { width: auto; max-width: none; max-height: none; }

/* Editor2 size scale: old S/M/L become the new M/L/XL. */
.annotation-chord[data-size="s"] { font-size: clamp(9px, 1.02vw, 14px); }
.annotation-chord[data-size="m"] { font-size: clamp(12px, 1.35vw, 18px); }
.annotation-chord[data-size="l"] { font-size: clamp(16px, 1.8vw, 24px); }
.annotation-chord[data-size="xl"] { font-size: clamp(20px, 2.35vw, 31px); }
.annotation-chord.selected {
  border-color: #d7a44a;
  background: #d7a44a26;
  box-shadow: 0 0 0 2px #10121499;
  cursor: grab;
}

@media (max-width: 1050px) {
  .annotation-panel-heading h2 { font-size: 15px; }
  .annotation-panel-heading small,
  .annotation-panel-heading p { display: none; }
  .annotation-panel-header { min-height: 62px; padding: 8px 7px 8px 10px; }
  .annotation-panel-header-actions .annotation-icon-button { width: 31px; height: 31px; }
  .annotation-panel-toolbar { gap: 4px; padding-inline: 7px; }
  .annotation-panel-toolbar > span { font-size: 6px; }
}

@media (orientation: portrait), (max-width: 760px) {
  .app.annotation-editing { display: flex; }
  .app.annotation-editing .library {
    position: relative;
    inset: auto;
    width: min(44vw, 390px);
    min-width: 320px;
    height: 100%;
    transform: none;
  }
  .stage.annotation-editing { display: grid; height: 100%; }
  .stage.annotation-editing .annotation-editor { overflow: hidden; padding: 0; }
  .stage.annotation-editing .annotation-editor-shell { min-height: 0; overflow: hidden; }
  .stage.annotation-editing .annotation-document-panel { height: 100%; min-height: 0; }
  .annotation-library-panel .annotation-tabs { position: static; }
  .annotation-panel-body > .annotation-tab-panel { overflow-y: auto; }
  .annotation-document-scroller { padding: 8px; }
  .annotation-document-scroller.view-width { padding: 8px 12px 56px; }
}

.annotation-layer-actions > .secondary-action { width: 100%; min-width: 0; margin-bottom: 8px; font-size: 9px; }

/* v0-19: timing preparation shares the score, with its own independent rows. */
.annotation-tabs { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.timing-fixed { min-width: 0; padding: 10px; border-bottom: 1px solid #363b41; }
.timing-fixed[hidden], .timing-panel[hidden], .timing-layer[hidden], .timing-marquee[hidden], #timingRowFields[hidden] { display: none; }
.timing-toolbar { display: grid; grid-template-columns: minmax(0,1fr) 40px 40px; gap: 6px; }
.timing-fixed button, .timing-panel button { min-height: 36px; border: 1px solid #444a51; border-radius: 8px; padding: 6px 9px; background: #272b30; color: #ece7dd; font: 650 12px system-ui; cursor: pointer; }
.timing-fixed button:disabled, .timing-panel button:disabled { opacity: .35; cursor: default; }
.timing-fixed button.active, .timing-panel button.active { background: #d4a344; border-color: #d4a344; color: #21190c; }
.timing-fixed button.danger, .timing-panel button.danger { color: #efb0a7; border-color: #77504a; }
.timing-fixed .annotation-icon-button { width: 40px; height: 38px; }
.timing-fixed label, .timing-panel label { display: grid; gap: 5px; min-width: 0; color: #bfc3c8; font: 600 11px system-ui; }
.timing-fixed input, .timing-panel input, .timing-panel select { box-sizing: border-box; min-width: 0; width: 100%; min-height: 36px; border: 1px solid #50565f; border-radius: 7px; background: #171a1e; color: #f0ebe0; padding: 7px; font: 500 13px system-ui; }
.timing-fixed input:focus, .timing-panel input:focus, .timing-panel select:focus { outline: 2px solid #d4a344; outline-offset: 1px; }
.timing-hint { color: #acb3ba; font: 11px/1.5 system-ui; margin: 9px 0; }
.timing-field-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 9px; margin-top: 9px; }
.timing-row-actions { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 5px; margin-top: 10px; }
.timing-row-actions button { font-size: 10px; padding: 5px 2px; }
.timing-range { display: grid; gap: 5px; align-content: center; font: 11px system-ui; color: #bfc3c8; }
.timing-range strong { font-size: 21px; color: #edc46e; }
#timingRowFields { margin-top: 8px; }
#timingSaveStatus { display: block; margin-top: 9px; color: #86c9ae; font: 10px/1.4 system-ui; }
#timingSaveStatus.error { color: #f0a297; }
#timingTotals { color: #aeb5bd; font-size: 10px; }
#timingRows { display: grid; gap: 6px; margin-top: 9px; }
.timing-list-row { min-width: 0; display: grid; gap: 4px; text-align: left; }
.timing-list-row strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.timing-list-row span { font-size: 10px; opacity: .8; }
.timing-panel .annotation-card { margin-bottom: 10px; }
.timing-layer { position: absolute; inset: 0; z-index: 3; pointer-events: none; }
.timing-row-box { position: absolute; box-sizing: border-box; border: 1px solid #258b89; background: #36a5a514; pointer-events: auto; }
.timing-row-box.selected { border: 2px solid #b7790e; background: #dcae3d24; }
.timing-row-label { position: absolute; top: 0; left: 0; z-index: 2; border: 0; padding: 2px 5px; color: #fff; background: #176a6b; font: 700 11px system-ui; cursor: pointer; }
.timing-row-box.selected .timing-row-label { background: #926116; }
.timing-measure-label { position: absolute; top: 2px; transform: translateX(-50%); color: #174849; background: #ffffffe6; border-radius: 3px; padding: 1px 3px; font: 700 10px system-ui; pointer-events: none; }
.timing-boundary { position: absolute; top: 0; width: 24px; height: 100%; min-height: 24px; padding: 0; border: 0; transform: translateX(-50%); background: transparent; cursor: ew-resize; touch-action: none; }
.timing-boundary span { position: absolute; inset: 0 auto 0 50%; border-left: 1px dashed #176a6b; pointer-events: none; }
.timing-row-box.selected .timing-boundary span { border-left: 2px solid #b7790e; }
.timing-boundary:focus-visible { outline: 2px solid #136870; }
.timing-corner { position: absolute; z-index: 4; width: 24px; height: 24px; padding: 0; border: 0; background: transparent; touch-action: none; }
.timing-corner::after { content: ''; position: absolute; inset: 7px; border: 1px solid #fff; background: #926116; border-radius: 2px; }
.timing-corner.nw { left: 0; top: 0; transform: translate(-50%,-50%); cursor: nwse-resize; }
.timing-corner.ne { right: 0; top: 0; transform: translate(50%,-50%); cursor: nesw-resize; }
.timing-corner.sw { left: 0; bottom: 0; transform: translate(-50%,50%); cursor: nesw-resize; }
.timing-corner.se { right: 0; bottom: 0; transform: translate(50%,50%); cursor: nwse-resize; }
.timing-move { position: absolute; top: 0; left: 50%; z-index: 4; transform: translate(-50%,-45%); width: 34px; height: 24px; border: 1px solid #fff; border-radius: 5px; color: #fff; background: #926116; font-size: 16px; cursor: move; touch-action: none; }
.annotation-page-surface.timing-active { cursor: default; }
.annotation-page-surface.timing-drawing { cursor: crosshair; touch-action: none; }
.annotation-page-surface.timing-drawing .timing-row-box { pointer-events: none; }
.annotation-page-surface.timing-active .annotation-chord { cursor: pointer; }
.timing-marquee { position: absolute; z-index: 5; border: 2px solid #b7790e; background: #dcae3d33; pointer-events: none; }
@media (pointer: coarse) { .timing-corner { width: 34px; height: 34px; } .timing-boundary { width: 32px; } }
@media (max-height: 650px) { .timing-fixed { padding: 7px; } .timing-fixed > .timing-hint { margin: 5px 0; font-size: 10px; } .timing-fixed .annotation-card { padding: 8px; } }

/* v0-20: explicit musical events and one-row audition. */
.annotation-page-surface.timing-active .annotation-layer { z-index: 4; }
.annotation-chord.timing-chord-selected { outline: 2px solid #b7790e; outline-offset: 2px; }
.annotation-chord.timing-chord-playing { background: #f5ca55; color: #172b25; border-color: #176a6b; box-shadow: 0 0 0 3px #176a6b; }
.timing-row-box.timing-playing { border-color: #138d65; background: #22b58224; }
.timing-playhead { position: absolute; z-index: 6; width: 3px; transform: translateX(-50%); background: #b32829; box-shadow: 0 0 0 1px #fff9; pointer-events: none; }
.timing-playhead::before { content: ''; position: absolute; top: -5px; left: -4px; border: 5px solid transparent; border-top-color: #b32829; }
.timing-playhead[hidden], #timingEventFields[hidden] { display: none; }
.timing-preview-actions { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 6px; margin-top: 9px; }
.timing-preview-actions #timingPreviewStart { color: #1b231b; background: #d4a344; }
.timing-preview-status { min-height: 2.7em; margin-top: 6px; color: #e4c784; font: 600 11px/1.35 system-ui; overflow-wrap: anywhere; }
.timing-event-actions { display: grid; gap: 6px; margin: 9px 0; }
.timing-event-actions button { width: 100%; }
.timing-events { display: grid; gap: 5px; max-height: 220px; overflow-y: auto; }
.timing-fraction-label { margin-top: 9px; }
#timingEventCount { color: #aeb5bd; font-size: 10px; }
@media (max-height: 750px) { .timing-fixed .timing-current { padding: 8px; } .timing-fixed .timing-field-grid { margin-top: 5px; } .timing-fixed #timingSaveStatus { margin-top: 4px; } .timing-preview-status { min-height: 1.35em; } }

#timingRowCard[hidden] { display: none; }
#timingSelectionLabel { display: block; overflow-wrap: anywhere; }
#timingSelectionLabel { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* v0-22: source layout helpers and musical repeat marks. */
.annotation-library-panel .annotation-tabs { grid-template-columns: 1fr 1fr 1.45fr 1.35fr; align-items: stretch; }
.annotation-library-panel .annotation-tabs button { display: flex; align-items: center; justify-content: center; box-sizing: border-box; height: auto; min-height: 40px; padding: 8px 4px; font-size: clamp(10px,1vw,14px); line-height: 1.25; text-align: center; white-space: normal; }
.annotation-page-surface, [data-live-score-page] { container-type: inline-size; }
.annotation-chord.source-aligned, .live-annotation-chord.source-aligned { transform: translate(-50%,-100%); padding: 0; line-height: 1.05; border-color: transparent; }
.source-aligned[data-size="s"] { font-size: 1.512cqw; }
.source-aligned[data-size="m"] { font-size: 2.016cqw; }
.source-aligned[data-size="l"] { font-size: 2.646cqw; }
.source-aligned[data-size="xl"] { font-size: 3.402cqw; }
.annotation-chord.chord-ghost { pointer-events: none; opacity: .48; z-index: 5; }
.chord-ghost[hidden] { display: none; }
.source-controls label, .music-panel label { display: grid; gap: 5px; font-size: 12px; color: #c7cbd1; }
.source-controls > label { display: flex; align-items: center; }
.source-controls input[type="checkbox"] { accent-color: #d4a344; width: 18px; height: 18px; }
.source-controls input[type="number"], .music-panel input, .music-panel select, .timing-fixed select { box-sizing: border-box; width: 100%; min-width: 0; min-height: 36px; border: 1px solid #50565f; border-radius: 7px; background: #171a1e; color: #f0ebe0; padding: 7px; font: 500 13px system-ui; }
.source-gap-controls { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 10px; align-items: end; margin-top: 10px; }
.source-controls button, .music-panel button { min-height: 36px; border: 1px solid #665337; border-radius: 7px; color: #f0ca7b; background: #352c1e; padding: 6px; cursor: pointer; }
.source-controls :disabled, .music-panel :disabled { opacity: .4; cursor: default; }
.music-panel label { margin: 12px 0; }
#repeatList { display: grid; gap: 8px; margin-top: 18px; }
#repeatList .active { border-color: #edc46e; }
.timing-toolbar { grid-template-columns: minmax(0,1fr) 40px 40px; }
#timingSmart { grid-column: 1 / -1; }
.timing-song-settings { margin-bottom: 10px; }
.timing-song-settings summary { cursor: pointer; color: #edc46e; font: 700 12px/1.5 system-ui; }
.timing-song-settings summary span { display: block; color: #bfc3c8; font-weight: 500; font-size: 10px; margin-top: 3px; }
.timing-song-settings[open] { max-height: 255px; overflow: auto; }
.timing-repeat-handle { position: absolute; top: 50%; right: 0; transform: translate(50%,-50%); width: 28px; height: 32px; padding: 3px 7px; z-index: 5; border: 1px solid #fff; border-radius: 5px; color: white; background: #926116; cursor: pointer; pointer-events: auto; }
.timing-repeat-handle svg { width: 100%; height: 100%; stroke: currentColor; fill: currentColor; }
.repeat-marks-layer { position: absolute; inset: 0; pointer-events: none; z-index: 2; }
.score-repeat-mark { position: absolute; display: flex; align-items: center; color: #161616; pointer-events: none; transform: translate(4px,-50%); }
.score-repeat-mark.start { transform: translate(calc(-100% - 4px),-50%); }
.score-repeat-mark svg { width: auto; height: 100%; min-height: 12px; aspect-ratio: 14/32; stroke: currentColor; fill: currentColor; }
.score-repeat-mark b { position: absolute; bottom: 100%; right: 0; font: 700 1.6cqw system-ui; white-space: nowrap; }
.annotation-page-surface.timing-smart { cursor: crosshair; touch-action: none; }
.timing-row-label { left: -30px; top: 0; width: 24px; box-sizing: border-box; padding: 2px; text-align: center; }
.timing-measure-label { white-space: nowrap; font-size: 9px; padding: 1px 2px; }
.music-history { display: flex; gap: 6px; justify-content: flex-end; margin-bottom: 10px; }
.music-history button { min-width: 36px; font-size: 21px; }

/* v0-23: compact timing controls and a single pinned row card. */
.timing-song-settings summary { display: flex; align-items: center; gap: 7px; list-style: none; }
.timing-song-settings summary::-webkit-details-marker { display: none; }
.timing-song-settings summary::before { content: '▸'; flex: 0 0 auto; font-size: 11px; }
.timing-song-settings[open] summary::before { content: '▾'; }
.timing-song-settings summary strong { flex: 0 0 auto; font-size: 11px; }
.timing-song-settings summary #timingSettingsSummary { display: inline; min-width: 0; margin: 0 0 0 auto; font-size: 9px; white-space: nowrap; }
.timing-toolbar { grid-template-columns: minmax(0,1fr) minmax(0,1.3fr) 32px 32px; gap: 5px; align-items: stretch; }
#timingSmart { grid-column: auto; }
.timing-toolbar #timingDraw, .timing-toolbar #timingSmart { min-width: 0; padding: 5px 4px; font-size: 10px; line-height: 1.25; }
.timing-toolbar .annotation-icon-button { width: 32px; min-width: 0; height: auto; padding: 5px; }
.timing-toolbar .annotation-icon-button svg { width: 18px; height: 18px; }
.timing-fixed { max-height: calc(100dvh - 280px); overflow-y: auto; scrollbar-color: #4b4f55 transparent; }
.timing-current #timingRowFields { margin-top: 8px; }
.timing-current .timing-range strong { font-size: 17px; line-height: 1.25; overflow-wrap: anywhere; }
.timing-current .timing-preview-actions { grid-template-columns: minmax(0,1.25fr) minmax(0,1fr) minmax(0,1fr); gap: 5px; }
.timing-current .timing-preview-actions button { min-width: 0; padding: 6px 3px; font-size: 11px; white-space: nowrap; }
#timingPreviewPause[aria-pressed="true"] { border-color: #d4a344; color: #f0ca7b; background: #3d301b; }
.annotation-page-surface .repeat-marks-layer { z-index: 7; }
.score-repeat-mark.editable { pointer-events: auto; cursor: pointer; appearance: none; min-width: 18px; border: 0; border-radius: 3px; padding: 0; margin: 0; background: transparent; box-sizing: content-box; touch-action: manipulation; }
.score-repeat-mark.editable svg { pointer-events: none; }
.score-repeat-mark.editable b { pointer-events: none; }
.score-repeat-mark.editable.selected { background: #edc46e99; outline: 2px solid #ac7418; outline-offset: 3px; }
.score-repeat-mark.editable:focus-visible { outline: 2px solid #ac7418; outline-offset: 3px; }
@media (max-width: 420px) {
 .timing-song-settings summary { gap: 4px; }
 .timing-song-settings summary strong { font-size: 10px; }
 .timing-song-settings summary #timingSettingsSummary { font-size: 8px; }
}

/* v0-24 compact alignment controls and centered page arrows */
.source-controls{margin-bottom:10px!important}
.source-gap-controls{align-items:end;gap:8px}
#annotationSourceGap,#annotationSourceApply{min-height:28px!important;height:28px!important;padding:3px 8px!important;font-size:12px!important;line-height:20px!important}
#annotationPreviousPage,#annotationNextPage{display:flex;align-items:center;justify-content:center;padding:0!important;line-height:1!important}
#annotationPreviousPage svg,#annotationNextPage svg{display:block;width:16px;height:16px}
.chord-current-card:has(#annotationCurrentChord[hidden]) #annotationCurrentChordLabel{font-size:11px;line-height:1.5;text-transform:none;letter-spacing:0}
.playback-audio{font-size:11px;margin-top:8px;min-width:0}
.playback-audio summary{cursor:pointer;color:#dbb15d;padding:4px 0}
.playback-audio>div{display:flex;flex-wrap:wrap;gap:8px;align-items:center;padding:5px 0}
.playback-audio label{display:flex;gap:5px;align-items:center;font-size:11px;margin:0;min-width:0}
.playback-audio input[type=checkbox]{width:15px;min-height:15px;height:15px;margin:0;accent-color:#d7a44a}
.playback-audio input[type=range]{width:90px;height:20px;min-height:20px;padding:0;accent-color:#d7a44a}
.timing-playback-scope{display:flex;align-items:center;gap:8px;margin:8px 0;font-size:11px}
.timing-playback-scope select{min-height:28px;padding:4px;font-size:11px;flex:1;min-width:0}
.timing-range-controls{margin-bottom:8px;font-size:11px}
.timing-range-controls .timing-field-grid{gap:6px}
.timing-range-controls input{min-height:28px;padding:4px 7px}
.timing-range-controls button{min-height:26px;font-size:10px;padding:4px;margin-top:4px}
.timing-range-shade{position:absolute;top:0;height:100%;pointer-events:none;background:rgba(85,170,194,.16);border-inline:1px solid #58abb5;box-sizing:border-box}
.timing-layer.range-picking .timing-row-box{cursor:crosshair;pointer-events:auto}
.timing-layer.range-picking .timing-row-box>*{pointer-events:none}

/* Playback in the normal score view */
.score-playback{display:flex;position:static;flex:0 0 auto}
.score-playback[hidden]{display:none!important}
.score-playback-buttons{display:flex;align-items:center;gap:7px}
.score-playback .header-button{width:38px;padding:0}
.score-playback svg{width:18px;height:18px;fill:currentColor}
.score-playback #scorePlay{background:#d5a444;border-color:#8d6a2f;color:#161b20}
.score-playback button:disabled{opacity:.4;cursor:default}
#scorePlaybackStatus{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
.metronome-settings-card{padding:14px}
.metronome-settings-card .playback-audio{margin:0}
.metronome-settings-card h3{font-size:14px;margin:0 0 12px}
.metronome-settings-card .playback-audio>div{display:flex;align-items:center;gap:16px;flex-wrap:wrap}
.metronome-settings-card label{display:flex;align-items:center;gap:8px;font-size:13px}
.metronome-settings-card input[type=range]{max-width:180px;accent-color:#d5a444}
.live-timing-follow{position:absolute;z-index:3;pointer-events:none;background:#64b5aa22;border:1px solid #498f89;box-sizing:border-box}
.live-timing-follow>i{position:absolute;top:0;bottom:0;width:2px;background:#b78024;box-shadow:0 0 0 1px #fff8}
.live-annotation-chord.live-chord-playing{outline:2px solid #c99b43;background:#ffe5a3!important;border-radius:3px}
.timing-current .timing-playback-scope{display:flex;align-items:center;margin:6px 0;gap:8px}
.timing-current .timing-playback-scope select{width:auto;flex:1;min-height:28px;height:28px;font-size:11px;padding:3px 6px}
.timing-current #timingRowFields input{min-height:30px;height:30px;padding:4px 8px}
.timing-current .timing-field-grid{margin-top:6px}
.timing-current .timing-row-actions{margin-top:6px}
.timing-current .timing-row-actions button{min-height:29px;padding:4px;font-size:10px}
.timing-current .timing-preview-status{min-height:1.35em}
.timing-current #timingSaveStatus{margin-top:6px}
.timing-current .playback-audio{margin-top:4px}

/* Score controls occupy the header; no transport overlays the score. */
.score-header-tools{display:flex;align-items:center;gap:7px;flex:0 0 auto}
.score-header-tools .treble-clef-icon{width:21px;height:30px;fill:none;stroke:currentColor;stroke-width:1.75;stroke-linecap:round;stroke-linejoin:round}
.score-header-tools .treble-clef-icon circle{fill:currentColor;stroke:none}
.score-header-tools #portraitViewToggle{display:none}
.brand-actions{flex-shrink:0;gap:5px}
.brand-actions .icon-button{width:32px;height:34px;flex:0 0 auto}
.brand-actions .icon-button[aria-pressed=true]{border-color:#8d6a2f;background:#3b2e17;color:#e3b454}
@media (orientation:portrait){
 .stage{grid-template-rows:calc(100px + env(safe-area-inset-top)) minmax(0,1fr)}
 .stage-header{grid-template-columns:auto minmax(68px,1fr);grid-template-rows:34px 34px;column-gap:6px;row-gap:8px}
 .portrait-right-actions{grid-column:1/-1;grid-row:2;justify-content:flex-end}
 .score-header-tools,.score-playback-buttons{gap:3px}
 .score-header-tools .view-mode-switch{display:flex;height:34px;gap:3px}
 .score-header-tools .view-mode-button,.score-header-tools .header-button{width:34px;height:34px;padding:0}
 .score-header-tools .view-mode-button b{display:none}
 .score-header-tools .treble-clef-icon{height:28px}
}
@media (orientation:portrait){
 .app.quick-list-mode .library>.brand-row{display:flex;height:46px;padding:6px 12px}
 .app.quick-list-mode .library>.brand-row .brand-mark{width:32px;height:32px}
 .app.quick-list-mode .portrait-quick-list{height:calc(100% - 46px)}
}
@media (orientation:landscape) and (max-width:760px){
 .brand-actions{gap:3px}
 .brand-actions .icon-button{width:28px;height:32px}
 .brand-row{gap:6px}
}
/* Independent notation layers and offline vector music symbols. */
.annotation-library-panel {grid-template-rows:auto auto auto auto minmax(0,1fr)}
.annotation-library-panel .annotation-tabs {grid-template-columns:1fr 1.45fr 1fr 1.3fr 1fr}
.annotation-library-panel .annotation-tabs button {font-size:clamp(10px,.85vw,12px)}
.annotation-layer-controls {margin:8px 10px;padding:7px 10px;border:1px solid #41464b;border-radius:9px;background:#1b1f23;max-height:32vh;overflow:auto;font-size:12px}
/* The Layers card owns the gap; first panels must not add padding or card margins. */
#annotationToolPanel :is(.annotation-chord-fixed, .timing-fixed, #musicPanel, [data-annotation-panel="notes"], #annotationWatermarkPanel) {
  padding-top:0;
}
#annotationToolPanel :is(.annotation-chord-fixed, .timing-fixed, #musicPanel, [data-annotation-panel="notes"], #annotationWatermarkPanel) > .annotation-card:first-child {
  margin-top:0;
}
.annotation-layer-controls summary {color:#e0b45e;cursor:pointer;font-weight:700;min-height:24px;line-height:24px}
.annotation-layer-controls summary span {font-size:11px;color:#9ba4ac;font-weight:400;margin-left:6px}
.annotation-layer-row {display:flex;align-items:center;flex-wrap:wrap;gap:8px;padding:7px 0;border-top:1px solid #ffffff12}
.annotation-layer-row[hidden] {display:none}
.annotation-layer-row strong {flex:1;min-width:100px;font-size:11px}
.annotation-layer-row label {display:flex;gap:4px;align-items:center;font-size:11px}
.annotation-layer-row input {accent-color:#d7a44a;width:16px;height:16px}
.annotation-layer-row>span {color:#969fa6;font-size:10px}
[data-annotation-panel][inert],#musicSymbolPanel[inert],#functionalRepeatControls[inert] {opacity:.48}
.music-symbol-panel {min-width:0}
.music-symbol-panel label {display:grid;gap:4px;font-size:12px}
.music-format {display:grid;grid-template-columns:1fr 1fr;gap:8px}
.music-format input,.music-format select,.music-search input {width:100%;min-width:0;box-sizing:border-box;min-height:36px;background:#14181c;color:#e5e7e8;border:1px solid #50545b;border-radius:7px;padding:6px;font:inherit}
#musicLengthField {grid-column:1/-1}
#musicLengthField[hidden] {display:none}
.music-edit-tools {display:flex;flex-wrap:wrap;gap:5px;margin:8px 0}
.music-edit-tools button {min-height:36px;flex:1;padding:6px;font-size:11px;border:1px solid #555046;border-radius:7px;background:#d7a44a14;color:#ebca8e;cursor:pointer}
.music-edit-tools button:disabled {opacity:.4;cursor:default}
#musicSelectionLabel {font-size:12px;color:#efca81;margin:0 0 9px}
.music-search {margin:12px 0}
.music-symbol-group {border:1px solid #383e43;border-radius:9px;margin:8px 0;padding:8px}
.music-symbol-group summary,#functionalRepeatControls>summary {color:#e2b660;font-weight:700;font-size:13px;cursor:pointer;padding:5px 0}
.music-symbol-grid {display:flex;flex-wrap:wrap;align-items:stretch;gap:6px;margin-top:8px;min-width:0}
.music-symbol-grid button {display:flex;flex:1 0 auto;flex-direction:column;align-items:center;justify-content:center;min-width:0;max-width:100%;min-height:64px;box-sizing:border-box;padding:7px;gap:6px;border:1px solid #50555b;border-radius:8px;background:#21262b;color:#e7dfcf;cursor:pointer}
.music-symbol-swatch {display:flex;align-items:center;justify-content:flex-start;box-sizing:border-box;min-height:32px;width:100%;padding:2px;overflow:auto;background:transparent;border-radius:4px}
.music-symbol-swatch.dark-symbol svg {filter:drop-shadow(0 0 1px #e8dfcf) drop-shadow(0 0 1px #e8dfcf)}
.music-symbol-grid button .music-symbol-swatch svg {display:block;flex:none;margin-inline:auto;max-width:none;overflow:visible}
.music-symbol-name {font-size:10px;line-height:1.2;text-align:center;overflow-wrap:anywhere}
.music-symbol-grid button.active {background:#59411c;border-color:#efbb5c;color:#ffe2a5}
.music-symbol-grid button:hover {border-color:#d7a44a}
.music-symbol-layer {position:absolute;inset:0;pointer-events:none;z-index:5}
.music-symbol-layer[hidden] {display:none}
.music-symbol {display:block;position:absolute;transform:translate(-50%,-50%);padding:0!important;border:0!important;border-radius:0!important;background:transparent!important;min-width:0!important;min-height:0!important;box-sizing:content-box;line-height:0;pointer-events:none}
.music-symbol svg,.music-symbol-ghost svg {display:block;width:100%;height:100%;overflow:visible}
.music-symbol-layer.editable .music-symbol {pointer-events:auto;touch-action:none;cursor:grab}
.music-symbol-layer.editable .music-symbol::after {content:"";position:absolute;inset:-10px;min-width:24px;min-height:24px}
.music-symbol.selected {outline:2px solid #d7a44a;outline-offset:5px;box-shadow:0 0 0 5px #d7a44a26}
.music-symbol-ghost {position:absolute;transform:translate(-50%,-50%);pointer-events:none;opacity:.45;z-index:6}
.music-symbol-ghost[hidden] {display:none}
.annotation-page-surface.music-placing {touch-action:none;cursor:crosshair}
.live-annotation-layer .music-symbol-layer {z-index:3}

/* M3.3.45: one formatting card and consistent editor typography. */
#annotationToolPanel {font-family:Inter,ui-sans-serif,system-ui,sans-serif}
#annotationToolPanel :is(button,input,select,label,summary,strong,small,p,span) {font-family:inherit}
#annotationToolPanel details>summary {list-style:none;display:flex;align-items:center;gap:7px;font-size:12px;font-weight:700;line-height:1.5;color:#edc46e;cursor:pointer}
#annotationToolPanel details>summary::-webkit-details-marker {display:none}
#annotationToolPanel details>summary::before {content:"";display:block;flex:0 0 9px;width:9px;height:10px;clip-path:polygon(0 0,100% 50%,0 100%);background:currentColor;transition:transform .12s}
#annotationToolPanel details[open]>summary::before {transform:rotate(90deg)}
#annotationToolPanel .timing-song-settings summary {flex-wrap:wrap}
#annotationToolPanel .timing-song-settings summary span {margin:0;font-size:10px}
.source-controls .source-toggle-row {display:flex;align-items:center;gap:8px}
.source-controls .source-toggle-row>label {flex:1;align-items:center;gap:5px}
.source-controls .annotation-format-grid {display:flex;flex:0 0 auto;align-items:center;gap:6px;margin:0}
.source-controls .annotation-size-options {display:flex;gap:4px}
.source-controls .annotation-size-options button {box-sizing:border-box;width:36px;min-width:36px;height:36px;min-height:36px;padding:0;font-size:11px}
.source-controls .annotation-color-picker {display:flex;gap:7px;align-items:center;font-size:12px}
#annotationChordColor,#musicSymbolColor {box-sizing:border-box;width:36px;min-width:36px;height:36px;min-height:36px;padding:3px;border:1px solid #50565f;border-radius:7px;background:#171a1e;cursor:pointer}
.source-controls [hidden] {display:none!important}
.source-controls .annotation-white-background {display:flex;align-items:center;gap:7px;margin:0}
.source-controls .annotation-white-background input {flex:none;margin:0}
/* The toolbar sits outside the selection card and shares its divider position.
   The card has 11 px inset (border + padding), a 10 px gap and a 36% first track.
   Reserve room for the right-hand controls on narrow panels as well. */
.music-symbol-panel {container-type:inline-size}
.music-current-card,.music-control-row {--music-tools-tail:250px}
.music-current-card {margin-top:0;grid-template-columns:minmax(0,min(calc(36% - 3.6px),calc(100% - var(--music-tools-tail) + 1px))) minmax(0,1fr)}
.music-control-row {display:grid;grid-template-columns:minmax(0,min(calc(36% + 9.48px),calc(100% - var(--music-tools-tail)))) max-content 36px 68px;align-items:center;gap:6px;min-width:0;margin:8px 0}
.music-control-row label {display:flex;align-items:center;gap:6px;margin:0!important;min-width:0}
.music-control-row label>span:not(.sr-only) {flex:none;font-size:11px}
.music-control-row .music-search input {flex:1;min-width:0}
/* Native select sizing includes the longest option and its dropdown arrow. */
.music-control-row .music-size select {flex:0 0 auto;width:auto;min-width:max-content}
.music-control-row :is(input,select) {height:30px;min-height:30px;font-size:11px;padding:4px}
.music-control-row .annotation-history-actions {flex:0 0 auto;gap:4px}
.music-control-row .annotation-icon-button {width:32px;min-width:32px;height:36px;padding:0;display:grid;place-items:center}
@container (max-width:420px) {
 .music-current-card,.music-control-row {--music-tools-tail:206px}
 .music-control-row {align-items:end;gap:4px}
 .music-control-row :is(.music-search,.music-size) {flex-direction:column;align-items:stretch;gap:3px;padding-bottom:3px}
 .music-control-row label>span:not(.sr-only) {font-size:10px;line-height:13px}
 .music-control-row .music-search input {flex:none;width:100%}
}
@container (max-width:360px) {
 .music-current-card,.music-control-row {--music-tools-tail:194px}
 .music-control-row {grid-template-columns:minmax(0,min(calc(36% + 9.48px),calc(100% - var(--music-tools-tail)))) max-content 32px 60px}
 .music-control-row #musicSymbolColor {width:32px;min-width:32px}
 .music-control-row .annotation-icon-button {width:28px;min-width:28px}
}
.music-current-card .annotation-current-chord-summary {overflow-wrap:anywhere}
.music-current-card .annotation-action-grid button {min-height:26px;padding:3px;font-size:9px;background:#25282d;border-color:#3d4147;color:#cfcac1}
#musicSelectionLabel {margin:0;font-size:8px;letter-spacing:.7px;text-transform:uppercase}
#musicCurrentLabel {font-size:11px;line-height:1.5;text-transform:none;letter-spacing:0;color:#efca81}
#musicCurrentSymbol {font-size:14px;line-height:1.3}
#musicLengthField {grid-column:1/-1;margin:0;font-size:11px}
.music-control-row .sr-only {position:absolute;width:1px;height:1px;padding:0;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
#creatorPreviewSurface,.metadata-image-frame {position:relative;container-type:inline-size}
.metadata-image-frame {width:100%;max-width:100%}
.metadata-image-frame>img {display:block;width:100%;height:auto}
.chord-preview-layer {pointer-events:none}

/* Independent text and ink notes. The original score stays untouched. */
@font-face {font-family:'BandIT Notes';src:url('./vendor/creator/DejaVuSans.ttf') format('truetype');font-weight:400;font-display:swap}
@font-face {font-family:'BandIT Notes';src:url('./vendor/creator/DejaVuSans-Bold.ttf') format('truetype');font-weight:700;font-display:swap}
.notes-layer,.notes-preview {position:absolute;inset:0;z-index:7;pointer-events:none;overflow:hidden}
.notes-preview {z-index:8}
.notes-layer>svg,.notes-preview>svg {display:block;width:100%;height:100%;overflow:hidden}
.notes-layer.editable [data-note-id] {pointer-events:visiblePainted;cursor:grab}
.notes-layer .note-selection {pointer-events:none}
.annotation-page-surface.notes-interacting {touch-action:none;user-select:none;-webkit-user-select:none;-webkit-touch-callout:none;cursor:crosshair}
.notes-panel .annotation-card {margin-top:8px}
.notes-panel h3 {margin:0 0 9px;color:#edc46e;font-size:13px}
.notes-tools {display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:6px}
.notes-tools button {min-height:48px;border:1px solid #454b53;border-radius:8px;background:#252a30;color:#ddd8cd;font-size:11px;cursor:pointer;display:flex;align-items:center;justify-content:center;gap:6px;padding:5px}
.notes-tools button span {font-size:22px;line-height:1}
.notes-tools button.active {background:#59411c;border-color:#d7a44a;color:#ffe2a5}
.notes-input-mode {display:grid;gap:8px;margin-top:10px}
.notes-panel label {display:flex;align-items:center;gap:6px;font-size:11px;min-width:0}
.notes-panel input[type=checkbox] {accent-color:#d7a44a;width:16px;height:16px}
.notes-panel :is(select,input[type=number]) {min-width:0;width:100%;height:32px;border:1px solid #50565f;border-radius:7px;background:#171a1e;color:#f0ebe0;padding:4px;font-size:11px}
.notes-panel input[type=color] {width:36px;height:32px;padding:3px;border:1px solid #50565f;border-radius:7px;background:#171a1e}
.notes-format-row {display:flex;align-items:center;gap:10px;margin-top:9px}
.notes-format-row label {flex:1;flex-wrap:wrap}
.notes-format-row input[type=checkbox] {flex:none}
.notes-selection-heading {display:flex;gap:8px;align-items:center;justify-content:space-between;margin-bottom:8px}
.notes-selection-heading strong {font-size:11px;color:#edc46e}
.notes-selection-heading .annotation-icon-button {width:32px;height:32px;font-size:22px}
.notes-selection-card .annotation-action-grid {grid-template-columns:repeat(2,minmax(0,1fr))}
.notes-selection-card button {font-size:10px;min-height:32px}
.notes-text-dialog textarea,.note-text-dialog textarea {width:100%;box-sizing:border-box;min-height:140px;resize:vertical;padding:10px;font:16px/1.5 'BandIT Notes',sans-serif;color:#efece4;background:#14181c;border:1px solid #50565f;border-radius:8px;margin-top:8px}
.notes-panel[hidden],.notes-panel [hidden] {display:none!important}

/* M3.3.45: identical glyph metrics and anchors on every score surface. */
@font-face {font-family:'BandIT Score';src:url('./vendor/creator/DejaVuSans-Bold.ttf') format('truetype');font-weight:700;font-display:swap}
.annotation-chord,.live-annotation-chord {font-family:'BandIT Score',sans-serif;font-weight:700;text-rendering:geometricPrecision;font-style:normal;font-variant:normal;letter-spacing:0;text-indent:0;text-align:center;line-height:1.05;min-width:0;min-height:0;margin:0;padding:0;border:0;box-sizing:content-box;appearance:none;-webkit-appearance:none;text-shadow:none}
.annotation-chord.source-aligned,.live-annotation-chord.source-aligned {line-height:1.05;padding:0;border:0}
.annotation-chord.selected {outline:2px solid #d7a44a;outline-offset:2px}
.annotation-chord::before {content:'';position:absolute;inset:-5px}
:where(button,summary,[role=button]) {touch-action:manipulation;-webkit-user-select:none;user-select:none}
.notes-input-surface {position:absolute;inset:0;z-index:9;pointer-events:none;touch-action:none;-webkit-user-select:none;user-select:none;-webkit-touch-callout:none}
.notes-interacting .notes-input-surface {pointer-events:auto}
.notes-interacting,.notes-interacting * {-webkit-user-select:none!important;user-select:none!important;-webkit-touch-callout:none}

/* Score glyphs must not be enlarged by mobile text autosizing. */
.annotation-chord,.live-annotation-chord,.notes-layer,.notes-preview {-webkit-text-size-adjust:none;text-size-adjust:none}

/* Bundled, offline handwriting with Hungarian accents, including ő/ű. */
@font-face {font-family:'BandIT Handwriting';src:url('./vendor/creator/Caveat-Regular.ttf') format('truetype');font-weight:400;font-display:swap}
@font-face {font-family:'BandIT Handwriting';src:url('./vendor/creator/Caveat-Bold.ttf') format('truetype');font-weight:700;font-display:swap}
.note-font-field {margin:8px 0}

.cross-layer-selection {position:absolute;inset:0;z-index:15;pointer-events:none;overflow:hidden}
.cross-layer-selection>i {position:absolute;box-sizing:border-box;border:1.5px dashed #ca941f;outline:1px solid #fff8;pointer-events:none}
.cross-layer-selection>.cross-layer-marquee {background:#d7a44a22;border:1px solid #ca941f}
.timing-passive {pointer-events:none!important}
.timing-passive .timing-row-box {pointer-events:none;border-color:#ca941f66;background:transparent}
.timing-passive :is(.timing-boundary,.timing-corner,.timing-move,.timing-repeat-handle,.timing-measure-label) {visibility:hidden}
.annotation-layer.cross-editable .annotation-chord {touch-action:none}
