:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --panel-soft: #eef6ff;
  --ink: #1f2a37;
  --muted: #5b6b7a;
  --accent: #2b7de9;
  --accent-strong: #4bb7ff;
  --glow: rgba(43, 125, 233, 0.25);
  --danger: #ff4d4f;
  --warn: #f7b500;
  --good: #22c55e;
  --timeline: #eef6ff;
  --results: #eef6ff;
  --icon-btn-size: 56px;
  --icon-size: 70px;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Space Grotesk", "IBM Plex Sans", "Calibri", sans-serif;
  color: var(--ink);
  background: var(--bg);
  min-height: 100dvh;
  overflow: hidden;
}

.app {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto; /* header, main, footer */
}

main {
  flex: 1;
  min-height: 0 !important;
  overflow: hidden;
  margin-bottom: 0px;
}

.brand {
  font-size: 40px;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-style: italic;
  font-family: "Bravura", "Petaluma", "Space Grotesk", sans-serif;
}

.header-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 18px 24px;
}

.score-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
}

.form-check {
  font-size: 24px;
  color: var(--accent);
}

.controls {
  display: flex !important;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.controls.has-score #analyzeBtn {
  order: 1;
}

.controls.has-score .score-clear {
  order: 2;
}

.controls.has-score .score-grade-row {
  order: 3;
}

.controls-block {
  display: grid;
  gap: 12px;
  width: 100%;
  max-width: 760px;
}

.controls .btn {
  width: auto !important;
  font-size: 32px !important;
  padding: 8px 12px !important;
}

.controls .score-load,
.controls .score-clear {
  grid-column: 1;
  grid-row: 1;
}

.controls #analyzeBtn {
  grid-column: 2;
  grid-row: 1;
}

.controls .score-grade-row {
  grid-column: 3;
  grid-row: 1;
  align-self: center;
  justify-self: center;
}

#fileInput {
  color: var(--accent-strong);
}

#clearBtn:hover {
  background: var(--danger);
  border: none;
}

.is-hidden {
  display: none;
}

.btn.btn-outline-primary,
.btn.btn-outline-secondary {
  box-shadow: 0 0 12px var(--glow);
  transform-origin: center;
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease;
}

.btn.btn-outline-primary:hover,
.btn.btn-outline-secondary:hover {
  transform: scale(1.1);
}

.grade-row {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-left: auto; /* pushes grade control to the right */
}

.grade-label {
  font-size: 36px;
  color: var(--accent);
  white-space: nowrap;
  margin: 0;
}

#targetGradeSelect {
  max-width: 160px;
  font-size: 32px;
  width: auto;
  flex: 0 0 auto;
}

.toggles {
  font-size: 18px;
  color: var(--accent);
  display: grid;
  gap: 10px;
  padding-left: 30px;
  background-color: #dbfafc;
  border: #2b7de9 2px solid;
  margin: 1px;
}
.header-controls .toggles {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
  padding-left: 0;
  background: transparent;
  border: none;
}

.key-analysis-btn {
  font-size: 16px;
  padding: 6px 12px;
  border-radius: 999px;
  text-transform: none;
}

.header-controls .grade-row {
  margin-left: auto;
  flex-wrap: nowrap;
}

.score-grade-row {
  font-size: 20px;
  color: var(--accent);
  justify-content: flex-start;
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.toggle input {
  width: 22px;
  height: 22px;
  accent-color: var(--accent-strong);
  transition: transform 0.5s ease;
}

.toggle input:hover {
  transform: scale(1.2);
}

.toggle .form-check-label {
  padding: 4px 10px;
  border-radius: 8px;
  transition:
    background 0.3s ease,
    color 0.3s ease;
}

.toggle input:checked + .form-check-label {
  background: rgb(240, 240, 29);
  color: var(--accent);
}

#analyzeBtn:hover {
  background-color: #22c55e;
}

.viewer-wrap {
  display: grid;
  grid-template-rows: auto 1fr; /* controls row, then viewer fills */
  gap: 10px;
  min-height: 0;
}

#score-controls {
  width: 100%;
}

.viewer-title {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 28px;
  color: rgba(31, 42, 55, 0.18);
  pointer-events: none;
}

#viewer {
  min-height: 500px;
  background: #ffffff;
}

.results {
  background: var(--results);
  border: 1px solid #d7e1ee;
  padding: 26px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  height: 100%;
  min-height: 0 !important;
}

.results h2,
.details-pane h2 {
  margin: 0;
  font-size: 32px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  min-height: 0;
  color: var(--muted);
}

