:root {
  --font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --page-bg: #eef4f2;
  --panel: #fffdf8;
  --panel-strong: #ffffff;
  --ink: #121826;
  --ink-soft: #607084;
  --ink-muted: #7a8794;
  --line: rgba(24, 32, 38, 0.12);
  --line-dark: rgba(255, 255, 255, 0.12);
  --dark-panel: #142033;
  --dark-panel-2: #1d2c42;
  --teal: #08725f;
  --teal-dark: #07594d;
  --coral: #c75a46;
  --amber: #c7922b;
  --green: #08725f;
  --blue: #17243a;
  --danger: #dc4b4b;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  font-family: var(--font-family);
  color: var(--ink);
  background: var(--page-bg);
  line-height: 1.5;
}

button,
input {
  font: inherit;
}

button {
  border: 0;
}

.app-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 40px 0 56px;
  display: grid;
  grid-template-columns: 0.8fr 1.2fr;
  gap: 18px;
}

.intro-panel,
.source-card,
.mixer-section {
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.intro-panel {
  min-height: 460px;
  padding: 34px;
  color: #f7fbfb;
  background:
    linear-gradient(160deg, rgba(8, 114, 95, 0.24), transparent 42%),
    linear-gradient(180deg, #17243a, #111827);
  border: 1px solid var(--line-dark);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  position: relative;
  overflow: hidden;
}

.intro-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.045) 1px, transparent 1px);
  background-size: 34px 34px;
  mask-image: linear-gradient(transparent, black 28%, black 100%);
  pointer-events: none;
}

.brand-mark {
  position: absolute;
  top: 30px;
  left: 30px;
  width: 68px;
  height: 68px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: #f7f4ee;
  color: var(--teal-dark);
}

.brand-mark i,
.btn i,
.icon-btn i,
.source-tab i,
.dropzone-icon i,
.url-input-shell i {
  width: 20px;
  height: 20px;
  stroke-width: 2;
}

.brand-mark i {
  width: 28px;
  height: 28px;
}

