/* Note input (ui/noteinput.js): the caret on a staff, the bar along the bottom of the view
   (the passage bar's pill, score.css), and the card of its keys. */

/* ---------------------------------------------------------------- the caret */

.score-caret {
  --caret: rgba(201, 150, 42, 0.85);
  --caret-hi: rgba(227, 184, 74, 0.38);
  position: absolute;
  /* A pixel wide, drawing nothing itself: its marks are what shows. */
  width: 1px;
  margin-left: -0.5px;
  pointer-events: none;
  z-index: 2;
  /* It glides where it goes, along and up or down: fast, short, easing in. */
  transition:
    left 90ms ease-in,
    top 90ms ease-in,
    height 90ms ease-in;
}
/* Its two marks, floating over and under the staff: nothing is drawn over the music. */
.score-caret-mark {
  position: absolute;
  left: -5.5px;
  border: 6px solid transparent;
}
.score-caret-mark.over {
  top: -6px;
  border-top: 8px solid var(--caret);
  border-bottom-width: 0;
}
.score-caret-mark.under {
  bottom: -6px;
  border-bottom: 8px solid var(--caret);
  border-top-width: 0;
}
/* The chord lock: notes stack here — the marks open wide. */
.score-caret.chord .score-caret-mark {
  left: -8.5px;
  border-left-width: 9px;
  border-right-width: 9px;
}
/* Insert: the music after it moves on — emerald. Re-pitch: the notes there change — sapphire. */
.score-caret.insert,
.score-caret-hi.insert {
  --caret: rgba(47, 143, 116, 0.9);
  --caret-hi: rgba(70, 165, 139, 0.36);
}
.score-caret.repitch,
.score-caret-hi.repitch {
  --caret: rgba(74, 111, 165, 0.9);
  --caret-hi: rgba(91, 130, 196, 0.36);
}
/* Slurring: each note is slurred from the one before — an arc leans over the caret from the left. */
.score-caret.slur::before {
  content: "";
  position: absolute;
  right: 0;
  top: -18px;
  width: 22px;
  height: 12px;
  border: 2px solid var(--caret);
  border-color: var(--caret) transparent transparent transparent;
  border-radius: 50% 50% 0 0 / 100% 100% 0 0;
}
/* What the caret stands on, lit softly under the ink: the note's head, the line or space it is on,
 * or the rest. */
.score-caret-hi {
  --caret-hi: rgba(227, 184, 74, 0.38);
  position: absolute;
  border-radius: 999px;
  background: var(--caret-hi);
  pointer-events: none;
  z-index: 1;
  transition:
    left 90ms ease-in,
    top 90ms ease-in,
    width 90ms ease-in,
    height 90ms ease-in;
}
@media (prefers-reduced-motion: reduce) {
  .score-caret,
  .score-caret-hi {
    transition: none;
  }
}
.score-caret-hi.line {
  opacity: 0.8;
  border-radius: 2px;
}
.score-caret-hi.rest {
  border-radius: 6px;
}

/* ---------------------------------------------------------------- the input bar */

/* The note bar: docked under the Score view's ribbon and over the hybrid view's lanes, always in
   the same place, never over the music. What it holds follows what edits notes now (noteBar in
   noteinput.js, for both views): note input, a passage, the chosen notes, or the value to write. */
.score-notebar {
  position: relative;
  flex: none;
  min-height: 40px;
  display: flex;
  align-items: center;
  padding: 3px 40px 3px 10px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(26, 22, 31, 0.94), rgba(15, 13, 18, 0.94));
}
/* Docked, it keeps one height as what it holds changes (two rows: the chosen notes' bar is the
   longest), so choosing a note does not move the music under the pointer; its buttons sit closer. */
