* {
  box-sizing: border-box;
}
body {
  margin: 0;
  font:
    14px system-ui,
    "Malgun Gothic",
    sans-serif;
  color: #203049;
  background: #f3f6fa;
}
header {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  overflow-x: auto;
  white-space: nowrap;
  gap: 9px;
  background: white;
  border-bottom: 1px solid #d1dce8;
  padding: 11px;
  position: sticky;
  top: 0;
  z-index: 9;
}
header > * { flex: none; }
button {
  background: white;
  border: 1px solid #a8b8ca;
  border-radius: 7px;
  padding: 8px 11px;
  cursor: pointer;
}
button:hover {
  background: #e9f4ff;
}
#view {
  height: calc(100vh - 135px);
  overflow: auto;
  background: white;
}
#layout {
  display: flex;
  width: max-content;
  min-width: 100%;
  padding-top: 30px;
}
#labels {
  position: sticky;
  left: 0;
  z-index: 5;
  background: white;
  border-right: 2px solid #8fa6bc;
  width: 108px;
  min-width: 108px;
  height: 505px;
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  font-weight: bold;
  padding-left: 10px;
}
#strip {
  display: flex;
  align-items: flex-start;
  transform-origin: top left;
}
.measure {
  flex: none;
  position: relative;
  height: 505px;
  border-right: 1px solid #bccbd9;
  cursor: pointer;
}
.measure img {
  display: block;
  height: 505px;
  width: 100%;
  object-fit: fill;
}
.measure .number {
  position: absolute;
  top: -23px;
  left: 3px;
  font-size: 11px;
  white-space: nowrap;
  color: #48637b;
}
.measure:hover {
  outline: 2px solid #9ac5ed;
}
.measure.selected {
  outline: 3px solid #df932b;
  z-index: 2;
}
footer {
  background: #fff;
  border-top: 1px solid #d1dce8;
  padding: 10px 14px;
  color: #42576b;
}
#detail {
  font-size: 13px;
  margin-left: auto;
}
#zoom {
  width: 120px;
}

#tools {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  padding: 9px 12px;
  background: #eaf1fa;
  border-bottom: 1px solid #c8d5e5;
}
#tools select,
#tools input {
  padding: 6px;
  border: 1px solid #aebfd1;
  border-radius: 5px;
  background: white;
}
#tools button {
  padding: 6px 9px;
}
#mixer {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  background: #fff;
  padding: 8px 12px;
  border-bottom: 1px solid #d8e0e9;
}
.mix {
  border: 1px solid #d4dfea;
  border-radius: 7px;
  padding: 6px;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 4px;
}
.mix input[type="range"] {
  width: 65px;
}
.note-mark {
  position: absolute;
  width: 11px;
  height: 8px;
  border-radius: 50%;
  background: rgba(29, 124, 241, 0.8);
  border: 1px solid white;
  transform: translate(-50%, -50%) rotate(-16deg);
  pointer-events: none;
}
.measure {
  overflow: visible;
}
#view {
  height: calc(100vh - 240px);
  min-height: 380px;
  padding-bottom: 32px;
}
.hint {
  font-size: 12px;
  color: #566b7e;
}
#status {
  font-weight: bold;
  color: #1d548d;
}

#playhead {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 3px;
  background: #e54848;
  z-index: 6;
  pointer-events: none;
  box-shadow: 0 0 0 1px #fff7;
  display: none;
}
#strip {
  position: relative;
}
#barinfo {
  font-weight: 600;
  color: #ad3232;
}
.measure.playing-bar {
  box-shadow: inset 0 0 0 2px #edb15d;
}
#playhead {
  cursor: ew-resize;
  pointer-events: auto;
  touch-action: none;
}
#seektrack {
  height: 26px;
  position: relative;
  cursor: crosshair;
  background: #f6e8e8;
  border-bottom: 1px solid #f0c5c5;
}
#seekmarker {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 3px;
  background: #e54848;
  pointer-events: none;
}
#seektrack .ticks {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
#strip {
  padding-top: 26px;
}
#playhead {
  top: 26px !important;
  height: 505px;
  bottom: auto;
  background: #ec2626;
  width: 4px;
  z-index: 15;
}
#labels {
  margin-top: 26px;
}
#playhead::before {
  content: "▼";
  position: absolute;
  top: -24px;
  left: -7px;
  color: #e54848;
  font-size: 19px;
}
#view {
  scrollbar-gutter: stable;
}

