/* YT Music Looper panel — scoped to #ytmt-practice-panel */
#ytmt-practice-panel {
  --ytmt-bg: #0f0f0f;
  --ytmt-surface: #272727;
  --ytmt-border: rgba(255, 255, 255, 0.12);
  --ytmt-muted: #aaaaaa;
  --ytmt-accent: #c026d3;
  --ytmt-accent-soft: rgba(192, 38, 211, 0.35);
  --ytmt-handle: #e879f9;
  --ytmt-playhead: #ffffff;
  --ytmt-tick: rgba(255, 255, 255, 0.35);
  --ytmt-tick-strong: rgba(255, 255, 255, 0.55);
  display: block;
  font-family: Roboto, Arial, Helvetica, sans-serif;
  color: #f1f1f1;
  box-sizing: border-box;
}

#ytmt-practice-panel *,
#ytmt-practice-panel *::before,
#ytmt-practice-panel *::after {
  box-sizing: border-box;
}

#ytmt-practice-panel .ytmt-panel {
  background: var(--ytmt-bg);
  border: 1px solid var(--ytmt-border);
  border-radius: 12px;
  padding: 10px 12px 12px;
}

#ytmt-practice-panel .ytmt-header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

#ytmt-practice-panel .ytmt-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #f1f1f1;
  justify-self: start;
}

#ytmt-practice-panel .ytmt-title-logo {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  border-radius: 4px;
  background: #ef4444;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 7px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1;
}

#ytmt-practice-panel .ytmt-title-yt {
  color: #a855f7;
}

#ytmt-practice-panel .ytmt-header-toggle {
  justify-self: center;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
}

#ytmt-practice-panel .ytmt-header-speed {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--ytmt-muted);
}

#ytmt-practice-panel .ytmt-header-actions {
  justify-self: end;
}

#ytmt-practice-panel .ytmt-btn {
  appearance: none;
  border: none;
  border-radius: 16px;
  height: 32px;
  min-height: 32px;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  color: #f1f1f1;
  background: var(--ytmt-surface);
  white-space: nowrap;
}

#ytmt-practice-panel .ytmt-btn:hover {
  opacity: 0.9;
}

#ytmt-practice-panel .ytmt-btn:active {
  opacity: 0.8;
}

#ytmt-practice-panel .ytmt-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

#ytmt-practice-panel .ytmt-btn-toggle {
  min-width: 72px;
  height: 28px;
  min-height: 28px;
  padding: 0 14px;
  font-size: 12px;
  border-radius: 14px;
  background: var(--ytmt-surface);
  color: #f1f1f1;
  border: 1px solid var(--ytmt-border);
}

#ytmt-practice-panel .ytmt-btn-on {
  background: var(--ytmt-accent);
  color: #fff;
}

#ytmt-practice-panel .ytmt-btn-link {
  background: transparent;
  color: var(--ytmt-accent);
  border: 1px solid var(--ytmt-accent-soft);
}

#ytmt-practice-panel .ytmt-btn-nudge {
  min-width: 28px;
  height: 28px;
  min-height: 28px;
  padding: 0 8px;
  font-size: 11px;
}

#ytmt-practice-panel .ytmt-btn-zoom {
  width: 28px;
  min-width: 28px;
  height: 28px;
  min-height: 28px;
  padding: 0;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  line-height: 1;
}

#ytmt-practice-panel .ytmt-panel.collapsed {
  padding-bottom: 10px;
}

#ytmt-practice-panel .ytmt-panel.collapsed .ytmt-header {
  margin-bottom: 0;
}

#ytmt-practice-panel .ytmt-timeline-row {
  display: flex;
  align-items: stretch;
  gap: 8px;
  margin-top: 2px;
}

#ytmt-practice-panel .ytmt-overview-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  margin-bottom: 6px;
}

#ytmt-practice-panel .ytmt-overview-edge {
  font-size: 10px;
  color: var(--ytmt-muted);
  font-variant-numeric: tabular-nums;
  width: 36px;
  min-width: 36px;
  flex-shrink: 0;
}

#ytmt-practice-panel .ytmt-overview-edge.end {
  text-align: right;
}

