:root {
  --bg: #0c0e14;
  --panel: #131722;
  --border: #252a3a;
  --text: #e8ebf4;
  --muted: #8b93a7;
  --accent: #6ee7ff;
  --accent-dim: #2a6d7a;
  --danger: #f87171;
  --radius: 14px;
  --font: "DM Sans", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
}

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

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

.bg-grid {
  position: fixed;
  inset: 0;
  background-image: linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, black 20%, transparent 100%);
  pointer-events: none;
  z-index: 0;
}

.shell {
  position: relative;
  z-index: 1;
  max-width: 880px;
  margin: 0 auto;
  padding: 2.5rem 1.25rem 4rem;
}

.hero {
  margin-bottom: 2rem;
}

.eyebrow {
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 0.5rem;
}

h1 {
  font-size: clamp(1.75rem, 4vw, 2.25rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 0.75rem;
}

.lede {
  color: var(--muted);
  max-width: 62ch;
  margin: 0;
}

code {
  font-family: var(--mono);
  font-size: 0.9em;
  background: rgba(110, 231, 255, 0.08);
  padding: 0.1em 0.35em;
  border-radius: 6px;
}

.health {
  margin-top: 1rem;
  font-size: 0.875rem;
  min-height: 1.25rem;
}

.health.ok::before {
  content: "● ";
  color: #4ade80;
}

.health.warn::before {
  content: "● ";
  color: var(--danger);
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
}

.panel.output {
  margin-top: 1.5rem;
}

.panel-gap {
  margin-top: 1rem;
}

.panel-title {
  font-size: 1rem;
  margin: 0 0 1rem;
  color: var(--muted);
  font-weight: 600;
}

.panel.output h2 {
  font-size: 1rem;
  margin: 0 0 1rem;
  color: var(--muted);
  font-weight: 600;
}

.field {
  margin-bottom: 1.25rem;
}

.field label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: #c5cbe0;
}

textarea,
input[type="text"],
select {
  width: 100%;
  font: inherit;
  color: var(--text);
  background: #0a0c12;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.65rem 0.85rem;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

textarea:focus,
input:focus,
select:focus {
  border-color: var(--accent-dim);
  box-shadow: 0 0 0 3px rgba(110, 231, 255, 0.12);
}

textarea {
  resize: vertical;
  min-height: 140px;
}

.row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
}

@media (max-width: 640px) {
  .row {
    grid-template-columns: 1fr;
  }
}

.field.small label {
  font-size: 0.8rem;
}

.dropzone {
  position: relative;
  border: 1px dashed var(--border);
  border-radius: 12px;
  min-height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.dropzone:hover,
.dropzone:focus-within,
.dropzone.drag {
  border-color: var(--accent-dim);
  background: rgba(110, 231, 255, 0.04);
}

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

.dropzone-inner {
  text-align: center;
  padding: 1rem;
  pointer-events: none;
}

.dz-title {
  display: block;
  font-weight: 600;
}

.dz-hint {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 0.35rem;
}

.preview {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #08090d;
  z-index: 1;
  pointer-events: none;
}

.preview.hidden {
  display: none;
}

.dropzone.has-image .dropzone-inner {
  opacity: 0;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
  margin-top: 0.5rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font: inherit;
  font-weight: 600;
  padding: 0.7rem 1.25rem;
  border-radius: 10px;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.08s ease, opacity 0.15s ease;
}

.btn:active {
  transform: scale(0.98);
}

.btn.primary {
  background: linear-gradient(135deg, #5eead4, var(--accent));
  color: #0a0f12;
  border-color: rgba(255, 255, 255, 0.2);
}

.btn.primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn.ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text);
}

.btn.ghost:hover {
  border-color: var(--muted);
}

.status {
  flex: 1;
  min-width: 200px;
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.status.error {
  color: var(--danger);
}

.player {
  width: 100%;
  max-height: 70vh;
  border-radius: 10px;
  background: #000;
  border: 1px solid var(--border);
}

.audio-player {
  width: 100%;
  margin-top: 0.75rem;
}

.output-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
  margin-top: 1rem;
}

.debug-panels {
  margin-top: 1rem;
  display: grid;
  gap: 0.75rem;
}

.debug-panels details {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #0b0e15;
  padding: 0.6rem 0.75rem;
}

.debug-panels summary {
  cursor: pointer;
  color: #c5cbe0;
  font-size: 0.9rem;
}

.debug-box {
  margin: 0.75rem 0 0;
  font-family: var(--mono);
  font-size: 0.75rem;
  color: #d6dbeb;
  white-space: pre-wrap;
  word-break: break-word;
}

.mono {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--muted);
  word-break: break-all;
}

.profiles-list {
  display: grid;
  gap: 0.8rem;
}

.profile-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #0b0e15;
  padding: 0.9rem;
}

.profile-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
}

.profile-head h3 {
  margin: 0;
  font-size: 1rem;
}

.profile-source {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.1rem 0.5rem;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.profile-source-custom {
  border-color: rgba(110, 231, 255, 0.45);
  color: var(--accent);
}

.profile-source-default {
  color: var(--muted);
}

.profile-actions {
  margin-top: 0.7rem;
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}
