@font-face {
  font-family: "Bricolage Grotesque";
  src: url("/fonts/BricolageGrotesque.woff2") format("woff2");
  font-weight: 200 800;
  font-display: swap;
}

:root {
  /* Layout: fixed header and tab bar; each view is its own scroll area so the app never rubber-bands as a whole. */
  --bg: #F2E9D8;
  --surface: #EADFC9;
  --surface-2: #E1D4BA;
  --ink: #2E2A22;
  --ink-2: #6B6352;
  --ink-3: #988E78;
  --line: rgba(46, 42, 34, 0.12);
  --comfort: #2A5540;
  --stretch: #DCAA47;
  --panic: #98452A;
  --cream: #F2E9D8;
  --char: #2E2A22;

  --font-display: "Bricolage Grotesque", ui-rounded, "SF Pro Rounded", system-ui, sans-serif;
  --font-text: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --spring: cubic-bezier(0.34, 1.36, 0.64, 1);
  --fast: 160ms;
  --med: 280ms;
  --slow: 460ms;

  --r-sm: 12px;
  --r-md: 16px;
  --r-lg: 24px;
  --gutter: 20px;
  --col: 520px;
  --tabs-h: 58px;

  color-scheme: light;
}
@supports (transition-timing-function: linear(0, 1)) {
  :root {
    --spring: linear(0, 0.006, 0.025 2.8%, 0.101 6.1%, 0.539 18.9%, 0.721 25.3%, 0.849 31.5%,
      0.937 38.1%, 0.968 41.8%, 0.991 45.7%, 1.006 50.1%, 1.015 55%, 1.017 63.9%, 1.001 85.6%, 1);
  }
}
/* Themes: background, surfaces and ink change; the rings are always green, yellow and red. */
[data-theme="field"][data-mode="light"] {
  --bg: #F2E9D8; --surface: #EADFC9; --surface-2: #E1D4BA;
  --ink: #2E2A22; --ink-2: #6B6352; --ink-3: #988E78; --line: rgba(46, 42, 34, 0.12);
  --comfort: #2A5540; --stretch: #DCAA47; --panic: #98452A;
  color-scheme: light;
}
[data-theme="field"][data-mode="dark"] {
  --bg: #2E2A22; --surface: #38332A; --surface-2: #433D32;
  --ink: #F2E9D8; --ink-2: #B3A88F; --ink-3: #847A65; --line: rgba(242, 233, 216, 0.12);
  --comfort: #6D7B44; --stretch: #CDA04A; --panic: #B3543A;
  color-scheme: dark;
}
[data-theme="olive"][data-mode="light"] {
  --bg: #F2E9D8; --surface: #EADFC9; --surface-2: #E1D4BA;
  --ink: #2E2A22; --ink-2: #6B6352; --ink-3: #988E78; --line: rgba(46, 42, 34, 0.12);
  --comfort: #6D7B44; --stretch: #CDA04A; --panic: #B3543A;
  color-scheme: light;
}
[data-theme="olive"][data-mode="dark"] {
  --bg: #2E2A22; --surface: #38332A; --surface-2: #433D32;
  --ink: #F2E9D8; --ink-2: #B3A88F; --ink-3: #847A65; --line: rgba(242, 233, 216, 0.12);
  --comfort: #6D7B44; --stretch: #CDA04A; --panic: #B3543A;
  color-scheme: dark;
}
[data-theme="forest"][data-mode="light"] {
  --bg: #F2E9D8; --surface: #EADFC9; --surface-2: #E1D4BA;
  --ink: #2E2A22; --ink-2: #6B6352; --ink-3: #988E78; --line: rgba(46, 42, 34, 0.12);
  --comfort: #2A5540; --stretch: #DCAA47; --panic: #98452A;
  color-scheme: light;
}
[data-theme="forest"][data-mode="dark"] {
  --bg: #2E2A22; --surface: #38332A; --surface-2: #433D32;
  --ink: #F2E9D8; --ink-2: #B3A88F; --ink-3: #847A65; --line: rgba(242, 233, 216, 0.12);
  --comfort: #2A5540; --stretch: #DCAA47; --panic: #98452A;
  color-scheme: dark;
}
[data-theme="slate"][data-mode="light"] {
  --bg: #E9ECEB; --surface: #DEE3E1; --surface-2: #D2D9D6;
  --ink: #1F2629; --ink-2: #56636A; --ink-3: #87949A; --line: rgba(31, 38, 41, 0.12);
  --comfort: #3D7A5C; --stretch: #E0B23F; --panic: #BF4B3A;
  color-scheme: light;
}
[data-theme="slate"][data-mode="dark"] {
  --bg: #1C2226; --surface: #252D32; --surface-2: #2F383E;
  --ink: #E6ECEC; --ink-2: #9AA8AE; --ink-3: #6A787E; --line: rgba(230, 236, 236, 0.12);
  --comfort: #5B9474; --stretch: #E3B850; --panic: #CF5C49;
  color-scheme: dark;
}
[data-theme="paper"][data-mode="light"] {
  --bg: #FBFAF6; --surface: #F1EFE8; --surface-2: #E7E4DA;
  --ink: #1B1B19; --ink-2: #5E5D57; --ink-3: #9A988F; --line: rgba(27, 27, 25, 0.1);
  --comfort: #3B8A57; --stretch: #EDB72F; --panic: #D64C36;
  color-scheme: light;
}
[data-theme="paper"][data-mode="dark"] {
  --bg: #141413; --surface: #1F1F1D; --surface-2: #2A2A27;
  --ink: #F4F3EE; --ink-2: #A5A39B; --ink-3: #6E6C66; --line: rgba(244, 243, 238, 0.11);
  --comfort: #4FA06A; --stretch: #F0C040; --panic: #E05A44;
  color-scheme: dark;
}
[data-theme="dusk"][data-mode="light"] {
  --bg: #EFE9F0; --surface: #E4DCE6; --surface-2: #D8CEDB;
  --ink: #26202E; --ink-2: #625A6B; --ink-3: #958C9D; --line: rgba(38, 32, 46, 0.12);
  --comfort: #4F7F62; --stretch: #D9A441; --panic: #B4473F;
  color-scheme: light;
}
[data-theme="dusk"][data-mode="dark"] {
  --bg: #221D2B; --surface: #2C2636; --surface-2: #373041;
  --ink: #EEE8F2; --ink-2: #A89FB1; --ink-3: #766E80; --line: rgba(238, 232, 242, 0.12);
  --comfort: #6E9C78; --stretch: #E2B256; --panic: #CE5D52;
  color-scheme: dark;
}