.kicker {
  color: var(--teal);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.intro-panel .kicker {
  color: #7de0d8;
}

h1 {
  margin-top: 10px;
  max-width: 520px;
  font-size: clamp(3rem, 7vw, 5.5rem);
  line-height: 0.92;
  letter-spacing: 0;
}

.subtitle {
  margin-top: 20px;
  max-width: 470px;
  color: rgba(247, 251, 251, 0.78);
  font-size: 1.04rem;
}

.quick-stats {
  margin-top: 28px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.quick-stats span {
  padding: 9px 12px;
  border: 1px solid var(--line-dark);
  border-radius: 999px;
  color: rgba(247, 251, 251, 0.76);
  background: rgba(255, 255, 255, 0.05);
}

.quick-stats strong {
  color: #ffffff;
}

.source-card {
  padding: 28px;
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.64);
}

.source-card .kicker,
.source-card h2,
.source-card label,
.source-card .dropzone-title,
.source-card .dropzone-note,
.source-card .rights-note {
  text-shadow: none;
}

.section-heading,
.mixer-topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

h2 {
  margin-top: 4px;
  color: var(--ink);
  font-size: clamp(1.5rem, 3vw, 2rem);
  line-height: 1.08;
  letter-spacing: 0;
}

.sample-panel {
  max-width: 340px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: 8px;
  background: var(--panel-strong);
  border: 1px solid var(--line);
}

.sample-panel span {
  flex: 1 1 auto;
  min-width: 60px;
  color: var(--ink-soft);
  font-size: 0.84rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sample-panel button {
  flex-shrink: 0;
}

.source-tabs {
  margin-top: 28px;
  padding: 5px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.08);
  border: 1px solid rgba(15, 23, 42, 0.08);
}

.source-tabs.single-source {
  display: none;
}

.source-tab {
  min-height: 50px;
  border-radius: 9px;
  color: #4f6076;
  background: transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  font-weight: 800;
  transition: background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

.source-tab.active {
  color: #061b19;
  background: #dff5ef;
  box-shadow: 0 10px 24px rgba(8, 114, 95, 0.16);
}

.demo-notice {
  margin-top: 18px;
  display: grid;
  gap: 7px;
  padding: 14px 15px;
  border-radius: 8px;
  border: 1px solid rgba(8, 114, 95, 0.22);
  background: #eef8f5;
  color: var(--ink-soft);
}

.demo-notice strong {
  color: var(--green);
  font-size: 0.96rem;
}

.demo-notice span {
  font-size: 0.92rem;
}

.demo-notice a {
  width: fit-content;
  color: var(--green);
  font-weight: 850;
  text-decoration: none;
}

.demo-notice a:hover {
  text-decoration: underline;
}

.source-tab:disabled,
.btn:disabled,
.icon-btn:disabled,
.pitch-reset:disabled,
.pitch-slider:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.source-form {
  margin-top: 18px;
  display: none;
  gap: 14px;
}

.source-form.active {
  display: grid;
}

.source-form,
.source-form label {
  min-width: 0;
}

.dropzone {
  min-height: 212px;
  border: 1px dashed rgba(24, 32, 38, 0.28);
  border-radius: 12px;
  background:
    linear-gradient(135deg, rgba(26, 165, 154, 0.08), transparent 48%),
    var(--panel-strong);
  display: grid;
  place-items: center;
  align-content: center;
  gap: 10px;
  cursor: pointer;
  text-align: center;
  transition: border-color 0.18s ease, transform 0.18s ease, background 0.18s ease;
}

.dropzone:hover {
  border-color: var(--teal);
  transform: translateY(-1px);
}

.dropzone input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.dropzone-icon {
  width: 50px;
  height: 50px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: #ffffff;
  background: var(--teal-dark);
}

.dropzone-title {
  max-width: 80%;
  color: #1f2937;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.dropzone-note,
.rights-note,
.source-meta {
  color: #6b7b8f;
  font-size: 0.9rem;
}

.url-field {
  display: grid;
  gap: 8px;
  width: 100%;
  color: var(--ink);
  font-weight: 800;
}

.url-input-shell {
  width: 100%;
  min-height: 56px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--teal-dark);
}

.url-input-shell input {
  width: 100%;
  height: auto;
  padding: 0;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
  min-width: 0;
  box-shadow: none;
}

.btn {
  min-height: 48px;
  padding: 0 18px;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  font-weight: 800;
  transition: transform 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.btn:hover:not(:disabled),
.icon-btn:hover:not(:disabled) {
  transform: translateY(-1px);
}

.btn-primary {
  color: #ffffff;
  background: var(--teal-dark);
  box-shadow: 0 12px 24px rgba(8, 120, 111, 0.22);
}

.btn-primary:hover:not(:disabled) {
  background: #066a63;
}

.btn-soft {
  min-height: 38px;
  padding: 0 12px;
  color: var(--ink);
  background: #eef3f1;
  border: 1px solid var(--line);
}

.status {
  display: none;
  margin-top: 16px;
  padding: 13px 14px;
  border-radius: 8px;
  color: var(--ink);
  background: var(--panel-strong);
  border: 1px solid var(--line);
  font-weight: 700;
}

.status:not(:empty) {
  display: block;
}

.status[data-type="success"] {
  border-color: rgba(74, 168, 106, 0.35);
  background: #eef8f1;
}

.status[data-type="warning"] {
  border-color: rgba(242, 184, 75, 0.46);
  background: #fff7e6;
}

.status[data-type="error"] {
  border-color: rgba(220, 75, 75, 0.36);
  background: #fff0ef;
}

.mixer-section {
  grid-column: 1 / -1;
  margin-top: 8px;
  padding: 28px;
  color: #f7fbfb;
  background: var(--dark-panel);
  border: 1px solid var(--line-dark);
}

.mixer-section h2 {
  color: #ffffff;
}

.mixer-section .kicker {
  color: #7de0d8;
}

.source-meta {
  min-height: 22px;
  margin-top: 8px;
  color: rgba(247, 251, 251, 0.58);
}

.visualizer-container {
  width: min(420px, 42vw);
  height: 76px;
  border-radius: 8px;
  overflow: hidden;
  background: #0e1419;
  border: 1px solid var(--line-dark);
}

.visualizer-container canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.player-controls {
  margin-top: 22px;
  padding: 16px;
  border-radius: 8px;
  background: var(--dark-panel-2);
  border: 1px solid var(--line-dark);
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 18px;
}

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

.icon-btn {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  color: #f7fbfb;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--line-dark);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: transform 0.18s ease, background 0.18s ease;
}

.icon-btn.primary {
  color: #061b19;
  background: #7de0d8;
}

.timeline-container {
  display: grid;
  gap: 8px;
}

.time-display {
  display: flex;
  justify-content: space-between;
  color: rgba(247, 251, 251, 0.62);
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  font-size: 0.84rem;
}

.seek-bar,
.vol-slider,
.pan-slider,
.pitch-slider {
  display: block;
  width: 100%;
  height: 6px;
  margin: 0;
  box-sizing: border-box;
  border-radius: 999px;
  outline: 0;
  cursor: pointer;
  accent-color: var(--teal);
}

.seek-bar {
  background: rgba(255, 255, 255, 0.16);
}

.pitch-panel {
  margin-top: 18px;
  padding: 16px;
  border-radius: 8px;
  background: var(--dark-panel-2);
  border: 1px solid var(--line-dark);
  display: grid;
  grid-template-columns: minmax(130px, auto) 1fr;
  align-items: center;
  gap: 18px;
}

.pitch-panel h3 {
  margin-top: 2px;
  color: #ffffff;
  font-size: 1.05rem;
  letter-spacing: 0;
}

.pitch-controls {
  min-width: 0;
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: center;
  gap: 10px;
}

.pitch-slider-wrap {
  min-width: 0;
  display: grid;
  gap: 9px;
}

.pitch-readout {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

#pitchValue {
  min-width: 58px;
  color: #ffffff;
  font-size: 1rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.pitch-reset {
  min-height: 28px;
  padding: 0 10px;
  border-radius: 6px;
  color: rgba(247, 251, 251, 0.78);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--line-dark);
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 900;
}

.pitch-slider {
  accent-color: #7de0d8;
}

.channels-grid {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(4, minmax(210px, 1fr));
  gap: 12px;
}

.channel {
  --stem-color: var(--teal);
  min-height: 186px;
  padding: 16px;
  border-radius: 12px;
  background: #f7f4ee;
  color: var(--ink);
  border: 1px solid rgba(255, 255, 255, 0.7);
  display: grid;
  gap: 16px;
}

.stem-vocals { --stem-color: var(--coral); }
.stem-drums { --stem-color: var(--amber); }
.stem-bass { --stem-color: var(--green); }
.stem-other { --stem-color: var(--blue); }

.channel-header,
.control-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.channel-name {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 900;
}

.channel-name::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--stem-color);
}

.channel-controls {
  display: flex;
  gap: 6px;
}

.mini-toggle {
  width: 30px;
  height: 30px;
  border-radius: 6px;
  color: var(--ink-soft);
  background: #e8e4dc;
  cursor: pointer;
  font-size: 0.74rem;
  font-weight: 900;
}

.mini-toggle.danger {
  color: #ffffff;
  background: var(--danger);
}

.mini-toggle.solo {
  color: #251602;
  background: var(--amber);
}

.channel-body {
  display: grid;
  gap: 14px;
}

.control-group {
  display: grid;
  gap: 9px;
}

.control-label {
  color: var(--ink-muted);
  font-size: 0.73rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.vol-value {
  color: var(--ink);
  font-size: 0.8rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.vol-slider,
.pan-slider {
  min-height: 18px;
}

.vol-slider,
.pan-slider,
.seek-bar {
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
}

.vol-slider::-webkit-slider-runnable-track,
.pan-slider::-webkit-slider-runnable-track,
.seek-bar::-webkit-slider-runnable-track {
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: rgba(15, 31, 52, 0.24);
}

.vol-slider::-webkit-slider-thumb,
.pan-slider::-webkit-slider-thumb,
.seek-bar::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  margin-top: -6px;
  border-radius: 50%;
  border: 0;
  background: var(--stem-color, var(--teal));
}

.seek-bar::-webkit-slider-runnable-track {
  background: rgba(255, 255, 255, 0.82);
}

.vol-slider::-moz-range-track,
.pan-slider::-moz-range-track,
.seek-bar::-moz-range-track {
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: rgba(15, 31, 52, 0.24);
}

.seek-bar::-moz-range-track {
  background: rgba(255, 255, 255, 0.82);
}

.vol-slider::-moz-range-thumb,
.pan-slider::-moz-range-thumb,
.seek-bar::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 0;
  background: var(--stem-color, var(--teal));
}

.pan-wrapper {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 8px;
}

.pan-side {
  color: var(--ink-muted);
  font-size: 0.75rem;
  font-weight: 900;
}

.vol-slider {
  accent-color: var(--stem-color);
}

.btn-download {
  width: 100%;
  margin-top: 18px;
  color: #061b19;
  background: #7de0d8;
}

.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(13, 17, 21, 0.76);
  backdrop-filter: blur(8px);
}

