:root {
  --ink: #222938;
  --ink-soft: #374151;
  --muted: #647087;
  --line: rgba(205, 173, 28, 0.28);
  --line-strong: rgba(210, 167, 0, 0.55);
  --sun: #f6d100;
  --sun-soft: #fff3b8;
  --paper: #fffef8;
  --panel: rgba(255, 255, 255, 0.95);
  --panel-soft: rgba(255, 253, 245, 0.9);
  --green: #16a34a;
  --green-soft: rgba(22, 163, 74, 0.12);
  --amber: #d97706;
  --amber-dark: #b45309;
  --danger: #c8533e;
  --shadow-sm: 0 2px 8px rgba(105, 87, 16, 0.06);
  --shadow-md: 0 6px 20px rgba(105, 87, 16, 0.09);
  --shadow-lg: 0 12px 36px rgba(105, 87, 16, 0.14);
  --font-body: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "Space Grotesk", ui-monospace, Menlo, monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  background:
    radial-gradient(circle at 90% 5%, rgba(246, 209, 0, 0.22), transparent 22rem),
    linear-gradient(160deg, #fffdf8 0%, #fff9de 55%, #fae69e 100%);
  color: var(--ink);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  touch-action: manipulation;
}

button, input {
  font: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

/* Main Container Frame: Mobile-First */
.trainer-app {
  max-width: 480px;
  min-height: 100vh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  position: relative;
  background: var(--paper);
  box-shadow: 0 0 32px rgba(90, 72, 8, 0.1);
  overflow-x: hidden;
}

/* App Topbar */
.app-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-icon {
  font-size: 1.5rem;
  line-height: 1;
}

.brand-title {
  font-family: var(--font-mono);
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: -0.02em;
  line-height: 1.15;
}

/* Main Content Area */
.trainer-content {
  flex: 1;
  padding: 12px 14px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Prominent Style Selector Banner */
.style-selector-banner {
  width: 100%;
}

.style-selector-bar {
  display: flex;
  align-items: stretch;
  gap: 8px;
  width: 100%;
}

.style-nav-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  min-width: 48px;
  background: linear-gradient(135deg, #ffffff 0%, #fffdec 100%);
  border: 1.5px solid var(--line-strong);
  border-radius: 14px;
  box-shadow: 0 3px 10px rgba(105, 87, 16, 0.08);
  color: #554100;
  cursor: pointer;
  transition: all 0.15s ease;
}

.style-nav-btn:hover {
  background: #fff8cb;
  border-color: #b45309;
  transform: translateY(-1px);
}

.style-nav-btn:active {
  transform: scale(0.94);
}

.style-selector-btn {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: linear-gradient(135deg, #ffffff 0%, #fffdec 100%);
  border: 1.5px solid var(--line-strong);
  border-radius: 14px;
  box-shadow: 0 3px 12px rgba(105, 87, 16, 0.08);
  transition: all 0.15s ease;
  text-align: left;
  cursor: pointer;
}

.style-selector-btn:hover {
  background: #fff8cb;
  border-color: #b45309;
}

.style-selector-btn:active {
  transform: scale(0.985);
}

.style-selector-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.style-tag-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.style-family-tag {
  font-family: var(--font-mono);
  font-size: 0.70rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #b45309;
}

.style-tier-badge {
  font-family: var(--font-mono);
  font-size: 0.60rem;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 6px;
  letter-spacing: 0.05em;
  line-height: 1.3;
}

.style-tier-badge.is-pro {
  color: #b45309;
  background: #fef3c7;
  border: 1px solid #fde68a;
}

.style-name-title {
  font-family: var(--font-mono);
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: -0.01em;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.style-selector-right {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 9px;
  background: var(--sun-soft);
  border: 1px solid rgba(210, 167, 0, 0.4);
  border-radius: 10px;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 800;
  color: #554100;
  white-space: nowrap;
  flex-shrink: 0;
}

.style-chevron {
  font-size: 0.65rem;
  transition: transform 0.2s ease;
}

/* Active Instrument Mute / Unmute Toggles: Interactive Drum Kit */
.instruments-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 12px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.instruments-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2px;
}

.instruments-title-group {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.instruments-title {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink);
}

.instruments-subtitle {
  font-size: 0.65rem;
  color: var(--muted);
  font-weight: 600;
}

.instruments-hint {
  font-size: 0.68rem;
  color: #9ca3af;
  font-weight: 500;
}

/* SVG Drum Kit Stage Container */
.drum-kit-container {
  width: 100%;
  background: linear-gradient(145deg, #ffffff 0%, #fffdec 60%, #fff9d6 100%);
  border: 1.5px solid var(--line-strong);
  border-radius: 14px;
  padding: 8px 6px;
  box-shadow: 0 4px 14px rgba(105, 87, 16, 0.08), inset 0 1px 2px rgba(255, 255, 255, 0.9);
  overflow: hidden;
}

.drum-kit-svg {
  width: 100%;
  height: auto;
  display: block;
  user-select: none;
  touch-action: manipulation;
}

/* Drum Kit Interactive Parts */
.drum-kit-part {
  cursor: pointer;
  outline: none;
  transform-box: fill-box;
  transform-origin: center center;
  transition: transform 0.12s cubic-bezier(0.34, 1.56, 0.64, 1), filter 0.15s ease;
}

.drum-kit-part:focus-visible {
  filter: drop-shadow(0 0 8px #f59e0b);
}

.drum-label {
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 800;
  text-anchor: middle;
  dominant-baseline: central;
  fill: #ffffff;
  letter-spacing: 0.04em;
  pointer-events: none;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.55));
}

.kick-label {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.06em;
}

.cowbell-label, .stick-label {
  font-size: 7px;
}

.clap-icon-symbol {
  font-size: 9px;
  text-anchor: middle;
  dominant-baseline: central;
  pointer-events: none;
}

/* ==============================================
   STATE 1: ACTIVE (Used and playing in pattern)
   Green illuminated aesthetic
   ============================================== */
.drum-kit-part.is-active {
  filter: drop-shadow(0 3px 6px rgba(22, 163, 74, 0.35)) drop-shadow(0 1px 2px rgba(34, 41, 56, 0.1));
}

.drum-kit-part.is-active:hover {
  transform: scale(1.035);
  filter: drop-shadow(0 5px 12px rgba(22, 163, 74, 0.55)) drop-shadow(0 2px 4px rgba(34, 41, 56, 0.15));
}

.drum-kit-part.is-active .drum-hoop {
  fill: url(#chromeHoop);
  stroke: #475569;
  stroke-width: 1.5;
}

.drum-kit-part.is-active .drum-head {
  fill: url(#greenHeadGrad);
  stroke: #15803d;
  stroke-width: 1.8;
}

.drum-kit-part.is-active .drum-lug {
  fill: url(#chromeLug);
  stroke: #334155;
  stroke-width: 0.8;
}

.drum-kit-part.is-active .cymbal-outer {
  fill: url(#greenCymbalGrad);
  stroke: #047857;
  stroke-width: 1.8;
}

.drum-kit-part.is-active .cymbal-ring {
  stroke: rgba(255, 255, 255, 0.4);
  stroke-width: 1;
}

.drum-kit-part.is-active .cymbal-bell {
  fill: #34d399;
  stroke: #064e3b;
  stroke-width: 1.5;
}

.drum-kit-part.is-active .kick-outer-hoop {
  fill: url(#mapleHoop);
  stroke: #451a03;
  stroke-width: 2.5;
}

.drum-kit-part.is-active .kick-inner-rim {
  fill: url(#chromeHoop);
  stroke: #334155;
  stroke-width: 1.2;
}

.drum-kit-part.is-active .kick-head {
  fill: url(#greenHeadGrad);
  stroke: #166534;
  stroke-width: 2;
}

.drum-kit-part.is-active .kick-port-hole {
  fill: #0b111a;
  stroke: rgba(255, 255, 255, 0.35);
  stroke-width: 1.5;
}

.drum-kit-part.is-active .cowbell-shape {
  fill: url(#greenHeadGrad);
  stroke: #15803d;
  stroke-width: 1.8;
}

.drum-kit-part.is-active .cowbell-spine {
  stroke: #34d399;
}

.drum-kit-part.is-active .pad-bezel {
  fill: #1e293b;
  stroke: #475569;
  stroke-width: 1.5;
}

.drum-kit-part.is-active .pad-surface {
  fill: url(#greenHeadGrad);
  stroke: #15803d;
  stroke-width: 1.5;
}

.drum-kit-part.is-active .stick-block {
  fill: url(#greenHeadGrad);
  stroke: #15803d;
  stroke-width: 1.8;
}

.drum-kit-part.is-active .drum-label {
  fill: #ffffff;
}

/* ==============================================
   STATE 2: MUTED (Switched off by user)
   Red glowing / warning aesthetic
   ============================================== */
.drum-kit-part.is-muted {
  filter: drop-shadow(0 3px 6px rgba(220, 38, 38, 0.38)) drop-shadow(0 1px 2px rgba(34, 41, 56, 0.1));
}

.drum-kit-part.is-muted:hover {
  transform: scale(1.035);
  filter: drop-shadow(0 5px 12px rgba(220, 38, 38, 0.58)) drop-shadow(0 2px 4px rgba(34, 41, 56, 0.15));
}

.drum-kit-part.is-muted .drum-hoop {
  fill: url(#chromeHoop);
  stroke: #475569;
  stroke-width: 1.5;
}

.drum-kit-part.is-muted .drum-head {
  fill: url(#redHeadGrad);
  stroke: #b91c1c;
  stroke-width: 1.8;
}

.drum-kit-part.is-muted .drum-lug {
  fill: url(#chromeLug);
  stroke: #334155;
  stroke-width: 0.8;
}

.drum-kit-part.is-muted .cymbal-outer {
  fill: url(#redCymbalGrad);
  stroke: #b91c1c;
  stroke-width: 1.8;
}

.drum-kit-part.is-muted .cymbal-ring {
  stroke: rgba(255, 255, 255, 0.4);
  stroke-width: 1;
}

.drum-kit-part.is-muted .cymbal-bell {
  fill: #f87171;
  stroke: #7f1d1d;
  stroke-width: 1.5;
}

.drum-kit-part.is-muted .kick-outer-hoop {
  fill: url(#mapleHoop);
  stroke: #451a03;
  stroke-width: 2.5;
}

.drum-kit-part.is-muted .kick-inner-rim {
  fill: url(#chromeHoop);
  stroke: #334155;
  stroke-width: 1.2;
}

.drum-kit-part.is-muted .kick-head {
  fill: url(#redHeadGrad);
  stroke: #991b1b;
  stroke-width: 2;
}

.drum-kit-part.is-muted .kick-port-hole {
  fill: #2a0808;
  stroke: rgba(255, 255, 255, 0.35);
  stroke-width: 1.5;
}

.drum-kit-part.is-muted .cowbell-shape {
  fill: url(#redHeadGrad);
  stroke: #b91c1c;
  stroke-width: 1.8;
}

.drum-kit-part.is-muted .cowbell-spine {
  stroke: #fca5a5;
}

.drum-kit-part.is-muted .pad-bezel {
  fill: #1e293b;
  stroke: #475569;
  stroke-width: 1.5;
}

.drum-kit-part.is-muted .pad-surface {
  fill: url(#redHeadGrad);
  stroke: #b91c1c;
  stroke-width: 1.5;
}

.drum-kit-part.is-muted .stick-block {
  fill: url(#redHeadGrad);
  stroke: #b91c1c;
  stroke-width: 1.8;
}

.drum-kit-part.is-muted .drum-label {
  fill: #ffffff;
}

/* ==============================================
   STATE 3: UNUSED (Not present in groove)
   Gray subdued / dimmed aesthetic
   ============================================== */
.drum-kit-part.is-unused {
  opacity: 0.38;
  cursor: not-allowed;
  filter: drop-shadow(0 1px 3px rgba(34, 41, 56, 0.08));
}

.drum-kit-part.is-unused .drum-hoop {
  fill: #cbd5e1;
  stroke: #94a3b8;
  stroke-width: 1;
}

.drum-kit-part.is-unused .drum-head {
  fill: url(#grayHeadGrad);
  stroke: #cbd5e1;
  stroke-width: 1.2;
}

.drum-kit-part.is-unused .drum-lug {
  fill: #cbd5e1;
  stroke: #94a3b8;
  stroke-width: 0.6;
}

.drum-kit-part.is-unused .cymbal-outer {
  fill: url(#grayCymbalGrad);
  stroke: #94a3b8;
  stroke-width: 1.2;
}

.drum-kit-part.is-unused .cymbal-ring {
  stroke: rgba(148, 163, 184, 0.4);
  stroke-width: 1;
}

.drum-kit-part.is-unused .cymbal-bell {
  fill: #cbd5e1;
  stroke: #94a3b8;
  stroke-width: 1;
}

.drum-kit-part.is-unused .kick-outer-hoop {
  fill: #94a3b8;
  stroke: #64748b;
  stroke-width: 2;
}

.drum-kit-part.is-unused .kick-inner-rim {
  fill: #cbd5e1;
  stroke: #94a3b8;
  stroke-width: 1;
}

.drum-kit-part.is-unused .kick-head {
  fill: url(#grayHeadGrad);
  stroke: #cbd5e1;
  stroke-width: 1.5;
}

.drum-kit-part.is-unused .kick-port-hole {
  fill: #64748b;
  stroke: #94a3b8;
  stroke-width: 1;
}

.drum-kit-part.is-unused .cowbell-shape {
  fill: url(#grayHeadGrad);
  stroke: #cbd5e1;
  stroke-width: 1.2;
}

.drum-kit-part.is-unused .cowbell-spine {
  stroke: #cbd5e1;
}

.drum-kit-part.is-unused .pad-bezel {
  fill: #94a3b8;
  stroke: #64748b;
  stroke-width: 1;
}

.drum-kit-part.is-unused .pad-surface {
  fill: url(#grayHeadGrad);
  stroke: #cbd5e1;
  stroke-width: 1.2;
}

.drum-kit-part.is-unused .stick-block {
  fill: url(#grayHeadGrad);
  stroke: #cbd5e1;
  stroke-width: 1.2;
}

.drum-kit-part.is-unused .drum-label {
  fill: #475569;
  filter: none;
}

/* Real-Time Live Playback Hit Pulse */
.drum-kit-part.is-hit {
  transform: scale(1.08);
  filter: brightness(1.45) drop-shadow(0 0 18px rgba(74, 222, 128, 0.95)) !important;
}

/* Shake Animation on Unused Drum Tap */
.drum-kit-part.shake {
  animation: drumShake 0.28s ease-in-out;
}

@keyframes drumShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

/* Drum Kit Legend */
.drum-kit-legend {
  display: flex;
  align-items: center;
  justify-content: space-around;
  gap: 8px;
  padding: 6px 12px;
  background: rgba(246, 209, 0, 0.14);
  border-radius: 8px;
  border: 1px solid rgba(214, 181, 23, 0.22);
}

.legend-item {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--ink-soft);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.legend-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
}

.dot-active {
  background: #16a34a;
  box-shadow: 0 0 4px #16a34a;
}

.dot-muted {
  background: #dc2626;
  box-shadow: 0 0 4px #dc2626;
}

.dot-unused {
  background: #94a3b8;
}

/* Count-In Banner */
.count-in-banner {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 10px 14px;
  background: linear-gradient(135deg, rgba(255, 250, 224, 0.96), rgba(254, 243, 199, 0.92));
  border: 1.5px solid rgba(217, 119, 6, 0.45);
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(180, 130, 10, 0.12);
  animation: countInFadeIn 0.16s ease-out;
}

.count-in-banner.active {
  display: flex;
}

@keyframes countInFadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.count-in-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: #fff;
  border: 1px solid rgba(217, 119, 6, 0.35);
  border-radius: 16px;
}

.count-in-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--amber);
  animation: countDotPulse 0.45s ease-in-out infinite alternate;
}

@keyframes countDotPulse {
  from { transform: scale(0.8); opacity: 0.6; }
  to { transform: scale(1.25); opacity: 1; }
}

.count-in-label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--amber-dark);
}

.count-in-digits {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.count-digit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  font-family: var(--font-mono);
  font-size: 1.7rem;
  font-weight: 800;
  color: #94a3b8;
  background: rgba(255, 255, 255, 0.85);
  border: 2px solid rgba(203, 213, 225, 0.7);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
  transition: all 0.1s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.count-digit.active {
  color: #fff;
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  border-color: #b45309;
  box-shadow: 0 4px 14px rgba(217, 119, 6, 0.55), 0 0 0 3px rgba(245, 158, 11, 0.28);
  transform: scale(1.15);
  z-index: 2;
}

.count-digit.passed {
  color: var(--green);
  background: rgba(220, 252, 231, 0.95);
  border-color: rgba(22, 163, 74, 0.55);
  transform: scale(0.96);
}

/* Notation Score Card */
.notation-card {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.notation-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(214, 181, 23, 0.2);
  padding-bottom: 6px;
}

.score-label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.loop-indicator {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  color: #7b6200;
  background: var(--sun-soft);
  padding: 2px 8px;
  border-radius: 6px;
}

.notation-wrapper {
  overflow-x: auto;
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: #ffffff;
}

.osmd-container {
  width: 100%;
}

/* Notehead Active Highlighting - strictly isolate notehead elements so stems and beams are protected */
.vf-notehead.played,
.vf-notehead.played path,
.vf-notehead.played polygon,
.vf-notehead.played ellipse,
.vf-notehead.played circle,
g.notehead.played,
g.notehead.played path,
g.notehead.played polygon,
g.notehead.played ellipse,
g.notehead.played circle,
path.vf-notehead.played {
  fill: #16a34a !important;
  stroke: #16a34a !important;
  transition: fill 0.06s ease;
}

/* Practice Tempo & Practice Loop Card */
.trainer-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tempo-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.tempo-left {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.swing-badge {
  display: inline-flex;
  align-items: center;
  padding: 5px 12px;
  background: linear-gradient(135deg, #ffffff 0%, #fffdec 100%);
  border: 1.5px solid var(--line-strong);
  border-radius: 10px;
  box-shadow: 0 1px 4px rgba(184, 144, 0, 0.12);
  transition: all 0.15s ease;
}

.swing-badge.has-swing {
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
  border-color: #d97706;
  box-shadow: 0 2px 6px rgba(217, 119, 6, 0.18);
}

.swing-label {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  font-weight: 700;
  color: #634f00;
  letter-spacing: -0.01em;
}

.swing-badge.has-swing .swing-label {
  color: #92400e;
  font-weight: 800;
}

.tempo-title {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.bpm-badge {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  padding: 4px 10px;
  background: linear-gradient(135deg, #ffffff, #fffdec);
  border: 1.5px solid var(--line-strong);
  border-radius: 10px;
  box-shadow: 0 1px 4px rgba(184, 144, 0, 0.12);
}

.bpm-number {
  font-family: var(--font-mono);
  font-size: 1.35rem;
  font-weight: 800;
  color: #634f00;
  line-height: 1;
}

.bpm-unit {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
}

/* BPM Range Slider */
.bpm-slider-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 4px;
}

.slider-min, .slider-max {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
  width: 24px;
  text-align: center;
}

.bpm-range-slider {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 8px;
  border-radius: 4px;
  background: rgba(214, 181, 23, 0.28);
  outline: none;
}

.bpm-range-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f6d100 0%, #d97706 100%);
  border: 2px solid #ffffff;
  box-shadow: 0 2px 8px rgba(217, 119, 6, 0.4);
  cursor: pointer;
  transition: transform 0.1s ease;
}

.bpm-range-slider::-webkit-slider-thumb:active {
  transform: scale(1.18);
}

/* Loop Mode Selector */
.loop-mode-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 4px;
  border-top: 1px solid rgba(214, 181, 23, 0.2);
}

.loop-mode-label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
}

.segmented-control {
  display: inline-flex;
  gap: 2px;
  padding: 2px;
  background: rgba(214, 181, 23, 0.2);
  border-radius: 8px;
}

.seg-btn {
  padding: 6px 10px;
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--ink);
  transition: all 0.12s ease;
}

.seg-btn.active {
  background: #ffffff;
  color: #554100;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

/* Bottom Spacer */
.bottom-spacer {
  height: 80px;
}

/* Sticky Bottom Transport Bar */
.sticky-transport-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 30;
  display: flex;
  justify-content: center;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--line-strong);
  box-shadow: 0 -4px 20px rgba(90, 72, 8, 0.1);
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom, 0px));
}

.transport-inner {
  width: 100%;
  max-width: 480px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.transport-toggle-btn {
  flex: 1;
  height: 52px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid rgba(214, 181, 23, 0.38);
  color: var(--muted);
  transition: all 0.12s ease;
}

.transport-toggle-btn.active {
  background: var(--sun-soft);
  border-color: rgba(210, 167, 0, 0.88);
  color: #554100;
  box-shadow: 0 2px 6px rgba(184, 144, 0, 0.15);
}

.transport-toggle-btn:active {
  transform: scale(0.94);
}

.transport-icon {
  font-size: 1.15rem;
  line-height: 1;
}

.transport-svg-icon {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  display: block;
  transition: transform 0.15s ease;
}

.transport-toggle-btn.active .transport-svg-icon {
  transform: scale(1.08);
}

.transport-label {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 700;
}

.transport-play-btn {
  flex: 1.5;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 28px;
  background: linear-gradient(135deg, #2b394e 0%, #1e2837 100%);
  color: #ffffff;
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  box-shadow: 0 4px 14px rgba(35, 45, 60, 0.3);
  transition: all 0.13s ease;
}

.transport-play-btn:active {
  transform: scale(0.96);
}

.transport-play-btn.playing {
  background: linear-gradient(135deg, #c8533e 0%, #991b1b 100%);
  box-shadow: 0 4px 16px rgba(200, 83, 62, 0.4);
}

.play-icon {
  font-size: 1.1rem;
  line-height: 1;
}

/* Styles Library Drawer / Bottom Sheet */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px);
  z-index: 40;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
}

.drawer-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.styles-drawer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-width: 480px;
  margin: 0 auto;
  max-height: 82vh;
  background: #ffffff;
  border-top-left-radius: 20px;
  border-top-right-radius: 20px;
  box-shadow: var(--shadow-lg);
  z-index: 50;
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform 0.24s cubic-bezier(0.32, 0.72, 0, 1);
}

.styles-drawer.open {
  transform: translateY(0);
}

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 12px;
  border-bottom: 1px solid rgba(214, 181, 23, 0.25);
}

.drawer-title-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.drawer-title {
  font-family: var(--font-mono);
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--ink);
}

.drawer-count {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
}

.drawer-close-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.05);
  display: grid;
  place-items: center;
  font-size: 1.4rem;
  color: var(--muted);
  line-height: 1;
}

.drawer-close-btn:active {
  background: rgba(0, 0, 0, 0.1);
}

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px 36px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Category Group in Drawer */
.drawer-category-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.drawer-category-title {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 800;
  color: #7b6200;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 4px 6px;
}

.drawer-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: #ffffff;
  border: 1px solid rgba(214, 181, 23, 0.3);
  border-radius: 10px;
  transition: all 0.12s ease;
  text-align: left;
}

.drawer-item:active {
  transform: scale(0.98);
}

.drawer-item.active {
  background: var(--sun-soft);
  border-color: #c99b00;
  box-shadow: 0 2px 8px rgba(184, 144, 0, 0.16);
}

.drawer-item-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.drawer-item-title {
  font-family: var(--font-mono);
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--ink);
}

.drawer-item-subtitle {
  font-size: 0.7rem;
  color: var(--muted);
}

.drawer-item-bpm {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 800;
  color: #554100;
  background: rgba(246, 209, 0, 0.25);
  padding: 3px 8px;
  border-radius: 6px;
}

/* PRO Access & Feature Badges in Drawer */
.drawer-item-title-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.drawer-lock-pill {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 800;
  color: #92400e;
  background: #fef3c7;
  border: 1px solid #fcd34d;
  padding: 1.5px 6px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.drawer-item.is-locked {
  background: #fffdf7;
  border-color: rgba(245, 158, 11, 0.4);
}

.drawer-item.is-locked:hover {
  background: #fffbeb;
  border-color: #f59e0b;
}

.seg-pro-badge {
  font-size: 0.58rem;
  font-weight: 800;
  color: #d97706;
  background: #fef3c7;
  border: 1px solid #fcd34d;
  padding: 1px 4px;
  border-radius: 4px;
  margin-left: 3px;
  vertical-align: middle;
}

/* Jams&Study PRO In-App Modal */
.pro-modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(10, 15, 29, 0.78);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1050;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
}

.pro-modal-backdrop.open {
  display: block !important;
  opacity: 1;
  pointer-events: auto;
}

.pro-modal-dialog {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.95);
  width: calc(100% - 32px);
  max-width: 440px;
  background: linear-gradient(180deg, #1e2538 0%, #111625 100%);
  border: 1.5px solid rgba(245, 158, 11, 0.5);
  border-radius: 20px;
  padding: 24px 20px 20px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.75), 0 0 35px rgba(245, 158, 11, 0.15);
  z-index: 1060;
  opacity: 0;
  pointer-events: none;
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  color: #ffffff;
}

.pro-modal-dialog.open {
  display: block !important;
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, -50%) scale(1);
}

.pro-modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.7);
  font-size: 1.25rem;
  display: grid;
  place-items: center;
  cursor: pointer;
  line-height: 1;
  transition: all 0.15s ease;
}

.pro-modal-close:hover {
  background: rgba(255, 255, 255, 0.16);
  color: #ffffff;
}

.pro-modal-header {
  text-align: center;
  margin-bottom: 18px;
}

.pro-modal-badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: #f59e0b;
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.35);
  padding: 3px 10px;
  border-radius: 9999px;
  margin-bottom: 10px;
}

.pro-modal-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: #ffffff;
  margin: 0 0 6px;
  letter-spacing: -0.01em;
}

.pro-modal-subtitle {
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.65);
  margin: 0;
}

.pro-modal-features {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 20px;
}

.pro-feature-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.pro-feature-icon {
  font-size: 1.15rem;
  line-height: 1.2;
}

.pro-feature-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.pro-feature-text strong {
  font-size: 0.85rem;
  color: #ffffff;
}

.pro-feature-text span {
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.65);
  line-height: 1.35;
}

.pro-modal-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
}

.pro-upgrade-btn {
  display: block;
  width: 100%;
  text-align: center;
  padding: 13px 18px;
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #111827;
  font-size: 0.95rem;
  font-weight: 800;
  border-radius: 9999px;
  text-decoration: none;
  box-shadow: 0 10px 25px rgba(245, 158, 11, 0.35);
  transition: all 0.15s ease;
}

.pro-upgrade-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 30px rgba(245, 158, 11, 0.45);
}

.pro-login-link {
  font-size: 0.76rem;
  color: rgba(255, 255, 255, 0.6);
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color 0.15s ease;
}

.pro-login-link:hover {
  color: #ffffff;
}

.pro-modal-guarantee {
  text-align: center;
  font-size: 0.68rem;
  color: rgba(255, 255, 255, 0.45);
  margin: 12px 0 0;
}