[data-theme="blush"][data-mode="light"] {
  --bg: #F8ECEF; --surface: #F2DFE4; --surface-2: #EAD1D8;
  --ink: #3B2A31; --ink-2: #7D626A; --ink-3: #AD9299; --line: rgba(59, 42, 49, 0.11);
  --comfort: #6E9B80; --stretch: #E6B866; --panic: #D46B70;
  color-scheme: light;
}
[data-theme="blush"][data-mode="dark"] {
  --bg: #2D2127; --surface: #392A31; --surface-2: #45343C;
  --ink: #F8E9ED; --ink-2: #C9ABB3; --ink-3: #91757D; --line: rgba(248, 233, 237, 0.12);
  --comfort: #7FAE90; --stretch: #EBC070; --panic: #E07E83;
  color-scheme: dark;
}

[data-zone="comfort"] { --zc: var(--comfort); }
[data-zone="stretch"] { --zc: var(--stretch); }
[data-zone="panic"] { --zc: var(--panic); }

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
html { overscroll-behavior: none; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 17px/1.42 var(--font-text);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  transition: background-color var(--med) ease;
}
h1, h2, h3 { margin: 0; font-family: var(--font-display); text-wrap: balance; }
p { margin: 0; }
a { color: inherit; }
button, input, textarea { font: inherit; color: inherit; }
button { -webkit-touch-callout: none; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; border-radius: 8px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.chrome { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }

/* ---------- Buttons ---------- */
.btn {
  appearance: none;
  border: 0;
  height: 50px;
  padding: 0 20px;
  border-radius: var(--r-md);
  font: 600 17px/1 var(--font-text);
  letter-spacing: -0.01em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  -webkit-user-select: none;
  user-select: none;
  transition: transform var(--fast) var(--ease-out), background-color var(--med) ease, color var(--med) ease, opacity var(--med) ease;
}
.btn:active { transform: scale(0.965); }
.btn[disabled] { opacity: 0.4; pointer-events: none; }
.btn-primary { background: var(--ink); color: var(--bg); }
.btn-ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }
.btn-quiet { background: transparent; color: var(--ink-2); padding: 0 12px; font-weight: 500; }
.btn-sm { height: 40px; font-size: 15px; padding: 0 16px; border-radius: var(--r-sm); }
.btn-icon { width: 50px; padding: 0; flex: none; background: var(--surface-2); color: var(--ink-2); }
.btn-icon svg { width: 18px; height: 18px; }

