/* Caldar. Two looks over one layout:
   [data-ui="material"]  Material 3 Expressive (Android, Windows, everything else)
   [data-ui="glass"]     Liquid Glass (iOS, iPadOS, macOS)                          */

/* Palette: Material 3 vibrant blue on cool neutrals. Free days lean blue, busy days lean coral. */
:root {
  --bg: #f8f9fc;
  --bg-image: none;
  --card: #ffffff;
  --card-border: transparent;
  --card-shadow: 0 1px 2px rgb(16 24 40 / .06), 0 2px 10px rgb(16 24 40 / .05);
  --blur: none;
  --ink: #1a1c22;
  --muted: #5b616e;
  --line: #c6cad3;
  --field: #f0f2f7;
  --accent: #0b57d0;
  --on-accent: #ffffff;
  --tonal: #d8e4fc;
  --on-tonal: #0a2a66;
  --heat: #1a6cf0;
  --heat-busy: #e5484d;
  --on-heat: #ffffff;
  --cell: #eef1f6;
  --danger: #c4262e;
  --r-card: 28px;
  --r-field: 16px;
  --r-cell: 14px;
  --btn-h: 48px;
  --font: "Google Sans Flex", "Google Sans", "Roboto Flex", Roboto, "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif;
  --display-weight: 700;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111318; --card: #1c1f26; --card-shadow: none;
    --ink: #e3e5ec; --muted: #a3a9b6; --line: #424754; --field: #262a33;
    --accent: #a8c7fa; --on-accent: #062e6f; --tonal: #26385c; --on-tonal: #d8e4fc;
    --heat: #5b9bff; --heat-busy: #ff6b6f; --on-heat: #061733; --cell: #232731;
    --danger: #ffb4ab;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #111318; --card: #1c1f26; --card-shadow: none;
  --ink: #e3e5ec; --muted: #a3a9b6; --line: #424754; --field: #262a33;
  --accent: #a8c7fa; --on-accent: #062e6f; --tonal: #26385c; --on-tonal: #d8e4fc;
  --heat: #5b9bff; --heat-busy: #ff6b6f; --on-heat: #061733; --cell: #232731;
  --danger: #ffb4ab;
  color-scheme: dark;
}

