/* ============================================================================
   Journal — wearing Daily's skin.
   Modern monochrome minimalism. Fredoka, Apple-radius cards, soft springs.
   One set of tokens drives light and dark; every surface follows the switch.
   ========================================================================== */

:root {
  --paper: #f5f5f5;
  --card: #ffffff;
  --ink: #121212;
  --ink-soft: #7d7d7d;
  --ink-faint: #c9c9c9;
  --line: #ececec;
  --shadow: 0 1px 2px rgb(0 0 0 / .03), 0 12px 32px -12px rgb(0 0 0 / .10);
  --shadow-lift: 0 6px 18px -8px rgb(0 0 0 / .16);
  --red: #9c4a3c;
  --amber: #94742f;
  --sunken: #ececec;
  --r: 28px;
  --r-md: 18px;
  --r-sm: 12px;
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --ease-spring: cubic-bezier(.34, 1.56, .64, 1);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: light;
}

html[data-theme="dark"] {
  --paper: #0e0e0e;
  --card: #1a1a1a;
  --ink: #f2f2f2;
  --ink-soft: #8e8e8e;
  --ink-faint: #4a4a4a;
  --line: #272727;
  --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 12px 32px -12px rgb(0 0 0 / .5);
  --shadow-lift: 0 6px 20px -8px rgb(0 0 0 / .55);
  --red: #d98874;
  --amber: #d4ab63;
  --sunken: #232323;
  color-scheme: dark;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
[hidden] { display: none !important; }

html {
  -webkit-text-size-adjust: 100%;
  background: var(--paper);
  transition: background .5s var(--ease-out);
}

body {
  font-family: "Fredoka", ui-sans-serif, -apple-system, system-ui, sans-serif;
  font-weight: 400;
  background: var(--paper);
  color: var(--ink);
  min-height: 100dvh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  transition: background .5s var(--ease-out), color .5s var(--ease-out);
}

::selection { background: var(--ink); color: var(--paper); }
button, input, textarea, select { font-family: inherit; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: 6px; }

.route { display: none; }
.route.active { display: block; }

/* shared type ------------------------------------------------------------- */

.label, .eyebrow {
  font-size: .78rem;
  font-weight: 500;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.mono {
  font-size: .72rem;
  font-weight: 400;
  letter-spacing: .08em;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}
.tnum { font-variant-numeric: tabular-nums; }
.count {
  font-size: .78rem;
  font-weight: 400;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}
.section-h {
  font-size: 1.15rem;
  font-weight: 500;
  letter-spacing: -.01em;
  margin: 2rem .4rem .15rem;
}
.section-sub {
  font-size: .88rem;
  font-weight: 300;
  color: var(--ink-soft);
  margin: 0 .4rem .8rem;
}

/* ---------- gate (login) ---------- */

.gate {
  min-height: 100dvh;
  display: grid; place-items: center;
  background: var(--paper);
  padding: 2rem 1.4rem calc(2rem + var(--safe-b));
}
.gate-inner { text-align: center; width: min(340px, 100%); animation: rise .8s var(--ease-out) both; }
.gate-mark {
  width: 14px; height: 14px; border: 2.5px solid var(--ink);
  border-radius: 50%; margin: 0 auto 1.3rem;
  animation: pulse 3s ease-in-out infinite;
}
.gate-word { font-size: 1.9rem; font-weight: 500; letter-spacing: -.01em; }
.gate-sub {
  font-size: .9rem; font-weight: 300; color: var(--ink-soft);
  margin: .2rem 0 2.2rem;
}
.gate-form {
  display: flex; align-items: center; gap: .4rem;
  width: 100%;
  margin: 0 auto;
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: 999px;
  padding: .35rem .35rem .35rem 1.5rem;
  box-shadow: var(--shadow);
  transition: border-color .3s, transform .3s var(--ease-spring);
}
.gate-form:focus-within { border-color: var(--ink); transform: scale(1.02); }
.gate-form.shake { animation: shake .4s; }
.gate-go {
  flex: 0 0 auto;
  width: 42px; height: 42px;
  border: none; border-radius: 50%;
  background: var(--ink); color: var(--paper);
  font-size: 1.05rem; font-weight: 500;
  cursor: pointer;
  display: grid; place-items: center;
  opacity: .3;
  transition: transform .35s var(--ease-spring), opacity .3s;
}
.gate-form:focus-within .gate-go { opacity: 1; }
.gate-go:hover { transform: scale(1.06); }
.gate-go:active { transform: scale(.92); }
.gate-go:disabled { opacity: .35; cursor: default; }
#pw {
  flex: 1; min-width: 0;
  font-size: 1rem;
  background: none; border: none;
  color: var(--ink);
  padding: .5rem 0;
  outline: none;
  letter-spacing: .25em;
}
#pw::placeholder { letter-spacing: .05em; color: var(--ink-faint); font-weight: 300; }
.pw-toggle {
  background: none; border: none; cursor: pointer;
  font-size: .72rem; font-weight: 400; letter-spacing: .08em;
  color: var(--ink-faint);
  padding: .3rem .2rem;
  transition: color .25s;
}
.pw-toggle:hover { color: var(--ink); }
.gate-error {
  font-size: .8rem; color: var(--red);
  margin-top: 1rem; min-height: 1.2em;
}
.gate-divider {
  font-size: .7rem; font-weight: 400; letter-spacing: .14em;
  text-transform: uppercase; color: var(--ink-faint);
  margin: 1.5rem 0 1rem;
}
.passkey-btn {
  display: inline-flex; align-items: center; gap: .5rem;
  border: 1.5px solid var(--line);
  background: var(--card);
  border-radius: 999px;
  color: var(--ink);
  font-size: .92rem; font-weight: 500;
  padding: .7rem 1.4rem;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: border-color .3s, transform .35s var(--ease-spring);
}
.passkey-btn:hover { border-color: var(--ink); transform: translateY(-2px); }
.passkey-btn:active { transform: scale(.96); }
.gate-foot {
  margin-top: 2.4rem;
  font-size: .68rem; font-weight: 300; letter-spacing: .06em;
  color: var(--ink-faint);
}

/* ---------- layout ---------- */

.app {
  max-width: 480px;
  margin: 0 auto;
  padding: max(clamp(1.4rem, 4vw, 2.6rem), var(--safe-t)) max(1.2rem, env(safe-area-inset-right, 0px))
           max(3.5rem, var(--safe-b) + 2rem) max(1.2rem, env(safe-area-inset-left, 0px));
}

/* ---------- masthead ---------- */

.masthead { animation: rise .7s var(--ease-out) both; padding: 0 .4rem; }
.masthead-top {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 1rem;
}
.greeting { font-size: .88rem; font-weight: 300; color: var(--ink-soft); }
.date-title {
  font-size: clamp(1.9rem, 6vw, 2.3rem);
  font-weight: 500;
  letter-spacing: -.02em;
  line-height: 1.15;
}
.masthead-actions { display: flex; align-items: center; gap: .7rem; padding-top: .3rem; }

.save-state {
  font-size: .7rem; font-weight: 300; letter-spacing: .06em;
  color: var(--ink-soft);
  opacity: 0;
  transition: opacity .4s;
}
.save-state[data-state="busy"] { opacity: .8; }
.save-state[data-state="done"] { opacity: .55; animation: fadeHold 1.6s forwards; }

.theme-toggle {
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: 50%;
  width: 36px; height: 36px;
  display: grid; place-items: center;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: border-color .3s, transform .5s var(--ease-spring), background .5s;
}
.theme-toggle:hover { border-color: var(--ink); transform: rotate(180deg) scale(1.05); }
.theme-dot {
  width: 11px; height: 11px; border-radius: 50%;
  background: var(--ink);
  transition: background .5s, box-shadow .5s;
}
html[data-theme="dark"] .theme-dot {
  background: transparent;
  box-shadow: inset 3px -3px 0 0 var(--ink);
}

.profile-btn {
  width: 36px; height: 36px;
  padding: 0;
  border: 1.5px solid var(--line);
  border-radius: 50%;
  background: var(--card);
  cursor: pointer;
  overflow: hidden;
  display: grid; place-items: center;
  box-shadow: var(--shadow);
  transition: border-color .3s, transform .4s var(--ease-spring);
}
.profile-btn:hover { border-color: var(--ink); transform: scale(1.08); }
/* The same face as the Daily instance — one person, one app. The initial
   underneath is what shows if the photo ever fails to load. */
.avatar {
  width: 100%; height: 100%;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: .82rem; font-weight: 500;
  color: var(--paper);
  background: var(--ink) url("/icons/avatar.jpg") center / cover no-repeat;
  text-indent: -999em; overflow: hidden;
}

/* ---------- tab pills ---------- */

.tabs {
  display: flex; gap: .45rem;
  margin-top: 1.5rem;
  overflow-x: auto;
  padding: .4rem .2rem .8rem;
  scrollbar-width: none;
}
.tabs.scrolly {
  -webkit-mask-image: linear-gradient(to right, transparent, black 4%, black 96%, transparent);
          mask-image: linear-gradient(to right, transparent, black 4%, black 96%, transparent);
}
.tabs::-webkit-scrollbar { display: none; }

.tab-pill {
  flex: 0 0 auto;
  padding: .5rem 1rem .55rem;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
  display: flex; align-items: center; gap: .45rem;
  font-size: .88rem; font-weight: 400;
  white-space: nowrap;
  transition: background .35s var(--ease-out), color .35s,
              transform .35s var(--ease-spring), box-shadow .35s;
}
.tab-pill svg { display: block; }
.tab-pill:hover { transform: translateY(-3px); color: var(--ink); }
.tab-pill .kbd {
  font-size: .6rem; font-weight: 400; letter-spacing: .06em;
  opacity: .5;
}
.tab-pill.on {
  background: var(--ink);
  color: var(--paper);
  box-shadow: var(--shadow);
  font-weight: 500;
}
.tab-pill.on:hover { transform: none; }
.tab-pill.live::after {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #ff5a4d;
  animation: pulse 1.6s ease-in-out infinite;
}
.tab-pill:active { transform: scale(.92); }

/* ---------- cards ---------- */

.panel { margin-top: .6rem; }

.card {
  background: var(--card);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  padding: 1.5rem 1.5rem 1.4rem;
  margin-bottom: 1rem;
  animation: cardIn .9s cubic-bezier(.22, 1.2, .36, 1) both;
  animation-delay: calc(.08s + var(--i, 0) * .11s);
  transition: background .5s var(--ease-out);
}
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: .8rem;
  margin-bottom: .9rem;
}
.head-actions { display: flex; align-items: center; gap: .45rem; }