/* ---------- App frame ---------- */
.app {
  height: 100%;
  height: 100dvh;
  display: grid;
  grid-template-rows: auto 1fr;
  overflow: hidden;
}
.top { padding: calc(env(safe-area-inset-top) + 8px) var(--gutter) 6px; }
.top-inner {
  max-width: var(--col);
  margin: 0 auto;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.brand {
  display: inline-flex;
  text-decoration: none;
  color: inherit;
  align-items: center;
  gap: 9px;
  border: 0;
  background: none;
  padding: 6px 8px 6px 0;
  cursor: pointer;
  transition: transform var(--fast) var(--ease-out);
}
.brand:active { transform: scale(0.96); }
.brand svg { width: 22px; height: 22px; display: block; }
.wordmark {
  font: 700 23px/1 var(--font-display);
  letter-spacing: -0.035em;
  font-variation-settings: "opsz" 36;
}
.status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 14px;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.status .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--zc); transition: background-color var(--med) ease; }
.status b { color: var(--ink); font-weight: 600; }
.status .pending { width: 7px; height: 7px; border-radius: 50%; box-shadow: inset 0 0 0 1.5px var(--ink-3); }
.status.tick { animation: tick var(--med) var(--ease-out); }
@keyframes tick { from { opacity: 0.2; transform: translateY(3px); } }

.views { position: relative; overflow: hidden; view-transition-name: views; }
.view {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 0 var(--gutter) calc(var(--tabs-h) + env(safe-area-inset-bottom) + 28px);
}
.view[hidden] { display: none; }
.view-inner { max-width: var(--col); margin: 0 auto; }
.view-title {
  font-size: 34px;
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1.05;
  padding: 10px 0 22px;
  font-variation-settings: "opsz" 72;
}

/* ---------- Tabs ---------- */
.tabs {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  padding-bottom: env(safe-area-inset-bottom);
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  -webkit-backdrop-filter: blur(20px) saturate(1.6);
  backdrop-filter: blur(20px) saturate(1.6);
  box-shadow: 0 -0.5px 0 var(--line);
  view-transition-name: tabs;
}
.tabs nav { max-width: var(--col); margin: 0 auto; display: grid; grid-template-columns: repeat(3, 1fr); height: var(--tabs-h); }
.tabs a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  text-decoration: none;
  color: var(--ink-3);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.01em;
  transition: color var(--med) ease;
}
.tabs a svg { width: 26px; height: 26px; transition: transform var(--fast) var(--ease-out); }
.tabs a:active svg { transform: scale(0.88); }
.tabs a[aria-current="page"] { color: var(--ink); }

/* ---------- Check in ---------- */
.checkin { display: flex; flex-direction: column; gap: 18px; padding-top: 4px; }
.board-wrap { position: relative; display: flex; justify-content: center; }
#board {
  display: block;
  width: min(100%, 440px, max(240px, calc(100dvh - 450px)));
  aspect-ratio: 1;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  cursor: crosshair;
  overflow: visible;
}
#board:focus-visible { outline: none; }
#board:focus-visible .ring-panic { stroke: var(--ink); stroke-width: 1.5; }
.ring { stroke: var(--bg); stroke-width: 1.2; transition: opacity var(--slow) var(--ease-out), fill var(--med) ease; }
.ring-comfort { fill: var(--comfort); }
.ring-stretch { fill: var(--stretch); }
.ring-panic { fill: var(--panic); }
#board.has-pin .ring { opacity: 0.5; }
#board.has-pin .ring.is-active { opacity: 1; }
.lbl {
  font: 600 6px var(--font-text);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  pointer-events: none;
  transition: opacity var(--slow) var(--ease-out);
}
.lbl-light { fill: var(--cream); opacity: 0.8; }
.lbl-dark { fill: var(--char); opacity: 0.62; }
#board.has-pin .lbl { opacity: 0.35; }

#trail { pointer-events: none; transition: opacity var(--med) ease; }
#board.hide-trail #trail { opacity: 0; }
.trail-dot { fill: var(--cream); stroke: var(--char); stroke-width: 0.7; }
.trail-halo { fill: none; stroke: var(--cream); stroke-width: 1.1; opacity: 0.9; }
.trail-dot.new, .trail-halo.new { transform-box: fill-box; transform-origin: center; animation: dot-in var(--slow) var(--spring) both; }
@keyframes dot-in { from { transform: scale(0); } }
.trail-line { stroke: var(--cream); stroke-width: 0.8; stroke-linecap: round; }

#pin { pointer-events: none; }
#pin.glide { transition: transform 360ms var(--spring); }
.pin-body { transform-box: fill-box; transform-origin: center; transition: transform 220ms var(--spring), opacity 220ms ease; }
.pin-body.pop { animation: pop 440ms var(--spring); }
@keyframes pop { from { transform: scale(0); } }
#board.dragging .pin-body { transform: scale(1.28); }
.pin-body.land { transform: scale(0.3); opacity: 0; transition: transform 240ms var(--ease-in-out), opacity 240ms ease; }
.pin-halo { fill: none; stroke: var(--cream); stroke-width: 1.4; opacity: 0.8; }
.pin-dot { fill: var(--cream); stroke: var(--char); stroke-width: 2.4; }
.ripple { fill: none; stroke: var(--cream); stroke-width: 0.9; transform-box: fill-box; transform-origin: center; animation: ripple 620ms var(--ease-out) forwards; pointer-events: none; }
@keyframes ripple { from { transform: scale(0.1); opacity: 0.9; } to { transform: scale(1); opacity: 0; } }

