:root {
  --sav-bg: #060606;
  --sav-panel: #0d0d0d;
  --sav-panel-2: #121212;
  --sav-gold: #d4af37;
  --sav-gold-bright: #f1cf63;
  --sav-gold-border: #b8902f;
  --sav-text: #f3e7c2;
}

.sav-page-bg {
  width: 100%;
  min-height: 100vh;
  background-repeat: no-repeat;
  background-position: center top;
  background-size: 100% auto;
  background-color: #000;
  padding: 64px 0 24px 0;
}

.sav-page-inner {
  width: 100%;
  max-width: 1200px;
  margin: 40px auto;
}

#score-audio-viewer {
  color: var(--sav-text);
  font-family: Arial, Helvetica, sans-serif;
}

.sav-wrapper {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px;
  background: linear-gradient(180deg, var(--sav-bg) 0%, var(--sav-panel) 100%);
  border: 1px solid var(--sav-gold-border);
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
}

.sav-item-selector-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 100%;
  margin-bottom: 18px;
  background: var(--sav-bg);
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid var(--sav-gold-border);
}

.sav-item-selector-wrap label {
  white-space: nowrap;
  color: var(--sav-gold-bright);
  font-size: 0.95rem;
}

.sav-item-selector-wrap select {
  flex: 1;
  background: var(--sav-panel-2);
  color: var(--sav-text);
  border: 1px solid var(--sav-gold-border);
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 0.95rem;
  outline: none;
  cursor: pointer;
}

.sav-nav {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.sav-counter {
  color: var(--sav-gold-bright);
  font-weight: 700;
  letter-spacing: 1px;
  text-align: center;
}

#score-audio-viewer h1,
#score-audio-viewer h2,
#score-audio-viewer h3,
.sav-title {
  margin: 0 0 20px;
  color: var(--sav-gold-bright) !important;
  font-size: 28px;
  text-transform: uppercase;
  text-align: center;
  font-weight: 700;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

.sav-pdf {
  margin-bottom: 24px;
  width: 100%;
  box-sizing: border-box;
}

/* Base Wrapper Rules */
#sav-pdf-wrapper.sav-pdf-scroll-wrapper {
  width: 100%;
  min-height: 350px;
  border: 1px solid var(--sav-gold-border);
  border-radius: 10px;
  background: #111;
  overflow: hidden;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  position: relative;
}

#sav-pdf-canvas {
  display: block;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  margin: 0 auto;
}

.sav-audio-panel {
  padding: 20px;
  background: var(--sav-bg);
  border: 1px solid var(--sav-gold-border);
  border-radius: 12px;
}

.sav-audio-header {
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  width: 100%;
  margin-bottom: 10px;
}

.sav-audio-panel .sav-audio-header label {
  display: inline-block;
  margin-bottom: 0;
  color: var(--sav-gold-bright);
  font-weight: 700;
  font-size: 0.95rem;
}

.sav-audio-shortcut {
  color: var(--sav-gold-bright);
  font-size: 0.9rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
}

.sav-kbd {
  background: linear-gradient(180deg, #fff0a6 0%, #f1cf63 38%, #e2bd4f 70%, #d4af37 100%);
  color: #111;
  padding: 2px 10px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.85rem;
  font-family: inherit;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
  border: 1px solid #e2bd4f;
  display: inline-block;
  line-height: 1.2;
}

#sav-audio-select {
  width: 100%;
  height: 48px;
  padding: 0 14px;
  margin-bottom: 18px;
  border: 1px solid var(--sav-gold-border);
  border-radius: 8px;
  background: var(--sav-panel-2);
  color: var(--sav-text);
  font-size: 16px;
  outline: none;
}

#sav-audio {
  width: 100%;
  margin-bottom: 20px;
  accent-color: var(--sav-gold);
}

.sav-bpm {
  margin-top: 8px;
}

#sav-bpm-label {
  color: var(--sav-gold-bright);
  font-weight: 700;
  margin-left: 8px;
}

.sav-bpm-range {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--sav-gold-bright);
  font-size: 14px;
  margin-top: 8px;
}

.sav-nav button,
.sav-btn {
  padding: 12px 24px;
  border: 1px solid #e2bd4f;
  border-radius: 999px;
  background: linear-gradient(180deg, #fff0a6 0%, #f1cf63 38%, #e2bd4f 70%, #d4af37 100%);
  color: #111;
  font-weight: 700;
  cursor: pointer;
}

.sav-nav button:disabled,
.sav-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* Slider Base Reset */
#sav-speed {
  -webkit-appearance: none !important;
  -moz-appearance: none !important;
  appearance: none !important;
  width: 100%;
  height: 2px !important;
  background: #3e3f42 !important; /* Single thin gray line */
  background-image: none !important; /* Clears OS-level background gradients */
  border-radius: 1px;
  border: none !important;
  outline: none;
  margin: 20px 0 10px;
  padding: 0 !important;
  cursor: pointer;
  box-shadow: none !important;
}

