:root {
  color-scheme: light;
  --bg: #f3efe6;
  --panel: rgba(255, 252, 245, 0.86);
  --panel-border: rgba(78, 56, 31, 0.14);
  --ink: #2e2417;
  --muted: #6d5b44;
  --accent: #0d7c66;
  --accent-strong: #095a4a;
  --accent-soft: rgba(13, 124, 102, 0.12);
  --shadow: 0 28px 80px rgba(73, 54, 31, 0.14);
  --radius: 24px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Georgia, "Times New Roman", serif;
  color: var(--ink);
  background:
    radial-gradient(
      circle at top left,
      rgba(230, 181, 104, 0.26),
      transparent 28%
    ),
    radial-gradient(
      circle at bottom right,
      rgba(13, 124, 102, 0.22),
      transparent 30%
    ),
    linear-gradient(160deg, #f5f1e8 0%, #efe5d4 48%, #e7dcc7 100%);
}

.app-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 18px;
}

.panel {
  width: min(760px, 100%);
  padding: 32px;
  border-radius: var(--radius);
  background: var(--panel);
  border: 1px solid var(--panel-border);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.eyebrow {
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.74rem;
  color: var(--accent-strong);
}

h1 {
  margin: 0;
  font-size: clamp(2.2rem, 5vw, 4rem);
  line-height: 0.95;
}

.intro,
.hint,
.status-line {
  color: var(--muted);
}

.intro {
  margin: 14px 0 24px;
  max-width: 56ch;
  font-size: 1.03rem;
}

.field-group {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
}

label {
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

select,
textarea,
button,
a {
  font: inherit;
}

select,
textarea {
  width: 100%;
  border-radius: 18px;
  border: 1px solid rgba(62, 45, 20, 0.16);
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  padding: 14px 16px;
  outline: none;
}

select:focus,
textarea:focus {
  border-color: rgba(13, 124, 102, 0.55);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

textarea {
  resize: vertical;
  min-height: 170px;
  line-height: 1.5;
}

.status-grid {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
}

.status-line {
  margin: 0;
  padding: 11px 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.54);
  border: 1px solid rgba(62, 45, 20, 0.1);
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 8px;
}

button,
#downloadLink {
  border: 0;
  border-radius: 999px;
  padding: 13px 18px;
  text-decoration: none;
  cursor: pointer;
  transition:
    transform 140ms ease,
    box-shadow 140ms ease,
    background 140ms ease;
}

button {
  color: #fbf7f2;
  background: linear-gradient(
    135deg,
    var(--accent) 0%,
    var(--accent-strong) 100%
  );
  box-shadow: 0 12px 28px rgba(13, 124, 102, 0.24);
}

button:hover,
#downloadLink:hover {
  transform: translateY(-1px);
}

button:disabled {
  cursor: not-allowed;
  transform: none;
  opacity: 0.54;
  box-shadow: none;
}

#stopPlaybackButton {
  background: linear-gradient(135deg, #a5452b 0%, #6c1d12 100%);
  box-shadow: 0 12px 28px rgba(108, 29, 18, 0.24);
}

#downloadLink {
  display: inline-block;
  margin-top: 16px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(62, 45, 20, 0.16);
}

.hint {
  margin: 18px 0 0;
}

.preview-panel {
  margin-top: 26px;
  padding: 18px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid rgba(62, 45, 20, 0.12);
}

.preview-header {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
  margin-bottom: 14px;
}

.preview-eyebrow {
  margin: 0 0 6px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.72rem;
  color: var(--accent-strong);
}

.preview-panel h2 {
  margin: 0;
  font-size: 1.1rem;
  line-height: 1.2;
}

.duration-output {
  margin: 0;
  color: var(--muted);
  white-space: nowrap;
}

.waveform-canvas {
  display: block;
  width: 100%;
  height: 180px;
  margin-bottom: 16px;
  border-radius: 18px;
  border: 1px solid rgba(62, 45, 20, 0.08);
  background: rgba(255, 255, 255, 0.7);
}

#previewAudio {
  width: 100%;
}

@media (max-width: 640px) {
  .panel {
    padding: 22px;
  }

  .action-row {
    flex-direction: column;
  }

  button,
  #downloadLink {
    width: 100%;
    text-align: center;
  }

  .preview-header {
    flex-direction: column;
    align-items: start;
  }
}