#ytmt-practice-panel .ytmt-zoom-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 36px;
  min-width: 36px;
  flex-shrink: 0;
}

#ytmt-practice-panel .ytmt-overview-track {
  position: relative;
  flex: 1;
  height: 28px;
  touch-action: none;
  user-select: none;
  cursor: grab;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--ytmt-border);
  border-radius: 6px;
  overflow: visible;
}

#ytmt-practice-panel .ytmt-overview-track:active {
  cursor: grabbing;
}

#ytmt-practice-panel .ytmt-overview-rail {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 4px;
  margin-top: -2px;
  border-radius: 2px;
  background: var(--ytmt-surface);
  pointer-events: none;
}

#ytmt-practice-panel .ytmt-overview-loops {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 4px;
  margin-top: -2px;
  pointer-events: none;
  z-index: 1;
}

#ytmt-practice-panel .ytmt-overview-loop-mark {
  position: absolute;
  top: 0;
  bottom: 0;
  min-width: 2px;
  border-radius: 2px;
  background: var(--mark-color, var(--ytmt-accent));
  opacity: 0.9;
}

#ytmt-practice-panel .ytmt-overview-range {
  position: absolute;
  top: 2px;
  bottom: 2px;
  min-width: 8px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.35);
  cursor: grab;
  touch-action: none;
  z-index: 2;
}

#ytmt-practice-panel .ytmt-overview-range:active {
  cursor: grabbing;
}

#ytmt-practice-panel .ytmt-overview-range-label {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 9px;
  line-height: 1;
  color: #f1f1f1;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  pointer-events: none;
  text-shadow: 0 0 3px rgba(0, 0, 0, 0.85);
}

#ytmt-practice-panel .ytmt-overview-range-label.start {
  left: 4px;
}

#ytmt-practice-panel .ytmt-overview-range-label.end {
  right: 4px;
}

#ytmt-practice-panel .ytmt-track {
  position: relative;
  flex: 1;
  height: 72px;
  touch-action: none;
  user-select: none;
  cursor: ew-resize;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--ytmt-border);
  border-radius: 8px;
  overflow: hidden;
}

#ytmt-practice-panel .ytmt-ruler {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 28px;
  border-bottom: 1px dotted rgba(255, 255, 255, 0.18);
  pointer-events: none;
  z-index: 1;
}

#ytmt-practice-panel .ytmt-tick {
  position: absolute;
  top: 0;
  width: 1px;
  background: var(--ytmt-tick);
  transform: translateX(-50%);
}

#ytmt-practice-panel .ytmt-tick.minor {
  height: 6px;
  top: 22px;
  opacity: 0.55;
}

#ytmt-practice-panel .ytmt-tick.medium {
  height: 12px;
  top: 16px;
  background: var(--ytmt-tick-strong);
}

#ytmt-practice-panel .ytmt-tick.major {
  height: 18px;
  top: 10px;
  background: var(--ytmt-tick-strong);
}

#ytmt-practice-panel .ytmt-tick-label {
  position: absolute;
  top: -1px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  line-height: 1;
  color: var(--ytmt-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  pointer-events: none;
}

#ytmt-practice-panel .ytmt-lane {
  position: absolute;
  left: 0;
  right: 0;
  top: 28px;
  bottom: 0;
  pointer-events: none;
}

#ytmt-practice-panel .ytmt-track-line {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 6px;
  margin-top: -3px;
  border-radius: 3px;
  background: var(--ytmt-surface);
}

#ytmt-practice-panel .ytmt-playhead {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  margin-left: -1px;
  background: var(--ytmt-playhead);
  pointer-events: none;
  z-index: 5;
}

#ytmt-practice-panel .ytmt-playhead::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 7px solid var(--ytmt-playhead);
}

#ytmt-practice-panel .ytmt-loop-region {
  position: absolute;
  top: 50%;
  height: 18px;
  margin-top: -9px;
  border-radius: 4px;
  background: var(--ytmt-accent-soft);
  border: 1px solid var(--ytmt-accent);
  cursor: grab;
  touch-action: none;
  min-width: 4px;
  z-index: 2;
  pointer-events: auto;
}

