/* BU-sy: Brownstone palette, one sentence per screen.
   Motion: press feedback on every control, page transitions, sliding sheets.
   All of it is switched off under prefers-reduced-motion. */
@font-face {
  font-family: "IBM Plex Sans";
  src: url("../assets/fonts/IBMPlexSans-Variable.woff2") format("woff2");
  font-weight: 100 700;
  font-display: swap;
}

:root {
  --ground: #F6F1EA;
  --surface: #FFFDF8;
  --ink: #2A2420;
  --muted: #6C6158;
  --line: #E5DDD2;
  --accent: #9E2A2B;
  --accent-press: #84211F;
  --accent-soft: #F6E4E1;
  --free: #2F5D50;
  --free-soft: #E4EEE9;
  --busy: #EDE6DC;
  --focus: #2F5D50;
  --radius: 16px;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --fast: 140ms;
  --med: 280ms;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--ground);
  color: var(--ink);
  font: 16px/1.5 "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
a { color: var(--accent); }
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 12px; top: -48px; background: var(--ink); color: #fff; padding: 8px 12px; border-radius: 8px; z-index: 50; }
.skip:focus { top: 12px; }

/* One phone-width column at every size. */
.phone {
  max-width: 440px; min-height: 100dvh; margin: 0 auto;
  display: flex; flex-direction: column; background: var(--ground);
}
@media (min-width: 520px) { .phone { border-inline: 1px solid var(--line); } }
#view { flex: 1; display: flex; flex-direction: column; padding: 20px 24px 120px; outline: none; }

/* ---------- controls and press feedback ---------- */
.btn, .word, .row, .tabs a, .opt, .seg button, .chip-btn, .icon-btn {
  transition: transform var(--fast) var(--ease), background-color var(--fast) ease, box-shadow var(--fast) ease, color var(--fast) ease;
  touch-action: manipulation;
}
.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; padding: 0 20px; border-radius: var(--radius); border: 1px solid var(--line);
  background: var(--surface); font-size: 16px; font-weight: 600; text-decoration: none; color: var(--ink); cursor: pointer;
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-size: 17px; font-weight: 700;
  box-shadow: 0 1px 0 rgba(42, 36, 32, 0.08), 0 6px 16px -8px rgba(158, 42, 43, 0.55); }
.btn.primary:hover { background: var(--accent-press); }
.btn.quiet { border-color: transparent; background: none; color: var(--muted); }
.btn:active, .row:active, .opt:active, .seg button:active, .chip-btn:active, .icon-btn:active { transform: scale(0.97); }
.btn.primary:active { transform: scale(0.97); box-shadow: 0 1px 0 rgba(42, 36, 32, 0.08); background: var(--accent-press); }
.btn[disabled] { opacity: 0.5; pointer-events: none; }
.btn-col { display: flex; flex-direction: column; gap: 10px; }
.icon-btn { width: 44px; height: 44px; display: grid; place-items: center; border: none; background: none; border-radius: 12px; cursor: pointer; }
.icon-btn:hover { background: var(--busy); }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- plan: the sentence ---------- */
.plan { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 24px; }
.sentence { margin: 0; font-size: clamp(28px, 8vw, 34px); line-height: 1.38; font-weight: 600; letter-spacing: -0.02em; }
.sentence.then { font-size: clamp(20px, 5.6vw, 23px); line-height: 1.45; font-weight: 500; color: var(--muted); margin-top: -10px; }
.word {
  display: inline; padding: 0 2px; margin: 0 -2px; border: none; border-radius: 6px; background: none; cursor: pointer;
  color: var(--accent); font-weight: inherit; text-decoration: underline; text-decoration-style: dashed;
  text-decoration-thickness: 2px; text-underline-offset: 6px;
}
.word:hover { background: var(--accent-soft); }
.word:active { background: var(--accent-soft); transform: scale(0.95); }
.word.pop { animation: pop var(--med) var(--ease); }
@keyframes pop { 0% { transform: scale(0.9); background: var(--accent-soft); } 60% { transform: scale(1.06); } 100% { transform: scale(1); background: transparent; } }
.hint { margin: -10px 0 0; font-size: 14px; color: var(--muted); }
.chip { align-self: flex-start; display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 6px 12px; font-size: 13px; font-weight: 600; }
.chip.free { background: var(--free-soft); color: var(--free); }
.chip.warn { background: var(--accent-soft); color: var(--accent); }
.fine { margin: 0; font-size: 12px; line-height: 1.5; color: var(--muted); }
.fine a { color: var(--muted); font-weight: 600; }