.card-ink {
  background: var(--ink);
  color: var(--paper);
}
.card-ink .label, .card-ink .count, .card-ink .mono { color: color-mix(in srgb, var(--paper) 62%, transparent); }
.card-ink .round-btn { background: color-mix(in srgb, var(--paper) 12%, transparent); color: color-mix(in srgb, var(--paper) 70%, transparent); }
.card-ink .round-btn:hover { background: var(--paper); color: var(--ink); }

.round-btn {
  background: var(--paper);
  border: none;
  border-radius: 50%;
  width: 30px; height: 30px;
  flex: 0 0 auto;
  color: var(--ink-soft);
  font-size: 1.05rem; font-weight: 400; line-height: 1;
  cursor: pointer;
  display: grid; place-items: center;
  transition: color .25s, background .3s, transform .35s var(--ease-spring);
}
.round-btn svg { display: block; }
.round-btn:hover { color: var(--paper); background: var(--ink); transform: scale(1.08); }
.round-btn:active { transform: scale(.9); }
.round-btn.spin-hover:hover { transform: rotate(90deg) scale(1.08); }
.round-btn.on { background: var(--ink); color: var(--paper); }
.card-ink .round-btn.on { background: var(--paper); color: var(--ink); }

/* buttons ----------------------------------------------------------------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  color: var(--ink);
  font-size: .95rem; font-weight: 500;
  padding: .8rem 1.5rem;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform .35s var(--ease-spring), background .3s, color .3s, border-color .3s, opacity .3s;
}
.btn svg { display: block; }
.btn:hover { transform: translateY(-2px); border-color: var(--ink); }
.btn:active { transform: scale(.96); }
.btn:disabled { opacity: .45; cursor: default; transform: none; }
.btn.primary { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.btn.ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--ink-soft); }
.btn.ghost:hover { color: var(--ink); background: var(--paper); border-color: transparent; }
.card-ink .btn.ghost { color: color-mix(in srgb, var(--paper) 70%, transparent); }
.card-ink .btn.ghost:hover { color: var(--ink); background: var(--paper); }
.btn.sm { font-size: .82rem; padding: .5rem 1rem; }
.btn.danger { color: var(--red); }
.btn.danger:hover { background: var(--red); color: var(--card); border-color: var(--red); }

.icon-btn {
  background: var(--paper);
  border: none; border-radius: 50%;
  width: 34px; height: 34px;
  color: var(--ink-soft);
  cursor: pointer;
  display: grid; place-items: center;
  transition: color .25s, background .3s, transform .35s var(--ease-spring);
}
.icon-btn svg { display: block; }
.icon-btn:hover { color: var(--paper); background: var(--ink); transform: scale(1.08); }
.icon-btn:active { transform: scale(.9); }
.icon-btn.on { background: var(--ink); color: var(--paper); }

/* segmented control ------------------------------------------------------- */