.trail-toggle {
  position: absolute;
  top: 0;
  right: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 0;
  background: var(--surface);
  color: var(--ink-3);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: color var(--med) ease, transform var(--fast) var(--ease-out);
}
.trail-toggle:active { transform: scale(0.9); }
.trail-toggle[aria-pressed="true"] { color: var(--ink); }
.trail-toggle svg { width: 18px; height: 18px; }

.panel {
  display: grid;
  background: var(--surface);
  border-radius: var(--r-lg);
  padding: 18px;
  min-height: 150px;
}
.pane {
  grid-area: 1 / 1;
  transition: opacity var(--med) var(--ease-out), transform var(--med) var(--ease-out), visibility 0s;
}
.pane[aria-hidden="true"] {
  opacity: 0;
  transform: translateY(8px);
  visibility: hidden;
  pointer-events: none;
  transition: opacity var(--fast) ease, transform var(--fast) ease, visibility 0s var(--fast);
}
.pane-idle { display: flex; flex-direction: column; justify-content: center; gap: 6px; padding: 2px 2px; }
.ask { font: 650 26px/1.1 var(--font-display); letter-spacing: -0.03em; font-variation-settings: "opsz" 48; }
.tip { color: var(--ink-2); font-size: 15px; }
/* A quiet note above the panel; the board shrinks a little to make room so nothing is pushed off-screen. */
.nudge-line { color: var(--ink-2); font-size: 15px; text-align: center; margin-bottom: -6px; }
.nudge-line .row-action { margin-left: 8px; color: var(--ink); font-weight: 600; }
.checkin:has(.nudge-line:not([hidden])) #board { width: min(100%, 440px, max(220px, calc(100dvh - 490px))); }
.pane-compose { display: flex; flex-direction: column; gap: 14px; }
.zhead { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.zname {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  font: 680 28px/1 var(--font-display);
  letter-spacing: -0.03em;
  font-variation-settings: "opsz" 48;
}
.zname::before {
  content: "";
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--zc);
  transition: background-color var(--med) ease;
  transform: translateY(1px);
}
.zname.bump { animation: bump 240ms var(--ease-out); }
@keyframes bump { from { opacity: 0.35; transform: translateY(4px); } }
.zdepth { font-size: 15px; color: var(--ink-2); transition: opacity var(--fast) ease; }
textarea {
  width: 100%;
  min-height: 50px;
  max-height: 132px;
  resize: none;
  border: 0;
  background: var(--bg);
  border-radius: var(--r-md);
  padding: 13px 15px;
  font-size: 17px;
  line-height: 1.4;
  box-shadow: inset 0 0 0 1px transparent;
  transition: box-shadow var(--fast) ease;
}
textarea::placeholder { color: var(--ink-3); }
textarea:focus { outline: none; box-shadow: inset 0 0 0 1.5px var(--ink-3); }
.pane-compose[data-zone="panic"] textarea { display: none; }
.actions { display: flex; gap: 10px; }
.actions .btn-primary { flex: 1; }
.pane-compose[data-zone="panic"] .btn-primary { background: var(--panic); color: var(--cream); }

/* ---------- History ---------- */
.section { display: flex; flex-direction: column; gap: 12px; padding-bottom: 30px; }
.eyebrow { font: 600 13px/1 var(--font-text); letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-2); }
.stack { display: flex; height: 12px; border-radius: 6px; overflow: hidden; gap: 3px; }
.stack span { height: 100%; background: var(--zc); border-radius: 3px; transform-origin: left; }
.animate .stack span, .stack.animate span { animation: grow 620ms var(--ease-out) both; }
.legend { display: flex; gap: 18px; flex-wrap: wrap; font-size: 15px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.legend span::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--zc); }
.legend b { color: var(--ink); font-weight: 600; }
.nudge { display: flex; align-items: center; gap: 10px; font-size: 15px; color: var(--ink); background: var(--surface); padding: 12px 14px; border-radius: var(--r-md); }
.nudge::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--comfort); flex: none; }

