:root {
  --cream: #F4EFE2;
  --espresso: #3D2B1F;
  --muted: #6A5748;
  --border: #D4CBB8;
  --secondary: #E8E0CE;
  --sage: #566E59;
  --terracotta: #9E5338;
  --navy: #465973;
  --ochre: #B3843E;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --header-h: 64px;
  --tap: 48px;
  --font-display: "Fraunces", "Times New Roman", serif;
  --font-body: "Source Serif 4", "Times New Roman", serif;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --pop: cubic-bezier(0.2, 1.4, 0.3, 1);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; min-height: 100%; overflow-x: hidden; overflow-x: clip; max-width: 100%; }
html { background: var(--cream); }
body {
  background: var(--cream);
  color: var(--espresso);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: contain;
}

button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; }
img { display: block; }

.app {
  min-height: 100dvh;
  padding-left: max(16px, var(--safe-left));
  padding-right: max(16px, var(--safe-right));
  padding-bottom: calc(96px + var(--safe-bottom));
}

.top {
  position: sticky;
  top: 0;
  z-index: 30;
  margin-left: calc(-1 * max(16px, var(--safe-left)));
  margin-right: calc(-1 * max(16px, var(--safe-right)));
  padding: calc(10px + var(--safe-top)) max(16px, var(--safe-right)) 10px max(16px, var(--safe-left));
  background: color-mix(in srgb, var(--cream) 92%, transparent);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--border);
}

.eyebrow {
  margin: 0;
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

.brand-block {
  min-width: 0;
  flex: 1 1 auto;
}

.brand-seal {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  margin-right: 18px;
}

@media (min-width: 400px) {
  .brand-seal { width: 50px; height: 50px; }
}

/* Brand kit 1.3: the script wordmark is never shown under 120px wide
   (2.584:1, so 47px tall = 121px). The H seal keeps clear space x (0.3848 x 47 = 18px). */
.wordmark {
  display: block;
  height: 47px;
  width: auto;
  min-width: 120px;
  margin: 0 0 4px;
}

.top h1 {
  margin: 2px 0 0;
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.05;
}

@media (min-width: 400px) {
  .wordmark { height: 50px; }
  .top h1 { font-size: 26px; }
}

.icon-btn {
  min-width: var(--tap);
  min-height: var(--tap);
  border: 1.5px solid var(--espresso);
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-size: 22px;
  line-height: 1;
  background: var(--cream);
  transition: transform 0.18s var(--pop), background 0.18s var(--ease);
}
.icon-btn:active { transform: scale(0.94); background: var(--secondary); }

.sign-wrap {
  width: min(100%, 340px);
  margin: 10px auto 2px;
  position: relative;
  --progress: 0;
  --glow: 0.22;
  --breath-scale: 1;
  --breath-glow: 0.3;
  transform-origin: center center;
  will-change: transform;
}
.sign-wrap.is-static { transform: none; will-change: auto; }
.sign-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  perspective: 640px;
  transform-style: preserve-3d;
  will-change: transform;
}
.sign-glow {
  position: absolute;
  inset: -14%;
  border-radius: 50%;
  pointer-events: none;
  background: radial-gradient(circle at 50% 50%,
    rgba(179, 132, 62, 0.55) 0%,
    rgba(86, 110, 89, 0.32) 40%,
    transparent 70%);
  z-index: 0;
  transform-origin: center center;
  will-change: transform, opacity;
}
.sign-wrap.motion-full {
  animation: sign-breath-scale 3s ease-in-out infinite;
  transform-origin: center center;
}
.sign-wrap.motion-full .sign-glow,
.sign-wrap.motion-calm .sign-glow {
  animation: sign-breath-glow 3s ease-in-out infinite;
}
.sign-wrap.motion-off,
.sign-wrap.is-static {
  animation: none;
  transform: none;
}
.sign-wrap.motion-off .sign-glow,
.sign-wrap.is-static .sign-glow {
  animation: none;
  opacity: 0.4;
}
@keyframes sign-breath-scale {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.04); }
}
@keyframes sign-breath-glow {
  0%, 100% { opacity: 0.4; transform: scale(0.96); }
  50% { opacity: 1; transform: scale(1.12); }
}
.sign-fx {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
  z-index: 1;
}
.sign-hit-ring {
  position: absolute;
  inset: 28%;
  border-radius: 50%;
  z-index: 3;
  background: transparent;
  border: 0;
  cursor: pointer;
}
.sign-hit-ring:focus-visible {
  outline: 2px solid var(--espresso);
  outline-offset: 2px;
}
.sign-bulbs { position: absolute; inset: 0; z-index: 4; pointer-events: none; }
.bulb-hit {
  position: absolute;
  width: 28px;
  height: 28px;
  margin: -14px 0 0 -14px;
  border-radius: 50%;
  pointer-events: auto;
  background: transparent;
  border: 0;
  cursor: pointer;
}
.bulb-hit:focus-visible {
  outline: 2px solid var(--espresso);
  outline-offset: 1px;
}
.sign-center {
  position: absolute;
  inset: 26%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  pointer-events: none;
  color: var(--espresso);
  z-index: 2;
}
.sign-center::before {
  content: "";
  position: absolute;
  inset: 6%;
  background: radial-gradient(circle, rgba(244,239,226,0.92) 0%, rgba(244,239,226,0.62) 58%, transparent 78%);
  z-index: -1;
  pointer-events: none;
}
.sign-center .pct {
  font-family: var(--font-display);
  font-size: clamp(36px, 12vw, 52px);
  font-weight: 600;
  letter-spacing: -0.04em;
  line-height: 1;
}
.sign-center .count,
.sign-center .days {
  font-family: var(--font-display);
  font-size: 12px;
  letter-spacing: 0.04em;
  margin-top: 5px;
  color: var(--muted);
}
.sign-center .days { font-weight: 600; color: var(--espresso); }

