:root {
  --ink: #1c2430;
  --muted: #5c6776;
  --line: #e4e7eb;
  --field: #f6f7f9;
  --save: #0f6b63;
  --save-hover: #0c564f;
  --rec: #c0262d;
  --focus: #1f5fd1;
  --radius: 10px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: #fff;
  color: var(--ink);
  font: 17px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
[hidden] { display: none !important; }

.wrap { max-width: 680px; margin: 0 auto; padding: 40px 20px 96px; }
h1 { font-size: 1.75rem; line-height: 1.2; font-weight: 650; letter-spacing: -0.01em; margin: 0 0 32px; }
h2 { font-size: 1.15rem; font-weight: 650; margin: 0 0 16px; }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 0 0 32px; }
.topbar h1 { margin: 0; }

#auth-form input { margin-bottom: 20px; }
.link-btn { background: none; border: 0; padding: 14px 0; margin-top: 8px; font: inherit; color: var(--focus); text-decoration: underline; cursor: pointer; }

label { display: block; font-weight: 600; margin: 0 0 8px; }

textarea, input {
  width: 100%;
  font: inherit;
  color: inherit;
  background: var(--field);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
}
textarea { min-height: 168px; resize: vertical; line-height: 1.5; }
textarea:focus, input:focus {
  outline: none;
  border-color: var(--focus);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(31, 95, 209, 0.15);
}
textarea.is-listening { border-color: var(--rec); background: #fff; box-shadow: 0 0 0 3px rgba(192, 38, 45, 0.15); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 56px;
  padding: 0 26px;
  border: 0;
  border-radius: var(--radius);
  font: inherit;
  font-weight: 600;
  font-size: 1.05rem;
  color: #fff;
  cursor: pointer;
}
.btn:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-mic { background: var(--ink); }
.btn-mic:hover:not(:disabled) { background: #0f151d; }
.btn-stop { background: var(--rec); }
.btn-stop:hover { background: #a11f25; }
.dot { width: 12px; height: 12px; border-radius: 50%; background: #fff; animation: pulse 1.1s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.25; } }
@media (prefers-reduced-motion: reduce) { .dot { animation: none; } }

.mic-row { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; margin: 14px 0 28px; }
.mic-status { color: var(--muted); font-size: 0.95rem; flex: 1 1 200px; }
.mic-status.is-live { color: var(--rec); font-weight: 600; }
.mic-status.is-error { color: var(--rec); }

#note-url { margin-bottom: 20px; }
#note-text { margin-bottom: 20px; }
.btn-save { width: 100%; min-height: 60px; background: var(--save); font-size: 1.15rem; }
.btn-save:hover { background: var(--save-hover); }
.save-status { min-height: 1.6em; margin: 10px 0 0; color: var(--muted); font-size: 0.95rem; }
.save-status.is-error { color: var(--rec); }

.saved { margin-top: 40px; padding-top: 32px; border-top: 1px solid var(--line); }
.notes { list-style: none; margin: 8px 0 0; padding: 0; }
.notes li { padding: 22px 0; border-top: 1px solid var(--line); }
.notes li:first-child { border-top: 0; }
.note-text { white-space: pre-wrap; overflow-wrap: anywhere; cursor: pointer; margin: 0; }
.note-url { margin: 8px 0 0; font-size: 0.95rem; overflow-wrap: anywhere; }
.note-url a { color: var(--focus); }
.note-meta { margin: 10px 0 0; color: var(--muted); font-size: 0.875rem; }
.note-actions { display: flex; gap: 10px; margin-top: 14px; }

.btn-small {
  min-height: 44px;
  padding: 0 18px;
  font-size: 0.95rem;
  background: #fff;
  color: var(--ink);
  border: 1.5px solid var(--line);
}
.btn-small:hover { background: var(--field); }
.btn-small.danger { color: var(--rec); }
.btn-small.primary { background: var(--save); border-color: var(--save); color: #fff; }
.btn-small.primary:hover { background: var(--save-hover); }

.edit-form label { margin-top: 14px; }
.edit-form label:first-child { margin-top: 0; }
.edit-form textarea { min-height: 120px; }
.edit-error { color: var(--rec); font-size: 0.95rem; margin: 10px 0 0; }

.empty { color: var(--muted); margin: 8px 0 0; }

@media (max-width: 480px) {
  .wrap { padding-top: 24px; }
  .btn-mic, .btn-stop { flex: 1 1 auto; }
}
