.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.control-group {
  display: grid;
  gap: 8px;
}

.control-label {
  font-size: 11px;
  font-weight: 800;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.header-controls {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
}

.header-select {
  max-width: 100%;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #fff;
  font-family: var(--font-ui);
  font-size: 15px;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 6px;
  outline: none;
  cursor: pointer;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
  transition: background 0.2s;
}

.header-select--root {
  max-width: 75px;
  flex: 0 0 auto;
}

.header-select--type {
  flex: 1;
  min-width: 0;
}

.header-select:hover {
  background: rgba(255, 255, 255, 0.25);
}

.header-select option,
.header-select optgroup {
  color: var(--text);
  background: #fff;
  font-weight: 600;
}

.note-pill,
.degree-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 28px;
  border-radius: 6px;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.03);
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.note-pill {
  min-width: 42px;
  padding: 0 4px;
  font-family: var(--font-ui);
  transition: all 0.2s ease;
  appearance: none;
  -webkit-appearance: none;
}

.degree-pill {
  min-width: 60px;
  padding: 0 8px;
}

.degree-pill__box {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  background: var(--accent-blue);
  border: 1px solid rgba(0, 0, 0, 0.15);
  flex: none;
}

.note-pill.active {
  background: #4a91b5;
  color: #fff;
  border: none;
  box-shadow: inset 0 0 0 1px #3d7a99;
}

.note-pill.is-primary {
  background: #fff;
  color: #4a91b5;
  border: none;
  box-shadow: inset 0 0 0 2px #4a91b5;
}

.degree-pill:hover,
.degree-pill:not(.active):hover {
  background: #f8fafc;
  border-color: rgba(0, 0, 0, 0.15);
}

.degree-pill--reset {
  font-size: 11px;
  font-weight: 700;
  color: #94a3b8;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.08);
}

.degree-pill--reset:hover {
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.2);
  background: #fff5f5 !important;
}

.scroll-instruction {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 800;
  color: var(--accent-blue);
  margin-bottom: 2px;
  padding-right: 4px;
}

.scroll-instruction__icon {
  font-size: 14px;
}

.color-palette-popover {
  position: absolute;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.16);
  border-radius: 12px;
  padding: 14px;
  display: grid;
  grid-template-columns: repeat(6, 28px);
  gap: 12px;
  z-index: 100;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s, visibility 0.15s, transform 0.15s;
  transform: translateY(4px);
}

.color-palette-popover.show {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.color-palette-swatch {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.15);
  transition: transform 0.1s;
}

.color-palette-swatch:hover {
  transform: scale(1.15);
}

.color-palette-swatch.selected {
  border-color: #1b2631;
  box-shadow: 0 0 0 1px #fff inset;
}

.promo-banner {
  padding: 20px 16px;
  border-top: 1px solid rgba(0, 0, 0, 0.05);
  display: grid;
  place-items: center;
}

.promo-card {
  position: relative;
  width: 100%;
  max-width: 320px;
  display: block;
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 8px;
  text-decoration: none;
  box-shadow: 0 4px 12px rgba(24, 37, 48, 0.08);
  transition: opacity 0.2s;
}

.promo-card:hover {
  opacity: 0.85;
}

.promo-card img {
  width: 100%;
  height: auto;
  border-radius: 8px;
  display: block;
}

.promo-card__label {
  position: absolute;
  inset-block-start: 6px;
  inset-inline-end: 6px;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 6px;
  border: 1px solid rgba(0, 0, 0, 0.14);
  color: rgba(0, 0, 0, 0.72);
  background: rgba(255, 255, 255, 0.95);
  border-radius: 4px;
}

.play-fab {
  margin: 0 10px 16px auto;
  width: 48px;
  height: 48px;
  border-radius: 26px;
  background: var(--accent-blue);
  color: #fff;
  display: grid;
  place-items: center;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
  border: none;
  cursor: pointer;
  z-index: 50;
  transition: transform 0.2s;
}

.play-fab:active {
  transform: scale(0.95);
}

.play-fab svg {
  width: 28px;
  height: 28px;
  fill: currentColor;
}

.icon-square-button {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.2s;
}

.icon-square-button:active {
  transform: scale(0.95);
}

.icon-square-button svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
}

.icon-circle-button {
  width: 32px;
  height: 32px;
  border-radius: 16px;
  background: #f0f4f8;
  border: 1px solid rgba(0, 0, 0, 0.05);
  color: var(--muted);
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 18px;
}