.bars { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; margin: 8px 0 4px; }
.bar-row {
  width: 100%;
  padding: 6px 4px 4px;
  border-radius: 12px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.2s var(--ease), border-color 0.2s var(--ease), box-shadow 0.3s var(--ease);
}
.bar-row:active { transform: scale(0.98); }
.bar-row.is-active {
  border-color: var(--espresso);
  background: color-mix(in srgb, var(--secondary) 70%, var(--cream));
}
.bar-row.is-complete .bar-track {
  box-shadow: 0 0 10px color-mix(in srgb, var(--bar-color) 75%, transparent);
}
.bar-row.is-complete .bar-fill {
  animation: bar-glow 1.8s ease-in-out infinite;
}
.bar-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 4px;
  font-family: var(--font-display);
}
.bar-track {
  height: 8px;
  width: 100%;
  background: var(--secondary);
  border-radius: 999px;
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  border-radius: 999px;
  width: 0;
  transition: width 0.45s var(--ease);
}

.filters {
  position: sticky;
  top: calc(var(--safe-top) + 62px);
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 0;
  margin: 4px calc(-1 * max(16px, var(--safe-left))) 0;
  padding-left: max(16px, var(--safe-left));
  padding-right: max(16px, var(--safe-right));
  background: var(--cream);
}

.chip {
  min-height: 40px;
  padding: 0 16px;
  border: 1.5px solid var(--espresso);
  border-radius: 999px;
  background: transparent;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  transition: transform 0.16s var(--pop), background 0.16s var(--ease), color 0.16s var(--ease);
}
.chip[aria-pressed="true"] { background: var(--espresso); color: var(--cream); }
.chip:active { transform: scale(0.96); }

.section { margin: 8px 0 18px; }
.section-head {
  width: 100%;
  min-height: var(--tap);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  text-align: left;
  padding: 8px 0;
  border-bottom: 2px solid var(--espresso);
}
.section-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 22px;
  letter-spacing: -0.03em;
  line-height: 1.15;
  flex: 1;
}
.section-count {
  font-size: 13px;
  color: var(--muted);
  font-family: var(--font-display);
  white-space: nowrap;
}
.chev {
  width: 20px;
  transition: transform 0.2s var(--ease);
}
.section[data-open="false"] .chev { transform: rotate(-90deg); }
.section[data-open="false"] .section-body { display: none; }
.blurb {
  margin: 8px 0 4px;
  color: var(--muted);
  font-size: 14px;
}

