/* Shared styles of the error detection pages: staff system, palette, results. */
@font-face {
  font-family: 'Bravura';
  src: url('/fonts/Bravura.woff2') format('woff2');
  font-display: block;
}
.bravura { font-family: 'Bravura'; }

.metric-card {
  background: var(--color-background-secondary, #f3f4f6);
  border-radius: 12px;
  padding: 14px;
  text-align: center;
}
.dark .metric-card { background: #1e2a3a; }
.metric-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #64748b;
}
.metric-value { font-size: 28px; font-weight: 600; color: #1f2937; }
.dark .metric-value { color: white; }
.metric-sub { font-size: 11px; color: #6b7280; margin-top: 2px; }

.seg-toggle {
  display: inline-flex; border: 2px solid #d1d5db; border-radius: 9999px; overflow: hidden;
}
.dark .seg-toggle { border-color: #4b5563; }
.seg-toggle button {
  padding: 3px 10px; font-size: 0.7rem; font-weight: 600; color: #4b5563;
  line-height: 1.25; cursor: pointer; -webkit-tap-highlight-color: transparent;
  transition: background-color 0.15s, color 0.15s;
}
.dark .seg-toggle button { color: #9ca3af; }
.seg-toggle button.selected { background: #3b82f6; color: #ffffff; }

.ap-toggle {
  position: relative; width: 44px; height: 24px; border-radius: 9999px;
  background: #d1d5db; cursor: pointer; transition: background-color 0.15s;
  -webkit-tap-highlight-color: transparent; flex-shrink: 0;
}
.dark .ap-toggle { background: #4b5563; }
.ap-toggle.on { background: #3b82f6; }
.ap-toggle .ap-knob {
  position: absolute; top: 2px; left: 2px; width: 20px; height: 20px;
  border-radius: 9999px; background: #ffffff; box-shadow: 0 1px 2px rgba(0,0,0,0.25);
  transition: left 0.15s;
}
.ap-toggle.on .ap-knob { left: 22px; }
.level-slider {
  -webkit-appearance: none; appearance: none; display: block; width: 100%; height: 20px;
  margin: 0; background: transparent; cursor: pointer;
  --pos: calc(10px + (var(--v, 1) - 1) / 9 * (100% - 20px));
}
.level-slider::-webkit-slider-runnable-track {
  height: 4px; border-radius: 2px;
  background: linear-gradient(to right, #3b82f6 var(--pos), #d1d5db var(--pos));
}
.dark .level-slider::-webkit-slider-runnable-track { background: linear-gradient(to right, #3b82f6 var(--pos), #4b5563 var(--pos)); }
.level-slider::-webkit-slider-thumb {
  -webkit-appearance: none; width: 20px; height: 20px; margin-top: -8px; border-radius: 9999px;
  background: #3b82f6; box-shadow: 0 1px 2px rgba(0,0,0,0.25);
}
.level-slider::-moz-range-track { height: 4px; border-radius: 2px; background: #d1d5db; }
.dark .level-slider::-moz-range-track { background: #4b5563; }
.level-slider::-moz-range-progress { height: 4px; border-radius: 2px; background: #3b82f6; }
.level-slider::-moz-range-thumb { width: 20px; height: 20px; border: 0; border-radius: 9999px; background: #3b82f6; box-shadow: 0 1px 2px rgba(0,0,0,0.25); }
.level-scale { display: flex; justify-content: space-between; margin-top: 2px; }
.level-scale button {
  width: 20px; font-size: 0.7rem; font-weight: 600; line-height: 1.25; text-align: center;
  color: #9ca3af; cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.dark .level-scale button { color: #6b7280; }
.level-scale button.on { color: #3b82f6; }
.dark .level-scale button.on { color: #60a5fa; }

.staff-scroll { overflow-x: auto; overflow-y: hidden; -webkit-overflow-scrolling: touch; }
.staff-svg {
  color: #111827; --given-color: #3b82f6; --highlight-color: #3b82f6; --edit-color: #2563eb;
  user-select: none; -webkit-user-select: none;
}
.dark .staff-svg { color: #f3f4f6; --given-color: #60a5fa; --highlight-color: #60a5fa; --edit-color: #60a5fa; }
.meter-sep { width: 5px; height: 5px; border-radius: 9999px; background: #9ca3af; margin: 0 3px; flex-shrink: 0; }
.dark .meter-sep { background: #6b7280; }
.glyph-pill { width: 3rem; height: 3.4rem; border-radius: 0.75rem; padding: 0; }
.glyph-pill svg { pointer-events: none; }
.shell-pill:disabled { opacity: 0.35; cursor: not-allowed; }
.preset-pill {
  padding: 0.375rem 0.75rem; font-size: 0.875rem; font-weight: 500; border-radius: 9999px;
  border: 2px solid #d1d5db; color: #4b5563; transition: all 0.12s;
}
.dark .preset-pill { border-color: #4b5563; color: #9ca3af; }
.preset-pill.selected { background: #3b82f6; border-color: #3b82f6; color: #ffffff; }
.clef-row { display: flex; align-items: center; gap: 0.5rem; margin-top: 0.4rem; }
.clef-row-label {
  flex: 0 0 4.5rem; font-size: 0.65rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.04em; color: #9ca3af;
}
.dark .clef-row-label { color: #6b7280; }

.staff-menu {
  position: absolute; z-index: 50; min-width: 11rem;
  background: #ffffff; border: 1px solid #d1d5db; border-radius: 0.75rem;
  box-shadow: 0 10px 25px rgba(0,0,0,0.15); padding: 0.35rem; display: flex; flex-direction: column;
}
.dark .staff-menu { background: #1f2937; border-color: #4b5563; }
.staff-menu button { text-align: left; padding: 0.45rem 0.8rem; border-radius: 0.5rem; font-size: 0.9rem; color: #111827; }
.dark .staff-menu button { color: #f3f4f6; }
.staff-menu button:hover { background: #eff6ff; }
.dark .staff-menu button:hover { background: #374151; }
.staff-menu button.active { font-weight: 700; color: #3b82f6; }
.dark .staff-menu button.active { color: #60a5fa; }
.staff-menu button:disabled { opacity: 0.4; cursor: not-allowed; }
.staff-menu button:disabled:hover { background: none; }

.system { display: flex; align-items: stretch; }
.system-bracket {
  flex: 0 0 10px; width: 10px; box-sizing: border-box; margin-right: 4px;
  border-left: 3px solid #111827; border-top: 3px solid #111827; border-bottom: 3px solid #111827;
  border-radius: 2px 0 0 2px;
}
.dark .system-bracket { border-color: #f3f4f6; }
.system-names { flex: 0 0 58px; width: 58px; display: flex; flex-direction: column; }
.system-staves { flex: 1 1 auto; min-width: 0; }
.system.single .system-bracket, .system.single .system-names { display: none; }
.voice-row { display: flex; align-items: center; }
.voice-name {
  flex: 1 1 0; display: flex; align-items: center; justify-content: flex-end;
  padding-right: 7px; text-align: right; font-size: 0.6rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.04em; color: #9ca3af; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.dark .voice-name { color: #6b7280; }
.voice-name.active { color: #3b82f6; }
.dark .voice-name.active { color: #60a5fa; }
.voice-name.erring { color: #d97706; }

.pal-btn {
  min-width: 2.9rem; height: 2.9rem; border-radius: 0.6rem;
  border: 1px solid #d1d5db; display: inline-flex; align-items: center; justify-content: center;
  font-size: 1rem; transition: all 0.12s;
}
.dark .pal-btn { border-color: #4b5563; }
.pal-btn .bravura { font-size: 1.9rem; line-height: 1; transform: translateY(0.55rem); }
#rest-btn .bravura, .tup-btn .bravura, .pal-btn .rest-glyph { transform: none; }
#palette .rest-glyph { display: none; }
#palette [data-dur="1"] .rest-glyph, #palette [data-dur="2"] .rest-glyph { position: relative; }
#palette [data-dur="1"] .rest-glyph::before, #palette [data-dur="2"] .rest-glyph::before {
  content: ''; position: absolute; left: -0.3em; right: -0.3em; top: 0.5em; height: 1px; background: currentColor;
}
#palette.rest-mode .note-glyph { display: none; }
#palette.rest-mode .rest-glyph { display: inline-block; }
.tup-btn .bravura { font-size: 1.5rem; }
.pal-btn * { pointer-events: none; }
.pal-btn.sel { background: #3b82f6; border-color: #3b82f6; color: #fff; }
.pal-btn[data-dur] { touch-action: none; }
.pal-btn:disabled { opacity: 0.35; }
.pal-btn:focus:not(:focus-visible) { outline: none; }
.pal-btn:focus-visible { outline: 2px solid #3b82f6; outline-offset: 2px; }
.pal-drag-ghost { position: fixed; z-index: 70; pointer-events: none; color: #111827; opacity: 0.5; }
.dark .pal-drag-ghost { color: #f3f4f6; }
.pal-drag-ghost.snap { opacity: 0.9; }
.tempo-slider { accent-color: #3b82f6; }

.toast {
  position: fixed; bottom: 1.5rem; left: 50%; transform: translateX(-50%);
  background: #111827; color: #fff; padding: 0.6rem 1.1rem; border-radius: 0.75rem;
  font-size: 0.9rem; z-index: 60; opacity: 0; transition: opacity 0.25s; pointer-events: none;
}
.toast.show { opacity: 0.95; }
:root { --color-background-secondary: #f3f4f6; }