.loader-box {
  width: min(360px, 100%);
  padding: 28px;
  border-radius: 8px;
  color: #f7fbfb;
  background: #161c22;
  border: 1px solid var(--line-dark);
  box-shadow: var(--shadow);
  text-align: center;
  display: grid;
  justify-items: center;
  gap: 16px;
  font-weight: 800;
}

.loader-bars {
  height: 44px;
  display: flex;
  align-items: end;
  gap: 6px;
}

.loader-bars span {
  width: 8px;
  height: 18px;
  border-radius: 99px;
  background: #7de0d8;
  animation: bounce-bar 0.86s ease-in-out infinite alternate;
}

.loader-bars span:nth-child(2) { animation-delay: 0.12s; background: var(--amber); }
.loader-bars span:nth-child(3) { animation-delay: 0.24s; background: var(--coral); }
.loader-bars span:nth-child(4) { animation-delay: 0.36s; background: var(--blue); }

@keyframes bounce-bar {
  from { height: 14px; }
  to { height: 42px; }
}

.hidden {
  display: none !important;
}

.fun-progress-container {
  display: grid;
  gap: 12px;
  width: 100%;
}

.fun-progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.95rem;
}

.fun-progress-text {
  color: var(--teal-dark);
  font-weight: 800;
  animation: pulse-text 2s infinite;
}