.settings-drawer-overlay {
  position: absolute;
  inset: 0;
  z-index: 300;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.settings-drawer-overlay.is-active {
  opacity: 1;
  pointer-events: auto;
}

.settings-drawer {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(85%, 320px);
  background: #fdfdfd;
  box-shadow: -5px 0 25px rgba(0, 0, 0, 0.15);
  transform: translateX(100%);
  transition: transform 0.35s cubic-bezier(0.2, 0, 0, 1);
  display: grid;
  grid-template-rows: auto 1fr;
}

.settings-drawer-overlay.is-active .settings-drawer {
  transform: translateX(0);
}

.settings-drawer__header {
  padding: 24px 20px 16px;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
}

.settings-drawer__title {
  font-size: 18px;
  font-weight: 800;
  color: #1b2631;
}

.settings-drawer__content {
  padding: 20px;
  overflow-y: auto;
  display: grid;
  align-content: start;
  gap: 12px;
}

.setting-card,
.setting-card-button {
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 14px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 4px 8px rgba(24, 37, 48, 0.02);
  transition: all 0.2s ease;
}

.setting-card {
  display: grid;
  gap: 12px;
  padding: 16px;
  align-content: start;
}

.setting-card__label {
  color: #1b2631;
  font-weight: 800;
  font-size: 13px;
  line-height: 1.4;
}

.setting-card-button {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  color: #1b2631;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  text-align: left;
  text-decoration: none;
  appearance: none;
  -webkit-appearance: none;
}

.setting-card-button:hover {
  background: rgba(255, 255, 255, 0.9);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(24, 37, 48, 0.08);
}

.setting-card-button:active {
  transform: scale(0.98);
  background: rgba(255, 255, 255, 0.7);
}

.setting-card-button:disabled {
  opacity: 0.6;
  cursor: default;
  transform: none;
}

.setting-card-button:disabled:hover,
.setting-card-button:disabled:active {
  background: rgba(255, 255, 255, 0.6);
  transform: none;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 4px 8px rgba(24, 37, 48, 0.02);
}

.setting-card-button svg {
  width: 20px;
  height: 20px;
  color: #4a91b5;
  flex-shrink: 0;
}

.setting-inline-note {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
  padding: 0 4px;
}

.toggle-field {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
  cursor: pointer;
}

.toggle-switch {
  position: relative;
  display: inline-grid;
  width: 44px;
  height: 24px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
  margin: 0;
}

.toggle-switch__slider {
  position: absolute;
  inset: 0;
  cursor: pointer;
  background-color: #cbd5e1;
  transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 24px;
}

.toggle-switch__slider::before {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  top: 3px;
  background-color: #fff;
  transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.toggle-switch input:checked + .toggle-switch__slider {
  background-color: #4a91b5;
}

.toggle-switch input:checked + .toggle-switch__slider::before {
  transform: translateX(20px);
}

.setting-select {
  width: 100%;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.1);
  color: #1b2631;
  font-size: 14px;
  font-weight: 800;
  padding: 10px 12px;
  border-radius: 8px;
  outline: none;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.02);
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%234a91b5' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 16px;
  padding-right: 32px;
}

.setting-select--spaced {
  margin-top: 12px;
}

.setting-select option {
  font-weight: 800;
  color: #1b2631;
}

.setting-select:focus {
  border-color: #4a91b5;
  box-shadow: 0 0 0 3px color-mix(in srgb, #4a91b5 20%, transparent);
}

.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 200;
  display: grid;
  place-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.modal-overlay.is-active {
  opacity: 1;
  pointer-events: auto;
}

.staff-modal {
  background: #fff;
  border-radius: 16px;
  padding: 24px;
  width: 95%;
  max-width: 800px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.25);
  transform: translateY(20px);
  transition: transform 0.3s cubic-bezier(0.2, 0.5, 0.1, 1);
  display: grid;
  gap: 16px;
  overflow-x: auto;
}

.modal-overlay.is-active .staff-modal {
  transform: translateY(0);
}

.staff-modal__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.staff-modal__title {
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
}

.staff-modal__notation {
  background: #fdfdfd;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 8px;
  min-height: 154px;
  position: relative;
  overflow-x: auto;
  overflow-y: hidden;
  display: block;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 8px;
  width: fit-content;
  max-width: 100%;
  margin: 0 auto;
}

.staff-modal__actions {
  display: flex;
  justify-content: center;
  width: 100%;
}

.staff-play-button {
  width: 100%;
  max-width: 400px;
  background: var(--accent-blue);
  color: #fff;
  border-radius: 8px;
  padding: 14px;
  font-size: 15px;
  font-weight: 700;
  border: none;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 12px color-mix(in srgb, var(--accent-blue) 30%, transparent);
  transition: all 0.2s ease;
}

@media (min-width: 640px) {
  .settings-drawer {
    border-radius: 12px 0 0 12px;
  }
}
