/* Daily — modern monochrome minimalism. Fredoka, Apple-radius cards, soft springs. */

:root {
  --paper: #f5f5f5;
  --card: #ffffff;
  --ink: #121212;
  --ink-soft: #7d7d7d;
  --ink-faint: #c9c9c9;
  --line: #ececec;
  --shadow: 0 1px 2px rgb(0 0 0 / .03), 0 12px 32px -12px rgb(0 0 0 / .10);
  --r: 28px;
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --ease-spring: cubic-bezier(.34, 1.56, .64, 1);
  color-scheme: light;
}

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

* { margin: 0; padding: 0; box-sizing: border-box; }

[hidden] { display: none !important; }

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

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

::selection { background: var(--ink); color: var(--paper); }

button { font-family: inherit; }
input, textarea { font-family: inherit; }

/* ---------- gate ---------- */

.gate {
  position: fixed; inset: 0;
  display: grid; place-items: center;
  background: var(--paper);
  z-index: 10;
}
.gate-inner { text-align: center; animation: rise .8s var(--ease-out) both; }
.gate-mark {
  width: 46px; height: 46px;
  margin: 0 auto 1.5rem;
  transform: rotate(-90deg);
  animation: ringGlow 5.2s ease-in-out infinite;
}
.gate-ring-track {
  fill: none;
  stroke: color-mix(in srgb, var(--ink) 10%, transparent);
  stroke-width: 5;
}
.gate-ring-fill {
  fill: none;
  stroke: var(--ink);
  stroke-width: 5;
  stroke-linecap: round;
  stroke-dasharray: 125.66;
  stroke-dashoffset: 125.66;
  animation: ringFill 5.2s cubic-bezier(.45, 0, .25, 1) infinite;
}
@keyframes ringFill {
  0%   { stroke-dashoffset: 125.66; }
  45%  { stroke-dashoffset: 0; }
  100% { stroke-dashoffset: 0; }
}
@keyframes ringGlow {
  0%, 45% {
    opacity: 1;
    filter: drop-shadow(0 0 4px color-mix(in srgb, var(--ink) 18%, transparent));
  }
  72% {
    opacity: 1;
    filter: drop-shadow(0 0 10px color-mix(in srgb, var(--ink) 50%, transparent))
            drop-shadow(0 0 30px color-mix(in srgb, var(--ink) 24%, transparent));
  }
  88% {
    opacity: 1;
    filter: drop-shadow(0 0 8px color-mix(in srgb, var(--ink) 38%, transparent))
            drop-shadow(0 0 22px color-mix(in srgb, var(--ink) 18%, transparent));
  }
  100% {
    opacity: 0;
    filter: drop-shadow(0 0 5px color-mix(in srgb, var(--ink) 20%, transparent));
  }
}
.gate-word {
  font-size: 1.9rem;
  font-weight: 500;
  letter-spacing: -.01em;
}
.gate-sub {
  font-size: .9rem;
  font-weight: 300;
  color: var(--ink-soft);
  margin: .2rem 0 2.2rem;
}
.gate-form {
  display: flex; align-items: center; gap: .4rem;
  width: 300px;
  margin: 0 auto;
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: 999px;
  padding: .35rem .35rem .35rem 1.5rem;
  box-shadow: var(--shadow);
  transition: border-color .3s, transform .3s var(--ease-spring);
}
.gate-form:focus-within { border-color: var(--ink); transform: scale(1.02); }
.gate-go {
  flex: 0 0 auto;
  width: 42px; height: 42px;
  border: none; border-radius: 50%;
  background: var(--ink); color: var(--paper);
  font-size: 1.05rem;
  cursor: pointer;
  display: grid; place-items: center;
  opacity: .3;
  transition: transform .35s var(--ease-spring), opacity .3s;
}
.gate-form:focus-within .gate-go { opacity: 1; }
.gate-go:hover { transform: scale(1.06); }
.gate-go:active { transform: scale(.92); }
#gate-input {
  flex: 1;
  min-width: 0;
  font-size: 1rem;
  background: none;
  border: none;
  color: var(--ink);
  padding: .5rem 0;
  text-align: left;
  outline: none;
  letter-spacing: .25em;
}
#gate-input::placeholder { letter-spacing: .05em; color: var(--ink-faint); font-weight: 300; }
.gate-error {
  font-size: .8rem;
  color: var(--ink-soft);
  margin-top: 1rem;
  min-height: 1em;
}
.gate.shake .gate-inner { animation: shake .4s; }

/* ---------- onboarding ---------- */

.onboard {
  position: fixed; inset: 0;
  display: grid; place-items: center;
  background: var(--paper);
  z-index: 9;
  padding: 2rem 1.6rem;
}
.onboard-steps { width: min(400px, 100%); }
.ob-step { animation: rise .6s var(--ease-out) both; }
.ob-step .gate-mark { margin: 0 0 1.6rem; }
.ob-title {
  font-size: clamp(2.1rem, 8vw, 2.7rem);
  font-weight: 500;
  letter-spacing: -.02em;
  line-height: 1.12;
  margin-bottom: .9rem;
}
.ob-text {
  font-size: .98rem;
  font-weight: 300;
  color: var(--ink-soft);
  line-height: 1.65;
  margin-bottom: 1.6rem;
  max-width: 34ch;
}
.ob-text strong { color: var(--ink); font-weight: 500; }
.ob-quiet { margin-top: -0.8rem; }
.ob-label {
  display: block;
  font-size: .78rem;
  font-weight: 500;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: .6rem;
}
.ob-input {
  width: 100%;
  font-size: 1.05rem;
  font-weight: 400;
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: 18px;
  color: var(--ink);
  padding: .85rem 1.15rem;
  outline: none;
  box-shadow: var(--shadow);
  transition: border-color .3s;
}
.ob-input:focus { border-color: var(--ink); }
.ob-input::placeholder { color: var(--ink-faint); font-weight: 300; }
.ob-next {
  display: block;
  width: 100%;
  margin-top: 1.4rem;
  border: none;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  font-size: 1rem;
  font-weight: 500;
  padding: .95rem 1.4rem;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform .35s var(--ease-spring), opacity .3s;
}
.ob-next:hover { transform: translateY(-2px); }
.ob-next:active { transform: scale(.97); }
.ob-rituals { list-style: none; margin-bottom: .8rem; }
.ob-rituals li {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--card);
  border-radius: 14px;
  padding: .6rem 1rem;
  margin-bottom: .45rem;
  font-size: .98rem;
  box-shadow: var(--shadow);
  animation: itemIn .4s var(--ease-out) both;
}
.ob-rituals .ob-x {
  background: none; border: none; color: var(--ink-faint);
  font-size: .95rem; cursor: pointer; padding: 0 .2rem;
}
.ob-ritual-form { display: flex; gap: .5rem; align-items: center; }
.ob-add {
  flex: 0 0 auto;
  width: 46px; height: 46px;
  border: none; border-radius: 50%;
  background: var(--ink); color: var(--paper);
  font-size: 1.25rem; cursor: pointer;
  transition: transform .35s var(--ease-spring);
}
.ob-add:active { transform: scale(.9); }
.ob-dots {
  position: absolute;
  bottom: max(2.2rem, env(safe-area-inset-bottom, 0px) + 1.4rem);
  left: 50%; transform: translateX(-50%);
  display: flex; gap: .5rem;
}
.ob-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--ink-faint);
  transition: background .3s, transform .35s var(--ease-spring);
}
.ob-dot.on { background: var(--ink); transform: scale(1.3); }
.ob-step.leaving { animation: swapOut .22s var(--ease-out) both; }

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