.fun-progress-percentage {
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
  font-weight: 900;
}

.fun-progress-bar {
  width: 100%;
  height: 8px;
  background: rgba(24, 32, 38, 0.08);
  border-radius: 999px;
  overflow: hidden;
}

.fun-progress-fill {
  height: 100%;
  background: var(--teal);
  border-radius: 999px;
  transition: width 0.4s ease-out;
  position: relative;
}

.fun-progress-fill::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  right: 0;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.3) 50%,
    rgba(255, 255, 255, 0) 100%
  );
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

@keyframes pulse-text {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

.status.active-progress {
  border-color: rgba(8, 114, 95, 0.35);
  background: #eef8f5;
  box-shadow: 0 4px 12px rgba(8, 114, 95, 0.08);
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
    padding-top: 24px;
  }

  .intro-panel {
    min-height: 360px;
  }

  .channels-grid {
    grid-template-columns: repeat(2, minmax(230px, 1fr));
  }
}

@media (max-width: 680px) {
  .app-shell {
    width: min(100% - 20px, 1180px);
    padding-bottom: 28px;
  }

  .intro-panel,
  .source-card,
  .mixer-section {
    padding: 20px;
  }

  .brand-mark {
    position: static;
    margin-bottom: 16px;
  }

  .section-heading,
  .mixer-topbar,
  .player-controls,
  .pitch-panel {
    grid-template-columns: 1fr;
    flex-direction: column;
  }

  .sample-panel {
    width: 100%;
    max-width: none;
  }

  .visualizer-container {
    width: 100%;
  }

  .source-tabs,
  .channels-grid {
    grid-template-columns: 1fr;
  }

  .player-controls {
    display: grid;
  }

  .transport {
    justify-content: center;
  }
}

.retention-notice {
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: 12px;
  align-items: start;
  padding: 14px 16px;
  margin: 18px 0;
  border: 1px solid rgba(20, 184, 166, 0.26);
  border-radius: 8px;
  background: rgba(20, 184, 166, 0.08);
  color: #d7fffa;
}

.retention-notice i {
  width: 20px;
  height: 20px;
  color: #5eead4;
}

.retention-notice strong {
  display: block;
  margin-bottom: 4px;
  color: #ffffff;
}

.retention-notice p {
  margin: 4px 0 0;
  color: rgba(235, 255, 252, 0.82);
  line-height: 1.45;
}

.history-section {
  margin-top: 22px;
  padding: 22px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.72);
}

.history-section .kicker {
  color: #7de0d8;
}

.history-section h2 {
  color: #f8fafc;
}

.history-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.history-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
}

.history-item h3 {
  margin: 0;
  color: #ffffff;
  font-size: 0.98rem;
}

.history-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
  color: rgba(226, 232, 240, 0.76);
  font-size: 0.86rem;
}

.history-status {
  color: #5eead4;
  font-weight: 700;
}

.history-status.expired,
.history-status.failed {
  color: #fca5a5;
}

.history-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.history-empty {
  padding: 14px;
  color: rgba(226, 232, 240, 0.72);
}

@media (max-width: 720px) {
  .history-item {
    grid-template-columns: 1fr;
  }

  .history-actions {
    justify-content: flex-start;
  }
}