.strips { display: grid; grid-template-columns: 66px 1fr; column-gap: 12px; row-gap: 7px; align-items: center; }
.strips .lab { font-size: 13px; color: var(--ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.strips .lab.today { color: var(--ink); font-weight: 600; }
.bar { position: relative; height: 12px; border-radius: 4px; background: var(--surface); overflow: hidden; }
.bar span { position: absolute; top: 0; bottom: 0; background: var(--zc); }
.bar .now { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: var(--ink); opacity: 0.55; border-radius: 1px; }
.strips.animate .bar { animation: grow 560ms var(--ease-out) both; animation-delay: calc(var(--i) * 22ms); transform-origin: left; }
@keyframes grow { from { transform: scaleX(0); } }
.hours { position: relative; height: 13px; font-size: 11px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.hours span { position: absolute; transform: translateX(-50%); }
.strips.compact { grid-template-columns: 58px 1fr; row-gap: 5px; }
.strips.compact .bar { height: 9px; border-radius: 3px; background: var(--surface-2); }

.entries { display: flex; flex-direction: column; }
.day-head {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--bg);
  font: 600 13px/1 var(--font-text);
  color: var(--ink-2);
  padding: 16px 0 8px;
}
.entry { position: relative; overflow: hidden; box-shadow: 0 0.5px 0 var(--line); transition: height var(--med) var(--ease-in-out), opacity var(--med) ease; }
.entry .del {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 92px;
  border: 0;
  background: var(--panic);
  color: var(--cream);
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
}
.entry-row {
  position: relative;
  background: var(--bg);
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 12px;
  padding: 12px 0;
  touch-action: pan-y;
  transition: transform 420ms var(--spring);
}
.entry.swiping .entry-row { transition: none; }
.entry.open .entry-row, .entry:focus-within .entry-row { transform: translateX(-92px); }
.entry time { font-size: 15px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.entry .what { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.entry .zn { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; }
.entry .zn::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--zc); }
.entry .zn small { font-weight: 400; font-size: 14px; color: var(--ink-2); }
.entry .txt { font-size: 16px; color: var(--ink); overflow-wrap: anywhere; }
.entry.gone { opacity: 0; }
.empty { color: var(--ink-2); font-size: 15px; }

/* ---------- Shared ---------- */
.share-card { background: var(--surface); border-radius: var(--r-lg); padding: 20px; display: flex; flex-direction: column; gap: 20px; }
.now-row { display: flex; align-items: center; gap: 18px; }
.now-row .mini { width: 86px; height: 86px; flex: none; }
.mini .ring { stroke-width: 2; }
.now-label { font-size: 13px; color: var(--ink-2); }
.now-zone { font: 700 32px/1.05 var(--font-display); letter-spacing: -0.035em; font-variation-settings: "opsz" 72; }
.now-meta { font-size: 15px; color: var(--ink-2); margin-top: 2px; }
.share-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.share-actions .btn-primary { flex: 1; }
.caption { font-size: 14px; color: var(--ink-2); }

/* ---------- About ---------- */
.back {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  margin: 4px 0 0 -6px;
  border: 0;
  background: none;
  color: var(--ink-2);
  font-size: 17px;
  padding: 6px 8px 6px 2px;
  cursor: pointer;
}
.back svg { width: 22px; height: 22px; }
.prose { max-width: 62ch; }
.prose h2 { font-size: 21px; font-weight: 650; letter-spacing: -0.025em; margin: 30px 0 10px; }
.prose p, .prose li { font-size: 16px; line-height: 1.58; }
.prose p + p { margin-top: 10px; }
.prose .lead { font-size: 19px; line-height: 1.45; color: var(--ink); }
.prose em { font-style: italic; }
.zones { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 12px; }
.zones li { display: grid; grid-template-columns: 16px 1fr; gap: 10px; }
.zones li::before { content: ""; width: 12px; height: 12px; border-radius: 50%; background: var(--zc); margin-top: 6px; }
.zones b { font-weight: 650; }
.refs { padding-left: 1.1em; margin: 0; color: var(--ink-2); }
.refs li { font-size: 14px; line-height: 1.5; margin-bottom: 6px; }
.data-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 4px; }
.fine { margin-top: 36px; font-size: 13px; color: var(--ink-3); }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tabs-h) + env(safe-area-inset-bottom) + 14px);
  z-index: 40;
  transform: translate(-50%, 16px) scale(0.96);
  opacity: 0;
  pointer-events: none;
  background: var(--ink);
  color: var(--bg);
  border-radius: 999px;
  padding: 12px 18px;
  font-size: 15px;
  font-weight: 500;
  display: flex;
  gap: 14px;
  align-items: center;
  white-space: nowrap;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.18);
  transition: opacity var(--fast) ease, transform var(--med) var(--spring);
}
.toast.show { opacity: 1; transform: translate(-50%, 0) scale(1); pointer-events: auto; }
.toast a { color: var(--bg); font-weight: 650; text-decoration: none; opacity: 0.85; }