.app {
  max-width: 480px;
  margin: 0 auto;
  padding: clamp(1.4rem, 4vw, 2.6rem) 1.2rem 3.5rem;
}

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

.masthead { animation: rise .7s var(--ease-out) both; padding: 0 .4rem; }

.masthead-top {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 1rem;
}
.greeting {
  font-size: .88rem;
  font-weight: 300;
  color: var(--ink-soft);
}
.date-title {
  font-size: clamp(1.9rem, 6vw, 2.3rem);
  font-weight: 500;
  letter-spacing: -.02em;
  line-height: 1.15;
}
.date-title .past-tag {
  font-size: .8rem; font-weight: 400; color: var(--ink-soft);
  vertical-align: middle; margin-left: .5rem;
}

.masthead-actions { display: flex; align-items: center; gap: .7rem; padding-top: .3rem; }

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

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

/* ---------- day pills ---------- */

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

.day-pill {
  flex: 0 0 auto;
  width: 46px;
  padding: .55rem 0 .5rem;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: .1rem;
  transition: background .35s var(--ease-out), color .35s, transform .35s var(--ease-spring), box-shadow .35s;
}
.day-pill:hover { transform: translateY(-3px); color: var(--ink); }
.day-pill .dow { font-size: .62rem; font-weight: 400; letter-spacing: .08em; opacity: .8; }
.day-pill .dom { font-size: .95rem; font-weight: 500; line-height: 1.2; }
.day-pill .mark {
  width: 4px; height: 4px; border-radius: 50%;
  background: currentColor; opacity: 0;
  transition: opacity .3s;
}
.day-pill[data-has="1"] .mark { opacity: .55; }
.day-pill[data-current="1"] {
  background: var(--ink);
  color: var(--paper);
  box-shadow: var(--shadow);
}
.day-pill[data-current="1"]:hover { transform: none; }

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

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

.card {
  background: var(--card);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  padding: 1.5rem 1.5rem 1.4rem;
  margin-bottom: 1rem;
  animation: cardIn .9s cubic-bezier(.22, 1.2, .36, 1) both;
  animation-delay: calc(.08s + var(--i) * .11s);
  transition: background .5s var(--ease-out);
  will-change: transform, opacity;
}

.card-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: .9rem;
}
.label {
  font-size: .78rem;
  font-weight: 500;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.count {
  font-size: .78rem;
  font-weight: 400;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}

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

/* ---------- hero ---------- */

.card-hero {
  display: flex; align-items: center; gap: 1.4rem;
  padding: 1.6rem 1.7rem;
}
.ring { flex: 0 0 auto; width: 132px; height: 132px; position: relative; }
.ring svg { width: 100%; height: 100%; display: block; }
.ring .halo-dot { fill: var(--ink); transition: opacity .6s; }
.ring .p-dot {
  fill: var(--ink-faint);
  transform-box: fill-box; transform-origin: center;
  transition: fill .45s, transform .45s var(--ease-spring);
}
.ring .p-dot.on { fill: var(--ink); transform: scale(1.65); }

.hero-figures { flex: 1; min-width: 0; }
.pct {
  font-size: clamp(2.9rem, 10vw, 3.6rem);
  font-weight: 500;
  letter-spacing: -.03em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.pct-sign { font-size: .5em; font-weight: 400; color: var(--ink-soft); margin-left: .06em; }
.pct-sub {
  font-size: .82rem;
  font-weight: 300;
  color: var(--ink-soft);
  margin-top: .45rem;
}

/* ---------- checks ---------- */

.check {
  --size: 26px;
  width: var(--size); height: var(--size);
  flex: 0 0 var(--size);
  background: none; border: none; padding: 0; cursor: pointer;
  display: grid; place-items: center;
}
.check svg { width: 100%; height: 100%; overflow: visible; }
.check .ring-c {
  fill: none; stroke: var(--ink-faint); stroke-width: 1.8;
  transition: stroke .3s;
}
.check:hover .ring-c { stroke: var(--ink); }
.check .fill-c {
  fill: var(--ink); transform-origin: center;
  transform: scale(0);
  transition: transform .45s var(--ease-spring);
}
.checked-row .check .fill-c, .task.done .check .fill-c { transform: scale(1); }
.check .tick-c {
  fill: none; stroke: var(--card); stroke-width: 2.4;
  stroke-linecap: round; stroke-linejoin: round;
  stroke-dasharray: 16; stroke-dashoffset: 16;
  transition: stroke-dashoffset .35s var(--ease-out) .12s, stroke .5s;
}
.checked-row .check .tick-c, .task.done .check .tick-c { stroke-dashoffset: 0; }

/* ---------- scrollable card lists ---------- */

.rituals, .tasks, .notes {
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: var(--ink-faint) transparent;
}
.rituals::-webkit-scrollbar, .tasks::-webkit-scrollbar, .notes::-webkit-scrollbar { width: 4px; }
.rituals::-webkit-scrollbar-thumb, .tasks::-webkit-scrollbar-thumb, .notes::-webkit-scrollbar-thumb {
  background: var(--ink-faint);
  border-radius: 999px;
}
.rituals { max-height: 232px; }
.tasks { max-height: 320px; }
.notes {
  max-height: 348px;
  padding: 4px; margin: -4px;   /* room for hover lift + shadow inside the clip */
}
/* soft fade at the edges, only while the list actually scrolls */
.rituals.scrolly, .tasks.scrolly, .notes.scrolly {
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, black 14px, black calc(100% - 14px), transparent 100%);
          mask-image: linear-gradient(to bottom, transparent 0, black 14px, black calc(100% - 14px), transparent 100%);
}

/* ---------- rituals ---------- */

.rituals { list-style: none; }
.ritual {
  display: flex; align-items: center; gap: .9rem;
  padding: .55rem 0;
  animation: itemIn .45s var(--ease-out) both;
}
.ritual-label { flex: 1; font-size: 1rem; font-weight: 400; transition: color .35s; }
.ritual.checked-row .ritual-label { color: var(--ink-soft); }
.streak {
  font-size: .78rem;
  font-weight: 500;
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
  background: var(--paper);
  border-radius: 999px;
  padding: .18rem .6rem;
  transition: color .3s, background .3s;
}
.ritual.checked-row .streak { color: var(--paper); background: var(--ink); }
.streak:empty { display: none; }
.streak.tick { animation: popIn .45s var(--ease-spring); }
.ritual-del, .task-del {
  background: none; border: none; color: var(--ink-faint);
  font-size: .95rem; cursor: pointer; opacity: 0;
  transition: opacity .2s, color .2s, transform .3s var(--ease-spring);
  padding: .15rem .35rem;
  border-radius: 50%;
}
.ritual:hover .ritual-del, .task:hover .task-del { opacity: .7; }
.ritual-del:hover, .task-del:hover { color: var(--ink); opacity: 1; transform: scale(1.25); }

.inline-form { padding: .5rem 0 .2rem; }
#ritual-input, #crew-name-input {
  width: 100%;
  font-size: 1rem;
  background: var(--paper);
  border: none; outline: none;
  border-radius: 999px;
  color: var(--ink);
  padding: .6rem 1.1rem;
}

/* ---------- tasks (ink card) ---------- */

.card-ink {
  background: var(--ink);
  color: var(--paper);
}
.card-ink .label, .card-ink .count { color: color-mix(in srgb, var(--paper) 62%, transparent); }

