:root {
  --ink: #1a1c1f;
  --ink-2: #3a3e44;
  --muted: #6b7078;
  --line: #e6e7e9;
  --soft: #f3f4f5;
  --rec: #d0261b;
  --err: #b42318;
  --bg: #ffffff;
  --col: 640px;
  --bar-h: 88px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body {
  font-family: "Heebo", system-ui, sans-serif;
  font-size: 17px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible, input:focus-visible {
  outline: 2px solid var(--ink); outline-offset: 2px;
}
svg { display: block; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.num { direction: ltr; unicode-bidi: isolate; font-variant-numeric: tabular-nums; }

.brand { font-weight: 600; font-size: 16px; letter-spacing: 0; }
.quiet {
  background: none; border: 0; padding: 10px 4px; color: var(--muted); font-size: 15px;
}
.quiet:hover { color: var(--ink); }

/* The product's own voice: written on the page, no bubble. */
.voice p {
  margin: 0 0 14px;
  font-size: 22px;
  line-height: 1.55;
  font-weight: 400;
  color: var(--ink);
  max-width: 34ch;
}
.voice p:first-child { font-weight: 500; }

/* ---------- top ---------- */
/* Opaque on every phone: its own layer (iOS/Android repaint sticky headers
   late without it), above everything in the stream, and a white sheet above
   it so text never shows in the status-bar strip or during the overscroll bounce. */
.top {
  position: sticky; top: 0; z-index: 20;
  background: var(--bg); border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top);
  isolation: isolate; transform: translateZ(0); -webkit-backface-visibility: hidden;
}
.top::before {
  content: ""; position: absolute; inset-inline: 0; bottom: 100%; height: 100vh;
  background: var(--bg);
}
.top-in {
  max-width: var(--col); margin: 0 auto; height: 52px;
  padding: 0 20px; display: flex; align-items: center; justify-content: space-between;
}

/* ---------- stream ---------- */
.stream {
  max-width: var(--col); margin: 0 auto;
  padding: 28px 20px calc(var(--bar-h) + 40px + env(safe-area-inset-bottom));
}
.note { margin: 4px 0 0; font-size: 14px; color: var(--muted); }
.items { margin-top: 36px; }

.day {
  text-align: center; font-size: 13px; color: var(--muted);
  margin: 28px 0 14px;
}
.item { padding: 14px 0 16px; border-top: 1px solid var(--line); }
.day + .item { border-top: 0; }
.item-head {
  display: flex; align-items: center; justify-content: space-between;
  min-height: 28px; font-size: 14px; color: var(--muted);
}
.item-head .what { color: var(--ink-2); }
.del {
  background: none; border: 0; padding: 6px; margin-inline-end: -6px; color: var(--muted);
  border-radius: 8px;
}
.del:hover { color: var(--ink); background: var(--soft); }
.del svg { width: 18px; height: 18px; }

/* player */
.player { display: flex; align-items: center; gap: 14px; margin-top: 6px; }
.play {
  flex: none; width: 44px; height: 44px; border-radius: 50%;
  border: 0; background: var(--soft); color: var(--ink);
  display: grid; place-items: center;
}
.play:hover { background: #e9eaec; }
.play svg { width: 18px; height: 18px; fill: currentColor; stroke: none; }
.play .i-pause { display: none; }
.item.playing .play { background: var(--ink); color: #fff; }
.item.playing .play .i-play { display: none; }
.item.playing .play .i-pause { display: block; }

.track { position: relative; flex: 1; height: 28px; display: flex; align-items: center; }
.rail { position: absolute; inset-inline: 0; height: 4px; border-radius: 2px; background: var(--line); }
.fill { position: absolute; inset-inline-start: 0; height: 4px; border-radius: 2px; background: var(--ink); width: 0; }
.seek {
  position: absolute; inset: 0; width: 100%; margin: 0; opacity: 0; cursor: pointer;
}
.time { flex: none; font-size: 14px; color: var(--muted); min-width: 76px; text-align: end; }

/* text that came out of the recording */
.said { margin-top: 14px; }
.summary { margin: 0 0 12px; font-size: 19px; line-height: 1.6; color: var(--ink); max-width: 40ch; }
.group { margin: 0 0 12px; }
.group-name { font-size: 14px; font-weight: 600; color: var(--ink-2); margin-bottom: 2px; }
.group ul { margin: 0; padding-inline-start: 20px; }
.group li { margin: 2px 0; line-height: 1.55; }
.working { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 15px; }
.working .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); animation: pulse 1.2s ease-in-out infinite; }
.said-err { color: var(--err); font-size: 15px; }
.said-fail .actions { margin-top: 8px; }
.said-by .speaker { font-size: 14px; font-weight: 600; color: var(--ink-2); margin-top: 12px; }
.said-by .speaker:first-child { margin-top: 0; }
.fold { border-top: 1px solid var(--line); }
.fold summary {
  list-style: none; cursor: pointer; padding: 10px 0; font-size: 15px; font-weight: 500; color: var(--ink-2);
  display: flex; align-items: center; gap: 8px;
}
.fold summary::-webkit-details-marker { display: none; }
.fold summary::before {
  content: ""; width: 7px; height: 7px; border: solid currentColor; border-width: 0 0 1.8px 1.8px;
  transform: rotate(45deg); transition: transform 150ms ease; margin-top: -3px;
}
.fold[open] summary::before { transform: rotate(-45deg); margin-top: 3px; }
.fold-body { padding: 0 0 14px; }
.fold-text { white-space: pre-wrap; line-height: 1.65; color: var(--ink); }
.copy { margin-top: 10px; }

/* pending upload / errors inside the stream */
.sending { margin-top: 8px; font-size: 14px; color: var(--muted); }
.progress { height: 3px; background: var(--line); border-radius: 2px; margin-top: 8px; overflow: hidden; }
.progress > div { height: 100%; width: 0; background: var(--ink); transition: width 150ms ease; }
.item.failed .sending { color: var(--err); }
.item.failed .progress { display: none; }
.actions { display: flex; gap: 8px; margin-top: 10px; align-items: center; }
.btn {
  border: 1px solid var(--line); background: #fff; border-radius: 8px;
  padding: 8px 14px; font-size: 15px; font-weight: 500;
}
.btn:hover { border-color: #cfd1d4; }
.btn.danger { background: var(--err); border-color: var(--err); color: #fff; }
.btn.dark { background: var(--ink); border-color: var(--ink); color: #fff; }
.confirm { margin-top: 10px; font-size: 15px; color: var(--ink); }
.confirm .actions { margin-top: 8px; }

/* ---------- bottom bar ---------- */
.bar {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 10;
  background: #fff; border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.bar-in {
  max-width: var(--col); margin: 0 auto; min-height: var(--bar-h);
  padding: 12px 20px; display: flex; align-items: center; gap: 12px;
}
.status { flex: 1; min-width: 0; }
.hint { font-size: 16px; color: var(--muted); }
.hint.warn { color: var(--err); }
.mic {
  flex: none; width: 60px; height: 60px; border-radius: 50%;
  border: 0; background: var(--ink); color: #fff;
  display: grid; place-items: center;
  transition: background-color 150ms ease;
}
.mic svg { width: 26px; height: 26px; }
.mic .i-stop { display: none; fill: currentColor; stroke: none; }
.mic:disabled { background: #b9bcc1; cursor: default; }

.live { display: flex; align-items: center; gap: 12px; }
.live[hidden] { display: none; }
.pulse {
  width: 12px; height: 12px; border-radius: 50%; background: var(--rec); flex: none;
  animation: pulse 1.2s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }
.timer { font-size: 26px; font-weight: 500; font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; color: var(--ink); }
.rec-word { color: var(--rec); font-weight: 500; font-size: 16px; }
.level { display: flex; align-items: center; gap: 3px; height: 26px; }
.level i { display: block; width: 4px; height: 4px; border-radius: 2px; background: var(--rec); opacity: 0.8; transition: height 80ms linear; }

body.recording .mic { background: var(--rec); }
body.recording .mic .i-mic { display: none; }
body.recording .mic .i-stop { display: block; }
body.recording .hint { display: none; }
body.recording .bar { border-top-color: var(--rec); }

/* ---------- login ---------- */
.login {
  max-width: 440px; margin: 0 auto;
  padding: calc(40px + env(safe-area-inset-top)) 24px 40px;
}
.login .brand { display: block; margin-bottom: 40px; }
.login .voice { margin-bottom: 28px; }
.login form { display: flex; flex-direction: column; gap: 8px; }
.login label { font-size: 15px; color: var(--ink-2); }
.login input {
  font: inherit; font-size: 18px; padding: 12px 14px; height: 52px;
  border: 1px solid #cfd1d4; border-radius: 8px; background: #fff; color: var(--ink);
}
.login input:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.primary {
  margin-top: 12px; height: 52px; border: 0; border-radius: 8px;
  background: var(--ink); color: #fff; font-size: 17px; font-weight: 500;
}
.primary:disabled { background: #b9bcc1; }
.error { color: var(--err); margin: 8px 0 0; font-size: 15px; }

@media (min-width: 900px) {
  .voice p { font-size: 26px; }
  .stream { padding-top: 56px; }
}
@media (prefers-reduced-motion: reduce) {
  .pulse { animation: none; }
  * { transition: none !important; }
}