.score-title {
  font-size: 32px;
  letter-spacing: 0.08em;
  color: var(--muted);
  border: 1px solid #d7e1ee;
  border-radius: 8px;
  padding: 10px 16px;
  text-align: center;
}

.bars {
  display: grid;
  gap: 12px;
  flex: 1;
  align-content: start;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-gutter: stable;
  padding-right: 6px;
}

.bar-row {
  display: grid;
  gap: 30px;
  font-size: 20px;
  color: var(--muted);
}

.bar-head {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 28px;
  font-style: italic;
  font-weight: 600;
  position: relative;
}

.bar-head span {
  justify-self: start;
}

.bar-head .details-mini {
  position: absolute;
  left: 50%;
}

.bar-score {
  margin-left: auto;
}

.bar-score {
  font-size: 28px;
  font-weight: 600;
  font-style: italic;
  color: var(--muted);
  justify-self: end;
}

.bar-score.is-high {
  color: var(--danger);
}

.details-mini {
  width: var(--icon-btn-size);
  height: var(--icon-btn-size);
  transform: translateY(10px);
  border-radius: 10px;
  border: none;
  background: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transform-origin: center;
  transition: transform 0.5s ease;
}

.details-mini:hover {
  transform: scale(1.2);
}

.details-mini img {
  width: var(--icon-size);
  height: var(--icon-size);
  display: block;
  background-color: transparent;
}

.bar {
  position: relative;
  height: 24px;
  background: transparent;
  border-radius: 2px;
  box-shadow: none;
  overflow: hidden;
}

.bar-image {
  display: block;
  width: 100%;
  height: 27px;
  object-fit: cover;
}

.bar-ticks {
  position: absolute;
  left: 1px;
  right: 1px;
  bottom: 0px;
  height: 30%;
  pointer-events: none;
  background-image:
    linear-gradient(
      to right,
      rgba(30, 41, 59, 0.75) 0,
      rgba(30, 41, 59, 0.75) 1px,
      transparent 1px
    ),
    linear-gradient(
      to right,
      rgba(30, 41, 59, 0.95) 0,
      rgba(30, 41, 59, 0.95) 2px,
      transparent 2px
    );
  background-size:
    calc(100% / 50) 100%,
    calc(100% / 5) 100%;
  background-repeat: repeat;
  background-position:
    0 0,
    0 0;
}

.timeline-ticks {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 100%;
  pointer-events: none;
  background-image:
    linear-gradient(
      to right,
      rgba(30, 41, 59, 0.75) 0,
      rgba(30, 41, 59, 0.75) 1px,
      transparent 1px
    ),
    linear-gradient(
      to right,
      rgba(30, 41, 59, 0.95) 0,
      rgba(30, 41, 59, 0.95) 2px,
      transparent 2px
    );
}

.bar-ticks span {
  display: none;
}

.bar .marker {
  position: absolute;
  left: 1%;
  top: 25%;
  transform: translate(-30%, -50%);
  width: 8px;
  height: 24px;
  image-rendering: auto;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.25));
  pointer-events: none;
  transition: left 2s ease;
}