.tasks { list-style: none; }
.task {
  display: flex; align-items: flex-start; gap: .9rem;
  padding: .6rem 0;
  border-radius: 12px;
  animation: itemIn .5s cubic-bezier(.22, 1.2, .36, 1) both;
  transition: opacity .3s, transform .4s var(--ease-spring);
}
.task:hover { transform: translateX(3px); }

/* tactile press feedback everywhere */
.check:active svg { transform: scale(.8); }
.check svg { transition: transform .3s var(--ease-spring); }
.day-pill:active, .round-btn:active, .theme-toggle:active, .profile-btn:active { transform: scale(.9); }
.ritual:active .ritual-label, .task:active .task-text { opacity: .7; }

.card-ink .check { margin-top: .05rem; }
.card-ink .check .ring-c { stroke: color-mix(in srgb, var(--paper) 40%, transparent); }
.card-ink .check:hover .ring-c { stroke: var(--paper); }
.card-ink .check .fill-c { fill: var(--paper); }
.card-ink .check .tick-c { stroke: var(--ink); }

.task-text {
  flex: 1; font-size: 1rem; font-weight: 400;
  position: relative;
  transition: color .4s, opacity .4s;
  word-break: break-word;
  padding-top: .05rem;
}
.task-text::after {
  content: "";
  position: absolute; left: -2px; right: -2px; top: .78em;
  height: 1.5px; background: color-mix(in srgb, var(--paper) 55%, transparent);
  transform: scaleX(0); transform-origin: left center;
  transition: transform .45s var(--ease-out);
  border-radius: 2px;
}
.task.done .task-text { opacity: .45; }
.task.done .task-text::after { transform: scaleX(1); }

.card-ink .task-del { color: color-mix(in srgb, var(--paper) 45%, transparent); margin-top: .1rem; }
.card-ink .task-del:hover { color: var(--paper); }

.task-add {
  display: flex; align-items: center; gap: .8rem;
  margin-top: .7rem;
  background: color-mix(in srgb, var(--paper) 10%, transparent);
  border-radius: 999px;
  padding: .55rem 1.1rem;
  transition: background .3s;
}
.task-add:focus-within { background: color-mix(in srgb, var(--paper) 16%, transparent); }
.task-add-mark {
  color: color-mix(in srgb, var(--paper) 55%, transparent);
  font-size: 1.05rem;
  transition: color .3s, transform .35s var(--ease-spring);
}
.task-add:focus-within .task-add-mark { color: var(--paper); transform: rotate(90deg); }
#task-input {
  flex: 1;
  font-size: .98rem;
  background: none; border: none; outline: none;
  color: var(--paper);
}
#task-input::placeholder, #ritual-input::placeholder, #crew-name-input::placeholder, .note::placeholder {
  color: inherit; opacity: .45; font-weight: 300;
}

.empty {
  font-size: .95rem;
  font-weight: 300;
  opacity: .5;
  padding: .3rem 0 .1rem;
}

/* ---------- notes ---------- */

.notes { list-style: none; }
.note-item {
  background: var(--paper);
  border-radius: 18px;
  padding: .75rem 1rem .65rem;
  margin-bottom: .55rem;
  animation: itemIn .55s cubic-bezier(.22, 1.2, .36, 1) both;
  position: relative;
  transition: background .5s var(--ease-out),
              transform .45s var(--ease-spring),
              box-shadow .45s var(--ease-out);
}
.note-item:hover {
  transform: translateY(-2px) scale(1.008);
  box-shadow: 0 6px 18px -8px rgb(0 0 0 / .16);
}
.note-item.fresh { animation: notePop .6s cubic-bezier(.22, 1.4, .36, 1) both; }
.note-text {
  font-size: .95rem;
  font-weight: 300;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}
.note-meta {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: .35rem;
}
.note-time {
  font-size: .66rem;
  font-weight: 400;
  letter-spacing: .08em;
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
}
.note-del {
  background: none; border: none; color: var(--ink-faint);
  font-size: .85rem; cursor: pointer; opacity: 0;
  padding: 0 .2rem;
  transition: opacity .2s, color .2s, transform .3s var(--ease-spring);
}
.note-item:hover .note-del { opacity: .7; }
.note-del:hover { color: var(--ink); opacity: 1; transform: scale(1.25); }

.empty-soft {
  font-size: .92rem;
  font-weight: 300;
  color: var(--ink-faint);
  padding: .2rem 0 .3rem;
}

.note-add {
  display: flex; align-items: flex-end; gap: .6rem;
  margin-top: .8rem;
  background: var(--paper);
  border-radius: 22px;
  padding: .5rem .5rem .5rem 1.1rem;
  transition: box-shadow .3s, background .5s var(--ease-out);
}
.note-add:focus-within { box-shadow: inset 0 0 0 1.5px var(--ink-faint); }
.note-input {
  flex: 1;
  font-size: .95rem;
  font-weight: 300;
  line-height: 1.5;
  background: none; border: none; outline: none;
  color: var(--ink);
  resize: none;
  max-height: 9rem;
  padding: .3rem 0;
}
.note-send {
  flex: 0 0 auto;
  width: 34px; height: 34px;
  border: none; border-radius: 50%;
  background: var(--ink);
  color: var(--paper);
  font-size: 1rem;
  cursor: pointer;
  display: grid; place-items: center;
  opacity: .25;
  transition: opacity .3s, transform .35s var(--ease-spring);
}
.note-add:focus-within .note-send { opacity: 1; }
.note-send:hover { transform: translateY(-2px) scale(1.06); }
.note-send:active { transform: scale(.92); }

/* ---------- profile ---------- */

.profile-btn {
  width: 36px; height: 36px;
  padding: 0;
  border: 1.5px solid var(--line);
  border-radius: 50%;
  background: var(--card);
  cursor: pointer;
  overflow: hidden;
  display: grid; place-items: center;
  box-shadow: var(--shadow);
  transition: border-color .3s, transform .4s var(--ease-spring);
}
.profile-btn:hover { border-color: var(--ink); transform: scale(1.08); }
.avatar {
  width: 100%; height: 100%;
  border-radius: 50%;
  background-size: cover;
  background-position: center;
  display: grid; place-items: center;
  font-size: .82rem;
  font-weight: 500;
  color: var(--paper);
  background-color: var(--ink);
}
.avatar-big { font-size: 1.6rem; }

.sheet-backdrop {
  position: fixed; inset: 0;
  background: rgb(0 0 0 / .28);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  z-index: 33;
  animation: fadeIn .35s var(--ease-out) both;
}
.sheet-backdrop.closing { animation: fadeOut .25s var(--ease-out) both; }

.sheet {
  position: fixed;
  left: 50%; bottom: 0;
  transform: translateX(-50%);
  width: min(440px, 100%);
  background: var(--card);
  border-radius: 28px 28px 0 0;
  padding: .8rem 1.7rem calc(1.6rem + env(safe-area-inset-bottom, 0px));
  z-index: 34;
  box-shadow: 0 -8px 40px -12px rgb(0 0 0 / .25);
  animation: sheetUp .55s cubic-bezier(.22, 1.2, .36, 1) both;
  transition: background .5s var(--ease-out);
}
.sheet.closing { animation: sheetDown .3s var(--ease-out) both; }

@media (min-width: 920px) {
  .sheet {
    bottom: auto; top: 50%;
    border-radius: 28px;
    animation: sheetPop .5s cubic-bezier(.22, 1.3, .36, 1) both;
    transform: translate(-50%, -50%);
    padding-bottom: 1.6rem;
  }
  .sheet.closing { animation: sheetPopOut .25s var(--ease-out) both; }
  .sheet-handle { visibility: hidden; }
}

