.app-preview {
  overflow: hidden;
  border: 1px solid #fff;
  border-radius: 16px;
  background: #fcfcff;
  box-shadow: var(--shadow);
  width: min(320px, 100%);
}

.preview-header {
  display: flex;
  position: relative;
  height: 132px;
  align-items: flex-start;
  justify-content: center;
  background: linear-gradient(180deg, #a78bfa 0%, var(--purple) 100%);
  padding-top: 38px;
}

.preview-header img {
  width: 218px;
  max-width: 72%;
  max-height: 48px;
  height: auto;
  object-fit: contain;
}

.preview-window-buttons {
  display: flex;
  position: absolute;
  top: 0;
  right: 4px;
  align-items: center;
  color: #fff;
  font-weight: 800;
  line-height: 1;
}

.preview-window-buttons span {
  display: grid;
  height: 44px;
  place-items: center;
}

.preview-window-buttons span:first-child {
  width: 24px;
}

.preview-window-buttons span:last-child {
  width: 32px;
  font-size: 17px;
  font-weight: 600;
}

.preview-window-buttons span:first-child::before {
  content: "-";
  transform: translateY(-2px);
}

.preview-window-buttons span:last-child::before {
  content: "×";
}

.preview-menu {
  display: grid;
  position: relative;
  z-index: 2;
  grid-template-columns: repeat(6, 1fr);
  align-items: stretch;
  height: 58px;
  margin-top: -14px;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 8px 18px rgba(17, 24, 39, 0.18);
}

.preview-menu-button {
  display: grid;
  position: relative;
  min-width: 0;
  height: 42px;
  min-height: 42px;
  place-items: start center;
  margin-top: 6px;
  border: 0;
  background: transparent;
  color: var(--purple);
  cursor: pointer;
  opacity: 0.75;
  padding: 6px 0 0;
  transition: opacity 160ms ease;
}

.preview-menu-button::after {
  position: absolute;
  top: 7px;
  right: 0;
  width: 1px;
  height: 24px;
  background: #ddd6fe;
  content: "";
}

.preview-menu-button:last-child::after {
  display: none;
}

.preview-menu-button svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

.preview-menu-button.active {
  opacity: 1;
}

.preview-menu-button:hover {
  opacity: 1;
}

.preview-menu-button:active {
  opacity: 0.72;
}

.preview-menu-button span {
  position: absolute;
  bottom: 0;
  width: 4px;
  height: 4px;
  border-radius: 999px;
  background: var(--green);
}

.preview-menu-button:not(.enabled):not(.active) span {
  display: none;
}

.preview-body {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 14px;
  background: #fcfcff;
  padding: 30px 16px 18px;
  color: #172236;
}

.preview-body strong {
  font-weight: 600;
}

.status-row,
.ducking-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 600;
}

.status-row {
  font-size: 18px;
}

.switch {
  position: relative;
  width: 40px;
  height: 22px;
  border-radius: 999px;
  background: #8b5cf6;
}

.switch::after {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
  content: "";
}

.segmented {
  display: grid;
  position: relative;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  height: 34px;
  border-radius: 999px;
  background: #ddd6fe;
  padding: 3px;
}

.segmented-indicator {
  position: absolute;
  top: 3px;
  bottom: 3px;
  left: 3px;
  width: calc((100% - 6px) / 3);
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 4px 12px rgba(31, 21, 55, 0.18);
  transform: translateX(100%);
  transition: transform 420ms cubic-bezier(0.22, 1, 0.36, 1);
}

.segmented[data-active-mode="mute"] .segmented-indicator {
  transform: translateX(0);
}

.segmented[data-active-mode="pause"] .segmented-indicator {
  transform: translateX(100%);
}

.segmented[data-active-mode="ducking"] .segmented-indicator {
  transform: translateX(200%);
}

.mode-button {
  position: relative;
  z-index: 1;
  min-height: 28px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #5f5377;
  cursor: pointer;
  font: inherit;
  font-size: 11.5px;
  font-weight: 600;
}

.mode-button.active {
  color: #24163a;
}

.ducking-panel {
  display: grid;
  gap: 8px;
  max-height: 0;
  overflow: hidden;
  padding-bottom: 0;
  opacity: 0;
  transform: translateY(-8px);
  transition: max-height 420ms ease, opacity 240ms ease, padding-bottom 420ms ease, transform 420ms ease;
}

.ducking-panel.is-visible {
  max-height: 68px;
  overflow: visible;
  padding-bottom: 7px;
  opacity: 1;
  transform: translateY(0);
}

.ducking-row {
  margin-top: 1px;
  font-size: 0.92rem;
  color: #4b5563;
}