.seg {
  display: inline-flex; gap: .25rem;
  background: var(--paper);
  border-radius: 999px;
  padding: .25rem;
  flex: 0 0 auto;
}
.seg button {
  border: none; background: transparent;
  color: var(--ink-soft);
  font-size: .8rem; font-weight: 500;
  padding: .4rem .9rem;
  border-radius: 999px;
  cursor: pointer;
  text-transform: capitalize;
  transition: background .3s, color .3s, transform .35s var(--ease-spring);
}
.seg button:active { transform: scale(.92); }
.seg button.on { background: var(--ink); color: var(--paper); }

/* ---------- hero: the record ring ---------- */

.card-hero { padding: 1.6rem 1.7rem 1.5rem; }
.hero-top { display: flex; align-items: center; gap: 1.4rem; }

.ring {
  flex: 0 0 auto;
  width: 132px; height: 132px;
  position: relative;
  display: grid; place-items: center;
}
.ring svg.ring-svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.ring .halo-dot { fill: var(--ink); transition: opacity .6s; }
.ring .p-dot {
  fill: var(--ink-faint);
  transform-box: fill-box; transform-origin: center;
  transition: fill .45s, transform .45s var(--ease-spring);
}
.ring .p-dot.on { fill: var(--ink); transform: scale(1.65); }

.record-btn {
  position: relative;
  width: 62px; height: 62px;
  border: none; border-radius: 50%;
  background: var(--ink);
  cursor: pointer;
  display: grid; place-items: center;
  box-shadow: 0 8px 24px -10px rgb(0 0 0 / .45);
  transition: transform .4s var(--ease-spring), background .4s, border-radius .45s var(--ease-spring);
}
.record-btn:hover { transform: scale(1.06); }
.record-btn:active { transform: scale(.92); }
.record-btn:disabled { opacity: .5; cursor: default; }
.rec-dot {
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--paper);
  transition: width .45s var(--ease-spring), height .45s var(--ease-spring),
              border-radius .45s var(--ease-spring), background .3s;
}
.record-btn.recording { animation: recPulse 2.4s ease-in-out infinite; }
.record-btn.recording .rec-dot { width: 20px; height: 20px; border-radius: 5px; }
.record-btn.paused { animation: none; }
.record-btn.paused .rec-dot { width: 20px; height: 20px; border-radius: 5px; opacity: .55; }
.record-btn.processing .rec-dot {
  width: 18px; height: 18px; border-radius: 50%;
  animation: pulse 1s ease-in-out infinite;
}