.note-mark.pending {
  background: #e49a17;
  border: 1px solid #7c4a00;
  pointer-events: auto;
  cursor: pointer;
  z-index: 4;
}
.note-mark.verified {
  background: #111827;
  border: 1px solid #fff;
  pointer-events: auto;
  cursor: pointer;
  z-index: 4;
}
#review-panel {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 8px 12px;
  background: #fff6e8;
  border-bottom: 1px solid #e2c69e;
}
#review-panel input,
#review-panel select {
  width: 78px;
  padding: 5px;
}
#review-panel button {
  padding: 6px 10px;
}

body {
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: white;
}
header,
#tools,
#review-panel,
#mixer,
footer {
  flex: none;
}
header {
  border-top: 3px solid #284c76;
}
header strong {
  font-size: 17px;
}
#view {
  height: auto;
  min-height: 180px;
  flex: 1;
  position: relative;
}
#layout {
  padding-top: 0;
}
#labels {
  margin-top: 26px;
}
#play {
  background: #214f77;
  color: white;
  border-color: #214f77;
}
#seektrack {
  overflow: visible;
}
#seektrack .ruler-label {
  position: absolute;
  top: 3px;
  padding-left: 5px;
  font-size: 11px;
  color: #764a4a;
  border-left: 1px solid #d7aaaa;
  pointer-events: none;
}
#labels {
  z-index: 9;
}
#goto-bar {
  width: 4.5em;
  padding: 5px;
}
footer {
  font-size: 12px;
}
button:focus-visible,
input:focus-visible {
  outline: 2px solid #1279bd;
}
@media (max-height: 650px) {
  body {
    height: auto;
  }
  #view {
    height: 65vh;
    flex: none;
  }
}