.range-shell {
  position: relative;
  --range-edge: 12px;
  margin-inline: calc(-1 * var(--range-edge));
  height: 28px;
  border-radius: 999px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
  user-select: none;
}

.range-track {
  position: absolute;
  top: 50%;
  right: var(--range-edge);
  left: var(--range-edge);
  overflow: hidden;
  height: 8px;
  border-radius: 999px;
  background: #ddd6fe;
  transform: translateY(-50%);
}

.range-fill {
  display: block;
  width: var(--ducking-percent, 50%);
  height: 100%;
  border-radius: inherit;
  background: #8b5cf6;
}

.range-thumb {
  position: absolute;
  top: 50%;
  left: var(--ducking-thumb-left, 50%);
  z-index: 1;
  width: 18px;
  height: 18px;
  border: 1px solid #e9d5ff;
  border-radius: 50%;
  background: #fff;
  box-shadow:
    0 4px 12px rgba(31, 21, 55, 0.2),
    0 0 0 1px rgba(124, 58, 237, 0.08);
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.ducking-range {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 28px;
  margin: 0;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  cursor: pointer;
  opacity: 0;
  outline: 0;
  pointer-events: none;
  -webkit-tap-highlight-color: transparent;
}

.ducking-range:disabled {
  cursor: default;
}

.ducking-range::-webkit-slider-runnable-track {
  height: 8px;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.ducking-range::-webkit-slider-thumb {
  width: 20px;
  height: 20px;
  margin-top: -6px;
  -webkit-appearance: none;
  appearance: none;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.ducking-range::-moz-range-track {
  height: 8px;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.ducking-range::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.range-shell:focus-within .range-thumb {
  box-shadow:
    0 4px 10px rgba(31, 21, 55, 0.22),
    0 0 0 1px rgba(124, 58, 237, 0.08),
    0 0 0 4px rgba(124, 58, 237, 0.18);
}

.ducking-panel.is-animating .range-fill {
  animation: ducking-fill 1200ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.ducking-panel.is-animating .range-thumb {
  animation: ducking-thumb 1200ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.preview-footer {
  display: grid;
  position: relative;
  z-index: 4;
  grid-template-columns: 1fr auto 1fr;
  min-height: 41px;
  align-items: center;
  margin-top: -2px;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 -8px 18px rgba(17, 24, 39, 0.18);
  padding: 14px 12px 12px;
}

.preview-footer-left {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 800;
}

.preview-footer strong {
  color: #050505;
  font-weight: 800;
}

.preview-footer span {
  color: var(--green);
}

.app-ad-preview {
  position: relative;
  display: grid;
  min-height: 92px;
  overflow: hidden;
  border-top: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: var(--radius) var(--radius) 0 0;
  background: #121826;
  color: rgba(255, 255, 255, 0.9);
  font-weight: 700;
}

.app-ad-creative {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 18px 22px;
}

.app-ad-logo {
  animation: app-ad-logo-cycle 8s ease-in-out infinite;
}

.app-ad-banner {
  flex-direction: column;
  gap: 3px;
  background:
    radial-gradient(circle at 74% 38%, rgba(167, 139, 250, 0.46), transparent 9rem),
    linear-gradient(135deg, #171d2b 0%, #10151e 100%);
  opacity: 0;
  transform: translateY(12px) scale(0.96);
  animation: app-ad-banner-cycle 8s ease-in-out infinite;
}

.app-ad-banner span {
  color: rgba(255, 255, 255, 0.62);
  font-size: 0.78rem;
}

.app-ad-mark {
  display: inline-grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 12px;
  background: linear-gradient(135deg, #22c55e, #a78bfa);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 800;
}

@keyframes ducking-fill {
  from {
    width: 0%;
  }

  to {
    width: var(--ducking-percent, 50%);
  }
}

@keyframes ducking-thumb {
  from {
    left: var(--range-edge);
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.72);
  }

  38% {
    opacity: 1;
  }

  to {
    left: var(--ducking-thumb-left, 50%);
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

@keyframes app-ad-logo-cycle {
  0%,
  44% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }

  52%,
  92% {
    opacity: 0;
    transform: translateY(-10px) scale(0.96);
  }

  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes app-ad-banner-cycle {
  0%,
  44% {
    opacity: 0;
    transform: translateY(12px) scale(0.96);
  }

  52%,
  92% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }

  100% {
    opacity: 0;
    transform: translateY(12px) scale(0.96);
  }
}

@media (prefers-reduced-motion: reduce) {
  .ducking-panel.is-animating .range-fill,
  .ducking-panel.is-animating .range-thumb,
  .app-ad-logo,
  .app-ad-banner {
    animation: none;
  }

  .app-ad-banner {
    display: none;
  }
}