.sheet-handle {
  width: 38px; height: 4px;
  border-radius: 999px;
  background: var(--ink-faint);
  margin: 0 auto 1.3rem;
  opacity: .6;
}
.sheet-avatar-wrap { display: grid; place-items: center; margin-bottom: 1.4rem; }
.sheet-avatar {
  position: relative;
  width: 84px; height: 84px;
  padding: 0;
  border: 1.5px solid var(--line);
  border-radius: 50%;
  background: none;
  cursor: pointer;
  overflow: hidden;
  transition: transform .4s var(--ease-spring), border-color .3s;
}
.sheet-avatar:hover { transform: scale(1.05); border-color: var(--ink); }
.avatar-edit-hint {
  position: absolute; left: 0; right: 0; bottom: 0;
  font-size: .62rem;
  font-weight: 500;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: #fff;
  background: rgb(0 0 0 / .45);
  padding: .22rem 0 .3rem;
  opacity: 0;
  transition: opacity .25s;
}
.sheet-avatar:hover .avatar-edit-hint { opacity: 1; }

.sheet-label {
  display: block;
  font-size: .7rem;
  font-weight: 500;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: .45rem;
}
.sheet-input {
  width: 100%;
  font-size: 1.02rem;
  background: var(--paper);
  border: 1.5px solid transparent;
  border-radius: 16px;
  color: var(--ink);
  padding: .7rem 1rem;
  outline: none;
  margin-bottom: 1.1rem;
  transition: border-color .3s, background .5s var(--ease-out);
}
.sheet-input:focus { border-color: var(--ink); }
.sheet-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: .65rem .15rem;
  border-top: 1px solid var(--line);
}
.sheet-row-label { font-size: .92rem; font-weight: 300; color: var(--ink-soft); }
.sheet-row-value { font-size: .92rem; font-weight: 500; font-variant-numeric: tabular-nums; }
.sheet-chip {
  border: 1.5px solid var(--line);
  background: none;
  border-radius: 999px;
  color: var(--ink);
  font-size: .82rem;
  font-weight: 500;
  padding: .3rem .9rem;
  cursor: pointer;
  transition: border-color .25s, transform .35s var(--ease-spring);
}
.sheet-chip:hover { border-color: var(--ink); }
.sheet-chip:active { transform: scale(.92); }
.sheet-chip.on { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.sheet-chip:disabled { color: var(--ink-faint); cursor: default; }
.sheet-chip:disabled:hover { border-color: var(--line); }
.push-hint {
  font-size: .78rem;
  font-weight: 300;
  color: var(--ink-soft);
  padding: .15rem .15rem .4rem;
  line-height: 1.45;
}
.sheet-signout {
  display: block;
  width: 100%;
  margin-top: 1.2rem;
  border: none;
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink-soft);
  font-size: .95rem;
  font-weight: 500;
  padding: .85rem;
  cursor: pointer;
  transition: background .3s, color .3s, transform .35s var(--ease-spring);
}
.sheet-signout:hover { background: var(--ink); color: var(--paper); }
.sheet-signout:active { transform: scale(.97); }

@keyframes sheetUp {
  from { transform: translate(-50%, 105%); }
  to { transform: translate(-50%, 0); }
}
@keyframes sheetDown {
  from { transform: translate(-50%, 0); }
  to { transform: translate(-50%, 105%); }
}
@keyframes sheetPop {
  from { opacity: 0; transform: translate(-50%, -46%) scale(.92); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}
@keyframes sheetPopOut {
  from { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  to { opacity: 0; transform: translate(-50%, -47%) scale(.95); }
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeOut { from { opacity: 1; } to { opacity: 0; } }

/* ---------- avatar cropper ---------- */

.cropper {
  position: fixed; inset: 0;
  display: grid; place-items: center;
  background: rgb(0 0 0 / .45);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  z-index: 45;
  animation: fadeIn .3s var(--ease-out) both;
  padding: 1.4rem;
}
.crop-card {
  background: var(--card);
  border-radius: 26px;
  padding: 1.5rem 1.5rem 1.3rem;
  width: min(340px, 100%);
  box-shadow: 0 20px 60px -18px rgb(0 0 0 / .4);
  animation: sheetPopIn .5s cubic-bezier(.22, 1.3, .36, 1) both;
  text-align: center;
}
@keyframes sheetPopIn {
  from { opacity: 0; transform: translateY(16px) scale(.94); }
  to { opacity: 1; transform: none; }
}
.crop-title {
  font-size: .95rem;
  font-weight: 500;
  margin-bottom: 1rem;
}
.crop-viewport {
  position: relative;
  width: 264px; height: 264px;
  margin: 0 auto;
  border-radius: 20px;
  overflow: hidden;
  background: var(--paper);
  cursor: grab;
  touch-action: none;
}
.crop-viewport:active { cursor: grabbing; }
#crop-img {
  position: absolute; top: 0; left: 0;
  transform-origin: 0 0;
  user-select: none;
  -webkit-user-select: none;
  pointer-events: none;
  max-width: none;
}
.crop-mask {
  position: absolute; inset: 0;
  border-radius: 50%;
  box-shadow: 0 0 0 400px rgb(0 0 0 / .38);
  pointer-events: none;
}
.crop-zoom {
  width: 80%;
  margin: 1.1rem auto .9rem;
  display: block;
  -webkit-appearance: none;
  appearance: none;
  height: 3px;
  border-radius: 999px;
  background: var(--line);
  outline: none;
}
.crop-zoom::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--ink);
  cursor: pointer;
  transition: transform .3s var(--ease-spring);
}
.crop-zoom::-webkit-slider-thumb:hover { transform: scale(1.2); }
.crop-actions { display: flex; gap: .6rem; }
.crop-btn {
  flex: 1;
  border: none;
  border-radius: 999px;
  font-size: .92rem;
  font-weight: 500;
  padding: .75rem;
  cursor: pointer;
  transition: transform .35s var(--ease-spring), opacity .3s;
}
.crop-btn:active { transform: scale(.95); }
.crop-cancel { background: var(--paper); color: var(--ink-soft); }
.crop-confirm { background: var(--ink); color: var(--paper); }

/* ---------- footer ---------- */

.foot {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 1.6rem;
  padding: 0 .6rem;
  font-size: .68rem;
  font-weight: 300;
  letter-spacing: .05em;
  color: var(--ink-faint);
  animation: rise .7s var(--ease-out) .5s both;
}
kbd {
  font-family: inherit;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: .1em .4em;
  background: var(--card);
}
.foot-hint kbd { margin-right: .1em; }

@media (max-width: 480px) {
  .foot-hint { display: none; }
  .foot { justify-content: center; }
  .card-hero { gap: 1.1rem; padding: 1.4rem 1.3rem; }
  .ring { width: 112px; height: 112px; }
}

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

.app {
  padding-left: max(1.2rem, env(safe-area-inset-left, 0px));
  padding-right: max(1.2rem, env(safe-area-inset-right, 0px));
  padding-top: max(clamp(1.4rem, 4vw, 2.6rem), env(safe-area-inset-top, 0px));
  padding-bottom: max(3.5rem, env(safe-area-inset-bottom, 0px) + 2rem);
}

