:root {
  --bg: #050816;
  --bg-alt: #0b1020;
  --accent: #7c3aed;
  --accent-soft: rgba(124, 58, 237, 0.15);
  --accent-strong: #a855f7;
  --text: #f9fafb;
  --muted: #9ca3af;
  --border: #1f2937;
  --error: #f97373;
  --success: #4ade80;
  --radius-lg: 16px;
  --radius-md: 10px;
  --radius-pill: 999px;
  --shadow-soft: 0 18px 45px rgba(15, 23, 42, 0.75);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text",
    "Segoe UI", sans-serif;
  background: radial-gradient(circle at top, #111827 0, #020617 45%, #000 100%);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

.app-container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 32px 16px 40px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.app-header {
  text-align: center;
  padding: 18px 16px 10px;
}

.app-header h1 {
  font-size: clamp(2rem, 3vw, 2.6rem);
  margin: 0 0 8px;
  letter-spacing: 0.03em;
  background: linear-gradient(120deg, #fff, var(--accent-strong));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.app-header p {
  margin: 0;
  color: var(--muted);
  font-size: 0.98rem;
}

.app-main {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.3fr);
  gap: 22px;
}

@media (max-width: 880px) {
  .app-main {
    grid-template-columns: minmax(0, 1fr);
  }
}

.upload-card,
.results-card {
  background: radial-gradient(circle at top left, #111827 0, #020617 52%);
  border-radius: var(--radius-lg);
  padding: 20px 20px 18px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-soft);
  position: relative;
  overflow: hidden;
}

.upload-card::before,
.results-card::before {
  content: "";
  position: absolute;
  inset: -40%;
  background: radial-gradient(
    circle at top left,
    rgba(124, 58, 237, 0.13),
    transparent 55%
  );
  opacity: 0.9;
  pointer-events: none;
  z-index: -1;
}

.upload-card h2,
.results-card h2 {
  margin: 0 0 10px;
  font-size: 1.05rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}

.hint {
  margin: 0 0 14px;
  font-size: 0.86rem;
  color: var(--muted);
}

.file-drop {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  position: relative;
  border-radius: var(--radius-lg);
  border: 1px dashed rgba(148, 163, 184, 0.75);
  padding: 26px 18px;
  cursor: pointer;
  background: radial-gradient(circle at top, #020617 0, #020617 60%, #000 100%);
  transition: border-color 0.18s ease, background 0.18s ease, transform 0.12s;
}

.file-drop input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.file-drop-text {
  font-size: 0.95rem;
  color: var(--muted);
}

.file-drop::after {
  content: "🎧";
  position: absolute;
  top: 10px;
  right: 14px;
  opacity: 0.6;
  font-size: 1.25rem;
}

.file-drop.drag-over {
  border-color: var(--accent-strong);
  background: radial-gradient(
    circle at top,
    rgba(124, 58, 237, 0.08),
    #020617 50%,
    #000 100%
  );
  transform: translateY(-1px);
}

.primary-btn {
  margin-top: 14px;
  width: 100%;
  border: none;
  outline: none;
  border-radius: var(--radius-pill);
  padding: 10px 18px;
  font-size: 0.96rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
  background: linear-gradient(130deg, var(--accent), var(--accent-strong));
  color: #f9fafb;
  box-shadow: 0 14px 40px rgba(88, 28, 135, 0.8);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: transform 0.12s ease, box-shadow 0.12s ease,
    filter 0.15s ease, opacity 0.15s ease;
}

.primary-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  filter: brightness(1.05);
  box-shadow: 0 18px 50px rgba(79, 70, 229, 0.9);
}

.primary-btn:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.9);
}

.primary-btn:disabled {
  opacity: 0.5;
  cursor: default;
  box-shadow: none;
}

.primary-btn.loading {
  position: relative;
  cursor: wait;
  opacity: 0.8;
}

.primary-btn.loading::after {
  content: "";
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 2px solid rgba(248, 250, 252, 0.4);
  border-top-color: #f9fafb;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.status {
  margin-top: 10px;
  font-size: 0.84rem;
  color: var(--muted);
  min-height: 1.3em;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid transparent;
  transition: all 0.3s ease;
  word-wrap: break-word;
}

.status-info {
  color: #60a5fa;
  background: rgba(96, 165, 250, 0.1);
  border-color: rgba(96, 165, 250, 0.2);
  animation: pulse-info 2s ease-in-out infinite;
}

.status-success {
  color: var(--success);
  background: rgba(74, 222, 128, 0.1);
  border-color: rgba(74, 222, 128, 0.2);
}

.status-error {
  color: var(--error);
  background: rgba(249, 115, 115, 0.1);
  border-color: rgba(249, 115, 115, 0.2);
}

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

.results-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.stems-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  max-height: 420px;
  overflow-y: auto;
  padding-right: 4px;
}

.stem-card {
  background: linear-gradient(
    135deg,
    rgba(15, 23, 42, 0.96),
    rgba(15, 23, 42, 0.92)
  );
  border-radius: var(--radius-md);
  border: 1px solid rgba(55, 65, 81, 0.9);
  padding: 10px 12px;
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1.2fr);
  gap: 6px 12px;
  align-items: center;
}

@media (max-width: 720px) {
  .stem-card {
    grid-template-columns: minmax(0, 1fr);
  }
}

.stem-card h3 {
  margin: 0;
  font-size: 0.96rem;
  color: #e5e7eb;
}

.stem-card audio {
  width: 100%;
}

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

.volume-wrapper span {
  font-size: 0.8rem;
  color: var(--muted);
  min-width: 50px;
}

.volume-wrapper input[type="range"] {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  border-radius: 999px;
  background: rgba(55, 65, 81, 0.9);
  outline: none;
}

.volume-wrapper input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent-strong);
  border: 2px solid #111827;
  box-shadow: 0 0 0 4px rgba(168, 85, 247, 0.25);
}

.volume-wrapper input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent-strong);
  border: 2px solid #111827;
  box-shadow: 0 0 0 4px rgba(168, 85, 247, 0.25);
}

.secondary-btn {
  justify-self: flex-end;
  text-decoration: none;
  border-radius: var(--radius-pill);
  padding: 7px 12px;
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border: 1px solid rgba(148, 163, 184, 0.6);
  color: #e5e7eb;
  background: radial-gradient(circle at top, #020617 0, #020617 60%, #000 100%);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: border-color 0.16s ease, background 0.16s ease,
    transform 0.12s ease;
}

.secondary-btn:hover {
  border-color: var(--accent);
  background: radial-gradient(
    circle at top,
    rgba(124, 58, 237, 0.14),
    #020617 60%,
    #000 100%
  );
  transform: translateY(-0.5px);
}

.secondary-btn::before {
  content: "↓";
  font-size: 0.7rem;
}

.app-footer {
  margin-top: 8px;
  text-align: center;
  font-size: 0.8rem;
  color: var(--muted);
}

.app-footer code {
  background: rgba(15, 23, 42, 0.9);
  padding: 2px 6px;
  border-radius: 6px;
  border: 1px solid rgba(31, 41, 55, 0.9);
}