.hero-figures { flex: 1; min-width: 0; }
.timer {
  font-size: clamp(2.4rem, 9vw, 3rem);
  font-weight: 500;
  letter-spacing: -.03em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.record-label {
  font-size: .82rem; font-weight: 300;
  color: var(--ink-soft);
  margin-top: .45rem;
  min-height: 1.2em;
}

.pause-btn {
  width: 38px; height: 38px;
  border: 1.5px solid var(--line);
  border-radius: 50%;
  background: var(--card);
  color: var(--ink);
  cursor: pointer;
  display: none; place-items: center;
  margin-top: .8rem;
  transition: transform .35s var(--ease-spring), border-color .3s;
}
.pause-btn.show { display: grid; animation: popIn .4s var(--ease-spring) both; }
.pause-btn:hover { border-color: var(--ink); transform: scale(1.06); }
.pause-btn:active { transform: scale(.9); }
.pause-btn .ic-resume { display: none; }
.pause-btn[data-state="paused"] .ic-pause { display: none; }
.pause-btn[data-state="paused"] .ic-resume { display: block; }

/* waveform */
.waveform {
  display: flex; align-items: center; justify-content: center; gap: 3px;
  height: 34px;
  margin-top: 1rem;
}
.waveform-bar {
  width: 3px; height: 4px;
  border-radius: 999px;
  background: var(--ink-faint);
  transition: height .09s linear, background .3s;
}
.waveform.live .waveform-bar { background: var(--ink); }

/* mode toggle */
.rec-mode-toggle {
  position: relative;
  display: flex;
  background: var(--paper);
  border-radius: 999px;
  padding: .25rem;
  margin-top: 1.1rem;
  width: max-content;
}
.rec-mode-pill {
  position: absolute; top: .25rem; bottom: .25rem;
  width: calc(50% - .25rem);
  border-radius: 999px;
  background: var(--ink);
  transition: left .45s var(--ease-spring);
}
.rec-mode-btn {
  position: relative; z-index: 1;
  border: none; background: none;
  color: var(--ink-soft);
  font-size: .82rem; font-weight: 500;
  padding: .42rem 1.1rem;
  border-radius: 999px;
  cursor: pointer;
  flex: 1;
  transition: color .35s;
}
.rec-mode-btn.on { color: var(--paper); }

/* upload meter */
.upload-meter { margin-top: 1rem; }
.upload-bar {
  height: 3px; border-radius: 999px;
  background: var(--sunken);
  overflow: hidden;
}
.upload-fill {
  height: 100%; width: 0;
  border-radius: 999px;
  background: var(--ink);
  transition: width .4s var(--ease-out);
}
.upload-note {
  font-size: .72rem; font-weight: 300;
  color: var(--ink-soft);
  margin-top: .45rem;
  font-variant-numeric: tabular-nums;
}

.deadair {
  margin-top: 1rem;
  font-size: .82rem; font-weight: 300; line-height: 1.55;
  color: var(--red);
  background: color-mix(in srgb, var(--red) 8%, transparent);
  border-radius: var(--r-md);
  padding: .7rem .95rem;
  animation: itemIn .4s var(--ease-out) both;
}

.mic-row {
  display: flex; align-items: center; gap: .55rem;
  margin-top: .9rem;
  color: var(--ink-soft);
}
.mic-row svg { flex: 0 0 auto; }

/* camera */
.cam-wrap {
  position: relative;
  margin-top: 1.1rem;
  border-radius: var(--r-md);
  overflow: hidden;
  background: #000;          /* a viewfinder is black in both themes */
  aspect-ratio: 3 / 4;
  animation: itemIn .5s var(--ease-out) both;
}
/* A viewfinder is a mirror. Show Sir the reflection he knows, the way every
   camera app does — the canvas itself is drawn un-mirrored, and captureStream
   ignores CSS, so the stored file stays in the ordinary orientation. */
.cam-preview {
  width: 100%; height: 100%; display: block; object-fit: cover;
  transform: scaleX(-1);
  cursor: grab; touch-action: none;
}
.cam-preview.dragging { cursor: grabbing; }
/* Only worth showing when there is a second camera to choose; setupCamera
   reveals it. Otherwise it renders as a chevron over nothing. */
.cam-select-wrap { position: absolute; left: .6rem; top: .6rem; z-index: 2; display: none; }
.cam-select-wrap.show { display: block; }
.cam-zoom {
  position: absolute; left: 50%; bottom: .7rem;
  transform: translateX(-50%);
  display: flex; gap: .25rem;
  background: rgb(0 0 0 / .4);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  border-radius: 999px; padding: .22rem;
  z-index: 2;
}
.cam-zoom-btn {
  border: none; background: transparent;
  color: rgb(255 255 255 / .7);
  font-size: .72rem; font-weight: 500;
  padding: .28rem .6rem; border-radius: 999px;
  cursor: pointer;
  transition: background .3s, color .3s, transform .35s var(--ease-spring);
}
.cam-zoom-btn:active { transform: scale(.9); }
.cam-zoom-btn.on { background: #fff; color: #121212; }
.cam-badge {
  position: absolute; right: .7rem; top: .7rem;
  display: flex; align-items: center; gap: .4rem;
  background: rgb(0 0 0 / .45);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  color: #fff;
  border-radius: 999px; padding: .28rem .7rem;
  font-size: .72rem; font-variant-numeric: tabular-nums;
  z-index: 2;
}
.cam-gate {
  position: absolute; inset: 0; z-index: 3;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: .9rem;
  padding: 1.6rem;
  text-align: center;
  background: #000;
  animation: itemIn .4s var(--ease-out) both;
}
.cam-gate-text {
  font-size: 1rem; font-weight: 400; line-height: 1.45;
  color: #fff;
  max-width: 28ch;
}
.cam-gate-help {
  font-size: .82rem; font-weight: 300; line-height: 1.55;
  color: rgb(255 255 255 / .6);
  max-width: 42ch;
}
.cam-gate .btn {
  background: #fff; color: #121212; border-color: #fff;
}
.cam-gate .btn:hover { background: #fff; color: #121212; }

.cam-badge .d {
  width: 6px; height: 6px; border-radius: 50%;
  background: #ff5a4d;
  animation: pulse 1.6s ease-in-out infinite;
}

/* ---------- the stage: focus + full screen ---------- */

.focus-backdrop {
  position: fixed; inset: 0;
  background: rgb(0 0 0 / .34);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  z-index: 29;
  animation: fadeIn .4s var(--ease-out) both;
}
.focus-backdrop.closing { animation: fadeOut .3s var(--ease-out) both; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeOut { from { opacity: 1; } to { opacity: 0; } }

.card.focused {
  animation: none;
  display: flex; flex-direction: column;
  overflow: hidden;
  box-shadow: 0 2px 6px rgb(0 0 0 / .1), 0 40px 90px -20px rgb(0 0 0 / .45);
}
.card.collapsing { overflow: hidden; }
.card.focused .card-head { flex: none; }

/* the camera takes whatever room is left */
.card-hero.focused .cam-wrap {
  flex: 1 1 auto;
  min-height: 0;
  aspect-ratio: auto;
  margin-top: .9rem;
}
.card-hero.focused .hero-top,
.card-hero.focused .rec-mode-toggle,
.card-hero.focused .upload-meter,
.card-hero.focused .deadair,
.card-hero.focused .mic-row { flex: none; }
.card-hero.focused .hero-top { justify-content: center; margin-top: 1.1rem; }
.card-hero.focused .rec-mode-toggle { margin-left: auto; margin-right: auto; }

/* voice on the stage has nothing to look at but the ring, so make it the room */
.card-hero.focused:not(.has-cam) .hero-top {
  flex: 1 1 auto;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.6rem;
}
.card-hero.focused:not(.has-cam) .ring { width: 210px; height: 210px; }
.card-hero.focused:not(.has-cam) .record-btn { width: 84px; height: 84px; }
.card-hero.focused:not(.has-cam) .rec-dot { width: 27px; height: 27px; }
.card-hero.focused:not(.has-cam) .record-btn.recording .rec-dot,
.card-hero.focused:not(.has-cam) .record-btn.paused .rec-dot { width: 26px; height: 26px; border-radius: 7px; }
.card-hero.focused:not(.has-cam) .hero-figures { text-align: center; }
.card-hero.focused:not(.has-cam) .timer { font-size: clamp(3rem, 11vw, 4.4rem); }
.card-hero.focused:not(.has-cam) .pause-btn { margin: .9rem auto 0; }

/* full screen: the card becomes the window */
.card-hero:fullscreen {
  width: 100vw; height: 100vh;
  max-width: none;
  border-radius: 0;
  margin: 0;
  animation: none;
  display: flex; flex-direction: column;
  background: var(--card);
  padding: max(1.4rem, env(safe-area-inset-top, 0px)) 1.6rem max(1.6rem, env(safe-area-inset-bottom, 0px));
}
.card-hero:fullscreen .cam-wrap { flex: 1 1 auto; min-height: 0; aspect-ratio: auto; margin-top: .9rem; }
.card-hero:fullscreen .hero-top { justify-content: center; margin-top: 1.1rem; flex: none; }
.card-hero:fullscreen .rec-mode-toggle { margin-left: auto; margin-right: auto; flex: none; }
.card-hero:fullscreen:not(.has-cam) .hero-top {
  flex: 1 1 auto; flex-direction: column; align-items: center; justify-content: center; gap: 1.8rem;
}
.card-hero:fullscreen:not(.has-cam) .ring { width: 260px; height: 260px; }
.card-hero:fullscreen:not(.has-cam) .record-btn { width: 100px; height: 100px; }
.card-hero:fullscreen:not(.has-cam) .rec-dot { width: 32px; height: 32px; }
.card-hero:fullscreen:not(.has-cam) .hero-figures { text-align: center; }
.card-hero:fullscreen:not(.has-cam) .timer { font-size: clamp(3.4rem, 12vw, 5.4rem); }

/* ---------- mood ---------- */

.mood-row { display: flex; flex-wrap: wrap; gap: .4rem; }
.mood-tag {
  border: none;
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink-soft);
  font-size: .84rem; font-weight: 400;
  padding: .42rem .95rem;
  cursor: pointer;
  transition: background .3s, color .3s, transform .35s var(--ease-spring);
}
.mood-tag:hover { color: var(--ink); transform: translateY(-2px); }
.mood-tag:active { transform: scale(.92); }
.mood-tag.on { background: var(--ink); color: var(--paper); font-weight: 500; }

/* ---------- prompt card ---------- */

.prompt-text {
  font-size: 1.22rem;
  font-weight: 400;
  line-height: 1.42;
  letter-spacing: -.01em;
  margin-top: .2rem;
}
.card-ink .prompt-text { color: var(--paper); }
.prompt-big {
  font-size: clamp(1.8rem, 6.5vw, 2.6rem);
  font-weight: 500;
  line-height: 1.16;
  letter-spacing: -.03em;
  margin: 1.2rem 0 0;
  max-width: 20ch;
}
.prompt-why {
  font-size: .95rem; font-weight: 300; line-height: 1.65;
  color: var(--ink-soft);
  max-width: 52ch;
  margin-top: .6rem;
}

/* ---------- entry list (search + grouped rows) ---------- */

.list-search {
  display: flex; align-items: center; gap: .8rem;
  background: color-mix(in srgb, var(--paper) 10%, transparent);
  border-radius: 999px;
  padding: .55rem 1.1rem;
  margin-bottom: .9rem;
  transition: background .3s;
}
.list-search:focus-within { background: color-mix(in srgb, var(--paper) 16%, transparent); }
.list-search svg { flex: 0 0 auto; opacity: .6; }
.list-search input {
  flex: 1; min-width: 0;
  font-size: .98rem;
  background: none; border: none; outline: none;
  color: inherit;
}
.list-search input::placeholder { color: inherit; opacity: .45; font-weight: 300; }

.entry-list {
  list-style: none;
  max-height: 460px;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: var(--ink-faint) transparent;
  padding: 2px; margin: -2px;
}
.entry-list::-webkit-scrollbar { width: 4px; }
.entry-list::-webkit-scrollbar-thumb { background: color-mix(in srgb, currentColor 25%, transparent); border-radius: 999px; }
.entry-list.scrolly {
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, black 14px, black calc(100% - 14px), transparent 100%);
          mask-image: linear-gradient(to bottom, transparent 0, black 14px, black calc(100% - 14px), transparent 100%);
}

.list-day {
  font-size: .68rem; font-weight: 500;
  letter-spacing: .14em; text-transform: uppercase;
  opacity: .45;
  padding: .9rem .2rem .35rem;
}
.entry-row {
  width: 100%;
  display: flex; flex-direction: column; gap: .3rem;
  text-align: left;
  border: none; background: transparent;
  color: inherit;
  border-radius: var(--r-md);
  padding: .6rem .7rem;
  cursor: pointer;
  animation: itemIn .45s var(--ease-out) both;
  transition: background .3s, transform .4s var(--ease-spring);
}
.entry-row:hover { background: color-mix(in srgb, currentColor 8%, transparent); transform: translateX(3px); }
.entry-row:active { transform: scale(.985); }
.entry-row.on { background: color-mix(in srgb, currentColor 12%, transparent); }
.entry-row .t {
  font-size: .98rem; font-weight: 400;
  line-height: 1.35;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.entry-row .m {
  display: flex; align-items: center; gap: .45rem;
  font-size: .7rem; font-weight: 300; letter-spacing: .05em;
  opacity: .55;
  font-variant-numeric: tabular-nums;
}
.entry-row .m svg { display: block; }
.entry-row .dot { width: 3px; height: 3px; border-radius: 50%; background: currentColor; opacity: .6; }

/* ---------- memory / recent cards ---------- */

.memory-card {
  display: flex; align-items: flex-start; gap: .9rem;
  width: 100%; text-align: left;
  background: var(--paper);
  border: none;
  color: inherit;
  border-radius: var(--r-md);
  padding: .85rem 1rem;
  margin-bottom: .55rem;
  cursor: pointer;
  animation: itemIn .55s cubic-bezier(.22, 1.2, .36, 1) both;
  transition: background .5s var(--ease-out), transform .45s var(--ease-spring), box-shadow .45s var(--ease-out);
}
.memory-card:hover { transform: translateY(-2px) scale(1.008); box-shadow: var(--shadow-lift); }
.memory-card:active { transform: scale(.99); }
.memory-when {
  flex: 0 0 auto;
  font-size: .66rem; font-weight: 500;
  letter-spacing: .08em;
  color: var(--ink-faint);
  padding-top: .25rem;
  font-variant-numeric: tabular-nums;
}
.memory-title { font-size: 1rem; font-weight: 400; line-height: 1.35; }
.memory-sub {
  font-size: .88rem; font-weight: 300; line-height: 1.5;
  color: var(--ink-soft);
  margin-top: .3rem;
}

/* ---------- entry view ---------- */

.entry-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 1rem;
  margin-bottom: .7rem;
}
.entry-title {
  font-size: clamp(1.6rem, 5.4vw, 2.1rem);
  font-weight: 500;
  letter-spacing: -.025em;
  line-height: 1.18;
  outline: none;
  border-radius: 8px;
  flex: 1; min-width: 0;
  transition: background .3s;
}
.entry-title:focus { background: var(--paper); box-shadow: 0 0 0 6px var(--paper); }
.entry-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: .5rem;
  margin-bottom: 1.1rem;
}
.chip {
  display: inline-flex; align-items: center; gap: .3rem;
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink-soft);
  font-size: .74rem; font-weight: 400;
  letter-spacing: .04em;
  padding: .26rem .72rem;
  transition: background .3s, color .3s, transform .35s var(--ease-spring);
}
.chip.solid { background: var(--ink); color: var(--paper); font-weight: 500; }
button.chip { border: none; cursor: pointer; }
button.chip:hover { background: var(--ink); color: var(--paper); transform: translateY(-2px); }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.card-ink .chip { background: color-mix(in srgb, var(--paper) 14%, transparent); color: color-mix(in srgb, var(--paper) 78%, transparent); }