/* Chrome / Safari / Edge Track Override */
#sav-speed::-webkit-slider-runnable-track {
  -webkit-appearance: none !important;
  height: 2px !important;
  background: #3e3f42 !important;
  background-image: none !important;
  border: none !important;
  box-shadow: none !important;
  border-radius: 1px;
}

/* Remove default lower/upper track fills (resolves shadow/secondary line artifacts) */
#sav-speed::-webkit-slider-thumb-lower-track,
#sav-speed::-webkit-slider-thumb-upper-track {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

/* Chrome / Safari / Edge Thumb */
#sav-speed::-webkit-slider-thumb {
  -webkit-appearance: none !important;
  appearance: none !important;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #f1ce59 !important;
  border: 3px solid #000000 !important; /* Black ring radius */
  cursor: pointer;
  margin-top: -8px !important; /* Vertically centers 18px thumb on 2px track */
  box-shadow: 0 0 8px rgba(241, 206, 89, 0.8) !important;
}

/* Firefox Track Override */
#sav-speed::-moz-range-track {
  height: 2px !important;
  background: #3e3f42 !important;
  border: none !important;
  box-shadow: none !important;
  border-radius: 1px;
}

#sav-speed::-moz-range-progress {
  background: transparent !important;
}

/* Firefox Thumb */
#sav-speed::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #f1ce59 !important;
  border: 3px solid #000000 !important;
  cursor: pointer;
  box-sizing: border-box;
  box-shadow: 0 0 8px rgba(241, 206, 89, 0.8) !important;
}

/* Speed Label Header Styling */
.sav-speed-label {
  display: block;
  color: var(--sav-gold-bright) !important; /* Forces bright gold on the entire text */
  font-size: 0.95rem;                       /* Matches the right-side text size */
  font-weight: 700;
  margin-bottom: 8px;
}

.sav-speed-title {
  color: var(--sav-gold-bright) !important; /* Explicitly overrides any dark default text color */
  font-weight: 700;
  margin-right: 4px;
}

#sav-speed-val {
  color: var(--sav-gold-bright) !important;
  font-weight: 800;
}

/* Tablet (iPad) Responsive Breakpoint */
@media screen and (min-width: 768px) and (max-width: 1024px) {
  .sav-wrapper {
    padding: 20px;
  }

  .sav-title {
    font-size: 24px;
  }

  #sav-pdf-wrapper.sav-pdf-scroll-wrapper {
    height: auto !important;
    min-height: auto !important;
    max-height: none !important;
    padding: 16px;
  }

  #sav-pdf-canvas {
    width: 100% !important;
    max-width: 720px !important;
    height: auto !important;
  }
}

/* Hide keyboard shortcut hints on any touch-primary device */
@media (pointer: coarse) {
  .sav-audio-shortcut {
    display: none !important;
  }
	
  .sav-search-shortcut-hint {
    display: none !important;
  }
}

/* Mobile Portrait Rules Target */
@media screen and (max-width: 767px) and (orientation: portrait) {
  .sav-page-inner {
    margin: 10px auto;
  }

  .sav-wrapper {
    padding: 12px;
  }

  .sav-title {
    font-size: 20px;
    margin-bottom: 12px;
  }

  .sav-nav {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .sav-nav button {
    width: 100%;
  }

  #sav-pdf-wrapper.sav-pdf-scroll-wrapper,
  #sav-pdf-wrapper.sav-ios-tall-pdf {
    width: 100% !important;
    height: 55dvh !important;
    min-height: 360px !important;
    max-height: 600px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-sizing: border-box !important;
  }

  #sav-pdf-canvas {
    width: 100% !important;
    height: auto !important;
    max-width: 100% !important;
    max-height: 100% !important;
    display: block !important;
  }

  .sav-audio-shortcut {
    display: none;
  }
}

/*This is for the BPM handling*/

/* Header Alignment */
.sav-speed-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-bottom: 16px;
}

#sav-speed-title-label {
  color: var(--sav-gold-bright);
  font-size: 1.05rem;
  font-weight: 700;
}

