:root {
  --vibrant-coral: #ff6666ff;
  --bright-amber: #f1c40fff;
  --indigo-velvet: #5d2e8cff;
  --light-sea-green: #2ec4b6ff;
  --champagne-mist: #f6e7cbff;
  --text-dark: #1f1b2c;
  --soft-border: rgba(92, 102, 122, 0.16);
}

.score-stage {
  min-height: 100vh;
  background: #f5f6f8;
  padding: 1.25rem;
  display: flex;
  align-items: stretch;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.score-stage__canvas {
  width: min(1200px, calc(100% - 4rem));
  min-height: 640px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 12px 28px rgba(31, 27, 44, 0.14);
  position: relative;
  overflow: hidden;
  padding: 1rem;
  display: flex;
}

.score-stage__canvas > .score-view__viewport {
  flex: 1;
  border-radius: 8px;
  background: #fff;
}

.floating-panel {
  position: absolute;
  background: rgba(255, 255, 255, 0.92);
  border-radius: 10px;
  box-shadow: 0 8px 18px rgba(31, 27, 44, 0.16);
  padding: 0.5rem 0.65rem;
  border: 1px solid rgba(92, 102, 122, 0.1);
  backdrop-filter: blur(6px);
  display: flex;
  gap: 0.5rem;
  align-items: center;
  z-index: 5;
  cursor: grab;
  user-select: none;
}

.floating-panel--top {
  top: 1rem;
  left: 50%;
  transform: translateX(-50%);
}

.floating-panel--status {
  bottom: 1rem;
  left: 1.25rem;
}

.floating-panel--instruments {
  top: 5rem;
  right: 3.5rem;
  width: 220px;
  flex-direction: column;
  align-items: stretch;
  gap: 0.25rem;
}

.floating-panel--instruments[data-dock="left"] {
  left: 1.25rem;
  right: auto;
}

.floating-panel--instruments[data-dock="floating"] {
  top: auto;
  bottom: 3rem;
  right: 3.5rem;
}

.instrument-panel__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(31, 27, 44, 0.65);
  gap: 0.4rem;
}

.instrument-panel__actions {
  display: inline-flex;
  gap: 0.3rem;
}

.instrument-panel__actions button {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  font-size: 0.7rem;
  padding: 0;
  border: 1px solid rgba(31, 27, 44, 0.2);
  background: rgba(255, 255, 255, 0.85);
  transition: background 0.2s;
}

.instrument-panel__actions button:hover,
.instrument-panel__actions button:focus-visible {
  background: rgba(46, 196, 182, 0.2);
  outline: none;
}

.instrument-panel__list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-top: 0.35rem;
}

.instrument-panel__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.45rem 0.45rem;
  gap: 0.5rem;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  cursor: pointer;
  transition: background 0.2s, box-shadow 0.2s;
}

.instrument-panel__row-main {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex: 1;
}

.instrument-panel__meta {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.instrument-panel__row:hover,
.instrument-panel__row.is-highlighted {
  background: rgba(46, 196, 182, 0.18);
  box-shadow: 0 8px 16px rgba(46, 196, 182, 0.15);
}

.instrument-panel__row.is-selected {
  border: 1px solid var(--light-sea-green);
}

.instrument-panel__empty {
  font-size: 0.75rem;
  color: rgba(31, 27, 44, 0.5);
  padding: 0.5rem 0.2rem;
}

.instrument-panel__glyph {
  font-size: 1.1rem;
}

.instrument-panel__meta strong {
  font-size: 0.85rem;
  color: var(--text-dark);
}

.instrument-panel__meta span {
  display: block;
  font-size: 0.7rem;
  color: rgba(31, 27, 44, 0.55);
}

.instrument-panel__meta-extra {
  font-size: 0.65rem;
  color: rgba(31, 27, 44, 0.5);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.instrument-panel__key-label {
  font-size: 0.65rem;
  color: rgba(31, 27, 44, 0.55);
  letter-spacing: 0.04em;
}

.instrument-panel__key-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.35rem 0;
  align-items: center;
}

.instrument-panel__key-actions label {
  display: flex;
  flex-direction: column;
  font-size: 0.65rem;
  color: rgba(31, 27, 44, 0.65);
}

.instrument-panel__key-actions select {
  margin-top: 0.15rem;
  border-radius: 6px;
  border: 1px solid rgba(31, 27, 44, 0.15);
  padding: 0.25rem 0.45rem;
  min-width: 90px;
  background: rgba(255, 255, 255, 0.9);
}

.instrument-panel__key-actions button {
  border-radius: 8px;
  border: 1px solid var(--soft-border);
  background: rgba(46, 196, 182, 0.12);
  padding: 0.3rem 0.9rem;
  font-size: 0.75rem;
  color: rgba(31, 27, 44, 0.8);
  transition: background 0.2s ease, border 0.2s ease;
}

.instrument-panel__key-actions button:hover {
  background: rgba(46, 196, 182, 0.25);
  border-color: rgba(46, 196, 182, 0.5);
}

.instrument-panel__row-actions {
  display: inline-flex;
  gap: 0.25rem;
}

.instrument-panel__row-action {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid rgba(31, 27, 44, 0.2);
  background: rgba(255, 255, 255, 0.9);
  font-size: 0.8rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s;
}

.instrument-panel__row-action:hover,
.instrument-panel__row-action:focus-visible {
  background: rgba(46, 196, 182, 0.2);
  outline: none;
}

.instrument-panel__row-action[aria-pressed="true"] {
  background: var(--light-sea-green);
  color: #fff;
  border-color: var(--light-sea-green);
}
.floating-panel button {
  border: none;
  background: rgba(255, 255, 255, 0.85);
  padding: 0.35rem 0.65rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.85rem;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--text-dark);
  transition: background 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
}

