.demo,
.demo * {
  box-sizing: border-box;
}

.demo {
  width: 93%;
  max-width: 1140px;
  margin-top: 32px;
  padding: 24px 28px;
  border: 1px solid rgba(249, 149, 39, .26);
  border-radius: 20px;
  background: linear-gradient(120deg, rgba(32, 22, 37, .97), rgba(14, 16, 31, .98) 65%);
  box-shadow: 0 22px 60px rgba(0, 0, 0, .24), inset 0 1px rgba(255, 255, 255, .07);
  color: #fff;
}

.demo-intro {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  margin-bottom: 18px;
}

.demo-eyebrow {
  color: #f99527;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .15em;
}

.demo h2 {
  margin: 5px 0;
  color: #fff;
  font-size: 26px;
  line-height: 1.2;
}

.demo-intro p,
.demo-hint {
  margin: 0;
  color: #b7b1bd;
  font-size: 13px;
  line-height: 1.5;
}

.demo-intro-icon {
  display: grid;
  flex: none;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, #f12d64, #f99527);
  font-size: 25px;
}

.demo-form label {
  display: block;
  margin-bottom: 8px;
  color: #f6edf3;
  font-size: 12px;
  font-weight: 600;
}

.demo-form-row {
  display: flex;
  gap: 10px;
}

.demo-form input {
  flex: 1;
  min-width: 0;
  height: 46px;
  padding: 0 14px;
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 9px;
  outline: none;
  background: #0a0c17;
  color: #fff;
  font: inherit;
  font-size: 14px;
}

.demo-form input::placeholder {
  color: #8e8998;
}

.demo :is(.demo-form input, .demo-form button, .demo-player-actions button, .demo-waveform, .demo-install a):focus-visible {
  outline: 2px solid #f99527;
  outline-offset: 3px;
}

.demo-form input[aria-invalid="true"] {
  border-color: #ff7792;
}

.demo-form button {
  flex: none;
  min-height: 46px;
  padding: 0 20px;
  border: 0;
  border-radius: 9px;
  background: linear-gradient(110deg, #ed366d, #f99527);
  color: #1b0e11;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
}

.demo-form button:hover {
  filter: brightness(1.12);
}

.demo-form button:disabled {
  opacity: .65;
  cursor: wait;
}

.demo-hint {
  margin-top: 9px;
}

.demo-status {
  margin: 10px 0 0;
  color: #e8c5a5;
  font-size: 13px;
  line-height: 1.5;
}

.demo-status:empty {
  display: none;
}

.demo-status[data-error="true"] {
  color: #ff9aa9;
}

.demo-status a {
  color: #fff;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.demo-player {
  min-width: 0;
  margin-top: 20px;
}

.demo-player[hidden] {
  display: none;
}

.demo-player-actions {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 8px;
}

.demo-player-actions button {
  border: 1px solid rgba(255, 255, 255, .4);
  border-radius: 5px;
  padding: 5px 10px;
  background: transparent;
  color: #fff;
  font: 600 12px/1.3 Inter, sans-serif;
  cursor: pointer;
}

.demo-player-actions button:hover {
  border-color: #f99527;
  color: #f99527;
}

.demo-video-shell {
  position: relative;
  width: 100%;
  min-height: 200px;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #000;
}

.demo-video-shell :is(#demo-youtube, iframe) {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 200px;
  border: 0;
}

.demo-video-shell iframe {
  position: absolute;
  inset: 0;
}

/* The toolbar and waveform mirror the extension's light YouTube overlay. */
.demo-overlay {
  container-type: inline-size;
  position: relative;
  z-index: 1;
  width: 100%;
  margin-top: 10px;
  padding: 6px 6px 0;
  border-radius: 4px;
  background: #f5f5f5;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .1);
  color: #666;
  font-family: Arial, sans-serif;
  font-weight: 400;
  font-size: 12px;
}

.demo-toolbar {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  column-gap: 10px;
  min-width: 0;
  padding: 0 8px 6px;
}

.demo-toolbar-left,
.demo-toolbar-right,
.demo-slider-control,
.demo-action-menu {
  display: flex;
  align-items: center;
  min-width: 0;
}

.demo-toolbar-left {
  gap: 8px;
  justify-self: start;
}

.demo-time {
  flex: none;
  white-space: nowrap;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.demo-slider-control {
  gap: 4px;
  flex: none;
  margin-left: 8px;
}

.demo-slider-control label {
  color: #888;
  font-size: 11px;
  white-space: nowrap;
}

.demo-slider-control input[type="range"] {
  width: 80px;
  height: 4px;
  margin: 0;
  padding: 0;
  appearance: none;
  background: transparent;
  cursor: pointer;
}

.demo-slider-control input[type="range"]::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 2px;
  background: #ddd;
}

.demo-slider-control input[type="range"]::-webkit-slider-thumb {
  width: 12px;
  height: 12px;
  margin-top: -4px;
  border: 0;
  border-radius: 50%;
  appearance: none;
  background: #666;
}

.demo-slider-control input[type="range"]::-moz-range-track {
  height: 4px;
  border-radius: 2px;
  background: #ddd;
}

.demo-slider-control input[type="range"]::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border: 0;
  border-radius: 50%;
  background: #666;
}