.sav-speed-shortcut {
  color: var(--sav-gold-bright);
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Centralized Button Box */
.sav-speed-control-box {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin: 10px auto 20px;
}

.sav-speed-btn {
  background: transparent;
  border: 1px solid var(--sav-gold-border);
  border-radius: 8px;
  color: var(--sav-gold-bright);
  width: 54px;
  height: 44px;
  font-size: 1.4rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, border-color 0.2s;
}

.sav-speed-btn:hover {
  background: rgba(212, 175, 55, 0.15);
  border-color: var(--sav-gold-bright);
}

.sav-speed-divider {
  width: 1px;
  height: 28px;
  background-color: rgba(212, 175, 55, 0.3);
}

.sav-bpm-display {
  color: var(--sav-gold-bright);
  font-size: 1.35rem;
  font-weight: 800;
  min-width: 90px;
  text-align: center;
}

/* Screen reader only utility class */
.sav-sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* Desktop-only visibility for keyboard hint */
@media screen and (max-width: 1024px), (pointer: coarse) {
  .sav-speed-shortcut {
    display: none !important;
  }
}

/*Added Accesibility features*/

/* Clear, high-contrast focus rings for keyboard navigation (Tab key) */
#score-audio-viewer :focus-visible {
  outline: 2px solid var(--sav-gold-bright) !important;
  outline-offset: 3px !important;
  box-shadow: 0 0 10px rgba(241, 207, 99, 0.7) !important;
  border-radius: 4px;
}

/* Button-specific Focus Enhancements */
.sav-btn:focus-visible,
.sav-nav button:focus-visible {
  border-radius: 999px;
  outline-offset: 4px !important;
  box-shadow: 0 0 12px rgba(241, 207, 99, 0.9), inset 0 0 4px #ffffff !important;
}

/* Select Dropdowns Focus Styling */
.sav-item-selector-wrap select:focus-visible,
#sav-audio-select:focus-visible {
  border-color: var(--sav-gold-bright) !important;
  background-color: #1a1a1a !important;
}

/* BPM Speed Range Slider Focus Styling */
#sav-speed:focus-visible::-webkit-slider-thumb {
  box-shadow: 0 0 0 3px #000, 0 0 0 5px var(--sav-gold-bright), 0 0 12px rgba(241, 207, 99, 1) !important;
}

#sav-speed:focus-visible::-moz-range-thumb {
  box-shadow: 0 0 0 3px #000, 0 0 0 5px var(--sav-gold-bright), 0 0 12px rgba(241, 207, 99, 1) !important;
}

/* Using existing CSS custom properties */
.sav-speed-btn:focus,
.sav-speed-btn:focus-visible,
.sav-speed-btn:active {
  background-color: transparent !important;
  outline: none !important; /* Removes native blue browser outline */
  box-shadow: none !important; /* Removes native webkit inset blue glow */
  border-color: #f1cf63 !important; /* Keeps border gold */
  -webkit-tap-highlight-color: transparent; /* Prevents mobile webkit blue flash */
}

/* Optional gold custom focus ring if focus state is needed for WCAG accessibility */
.sav-speed-btn:focus-visible {
  box-shadow: 0 0 0 2px #f1cf63 !important;
}

/* New searchbar css*/

/* Top shortcut indicator header */
.sav-search-shortcut-hint {
  text-align: right;
  color: #f1cf63;
  font-size: 0.85rem;
  margin-bottom: 6px;
}

/* Search Container & Inputs */
/*
.sav-search-container {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}
*/

.sav-search-container,
.sav-select-container {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
}

.sav-search-input-wrap {
  position: relative;
  flex: 1;
}

#sav-search-input {
  width: 100%;
  background: #000;
  color: #fff;
  border: 1px solid #f1cf63;
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 0.95rem;
  box-sizing: border-box;
}

#sav-search-input:focus,
#sav-search-input:focus-visible {
  outline: 2px solid #f1cf63 !important;
  outline-offset: 1px;
  box-shadow: 0 0 8px rgba(241, 207, 99, 0.3) !important;
}

/* Autocomplete Floating Dropdown */
.sav-autocomplete-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #111;
  border: 1px solid #f1cf63;
  border-radius: 6px;
  max-height: 220px;
  overflow-y: auto;
  margin: 4px 0 0 0;
  padding: 0;
  list-style: none;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0,0,0,0.8);
}

.sav-dropdown-item {
  padding: 8px 12px;
  color: #fff;
  cursor: pointer;
  border-bottom: 1px solid rgba(241, 207, 99, 0.15);
}

.sav-dropdown-item:last-child {
  border-bottom: none;
}

.sav-dropdown-item:hover,
.sav-dropdown-item:focus {
  background: rgba(241, 207, 99, 0.2);
  color: #f1cf63;
}

.sav-dropdown-item.sav-dropdown-active {
  background: rgba(241, 207, 99, 0.3) !important;
  color: #f1cf63 !important;
  outline: 1px solid #f1cf63;
}

.sav-no-results {
  padding: 8px 12px;
  color: #888;
  font-style: italic;
}

.sav-search-container label,
.sav-select-container label {
  min-width: 100px; /* Aligns both labels cleanly */
}