.score-notebar {
  min-height: 72px;
}
.score-notebar .input-bar {
  gap: 4px 6px;
}
.score-notebar .input-bar .btn.small {
  padding-left: 6px;
  padding-right: 6px;
}
.score-notebar .input-bar .btn .input-key {
  margin-left: 4px;
  padding: 0 3px;
}
/* Its ✕, in the corner however many rows the bar takes. */
.score-notebar .bar-end {
  position: absolute;
  top: 8px;
  right: 10px;
}
.score-notebar > .score-rangebar {
  position: static;
  margin: 0;
  width: auto;
  flex: 1;
  min-width: 0;
  justify-content: flex-start;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
  backdrop-filter: none;
  animation: none;
}
/* What is in hand (the caret's place, the notes chosen, what a click does): a slot of one width
   whatever it says, so the buttons after it stay put as it changes. */
.input-bar > .input-status {
  flex: 0 0 clamp(190px, 26%, 320px);
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
}
.input-status > * {
  flex: none;
}
.input-status > :last-child {
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* Where the next note lands: its name gives way first; how often a shared pattern plays (the button
   that gives the clip its own) stays whole. */
.input-status > .input-lands {
  flex: 0 1 auto;
  min-width: 0;
}
.input-status > .btn:last-child {
  flex: none;
  font-variant-numeric: tabular-nums;
}
.notebar-hint {
  flex: 1 1 0;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: var(--muted);
  font-size: 12px;
  font-style: italic;
  line-height: 1.3;
}
.idle-bar .input-badge-dot {
  background: var(--dim);
  box-shadow: none;
  animation: none;
}
.input-bar {
  gap: 8px;
  padding: 6px 8px 6px 10px;
  z-index: 4;
  animation: input-rise 0.18s ease-out;
}
@keyframes input-rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}
.input-bar > * {
  flex: none;
}
.input-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--metal);
  color: #251a06;
  font: 700 10.5px/1 var(--sans);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