@media (pointer: coarse) {
  /* 16px+ inputs stop iOS Safari's focus zoom */
  #task-input, #ritual-input, #crew-name-input, .note-input, #gate-input, .ob-input { font-size: 16px; }
  /* comfortable tap targets without changing the visual size */
  .check { --size: 28px; position: relative; }
  .check::after { content: ""; position: absolute; inset: -9px; }
  .task-del, .ritual-del, .note-del { opacity: .45; padding: .3rem .5rem; }
  .day-pill { width: 48px; }
  .theme-toggle { width: 40px; height: 40px; }
}

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

@media (min-width: 920px) {
  .app {
    max-width: 1000px;
    padding-top: 3.2rem;
  }
  .masthead {
    display: flex; align-items: flex-end; justify-content: space-between;
    gap: 2rem;
    padding: 0 .6rem;
  }
  .masthead-top { flex: 0 0 auto; }
  .days {
    margin-top: 0;
    justify-content: flex-end;
    -webkit-mask-image: linear-gradient(to right, transparent, black 6%);
            mask-image: linear-gradient(to right, transparent, black 6%);
  }
  .panel {
    margin-top: 1.4rem;
    display: grid;
    grid-template-columns: 1fr 1.15fr;
    gap: 1.1rem;
    align-items: start;
  }
  .col { display: flex; flex-direction: column; gap: 1.1rem; }
  .card { margin-bottom: 0; padding: 1.7rem 1.7rem 1.6rem; }
  .card-hero { padding: 1.9rem 1.9rem; }
  .ring { width: 148px; height: 148px; }
}

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

@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}
@keyframes cardIn {
  0% { opacity: 0; transform: translateY(26px) scale(.96); filter: blur(6px); }
  60% { filter: blur(0); }
  100% { opacity: 1; transform: none; filter: none; }
}
@keyframes itemIn {
  from { opacity: 0; transform: translateY(10px) scale(.98); filter: blur(3px); }
  to { opacity: 1; transform: none; filter: none; }
}
@keyframes itemOut {
  to { opacity: 0; transform: translateX(14px); }
}
@keyframes notePop {
  0% { opacity: 0; transform: translateY(14px) scale(.92); }
  60% { transform: translateY(-2px) scale(1.015); }
  100% { opacity: 1; transform: none; }
}
@keyframes popIn {
  0% { transform: scale(.6); }
  100% { transform: scale(1); }
}
@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(.7); opacity: .5; }
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-7px); }
  75% { transform: translateX(7px); }
}
@keyframes fadeHold {
  0%, 70% { opacity: .55; }
  100% { opacity: 0; }
}
@keyframes swapOut { to { opacity: 0; transform: translateY(-8px); } }
@keyframes swapIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}
.panel.swap-out, .masthead-top.swap-out { animation: swapOut .22s var(--ease-out) both; }
.panel.swap-in, .masthead-top.swap-in { animation: swapIn .4s var(--ease-out) both; }

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

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

/* ---------- auth ---------- */

.auth-form { display: grid; gap: .7rem; width: 280px; margin: 0 auto; }
.auth-field { text-align: left; }
.auth-submit { margin-top: .3rem; }
.auth-switch {
  background: none; border: none;
  font-family: inherit;
  font-size: .85rem;
  font-weight: 300;
  color: var(--ink-soft);
  cursor: pointer;
  margin-top: 1.2rem;
  transition: color .25s;
}
.auth-switch:hover { color: var(--ink); }
.auth-switch strong { font-weight: 500; color: var(--ink); }
.sheet-email { font-weight: 300; font-size: .8rem; color: var(--ink-soft); max-width: 60%; overflow: hidden; text-overflow: ellipsis; }

/* ---------- coach-mark tour ---------- */

.tour { position: fixed; inset: 0; z-index: 40; pointer-events: none; }
.tour-spot {
  position: fixed;
  border-radius: 32px;
  box-shadow: 0 0 0 9999px rgb(0 0 0 / .5);
  pointer-events: none;
  transition: top .5s cubic-bezier(.22,1.2,.36,1), left .5s cubic-bezier(.22,1.2,.36,1),
              width .5s cubic-bezier(.22,1.2,.36,1), height .5s cubic-bezier(.22,1.2,.36,1);
}
.tour-tip {
  position: fixed;
  width: min(320px, calc(100vw - 24px));
  background: var(--card);
  border-radius: 20px;
  padding: 1.1rem 1.2rem 1rem;
  box-shadow: 0 16px 48px -14px rgb(0 0 0 / .4);
  pointer-events: auto;
  transition: top .5s cubic-bezier(.22,1.2,.36,1), left .5s cubic-bezier(.22,1.2,.36,1);
  animation: sheetPopIn .5s cubic-bezier(.22,1.3,.36,1) both;
}
.tour-text { font-size: .95rem; font-weight: 300; line-height: 1.55; margin-bottom: .9rem; }
.tour-actions { display: flex; align-items: center; justify-content: space-between; }
.tour-skip {
  background: none; border: none;
  font-family: inherit; font-size: .82rem; font-weight: 400;
  color: var(--ink-faint); cursor: pointer;
  transition: color .25s;
}
.tour-skip:hover { color: var(--ink); }
.tour-next {
  border: none; border-radius: 999px;
  background: var(--ink); color: var(--paper);
  font-family: inherit; font-size: .85rem; font-weight: 500;
  padding: .5rem 1.2rem; cursor: pointer;
  transition: transform .35s var(--ease-spring);
}
.tour-next:active { transform: scale(.93); }
.tour-dots { display: flex; gap: .35rem; }
.tour-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--ink-faint); transition: background .3s, transform .3s var(--ease-spring); }
.tour-dot.on { background: var(--ink); transform: scale(1.4); }

/* ---------- google auth button ---------- */

.auth-google {
  display: flex; align-items: center; justify-content: center; gap: .55rem;
  width: 280px;
  margin: .8rem auto 0;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  color: var(--ink);
  font-family: inherit; font-size: .92rem; font-weight: 500;
  padding: .75rem 1.2rem;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: border-color .3s, transform .35s var(--ease-spring);
}
.auth-google:hover { border-color: var(--ink); transform: translateY(-1px); }
.auth-google:active { transform: scale(.97); }

.auth-divider {
  display: flex; align-items: center; gap: .8rem;
  width: 280px; margin: 1rem auto;
  color: var(--ink-faint);
  font-size: .72rem; font-weight: 400;
}
.auth-divider::before, .auth-divider::after {
  content: ""; flex: 1; height: 1px; background: var(--line);
}

/* ---------- share card ---------- */
.head-actions { display: flex; gap: .45rem; }
.share-btn svg { display: block; }
.share-btn:hover { transform: translateY(-2px) scale(1.08); }

