:root {
  --bg: #f3efe6;
  --surface: #fbf9f4;
  --ink: #1d1b16;
  --muted: #6f685b;
  --line: #e2dccf;
  --accent: #c2410c;
  --accent-ink: #fff;
  --ok: #3f6b3a;
  --warn: #a23a1d;
  --serif: ui-serif, "New York", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16140f;
    --surface: #211e18;
    --ink: #eee8dc;
    --muted: #a39b8b;
    --line: #34302a;
    --accent: #ea6a2f;
    --ok: #8fbf86;
    --warn: #f08a6a;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.45 var(--sans);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
main {
  max-width: 560px;
  margin: 0 auto;
  padding: max(16px, env(safe-area-inset-top)) 16px max(32px, env(safe-area-inset-bottom));
}
button { font: inherit; color: inherit; }

/* Capture */
.capture {
  min-height: 52vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  text-align: center;
}
.hint { margin: 0; color: var(--muted); font-family: var(--serif); font-size: 1.15rem; }
.record {
  width: 168px;
  height: 168px;
  border-radius: 50%;
  border: 0;
  background: var(--accent);
  box-shadow: 0 10px 30px -10px color-mix(in srgb, var(--accent) 70%, transparent);
  display: grid;
  place-items: center;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform .15s ease;
}
.record:active { transform: scale(.96); }
.record .dot {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--accent-ink);
  transition: border-radius .2s ease, width .2s ease, height .2s ease;
}
.recording .record { animation: pulse 1.6s ease-in-out infinite; }
.recording .record .dot { width: 48px; height: 48px; border-radius: 10px; }
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 45%, transparent); }
  50% { box-shadow: 0 0 0 22px color-mix(in srgb, var(--accent) 0%, transparent); }
}
.timer {
  margin: 0;
  font-variant-numeric: tabular-nums;
  font-size: 1.5rem;
  letter-spacing: .02em;
  visibility: hidden;
}
.recording .timer { visibility: visible; }
.link { background: none; border: 0; color: var(--muted); text-decoration: underline; padding: 6px; }
.outbox { margin: 0; color: var(--muted); font-size: .9rem; }

/* Inbox */
.inbox header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  padding-bottom: 8px;
}
h1 { font-family: var(--serif); font-weight: 600; font-size: 1.6rem; margin: 0; }
.count { color: var(--muted); font-variant-numeric: tabular-nums; }
ol { list-style: none; margin: 0; padding: 0; }
.card {
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}
.meta { display: flex; gap: 10px; flex-wrap: wrap; color: var(--muted); font-size: .85rem; }
.status:empty { display: none; }
.status[data-s="pending"], .status[data-s="transcribing"] { color: var(--muted); font-style: italic; }
.status[data-s="failed"] { color: var(--warn); }
.transcript {
  margin: 6px 0 10px;
  font-family: var(--serif);
  font-size: 1.08rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.transcript:empty { display: none; }
.editor {
  width: 100%;
  margin: 6px 0 10px;
  padding: 10px;
  font: 1.05rem/1.4 var(--serif);
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.actions button {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: .9rem;
  cursor: pointer;
}
.actions .done { margin-left: auto; border-color: color-mix(in srgb, var(--ok) 45%, var(--line)); color: var(--ok); }
.empty { color: var(--muted); font-family: var(--serif); text-align: center; padding: 24px 0; }

.toast {
  position: fixed;
  left: 50%;
  bottom: max(20px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  max-width: calc(100% - 32px);
  background: var(--ink);
  color: var(--bg);
  padding: 10px 16px;
  border-radius: 10px;
  font-size: .95rem;
}

/* Login */
.login { min-height: 80vh; display: grid; place-content: center; gap: 24px; text-align: center; }
.login h1 { font-size: 2.4rem; }
.login form { display: grid; gap: 10px; width: min(320px, 100%); text-align: left; }
.login label { color: var(--muted); font-size: .9rem; }
.login input {
  font: inherit;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
}
.login button[type="submit"] {
  padding: 12px;
  border: 0;
  border-radius: 10px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
}
.error { color: var(--warn); margin: 0; }