/* The two modes, first in the bar: Normal (silver while on) and Note input (gold while on). */
.input-mode-label {
  margin: 0 6px 0 4px;
  font: 600 9.5px/1 var(--sans);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
.input-mode-label::after {
  content: ":";
}
.input-modes {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.25);
}
.input-modes .btn {
  border-radius: 999px;
}
.input-mode-seg {
  font: 700 10.5px/1 var(--sans);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.input-mode-seg.on {
  background: rgba(240, 236, 228, 0.16);
  border-color: transparent;
  color: var(--text);
}
/* What the values apply to: the next note, the notes chosen, a click. */
/* The values with what they are for, together on one row. */
.input-valgroup {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.input-vcap {
  font: 600 9.5px/1.1 var(--sans);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  /* One width whatever it says, so the buttons after it stay put. */
  width: 64px;
  text-align: right;
}
.input-vcap.next {
  color: var(--gold-mid);
}
/* Note input: the bar and the music framed in gold. */
.score-notebar.inputting {
  border-bottom-color: rgba(227, 184, 74, 0.55);
  background: linear-gradient(180deg, rgba(62, 48, 18, 0.96), rgba(24, 19, 10, 0.96));
}
.score:has(.score-notebar.inputting) .score-scroll,
.hybrid:has(.score-notebar.inputting) .hy-main {
  box-shadow: inset 0 0 0 2px rgba(227, 184, 74, 0.6);
}
/* The note input switch, first in the bar: the gold pill while it is on. */
.input-toggle {
  gap: 6px;
  border-radius: 999px;
  font: 700 10.5px/1 var(--sans);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.input-toggle.on {
  background: var(--metal);
  border-color: transparent;
  color: #251a06;
}
.input-toggle:not(.on) .input-badge-dot {
  background: var(--dim);
  box-shadow: none;
  animation: none;
}
.input-toggle.on .input-key {
  color: rgba(37, 26, 6, 0.6);
}
@keyframes input-caret {
  50% {
    opacity: 0.55;
  }
}
.input-badge-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #8e3b46;
  box-shadow: 0 0 6px rgba(176, 40, 63, 0.8);
  animation: input-caret 1.1s ease-in-out infinite;
}
.input-where {
  display: inline-flex;
  flex-direction: column;
  gap: 2px;
  min-width: 92px;
}
.input-staff {
  font: italic 600 14px/1 var(--serif);
  color: var(--champagne);
}
/* On a chord: what of it the caret has (the whole, or one note), and how to change that. */
.input-focus {
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid rgba(227, 184, 74, 0.45);
  background: rgba(227, 184, 74, 0.1);
  font: 500 11px/1.2 var(--sans);
  color: var(--champagne);
  white-space: nowrap;
}
.input-at {
  font: 500 10.5px/1 var(--sans);
  color: var(--muted);
  letter-spacing: 0.04em;
}
/* The key that does it, small under a button's face. */
.input-values .score-value {
  position: relative;
  height: 28px;
  padding-bottom: 6px;
}
.input-key {
  font: 600 8.5px/1 var(--mono);
  color: var(--dim);
  letter-spacing: 0;
}
.input-values .input-key {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 2px;
}
.input-values .score-value.on .input-key {
  color: rgba(37, 26, 6, 0.7);
}
.input-bar .btn .input-key {
  margin-left: 6px;
  padding: 1px 4px;
  border-radius: 4px;
  border: 1px solid var(--line-2);
}
.input-bar .btn.on .input-key {
  color: rgba(37, 26, 6, 0.75);
  border-color: rgba(37, 26, 6, 0.3);
}
.input-lands {
  display: inline-flex;
  align-items: baseline;
  min-width: 0;
  max-width: 320px;
  font: 500 12px/1.2 var(--sans);
  color: var(--text);
}
.input-lands-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.input-lands.shared {
  color: var(--gold-hi);
}
.input-lands.warn {
  color: var(--danger);
}
.input-arrow {
  margin-right: 5px;
  color: var(--gold-mid);
}

/* ---------------------------------------------------------------- the keys card */

.input-card {
  position: absolute;
  right: 18px;
  bottom: 72px;
  /* Never past the view's edges (a short view scrolls it). */
  max-height: calc(100% - 96px);
  overflow-y: auto;
  padding: 14px 16px 12px;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(36, 31, 42, 0.97), rgba(18, 16, 22, 0.97));
  border: 1px solid var(--line-3);
  box-shadow:
    0 14px 36px rgba(0, 0, 0, 0.6),
    var(--glow);
  z-index: 5;
  animation: score-rise 0.18s ease-out;
  /* A short pane scrolls it rather than cutting off its top. */
  max-height: calc(100% - 84px);
  max-width: calc(100% - 36px);
  overflow-y: auto;
}
.input-card-title {
  margin-bottom: 10px;
  font: 600 11px/1 var(--sans);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gold-mid);
}
.input-card-rows {
  display: grid;
  grid-template-columns: auto auto;
  gap: 5px 14px;
  align-items: baseline;
}
.input-card-key {
  justify-self: end;
  padding: 2px 6px;
  border-radius: 5px;
  border: 1px solid var(--line-2);
  background: rgba(0, 0, 0, 0.3);
  font: 600 11px/1.2 var(--mono);
  color: var(--gold-hi);
  white-space: nowrap;
}
.input-card-what {
  font: 400 12.5px/1.3 var(--sans);
  color: var(--text);
}
/* In the note bar, docked under the view's toolbar: the card opens down over the music. */
.score-notebar .input-card {
  top: calc(100% + 6px);
  bottom: auto;
  max-height: 64vh;
}
/* A wide pane: two keys to a line, so the card stays short. */
@container (min-width: 900px) {
  .input-card-rows {
    grid-template-columns: auto minmax(0, 260px) auto minmax(0, 260px);
  }
}

.input-mode.on {
  box-shadow: inset 0 0 0 1px var(--line-3);
}

/* The bar on the chosen notes (note input off): nothing is being written, so its dot holds still,
   in the color the chosen notes are drawn in. */
.chosen-bar .input-badge-dot {
  animation: none;
  background: var(--sel);
  box-shadow: 0 0 6px var(--hot-glow);
}
.select.input-dynamics {
  max-width: 104px;
}

/* The input bar measures the view it is in: a narrow one (a small pane, a phone) keeps the buttons
   and leaves out the readout and the keys under them (the status line says where the caret is). */