.bar-labels {
  display: flex;
  justify-content: space-between;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.bar-labels .low {
  color: red;
}

.bar-labels .high {
  color: green;
}

.detail-body {
  display: grid;
  grid-template-columns: .5fr, .5fr;
  gap: 5px;
  min-height: 120px;
  background: #ffffff;
  border: 1px solid #d7e1ee;
  padding: 10px;
  font-size: 24px;
  color: var(--muted);
  overflow-y: auto;
}

.detail-body.detail-body--measure {
  display: block;
}

.detail-body.detail-body--analyzer {
  display: block;
}

.detail-body.detail-body--global {
  display: block;
}

.detail-body.detail-body--list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.detail-list-btn {
  width: 100%;
  padding: 6px 10px;
  font-size: 20px;
  text-align: left;
  border: 1px solid #c9d6e6;
  background: #f8fbff;
  color: var(--muted);
  border-radius: 8px;
}

.detail-list-btn:hover {
  color: var(--ink);
  border-color: #9ab0cc;
}

.detail-list-btn--wind {
  background: #d9ecff;
  border-color: #9fbde6;
  color: #1f2a37;
}

.detail-list-btn--brass {
  background: #ffbdbd;
  border-color: #e28e8e;
  color: #1f2a37;
}

.detail-list-btn--percussion {
  background: rgb(188, 233, 248);
  border-color: #054ce6;
  color: #1f2a37;
}

.detail-list-btn--string {
  background: #ffd6d6;
  border-color: #f0a0a0;
  color: #1f2a37;
}

.detail-list-btn--keyboard,
.detail-list-btn--unknown {
  background: #d9f5d8;
  border-color: #9fd9a5;
  color: #1f2a37;
}

.detail-list-btn--high-woodwinds {
  background: #d7f5c9;
  border-color: #9ed2a5;
  color: #1f2a37;
}

.detail-list-btn--mid-woodwinds {
  background: #d9ecff;
  border-color: #9fbde6;
  color: #1f2a37;
}

.detail-list-btn--low-woodwinds {
  background: #e2d2ff;
  border-color: #b7a0e3;
  color: #1f2a37;
}

.detail-list-btn--high-brass {
  background: #fff3a6;
  border-color: #e7c86a;
  color: #1f2a37;
}

.detail-list-btn--mid-brass {
  background: #ffd3a6;
  border-color: #e2a86e;
  color: #1f2a37;
}

.detail-list-btn--low-brass {
  background: #ffbdbd;
  border-color: #e28e8e;
  color: #1f2a37;
}

.detail-block {
  padding: 10px 0;
}

.detail-block-title {
  font-size: 28px;
  font-weight: 700;
  color: var(--ink);
}

.detail-block-line {
  border-bottom: 3px solid #0b4b6b;
  margin: 6px 0 8px;
}

.detail-issues-line {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 2px solid #0b4b6b;
  font-size: 18px;
  font-weight: 600;
  color: var(--ink);
}

.details-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.export-btn {
  font-size: 20px;
  padding: 6px 12px;
}

.export-desc {
  font-size: 24px;
  color: var(--muted);
  margin-bottom: 12px;
}

.export-actions {
  display: grid;
  gap: 8px;
}

.export-progress {
  margin-top: 14px;
  display: grid;
  gap: 8px;
}

.export-status {
  font-size: 14px;
  color: var(--muted);
}

@media (max-width: 991px) {
  .details-header {
    flex-wrap: wrap;
  }
}

.detail-block-measure {
  font-size: 18px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 4px;
}

.detail-header {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #ffffff;
  padding: 6px 0 10px;
  border-bottom: 3px solid #0b4b6b;
  margin-bottom: 10px;
}

.detail-header-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.detail-back {
  border: 1px solid #c9d6e6;
  background: #f8fbff;
  color: var(--muted);
  font-size: 16px;
  padding: 4px 10px;
  border-radius: 8px;
  cursor: pointer;
}

.detail-back:hover {
  color: var(--ink);
  border-color: #9ab0cc;
}

.detail-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--ink);
}

.detail-measure {
  padding: 10px 0;
  border-bottom: 2px solid #0b4b6b;
}

.detail-measure-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 4px;
}

.detail-beat-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--ink);
  margin: 6px 0 2px;
}
.measure-title {
  font-size: 28px;
  font-weight: 700;
  color: var(--ink);
  margin: 6px 0 12px;
  padding-bottom: 8px;
  border-bottom: 3px solid #0b4b6b;
}

.measure-empty {
  font-size: 20px;
  color: var(--muted);
}

.measure-part {
  padding: 12px 0;
  border-bottom: 2px solid #0b4b6b;
}

.measure-part-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 6px;
}

.measure-analyzer-title {
  font-size: 19px;
  font-weight: 700;
  color: var(--ink);
  margin: 8px 0 4px;
}

.measure-analyzer {
  margin-bottom: 10px;
}

.measure-beat-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--ink);
  margin: 6px 0 2px;
}

.measure-issue-list {
  margin: 0;
  padding-left: 20px;
  font-size: 18px;
  color: var(--muted);
}

.measure-issue-item {
  margin-bottom: 6px;
}

.tick-measure {
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
  color: var(--ink);
}

.tick-measure:hover {
  color: var(--accent);
  text-decoration: underline;
  transform: scale(2);
  transition: 0.5s ease;
}

.timeline-tick-issue .tick-mark {
  background: var(--warn);
}

.tick-measure-issue {
  color: var(--accent);
}

.availability-summary {
  grid-column: 1 / -1;
  font-size: 20px;
  color: var(--muted);
  margin-bottom: 8px;
}

.observed-grade-pane {
  border: 1px solid #d7e1ee;
  background: #f8fbff;
  padding: 10px 12px;
  display: grid;
  gap: 6px;
  min-height: 60px;
}