.item {
  display: flex;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  align-items: flex-start;
}
.check {
  flex: 0 0 var(--tap);
  width: var(--tap);
  height: var(--tap);
  margin: -4px 0 0 -6px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  transition: transform 0.18s var(--pop);
}
.check:active { transform: scale(0.9); }
.check-box {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  border: 2px solid var(--espresso);
  background: transparent;
  display: grid;
  place-items: center;
  transition: background 0.18s var(--ease), border-color 0.18s var(--ease), transform 0.22s var(--pop);
}
.item.is-done .check-box { transform: scale(1.06); }
.check-box svg { opacity: 0; transform: scale(0.6); transition: opacity 0.16s var(--ease), transform 0.22s var(--pop); }
.item.is-done .check-box svg { opacity: 1; transform: scale(1); }
.item-text {
  flex: 1;
  min-width: 0;
  padding-top: 8px;
}
.item-title { margin: 0; }
.item.is-done .item-title { text-decoration: line-through; opacity: 0.7; }
.item-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
  align-items: center;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  font-family: var(--font-display);
}
.field input, .field select, .sheet input, .sheet select, .sheet textarea {
  min-height: 44px;
  min-width: 0;
  width: 132px;
  padding: 0 10px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: var(--cream);
  text-transform: none;
  letter-spacing: 0;
  font-size: 15px;
  color: var(--espresso);
}
.due-label { font-size: 13px; color: var(--muted); font-family: var(--font-display); text-transform: none; letter-spacing: 0; }
.remove {
  min-height: 44px;
  padding: 0 8px;
  color: var(--muted);
  font-size: 14px;
  text-decoration: underline;
}

.fab {
  position: fixed;
  right: max(16px, var(--safe-right));
  bottom: calc(18px + var(--safe-bottom));
  z-index: 40;
  min-height: 52px;
  padding: 0 22px;
  border-radius: 999px;
  background: var(--terracotta);
  color: var(--cream);
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 600;
  box-shadow: 0 8px 20px rgba(61, 43, 31, 0.22);
  transition: transform 0.18s var(--pop);
}
.fab:active { transform: scale(0.96); }

.scrim {
  position: fixed;
  inset: 0;
  background: rgba(61, 43, 31, 0.4);
  z-index: 50;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s var(--ease);
}
.scrim.open { opacity: 1; pointer-events: auto; }

.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 60;
  background: var(--cream);
  border-top: 2px solid var(--espresso);
  border-radius: 20px 20px 0 0;
  padding: 12px 20px calc(20px + var(--safe-bottom));
  transform: translateY(110%);
  transition: transform 0.28s var(--ease);
  max-height: 88dvh;
  overflow: auto;
}
.sheet.open { transform: translateY(0); }
.sheet h2 {
  font-family: var(--font-display);
  margin: 8px 0 14px;
  font-size: 24px;
  letter-spacing: -0.03em;
}
.sheet .grab {
  width: 40px;
  height: 4px;
  background: var(--border);
  border-radius: 4px;
  margin: 0 auto 8px;
}
.sheet label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
  font-family: var(--font-display);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.sheet input, .sheet select, .sheet textarea { width: 100%; }
.sheet textarea { padding: 10px; resize: vertical; min-height: 88px; }
.row-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
.btn {
  min-height: 48px;
  padding: 0 18px;
  border-radius: 999px;
  border: 1.5px solid var(--espresso);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 16px;
  flex: 1 1 140px;
  transition: transform 0.16s var(--pop);
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--espresso); color: var(--cream); }
.btn-quiet { background: transparent; }

.menu-list { display: flex; flex-direction: column; gap: 8px; }
.menu-list .btn { flex: none; width: 100%; }

.celebrate {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(244, 239, 226, 0.88);
  text-align: center;
  padding: 24px;
}
.celebrate.open { display: flex; flex-direction: column; }
.celebrate h2 {
  font-family: var(--font-display);
  font-size: 40px;
  letter-spacing: -0.04em;
  margin: 0 0 8px;
  animation: pop-in 0.5s var(--pop);
}
.celebrate p { margin: 0 0 20px; color: var(--muted); }
.burst {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}
.spark {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  animation: spark 1s var(--ease) forwards;
}