.score-main,
.hybrid {
  container-type: inline-size;
}
@container (max-width: 820px) {
  .input-where,
  .input-bar .btn .input-key,
  .input-values .input-key {
    display: none;
  }
  .input-values .score-value {
    height: 24px;
    padding-bottom: 0;
  }
  .input-bar {
    gap: 5px;
  }
  /* Where the next note lands stays, shorter. */
  .input-lands {
    max-width: 190px;
  }
}

/* A phone: thumb-sized buttons. */
@media (max-width: 760px) {
  .input-bar {
    max-width: calc(100% - 12px);
    gap: 6px;
    padding: 6px;
  }
  .input-bar .btn,
  .input-values .score-value {
    min-height: 34px;
    min-width: 34px;
  }
}

/* The dynamics' palette: Bravura's marks, and the hairpins in the serif. */
.dyn-values .score-value.dyn {
  width: 26px;
  font-size: 19px;
  padding-bottom: 0;
  overflow: hidden;
}
/* Bravura's glyphs reach far above their line: not over the buttons around. */
.dyn-values .score-value.dyn .g {
  pointer-events: none;
}
.dyn-values .score-value.dyn.pin {
  font: 600 14px/1 var(--serif);
}
.dyn-values .score-value:disabled {
  opacity: 0.4;
  cursor: default;
}
/* Behind a button of the note bar, so the bar keeps its two rows: the level there, and the word. */
/* One width whatever level it shows (or none), so the buttons after it stay put. */
.score-notebar .dyn-open {
  min-width: 108px;
  justify-content: center;
}
.dyn-open-glyph {
  margin-right: 5px;
  font: 17px/0 "Bravura";
  vertical-align: -2px;
}
/* What a button of the note bar shows takes no clicks: a music font's glyph reaches far past its
 * line (Bravura's ascent), and where the bar wraps it would take the clicks meant for the buttons
 * of the row above — the button around it has them. */
.score-notebar button span {
  pointer-events: none;
}
/* Under the palette: whose dynamic it sets, and from which bar. */
.dyn-where {
  flex-basis: 100%;
  order: -1;
  padding: 2px 4px 6px;
  color: var(--muted);
  font: italic 500 13px/1.2 var(--serif);
}
.score-popup.dyn-popup {
  left: 0;
  right: auto;
  flex-direction: row;
  flex-wrap: wrap;
}

/* The forms (V), under their button: a button a form, two to a row, then the switch that takes the
 * pitches from the chord symbol. */
.score-popup.form-popup {
  left: 0;
  right: auto;
  min-width: 230px;
}
.form-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
}
.form-popup .form-item,
.form-popup .form-marker {
  justify-content: center;
  white-space: nowrap;
}

/* The notes' menu (a right-click on a note): each item's key at its right. */
.note-menu-item .input-key {
  margin-left: auto;
}
.note-menu-item:disabled {
  opacity: 0.4;
  pointer-events: none;
}

/* The voice the next notes are written in (Ctrl+Alt+1–4), in its bar: MuseScore's colors per voice. */
.input-voice {
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  font: 600 11px/1.2 var(--sans);
  white-space: nowrap;
}
.input-voice.v1 {
  color: #7fb2ff;
}
.input-voice.v2 {
  color: #6fcf86;
}
.input-voice.v3 {
  color: #f0a35a;
}
.input-voice.v4 {
  color: #d58ad6;
}

/* The marks (the note bar's Marks), under their button: Bravura's articulations, ornaments and
 * accents, a row of six each; lit when the chosen notes have one. */
.score-popup.mark-popup {
  left: 0;
  right: auto;
}
.mark-values .score-value.mark {
  width: 30px;
  overflow: hidden;
}
.mark-values .score-value.mark .mark-glyph {
  font: 20px/1 "Bravura";
  pointer-events: none;
}
.mark-values .score-value.mark .mark-text {
  font: italic 600 12px/1 var(--serif);
  pointer-events: none;
}
.mark-values .score-value:disabled {
  opacity: 0.4;
  cursor: default;
}