/* ---------- Calm ---------- */
.calm {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 34px;
  padding: calc(env(safe-area-inset-top) + 24px) 28px calc(env(safe-area-inset-bottom) + 24px);
  text-align: center;
  opacity: 0;
  transition: opacity 600ms var(--ease-out);
}
.calm[hidden] { display: none; }
.calm.open { opacity: 1; }
.calm svg { width: min(68vw, 300px); height: auto; overflow: visible; }
.calm .breathe { transform-box: fill-box; transform-origin: center; animation: breathe 10s ease-in-out infinite; }
.calm .breathe circle { stroke: var(--bg); stroke-width: 1.2; }
@keyframes breathe { 0% { transform: scale(0.68); } 40% { transform: scale(1); } 100% { transform: scale(0.68); } }
.breath-ui { display: flex; flex-direction: column; align-items: center; gap: 8px; min-height: 120px; }
.phase { font: 650 34px/1.1 var(--font-display); letter-spacing: -0.03em; transition: opacity 700ms ease; }
.phase.fade { opacity: 0; }
.count { font-size: 15px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.skip { margin-top: 10px; opacity: 0; pointer-events: none; transition: opacity var(--slow) ease; }
.skip.show { opacity: 1; pointer-events: auto; }
.write { display: flex; flex-direction: column; gap: 12px; width: min(100%, 320px); animation: rise var(--slow) var(--ease-out) both; }
.write[hidden], .breath-ui[hidden] { display: none; }
.write h2 { font-size: 32px; font-weight: 700; letter-spacing: -0.035em; margin-bottom: 8px; }
.write .btn-primary { background: var(--panic); color: var(--cream); }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }

/* ---------- View transitions ---------- */
::view-transition-group(tabs) { animation: none; }
::view-transition-old(views), ::view-transition-new(views) {
  animation-duration: 300ms;
  animation-timing-function: var(--ease-out);
}
html[data-dir="fwd"]::view-transition-old(views) { animation-name: vt-out-left; }
html[data-dir="fwd"]::view-transition-new(views) { animation-name: vt-in-right; }
html[data-dir="back"]::view-transition-old(views) { animation-name: vt-out-right; }
html[data-dir="back"]::view-transition-new(views) { animation-name: vt-in-left; }
@keyframes vt-out-left { to { opacity: 0; transform: translateX(-28px); } }
@keyframes vt-in-right { from { opacity: 0; transform: translateX(28px); } }
@keyframes vt-out-right { to { opacity: 0; transform: translateX(28px); } }
@keyframes vt-in-left { from { opacity: 0; transform: translateX(-28px); } }
.view.enter { animation: rise var(--med) var(--ease-out); }

/* ---------- Sign in and share page ---------- */
.solo {
  min-height: 100%;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: calc(env(safe-area-inset-top) + 24px) var(--gutter) calc(env(safe-area-inset-bottom) + 24px);
}
.signin { width: min(100%, 320px); display: flex; flex-direction: column; gap: 14px; text-align: center; }
.signin svg { width: 64px; height: 64px; margin: 0 auto 6px; }
.signin h1 { font-size: 36px; font-weight: 700; letter-spacing: -0.04em; margin-bottom: 10px; font-variation-settings: "opsz" 72; }
.signin input {
  height: 52px;
  border: 0;
  border-radius: var(--r-md);
  background: var(--surface);
  padding: 0 16px;
  font-size: 17px;
  text-align: center;
  box-shadow: inset 0 0 0 1px transparent;
  transition: box-shadow var(--fast) ease;
}
.signin input:focus { outline: none; box-shadow: inset 0 0 0 1.5px var(--ink-3); }
.signin .err { color: var(--panic); font-size: 15px; min-height: 1.4em; }
.shake { animation: shake 360ms var(--ease-out); }
@keyframes shake { 20% { transform: translateX(-8px); } 45% { transform: translateX(7px); } 70% { transform: translateX(-4px); } }

.share-page { width: min(100%, var(--col)); display: flex; flex-direction: column; gap: 20px; align-self: start; padding-top: 12px; }
.share-page .brand { pointer-events: none; }
.updated { font-size: 13px; color: var(--ink-3); text-align: center; }

/* ---------- Header extras ---------- */
.top-right { display: flex; align-items: center; gap: 12px; }
.avatar {
  text-decoration: none;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 0;
  background: var(--surface-2);
  color: var(--ink);
  font: 650 15px/1 var(--font-display);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: transform var(--fast) var(--ease-out), background-color var(--med) ease;
}
.avatar:active { transform: scale(0.92); }
.avatar[aria-current="page"] { background: var(--ink); color: var(--bg); }