.observed-grade-title {
  font-size: 32px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.observed-grade-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--ink);
}


.key-analysis-modal .modal-header {
  padding: 10px 14px;
  align-items: center;
}

.key-analysis-modal .modal-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.key-analysis-modal .modal-body {
  display: grid;
  gap: 10px;            
  padding: 12px 14px 14px; 
}


.key-analysis-lead {
  font-size: 36px; 
  font-weight: 750;
  color: var(--ink);
  margin: 0;
}

.key-analysis-desc {
  font-size: 24px; 
  color: var(--muted);
  line-height: 1.35;
  margin: 0;
}

.key-analysis-list {
  font-size: 18px;
  color: var(--ink);
  margin: 0;
}

.key-analysis-list ul {
  margin: 0;
  padding-left: 20px;
}

.key-analysis-list li {
  margin-bottom: 4px;
}


.key-analysis-options {
  display: grid;
  gap: 8px; /* tighter */
  margin-top: 2px;
}


.key-analysis-options .btn {
  text-align: left;
  white-space: normal;
 
  border-radius: 12px;
  line-height: 1.25;

  font-size: 24px;         
  font-weight: 650;

  min-height: 0;           
}

.key-analysis-options .btn .sub {
  display: block;
  font-size: 26px;
  font-weight: 500;
  opacity: 0.85;
  margin-top: 3px;
}

.key-analysis-modal .btn-close {
  transform: scale(0.9);
}

.parts-toggle {
  display: flex;
  gap: 8px;
  width: 100%;
  max-height: 48px;
}

.parts-toggle button {
  flex: 1;
  padding: 6px 8px;
  border: 1px solid #c9d6e6;
  background: #f8fbff;
  color: var(--muted);
  cursor: pointer;
  font-size: 24px;
  font-weight: 600;
  height: 100%;
}

.sort {
  font-size: 32px;
  color: var(--accent);
  margin-right: 30px;
  margin-top: px;
}

footer {
  margin-top: auto;
  flex: 0 0 auto;
  height: clamp(250px, 22dvh, 360px);
}

.timeline {
  display: grid;
  grid-template-rows: 1fr; /* track */
  height: 100%;
  padding: 10px 12px;
  gap: 10px;
  overflow: visible;
  border: 1px solid #0b4b6b;
  --timeline-line-offset: 15px;
}

.timeline-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 12px;
  border: 1px solid #d7e1ee;
  border-radius: 10px;
  background: #ffffff;
}

.results-timeline-header {
  margin-top: 12px;
  background-color: azure;
}

.timeline-label {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

.timeline-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  color: var(--muted);
  font-size: 20px;
}

#controls-label {
  font-size: 24px;
  font-style: italic;
  font-weight: 600;
  margin-right: 10px;
}

.timeline-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
}

.timeline-toggle input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.timeline .tick-measure {
  display: none;
}

.timeline .timeline-tick-issue-only .tick-mark {
  display: none;
}

.timeline.show-issue-measures .timeline-tick-issue-only .tick-mark {
  display: block;
}

.timeline.show-issue-measures .tick-measure-issue {
  display: inline-flex;
}

.timeline.hide-key .tick-key-wrap {
  display: none;
}

.timeline.hide-tempo .tick-tempo {
  display: none;
}

.timeline.hide-meter .tick-timesig {
  display: none;
}

.timeline.hide-last-measure #endingMeasureLabel {
  display: none;
}

.timeline h3 {
  margin: 0;
  font-size: 32px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
  text-align: center;
}

.timeline-track {
  position: relative;
  min-height: 0px;
  height: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 56px;
}

.timeline-canvas {
  position: relative;
  height: 100%;
  padding: 0 12px;
  box-sizing: border-box;
}

.timeline-line {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(50% + var(--timeline-line-offset));
  height: 4px;
  background: #0b4b6b;
  transform: translateY(-50%);
}

.timeline-tick {
  position: absolute;
  top: 0;
  height: 100%;
  transform: translateX(-50%);
  display: block;
  color: var(--ink);
}

.timeline-tick .tick-mark {
  width: 3px;
  height: 26px;
  background: #0b4b6b;
  position: absolute;
  top: calc(50% + var(--timeline-line-offset));
  left: 50%;
  transform: translate(-50%, -50%);
}

.timeline-tick-end .tick-mark {
  height: 36px;
  width: 5px;
}

.timeline-tick .tick-above {
  font-size: 16px;
  font-weight: 600;
}