.floating-panel button:hover {
  box-shadow: 0 4px 10px rgba(46, 196, 182, 0.24);
  background: rgba(46, 196, 182, 0.12);
}

.floating-panel button:focus-visible {
  outline: 2px solid var(--light-sea-green);
  outline-offset: 3px;
  box-shadow: 0 0 6px rgba(46, 196, 182, 0.45);
}

.floating-panel button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.floating-panel[data-dragging="true"] {
  cursor: grabbing;
}

.floating-panel__group {
  display: flex;
  gap: 0.4rem;
}

.tool-toggle {
  min-width: 38px;
  justify-content: center;
}

.tool-toggle.is-active {
  background: rgba(46, 196, 182, 0.22);
  box-shadow: 0 4px 10px rgba(46, 196, 182, 0.22);
}

.toolbar-toggle {
  border: 1px solid rgba(92, 102, 122, 0.18);
  background: rgba(31, 27, 44, 0.035);
}

.toolbar-toggle.is-active {
  background: rgba(46, 196, 182, 0.18);
  border-color: var(--light-sea-green);
}

.floating-panel__zoom-value {
  font-weight: 600;
  font-size: 0.85rem;
}

.toolbar-select {
  display: inline-flex;
  gap: 0.35rem;
  align-items: center;
  padding: 0.25rem 0.45rem;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(92, 102, 122, 0.15);
  border-radius: 8px;
  font-size: 0.85rem;
}

.toolbar-select select {
  border: 1px solid rgba(92, 102, 122, 0.25);
  border-radius: 6px;
  padding: 0.2rem 0.4rem;
  font-size: 0.85rem;
  background: #fff;
}

.status-pill {
  background: rgba(31, 27, 44, 0.05);
  border-radius: 8px;
  padding: 0.2rem 0.65rem;
  font-size: 0.78rem;
}

.inspector-hover {
  position: absolute;
  padding: 0.45rem 0.65rem;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 8px;
  border: 1px solid var(--soft-border);
  box-shadow: 0 8px 18px rgba(31, 27, 44, 0.24);
  font-size: 0.75rem;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 10;
}

.inspector-hover h4 {
  margin: 0;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #555;
}

.inspector-hover p {
  margin: 0.2rem 0 0;
  font-size: 0.9rem;
  color: var(--text-dark);
}

.inspector-hover[hidden],
.hint-bubble[hidden] {
  display: none;
}

.hint-bubble {
  position: absolute;
  background: rgba(46, 196, 182, 0.95);
  color: #fff;
  border-radius: 8px;
  padding: 0.35rem 0.8rem;
  font-size: 0.75rem;
  pointer-events: none;
  z-index: 6;
  box-shadow: 0 6px 12px rgba(46, 196, 182, 0.32);
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.hint-bubble__primary {
  font-weight: 600;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
}

.hint-bubble__pitch {
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.9;
}

.ui-overlay-layer--rest-suggestions text {
  pointer-events: none;
}

.ui-overlay-layer--diagnostics rect {
  pointer-events: none;
}

.ui-overlay-layer--diagnostics text {
  font-size: 0.65rem;
  fill: #fff;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  pointer-events: none;
}

.mini-glyph {
  font-size: 1rem;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 12, 32, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
}

.modal-panel {
  background: #fff;
  padding: 1.2rem 1.5rem;
  border-radius: 10px;
  box-shadow: 0 14px 30px rgba(15, 12, 32, 0.28);
  width: min(320px, 90%);
  max-width: 360px;
}

.modal-panel h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: #1f1b2c;
}

.modal-panel p {
  margin: 0.5rem 0 1rem;
  font-size: 0.85rem;
  color: #3d3a50;
}

.modal-panel .modal-close {
  border: none;
  background: rgba(46, 196, 182, 0.2);
  padding: 0.4rem 0.85rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  color: #1f1b2c;
}
.instrument-panel__actions button:focus-visible {
  outline: 2px solid var(--light-sea-green);
  outline-offset: 2px;
}

.context-menu {
  position: absolute;
  min-width: 180px;
  background: #fff;
  border: 1px solid var(--muted-2);
  border-radius: 6px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.18);
  padding: 8px;
  z-index: 12;
}

.context-menu__list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.context-menu__list button {
  border: 1px solid var(--muted-2);
  background: var(--near-white);
  padding: 6px 8px;
  text-align: left;
  border-radius: 4px;
  cursor: pointer;
}

.context-menu__list button:hover:not(:disabled) {
  background: var(--muted-2);
}

.context-menu__accidentals,
.context-menu__key {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

.context-menu select {
  border: 1px solid var(--muted-2);
  border-radius: 4px;
  padding: 4px 6px;
}