.demo-slider-control input[type="range"]:hover::-webkit-slider-thumb {
  background: #333;
}

.demo-slider-control input[type="range"]:hover::-moz-range-thumb {
  background: #333;
}

.demo-slider-control input[type="range"]:disabled {
  opacity: .48;
  cursor: not-allowed;
}

.demo-slider-control output {
  min-width: 32px;
  text-align: right;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.demo-loop-info {
  overflow: hidden;
  justify-self: center;
  max-width: 200px;
  color: #888;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.demo-loop-info:empty,
.demo-bpm:empty {
  display: none;
}

.demo-toolbar-right {
  justify-content: flex-end;
  gap: 8px;
  grid-column: 3;
  position: relative;
}

.demo-action-menu {
  gap: 8px;
}

.demo .demo-action-menu[hidden] {
  display: none;
}

.demo-tool-button {
  display: inline-flex;
  flex: none;
  justify-content: center;
  align-items: center;
  min-height: 24px;
  padding: 0 10px;
  border: 0;
  border-radius: 3px;
  background: #6c757d;
  box-shadow: 0 2px 4px rgba(0, 0, 0, .2);
  color: #fff;
  cursor: pointer;
  font: 500 12px/1.2 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  white-space: nowrap;
  transition: background-color .2s ease, box-shadow .2s ease;
}

.demo-tool-button:hover {
  background: #596269;
}

.demo-tool-button[aria-pressed="true"] {
  background: #0d6efd;
}

.demo-tool-button:disabled {
  cursor: not-allowed;
}

#demo-loop:disabled {
  display: none;
}

#demo-loop[aria-pressed="true"],
#demo-follow[aria-pressed="true"] {
  background: #28a745;
}

.demo .demo-tool-button:focus-visible,
.demo .demo-slider-control input:focus-visible {
  outline: 2px solid #137d9d;
  outline-offset: 2px;
}

.demo-tap {
  min-width: 90px;
}

.demo-bpm {
  font-size: 11px;
  white-space: nowrap;
}

.demo-more {
  display: none;
  width: 28px;
  padding: 0;
  font-size: 16px;
}

.demo-help-wrap {
  position: relative;
  flex: none;
}

.demo-help {
  width: 20px;
  min-height: 20px;
  padding: 0;
  border-radius: 50%;
  font: bold 11px/1 Arial, sans-serif;
}

.demo-help-text {
  position: absolute;
  right: 0;
  bottom: calc(100% + 6px);
  z-index: 5;
  width: max-content;
  max-width: min(440px, 80vw);
  padding: 8px 10px;
  border-radius: 6px;
  background: #333;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .3);
  color: #fff;
  font: 11px/1.6 Arial, sans-serif;
  white-space: nowrap;
}

.demo-help-text[hidden] {
  display: none;
}

.demo-waveform {
  position: relative;
  z-index: 0;
  width: 100%;
  height: 114px;
  min-height: 114px;
  max-height: 114px;
  margin: 0;
  padding: 0;
  overflow: hidden;
  cursor: crosshair;
  touch-action: none;
}

.demo-waveform canvas {
  display: block;
}

.demo-install {
  margin: 12px 2px 0;
  color: #b7b1bd;
  font-size: 13px;
  line-height: 1.5;
}

.demo-install a {
  color: #fff;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}

@container (max-width: 1239px) {
  .demo-more {
    display: inline-flex;
  }

  .demo-action-menu:not([hidden]) {
    position: absolute;
    top: 100%;
    right: 0;
    z-index: 4;
    display: block;
    min-width: 160px;
    overflow: hidden;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    background: #fff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, .15);
  }

  .demo-action-menu .demo-tool-button {
    justify-content: flex-start;
    width: 100%;
    height: auto;
    min-height: 30px;
    padding: 7px 14px;
    border-radius: 0;
    box-shadow: none;
  }
}

@container (max-width: 1049px) {
  .demo-slider-control:has(#demo-pitch) {
    display: none;
  }
}

@container (max-width: 759px) {
  .demo-toolbar {
    grid-template-columns: minmax(0, 1fr) auto;
    row-gap: 6px;
  }

  .demo-toolbar-right {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-content: flex-start;
    flex-wrap: wrap;
  }
}

@container (max-width: 559px) {
  .demo-help-wrap {
    display: none;
  }
}

@container (max-width: 439px) {
  .demo-slider-control label[for="demo-speed"] {
    display: none;
  }

  .demo-slider-control input[type="range"] {
    width: 60px;
  }
}

@media screen and (max-width: 767px) {
  .demo {
    width: min(100%, 500px);
    padding: 22px;
  }
}

@media screen and (max-width: 479px) {
  .demo {
    width: 86%;
    padding: 18px;
  }

  .demo h2 {
    font-size: 23px;
  }

  .demo-form-row {
    flex-direction: column;
  }

  .demo-form button {
    width: 100%;
  }

  .demo-intro-icon {
    display: none;
  }
}
