:root {
  color-scheme: light;
  --bg: #f7f7f4;
  --ink: #151515;
  --muted: #667085;
  --line: #deded8;
  --panel: #ffffff;
  --accent: #111111;
  --accent-2: #d64b35;
  --soft: #eef4f2;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.shell {
  width: min(1220px, calc(100vw - 32px));
  margin: 28px auto;
}

.topbar, .workspace, .result-head, .controls, .voice-grid, .voice-controls {
  display: grid;
  gap: 16px;
}

.topbar {
  grid-template-columns: 1fr auto;
  align-items: center;
  margin-bottom: 16px;
}

h1, h2, p { margin: 0; }
h1 { font-size: clamp(34px, 5vw, 64px); line-height: 0.95; }
h2 { font-size: 22px; }

.eyebrow {
  color: var(--accent-2);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.status {
  min-width: 120px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 10px 14px;
  color: var(--muted);
  text-align: center;
}

.modebar {
  display: flex;
  gap: 8px;
  margin: 0 0 22px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}

.mode {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  font-weight: 800;
  padding: 10px 14px;
}

.mode.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.tool-section { display: none; }
.tool-section.active { display: block; }

.workspace {
  grid-template-columns: minmax(320px, 420px) 1fr;
  align-items: start;
}

.voice-grid {
  grid-template-columns: minmax(360px, 500px) 1fr;
  align-items: start;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 22px;
}

.section-title { margin-bottom: 16px; }

.dropzone {
  display: grid;
  place-items: center;
  gap: 9px;
  min-height: 260px;
  border: 2px dashed var(--line);
  border-radius: 8px;
  background: var(--soft);
  cursor: pointer;
  text-align: center;
  padding: 26px;
}

.dropzone.dragover { border-color: var(--accent-2); background: #fff4ef; }
.dropzone input { display: none; }

.upload-icon {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #fff;
  font-size: 13px;
  font-weight: 900;
}

.dropzone small, .hint, .file-name { color: var(--muted); }

.file-name {
  max-width: 100%;
  overflow-wrap: anywhere;
  font-size: 14px;
}

.controls {
  grid-template-columns: 1fr 140px;
  margin: 18px 0;
}

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

.voice-controls {
  grid-template-columns: 120px 1fr 1fr;
  margin: 16px 0;
}

label {
  color: #344054;
  display: block;
  font-size: 14px;
  font-weight: 700;
}

select, input[type="number"], textarea {
  width: 100%;
  margin-top: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  padding: 0 12px;
}

select, input[type="number"] { height: 44px; }

textarea {
  min-height: 220px;
  padding: 12px;
  resize: vertical;
  line-height: 1.5;
}

.button-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
}

.primary, .secondary {
  min-height: 48px;
  border-radius: 8px;
  cursor: pointer;
  font: inherit;
  font-size: 16px;
  font-weight: 800;
  padding: 0 18px;
}

.primary {
  width: 100%;
  border: 0;
  background: var(--accent);
  color: white;
}

.secondary {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

.primary:disabled { cursor: wait; opacity: 0.62; }

.hint {
  margin-top: 12px;
  font-size: 14px;
  line-height: 1.45;
}

.result, .voice-output { min-height: 520px; }

.result-head {
  grid-template-columns: 1fr auto;
  align-items: end;
  border-bottom: 1px solid var(--line);
  padding-bottom: 16px;
}

.downloads {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.downloads button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 9px 12px;
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.transcript {
  max-height: 540px;
  overflow: auto;
  margin: 18px 0 0;
  white-space: pre-wrap;
  color: #111827;
  font: 17px/1.7 Consolas, "Courier New", monospace;
}

.transcript.compact {
  max-height: 220px;
  font-size: 15px;
}

audio {
  display: block;
  width: 100%;
  margin-top: 22px;
}

@media (max-width: 900px) {
  .topbar, .workspace, .result-head, .controls, .voice-grid, .voice-controls, .button-row {
    grid-template-columns: 1fr;
  }

  .status, .downloads { justify-self: start; }
  .modebar { flex-wrap: wrap; }
}
