:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --panel: #ffffff;
  --ink: #162033;
  --muted: #637083;
  --line: #d8dee8;
  --accent: #2563eb;
  --accent-dark: #1d4ed8;
  --success-bg: #e8f7ee;
  --success-text: #17623b;
  --shadow: 0 18px 48px rgba(25, 37, 61, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: linear-gradient(135deg, #f5f7fb 0%, #eef4f8 48%, #f8f7f2 100%);
  color: var(--ink);
}

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

.app-shell {
  width: min(1080px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 40px 0;
}

.workspace {
  background: var(--panel);
  border: 1px solid rgba(216, 222, 232, 0.85);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 28px;
}

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

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1.05;
  letter-spacing: 0;
}

.topbar p,
.result p,
.meta {
  color: var(--muted);
}

.topbar p {
  margin-top: 8px;
  font-size: 17px;
}

.status-pill {
  flex: 0 0 auto;
  min-height: 34px;
  border-radius: 999px;
  padding: 7px 12px;
  background: var(--success-bg);
  color: var(--success-text);
  font-size: 14px;
  white-space: nowrap;
}

.editor {
  display: grid;
  gap: 18px;
}

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

.field span {
  font-weight: 700;
}

.field strong {
  font-weight: 700;
  color: var(--accent);
}

textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  outline: none;
}

textarea:focus,
select:focus,
input[type="range"]:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.16);
}

textarea {
  min-height: 300px;
  resize: vertical;
  padding: 16px;
  line-height: 1.65;
  font-size: 17px;
}

.style-input {
  min-height: 92px;
  font-size: 15px;
}

select {
  height: 46px;
  padding: 0 12px;
}

.controls {
  display: grid;
  grid-template-columns: minmax(170px, 220px) minmax(0, 1fr) minmax(200px, 260px);
  gap: 18px;
  align-items: end;
}

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

.action-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

button,
.download-button {
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  padding: 13px 18px;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  min-width: 132px;
}

button:hover,
.download-button:hover {
  background: var(--accent-dark);
}

button:disabled {
  cursor: wait;
  background: #8aa6e7;
}

.result {
  display: grid;
  gap: 14px;
  margin-top: 22px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

[hidden] {
  display: none !important;
}

.result[hidden] {
  display: none;
}

h2 {
  font-size: 20px;
  line-height: 1.2;
}

audio {
  width: 100%;
}

.download-button {
  width: fit-content;
}

@media (max-width: 720px) {
  .app-shell {
    width: min(100vw - 20px, 1080px);
    padding: 10px 0;
  }

  .workspace {
    padding: 18px;
  }

  .topbar,
  .action-row {
    display: grid;
  }

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

  .status-pill,
  button,
  .download-button {
    width: 100%;
  }

  textarea {
    min-height: 260px;
  }
}