.tick-meter {
  font-size: 18px;
  font-weight: 600;
  font-family: "Bravura", "Petaluma", "Space Grotesk", sans-serif;
  line-height: 1;
  position: absolute;
  top: 4px;
  left: 50%;
  transform: translateX(-50%);
}

.tick-top {
  position: absolute;
  top: 4px;
  bottom: calc(50% + var(--timeline-line-offset) + 6px);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
}

.tick-tempo {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1;
  position: static;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #0b4b6b;
  white-space: nowrap;
  transform: translateY(10px) translateX(10px);
}

.tick-tempo-icon {
  display: block;
  height: 22px;
  width: auto;
}

.tick-tempo-text {
  line-height: 1;
  font-size: 18px;
  font-weight: 700;
}

.tick-measure {
  font-size: 18px;
  font-weight: 600;
  line-height: 1;
  position: absolute;
  bottom: -16px;
  left: 50%;
  transform: translateX(-50%);
}

.tick-key-wrap {
  position: absolute;
  top: 75%;
  left: 100%;
  transform: translate(-50%, -50%);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 18px;
  transform: translateY(10px);
}

.tick-key-icon {
  display: block;
  height: 18px;
  width: auto;
}

.tick-key-letter,
.tick-key-accidental {
  font-family: Georgia, 'Times New Roman', Times, serif;
  line-height: 1;
  color: var(--ink);
  font-size: 24px;
}

.tick-key-accidental {
  font-size: 18px;
  line-height: 3;
}

.tick-key-minor {
  font-size: 18px;
  line-height: 1;
  position: relative;
  top: 3px;
  right: -2px;
}

.timeline-tick-start {
  transform: translateX(0);
}

.timeline-tick-end {
  transform: translateX(-100%);
  right: calc(50%);
}

.timeline-tick-start .tick-top {
  left: 0;
  transform: translateX(6px);
}

.timeline-tick-start .tick-key-wrap {
  left: 0;
}

.timeline-tick-start .tick-mark {
  left: 0;
  transform: translate(0, -50%);
  height: 36px;
  width: 5px;
}

.tick-tempo .tick-above:first-child {
  font-size: 18px;
  letter-spacing: 0.08em;
}

.tick-meter .tick-above {
  font-family: "Bravura", "Petaluma", "Space Grotesk", sans-serif;
  font-size: 18px;
}

.tick-timesig{
  display: grid;
  grid-template-rows: 1fr 1fr;  /* numerator row, denominator row */
  justify-items: center;
  align-items: center;

  width: 20px;     /* tweak */
  height: 30px;    /* tweak */
  line-height: 1;
  position: static;
}

.tick-timesig .ts-row{
  display: inline-flex;         /* digits next to each other */
  align-items: center;
  justify-content: center;
  gap: 1px;                     /* spacing between digits */
}

.tick-timesig .ts-digit{
  width: 12px;                  /* tweak digit size */
  height: auto;
  display: block;
}


.tick-timesig-num,
.tick-timesig-den{
  display: block;
}

.timeline-range {
  position: sticky;
  left: 0;
  right: 0;
  bottom: 0;
  margin-top: auto;
  z-index: 3;
  background: var(--timeline);
  padding-top: 6px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 28px;
  height: 28px;
  padding-top: 6px;
  font-size: 22px;
  font-weight: 700;
  color: var(--muted);
}

.timeline-range .label {
  margin-right: 8px;
  opacity: 0.9;
}

#progressModal .modal-content {
  min-height: 1100px;
}

.tooltip .tooltip-inner {
  font-size: 18px;
  background: #ffffff;
  color: black;
  border: 1px solid #cfe7d4;
  box-shadow: 0 6px 18px rgba(27, 61, 107, 0.12);
}

.tooltip.bs-tooltip-right .tooltip-arrow::before {
  border-right-color: #ffffff;
}

.progress-bars {
  display: grid;
  gap: 16px;
}

.progress-item {
  display: grid;
  gap: 6px;
}

.progress-row {
  display: grid;
  grid-template-columns: 1fr;
  align-items: center;
}

.progress-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}

.progress-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.progress-icon {
  width: 32px;
  height: 32px;
  display: inline-block;
}

.progress-percent {
  font-size: 20px;
  font-weight: 700;
  color: var(--muted);
  min-width: 48px;
  text-align: right;
}

.progress-item .label {
  font-size: 20px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

#progressText {
  font-size: 28px;
  font-weight: 700;
  color: var(--accent); 
}

.modal-header {
  justify-content: space-between;
  align-items: center;
}

