:root {
  --bg: #0f172a;
  --card: #1e293b;
  --text: #f1f5f9;
  --muted: #94a3b8;
  --accent: #ef4444;
  --accent-dark: #b91c1c;
  --blue: #2563eb;
  --blue-dark: #1d4ed8;
  --danger: #dc2626;
  --border: #334155;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

header {
  padding: 20px 16px 8px;
  text-align: center;
}

header h1 {
  margin: 0;
  font-size: 1.4rem;
}

main {
  max-width: 640px;
  margin: 0 auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.recording-warning {
  margin: 16px 0 0;
  color: #fbbf24;
  font-size: 0.9rem;
}

.recovery {
  background: #422006;
  border: 1px solid #92400e;
  border-radius: 16px;
  padding: 16px 20px;
  text-align: center;
}

.recovery p {
  margin: 0 0 12px;
}

.recorder, .result {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  text-align: center;
}

.status {
  font-size: 1rem;
  color: var(--muted);
  min-height: 1.4em;
  margin-bottom: 8px;
}

.timer {
  font-size: 2.5rem;
  font-variant-numeric: tabular-nums;
  margin-bottom: 16px;
}

.controls {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.btn {
  min-height: 52px;
  min-width: 120px;
  padding: 12px 20px;
  border-radius: 12px;
  border: none;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  background: var(--blue);
  color: white;
  touch-action: manipulation;
}

.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-record { background: var(--accent); }
.btn-record:hover:not(:disabled) { background: var(--accent-dark); }

.btn-stop { background: #475569; }

.btn-danger { background: var(--danger); }

.result h2 {
  margin-top: 0;
  font-size: 1.1rem;
  text-align: left;
}

audio {
  width: 100%;
  margin-bottom: 12px;
}

.transcribe-status {
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: 10px;
  min-height: 1.2em;
  text-align: left;
}

.transcript {
  width: 100%;
  min-height: 160px;
  resize: vertical;
  background: #0f172a;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  font-size: 1rem;
  line-height: 1.4;
  margin-bottom: 16px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

.actions .btn {
  flex: 1 1 45%;
}

.hidden { display: none; }

@media (max-width: 420px) {
  .actions .btn { flex: 1 1 100%; }
}
