:root {
  color-scheme: dark;
  --bg: #090b0d;
  --panel: #101418;
  --panel-2: #151b20;
  --line: rgba(226, 232, 240, 0.13);
  --text: #f3f7fa;
  --muted: #9aa7b2;
  --accent: #2dd4bf;
  --accent-2: #60a5fa;
  --danger: #fb7185;
}

* { box-sizing: border-box; }

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

body {
  background:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    var(--bg);
  background-size: 28px 28px;
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

main {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0;
}

header {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 18px;
}

.back,
.download,
button,
.file span {
  min-height: 40px;
  border: 1px solid rgba(96, 165, 250, 0.45);
  border-radius: 7px;
  background: #1d4ed8;
  color: #f8fafc;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 13px;
  font: inherit;
  font-size: 13px;
  font-weight: 760;
  text-decoration: none;
}

.back,
.download,
button:disabled {
  background: var(--panel-2);
  border-color: var(--line);
  color: #cbd5df;
}

button:disabled {
  cursor: default;
  opacity: 0.55;
}

.eyebrow {
  color: var(--accent);
  font-size: 12px;
  font-weight: 780;
  letter-spacing: 0.08em;
  margin: 0 0 4px;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(32px, 6vw, 64px);
  line-height: 0.95;
}

h2 {
  color: #dce5ec;
  font-size: 13px;
  letter-spacing: 0.08em;
  margin-bottom: 14px;
  text-transform: uppercase;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(240px, 0.9fr) minmax(320px, 1.3fr) minmax(240px, 0.9fr);
  gap: 14px;
  align-items: start;
}

.panel {
  background: rgba(16, 20, 24, 0.92);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.28);
}

.main-panel {
  min-height: 440px;
}

.controls,
.settings {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.controls {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.file input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
  pointer-events: none;
}

label {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  margin-top: 14px;
}

.settings label {
  margin-top: 0;
}

.settings span {
  display: block;
  margin-bottom: 6px;
}

textarea,
input[type="number"] {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #070a0d;
  color: var(--text);
  font: inherit;
  font-size: 16px;
  line-height: 1.45;
  outline: none;
  padding: 10px 12px;
}

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

#text {
  min-height: 210px;
}

audio {
  width: 100%;
  margin-top: 14px;
}

#generateButton {
  width: 100%;
  margin-top: 14px;
}

.meter {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #050709;
  border: 1px solid var(--line);
}

#progressBar {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 180ms ease;
}

.status-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

#progress {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.download {
  width: 100%;
  margin-top: 12px;
}

.timing {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  margin-top: 12px;
}

.diagnostics {
  min-height: 72px;
  max-height: 220px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #050709;
  color: #b7c4cf;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  line-height: 1.45;
  margin: 12px 0 0;
  padding: 10px;
}

@media (max-width: 920px) {
  body {
    background-size: 22px 22px;
  }

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

  .main-panel {
    min-height: 0;
  }
}

@media (max-width: 520px) {
  main {
    width: min(100% - 20px, 1180px);
    padding: 16px 0;
  }

  header {
    align-items: flex-start;
    flex-direction: column;
  }

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