/* ---------- Liquid Glass ---------- */
:root[data-ui="glass"] {
  --bg: #eceff5;
  --bg-image:
    radial-gradient(60vmax 50vmax at 0% 0%, #d4e2fb 0%, transparent 60%),
    radial-gradient(50vmax 40vmax at 100% 10%, #d9eef3 0%, transparent 60%),
    radial-gradient(60vmax 50vmax at 60% 100%, #f6e3dc 0%, transparent 60%);
  --card: rgb(255 255 255 / .58);
  --card-border: rgb(255 255 255 / .75);
  --card-shadow: 0 10px 40px rgb(20 30 60 / .10), inset 0 1px 0 rgb(255 255 255 / .9);
  --blur: blur(28px) saturate(1.8);
  --field: rgb(255 255 255 / .6);
  --line: rgb(60 66 80 / .18);
  --muted: #5d6270;
  --accent: #007aff;
  --tonal: rgb(0 122 255 / .13);
  --on-tonal: #0058c4;
  --heat: #007aff;
  --heat-busy: #ff3b30;
  --cell: rgb(255 255 255 / .5);
  --r-card: 26px;
  --r-field: 12px;
  --r-cell: 12px;
  --btn-h: 44px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro", "Helvetica Neue", system-ui, sans-serif;
  --display-weight: 700;
}
@media (prefers-color-scheme: dark) {
  :root[data-ui="glass"]:not([data-theme="light"]) {
    --bg: #0e1015;
    --bg-image:
      radial-gradient(60vmax 50vmax at 0% 0%, #142645 0%, transparent 60%),
      radial-gradient(50vmax 40vmax at 100% 10%, #11303a 0%, transparent 60%),
      radial-gradient(60vmax 50vmax at 60% 100%, #35211d 0%, transparent 60%);
    --card: rgb(40 42 48 / .5);
    --card-border: rgb(255 255 255 / .12);
    --card-shadow: 0 10px 40px rgb(0 0 0 / .35), inset 0 1px 0 rgb(255 255 255 / .1);
    --field: rgb(255 255 255 / .08);
    --line: rgb(255 255 255 / .16);
    --muted: #a6abb6;
    --accent: #0a84ff;
    --on-accent: #ffffff;
    --tonal: rgb(10 132 255 / .2);
    --on-tonal: #9cc9ff;
    --heat: #0a84ff;
    --heat-busy: #ff453a;
    --on-heat: #ffffff;
    --cell: rgb(255 255 255 / .06);
  }
}
:root[data-ui="glass"][data-theme="dark"] {
  --bg: #0e1015; --card: rgb(40 42 48 / .5); --card-border: rgb(255 255 255 / .12);
  --field: rgb(255 255 255 / .08); --line: rgb(255 255 255 / .16); --muted: #a6abb6;
  --accent: #0a84ff; --on-accent: #ffffff; --tonal: rgb(10 132 255 / .2); --on-tonal: #9cc9ff;
  --heat: #0a84ff; --heat-busy: #ff453a; --on-heat: #ffffff; --cell: rgb(255 255 255 / .06);
}

/* ---------- base ---------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--bg);
  background-image: var(--bg-image);
  background-attachment: fixed;
  color: var(--ink);
  font: 16px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
main {
  max-width: 600px;
  margin: 0 auto;
  padding: 8px 16px calc(40px + env(safe-area-inset-bottom));
}
a { color: var(--accent); }
h1, h2 { margin: 0; line-height: 1.2; text-wrap: balance; }
p { margin: 0; }
svg { display: block; }

/* Header on every screen: name on the left, theme and palette on the right. Always in place; the
   frosted glass behind it is .glass-top. */
.top {
  position: sticky; top: 0; z-index: 15;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-bottom: 12px;
  padding: max(10px, env(safe-area-inset-top)) 4px 10px;
}
.top-actions { display: flex; gap: 4px; }
.iconbtn {
  position: relative;
  display: grid; place-items: center;
  width: 42px; height: 42px;
  border: 0; border-radius: 999px;
  background: transparent; color: var(--ink);
  cursor: pointer;
}
.iconbtn:hover { background: var(--field); }
.iconbtn:focus-visible { outline: 3px solid var(--accent); outline-offset: 1px; }
.iconbtn svg { width: 22px; height: 22px; grid-area: 1 / 1; transition: transform .45s cubic-bezier(.34, 1.56, .64, 1), opacity .2s; }
:root[data-theme="dark"] .iconbtn .i-sun, :root:not([data-theme="dark"]) .iconbtn .i-moon { opacity: 0; transform: rotate(-120deg) scale(.3); }
.iconbtn.bounce { animation: pop .45s cubic-bezier(.34, 1.56, .64, 1); }
.palmenu { width: 200px; }
.palmenu button {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border: 0; border-radius: 12px;
  background: transparent; color: var(--ink);
  font: inherit; font-weight: 600; font-size: 15px; text-align: left; cursor: pointer;
}
.palmenu button:hover, .palmenu button:focus-visible { background: var(--tonal); color: var(--on-tonal); outline: none; }
.palmenu button[aria-checked="true"]::after { content: ""; margin-left: auto; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.pal-sw { width: 20px; height: 20px; border-radius: 50%; flex: none; box-shadow: inset 0 0 0 2px rgb(255 255 255 / .35); }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 800; font-size: 21px; letter-spacing: -.01em; }
.brand svg { width: 36px; height: 32px; }

.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  box-shadow: var(--card-shadow);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  border-radius: var(--r-card);
  padding: 24px;
  margin-bottom: 16px;
}
.card.center { text-align: center; display: grid; gap: 12px; justify-items: center; }

.display { font-size: clamp(28px, 7vw, 40px); font-weight: var(--display-weight); letter-spacing: -.02em; }
.lead { color: var(--muted); margin-top: 10px; font-size: 17px; }
.loading { text-align: center; color: var(--muted); padding: 48px 0; }

/* ---------- form ---------- */
form { display: grid; gap: 16px; margin-top: 24px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field { display: grid; gap: 6px; font-size: 14px; font-weight: 600; color: var(--muted); }
.field input {
  font: inherit; font-size: 17px; font-weight: 400; color: var(--ink);
  background: var(--field);
  border: 1px solid var(--line);
  border-radius: var(--r-field);
  padding: 0 14px;
  height: 52px;
  width: 100%;
  min-width: 0;
}
.field input:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
.err { color: var(--danger); font-weight: 600; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: var(--btn-h);
  padding: 0 20px;
  border: 0;
  border-radius: 999px;
  font: inherit; font-weight: 600; font-size: 15px;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: filter .12s;
}
.btn:hover { filter: brightness(1.06); }
.btn:active { filter: brightness(.94); }
.btn:focus-visible, .day:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.btn:disabled { opacity: .6; cursor: default; }
.btn.filled { background: var(--accent); color: var(--on-accent); }
.btn.tonal { background: var(--tonal); color: var(--on-tonal); }
.btn.big { height: 60px; font-size: 18px; }
:root[data-ui="material"] .btn.big { border-radius: 20px; }            /* M3 Expressive: bigger, squarer primary */
:root[data-ui="glass"] .btn.big { height: 52px; }
.btn.danger { background: transparent; color: var(--danger); border: 1.5px solid currentColor; }
.btn.danger.armed { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn.sm { height: 36px; padding: 0 14px; font-size: 14px; }

/* ---------- organizer ---------- */
.btn svg { width: 22px; height: 22px; }
.card.gate { display: grid; gap: 14px; text-align: center; justify-items: center; padding: 32px 24px; }
.gate h1 { font-size: clamp(24px, 6vw, 30px); font-weight: var(--display-weight); }
.gate p { color: var(--muted); max-width: 400px; overflow-wrap: anywhere; }
.gate p strong { color: var(--ink); }
.gate .btn { margin-top: 6px; }

.dlg {
  width: min(420px, calc(100vw - 32px));
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  padding: 24px;
  background: var(--bg);
  color: var(--ink);
  box-shadow: 0 20px 60px rgb(0 0 0 / .3);
}
.dlg::backdrop { background: rgb(0 0 0 / .45); }
.dlg h2 { font-size: 20px; margin-bottom: 12px; }
.dlg p { color: var(--muted); margin-bottom: 10px; font-size: 15px; }
.dlg-row { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 18px; }

.orgbar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px;
  padding: 8px 8px 8px 16px;
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  font-size: 14px;
}
.org-label { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; color: var(--muted); }
.org-label svg { width: 18px; height: 18px; }
.org-actions { display: inline-flex; gap: 6px; }

.share { text-align: center; display: grid; gap: 10px; }
.share h2 { font-size: 17px; }
.share-url { color: var(--muted); font-size: 14px; overflow-wrap: anywhere; }
.share-row { display: flex; justify-content: center; gap: 8px; }
.share-row .btn { flex: 1 1 0; max-width: 200px; }

/* ---------- calendar ---------- */
.ask, .cal { text-align: center; }
.cal .months { margin-top: 0; }

/* Phones: one column, calendar right under the question. */
.layout { display: flex; flex-direction: column; }
.side, .maincol { display: contents; }
.orgbar { order: 1; } .share { order: 2; } .ask { order: 3; } .cal { order: 4; } .summary { order: 5; } .plan-new { order: 6; } .maincol > .fine { order: 7; }
.plan-new { width: 100%; margin-bottom: 8px; }

/* Wide screens and landscape: controls on the left, a big calendar on the right. */
@media (min-width: 900px), (orientation: landscape) and (min-width: 700px) {
  main:has(.layout) { max-width: 1200px; }
  .layout { display: grid; grid-template-columns: minmax(300px, 380px) minmax(0, 1fr); gap: 20px; align-items: start; }
  .side { display: flex; flex-direction: column; position: sticky; top: 80px; }
  .maincol { display: block; }
  .side > *, .maincol > * { order: 0; }
  .ask .q .ev { font-size: 24px; }
  .cal { padding: 24px 28px; }
  .cal .months { gap: 28px; max-width: 680px; margin-inline: auto; }
  .cal .grid { gap: 8px; }
}

.q { font-weight: var(--display-weight); }
.ask-q { display: block; font-size: 15px; font-weight: 600; line-height: 1.4; }
.ev { display: block; margin-top: 4px; font-size: clamp(21px, 5.2vw, 26px); color: var(--accent); letter-spacing: -.01em; overflow-wrap: anywhere; }
.word { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; }
.word.free { text-decoration-color: var(--heat); }
.hint { color: var(--muted); margin-top: 12px; font-size: 15px; }


.months { display: grid; gap: 24px; margin-top: 20px; }
.month h2 { font-size: 17px; text-align: center; margin: 0 4px 8px; }
.grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.wd { font-size: 13px; font-weight: 600; color: var(--muted); padding: 4px 0; }

/* Day tiles. Busy: rounded square, big cross, date underneath. Free: circle, big check, date on the curve. */
.day {
  --spring: cubic-bezier(.34, 1.56, .64, 1);
  position: relative;
  display: block;
  aspect-ratio: 1;
  width: 100%;
  padding: 0;
  border: 0;
  border-radius: var(--r-cell);
  background: color-mix(in srgb, var(--tint, var(--heat)) var(--p, 0%), var(--cell));
  color: var(--ink);
  font: inherit;
  cursor: pointer;
  container-type: inline-size;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  user-select: none;
  transition: border-radius .5s var(--spring), background-color .3s;
}
.day.yes { border-radius: 50%; }
.day:disabled { cursor: default; }
.day.out { background: transparent; color: var(--muted); opacity: .45; cursor: default; text-align: center; }
.day.out .n { position: absolute; left: 0; right: 0; bottom: 7%; font-size: max(11px, 21cqi); font-weight: 700; line-height: 1; }
/* Hidden by "I'm busy on weekends": a ghost of a busy tile, so it reads as switched off, not gone. */


.day .ic {
  position: absolute;
  left: 50%; top: 40%;
  width: 46%; height: 46%;
  translate: -50% -50%;
  fill: none; stroke: currentColor; stroke-width: 3.2; stroke-linecap: round; stroke-linejoin: round;
  transition: transform .5s var(--spring), opacity .25s, top .5s var(--spring);
}
.day .ic-x { color: var(--muted); stroke-width: 2.6; }
.day .ic-x { transition-delay: var(--delay, 0ms); }
/* before your first pick: crosses just a whisper (smaller, very faint), so the colours and best-day checks lead */
.months.fresh .day:not(.peak) .ic-x { opacity: .12; transform: scale(.75); }
.day.yes .ic { top: 41%; }

.day[data-d] .n {
  position: absolute; left: 0; right: 0; bottom: 7%;
  font-size: max(11px, 21cqi); font-weight: 700; line-height: 1;
  transition: opacity .2s, transform .4s var(--spring);
}
.day.yes .n { opacity: 0; transform: translateY(30%); }
.arc { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; transform: rotate(-40deg); transition: opacity .25s, transform .5s var(--spring); }
.arc path { fill: none; }
.arc text { font: 700 21px var(--font); letter-spacing: 3px; fill: currentColor; }
.day.yes .arc { opacity: 1; transform: none; }

.day.pop { animation: pop .5s var(--spring); }
/* the first check on a blank calendar lands with a proper pop */
@keyframes first-pop {
  0% { scale: .8; }
  45% { scale: 1.35; }
  100% { scale: 1; }
}
@keyframes pop {
  0% { scale: 1; }
  35% { scale: .82; }
  100% { scale: 1; }
}

/* Hover preview (mouse and trackpad only). The middle mark is the group's and never changes;
   what a click would do to YOUR pick is previewed: the shape, the ring and the star badge. */
@media (hover: hover) and (pointer: fine) {
  /* the tile itself morphs a third of the way towards its next shape */
  .day:not(:disabled):not(.just):hover:not(.yes) { border-radius: calc(var(--r-cell) * .67 + 50% * .33); }
  .day:not(:disabled):not(.just):hover.yes { border-radius: calc(50% * .67 + var(--r-cell) * .33); }
  /* your ring fades in when a click would pick the day, and half-fades when it would unpick it */
  .day:not(:disabled):not(.just):hover:not(.yes) { box-shadow: inset 0 0 0 3px rgb(255 255 255 / .55), 0 0 0 1.5px color-mix(in srgb, var(--heat) 50%, transparent); }
  .day:not(:disabled):not(.just):hover.yes { box-shadow: inset 0 0 0 3px rgb(255 255 255 / .3), 0 0 0 1.5px color-mix(in srgb, var(--heat) 30%, transparent); }
}

/* Days that lean strongly one way get light (or dark, in dark mode) ink. */
.day.lean-free, .day.lean-free .ic-x { color: #fff; }
.day.lean-free .n, .day.lean-free .arc text { text-shadow: 0 1px 2px rgb(0 0 40 / .3); }
.day.lean-free .ic { filter: drop-shadow(0 1px 1.5px rgb(0 0 40 / .3)); }

/* Your own free days: a star, the white ring and the heaviest numbers. */
.day.yes { box-shadow: inset 0 0 0 3px #fff, 0 0 0 1.5px var(--heat); }
.day.yes .n, .day.yes .arc text { font-weight: 900; }
/* Best days you haven't picked: a check instead of a cross, in full ink, also before you've answered. */
.day.peak .ic-x { stroke-width: 3.2; }
.day.peak:not(.lean-free) .ic-x { color: var(--ink); }
/* Crosses stay faint: an unstarred day already means you're busy, the cross only confirms it. */
.day:not(.peak) .ic-x { opacity: .28; }
/* how many can make it, top left (stronger on the best days) */
.day .cnt {
  position: absolute; top: 7%; left: 9%;
  font-size: max(9px, 15cqi); font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums;
  opacity: .5; pointer-events: none;
}
.day.peak .cnt { opacity: .8; }
.day .cnt:empty { display: none; }
.day.yes .cnt { top: 15%; left: 20%; } /* circles: keep it inside the round edge */

/* Your pick, on any day: a star badge on the rim (plus the ring and round shape above). */
.day .badge {
  /* sits on the rim like a notification badge: a white star outlined in the theme colour */
  position: absolute; z-index: 1; top: -13%; right: -13%; width: 42%; height: 42%;
  fill: #fff; stroke: var(--heat); stroke-width: 3.6; stroke-linejoin: round; overflow: visible;
  paint-order: stroke fill; /* outline drawn behind the fill, so the star keeps its full shape */
  opacity: 0; transform: scale(.3) rotate(-60deg);
  transition: opacity .2s, transform .45s var(--spring);
  pointer-events: none;
}
.day.yes .badge { top: -5%; right: -5%; } /* on a circle the rim is further in from the corner */
.day.yes .badge { opacity: 1; transform: none; }
.day .badge { filter: drop-shadow(0 1px 2px rgb(0 0 40 / .25)); }
.day.first .badge { animation: first-pop .6s var(--spring); }
@media (hover: hover) and (pointer: fine) {
  .day:not(.yes):not(:disabled):not(.just):hover .badge { opacity: .75; transform: scale(.9); }
  .day.yes:not(:disabled):not(.just):hover .badge { opacity: .25; transform: scale(.7); }
}
.cal .months .grid .day.off .badge { opacity: 0; }
.day.peak .n { font-weight: 800; }

.tip {
  position: fixed; z-index: 10;
  display: grid; gap: 1px;
  padding: 8px 12px;
  border-radius: 12px;
  background: var(--ink); color: var(--bg);
  font-size: 13px; line-height: 1.3; text-align: center;
  pointer-events: none;
  box-shadow: 0 6px 20px rgb(0 0 0 / .2);
  opacity: 0;
  transform: translateY(6px) scale(.6);
  transform-origin: var(--ax, 50%) 100%;
}
.tip.below { transform-origin: var(--ax, 50%) 0; transform: translateY(-6px) scale(.6); }
.tip.show { opacity: 1; transform: none; transition: transform .35s cubic-bezier(.34, 1.56, .64, 1), opacity .15s; }
.tip strong { font-weight: 700; }

@media (prefers-reduced-motion: reduce) {
  .day, .day .ic, .day .n, .arc, .tip.show { transition: none; }
  .day.pop, .day.first .badge { animation: none; }
  .bigx { transition: none; }
}

.legend { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 16px; margin-top: 18px; font-size: 13px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.sw { display: inline-block; flex: none; width: 14px; height: 14px; border-radius: 5px; background: var(--cell); border: 1px solid var(--line); }
.legend .sw + .sw { margin-left: -3px; }
.sw.lean-busy { opacity: .6; }
.sw.lean-free { background: color-mix(in srgb, var(--heat) 90%, var(--cell)); }
.sw.me-no, .sw.me-yes { display: grid; place-items: center; width: 18px; height: 18px; }
.sw.me-yes { border-radius: 50%; background: color-mix(in srgb, var(--heat) 45%, var(--cell)); box-shadow: inset 0 0 0 2px #fff; border-color: var(--heat); }
.sw.me-best { display: grid; place-items: center; width: 18px; height: 18px; }
.sw svg { width: 12px; height: 12px; }
.sw.me-no svg { color: var(--muted); }
.sw.me-best svg { color: var(--ink); }

.switches { display: grid; justify-items: start; gap: 10px; width: max-content; max-width: 100%; margin: 14px auto 0; text-align: left; }
.switches .switch { margin-top: 0; }
.cal { position: relative; }
.cal .months, .cal .legend { transition: opacity .25s; }
.cal.allbusy .months, .cal.allbusy .legend { opacity: .3; pointer-events: none; }
.bigx {
  position: absolute; left: 50%; top: 45%; z-index: 2;
  width: min(45%, 260px); aspect-ratio: 1;
  translate: -50% -50%;
  color: var(--heat-busy);
  pointer-events: none;
  opacity: 0; transform: scale(.4) rotate(-90deg);
  transition: opacity .2s, transform .5s cubic-bezier(.34, 1.56, .64, 1);
}
.bigx svg { width: 100%; height: 100%; }
.bigx path { stroke-width: 2.4; }
.cal.allbusy .bigx { opacity: 1; transform: none; }
.switch { display: inline-flex; align-items: center; gap: 10px; margin-top: 14px; font-size: 15px; font-weight: 600; cursor: pointer; }
.switch input {
  appearance: none; -webkit-appearance: none; margin: 0; flex: none;
  position: relative; width: 44px; height: 26px;
  border-radius: 999px; border: 2px solid var(--line); background: var(--field);
  cursor: pointer;
}
.switch input::after {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 16px; height: 16px; border-radius: 999px; background: var(--muted);
}
.switch input:checked { background: var(--accent); border-color: var(--accent); }
.switch input:checked::after { left: 21px; background: var(--on-accent); }
.switch input:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.switch input:disabled, .switch input:disabled + span { opacity: .5; cursor: default; }
:root[data-ui="glass"] .switch input { width: 50px; height: 30px; border: 0; background: rgb(120 120 128 / .2); }
:root[data-ui="glass"] .switch input::after { top: 2px; left: 2px; width: 26px; height: 26px; background: #fff; box-shadow: 0 2px 6px rgb(0 0 0 / .2); }
:root[data-ui="glass"] .switch input:checked { background: var(--accent); }
:root[data-ui="glass"] .switch input:checked::after { left: 22px; background: #fff; }

.status { margin-top: 14px; font-size: 14px; font-weight: 600; color: var(--accent); }
.status:empty { display: none; }
.cal .hours { margin-top: 22px; }

.saver {
  position: fixed; z-index: 30;
  right: max(16px, env(safe-area-inset-right)); bottom: max(16px, env(safe-area-inset-bottom));
  display: flex; align-items: center; justify-content: center;
  min-width: 48px; height: 48px; padding: 0 13px; border-radius: 999px;
  background: color-mix(in srgb, var(--muted) 22%, var(--bg));
  font-size: 14px; font-weight: 600; white-space: nowrap;
  color: var(--accent);
  box-shadow: 0 6px 20px rgb(0 0 0 / .18);
  opacity: 0; transform: scale(.5);
  pointer-events: none;
  transition: opacity .2s, transform .35s cubic-bezier(.34, 1.56, .64, 1);
}
.saver.show { opacity: 1; transform: none; }
.saver .txt {
  max-width: 220px; margin-left: 10px; overflow: hidden; color: var(--ink);
  transition: max-width .35s cubic-bezier(.2, 0, 0, 1), margin .35s, opacity .2s;
}
.saver.saved .txt { max-width: 0; margin-left: 0; opacity: 0; }
.saver svg { display: none; }
.saver.saved svg { display: block; }
.saver .spin {
  flex: none; width: 22px; height: 22px; border-radius: 50%;
  border: 3px solid color-mix(in srgb, var(--accent) 25%, transparent); border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}
.saver svg { width: 26px; height: 26px; opacity: 0; transform: scale(.2) rotate(-45deg); transition: opacity .15s, transform .4s cubic-bezier(.34, 1.56, .64, 1); }
.saver path { stroke-width: 3.4; }
.saver.saved .spin { display: none; }
.saver.saved svg { opacity: 1; transform: none; }
.saver.saved { animation: saver-pop .4s cubic-bezier(.34, 1.56, .64, 1); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes saver-pop { 40% { transform: scale(1.15); } }
@media (prefers-reduced-motion: reduce) { .saver, .saver svg { transition: none; } .saver.saved { animation: none; } .saver .spin { animation-duration: 2s; } }
.status.bad { color: var(--danger); }

.summary { text-align: center; display: grid; gap: 8px; }
.stat { font-size: 17px; }
.stat strong { font-weight: 800; font-variant-numeric: tabular-nums; }

/* Big faint step numbers behind each card: 1 question, 2 calendar, 3 best dates. */
.card.step { position: relative; overflow: hidden; isolation: isolate; }
.card.step::before {
  content: attr(data-step);
  position: absolute; z-index: -1; left: 11px; top: 2px; /* the digit's own edges sit 16px in, top and left */
  font-size: 72px; font-weight: 800; line-height: 1; letter-spacing: -.04em;
  color: var(--accent); opacity: .08;
  pointer-events: none;
}
/* where supported, trim the line box to the digit's cap height so the top gap is exact in any font */
.card.step[data-step="1"]::before { left: 14px; } /* a "1" has less side space built into the font */
@supports (text-box: trim-both cap alphabetic) {
  .card.step::before { text-box: trim-both cap alphabetic; top: 16px; }
}
.best { list-style: none; padding: 0; margin: 4px 0 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 40px; padding: 6px 16px 6px 12px;
  border: 0; border-radius: 999px;
  background: var(--tonal); color: var(--on-tonal);
  font: inherit; font-weight: 600; font-size: 14px; line-height: 1.2; text-align: left;
  cursor: pointer;
}
/* best-date pills: the same colour as their day on the calendar */
.chip[data-cal] { background: color-mix(in srgb, var(--tint, var(--heat)) var(--p, 0%), var(--cell)); color: var(--ink); }
.chip[data-cal].lean-free { color: #fff; }
.chip[data-cal].lean-free span { text-shadow: 0 1px 2px rgb(0 0 40 / .3); }
.chip[data-cal].mine { box-shadow: inset 0 0 0 3px #fff, 0 0 0 1.5px var(--heat); padding-block: 8px; }
.chip[data-cal].mine span { font-weight: 800; }
.chip:hover { filter: brightness(1.05); }
.chip:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.chip svg { width: 20px; height: 20px; flex: none; }
.chip span { display: grid; }
.chip small { font-size: 12px; font-weight: 500; opacity: .85; }
.best li:not(:has(.chip)) { align-self: center; color: var(--muted); font-size: 14px; }

.calmenu {
  position: fixed; z-index: 20;
  display: grid; width: min(300px, calc(100vw - 16px));
  padding: 8px;
  border: 1px solid var(--line); border-radius: 20px;
  background: var(--bg); color: var(--ink);
  box-shadow: 0 12px 40px rgb(0 0 0 / .22);
}
.calmenu-h { padding: 8px 10px 10px; font-size: 13px; color: var(--muted); }
.calmenu a {
  padding: 11px 12px; border-radius: 12px;
  color: var(--ink); text-decoration: none; font-weight: 600; font-size: 15px;
}
.calmenu a:hover, .calmenu a:focus-visible { background: var(--tonal); color: var(--on-tonal); outline: none; }

.hours { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; margin: 16px 0 0; padding: 0; border: 0; min-width: 0; }
.hours legend { width: 100%; padding: 0; margin-bottom: 8px; font-size: 14px; font-weight: 600; color: var(--muted); text-align: center; float: left; }
.hours:disabled { opacity: .45; }
.tand { color: var(--muted); font-size: 14px; }

/* A time shown as a pill button. On touch a transparent native time input sits on top of it. */
.tpill {
  position: relative;
  display: inline-flex; align-items: center; gap: 8px;
  height: 44px; padding: 0 16px 0 12px;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--field); color: var(--ink);
  font: inherit; font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums;
  cursor: pointer;
}
.tpill svg { width: 20px; height: 20px; color: var(--accent); flex: none; }
.tpill:hover { border-color: var(--accent); }
.tpill:focus-within, .tpill:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.tpill input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; border: 0; padding: 0; cursor: pointer; }
.tpill.wide { padding: 0 20px 0 14px; }
.tclear {
  display: grid; place-items: center; width: 36px; height: 36px;
  border: 0; border-radius: 999px; background: transparent; color: var(--muted); cursor: pointer;
}
.tclear[hidden] { display: none; }
.tclear svg { width: 18px; height: 18px; }
.tclear:hover { background: var(--field); color: var(--ink); }

/* Desktop picker: two scrolling columns, Material surface or a glass sheet. */
.tpop {
  position: fixed; z-index: 20;
  width: 300px; padding: 12px;
  border: 1px solid var(--line); border-radius: var(--r-card);
  background: var(--bg); color: var(--ink);
  box-shadow: 0 16px 48px rgb(0 0 0 / .22);
}
:root[data-ui="glass"] .tpop { background: var(--card); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); border-color: var(--card-border); }
.tcols { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tcol p { margin: 4px 0 8px; font-size: 13px; font-weight: 700; color: var(--muted); text-align: center; }
.tlist {
  display: grid; gap: 2px;
  height: 248px; overflow-y: auto; overscroll-behavior: contain;
  padding: 2px; border-radius: var(--r-field); background: var(--field);
  /* no system scrollbar: the list fades out at its edges instead, like a picker wheel */
  scrollbar-width: none;
  -webkit-mask-image: linear-gradient(transparent, #000 28px, #000 calc(100% - 28px), transparent);
  mask-image: linear-gradient(transparent, #000 28px, #000 calc(100% - 28px), transparent);
}
.tlist::-webkit-scrollbar { display: none; }
.tlist button {
  height: 40px; border: 0; border-radius: 12px;
  background: transparent; color: var(--ink);
  font: inherit; font-size: 15px; font-variant-numeric: tabular-nums; cursor: pointer;
}
.tlist button:hover:not(:disabled) { background: var(--tonal); color: var(--on-tonal); }
.tlist button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.tlist button.on { background: var(--accent); color: var(--on-accent); font-weight: 700; }
.tlist button:disabled { opacity: .3; cursor: default; }
:root[data-ui="material"] .tlist button.on { border-radius: 20px; }
.tfoot { display: flex; justify-content: flex-end; align-items: center; gap: 8px; margin-top: 12px; }
.seg { display: flex; margin-right: auto; padding: 3px; border-radius: 999px; background: var(--field); }
.seg button {
  height: 30px; padding: 0 12px; border: 0; border-radius: 999px;
  background: transparent; color: var(--muted);
  font: inherit; font-size: 13px; font-weight: 700; cursor: pointer;
  transition: background-color .2s, color .2s;
}
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }
.seg button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.fine { color: var(--muted); font-size: 13px; text-align: center; max-width: 480px; margin: 8px auto 0; }

@media (max-width: 420px) {
  .card { padding: 18px; }
  .card.cal { padding: 18px 10px; }
  .grid { gap: 3px; }
  .row { grid-template-columns: 1fr; }
}

/* Hidden by "I'm busy on weekends": a ghost of a busy tile, so it reads as switched off, not gone.
   Kept last and specific so it wins over the heat, best-day and not-answered-yet styles. */
.cal .months .grid .day.off { background: #4a4f5a; color: #fff; box-shadow: none; border-radius: var(--r-cell); opacity: .22; }
.cal .months .grid .day.off .ic-x { color: #e2e5ea; opacity: 1; transform: none; }
.cal .months .grid .day.off .arc { opacity: 0; }
.cal .months .grid .day.off .n { opacity: 1; transform: none; }

/* ---------- colour themes (palette menu). Blue is the default above.
   Free days use the theme colour, busy days its complement. ---------- */
:root[data-palette="teal"][data-palette] {
  --accent: #00696e; --on-accent: #fff; --tonal: #c8ebec; --on-tonal: #00393c; --heat: #0a8f96; --heat-busy: #e4573f;
}
:root[data-palette="green"][data-palette] {
  --accent: #1e6b35; --on-accent: #fff; --tonal: #cdeccf; --on-tonal: #0a2a12; --heat: #23964a; --heat-busy: #c2418e;
}
:root[data-palette="orange"][data-palette] {
  --accent: #9a4a00; --on-accent: #fff; --tonal: #ffdcc4; --on-tonal: #331200; --heat: #e8710a; --heat-busy: #2f6fd6;
}
:root[data-palette="teal"][data-theme="dark"] {
  --accent: #4fd8de; --on-accent: #00373a; --tonal: #1f4d50; --on-tonal: #c8ebec; --heat: #2bb3b9; --heat-busy: #ff7a62;
}
:root[data-palette="green"][data-theme="dark"] {
  --accent: #7fdc95; --on-accent: #003914; --tonal: #234a2c; --on-tonal: #cdeccf; --heat: #3fb565; --heat-busy: #e86bb5;
}
:root[data-palette="orange"][data-theme="dark"] {
  --accent: #ffb77a; --on-accent: #4f2500; --tonal: #5a3517; --on-tonal: #ffdcc4; --heat: #f08a2c; --heat-busy: #6fa0ff;
}

/* ---------- springy hover (mouse and trackpad) ----------
   Things only ever grow on hover, never shrink or shift away, so the hit area always still
   contains the pointer and an edge can't flicker. Pressing squeezes (only while held). */
.btn, .chip, .tpill, .iconbtn, .tclear, .switch input, .switch input::after {
  transition: transform .45s cubic-bezier(.34, 1.56, .64, 1), background-color .2s, border-color .2s,
              color .2s, filter .2s, box-shadow .2s, left .4s cubic-bezier(.34, 1.56, .64, 1), width .3s cubic-bezier(.34, 1.56, .64, 1);
}
@media (hover: hover) and (pointer: fine) {
  .btn:not(:disabled):hover, .chip:hover, .tpill:hover { transform: scale(1.04); }
  .iconbtn:hover, .tclear:hover { transform: scale(1.1); }
  .iconbtn:hover svg { transform: rotate(-12deg); }
  :root[data-theme="dark"] .iconbtn:hover .i-moon, :root:not([data-theme="dark"]) .iconbtn:hover .i-sun { transform: rotate(-12deg); }
  .btn:not(:disabled):active, .chip:active, .tpill:active, .iconbtn:active, .tclear:active { transform: scale(.96); transition-duration: .1s; }
  /* switches: the track swells a little and the knob leans towards the other side */
  .switch:hover input:not(:disabled) { transform: scale(1.08); border-color: var(--accent); }
  .switch:hover input:not(:disabled):not(:checked)::after { width: 20px; background: var(--accent); }
  .switch:hover input:not(:disabled):checked::after { width: 20px; left: 17px; }
}
@media (prefers-reduced-motion: reduce) {
  .btn, .chip, .tpill, .iconbtn, .tclear, .switch input, .switch input::after { transition-duration: .01s; }
  .btn:hover, .chip:hover, .tpill:hover, .iconbtn:hover, .tclear:hover, .switch:hover input { transform: none !important; }
}

/* ---------- frosted glass edges: blurrier and darker toward the window edge ---------- */
:root { --bar: 50px; --glass-h: calc(64px + env(safe-area-inset-top)); --glass-tint: #eeeeee; --glass-tint: oklch(from var(--bg) calc(l - .03) 0 0); }
/* neutral grey, never the theme's hue */
:root[data-theme="dark"] { --glass-tint: #0e0e0e; --glass-tint: oklch(from var(--bg) calc(l - .06) 0 0); }
.glass { position: fixed; left: 0; right: 0; z-index: 14; pointer-events: none; transition: opacity .3s; }
.glass > i { position: absolute; inset: 0; }
.glass-top { top: 0; height: var(--glass-h); background: linear-gradient(color-mix(in srgb, var(--glass-tint) 72%, transparent), transparent); }
.glass-top > i:nth-child(1) { --b: 1.5px; --from: 0%; }
.glass-top > i:nth-child(2) { --b: 4px; --from: 30%; }
.glass-top > i:nth-child(3) { --b: 8px; --from: 55%; }
.glass-top > i:nth-child(4) { --b: 14px; --from: 78%; }
.glass-top > i {
  -webkit-backdrop-filter: blur(var(--b)); backdrop-filter: blur(var(--b));
  -webkit-mask-image: linear-gradient(to top, transparent var(--from), #000 calc(var(--from) + 22%));
  mask-image: linear-gradient(to top, transparent var(--from), #000 calc(var(--from) + 22%));
}
.glass-bottom { bottom: 0; height: 64px; /* the top one mirrors this */ background: linear-gradient(transparent, color-mix(in srgb, var(--glass-tint) 72%, transparent)); }
.glass-bottom > i:nth-child(1) { --b: 1.5px; --from: 0%; }
.glass-bottom > i:nth-child(2) { --b: 4px; --from: 30%; }
.glass-bottom > i:nth-child(3) { --b: 8px; --from: 55%; }
.glass-bottom > i:nth-child(4) { --b: 14px; --from: 78%; }
.glass-bottom > i {
  -webkit-backdrop-filter: blur(var(--b)); backdrop-filter: blur(var(--b));
  -webkit-mask-image: linear-gradient(transparent var(--from), #000 calc(var(--from) + 22%));
  mask-image: linear-gradient(transparent var(--from), #000 calc(var(--from) + 22%));
}
.side { will-change: transform; }

/* today: a dashed ring, as thick as the "most people free" ring */
.cal .months .grid .day.today { outline: 3px dashed color-mix(in srgb, var(--ink) 55%, transparent); outline-offset: -3px; }
/* today is also the best day: the best-day ring itself turns dashed, in its own colour */
.cal .months .grid .day.today.yes { box-shadow: 0 0 0 1.5px var(--heat); outline-color: #fff; }
.cal .months .grid .day.today.off { opacity: .35; }

/* ---------- spotlight: a best date pointed at in the panel ---------- */
.months .day { transition: border-radius .5s var(--spring), background-color .3s, opacity .25s, transform .4s var(--spring), box-shadow .25s; }
.months.spotting .day[data-d]:not(.spot) { opacity: .3; }
.cal .months .grid .day.spot { position: relative; z-index: 2; transform: scale(1.12); outline: 3px solid var(--accent); outline-offset: 3px; }
.chip[data-cal] { -webkit-touch-callout: none; user-select: none; }
@media (prefers-reduced-motion: reduce) { .cal .months .grid .day.spot { transform: none; } }

/* ---------- date fields on the create page: our own themed icon instead of the browser's ---------- */
.datewrap { position: relative; display: block; }
.datewrap svg {
  position: absolute; right: 14px; top: 50%; translate: 0 -50%;
  width: 22px; height: 22px; color: var(--accent); pointer-events: none;
}
.datewrap input {
  padding-right: 48px; cursor: pointer;
  /* phones draw a dropdown arrow on date fields (and iOS centres the date): drop both */
  -webkit-appearance: none; appearance: none;
  text-align: left;
}
.datewrap input::-webkit-date-and-time-value { text-align: left; margin: 0; }
/* the browser's own icon stays clickable but invisible, stretched under ours */
.datewrap input::-webkit-calendar-picker-indicator {
  position: absolute; right: 0; top: 0; width: 52px; height: 100%; margin: 0; padding: 0;
  opacity: 0; cursor: pointer;
}
/* Firefox draws its own icon that can't be hidden, so keep ours out of the way there */
@supports (-moz-appearance: none) { .datewrap svg { display: none; } .datewrap input { padding-right: 14px; } }

/* busier days fade a little (see paintHeat) */
.day[data-d] { opacity: var(--o, 1); }

/* best-date pills: the same star badge on the rim when it's one of your days */
.chip[data-cal] { position: relative; }
.chip .badge {
  position: absolute; top: -9px; right: -6px; width: 22px; height: 22px;
  fill: #fff; stroke: var(--heat); stroke-width: 3.6; stroke-linejoin: round; paint-order: stroke fill; overflow: visible;
  filter: drop-shadow(0 1px 2px rgb(0 0 40 / .25));
  opacity: 0; transform: scale(.3) rotate(-60deg); transition: opacity .2s, transform .45s cubic-bezier(.34, 1.56, .64, 1);
  pointer-events: none;
}
.chip.mine .badge { opacity: 1; transform: none; }

/* ---------- hover: everything moves a third of the way to where a click would put it ---------- */
.day .cnt { transition: top .45s var(--spring), left .45s var(--spring), opacity .2s; }
.day .badge { transition: opacity .2s, transform .45s var(--spring), top .45s var(--spring), right .45s var(--spring); }
@media (hover: hover) and (pointer: fine) {
  /* the group's mark just reacts (a small lift), it doesn't change */
  .cal .months .grid .day:not(:disabled):not(.just):hover .ic-x { transform: scale(1.12); }
  .cal .months .grid .day:not(:disabled):not(.just):hover:not(.yes) .ic { top: 40.3%; }
  .cal .months .grid .day:not(:disabled):not(.just):hover.yes .ic { top: 40.7%; }
  /* square -> circle: count, badge and date move a third of the way (the date never shows twice) */
  .cal .months .grid .day:not(:disabled):not(.just):hover:not(.yes) .cnt { top: 9.6%; left: 12.6%; }
  .cal .months .grid .day:not(:disabled):not(.just):hover:not(.yes) .badge { top: -10.4%; right: -10.4%; }
  .cal .months .grid .day:not(:disabled):not(.just):hover:not(.yes) .n { transform: translateY(10%); }
  /* circle -> square */
  .cal .months .grid .day:not(:disabled):not(.just):hover.yes .cnt { top: 12.4%; left: 16.4%; }
  .cal .months .grid .day:not(:disabled):not(.just):hover.yes .badge { top: -7.6%; right: -7.6%; }
  .cal .months .grid .day:not(:disabled):not(.just):hover.yes .arc { transform: translateY(4%) scale(.97); }
}

/* an even split: a dash at half strength, between the faint cross and the full check */
.day.split .ic-x { opacity: .5; stroke-width: 3.2; }
.months.fresh .day.split .ic-x { opacity: .35; }

/* ---------- group mark preview: what your click would make it ---------- */
.day .ic-n { color: var(--ink); opacity: 0; transform: rotate(90deg) scale(.6); }
.day.lean-free .ic-n { color: #fff; }
@media (hover: hover) and (pointer: fine) {
  /* in place: the current mark spins and fades out while the new one spins and fades in, at the
     strength the current one shows (set from script), slightly lifted like any hovered mark */
  .cal .months .grid .day.will:not(:disabled):not(.just):hover .ic-x { opacity: 0; transform: rotate(-90deg) scale(.6); }
  .cal .months .grid .day.will:not(:disabled):not(.just):hover .ic-n { opacity: var(--io, .75); transform: scale(1.12); }
}

/* ---------- a soft glow when a day changes (your click or live data) ---------- */
.day[data-d]::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
}
.day.pulse::after { animation: day-pulse 1s ease-out; }
@keyframes day-pulse {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--heat) 55%, transparent); }
  100% { box-shadow: 0 0 0 12px color-mix(in srgb, var(--heat) 0%, transparent); }
}
@media (prefers-reduced-motion: reduce) { .day.pulse::after { animation: none; } }

/* the people count: a small pill with a person icon, so it can't be mistaken for the date,
   kept a few pixels in from the edges even on small phone tiles */
.cal .months .grid .day .cnt {
  top: max(4px, 7%); left: max(4px, 8%);
  display: inline-flex; align-items: center; gap: 1px;
  padding: 1px 4px 1px 2px; border-radius: 999px;
  background: color-mix(in srgb, currentColor 10%, transparent);
  font-size: max(9px, 13cqi); font-weight: 700; opacity: .7;
}
.cal .months .grid .day .cnt svg { width: 1.05em; height: 1.05em; fill: currentColor; flex: none; }
.cal .months .grid .day.peak .cnt { opacity: .9; }
.cal .months .grid .day.yes .cnt { top: 15%; left: 17%; }
@media (hover: hover) and (pointer: fine) {
  .cal .months .grid .day:not(:disabled):not(.just):hover:not(.yes) .cnt { top: max(5px, 9.6%); left: max(5px, 11%); }
  .cal .months .grid .day:not(:disabled):not(.just):hover.yes .cnt { top: 12.4%; left: 14%; }
}
.cal .months .grid .day .cnt:empty { display: none; }
/* small tiles (phones): give the count its own row by making the middle mark a bit smaller and lower */
@container (max-width: 64px) {
  .cal .months .grid .day .ic { width: 36%; height: 36%; top: 52%; }
  .cal .months .grid .day.yes .ic { top: 50%; }
  .cal .months .grid .day .cnt { font-size: 9px; padding: 0 3px 0 1px; }
}

/* ---------- count and badge: fixed anchor, moved only with transform (sub-pixel smooth) ----------
   Offsets are in cqi (1% of the tile's width), so they match the old percentages exactly. */
.cal .months .grid .day .cnt {
  top: max(4px, 7%); left: max(4px, 8%);
  background: none; padding: 0; gap: 2px;
  opacity: .55;
  transform: translate(0, 0);
  transition: transform .45s var(--spring), opacity .2s;
  will-change: transform;
}
.cal .months .grid .day.peak .cnt { opacity: .75; }
.cal .months .grid .day.yes .cnt { top: max(4px, 7%); left: max(4px, 8%); transform: translate(9cqi, 8cqi); }
.cal .months .grid .day .badge {
  top: -13%; right: -13%;
  transition: opacity .2s, transform .45s var(--spring);
  will-change: transform;
}
.cal .months .grid .day:not(.yes) .badge { transform: scale(.3) rotate(-60deg); }
.cal .months .grid .day.yes .badge { top: -13%; right: -13%; transform: translate(-8cqi, 8cqi); }
@media (hover: hover) and (pointer: fine) {
  .cal .months .grid .day:not(:disabled):not(.just):hover:not(.yes) .cnt { top: max(4px, 7%); left: max(4px, 8%); transform: translate(3cqi, 2.7cqi); }
  .cal .months .grid .day:not(:disabled):not(.just):hover.yes .cnt { top: max(4px, 7%); left: max(4px, 8%); transform: translate(6cqi, 5.3cqi); }
  .cal .months .grid .day:not(:disabled):not(.just):hover:not(.yes) .badge { top: -13%; right: -13%; transform: translate(-2.7cqi, 2.7cqi) scale(.9); }
  .cal .months .grid .day:not(:disabled):not(.just):hover.yes .badge { top: -13%; right: -13%; transform: translate(-5.3cqi, 5.3cqi) scale(.7); }
}
@container (max-width: 64px) {
  .cal .months .grid .day .cnt { padding: 0; }
}

/* ---------- emoji (Fluent Emoji Flat, in their own colours) ---------- */
.emo {
  display: inline-block; width: 1em; height: 1em; flex: none;
  background: var(--m, none) center / contain no-repeat;
}
.namerow { display: grid; grid-template-columns: 52px 1fr; gap: 8px; }
.emobtn {
  display: grid; place-items: center; height: 52px; padding: 0;
  border: 1px solid var(--line); border-radius: var(--r-field);
  background: var(--field); cursor: pointer; font-size: 26px;
}
.emobtn:hover { border-color: var(--accent); }
.emobtn:focus-visible { outline: 2px solid var(--accent); outline-offset: -1px; }
.emobtn.pop .emo { animation: first-pop .5s cubic-bezier(.34, 1.56, .64, 1); }
.field > label { font-size: 14px; font-weight: 600; color: var(--muted); }
.emopop {
  position: absolute; z-index: 40; width: min(340px, calc(100vw - 16px));
  padding: 10px; border-radius: 20px;
  background: var(--card); border: 1px solid var(--line); box-shadow: 0 12px 40px rgb(0 0 0 / .18);
}
:root[data-ui="glass"] .emopop { -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); border-color: var(--card-border); }
.emohead { display: flex; gap: 8px; margin-bottom: 8px; }
.emohead input {
  flex: 1; min-width: 0; height: 40px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--field); color: var(--ink); font: inherit; font-size: 15px;
}
.emohead input:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
.emohead [hidden] { display: none; }
.emogrid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); gap: 2px;
  max-height: 260px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: none;
  -webkit-mask-image: linear-gradient(transparent, #000 12px, #000 calc(100% - 20px), transparent);
  mask-image: linear-gradient(transparent, #000 12px, #000 calc(100% - 20px), transparent);
  padding: 6px 0;
}
.emogrid::-webkit-scrollbar { display: none; }
.emogrid button {
  display: grid; place-items: center; height: 40px; border: 0; border-radius: 10px;
  background: transparent; cursor: pointer; font-size: 24px;
}
.emogrid button:hover, .emogrid button:focus-visible { background: var(--tonal); outline: none; }
.emogrid button[aria-selected="true"] { background: var(--tonal); box-shadow: inset 0 0 0 2px var(--accent); }
.emonone { grid-column: 1 / -1; text-align: center; color: var(--muted); font-size: 14px; }
.ev .emo { width: 1.05em; height: 1.05em; margin-right: .3em; vertical-align: -.15em; }

/* ---------- card 3 for organizers: invite and delete above the numbers ---------- */
.summary-body { display: grid; gap: 8px; }
.orgctl { display: grid; gap: 10px; padding-bottom: 18px; margin-bottom: 10px; border-bottom: 1px solid var(--line); }
.orgctl .share-row .btn { max-width: none; }
.del-cal { width: 100%; margin-top: 10px; }
@media (max-width: 899px) and (not ((orientation: landscape) and (min-width: 700px))) { .del-cal { order: 6; } }
.orgctl h2 { margin: 0; font-size: 18px; }
.orgctl .share-url { margin: -4px 0 4px; color: var(--muted); font-size: 14px; overflow-wrap: anywhere; }

/* "I'm busy on weekends": the day looks like any other busy day (the group's mark and count stay),
   and its date number fades to match the mark in the middle. */
.cal .months .grid .day.wkoff .n { color: var(--muted); opacity: .28; }
.cal .months .grid .day.wkoff.lean-free .n { color: #fff; }
.cal .months .grid .day.wkoff.peak .n { opacity: .6; }
.cal .months .grid .day.wkoff .arc, .cal .months .grid .day.wkoff .badge { opacity: 0; }

/* the glass edges are always there: the page leaves room for them at the top and bottom */
.top { padding-top: max(4px, env(safe-area-inset-top)); padding-bottom: 4px; margin-bottom: max(8px, calc(var(--glass-h) - var(--bar))); }
main { padding-bottom: calc(72px + env(safe-area-inset-bottom)); }
@media (min-width: 900px), (orientation: landscape) and (min-width: 700px) {
  .side { top: var(--glass-h); }
}

/* weekends: the same tiles with a slightly shifted hue */
:root { --we-hue: #7a5cff; }
.cal .months .grid .day.we:not(.off) {
  background: color-mix(in srgb, var(--tint, var(--heat)) var(--p, 0%), color-mix(in srgb, var(--cell) 90%, var(--we-hue)));
}

/* "busy on weekends" days refuse a hover with a tiny shake */
@media (hover: hover) and (pointer: fine) {
  .cal .months .grid .day.wkoff { cursor: not-allowed; }
  .cal .months .grid .day.wkoff:hover { animation: nope .32s ease-out; }
}
@keyframes nope {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-2.5px); }
  45% { transform: translateX(2px); }
  70% { transform: translateX(-1px); }
}
@media (prefers-reduced-motion: reduce) { .cal .months .grid .day.wkoff:hover { animation: none; } }

/* the people count sits top middle on every day: clear of both the square and the round shape */
.cal .months .grid .day .cnt,
.cal .months .grid .day.yes .cnt,
.cal .months .grid .day:not(:disabled):not(.just):hover:not(.yes) .cnt,
.cal .months .grid .day:not(:disabled):not(.just):hover.yes .cnt {
  top: max(4px, 7%); left: 0; right: 0; justify-content: center; transform: none;
}

/* the main mark sits in the true centre of the tile, a touch smaller so it clears the count and date */
.cal .months .grid .day .ic,
.cal .months .grid .day.yes .ic,
.cal .months .grid .day:not(:disabled):not(.just):hover:not(.yes) .ic,
.cal .months .grid .day:not(:disabled):not(.just):hover.yes .ic { top: 50%; width: 40%; height: 40%; }
@container (max-width: 64px) {
  .cal .months .grid .day .ic, .cal .months .grid .day.yes .ic { width: 34%; height: 34%; }
}

/* ---------- day layout: the mark in the centre, the date straight along the bottom ----------
   The people count is hidden for now (kept in place, top middle, to bring back by removing display: none). */
.cal .months .grid .day .arc { display: none; }
.cal .months .grid .day .cnt { display: none; }
.cal .months .grid .day .n,
.cal .months .grid .day.yes .n,
.cal .months .grid .day:not(:disabled):not(.just):hover:not(.yes) .n {
  top: auto; bottom: 7%; transform: none;
  transition: opacity .2s, translate .45s var(--spring);
}
.cal .months .grid .day .n { translate: 0 -3cqi; } /* same height in squares and circles */
.cal .months .grid .day.yes .n { opacity: 1; translate: 0 -3cqi; }
@media (hover: hover) and (pointer: fine) {
  /* hover moves the date a third of the way to where the click would put it */
  .cal .months .grid .day:not(:disabled):not(.just):hover .n { translate: 0 -5.5cqi; }
}
@media (prefers-reduced-motion: reduce) { .cal .months .grid .day .n { transition: none; } }

/* days outside the range refuse a hover the same way as "busy on weekends" days */
@media (hover: hover) and (pointer: fine) {
  .cal .months .grid .day.out { cursor: not-allowed; }
  .cal .months .grid .day.out:hover { animation: nope .32s ease-out; }
}
@media (prefers-reduced-motion: reduce) { .cal .months .grid .day.out:hover { animation: none; } }