.share-sheet { width: min(400px, 100%); }
.share-title {
  text-align: center; font-size: 1.05rem; font-weight: 500;
  margin-bottom: 1.1rem;
  animation: rise .5s var(--ease-out) .1s both;
}
.share-stage {
  display: grid; place-items: center;
  perspective: 900px;
  margin-bottom: 1.2rem;
}
#share-canvas {
  width: min(210px, 52vw); height: auto;
  border-radius: 18px;
  box-shadow: 0 18px 44px -10px rgb(0 0 0 / .35);
  animation: cardIn .7s cubic-bezier(.22, 1.3, .36, 1) .12s both;
  transition: opacity .18s ease, transform .18s ease;
}
#share-canvas.flipping { opacity: 0; transform: rotateY(70deg) scale(.94); }
@keyframes cardIn {
  from { opacity: 0; transform: translateY(46px) rotateX(14deg) scale(.82); }
  to { opacity: 1; transform: none; }
}
.share-controls {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  animation: rise .5s var(--ease-out) .22s both;
}
.share-flip {
  display: flex; gap: .3rem;
  background: var(--bg); border-radius: 999px; padding: .28rem;
}
.share-flip-btn {
  border: none; background: transparent; color: var(--ink-soft);
  font-family: inherit; font-size: .8rem; font-weight: 500;
  padding: .42rem .95rem; border-radius: 999px; cursor: pointer;
  transition: background .3s, color .3s, transform .35s var(--ease-spring);
}
.share-flip-btn:active { transform: scale(.92); }
.share-flip-btn.on { background: var(--ink); color: var(--paper); }
.share-go {
  border: none; border-radius: 999px;
  background: var(--ink); color: var(--paper);
  font-family: inherit; font-size: .95rem; font-weight: 500;
  padding: .8rem 1.9rem; cursor: pointer;
  transition: transform .35s var(--ease-spring), box-shadow .35s;
}
.share-go:hover { transform: translateY(-2px); box-shadow: 0 10px 24px -10px rgb(0 0 0 / .4); }
.share-go:active { transform: scale(.94); }
.share-go.done { animation: sharePulse .5s var(--ease-out); }
@keyframes sharePulse {
  0% { transform: scale(1); }
  40% { transform: scale(1.08); }
  100% { transform: scale(1); }
}

.milestone-toast {
  position: fixed; left: 50%; bottom: calc(1.6rem + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  display: flex; align-items: center; gap: .55rem;
  border: none; cursor: pointer;
  background: var(--ink); color: var(--paper);
  font-family: inherit; font-size: .88rem; font-weight: 400;
  padding: .85rem 1.5rem; border-radius: 999px;
  box-shadow: 0 16px 40px -8px rgb(0 0 0 / .4);
  z-index: 19;
  animation: toastIn .6s cubic-bezier(.22, 1.4, .36, 1) both;
  overflow: visible;
}
.milestone-toast strong { font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.milestone-toast.leaving { animation: toastOut .3s var(--ease-out) both; }
@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(60px) scale(.8); }
  to { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
}
@keyframes toastOut {
  to { opacity: 0; transform: translateX(-50%) translateY(40px) scale(.85); }
}
.mt-burst { position: absolute; inset: 0; pointer-events: none; }
.mt-burst::before, .mt-burst::after {
  content: ""; position: absolute; top: 50%; left: 50%;
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--paper); opacity: 0;
  animation: burst 1s var(--ease-out) .25s;
}
.mt-burst::after { animation-delay: .4s; }
@keyframes burst {
  0% { opacity: .9; transform: translate(-50%, -50%) scale(.4); }
  100% { opacity: 0; transform: translate(calc(-50% + 46px), calc(-50% - 40px)) scale(1.6); }
}
@media (prefers-reduced-motion: reduce) {
  #share-canvas, .share-title, .share-controls, .milestone-toast { animation: none; }
}

.share-actions { display: flex; align-items: center; gap: .55rem; }
.share-save {
  border: 1.5px solid var(--line); border-radius: 999px;
  background: transparent; color: var(--ink-soft);
  font-family: inherit; font-size: .85rem; font-weight: 500;
  padding: .68rem 1.15rem; cursor: pointer;
  transition: color .3s, border-color .3s, transform .35s var(--ease-spring);
}
.share-save:hover { color: var(--ink); border-color: var(--ink); transform: translateY(-2px); }
.share-save:active { transform: scale(.94); }
.share-hint {
  text-align: center; font-size: .68rem; font-weight: 300;
  color: var(--ink-faint); margin-top: .9rem;
  animation: rise .5s var(--ease-out) .3s both;
}

/* ---------- focus mode ---------- */

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

.card.focused {
  animation: none;
  display: flex; flex-direction: column;
  box-shadow: 0 2px 6px rgb(0 0 0 / .1), 0 40px 90px -20px rgb(0 0 0 / .4);
  overflow: hidden;
}
.card.focused .rituals,
.card.focused .tasks,
.card.focused .notes {
  flex: 1; max-height: none; overflow-y: auto;
}
.card.focused .card-head { flex: none; }
.card.focused .task-add,
.card.focused .note-add,
.card.focused .inline-form { flex: none; }
.card.focused .focus-btn { color: var(--ink); }
.card.collapsing { overflow: hidden; }


/* delete crosses on tasks/rituals — match the notes' visibility */
.task-del, .ritual-del { color: var(--ink-soft); }
.task-del:hover, .ritual-del:hover { color: var(--ink); }

/* ---------- instants (photo proof pinned to a check) ---------- */

.task, .ritual { flex-wrap: wrap; }

.prove-btn {
  background: none; border: none; cursor: pointer;
  color: var(--ink-soft); opacity: .55;
  padding: .15rem .35rem; border-radius: 50%;
  transition: opacity .2s, color .2s, transform .3s var(--ease-spring);
}
.prove-btn svg { display: block; }
.prove-btn:hover { color: var(--ink); opacity: 1; transform: scale(1.2); }
.prove-btn.pulse { animation: provePulse 1.6s var(--ease-spring) .25s 2; }
@keyframes provePulse {
  0%, 100% { transform: scale(1); opacity: .55; }
  30% { transform: scale(1.35); opacity: 1; color: var(--ink); }
}
.card-ink .prove-btn { color: color-mix(in srgb, var(--paper) 55%, transparent); }
.card-ink .prove-btn:hover { color: var(--paper); }

.instant-strip {
  width: 100%; display: flex; gap: .5rem; flex-wrap: wrap;
  padding: .35rem 0 .1rem 2.6rem;
}
.instant-tile {
  width: 62px; height: 62px; padding: 0; border: none; cursor: pointer;
  border-radius: 16px; overflow: hidden; background: var(--line);
  animation: itemIn .5s cubic-bezier(.22, 1.2, .36, 1) both;
  transition: transform .35s var(--ease-spring), box-shadow .3s;
}
@supports (corner-shape: squircle) {
  .instant-tile { corner-shape: squircle; border-radius: 22px; }
}
.instant-tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.instant-tile:hover { transform: scale(1.06); box-shadow: var(--shadow); }