#ytmt-practice-panel .ytmt-loop-region:active {
  cursor: grabbing;
}

#ytmt-practice-panel .ytmt-handle {
  position: absolute;
  top: 50%;
  width: 44px;
  height: 44px;
  margin-top: -22px;
  margin-left: -22px;
  border: none;
  background: transparent;
  padding: 0;
  cursor: ew-resize;
  touch-action: none;
  z-index: 4;
  pointer-events: auto;
}

#ytmt-practice-panel .ytmt-handle::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 12px;
  height: 22px;
  margin-left: -6px;
  margin-top: -11px;
  border-radius: 6px;
  background: var(--ytmt-handle);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35);
}

#ytmt-practice-panel .ytmt-handle-label {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  font-size: 9px;
  font-weight: 700;
  color: var(--ytmt-handle);
  pointer-events: none;
}

#ytmt-practice-panel .ytmt-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
}

#ytmt-practice-panel .ytmt-loops-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
  min-height: 0;
}

#ytmt-practice-panel .ytmt-loops-pills:empty {
  display: none;
}

#ytmt-practice-panel .ytmt-loop-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  height: 28px;
  padding: 0 4px 0 8px;
  border-radius: 14px;
  border: 1px solid var(--pill-color, var(--ytmt-accent));
  background: color-mix(in srgb, var(--pill-color, var(--ytmt-accent)) 22%, transparent);
  color: #f1f1f1;
  font-size: 11px;
  font-family: inherit;
  cursor: pointer;
  touch-action: manipulation;
}

#ytmt-practice-panel .ytmt-loop-pill.active {
  background: color-mix(in srgb, var(--pill-color, var(--ytmt-accent)) 40%, transparent);
  box-shadow: 0 0 0 1px var(--pill-color, var(--ytmt-accent));
}

#ytmt-practice-panel .ytmt-loop-pill-swatch {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--pill-color, var(--ytmt-accent));
  flex-shrink: 0;
}

#ytmt-practice-panel .ytmt-loop-pill-name {
  font-weight: 600;
  max-width: 96px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border-radius: 4px;
  padding: 0 2px;
}

#ytmt-practice-panel .ytmt-loop-pill-name-input {
  width: 96px;
  max-width: 120px;
  height: 20px;
  padding: 0 4px;
  border-radius: 4px;
  border: 1px solid var(--pill-color, var(--ytmt-accent));
  background: var(--ytmt-bg);
  color: #f1f1f1;
  font-size: 11px;
  font-weight: 600;
  font-family: inherit;
}

#ytmt-practice-panel .ytmt-loop-pill-edit,
#ytmt-practice-panel .ytmt-loop-pill-delete {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--ytmt-muted);
  width: 22px;
  height: 22px;
  min-width: 22px;
  border-radius: 11px;
  padding: 0;
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
  font-family: inherit;
}

#ytmt-practice-panel .ytmt-loop-pill-delete {
  font-size: 14px;
}

#ytmt-practice-panel .ytmt-loop-pill-edit:hover,
#ytmt-practice-panel .ytmt-loop-pill-delete:hover {
  color: #f1f1f1;
  background: rgba(255, 255, 255, 0.08);
}

#ytmt-practice-panel .ytmt-loop-pill-range {
  color: var(--ytmt-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

#ytmt-practice-panel .ytmt-hidden {
  display: none !important;
}

#ytmt-practice-panel .ytmt-speed-value {
  min-width: 40px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: #f1f1f1;
}

@media (max-width: 640px) {
  #ytmt-practice-panel .ytmt-header {
    grid-template-columns: 1fr;
    justify-items: stretch;
  }

  #ytmt-practice-panel .ytmt-title,
  #ytmt-practice-panel .ytmt-header-toggle,
  #ytmt-practice-panel .ytmt-header-actions {
    justify-self: stretch;
  }

  #ytmt-practice-panel .ytmt-header-toggle {
    justify-content: center;
    flex-wrap: wrap;
  }

  #ytmt-practice-panel .ytmt-header-actions {
    text-align: center;
  }
}