/* ---------- headings and lists ---------- */
.head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 -12px 8px; }
.head h1 { margin: 0 12px; font-size: 28px; line-height: 1.2; letter-spacing: -0.02em; }
.back { display: inline-flex; align-items: center; gap: 2px; min-height: 44px; padding: 0 8px; border-radius: 12px; text-decoration: none; color: var(--ink); font-weight: 600; }
.back:hover { background: var(--busy); }
.label { margin: 0 0 8px; font-size: 13px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.stack { display: flex; flex-direction: column; gap: 24px; }
.list { list-style: none; margin: 0; padding: 0; }
.list > li { border-bottom: 1px solid var(--line); }
.row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 64px; padding: 12px 8px;
  margin: 0 -8px; border-radius: 12px; text-decoration: none; color: var(--ink);
}
button.row { width: calc(100% + 16px); border: none; background: none; text-align: left; font: inherit; cursor: pointer; }
.row:hover { background: var(--surface); }
.row .main { display: flex; flex-direction: column; min-width: 0; }
.row .title { font-size: 17px; font-weight: 600; overflow-wrap: anywhere; }
.row .sub { font-size: 13px; color: var(--muted); }
.row .sub.open { color: var(--free); font-weight: 600; }
.row .go { color: var(--accent); font-weight: 600; font-size: 15px; white-space: nowrap; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 20px; display: flex; flex-direction: column; gap: 14px; }