.status-strip {
  display: flex; align-items: center; gap: .6rem;
  background: var(--paper);
  border-radius: var(--r-md);
  padding: .75rem 1rem;
  font-size: .88rem; font-weight: 300;
  color: var(--ink-soft);
  margin-bottom: 1rem;
  animation: itemIn .45s var(--ease-out) both;
}
.status-strip.warn { color: var(--amber); background: color-mix(in srgb, var(--amber) 9%, transparent); }
.status-strip.bad { color: var(--red); background: color-mix(in srgb, var(--red) 9%, transparent); }
.spinner {
  width: 12px; height: 12px; flex: 0 0 auto;
  border: 1.6px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin .7s linear infinite;
  opacity: .7;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* player */
.player { padding: 1.3rem 1.4rem 1.2rem; }
/* These are self-portraits, so play them back the way Sir saw himself while
   recording — mirrored, matching the live preview — rather than the way a
   stranger would see him. The stored file stays un-mirrored, so an exported
   copy is still in the ordinary orientation. */
.player video {
  width: 100%; display: block;
  border-radius: var(--r-md);
  background: #000;
  margin-bottom: 1rem;
  max-height: 68vh;
  transform: scaleX(-1);
}
.player-bar { display: flex; align-items: center; gap: .75rem; }
.p-btn {
  width: 44px; height: 44px; flex: 0 0 auto;
  border: none; border-radius: 50%;
  background: var(--ink); color: var(--paper);
  cursor: pointer;
  display: grid; place-items: center;
  transition: transform .35s var(--ease-spring);
}
.p-btn:hover { transform: scale(1.07); }
.p-btn:active { transform: scale(.9); }
.p-time {
  font-size: .74rem; font-weight: 400;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
  flex: 0 0 auto;
}
.p-track { flex: 1; min-width: 0; padding: .7rem 0; cursor: pointer; touch-action: none; }
.p-rail {
  position: relative;
  height: 3px; border-radius: 999px;
  background: var(--sunken);
}
.p-fill { height: 100%; width: 0; border-radius: 999px; background: var(--ink); }
.p-thumb {
  position: absolute; top: 50%;
  width: 12px; height: 12px;
  margin-left: -6px;
  border-radius: 50%;
  background: var(--ink);
  transform: translateY(-50%);
  box-shadow: 0 2px 6px rgb(0 0 0 / .2);
  transition: transform .3s var(--ease-spring);
}
.p-track:hover .p-thumb { transform: translateY(-50%) scale(1.25); }
.speed-btn {
  border: none; border-radius: 999px;
  background: var(--paper);
  color: var(--ink-soft);
  font-size: .76rem; font-weight: 500;
  padding: .32rem .7rem;
  cursor: pointer;
  flex: 0 0 auto;
  font-variant-numeric: tabular-nums;
  transition: background .3s, color .3s, transform .35s var(--ease-spring);
}
.speed-btn:hover { background: var(--ink); color: var(--paper); }
.speed-btn:active { transform: scale(.92); }

/* insight (ink card) */
.insight-text {
  font-size: 1.25rem;
  font-weight: 300;
  line-height: 1.55;
  letter-spacing: -.01em;
}

/* transcript */
.transcript {
  font-size: 1.02rem;
  font-weight: 300;
  line-height: 1.8;
  color: var(--ink);
}
.transcript p + p { margin-top: 1rem; }
.t-seg {
  border-radius: 5px;
  cursor: pointer;
  transition: background .3s, color .3s;
}
.t-seg:hover { background: var(--paper); }
.t-seg.on {
  background: var(--ink);
  color: var(--paper);
  box-shadow: 0 0 0 3px var(--ink);
}

/* ---------- insights ---------- */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .55rem;
}
.stat {
  background: var(--paper);
  border-radius: var(--r-md);
  padding: .9rem .8rem .8rem;
  text-align: center;
  animation: itemIn .5s var(--ease-out) both;
}
.stat-n {
  font-size: 1.55rem; font-weight: 500;
  letter-spacing: -.02em; line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.stat-l {
  font-size: .6rem; font-weight: 500;
  letter-spacing: .12em; text-transform: uppercase;
  color: var(--ink-soft);
  margin-top: .3rem;
}
.card-ink .stat { background: color-mix(in srgb, var(--paper) 10%, transparent); }
.card-ink .stat-l { color: color-mix(in srgb, var(--paper) 60%, transparent); }

.heat {
  display: flex; gap: 3px;
  overflow-x: auto;
  padding: .2rem 0 .5rem;
  scrollbar-width: none;
}
.heat::-webkit-scrollbar { display: none; }
.heat-col { display: flex; flex-direction: column; gap: 3px; }
.heat-cell {
  width: 10px; height: 10px;
  border-radius: 3px;
  background: var(--sunken);
  transition: background .3s, transform .3s var(--ease-spring);
}
.heat-cell:hover { transform: scale(1.35); }
.heat-cell.l1 { background: color-mix(in srgb, var(--ink) 30%, var(--sunken)); }
.heat-cell.l2 { background: color-mix(in srgb, var(--ink) 55%, var(--sunken)); }
.heat-cell.l3 { background: color-mix(in srgb, var(--ink) 78%, var(--sunken)); }
.heat-cell.l4 { background: var(--ink); }

.bar-list { display: flex; flex-direction: column; gap: .5rem; }
.bar-row { display: flex; align-items: center; gap: .8rem; }
.bar-name {
  flex: 0 0 84px;
  font-size: .84rem; font-weight: 400;
  color: var(--ink-soft);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.bar-track {
  flex: 1;
  height: 8px; border-radius: 999px;
  background: var(--sunken);
  overflow: hidden;
}
.bar-fill {
  display: block; height: 100%;
  border-radius: 999px;
  background: var(--ink);
  transform-origin: left center;
  animation: barGrow .8s cubic-bezier(.22, 1.2, .36, 1) both;
}
.bar-n {
  flex: 0 0 auto;
  font-size: .76rem; font-weight: 500;
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
}
@keyframes barGrow { from { transform: scaleX(0); } to { transform: scaleX(1); } }

.theme-cloud { display: flex; flex-wrap: wrap; gap: .4rem; }

/* ---------- settings rows ---------- */

.profile-head { display: flex; align-items: center; gap: 1.1rem; }
.profile-avatar {
  width: 62px; height: 62px;
  border-radius: 50%;
  background: var(--ink) url("/icons/avatar.jpg") center / cover no-repeat;
  color: var(--paper);
  display: grid; place-items: center;
  font-size: 1.5rem; font-weight: 500;
  flex: 0 0 auto;
  text-indent: -999em; overflow: hidden;
}
.profile-name {
  font-size: 1.6rem; font-weight: 500; letter-spacing: -.025em;
  line-height: 1.15;
}

.set-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem;
  padding: .85rem 0;
  border-top: 1px solid var(--line);
}
.set-row:first-child { border-top: none; }
.set-label { font-size: .96rem; font-weight: 400; }
.set-help {
  font-size: .8rem; font-weight: 300; line-height: 1.5;
  color: var(--ink-soft);
  margin-top: .2rem;
  max-width: 42ch;
}

/* ---------- empty states ---------- */

.empty {
  text-align: center;
  padding: 3rem 1.4rem;
  animation: rise .6s var(--ease-out) both;
}
.empty-title { font-size: 1.25rem; font-weight: 500; letter-spacing: -.01em; }
.empty-body {
  font-size: .92rem; font-weight: 300; line-height: 1.6;
  color: var(--ink-soft);
  margin: .5rem auto 1.4rem;
  max-width: 38ch;
}
.empty-soft {
  font-size: .92rem; font-weight: 300;
  color: var(--ink-faint);
  padding: .2rem 0 .3rem;
}
.card-ink .empty-soft { color: color-mix(in srgb, var(--paper) 45%, transparent); }

/* ---------- branded select ---------- */

.bsel { position: relative; flex: 1; min-width: 0; }
.bsel-native {
  position: absolute; inset: 0;
  opacity: 0; pointer-events: none;
}
.bsel-btn {
  width: 100%;
  display: flex; align-items: center; justify-content: space-between; gap: .5rem;
  border: none; border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
  font-size: .84rem; font-weight: 400;
  padding: .45rem .9rem;
  cursor: pointer;
  transition: background .3s, transform .3s var(--ease-spring);
}
.bsel-btn:active { transform: scale(.97); }
.bsel-lbl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bsel-cam .bsel-btn {
  background: rgb(0 0 0 / .45);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  color: #fff;
  max-width: 170px;
}
.bsel-menu {
  position: absolute; left: 0; right: 0; top: calc(100% + .4rem);
  background: var(--card);
  border-radius: var(--r-md);
  box-shadow: var(--shadow), 0 0 0 1px var(--line);
  padding: .3rem;
  z-index: 30;
  display: none;
  max-height: 240px; overflow-y: auto;
}
.bsel.open .bsel-menu { display: block; animation: sheetPopIn .3s var(--ease-spring) both; }
.bsel-opt {
  font-size: .86rem; font-weight: 400;
  padding: .5rem .7rem;
  border-radius: 10px;
  cursor: pointer;
  color: var(--ink);
  transition: background .2s;
}
.bsel-opt:hover { background: var(--paper); }
.bsel-opt.sel { background: var(--ink); color: var(--paper); }

/* ---------- toast ---------- */

.toast-wrap {
  position: fixed;
  left: 50%; bottom: calc(1.6rem + var(--safe-b));
  transform: translateX(-50%);
  display: flex; flex-direction: column-reverse; align-items: center; gap: .5rem;
  z-index: 60;
  width: min(420px, calc(100% - 2rem));
  pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: .7rem;
  background: var(--ink); color: var(--paper);
  font-size: .88rem; font-weight: 400;
  padding: .8rem 1.3rem;
  border-radius: 999px;
  box-shadow: 0 16px 40px -8px rgb(0 0 0 / .4);
  animation: toastIn .6s cubic-bezier(.22, 1.4, .36, 1) both;
  pointer-events: auto;
  max-width: 100%;
}
.toast span { min-width: 0; }
.toast.err { background: var(--red); color: #fff; }
.toast button {
  flex: 0 0 auto;
  border: none; border-radius: 999px;
  background: color-mix(in srgb, var(--paper) 22%, transparent);
  color: inherit;
  font-size: .8rem; font-weight: 500;
  padding: .3rem .8rem;
  cursor: pointer;
  transition: background .3s, transform .35s var(--ease-spring);
}
.toast button:hover { background: color-mix(in srgb, var(--paper) 34%, transparent); }
.toast button:active { transform: scale(.92); }
.toast.out { animation: toastOut .3s var(--ease-out) both; }

/* ---------- scroll to top ---------- */

.scroll-top {
  position: fixed;
  right: max(1.2rem, env(safe-area-inset-right, 0px));
  bottom: calc(1.4rem + var(--safe-b));
  width: 40px; height: 40px;
  border: 1.5px solid var(--line);
  border-radius: 50%;
  background: var(--card);
  color: var(--ink-soft);
  cursor: pointer;
  display: grid; place-items: center;
  box-shadow: var(--shadow);
  opacity: 0; pointer-events: none;
  transform: translateY(12px) scale(.9);
  transition: opacity .35s, transform .45s var(--ease-spring), border-color .3s;
  z-index: 20;
}
.scroll-top.show { opacity: 1; pointer-events: auto; transform: none; }
.scroll-top:hover { border-color: var(--ink); color: var(--ink); transform: translateY(-2px); }

/* ---------- desktop ---------- */

@media (min-width: 920px) {
  .app { max-width: 1000px; padding-top: 3.2rem; }
  .masthead {
    display: flex; align-items: flex-end; justify-content: space-between;
    gap: 2rem;
    padding: 0 .6rem;
  }
  .masthead-top { flex: 0 0 auto; }
  /* A right-aligned strip that can still scroll: shrink to content and push it
     over with margin, never justify-content — flex-end makes overflow at the
     start edge unreachable. */
  .tabs { margin-top: 0; margin-left: auto; justify-content: flex-start; flex: 0 1 auto; min-width: 0; }
  .tabs.scrolly {
    -webkit-mask-image: linear-gradient(to right, transparent, black 6%);
            mask-image: linear-gradient(to right, transparent, black 6%);
  }
  .panel {
    margin-top: 1.4rem;
    display: grid;
    grid-template-columns: 1fr 1.15fr;
    gap: 1.1rem;
    align-items: start;
  }
  .panel.single { grid-template-columns: minmax(0, 760px); justify-content: center; }
  .col { display: flex; flex-direction: column; gap: 1.1rem; }
  .card { margin-bottom: 0; padding: 1.7rem 1.7rem 1.6rem; }
  .card-hero { padding: 1.9rem; }
  .ring { width: 148px; height: 148px; }
  .entry-list { max-height: 520px; }
}

@media (max-width: 560px) {
  /* a control and its explanation fight for the same line on a phone */
  .set-row { flex-direction: column; align-items: flex-start; gap: .7rem; }
  .set-help { max-width: none; }
  .set-row .btn, .set-row .seg { align-self: flex-start; }
}

@media (max-width: 480px) {
  .hero-top { gap: 1.1rem; }
  .ring { width: 118px; height: 118px; }
  .record-btn { width: 56px; height: 56px; }
  .stat-grid { grid-template-columns: repeat(3, 1fr); gap: .45rem; }
  .stat { padding: .75rem .5rem .65rem; }
  .stat-n { font-size: 1.3rem; }
}

/* ---------- touch polish ---------- */

@media (pointer: coarse) {
  input, textarea, select, .list-search input { font-size: 16px; }
  .theme-toggle, .profile-btn { width: 40px; height: 40px; }
  .entry-row:hover { transform: none; background: transparent; }
  .memory-card:hover { transform: none; box-shadow: none; }
  .tab-pill:hover { transform: none; }
}

/* ---------- keyframes ---------- */

@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}
@keyframes cardIn {
  0% { opacity: 0; transform: translateY(26px) scale(.96); filter: blur(6px); }
  60% { filter: blur(0); }
  100% { opacity: 1; transform: none; filter: none; }
}
@keyframes itemIn {
  from { opacity: 0; transform: translateY(10px) scale(.98); filter: blur(3px); }
  to { opacity: 1; transform: none; filter: none; }
}
@keyframes notePop {
  0% { opacity: 0; transform: translateY(14px) scale(.92); }
  60% { transform: translateY(-2px) scale(1.015); }
  100% { opacity: 1; transform: none; }
}
@keyframes popIn {
  0% { transform: scale(.6); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}
@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(.7); opacity: .5; }
}
@keyframes recPulse {
  0%, 100% { box-shadow: 0 8px 24px -10px rgb(0 0 0 / .45), 0 0 0 0 color-mix(in srgb, var(--ink) 30%, transparent); }
  50% { box-shadow: 0 8px 24px -10px rgb(0 0 0 / .45), 0 0 0 14px color-mix(in srgb, var(--ink) 0%, transparent); }
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-7px); }
  75% { transform: translateX(7px); }
}
@keyframes fadeHold {
  0%, 70% { opacity: .55; }
  100% { opacity: 0; }
}
@keyframes swapOut { to { opacity: 0; transform: translateY(-8px); } }
@keyframes swapIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}
@keyframes sheetPopIn {
  from { opacity: 0; transform: translateY(-6px) scale(.96); }
  to { opacity: 1; transform: none; }
}
@keyframes toastIn {
  from { opacity: 0; transform: translateY(60px) scale(.8); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes toastOut {
  to { opacity: 0; transform: translateY(40px) scale(.85); }
}

.panel.swap-out, .masthead-top.swap-out { animation: swapOut .22s var(--ease-out) both; }
.panel.swap-in, .masthead-top.swap-in { animation: swapIn .4s var(--ease-out) both; }

/* theme wipe via view transitions */
::view-transition-old(root), ::view-transition-new(root) {
  animation: none;
  mix-blend-mode: normal;
}
::view-transition-new(root) { z-index: 1; }
::view-transition-old(root) { z-index: 0; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