@font-face {
  font-family: Bravura;
  src: url("../assets/Bravura.woff2");
}
.measure,
#labels {
  height: 525px;
}
#playhead {
  height: 525px;
}
.staff-paper {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.staff-lines {
  position: absolute;
  width: 100%;
  height: 25px;
  background: repeating-linear-gradient(
    to bottom,
    #596675 0 1px,
    transparent 1px 6px
  );
}
.glyph {
  font-family: Bravura;
  position: absolute;
  font-size: 24px;
  line-height: 0;
}
.measure .note-mark {
  width: auto;
  height: auto;
  transform: none;
  background: none;
  border: 0;
  transform-origin: 0 0;
  color: #18242f;
}
.note-mark.pending {
  color: #cc7a10;
}
.note-mark svg {
  overflow: visible;
  position: absolute;
  left: -5px;
  top: -22px;
  width: 16px;
  height: 44px;
}
.clef {
  font: 26px Bravura;
  float: right;
  margin-right: 10px;
}
#labels {
  display: block;
  padding: 0 5px;
}
#labels > div {
  height: 75px;
  padding-top: 16px;
}
.measure .number {
  display: none;
}
.score-phrasing {
  position: absolute;
  top: var(--score-top);
  left: 0;
  pointer-events: none;
  overflow: visible;
  z-index: 4;
  color: #18242f;
}
.lyric {
  font:
    13px "Malgun Gothic",
    sans-serif;
  fill: #193047;
}
.score-phrasing .lyric {
  pointer-events: all;
  cursor: default;
  user-select: none;
}
.note-mark {
  touch-action: none;
  cursor: grab !important;
}
.note-mark.chosen {
  color: #176dbe !important;
}
.lyric.chosen {
  fill: #176dbe;
  font-weight: bold;
}
.floating-lyric {
  position: fixed;
  z-index: 30;
  width: 9em;
  padding: 5px;
  border: 2px solid #2372ac;
  border-radius: 4px;
}
#review-panel #lyric-field {
  width: 9em;
}
#labels {
  width: 122px;
  min-width: 122px;
}
#labels > div {
  position: relative;
  padding-top: 17px;
  font-size: 13px;
  white-space: nowrap;
}
#labels .clef {
  position: absolute;
  float: none;
  right: 0;
  top: 26px;
  line-height: 0;
  font-size: 24px;
  margin: 0;
}
#lyrics-dialog {
  width: min(660px, 94vw);
  padding: 22px;
  color: #203049;
  border: 1px solid #a8b8ca;
  border-radius: 12px;
}
#lyrics-dialog::backdrop {
  background: #16233766;
}
#lyrics-dialog h2 {
  margin: 0;
  font-size: 20px;
}
#lyrics-dialog p,
#lyrics-counter {
  font-size: 13px;
}
#lyrics-text {
  box-sizing: border-box;
  width: 100%;
  padding: 12px;
  font: 17px/1.8 system-ui;
  resize: vertical;
}
#lyrics-counter {
  margin: 8px 0;
}
.lyrics-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}
#lyrics-apply {
  background: #214f77;
  color: white;
}
#lyrics-apply:disabled {
  opacity: 0.45;
}
#playhead,
#playhead::before {
  pointer-events: none;
}
#playhead::before {
  content: none;
}
#seektrack {
  cursor: ew-resize;
  touch-action: none;
  user-select: none;
}
#seekmarker {
  z-index: 2;
}
#seekmarker::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: -5px;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 9px solid #e54848;
}
#live-mix,
#group-mix {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
#live-mix {
  padding: 6px 12px;
  background: #f2f6fa;
  border-bottom: 1px solid #cbd7e2;
  flex: none;
}
#group-mix label {
  display: inline-flex;
  gap: 5px;
  align-items: center;
}
#group-mix input[type="range"] {
  width: 75px;
}
#voice-status {
  font-size: 12px;
  color: #334d67;
}
#lyrics-parts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
#lyrics-parts button[aria-pressed="true"] {
  background: #214f77;
  color: white;
}
#backing-control {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 8px;
  border: 1px solid #a8bdce;
  border-radius: 6px;
  background: #edf4fa;
  font-weight: 600;
}
#backing-control input[type="range"] {
  width: 72px;
}
.tempo-mark {
  position: absolute;
  top: 1px;
  z-index: 10;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font: bold 13px/18px "Malgun Gothic", sans-serif;
  color: #233346;
  background: #fff;
}
.tempo-mark input {
  width: 3.2em;
  padding: 0 2px;
  font: inherit;
  color: inherit;
  border: 0;
  border-bottom: 1px dotted #64748b;
}
#playhead { pointer-events: auto; cursor: grab; touch-action: none; }
#playhead:active { cursor: grabbing; }
#playhead::after { content: ""; position: absolute; inset: 0 -4px; }
.drag-cursor {
  position: absolute;
  left: 1px;
  width: 14px;
  height: 19px;
  pointer-events: none;
  background: #fff;
  filter: drop-shadow(0 0 1px black);
  clip-path: polygon(0 0, 94% 58%, 54% 63%, 79% 95%, 58% 100%, 34% 66%, 4% 88%);
  outline: 1px solid #222;
}
#strings-panel { width: max-content; min-width: 100%; background: #fff; border-top: 1px solid #cad3df; }
#strings-panel summary, .strings-controls { position: sticky; left: 0; width: max-content; padding: 7px 12px; }
#strings-panel summary { cursor: pointer; font-weight: 650; }
#strings-staff, #strings-measures { display: flex; }
#strings-labels { flex: none; position: sticky; left: 0; z-index: 2; background: white; border-right: 2px solid #8fa6bc; }
#strings-labels > div { height: 72px; padding: 22px 5px 0; font-weight: bold; }
.string-measure { flex: none; border-right: 1px solid #bccbd9; height: 216px; }
.string-measure > div { height: 72px; overflow: hidden; position: relative; }
.string-measure > div > div { position: absolute !important; inset: 0; padding: 0 !important; }
.string-measure svg { width: 100%; height: 100%; }
#strings-enabled[aria-pressed="true"] { background: #245c4c; color: white; }
@media (max-width: 480px) { header strong { max-width: 38vw; overflow: hidden; text-overflow: ellipsis; } }
#recent-files { max-width: 12em; }
.duration-menu { position: fixed; inset: auto; margin: 0; padding: 4px; border: 1px solid #aaa; border-radius: 6px; } .duration-menu button { display: block; width: 100%; text-align: left; }
#symbol-palette {display:inline-flex;align-items:center;max-width:100%;overflow-x:auto;gap:2px;} #symbol-palette button {flex:none;white-space:nowrap;} #symbol-palette button.music-symbol {font:22px/32px Bravura;padding:0 4px;min-width:24px;height:36px;} #symbol-palette button[aria-pressed=true] {background:#164b70;color:white;}
#score-tabs {display:flex;gap:3px;max-width:32vw;overflow-x:auto;} #score-tabs button {flex:none;} #score-tabs button[aria-pressed=true] {background:#184f73;color:white;}
.note-mark svg {pointer-events:none;}
.measure .note-mark::before {content:"";position:absolute;left:-4px;top:-2px;width:10px;height:5px;}
.show-external > :not(header):not(.external-score) {display:none!important;} .show-external header > :not(#score-tabs):not(#loadbtn):not(#recent-files) {display:none;} .show-external #score-tabs {max-width:70vw;} .external-score {position:fixed;inset:54px 0 0;width:100%;height:calc(100% - 54px);border:0;background:white;} .imported-editor #score-tabs,.imported-editor #loadbtn,.imported-editor #recent-files {display:none;}
#folder-picker {width:min(520px,90vw);border:1px solid #a8b8ca;border-radius:9px;padding:18px;} #folder-picker::backdrop {background:#14263966;} #folder-picker form {display:flex;gap:5px;margin-bottom:8px;} #folder-picker label {flex:1;} #folder-picker input {width:100%;padding:6px;} .folder-list {max-height:32vh;overflow:auto;margin:6px 0;} .folder-list button {display:block;width:100%;text-align:left;}
.measure,#labels,#playhead {height:var(--staff-height,525px);} #labels > [hidden] {display:none;}
#labels .staff-signature {position:absolute;right:-5px;top:0;overflow:visible;pointer-events:none;} .staff-signature text {font:24px Bravura;fill:#18242f;}
.conductor-panel {position:fixed;top:12px;right:12px;width:min(330px,90vw);background:white;color:#18242f;padding:10px;border:1px solid #8196a6;border-radius:8px;z-index:25;box-shadow:0 3px 16px #0004;} .conductor-panel canvas {display:block;width:100%;margin:6px 0;background:#20262b;aspect-ratio:4/3;} .conductor-panel p {margin:5px 0;}
.camera-preview {width:100%;aspect-ratio:4/3;overflow:hidden;background:#20262b;margin:6px 0;} .camera-preview video {width:100%;height:100%;object-fit:cover;transform:scaleX(-1);} .camera-signal {display:block;} .camera-device {max-width:80%;}
.score-tab-group{display:inline-flex;flex:none;align-items:stretch}.score-tab-group>button:first-child{border-radius:6px 0 0 6px}.score-tab-group>.score-tab-close{border-radius:0 6px 6px 0;padding:0 5px;border-left:0;min-width:20px}

.tempo-corner { position:sticky; left:0; top:0; width:max-content; height:0; z-index:12; pointer-events:none; }
#live-score-tempo { display:block; padding:3px 7px; background:#163957; color:white; border-radius:0 0 5px 0; font:bold 26px/36px sans-serif; font-variant-numeric:tabular-nums; }
.conductor-panel {box-sizing:border-box;max-width:100vw;max-height:100vh;overflow:auto;}
.camera-drag-title {display:block;padding-left:26px;cursor:grab;user-select:none;touch-action:none;}
.camera-drag-title:active {cursor:grabbing;}
.camera-resize-grip {position:absolute;top:3px;left:3px;width:26px;height:24px;display:grid;place-items:center;color:#25445a;cursor:nwse-resize;user-select:none;touch-action:none;}
#strip:not(.score-editing) .measure,
#strip:not(.score-editing) .measure * {pointer-events:none;}
#strip:not(.score-editing) .measure .tempo-mark,
#strip:not(.score-editing) .measure .tempo-mark input {pointer-events:auto;}
#strip {--score-top:52px;padding-top:var(--score-top);}
#labels {margin-top:52px;}
#playhead {top:52px !important;}
.measure .tempo-mark {top:auto;bottom:calc(100% + 2px);height:20px;}
.measure .tempo-mark input {box-sizing:border-box;height:20px;min-height:0;}
.measure .tempo-mark[hidden] {display:none;}
#strip .tempo-mark button {pointer-events:auto;cursor:pointer;padding:0 2px;border:0;background:transparent;color:inherit;font:inherit;}
#strip .tempo-mark button:focus {outline:2px solid #2371a8;}
#strip:not(.score-editing) .measure .tempo-mark button {pointer-events:auto;}
.lyric-lane {fill:transparent;pointer-events:none;}
.score-editing .lyric-lane,.score-editing .lyric {pointer-events:all;cursor:text;}
#inline-lyrics {position:absolute;z-index:12;box-sizing:border-box;height:24px;font:14px "Malgun Gothic",sans-serif;}
.score-phrasing text.lyric {white-space:pre;}
.measure[data-end-style] .staff-lines::after {content:"";position:absolute;right:0;top:0;height:100%;width:4px;border-left:1px solid #263747;border-right:1px solid #263747;}
.measure[data-end-style="SectionClose"] .staff-lines::after {border-right-width:3px;}
.measure[data-end-style="SectionOpen"] .staff-lines::after {border-left-width:3px;}
body.side-mixer {--mix-width:clamp(158px,15vw,212px);padding-left:var(--mix-width);}
body.side-mixer.show-external {padding-left:0;}
.side-mixer #mixer {position:fixed;inset:0 auto 0 0;width:var(--mix-width);display:flex;flex-direction:column;flex-wrap:nowrap;align-items:stretch;overflow:auto;gap:6px;padding:8px;background:#f3f6fa;border-right:1px solid #bdcbd9;}
.side-mixer #mixer > * {flex:none;flex-wrap:wrap;background:white;}
.side-mixer #mixer .mix b {flex:1 1 auto;}
.side-mixer #mixer input[type="range"] {flex:0 0 100%;width:100%;margin:3px 0;}
#tools #edit-toggle {font-weight:700;color:#12456b;border:2px solid #24628e;background:#edf6ff;}
#tools #edit-toggle[aria-pressed="true"] {background:#164b70;color:white;}
body:not(.editing-score) :is(#symbol-palette,#review-panel,#tools label:has(#dur),#tools label:has(#part),#preview) {display:none;}
@media (max-width:600px) {
  body.side-mixer {--mix-width:126px;}
  .side-mixer #mixer {padding:4px;}
  .side-mixer #mixer .mix b {flex-basis:100%;}
}
#recent-list {position:fixed;inset:auto;margin:0;width:min(400px,calc(100vw - 8px));max-height:55vh;overflow:auto;padding:6px;border:1px solid #a8b8ca;border-radius:7px;color:#203049;background:white;}
#recent-list summary,#opened-list strong {padding:7px;cursor:pointer;}
#opened-list strong {display:block;cursor:default;}
#recent-list button {display:block;width:100%;text-align:left;border:0;white-space:normal;}