.progress-timer {
  font-size: 24px;
  font-weight: 700;
  color: var(--muted);
  margin-left: auto;
  margin-right: 16px;
  font-variant-numeric: tabular-nums;
}

.modal-dialog.modal-dialog-centered {
  max-width: 900px;
}

.progress {
  height: 27px;
}

.progress-bar {
  font-size: 16px;
  line-height: 27px;
}

.progress-bar.brown {
  background-color: #7a1b1b;
}
.progress-bar.red {
  background-color: #d32f2f;
}
.progress-bar.orange {
  background-color: #fb8c00;
}
.progress-bar.pink {
  background-color: #f8bbd0;
  color: #2b2b2b;
}
.progress-bar.yellow {
  background-color: #fdd835;
  color: #2b2b2b;
}
.progress-bar.light-green {
  background-color: #9ccc65;
  color: #1f2a37;
}
.progress-bar.green {
  background-color: #4dd0e1;
  color: #1f2a37;
}
.progress-bar.blue {
  background-color: #1e88e5;
}
.progress-bar.indigo {
  background-color: #3949ab;
}
.progress-bar.teal {
  background-color: #0ea5a4;
  color: #1f2a37;
}

@media (max-width: 991px) {
  .details-pane {
    order: 3;
  }
}
.details-pane {
  background: #ffffff;
  border: 1px solid #d7e1ee;
  padding: 16px;
  display: grid;
  grid-template-rows: auto auto auto auto 1fr;
  gap: 16px;
  height: 100%;
  min-height: 0 !important;
}

.viewer-wrap {
  min-height: 0 !important;
}

#app.verovio-app {
  flex: 1 1 auto;
  min-height: 0 !important;
  border: 1px solid lightgray;
  background: white;
  overflow: auto;
  height: 100%;
  position: relative; /* Verovio UI can be tall */
}

#app .verovio-zoom-root {
  transform-origin: top left;
}
#startingMeasureLabel,
#endingMeasureLabel {
  color: black !important;
  font-size: 24px;
}

/* Track should fit inside the first row instead of forcing min-height */
.timeline-track {
  position: relative;
  min-height: 0 !important;
  height: 100%;
}

/* Keep the line centered within track */
.timeline-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 4px;
  background: #0b4b6b;
  transform: translateY(-50%);
}

/* Labels row ALWAYS visible */
.timeline-range {
  display: flex;
  justify-content: space-between;
  align-items: center;

  height: 28px; /* explicit so it can't collapse */
  min-height: 28px;

  padding: 0;
  margin: 0;

  font-size: 22px;
  font-weight: 700;
  color: var(--muted);
}

/* =========================================================
   LAYOUT + SCROLL (refactor)
   Goal: body locked, app fills viewport, panes scroll correctly
   ========================================================= */

/* 1) Lock page scroll, but make the app the viewport-scroller context */
html, body {
  height: 100%;
}

body {
  min-height: 100dvh;
  overflow: hidden; /* keep if you want NO page scrollbar */
}

/* 2) Make the app a true viewport-height grid */
.app {
  height: 100dvh;        /* was min-height: 100vh */
  min-height: 0;         /* allow children to shrink */
  display: grid;
  grid-template-rows: auto 1fr auto;
}

/* 3) Main must be allowed to shrink AND clip */
main {
  min-height: 0;         /* critical in grid layouts */
  overflow: hidden;      /* main contains internal scrollers */
}

/* 4) Make the details pane a bounded grid so its body can scroll */
.details-pane {
  min-height: 0;
  height: 100%;
  overflow: hidden;

  display: grid;
  gap: 16px;

  /* IMPORTANT: last row is the scrolling area */
  grid-template-rows: auto auto minmax(0, 1fr);
}

/* 5) The actual scroll container */
.detail-body {
  /* FIX invalid grid syntax (commas break it) */
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;

  /* make it fill the available "minmax(0,1fr)" row */
  min-height: 0;
  height: 100%;

  overflow-y: auto;
  overflow-x: hidden;

  scrollbar-gutter: stable;
}

/* If this is the measure view, keep it as block but still scroll */
.detail-body.detail-body--measure {
  display: block;
  min-height: 0;
  height: 100%;
  overflow-y: auto;
}

/* 6) Prevent accidental "double scroll" in nested wrappers */
.results,
.viewer-wrap {
  min-height: 0;
}

/* Optional: if some parent wrapper is using flex, this helps */
.viewer-wrap,
.details-pane,
.results {
  min-height: 0 !important;
}