/* ---------- Grouped rows (settings style) ---------- */
.group { background: var(--surface); border-radius: var(--r-lg); overflow: hidden; }
.group + .caption { margin-top: -4px; padding: 0 4px; }
.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 54px;
  padding: 10px 16px;
  box-shadow: 0 0.5px 0 var(--line);
  font-size: 17px;
}
.row:last-child { box-shadow: none; }
.row .sub { display: block; font-size: 14px; color: var(--ink-2); margin-top: 1px; }
.row .grow { flex: 1; min-width: 0; }
.row .grow > span:first-child { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
button.row, a.row { width: 100%; border: 0; background: none; text-align: left; cursor: pointer; text-decoration: none; color: inherit; }
button.row:active, a.row:active { background: var(--surface-2); }
.chev { width: 18px; height: 18px; color: var(--ink-3); flex: none; }
.row-action { border: 0; background: none; color: var(--ink-2); font-size: 15px; padding: 6px 2px; cursor: pointer; }
.row-action.danger { color: var(--panic); }
/* Confirming a risky row action (tap twice): the button becomes a small pill, the row explains what will happen,
   and the other actions step aside so the link can’t be shared by accident. */
.row-action { border-radius: 999px; transition: background-color var(--med) ease, padding var(--med) var(--ease-out); }
.row-action.armed { font-weight: 600; padding-left: 12px; padding-right: 12px; background: var(--surface-2); }
.row-action.danger.armed { background: color-mix(in srgb, var(--panic) 14%, transparent); }
.row:has(.row-action.armed, .row-action.working) :is([data-share-url], [data-copy]) { display: none; }
.row .sub-b { display: none; }
.row:has(.row-action.armed, .row-action.working) .sub-a { display: none; }
.row:has(.row-action.armed, .row-action.working) .sub-b { display: inline; }
.row .grow { transition: opacity var(--med) ease; }
.row:has(.row-action.working) .grow { opacity: 0.55; }
/* A request is running: spinner plus a short label. */
.working::before {
  content: ""; display: inline-block; width: 11px; height: 11px; margin-right: 7px; vertical-align: -1px;
  border-radius: 50%; border: 2px solid var(--line); border-top-color: currentColor;
  animation: spin 700ms linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
/* A row collapsing away once its removal succeeded. */
.row.leaving { overflow: hidden; transition: height 300ms var(--ease-out), min-height 300ms var(--ease-out), padding 300ms var(--ease-out), opacity 220ms ease; }
.danger-text { color: var(--panic); }

/* Switch: native on Safari (with haptics), drawn here elsewhere. */
input[type="checkbox"][switch] { accent-color: var(--comfort); width: 51px; height: 31px; margin: 0; flex: none; }
.no-switch input[type="checkbox"][switch] {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  border-radius: 999px;
  background: var(--surface-2);
  box-shadow: inset 0 0 0 1px var(--line);
  cursor: pointer;
  transition: background-color var(--med) ease;
}
.no-switch input[type="checkbox"][switch]::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 27px;
  height: 27px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.22);
  transition: transform var(--med) var(--spring);
}
.no-switch input[type="checkbox"][switch]:checked { background: var(--comfort); }
.no-switch input[type="checkbox"][switch]:checked::after { transform: translateX(20px); }

.segmented {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  background: var(--surface-2);
  border-radius: 11px;
  padding: 2px;
  gap: 2px;
}
.segmented button {
  border: 0;
  background: transparent;
  border-radius: 9px;
  height: 32px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-2);
  cursor: pointer;
  transition: background-color var(--med) ease, color var(--med) ease, box-shadow var(--med) ease;
}
.segmented button[aria-pressed="true"] { background: var(--bg); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12); }

.themes { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.theme-card {
  border: 0;
  background: var(--bg);
  color: var(--ink);
  border-radius: var(--r-md);
  padding: 12px 4px 9px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px var(--line);
  font-size: 14px;
  font-weight: 600;
  transition: transform var(--fast) var(--ease-out), box-shadow var(--med) ease;
}
.theme-card:active { transform: scale(0.96); }
.theme-card svg { width: 44px; height: 44px; }
.theme-card[aria-pressed="true"] { box-shadow: inset 0 0 0 2.5px var(--ink); }

.stack-v { display: flex; flex-direction: column; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 14px; font-weight: 600; color: var(--ink-2); }
.input {
  height: 50px;
  border: 0;
  border-radius: var(--r-md);
  background: var(--bg);
  padding: 0 15px;
  font-size: 17px;
  width: 100%;
  box-shadow: inset 0 0 0 1px var(--line);
  transition: box-shadow var(--fast) ease;
}
.group .input { background: var(--bg); }
.solo .input { background: var(--surface); box-shadow: inset 0 0 0 1px transparent; }
.input:focus { outline: none; box-shadow: inset 0 0 0 1.5px var(--ink-3); }
.form-msg { font-size: 15px; min-height: 1.4em; color: var(--ink-2); }
.form-msg.err { color: var(--panic); }

details.more { border-radius: var(--r-lg); background: var(--surface); overflow: hidden; }
details.more + details.more { margin-top: 10px; }
details.more > summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 54px;
  padding: 10px 16px;
  cursor: pointer;
  font-size: 17px;
}
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary .chev { transition: transform var(--med) var(--ease-out); }
details.more[open] > summary .chev { transform: rotate(90deg); }
details.more .body { padding: 2px 16px 16px; display: flex; flex-direction: column; gap: 12px; animation: rise var(--med) var(--ease-out); }

