:root {
  --bg: #f6f2ea;
  --ink: #1f1a17;
  --muted: #5a514a;
  --card: #fff9f1;
  --accent: #d4551f;
  --accent-dark: #b64517;
  --border: #e5d8c7;
  --shadow: 0 18px 40px rgba(31, 26, 23, 0.12);
  --radius: 20px;
  --pad: 22px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Helvetica Neue", "Segoe UI", ui-sans-serif, system-ui, sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at top, #fff6e8 0%, var(--bg) 55%, #efe3d2 100%);
  min-height: 100vh;
}

.app {
  max-width: 860px;
  margin: 0 auto;
  padding: 48px 20px 80px;
  display: grid;
  gap: 24px;
}

.hero {
  background: linear-gradient(120deg, #f6d7b8, #f4b08a);
  color: #2c1c12;
  padding: 32px var(--pad);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.hero h1 {
  font-size: clamp(2.2rem, 3vw, 3.2rem);
  margin: 10px 0;
  letter-spacing: -0.02em;
}

.hero .subhead {
  margin: 0;
  max-width: 600px;
  color: #3d281b;
  font-size: 1.05rem;
}

.eyebrow {
  margin: 0;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 0.75rem;
  opacity: 0.7;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--pad);
  box-shadow: var(--shadow);
}

.card h2 {
  margin-top: 0;
  font-size: 1.2rem;
}

ol {
  margin: 12px 0 16px 20px;
  padding: 0;
  color: var(--muted);
}

.hint {
  margin: 0;
  font-size: 0.95rem;
  color: var(--muted);
}

.controls {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.setting-item {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 6px 12px;
  margin-bottom: 12px;
}

.setting-item:last-child {
  margin-bottom: 0;
}

.settings .toggle {
  display: contents;
}

.settings .toggle input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--accent);
}

.settings .toggle span {
  font-weight: 600;
}

.settings .hint {
  grid-column: 2;
  margin: 0;
}

.api-key-input {
  grid-column: 2;
  margin: 4px 0;
}

.api-key-input input {
  width: 100%;
  max-width: 400px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.95rem;
  background: #fff;
}

.api-key-input input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(212, 85, 31, 0.1);
}

.transcription {
  background: #f0fdf4;
  border-color: #bbf7d0;
}

.transcription h2 {
  color: #166534;
}

.transcription-text {
  min-height: 120px;
  max-height: 300px;
  overflow-y: auto;
  padding: 16px;
  background: #fff;
  border: 1px solid #bbf7d0;
  border-radius: 12px;
  font-size: 1.05rem;
  line-height: 1.8;
  color: var(--ink);
  white-space: pre-wrap;
}

button,
.download {
  border: none;
  cursor: pointer;
  font-size: 1rem;
  padding: 12px 20px;
  border-radius: 999px;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
  transform: none;
  box-shadow: none;
}

.primary {
  background: #8b5cf6;
  color: #fff;
  box-shadow: 0 14px 30px rgba(139, 92, 246, 0.35);
}

.primary:hover:not(:disabled) {
  background: #7c3aed;
  transform: translateY(-2px);
}

.primary.requesting {
  background: #06b6d4;
  box-shadow: 0 14px 30px rgba(6, 182, 212, 0.35);
}

.primary.requesting:hover:not(:disabled) {
  background: #0891b2;
}

.primary.recording {
  background: #ef4444;
  box-shadow: 0 14px 30px rgba(239, 68, 68, 0.35);
}

.primary.recording:hover:not(:disabled) {
  background: #dc2626;
}

.ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--ink);
}

.ghost:hover:not(:disabled) {
  box-shadow: 0 10px 20px rgba(31, 26, 23, 0.12);
  transform: translateY(-1px);
}

.status {
  display: grid;
  gap: 6px;
  padding: 12px 4px 0;
  color: var(--muted);
}

.status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-weight: 600;
  color: var(--ink);
}

.timer {
  font-variant-numeric: tabular-nums;
  background: #1f1a17;
  color: #fff;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.95rem;
}

.details {
  font-size: 0.95rem;
}

.waveform {
  width: 100%;
  height: 160px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: #fff3e6;
}

.output {
  display: grid;
  gap: 12px;
}

.output-controls {
  display: flex;
  gap: 12px;
  align-items: center;
}

.output audio {
  flex: 1;
  min-width: 0;
}

.output .download {
  flex: 0 0 20%;
  padding: 12px 20px;
  justify-content: center;
}

.download {
  display: inline-flex;
  background: #1f1a17;
  color: #fff;
  text-decoration: none;
  padding: 6px 10px;
  font-size: 0.9rem;
}

.download.small {
  padding: 6px 10px;
  font-size: 0.9rem;
}

.download:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(31, 26, 23, 0.2);
}

.download.disabled {
  pointer-events: none;
  opacity: 0.5;
}

.takes-list {
  display: grid;
  gap: 16px;
}

.takes-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 8px;
}

.takes-header h2 {
  margin: 0;
  flex: 1;
}

.download-all {
  background: #1f1a17;
  color: #fff;
  padding: 10px 16px;
  font-size: 0.95rem;
  flex-shrink: 0;
}

.download-all:hover:not(:disabled) {
  background: #2c2622;
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(31, 26, 23, 0.2);
}

.download-all.disabled {
  pointer-events: none;
  opacity: 0.5;
}

.takes-empty {
  color: var(--muted);
  font-size: 0.95rem;
}

.take {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  background: #fff7ed;
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr auto;
  align-items: center;
}

.take-meta {
  font-weight: 600;
  color: var(--ink);
  grid-column: 1 / -1;
}

.take audio {
  grid-column: 1;
  width: 100%;
}

.take .download {
  grid-column: 2;
  white-space: nowrap;
}

.material-symbols-rounded {
  font-size: 1.2em;
  font-weight: 400;
}

.primary .material-symbols-rounded {
  color: #fff;
}

.button-status {
  display: inline-block;
  font-size: 0.85rem;
  opacity: 0.9;
  font-weight: 500;
}

@media (max-width: 600px) {
  .hero {
    padding: 28px 18px;
  }

  .controls {
    flex-direction: column;
  }

  button,
  .download {
    width: 100%;
  }

  .output-controls {
    flex-direction: column;
  }

  .output audio {
    flex: none;
  }

  .output .download {
    flex: none;
    width: 100%;
    padding: 12px 20px;
  }

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

  .download-all {
    width: 100%;
  }

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

  .take .download {
    grid-column: 1;
    width: 100%;
    padding: 12px 20px;
  }
}

