:root {
  --ink: #1b1a18;
  --paper: #f6efe2;
  --paper-strong: #fffaf1;
  --panel: rgba(255, 250, 241, 0.84);
  --line: rgba(39, 32, 20, 0.14);
  --line-strong: rgba(39, 32, 20, 0.26);
  --accent: #ac3f1e;
  --accent-strong: #812a12;
  --accent-soft: rgba(172, 63, 30, 0.12);
  --sage: #5e6a4f;
  --shadow: 0 22px 60px rgba(57, 39, 14, 0.14);
  --font-display: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", serif;
  --font-body: "Avenir Next", "Segoe UI", "Helvetica Neue", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  color: var(--ink);
  font-family: var(--font-body);
  background:
    radial-gradient(circle at top left, rgba(234, 134, 76, 0.18), transparent 30%),
    radial-gradient(circle at bottom right, rgba(92, 113, 74, 0.16), transparent 32%),
    linear-gradient(180deg, #f8f3e7 0%, #eee1c6 100%);
}

button,
input,
select,
textarea {
  font: inherit;
}

.page-shell {
  position: relative;
  overflow: hidden;
  min-height: 100vh;
  padding: 40px 20px 56px;
}

.ambient {
  position: absolute;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  filter: blur(18px);
  opacity: 0.44;
  pointer-events: none;
}

.ambient-left {
  top: -90px;
  left: -120px;
  background: radial-gradient(circle, rgba(174, 87, 42, 0.34), transparent 68%);
}

.ambient-right {
  right: -110px;
  bottom: 10%;
  background: radial-gradient(circle, rgba(88, 110, 74, 0.26), transparent 68%);
}

.hero,
.workspace {
  position: relative;
  z-index: 1;
  max-width: 1180px;
  margin: 0 auto;
}

.hero {
  margin-bottom: 26px;
}

.eyebrow,
.panel-kicker {
  margin: 0 0 8px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--accent-strong);
}

.hero h1 {
  margin: 0;
  max-width: 780px;
  font-family: var(--font-display);
  font-size: clamp(2.6rem, 5vw, 5rem);
  line-height: 0.95;
  letter-spacing: -0.03em;
}

.hero-copy {
  max-width: 650px;
  margin: 18px 0 0;
  font-size: 1.06rem;
  line-height: 1.65;
  color: rgba(27, 26, 24, 0.82);
}

.hero-notes {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.hero-notes span,
.file-pill,
.ghost-button,
.primary-button {
  transition:
    transform 140ms ease,
    box-shadow 140ms ease,
    background-color 140ms ease,
    border-color 140ms ease;
}

.hero-notes span {
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(255, 250, 241, 0.7);
  border: 1px solid rgba(39, 32, 20, 0.08);
  backdrop-filter: blur(8px);
}

.workspace {
  display: grid;
  grid-template-columns: 1.35fr 0.9fr;
  gap: 18px;
}

.panel {
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 28px;
  padding: 22px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.panel-source {
  grid-row: span 2;
}

.panel-output {
  grid-column: span 2;
}

.panel-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.panel-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.7rem;
  line-height: 1.05;
}

.file-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--paper-strong);
  cursor: pointer;
  font-weight: 700;
}

.file-pill:hover,
.ghost-button:hover,
.primary-button:hover {
  transform: translateY(-1px);
}

.file-pill input {
  display: none;
}

.source-meta,
.panel-note,
.output-actions,
.textarea-footer,
.status-detail,
.muted {
  color: rgba(27, 26, 24, 0.72);
}

.source-meta {
  display: grid;
  gap: 6px;
  margin-bottom: 16px;
}

.source-meta p,
.panel-note p,
.output-actions p {
  margin: 0;
}

.textarea-wrap {
  display: grid;
  gap: 10px;
}

.field-label {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.92rem;
  font-weight: 700;
}

textarea,
select,
input[type="range"] {
  width: 100%;
}

textarea,
select {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.8);
}

textarea {
  min-height: 420px;
  padding: 18px;
  resize: vertical;
  line-height: 1.6;
}

textarea:focus,
select:focus,
input[type="range"]:focus {
  outline: 2px solid rgba(172, 63, 30, 0.2);
  outline-offset: 2px;
}

.textarea-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-top: 12px;
}

.control-grid {
  display: grid;
  gap: 16px;
}

.field {
  display: grid;
  gap: 10px;
}

select {
  padding: 13px 14px;
}

.field-range {
  padding: 14px 16px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.54);
  border: 1px solid rgba(39, 32, 20, 0.08);
}

input[type="range"] {
  accent-color: var(--accent);
}

.actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.primary-button,
.ghost-button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  padding: 13px 18px;
  border-radius: 16px;
  border: 1px solid transparent;
  text-decoration: none;
  cursor: pointer;
  font-weight: 700;
}

.primary-button {
  color: #fffdf8;
  background: linear-gradient(135deg, var(--accent) 0%, #cc6439 100%);
  box-shadow: 0 14px 28px rgba(172, 63, 30, 0.2);
}

.ghost-button {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.72);
  border-color: var(--line);
}

.primary-button[disabled],
.ghost-button[disabled],
.primary-button.disabled {
  opacity: 0.45;
  pointer-events: none;
  box-shadow: none;
}

.status-card,
.output-card {
  padding: 18px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(39, 32, 20, 0.08);
}

.status-card[data-tone="working"] {
  background: linear-gradient(180deg, rgba(255, 246, 230, 0.96), rgba(255, 255, 255, 0.72));
}

.status-card[data-tone="success"] {
  background: linear-gradient(180deg, rgba(239, 248, 237, 0.96), rgba(255, 255, 255, 0.72));
}

.status-card[data-tone="error"] {
  background: linear-gradient(180deg, rgba(255, 236, 229, 0.96), rgba(255, 255, 255, 0.72));
}

.status-line {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: baseline;
}

.status-detail {
  margin: 10px 0 14px;
  line-height: 1.55;
}

.progress-wrap {
  height: 10px;
  border-radius: 999px;
  background: rgba(39, 32, 20, 0.08);
  overflow: hidden;
}

.progress-bar {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent) 0%, #e38b5f 55%, #f3bb8a 100%);
  transition: width 180ms ease;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin: 18px 0 0;
}

.stats-grid div {
  padding: 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.56);
  border: 1px solid rgba(39, 32, 20, 0.07);
}

.stats-grid dt {
  margin-bottom: 6px;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: rgba(27, 26, 24, 0.58);
}

.stats-grid dd {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
}

.output-card {
  display: grid;
  gap: 16px;
}

#audio-preview {
  width: 100%;
}

.output-actions {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
}

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

  .panel-source,
  .panel-output {
    grid-row: auto;
    grid-column: auto;
  }

  textarea {
    min-height: 320px;
  }
}

@media (max-width: 640px) {
  .page-shell {
    padding: 24px 14px 40px;
  }

  .panel {
    padding: 18px;
    border-radius: 22px;
  }

  .hero-copy {
    font-size: 1rem;
  }

  .panel-head,
  .output-actions,
  .textarea-footer,
  .status-line {
    flex-direction: column;
    align-items: stretch;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .actions {
    flex-direction: column;
  }
}