@keyframes pop-in {
  from { transform: scale(0.7); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
@keyframes spark {
  0% { transform: translate(0, 0) scale(0.6); opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) scale(0.2); opacity: 0; }
}
@keyframes flash-wedge {
  0%, 100% { opacity: var(--base-op, 0.2); }
  50% { opacity: 0.55; }
}
.flashing { animation: flash-wedge 0.7s var(--ease) 2; }

.color-bar {
  display: flex;
  height: 5px;
  margin-left: calc(-1 * max(16px, var(--safe-left)));
  margin-right: calc(-1 * max(16px, var(--safe-right)));
}
.color-bar span { flex: 1; }
.note {
  margin: 8px 0 0;
  padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--muted);
}

.sync-bar {
  margin: 10px 0 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
}
.who-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--espresso);
  background: var(--secondary);
  color: var(--espresso);
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1.4;
}
.who-badge.live {
  background: var(--espresso);
  color: var(--cream);
  border-color: var(--espresso);
}
.item-note {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.4;
}
.activity {
  margin: 12px 0 4px;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  background: color-mix(in srgb, var(--secondary) 55%, var(--cream));
}
.activity h2 {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
.activity ol {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.activity li {
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.activity li:last-child { padding-bottom: 0; border-bottom: 0; }
.activity-line {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
}
.activity-meta {
  font-size: 13px;
  color: var(--muted);
}
.activity-note {
  display: block;
  margin-top: 2px;
  font-size: 13px;
  color: var(--espresso);
}

.top-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.actor-btn {
  min-height: var(--tap);
  padding: 0 14px;
  border: 1.5px solid var(--espresso);
  border-radius: 999px;
  background: var(--cream);
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
  transition: transform 0.18s var(--pop), background 0.18s var(--ease);
}
.actor-btn:active { transform: scale(0.94); background: var(--secondary); }
.sheet-copy {
  margin: 0 0 14px;
  font-size: 15px;
  color: var(--muted);
  text-transform: none;
  letter-spacing: 0;
}
.actor-choices {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}
.actor-choices .btn { flex: 1 1 90px; }
.actor-choice[aria-pressed="true"],
.actor-choice.btn-primary { background: var(--espresso); color: var(--cream); }

@keyframes bar-glow {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.18); }
}

.live-toast-stack {
  position: fixed;
  left: 50%;
  bottom: calc(78px + var(--safe-bottom));
  transform: translateX(-50%);
  z-index: 85;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(360px, calc(100% - 32px));
  pointer-events: none;
}
.live-toast {
  background: var(--espresso);
  color: var(--cream);
  border-radius: 16px;
  padding: 12px 16px;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.3;
  box-shadow: 0 10px 28px rgba(61, 43, 31, 0.32);
  border-left: 5px solid var(--ochre);
  animation: toast-in 0.4s var(--pop);
}
.live-toast.is-out { animation: toast-out 0.28s var(--ease) forwards; }
.live-toast .toast-who { color: var(--ochre); }

@keyframes toast-in {
  from { transform: translateY(12px) scale(0.96); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}
@keyframes toast-out {
  to { transform: translateY(8px) scale(0.96); opacity: 0; }
}

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 0 0 16px;
}
.stat-card {
  background: var(--secondary);
  border-radius: 14px;
  padding: 12px 14px;
}
.stat-card .stat-label {
  margin: 0;
  font-family: var(--font-display);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
.stat-card .stat-value {
  margin: 4px 0 0;
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.04em;
  line-height: 1;
}
.stats-people { margin: 0 0 8px; padding: 0; list-style: none; }
.stats-people li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-family: var(--font-display);
}
.stats-people li:last-child { border-bottom: 0; }
.sheet-lede {
  margin: -4px 0 14px;
  color: var(--muted);
  font-size: 15px;
  text-transform: none;
  letter-spacing: 0;
}

@media (prefers-reduced-motion: reduce) {
  /* Sign motion is owned by the Motion menu (defaults to Calm, not Off). */
  .bar-row.is-complete .bar-fill { animation: none; }
}

.activity-toggle {
  width: 100%;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  text-align: left;
  padding: 0;
}
.activity-toggle h2 { margin: 0; }
.activity-toggle-meta {
  font-family: var(--font-display);
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}
.activity { padding: 10px 14px; }

.motion-choices { margin-bottom: 16px; }
.app-version-label {
  margin: 0 0 14px;
  font-size: 13px;
  color: var(--muted);
  text-transform: none;
  letter-spacing: 0;
}