/* ---------- People ---------- */
.people { display: flex; flex-direction: column; gap: 10px; }
details.person { background: var(--surface); border-radius: var(--r-lg); overflow: hidden; }
details.person > summary { list-style: none; display: flex; align-items: center; gap: 14px; padding: 14px 16px; cursor: pointer; }
details.person > summary::-webkit-details-marker { display: none; }
details.person .mini { width: 52px; height: 52px; flex: none; }
.person-name { font-size: 15px; color: var(--ink-2); }
.person-zone { font: 680 22px/1.1 var(--font-display); letter-spacing: -0.025em; }
.person-meta { font-size: 14px; color: var(--ink-3); }
.person-nudge { font-size: 14px; color: var(--ink-2); }
/* Full-width secondary action; the label may wrap (long names, and the limit warning once armed). */
details.person .inner > .btn-ask {
  position: relative; isolation: isolate; overflow: hidden;
  align-self: stretch; height: auto; min-height: 44px; padding: 11px 16px;
  white-space: normal; text-align: center; line-height: 1.25;
  transition: transform var(--fast) var(--ease-out), box-shadow 320ms ease, opacity var(--med) ease;
}
.btn-ask .label { display: inline-block; }
/* Arming: a tint wipes in from the left behind the label, and out to the right if the confirm times out.
   The label colour never changes, so it stays readable the whole way. */
.btn-ask::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: var(--surface-2);
  background: color-mix(in srgb, var(--ink) 16%, transparent);
  transform: scaleX(0); transform-origin: right;
  transition: transform 380ms var(--ease-out);
}
.btn-ask.armed { box-shadow: inset 0 0 0 1px var(--ink-2); }
.btn-ask.armed::before { transform: scaleX(1); transform-origin: left; }
.btn-ask.armed .label { animation: ask-label 320ms var(--ease-out) both; }
@keyframes ask-label { from { opacity: 0; transform: translateY(5px); } }
/* The body clips while its height animates open and closed (see toggleCard); the inner box keeps the padding. */
details.person .body { overflow: hidden; }
details.person .inner { padding: 0 16px 16px; display: flex; flex-direction: column; gap: 14px; }
details.person > summary .chev { transition: transform 220ms var(--ease-out); }
details.person[open]:not(.closing) > summary .chev { transform: rotate(90deg); }
.notes-list { display: flex; flex-direction: column; gap: 8px; }
.notes-list p { font-size: 15px; display: grid; grid-template-columns: 66px 1fr; gap: 10px; }
.notes-list time { color: var(--ink-3); font-variant-numeric: tabular-nums; }
.add-row { display: flex; gap: 8px; padding: 10px 12px; box-shadow: 0 -0.5px 0 var(--line); }
.add-row .input { height: 44px; }
.add-row .btn { height: 44px; }
.joined-hint { display: flex; align-items: center; justify-content: space-between; gap: 10px; }

/* ---------- Join and recovery ---------- */
.solo-card { width: min(100%, 360px); display: flex; flex-direction: column; gap: 14px; }
.solo-card .logo { width: 56px; height: 56px; margin: 0 auto 4px; }
.solo-card h1 { font-size: 32px; font-weight: 700; letter-spacing: -0.04em; text-align: center; font-variation-settings: "opsz" 72; }
.solo-card .lede { text-align: center; color: var(--ink-2); font-size: 16px; margin-top: -6px; margin-bottom: 4px; }
.code {
  font: 600 22px/1.5 ui-monospace, "SF Mono", Menlo, monospace;
  letter-spacing: 0.06em;
  text-align: center;
  background: var(--surface);
  border-radius: var(--r-md);
  padding: 18px 12px;
  word-spacing: 0.2em;
  -webkit-user-select: all;
  user-select: all;
}
.link-btn { border: 0; background: none; color: var(--ink-2); font-size: 15px; cursor: pointer; padding: 6px; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; }
  .calm .breathe { animation: none; transform: scale(0.86); }
  ::view-transition-old(views), ::view-transition-new(views) { animation: none; }
}