.lightbox {
  position: fixed; inset: 0; z-index: 60;
  background: rgb(0 0 0 / .82); backdrop-filter: blur(8px);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 1rem; padding: 2rem 1.2rem;
  opacity: 0; transition: opacity .26s var(--ease-out);
}
.lightbox.open { opacity: 1; }
.lightbox img {
  max-width: min(92vw, 720px); max-height: 74vh;
  border-radius: 22px; object-fit: contain;
  box-shadow: 0 30px 80px -20px rgb(0 0 0 / .6);
  transform: scale(.94); transition: transform .3s var(--ease-spring);
}
.lightbox.open img { transform: none; }
.lightbox-bar {
  display: flex; align-items: center; gap: 1.2rem;
  color: rgb(255 255 255 / .85); font-size: .9rem;
}
.lightbox-bar button {
  background: none; border: 1.5px solid rgb(255 255 255 / .35);
  color: rgb(255 255 255 / .85); border-radius: 999px;
  padding: .3rem .95rem; font-family: inherit; font-size: .82rem; cursor: pointer;
  transition: border-color .2s, color .2s;
}
.lightbox-bar button:hover { border-color: #fff; color: #fff; }

/* ---------- push (reminders chip + hint) ---------- */

.sheet-chip.on { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.sheet-chip:disabled { color: var(--ink-faint); cursor: default; }
.push-hint {
  font-size: .78rem; color: var(--ink-soft);
  padding: .15rem .15rem .4rem; line-height: 1.45;
}

/* ---------- custom camera (in-app viewfinder) ---------- */

.camera {
  position: fixed; inset: 0; z-index: 70; background: #000;
  display: flex; flex-direction: column;
  transform: translateY(102%);
  transition: transform .5s cubic-bezier(.22, 1, .36, 1);
}
.camera.open { transform: none; }
.cam-viewfinder {
  flex: 1; position: relative; overflow: hidden;
  margin: calc(env(safe-area-inset-top, 0px) + 14px) 14px 14px;
  border-radius: 28px; background: #0a0a0a;
}
.cam-viewfinder video {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover;
}
.cam-viewfinder video.mirrored { transform: scaleX(-1); }
.cam-tag {
  position: absolute; top: 14px; left: 14px; z-index: 2;
  background: rgb(0 0 0 / .45); color: #fff;
  font-size: .78rem; font-weight: 500;
  border-radius: 999px; padding: .28rem .75rem;
  backdrop-filter: blur(6px); max-width: 70%;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cam-flash {
  position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; z-index: 3;
}
.cam-flash.fire { animation: camFlash .45s ease-out; }
@keyframes camFlash { 0% { opacity: 0; } 18% { opacity: .95; } 100% { opacity: 0; } }
.cam-controls {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 2.2rem calc(env(safe-area-inset-bottom, 0px) + 2rem);
}
.cam-skip {
  background: none; border: none; color: rgb(255 255 255 / .75);
  font-family: inherit; font-size: .92rem; cursor: pointer; padding: .4rem;
  transition: color .2s;
}
.cam-skip:hover { color: #fff; }
.cam-shutter {
  width: 66px; height: 66px; border-radius: 50%;
  border: 3.5px solid #fff; background: none; cursor: pointer;
  display: grid; place-items: center; padding: 0;
}
.cam-shutter i {
  width: 52px; height: 52px; border-radius: 50%; background: #fff;
  transition: transform .15s;
}
.cam-shutter:active i { transform: scale(.8); }
.cam-flip {
  background: none; border: none; color: rgb(255 255 255 / .75);
  cursor: pointer; padding: .5rem; border-radius: 50%;
  transition: color .2s, transform .35s var(--ease-spring);
}
.cam-flip:hover { color: #fff; transform: rotate(180deg); }
.cam-flip svg { display: block; }

.cam-viewfinder { touch-action: none; }   /* pinch belongs to us, not the page */
.cam-viewfinder video { transition: transform .12s linear; transform-origin: center; }
.cam-zoom {
  position: absolute; top: 14px; right: 14px; z-index: 2;
  background: rgb(0 0 0 / .45); color: #fff;
  font-size: .78rem; font-weight: 500; font-variant-numeric: tabular-nums;
  border-radius: 999px; padding: .28rem .7rem;
  backdrop-filter: blur(6px);
}

/* ---------- crew (preview build) ---------- */

.crew-tag {
  font-size: .58rem; letter-spacing: .12em; text-transform: uppercase;
  color: var(--ink-faint); border: 1.5px solid var(--line);
  border-radius: 999px; padding: .12rem .5rem; margin-left: .45rem;
  vertical-align: 2px;
}
.crew-list { list-style: none; }
.cw-row {
  display: flex; align-items: center; gap: .8rem; padding: .5rem 0;
  border-top: 1.5px solid var(--line);
  animation: itemIn .5s cubic-bezier(.22, 1.2, .36, 1) both;
}
.cw-row:first-child { border-top: none; }
.cw-row.cw-out { opacity: .45; }
.cw-av { width: 40px; height: 40px; position: relative; flex: none; display: block; }
.cw-av svg { position: absolute; inset: 0; transform: rotate(-90deg); }
.cw-tr { fill: none; stroke: var(--line); stroke-width: 3; }
.cw-fl {
  fill: none; stroke: var(--ink); stroke-width: 3; stroke-linecap: round;
  stroke-dasharray: 113;
  transition: stroke-dashoffset 1s var(--ease-out);
}
.cw-face {
  position: absolute; inset: 5px; border-radius: 50%; overflow: hidden;
  background: var(--line);
}
.cw-face-init {
  display: grid; place-items: center; background: var(--ink); color: var(--paper);
  font-size: .8rem; font-weight: 500;
}
.cw-name { font-size: .95rem; flex: 1; }
.cw-status { font-size: .78rem; color: var(--ink-soft); font-variant-numeric: tabular-nums; }

/* the room — visible only when the crew card is focused */
.crew-room { display: none; }
#crew-card.focused .crew-room { display: block; overflow-y: auto; flex: 1; padding-top: .4rem; }
#crew-card.focused .crew-list { flex: none; }
.room-note {
  font-size: .74rem; color: var(--ink-faint); text-align: center;
  padding: .5rem 0 .8rem; border-top: 1.5px solid var(--line);
}
.room-sec { padding: .3rem 0 .9rem; }
.room-who { font-size: .88rem; margin-bottom: .5rem; }
.room-who b { font-weight: 500; }
.room-who span { color: var(--ink-soft); font-size: .78rem; }
.room-item { margin-bottom: .5rem; }
.room-tile { width: 132px; height: 132px; }
.room-meta { font-size: .76rem; color: var(--ink-soft); margin: .35rem 0 .2rem; }
.room-empty { font-size: .82rem; color: var(--ink-faint); padding-bottom: .5rem; }
.rx-bar { display: flex; gap: .4rem; margin-top: .35rem; }
.rx-chip {
  border: 1.5px solid var(--line); background: none; color: var(--ink);
  border-radius: 999px; padding: .22rem .6rem; font-size: .8rem;
  font-family: inherit; cursor: pointer; display: flex; gap: .25rem; align-items: center;
  transition: border-color .25s, background .25s, transform .35s var(--ease-spring);
}
.rx-chip b { font-weight: 500; font-variant-numeric: tabular-nums; }
.rx-chip.hot { border-color: var(--ink); background: var(--ink); color: var(--paper); }
.rx-chip.pop { animation: popIn .45s var(--ease-spring); }
.rx-chip:hover { border-color: var(--ink); }

/* ---------- what's new ---------- */

.wn {
  position: fixed; inset: 0; z-index: 85;
  background: rgb(0 0 0 / .45); backdrop-filter: blur(7px);
  display: grid; place-items: center; padding: 1.4rem;
  opacity: 0; transition: opacity .32s var(--ease-out);
}
.wn.open { opacity: 1; }
.wn-card {
  background: var(--card); border-radius: var(--r); box-shadow: var(--shadow);
  width: min(420px, 100%); padding: 1.5rem 1.5rem 1.1rem; text-align: center;
  transform: translateY(26px) scale(.94);
  transition: transform .55s cubic-bezier(.22, 1.2, .36, 1);
}
.wn.open .wn-card { transform: none; }
.wn-visual { height: 128px; position: relative; margin-bottom: 1rem; }
.wn-v {
  position: absolute; inset: 0; display: grid; place-items: center;
  opacity: 0; transform: scale(.9); pointer-events: none;
  transition: opacity .4s, transform .5s var(--ease-spring);
}
.wn-v.on { opacity: 1; transform: none; }
.wn-cam { width: 168px; height: 116px; border-radius: 18px; overflow: hidden; position: relative; }
@supports (corner-shape: squircle) { .wn-cam { corner-shape: squircle; border-radius: 24px; } }
.wn-cam img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.wn-shutter {
  position: absolute; bottom: 9px; left: 50%; transform: translateX(-50%);
  width: 30px; height: 30px; border-radius: 50%; border: 2.5px solid #fff;
  display: grid; place-items: center;
}
.wn-shutter i { width: 21px; height: 21px; border-radius: 50%; background: #fff; display: block; }
.wn-stage {
  width: 168px; height: 116px; background: var(--paper); border-radius: 16px;
  border: 1.5px solid var(--line); display: grid; place-items: center; overflow: hidden;
}
.wn-mini {
  background: var(--card); border-radius: 10px; box-shadow: var(--shadow);
  width: 70px; padding: .5rem .55rem; text-align: left;
  animation: wnGrow 2.6s var(--ease-spring) infinite alternate;
}
@keyframes wnGrow { 0%, 25% { width: 70px; } 70%, 100% { width: 138px; } }
.wn-mini-head { font-size: .52rem; font-weight: 500; display: flex; justify-content: space-between; margin-bottom: .3rem; }
.wn-mini-head span { color: var(--ink-soft); }
.wn-mini-line { height: 4px; border-radius: 2px; background: var(--line); margin: .24rem 0; }
.wn-mini-line.short { width: 60%; }
.wn-crew-vis { display: flex; gap: .7rem; }
.wn-crew-vis .cw-av { width: 56px; height: 56px; }
.wn-notif {
  display: flex; gap: .6rem; align-items: center; text-align: left;
  background: var(--paper); border: 1.5px solid var(--line); border-radius: 18px;
  padding: .7rem .85rem; font-size: .8rem; line-height: 1.4; max-width: 250px;
}
.wn-notif b { font-weight: 500; }
.wn-nic {
  width: 34px; height: 34px; flex: none; border-radius: 9px;
  background: var(--ink); display: grid; place-items: center;
}
.wn-nring { width: 16px; height: 16px; border-radius: 50%; border: 2.5px solid var(--paper); position: relative; }
.wn-nring::after { content: ""; position: absolute; inset: 2.5px; border-radius: 50%; background: var(--paper); }
.wn-card h3 { font-size: 1.25rem; font-weight: 500; letter-spacing: -.01em; margin-bottom: .35rem; }
.wn-card p { font-size: .86rem; color: var(--ink-soft); line-height: 1.5; min-height: 4em; margin-bottom: .5rem; }
.wn-dots { display: flex; gap: .4rem; justify-content: center; margin-bottom: 1rem; }
.wn-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--ink-faint); transition: background .3s, transform .3s; }
.wn-dot.on { background: var(--ink); transform: scale(1.25); }
.wn-btn {
  width: 100%; background: var(--ink); color: var(--paper); border: none;
  border-radius: 999px; padding: .7rem; font-family: inherit; font-size: .95rem;
  font-weight: 500; cursor: pointer;
  transition: transform .35s var(--ease-spring);
}
.wn-btn:active { transform: scale(.96); }
.wn-skip {
  background: none; border: none; color: var(--ink-faint); font-family: inherit;
  font-size: .8rem; cursor: pointer; margin-top: .6rem; padding: .3rem;
  transition: color .2s;
}
.wn-skip:hover { color: var(--ink-soft); }

/* eyebrow tab peeking from behind the announcement card */
.wn-card { position: relative; }
.wn-eyebrow {
  position: absolute; top: 4px; left: 50%; z-index: -1;
  transform: translate(-50%, 0);
  background: #ffffff; color: #121212;
  font-size: .72rem; font-weight: 500; letter-spacing: .05em;
  white-space: nowrap;
  padding: .4rem 1.15rem 1rem;
  border-radius: 14px 14px 0 0;
  box-shadow: 0 -8px 24px rgb(0 0 0 / .10);
  transition: transform .65s cubic-bezier(.22, 1.2, .36, 1) .45s;
}
.wn.open .wn-eyebrow { transform: translate(-50%, -84%); }

/* ---------- proof gallery ---------- */

.proof-peek { display: flex; gap: .6rem; padding: .2rem 0; }
.peek-tile { width: 72px; height: 72px; }
.proof-gallery { display: none; }
#proof-card.focused .proof-gallery { display: block; overflow-y: auto; flex: 1; }
#proof-card.focused .proof-peek { display: none; }
#proof-card.focused #proof-empty { display: none; }
.proof-nav { display: flex; align-items: center; justify-content: center; gap: 1rem; padding: .4rem 0 .7rem; }
.proof-month { font-size: .98rem; font-weight: 500; min-width: 160px; text-align: center; }
.proof-filters { display: flex; gap: .45rem; flex-wrap: wrap; justify-content: center; padding-bottom: .8rem; }
.pf-chip {
  border: 1.5px solid var(--line); background: none; color: var(--ink-soft);
  border-radius: 999px; padding: .25rem .85rem; font-size: .78rem;
  font-family: inherit; cursor: pointer; max-width: 180px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: border-color .25s, background .25s, color .25s, transform .35s var(--ease-spring);
}
.pf-chip:hover { border-color: var(--ink); color: var(--ink); }
.pf-chip.cur { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.proof-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  gap: 10px; padding-bottom: 1rem;
}
.proof-tile { position: relative; width: 100%; height: auto; aspect-ratio: 1; }
.proof-day {
  position: absolute; right: 8px; bottom: 6px; color: #fff;
  font-size: .7rem; font-weight: 500; font-variant-numeric: tabular-nums;
  text-shadow: 0 1px 5px rgb(0 0 0 / .55);
}

/* ---------- app toast ---------- */
.app-toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%);
  background: var(--ink); color: var(--paper);
  border-radius: 999px; padding: .6rem 1.2rem; font-size: .86rem; font-weight: 500;
  box-shadow: var(--shadow); z-index: 90; max-width: 90vw; text-align: center;
  animation: toastIn .5s var(--ease-spring) both;
}
.app-toast.leaving { animation: toastOut .35s var(--ease-out) both; }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 20px); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes toastOut { to { opacity: 0; transform: translate(-50%, 14px); } }

/* crew empty + create */
.crew-empty { padding: .8rem 0 .3rem; text-align: center; }
.crew-empty p { font-size: .82rem; color: var(--ink-soft); line-height: 1.5; margin-bottom: .85rem; }
.crew-cta {
  background: var(--ink); color: var(--paper); border: none; border-radius: 999px;
  padding: .55rem 1.2rem; font-family: inherit; font-size: .87rem; font-weight: 500;
  cursor: pointer; transition: transform .35s var(--ease-spring);
}
.crew-cta:active { transform: scale(.94); }
.room-leave {
  display: block; margin: .4rem auto 1rem; background: none; border: none;
  color: var(--ink-faint); font-family: inherit; font-size: .78rem; cursor: pointer;
  transition: color .2s;
}
.room-leave:hover { color: var(--ink-soft); }

/* capture-time visibility: room or just me */
.cam-vis {
  display: flex; justify-content: center; gap: .4rem; padding: .7rem 0 0;
}
.cam-vis-opt {
  background: none; border: 1.5px solid rgb(255 255 255 / .3);
  color: rgb(255 255 255 / .75); border-radius: 999px;
  padding: .3rem .95rem; font-family: inherit; font-size: .8rem; font-weight: 500;
  cursor: pointer; transition: background .25s, color .25s, border-color .25s;
}
.cam-vis-opt.on { background: #fff; border-color: #fff; color: #121212; }