/* ---------- answer ---------- */
.answer { display: flex; flex-direction: column; gap: 24px; flex: 1; }
.answer .place { margin: 4px 0 0; font-size: clamp(30px, 9vw, 38px); line-height: 1.1; letter-spacing: -0.03em; }
.answer .what { margin: 0; font-size: 16px; color: var(--muted); }
.answer .what b { color: var(--ink); }
.lvl { font-weight: 600; }
.lvl[data-level="quiet"] { color: var(--free); }
.lvl[data-level="moderate"] { color: #8A4B00; }
.lvl[data-level="busy"] { color: var(--accent); }
/* schedule: the week strip */
.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.day { display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 8px 0; border: 1px solid transparent; border-radius: 14px;
  background: none; cursor: pointer; color: var(--ink); min-width: 0; transition: background-color var(--fast) ease, transform var(--fast) var(--ease); }
.day span { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.03em; }
.day b { font-size: 18px; font-variant-numeric: tabular-nums; }
.day i { font-style: normal; font-size: 10.5px; font-weight: 600; color: var(--free); white-space: nowrap; }
.day:hover { background: var(--surface); }
.day:active { transform: scale(0.95); }
.day[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.day[aria-pressed="true"] span, .day[aria-pressed="true"] i { color: #fff; }
.linkish { border: none; background: none; padding: 0; font: inherit; font-weight: 700; color: inherit; text-decoration: underline; cursor: pointer; }

/* schedule: the day map — your calendar in time order, a suggestion in every free gap */
.daymap { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.blk { position: relative; display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 10px; }
.blk > time { font-size: 12px; font-weight: 600; color: var(--muted); padding-top: 10px; font-variant-numeric: tabular-nums; }
.blk .body { display: flex; flex-direction: column; gap: 4px; border-radius: 14px; padding: 10px 12px; min-width: 0; }
.blk .title { font-size: 15px; font-weight: 600; overflow-wrap: anywhere; }
.blk .sub { font-size: 13px; color: var(--muted); display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.blk.is-busy .body { background: var(--busy); }
.blk.is-club .body { background: var(--accent-soft); }
.blk.is-free .body { background: var(--surface); border: 1.5px dashed #BFD3CA; gap: 6px; }
.blk.is-free .free-len { font-size: 12px; font-weight: 700; color: var(--free); letter-spacing: 0.02em; text-transform: uppercase; }
.blk.is-short .body, .blk.is-past .body { padding: 6px 12px; background: transparent; border: 1px dashed var(--line); }
.blk.over { opacity: 0.55; }
.chip-btn { min-height: 34px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--ground); font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer; }
.blk .btn.primary { min-height: 44px; font-size: 15px; margin-top: 4px; }
.now-line { position: absolute; left: 54px; right: 0; height: 0; border-top: 2px solid var(--accent); pointer-events: none; z-index: 1; }
.now-line b { position: absolute; left: -54px; top: -9px; font-size: 11px; font-weight: 700; color: var(--accent); background: var(--ground); padding-right: 4px; text-transform: uppercase; }

/* place page: busyness through the sample day, one bar per hour */
.day-chart { display: grid; grid-template-columns: repeat(16, minmax(0, 1fr)); gap: 3px; height: 120px; align-items: end; padding: 8px 0 18px; }
.day-chart .col { position: relative; height: 100%; display: flex; align-items: flex-end; }
.day-chart i { display: block; width: 100%; border-radius: 3px 3px 1px 1px; background: var(--line); transform-origin: 50% 100%;
  animation: bar-grow 520ms var(--ease) both; }
.day-chart i[data-level="quiet"] { background: color-mix(in srgb, var(--free) 70%, var(--surface)); }
.day-chart i[data-level="moderate"] { background: #C8925A; }
.day-chart i[data-level="busy"] { background: var(--accent); }
.day-chart .now i { box-shadow: 0 0 0 2px var(--ink); }
.day-chart b { position: absolute; left: 0; bottom: -18px; font-size: 11px; font-weight: 500; color: var(--muted); white-space: nowrap; }
.tag-mini { display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 999px; background: var(--busy); color: var(--muted); font-size: 11px; font-weight: 600; vertical-align: 1px; }
.row .sub { overflow-wrap: anywhere; }

/* club sign-up form */
.field { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 600; }
.field input, .field select, .field textarea { font: inherit; font-weight: 400; font-size: 16px; color: var(--ink); background: var(--ground);
  border: 1px solid var(--line); border-radius: 12px; padding: 12px; min-height: 48px; transition: border-color var(--fast) ease, box-shadow var(--fast) ease; }
.field textarea { min-height: 72px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--free); box-shadow: 0 0 0 3px var(--free-soft); }

/* busyness icon: three ascending bars; the word beside it always says the level */
.busy { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.row .busy { margin-left: auto; font-size: 13px; }
.busy-icon { width: 19px; height: 12px; flex: none; stroke: none; fill: none; overflow: visible; }
.busy-icon rect { fill: var(--line); transform-box: fill-box; transform-origin: 50% 100%; animation: bar-grow 420ms var(--ease) calc(120ms + var(--i) * 70ms) both; }
.busy-icon[data-level="quiet"] rect.on { fill: var(--free); }
.busy-icon[data-level="moderate"] rect.on { fill: #8A4B00; }
.busy-icon[data-level="busy"] rect.on { fill: var(--accent); }
.lvl[data-level="closed"], .lvl[data-level="unknown"] { color: var(--muted); font-weight: 500; }
@keyframes bar-grow { from { transform: scaleY(0.15); } to { transform: none; } }
.steps { list-style: none; margin: 0; padding: 0; }
.steps li { display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.steps li:last-child { border-bottom: none; }
.steps time { font-weight: 700; font-variant-numeric: tabular-nums; }
.steps .muted { color: var(--muted); }
.spacer { flex: 1; }

/* time bar: where every minute of the window goes */
.bar { display: flex; gap: 2px; height: 10px; border-radius: 5px; overflow: hidden; }
.bar span { min-width: 2px; transform-origin: left; animation: grow 520ms var(--ease) both; }
.bar span:nth-child(2) { animation-delay: 40ms; } .bar span:nth-child(3) { animation-delay: 80ms; }
.bar span:nth-child(4) { animation-delay: 120ms; } .bar span:nth-child(5) { animation-delay: 160ms; }
.bar span:nth-child(6) { animation-delay: 200ms; } .bar span:nth-child(7) { animation-delay: 240ms; }
@keyframes grow { from { transform: scaleX(0); opacity: 0; } to { transform: scaleX(1); opacity: 1; } }
.k-there, .k-onward { background: #D6CBBE; }
.k-preparation, .k-cleanup { background: #E7B9B3; }
.k-activity { background: var(--accent); }
.k-buffer { background: var(--free-soft); box-shadow: inset 0 0 0 1px #BFD3CA; }
.k-free, .k-spare { background: repeating-linear-gradient(45deg, var(--line) 0 4px, transparent 4px 8px); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 0; padding: 0; list-style: none; font-size: 12px; color: var(--muted); }
.legend li { display: flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.opt-card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.opt-card.best { border: 2px solid var(--accent); }
.opt-card .top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.opt-card h2 { margin: 0; font-size: 19px; }
.facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.facts span { display: flex; flex-direction: column; font-size: 12px; color: var(--muted); }
.facts b { font-size: 16px; color: var(--ink); font-variant-numeric: tabular-nums; }

/* ---------- schedule ---------- */
.now-card .when { font-size: 30px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; font-variant-numeric: tabular-nums; }
.now-card .then { font-size: 15px; color: var(--muted); }
.events .row { min-height: 56px; }
.events .tag { font-size: 11px; font-weight: 700; border-radius: 999px; padding: 2px 8px; border: 1px solid var(--accent); color: var(--accent); }
.drop { border: 2px dashed #D6CBBE; border-radius: 18px; padding: 22px; display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; }
.steps-num { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.steps-num li { display: flex; gap: 12px; align-items: flex-start; font-size: 15px; }
.steps-num li::before { counter-increment: s; content: counter(s); flex: none; width: 26px; height: 26px; border-radius: 13px; background: var(--ink); color: #fff; display: grid; place-items: center; font-size: 13px; font-weight: 700; }
.steps-num { counter-reset: s; }
.collapse { display: grid; grid-template-rows: 0fr; transition: grid-template-rows var(--med) var(--ease); }
.collapse.open { grid-template-rows: 1fr; }
.collapse > div { overflow: hidden; }
.chev { transition: transform var(--med) var(--ease); }
[aria-expanded="true"] .chev { transform: rotate(180deg); }

/* ---------- explore ---------- */
.search { display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 0 14px; min-height: 48px; transition: box-shadow var(--fast) ease, border-color var(--fast) ease; }
.search:focus-within { border-color: var(--free); box-shadow: 0 0 0 3px var(--free-soft); }
.search input { font: inherit; border: none; outline: none; background: none; flex: 1; min-width: 0; color: var(--ink); }
.seg { position: relative; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); background: var(--busy); border-radius: 12px; padding: 4px; }
.seg::before { content: ""; position: absolute; top: 4px; bottom: 4px; left: 4px; width: calc(50% - 4px); border-radius: 9px; background: var(--surface); box-shadow: 0 1px 2px rgba(42, 36, 32, 0.12); transition: transform var(--med) var(--ease); }
.seg[data-active="1"]::before { transform: translateX(100%); }
.seg button { position: relative; min-height: 40px; border: none; background: none; border-radius: 9px; font-weight: 600; color: var(--muted); cursor: pointer; }
.seg button[aria-selected="true"] { color: var(--ink); font-weight: 700; }
.empty { color: var(--muted); padding: 24px 0; text-align: center; }

/* ---------- onboarding ---------- */
.welcome { flex: 1; display: flex; flex-direction: column; padding-top: 40px; gap: 16px; }
.logo { width: 52px; height: 52px; border-radius: 15px; background: var(--accent); display: grid; place-items: center; color: #fff; }
.logo svg { width: 28px; height: 28px; }
.welcome h1 { margin: auto 0 0; font-size: clamp(32px, 9.5vw, 38px); line-height: 1.1; letter-spacing: -0.03em; }
.welcome .lede { margin: 0 0 auto; font-size: 17px; color: var(--muted); }
.toggle { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 64px; padding: 12px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.toggle .main { display: flex; flex-direction: column; }
.toggle .sub { font-size: 13px; color: var(--muted); }
.switch { appearance: none; flex: none; width: 52px; height: 32px; border-radius: 16px; background: #D6CBBE; position: relative; cursor: pointer; transition: background-color var(--med) ease; margin: 0; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 13px; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2); transition: transform var(--med) var(--ease); }
.switch:checked { background: var(--free); }
.switch:checked::after { transform: translateX(20px); }

/* ---------- tab bar ---------- */
.tabs {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: min(100%, 440px); z-index: 10;
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(12px);
  border-top: 1px solid var(--line); padding: 8px 8px max(14px, env(safe-area-inset-bottom));
}
.tabs a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0; border-radius: 12px; text-decoration: none; color: var(--muted); font-size: 13px; font-weight: 600; }
.tabs a svg { width: 24px; height: 24px; transition: transform var(--med) var(--ease); }
.tabs a[aria-current="page"] { color: var(--accent); }
.tabs a[aria-current="page"] svg { transform: translateY(-2px); }
.tabs a:active { transform: scale(0.94); }
body.no-tabs .tabs { transform: translate(-50%, 110%); }
.tabs { transition: transform var(--med) var(--ease); }

/* ---------- version note: a quiet label above the tab bar, opening the release history ---------- */
/* --tabs-h is the tab bar's measured height (app.js); the screen's bottom padding keeps the last row clear of both. */
#view { padding-bottom: max(120px, calc(var(--tabs-h, 80px) + 44px)); }
.version { position: fixed; left: 50%; bottom: calc(var(--tabs-h, 80px) + 6px); transform: translateX(-50%); z-index: 20;
  transition: bottom var(--med) var(--ease); }
body.no-tabs .version { bottom: max(12px, env(safe-area-inset-bottom)); }
.version-btn {
  display: block; min-height: 28px; max-width: calc(100vw - 32px); padding: 4px 12px; border: none; border-radius: 999px; cursor: pointer;
  background: color-mix(in srgb, var(--ground) 86%, transparent); backdrop-filter: blur(8px);
  font-size: 12px; font-weight: 500; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: background-color var(--fast) ease, color var(--fast) ease;
}
.version-btn .u { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line); }
.version-btn:hover, .version-btn[aria-expanded="true"] { background: var(--busy); color: var(--ink); }
.version-panel {
  position: absolute; left: 50%; bottom: calc(100% + 8px); width: min(408px, calc(100vw - 32px));
  max-height: calc(100dvh - var(--tabs-h, 80px) - 60px - env(safe-area-inset-top)); overflow-y: auto; overscroll-behavior: contain;
  padding: 6px 18px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 20px;
  box-shadow: 0 12px 30px rgba(42, 36, 32, 0.18);
  opacity: 0; transform: translate(-50%, 8px); transition: opacity var(--fast) ease, transform var(--med) var(--ease);
}
.version-panel.open { opacity: 1; transform: translate(-50%, 0); }
.version-panel:focus-visible { outline-offset: 2px; border-radius: 20px; }
.version-top { display: flex; align-items: center; justify-content: space-between; margin-right: -10px; }
.version-top h2 { margin: 0; font-size: 18px; letter-spacing: -0.01em; }
.version-now { margin: 0 0 4px; font-size: 13px; }
.version-now b { color: var(--ink); }
.version-panel .row { min-height: 56px; padding: 10px 8px; }
.version-panel .row:hover { background: var(--ground); }
.version-panel .row .title { font-size: 15px; }
.version-panel .tag-mini { background: var(--accent-soft); color: var(--accent); }
.version-detail { display: flex; flex-direction: column; padding: 0 0 12px; }
.version-detail .label { margin: 8px 0 4px; font-size: 11px; }
.version-changes { margin: 0; padding-left: 18px; font-size: 14px; line-height: 1.45; }
.version-changes li + li { margin-top: 2px; }
.version-detail .fine { margin-top: 8px; }
.version-build { margin-top: 12px; }

/* ---------- sheet (pickers) ---------- */
.scrim { position: fixed; inset: 0; background: rgba(42, 36, 32, 0.45); z-index: 40; opacity: 0; transition: opacity var(--med) ease; }
.sheet {
  position: fixed; left: 50%; bottom: 0; width: min(100%, 440px); z-index: 41;
  transform: translate(-50%, 100%); transition: transform var(--med) var(--ease);
  background: var(--surface); border-radius: 24px 24px 0 0; padding: 10px 20px max(24px, env(safe-area-inset-bottom));
  max-height: 80dvh; overflow: auto; box-shadow: 0 -8px 30px rgba(42, 36, 32, 0.18);
}
.sheet::before { content: ""; display: block; width: 40px; height: 4px; border-radius: 2px; background: var(--line); margin: 0 auto 12px; }
.sheet h2 { margin: 0 0 8px; font-size: 20px; }
.sheet.open { transform: translate(-50%, 0); }
.scrim.open { opacity: 1; }
.opt { display: flex; align-items: center; justify-content: space-between; width: 100%; min-height: 54px; padding: 0 14px; margin: 4px 0; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); text-align: left; cursor: pointer; font-size: 16px; font-weight: 500; }
.opt:hover { background: var(--ground); }
.opt[aria-pressed="true"] { border: 2px solid var(--accent); background: var(--accent-soft); font-weight: 700; }
.opt .note { font-size: 13px; color: var(--muted); font-weight: 400; }

/* coach mark */
.coach { position: fixed; left: 50%; bottom: 120px; transform: translateX(-50%); width: min(calc(100% - 32px), 408px); z-index: 30;
  background: var(--ink); color: #fff; border-radius: 18px; padding: 16px 18px; display: flex; flex-direction: column; gap: 10px;
  animation: rise var(--med) var(--ease) both; box-shadow: 0 12px 30px rgba(42, 36, 32, 0.3); }
.coach p { margin: 0; font-size: 15px; }
.coach .btn { min-height: 44px; align-self: flex-end; background: #fff; color: var(--ink); border: none; }
@keyframes rise { from { opacity: 0; transform: translate(-50%, 16px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ---------- brand: the pin clock ---------- */
.topbar { display: flex; align-items: center; margin: -4px 0 0; }
.brand { display: inline-flex; align-items: center; gap: 8px; color: var(--accent); font-size: 17px; font-weight: 700; letter-spacing: -0.01em; }
.brand > span { color: var(--ink); }
.brand em { font-style: normal; color: var(--accent); }
.pin-clock { stroke: none; fill: none; }
.pin-clock .pin-body { fill: currentColor; }
.pin-clock .pin-face { fill: var(--surface); }
.pin-clock .hand { fill: none; stroke: var(--ink); stroke-width: 3.2; stroke-linecap: round; transform-box: view-box; transform-origin: 32px 26px; }
.brand .pin-clock { width: 24px; height: 24px; }
.logo .pin-clock { width: 34px; height: 34px; color: #fff; }
.logo .pin-clock .pin-face { fill: var(--accent); }
.logo .pin-clock .hand { stroke: #fff; }

/* ---------- loader: drop, land, burst, hover ---------- */
/* Timeline: the pin falls (0-300ms), lands with a squash and a flash, rings and sparks burst out,
   the hands whirl into place, the words pop in letter by letter, then it all keeps breathing. */
.loader {
  position: fixed; inset: 0; z-index: 60; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px;
  background: radial-gradient(circle at 50% 44%, var(--surface) 0, var(--ground) 60%); opacity: 0;
  transition: opacity 180ms ease;
}
.loader.on { opacity: 1; }
.loader.out { opacity: 0; transition: opacity 320ms ease 60ms; }
.loader.out .stage { transform: scale(1.18) translateY(-12px); opacity: 0; transition: transform 320ms var(--ease), opacity 260ms ease; }
.stage { position: relative; width: 220px; height: 220px; display: grid; place-items: center; }
.stage > * { position: absolute; left: 50%; top: 50%; }

.pin-wrap { width: 92px; height: 92px; margin: -58px 0 0 -46px; color: var(--accent); transform-origin: 50% 100%;
  animation: drop 640ms cubic-bezier(0.3, 0, 0.2, 1) both, hover 1.9s ease-in-out 900ms infinite; }
.pin-wrap .pin-clock { width: 92px; height: 92px; filter: drop-shadow(0 10px 14px rgba(158, 42, 43, 0.28)); }
.pin-wrap .hand-m { animation: whirl 900ms cubic-bezier(0.15, 0.7, 0.2, 1) 250ms both, tick 2.4s linear 1150ms infinite; }
.pin-wrap .hand-h { animation: whirl-h 900ms cubic-bezier(0.15, 0.7, 0.2, 1) 250ms both, tick 16s linear 1150ms infinite; }
@keyframes drop {
  0%   { transform: translateY(-280px) scale(0.55); opacity: 0; }
  35%  { opacity: 1; }
  48%  { transform: translateY(0) scale(1.22, 0.78); }
  64%  { transform: translateY(-30px) scale(0.9, 1.12); }
  80%  { transform: translateY(0) scale(1.07, 0.94); }
  100% { transform: translateY(0) scale(1); }
}
@keyframes hover { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
@keyframes whirl { from { transform: rotate(-720deg); } to { transform: rotate(0); } }
@keyframes whirl-h { from { transform: rotate(-240deg); } to { transform: rotate(0); } }
@keyframes tick { to { transform: rotate(360deg); } }

.shadow { width: 64px; height: 12px; margin: 40px 0 0 -32px; border-radius: 50%; background: rgba(42, 36, 32, 0.22);
  animation: shadow-land 640ms ease both, shadow-hover 1.9s ease-in-out 900ms infinite; }
@keyframes shadow-land { 0% { transform: scale(0.2); opacity: 0; } 48% { transform: scale(1.35); opacity: 1; } 100% { transform: scale(1); opacity: 0.8; } }
@keyframes shadow-hover { 0%, 100% { transform: scale(1); opacity: 0.8; } 50% { transform: scale(0.78); opacity: 0.45; } }

.flash { width: 200px; height: 200px; margin: -100px 0 0 -100px; border-radius: 50%; background: var(--accent-soft);
  animation: flash 900ms cubic-bezier(0.2, 0.7, 0.2, 1) 260ms both; }
@keyframes flash { 0% { transform: scale(0); opacity: 0; } 15% { opacity: 1; } 100% { transform: scale(2.6); opacity: 0; } }

.ring { width: 96px; height: 96px; margin: -48px 0 0 -48px; border-radius: 50%; border: 3px solid var(--accent); opacity: 0;
  animation: ring 1.7s cubic-bezier(0.1, 0.6, 0.2, 1) infinite; }
.ring.r1 { animation-delay: 300ms; } .ring.r2 { animation-delay: 480ms; border-color: var(--free); } .ring.r3 { animation-delay: 660ms; border-width: 2px; }
@keyframes ring { 0% { transform: scale(0.35); opacity: 0.9; } 70% { opacity: 0.15; } 100% { transform: scale(2.5); opacity: 0; } }

.sparks { width: 0; height: 0; }
.spark { position: absolute; left: -3px; top: -8px; width: 6px; height: 16px; border-radius: 3px; background: var(--accent); opacity: 0;
  transform: rotate(var(--a)) translateY(0);
  animation: spark 1.7s cubic-bezier(0.1, 0.8, 0.2, 1) 300ms infinite; }
.spark.s1 { background: var(--free); height: 10px; width: 10px; border-radius: 50%; }
.spark.s2 { background: #E7B9B3; }
@keyframes spark {
  0%   { transform: rotate(var(--a)) translateY(-30px) scale(0.3); opacity: 0; }
  8%   { opacity: 1; }
  45%  { transform: rotate(var(--a)) translateY(calc(-1 * var(--d))) scale(1); opacity: 0; }
  100% { transform: rotate(var(--a)) translateY(calc(-1 * var(--d))) scale(1); opacity: 0; }
}

.loader-text { margin: 0; display: flex; align-items: baseline; font-size: 20px; font-weight: 700; letter-spacing: -0.01em; color: var(--ink); white-space: pre; }
.letters .ch { display: inline-block; animation: letter 520ms cubic-bezier(0.3, 1.6, 0.5, 1) calc(420ms + var(--i) * 28ms) both; }
@keyframes letter { 0% { transform: translateY(18px) scale(0.4) rotate(-8deg); opacity: 0; } 100% { transform: none; opacity: 1; } }
.dots { display: inline-flex; gap: 4px; margin-left: 4px; animation: in-fade 300ms var(--ease) 900ms both; }
.dots i { width: 6px; height: 6px; border-radius: 3px; background: var(--accent); animation: bounce 900ms ease-in-out 1000ms infinite; opacity: 0.9; }
.dots i:nth-child(2) { animation-delay: 1120ms; } .dots i:nth-child(3) { animation-delay: 1240ms; }
@keyframes bounce { 0%, 100% { transform: translateY(0); } 40% { transform: translateY(-8px); } }
.loader-line { width: 150px; height: 4px; border-radius: 2px; background: var(--line); overflow: hidden; animation: in-fade 400ms var(--ease) 700ms both; }
.loader-line i { display: block; width: 40%; height: 100%; border-radius: 2px; background: var(--accent); animation: slide 1.1s var(--ease) infinite; }
@keyframes slide { from { transform: translateX(-110%); } to { transform: translateX(260%); } }

/* ---------- page transitions ---------- */
/* View Transitions where supported; otherwise a short fade-and-rise on the new screen. */
@keyframes in-fwd { from { opacity: 0; transform: translateX(28px); } to { opacity: 1; transform: none; } }
@keyframes out-fwd { to { opacity: 0; transform: translateX(-28px); } }
@keyframes in-back { from { opacity: 0; transform: translateX(-28px); } to { opacity: 1; transform: none; } }
@keyframes out-back { to { opacity: 0; transform: translateX(28px); } }
@keyframes in-fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
#view { view-transition-name: view; }
.tabs { view-transition-name: tabs; }
::view-transition-old(view) { animation: out-fwd 180ms ease both; }
::view-transition-new(view) { animation: in-fwd var(--med) var(--ease) both; }
html[data-dir="back"]::view-transition-old(view) { animation-name: out-back; }
html[data-dir="back"]::view-transition-new(view) { animation-name: in-back; }
html[data-dir="tab"]::view-transition-old(view) { animation: none; opacity: 0; }
html[data-dir="tab"]::view-transition-new(view) { animation: in-fade var(--med) var(--ease) both; }
#view.enter { animation: in-fade var(--med) var(--ease) both; }
.stagger > * { animation: in-fade 360ms var(--ease) both; }
.stagger > *:nth-child(2) { animation-delay: 50ms; } .stagger > *:nth-child(3) { animation-delay: 100ms; }
.stagger > *:nth-child(4) { animation-delay: 150ms; } .stagger > *:nth-child(5) { animation-delay: 200ms; }
.stagger > *:nth-child(6) { animation-delay: 250ms; } .stagger > *:nth-child(n+7) { animation-delay: 300ms; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after, ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) {
    animation-duration: 1ms !important; animation-delay: 0ms !important; transition-duration: 1ms !important;
  }
  .btn:active, .row:active, .opt:active, .word:active, .tabs a:active { transform: none; }
  /* Repeating animations would flicker at 1ms: hold them still instead. */
  .stage > *, .pin-wrap .hand, .letters .ch, .dots, .dots i, .loader-line, .loader-line i { animation: none !important; }
  .flash, .ring, .sparks { display: none; }
  .loader-line i { width: 100%; }
}
.fills { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.fill { display: flex; flex-direction: column; gap: 3px; padding: 10px; border-radius: 12px; background: var(--ground); }
.fill .when { font-size: 12px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.fill.is-club { background: var(--accent-soft); }
.fill .btn { min-height: 40px; font-size: 14px; margin-top: 6px; }
.allday { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.allday li { font-size: 13px; padding: 6px 10px; border-radius: 999px; background: var(--busy); overflow-wrap: anywhere; }
.allday b { font-size: 11px; text-transform: uppercase; letter-spacing: 0.02em; color: var(--muted); margin-right: 4px; }
.blk.is-mine .body { background: var(--free-soft); }
.blk .ev { display: flex; flex-direction: column; gap: 2px; }
.blk .ev + .ev { border-top: 1px solid var(--line); padding-top: 8px; margin-top: 4px; }
.fill-acts { display: flex; gap: 8px; flex-wrap: wrap; }
.fill-acts .btn { flex: 1 1 120px; }
.add-event { margin-top: 10px; gap: 10px; }
.blk .linkish { font-size: 13px; font-weight: 600; color: var(--muted); }
