/* ---------- Tokens ---------- */
:root {
  --bg: #FFF8E7;            /* warm cream */
  --bg-soft: #FFEFC2;       /* warm wash */
  --ink: #1A1410;           /* warm near-black */
  --ink-2: #4A3F33;         /* secondary ink */
  --ink-3: #8A7F70;         /* tertiary */
  --line: rgba(26, 20, 16, 0.10);
  --line-strong: rgba(26, 20, 16, 0.18);
  --sun: #FFD43B;           /* sun yellow */
  --sun-deep: #F5B800;      /* deeper sun */
  --rose: #FF6B6B;          /* no/love accent */
  --leaf: #2F8F4E;          /* yes accent */
  --paper: #FFFDF7;
  --shadow-sm: 0 2px 0 rgba(26, 20, 16, 0.08);
  --shadow-md: 0 8px 28px -10px rgba(26, 20, 16, 0.18), 0 2px 0 rgba(26, 20, 16, 0.06);
  --shadow-lg: 0 24px 50px -20px rgba(26, 20, 16, 0.30), 0 2px 0 rgba(26, 20, 16, 0.08);
  --radius-card: 22px;
  --radius-sm: 10px;
}

* { box-sizing: border-box; }

html, body, #root {
  height: 100%;
  margin: 0;
  background: #1a1410;
}

body {
  font-family: 'Archivo', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.mono {
  font-family: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  letter-spacing: 0.02em;
  font-size: 11px;
  text-transform: lowercase;
}

/* ---------- App shell (mobile viewport) ---------- */
#root {
  display: grid;
  place-items: center;
  background: #1a1410;
  padding: 0;
  min-height: 100vh;
}

.app {
  width: 100%;
  max-width: 420px;
  height: 100vh;
  max-height: 920px;
  background: var(--bg);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 0 80px rgba(0,0,0,0.5);
}

@media (min-width: 480px) {
  .app {
    border-radius: 28px;
    margin: 24px 0;
    height: calc(100vh - 48px);
  }
}

/* ---------- Topbar ---------- */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 22px 10px;
  flex-shrink: 0;
}

.brand { display: flex; gap: 12px; align-items: center; }

.brand-mark {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--sun);
  display: grid; place-items: center;
  position: relative;
  box-shadow: 0 0 0 2px var(--ink) inset, 3px 3px 0 var(--ink);
}
.brand-sun {
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--ink);
}

.brand-row1 {
  font-family: 'Fraunces', 'Georgia', serif;
  font-weight: 600;
  font-style: italic;
  font-size: 22px;
  line-height: 1;
  letter-spacing: -0.02em;
}
.brand-row2 {
  color: var(--ink-3);
  margin-top: 3px;
}

.counter {
  background: var(--ink);
  color: var(--bg);
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

/* ---------- Progress ---------- */
.progress {
  height: 4px;
  background: var(--line);
  margin: 0 22px;
  border-radius: 999px;
  overflow: hidden;
  flex-shrink: 0;
}
.progress-fill {
  height: 100%;
  background: var(--ink);
  transition: width 320ms cubic-bezier(.2,.7,.2,1);
}

/* ---------- Stage ---------- */
.stage {
  flex: 1;
  position: relative;
  padding: 16px 22px 8px;
  min-height: 0;
  display: flex;
  align-items: stretch;
  user-select: none;
  -webkit-user-select: none;
  touch-action: pan-y;
}

.card-peek {
  position: absolute;
  top: 22px; left: 28px; right: 28px;
  bottom: 16px;
  transform: scale(0.96) translateY(8px);
  opacity: 0.4;
  pointer-events: none;
  filter: blur(0.5px);
}
.card-peek .card-body { display: none; }
.card-peek .hero {
  height: 100%;
  border-radius: var(--radius-card);
}

.card-wrap {
  position: relative;
  flex: 1;
  display: flex;
  cursor: grab;
  transition: transform 220ms cubic-bezier(.2,.7,.2,1), opacity 220ms ease;
}
.card-wrap:active { cursor: grabbing; }

/* ---------- Card ---------- */
.card {
  flex: 1;
  background: var(--paper);
  border-radius: var(--radius-card);
  border: 1.5px solid var(--ink);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 280ms cubic-bezier(.4,.0,.2,1), opacity 280ms ease;
}

.phase-out-right {
  transform: translateX(420px) rotate(2deg);
  opacity: 0;
}
.phase-out-left {
  transform: translateX(-420px) rotate(-2deg);
  opacity: 0;
}
.phase-in {
  transform: translateY(20px) scale(0.97);
  opacity: 0;
}

/* ---------- Hero ---------- */
.hero {
  height: 44%;
  min-height: 200px;
  position: relative;
  border-bottom: 1.5px solid var(--ink);
  overflow: hidden;
  flex-shrink: 0;
}

.hero-stripes {
  background: oklch(85% 0.12 var(--hue));
}
.hero-stripes .stripes {
  position: absolute; inset: 0;
  background-image: repeating-linear-gradient(
    -45deg,
    transparent 0,
    transparent 14px,
    oklch(78% 0.14 var(--hue)) 14px,
    oklch(78% 0.14 var(--hue)) 22px
  );
  opacity: 0.85;
}

.hero-image {
  background: oklch(75% 0.10 var(--hue));
}
.hero-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.hero-image-tint {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 55%, rgba(26,20,16,0.22));
  pointer-events: none;
}

.hero-photo {
  background: oklch(72% 0.10 var(--hue));
}
.hero-photo .photo-wash {
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 80% 50% at 30% 20%, oklch(88% 0.12 calc(var(--hue) + 30)) 0%, transparent 60%),
    radial-gradient(ellipse 70% 60% at 70% 80%, oklch(58% 0.14 calc(var(--hue) - 20)) 0%, transparent 65%),
    linear-gradient(160deg, oklch(70% 0.12 var(--hue)), oklch(55% 0.14 calc(var(--hue) + 10)));
}
.hero-photo .photo-grain {
  position: absolute; inset: 0;
  background-image:
    radial-gradient(rgba(255,255,255,0.06) 1px, transparent 1px),
    radial-gradient(rgba(0,0,0,0.05) 1px, transparent 1px);
  background-size: 3px 3px, 5px 5px;
  background-position: 0 0, 1px 2px;
  mix-blend-mode: overlay;
}

.hero-meta {
  position: absolute;
  left: 14px; bottom: 12px;
  background: rgba(255, 253, 247, 0.92);
  border: 1px solid var(--ink);
  padding: 4px 8px;
  border-radius: 6px;
  color: var(--ink);
  font-weight: 500;
  white-space: nowrap;
}

/* ---------- Card body ---------- */
.card-body {
  padding: 18px 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.pill {
  font-size: 11px;
  font-weight: 600;
  padding: 4px 9px;
  border-radius: 999px;
  border: 1.2px solid var(--ink);
  background: var(--paper);
  color: var(--ink);
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.pill-aud { background: var(--sun); }
.pill-aud.aud-couple { background: #FFC0D9; }
.pill-aud.aud-mom-solo { background: #B5E3FF; }
.pill-aud.aud-flex { background: #C9E8B5; }

.pill-price {
  background: var(--paper);
  color: var(--ink);
}
.pill-drive {
  background: transparent;
  color: var(--ink-2);
  border-color: var(--line-strong);
}
.pill-sm {
  font-size: 10px;
  padding: 3px 7px;
}

.card-title {
  font-family: 'Archivo', sans-serif;
  font-weight: 800;
  font-size: 26px;
  line-height: 1.08;
  letter-spacing: -0.02em;
  margin: 0;
  text-wrap: balance;
}

.title-row {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  justify-content: space-between;
}
.title-row .card-title {
  flex: 1;
  min-width: 0;
}

.dt-block {
  flex-shrink: 0;
  text-align: right;
  background: var(--sun);
  border: 1.5px solid var(--ink);
  border-radius: 12px;
  padding: 7px 10px 8px;
  box-shadow: 2px 2px 0 var(--ink);
  min-width: 96px;
}
.dt-block .dt-date {
  font-family: 'Archivo', sans-serif;
  font-weight: 800;
  font-size: 14px;
  letter-spacing: -0.01em;
  white-space: nowrap;
  line-height: 1.1;
  text-transform: uppercase;
}
.dt-block .dt-time {
  font-weight: 700;
  font-size: 13px;
  color: var(--ink);
  margin-top: 3px;
  white-space: nowrap;
  line-height: 1.1;
}

.loc-row {
  border-top: 1px dashed var(--line-strong);
  border-bottom: 1px dashed var(--line-strong);
  padding: 9px 0;
  gap: 6px;
  flex-wrap: nowrap;
  font-size: 13px;
  min-width: 0;
}
.loc-pin { color: var(--ink-2); flex-shrink: 0; }
.loc-venue {
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.loc-sep { color: var(--ink-3); flex-shrink: 0; }
.loc-city {
  color: var(--ink-2);
  white-space: nowrap;
  flex-shrink: 0;
}

.why {
  margin: 0;
  font-family: 'Fraunces', 'Georgia', serif;
  font-size: 15px;
  line-height: 1.4;
  color: var(--ink);
  font-weight: 400;
  text-wrap: pretty;
}

.source {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-2);
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: auto;
  padding-top: 4px;
}
.source:hover { color: var(--ink); }

/* ---------- Hints (during drag) ---------- */
.hint {
  position: absolute;
  top: 30px;
  font-family: 'Archivo', sans-serif;
  font-weight: 900;
  font-size: 28px;
  letter-spacing: 0.02em;
  padding: 10px 16px;
  border-radius: 10px;
  border: 3px solid currentColor;
  opacity: 0;
  pointer-events: none;
  transition: opacity 100ms ease;
}
.hint-yes {
  right: 24px;
  color: var(--leaf);
  transform: rotate(12deg);
  background: rgba(47, 143, 78, 0.08);
}
.hint-no {
  left: 24px;
  color: var(--rose);
  transform: rotate(-12deg);
  background: rgba(255, 107, 107, 0.08);
}

/* ---------- Actions ---------- */
.actions {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
  padding: 14px 36px 22px;
  flex-shrink: 0;
}

.action {
  width: 60px; height: 60px;
  border-radius: 50%;
  border: 1.5px solid var(--ink);
  background: var(--paper);
  display: grid; place-items: center;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform 120ms ease, box-shadow 120ms ease;
  color: var(--ink);
}
.action:hover { transform: translateY(-1px); box-shadow: 0 4px 0 rgba(26,20,16,0.10); }
.action:active { transform: translateY(1px); box-shadow: none; }

.action-no { justify-self: start; }
.action-no:hover { color: var(--rose); }

.action-yes {
  justify-self: end;
  background: var(--sun);
  color: var(--ink);
}

.action-hint {
  color: var(--ink-3);
  font-size: 10px;
  display: flex;
  gap: 8px;
  align-items: center;
}
.dot-sep { opacity: 0.5; }

/* ---------- Toast ---------- */
.toast {
  position: absolute;
  top: 66px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--bg);
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  z-index: 50;
  animation: toastIn 180ms ease;
  pointer-events: none;
  box-shadow: 0 6px 16px rgba(0,0,0,0.18);
}
@keyframes toastIn {
  from { opacity: 0; transform: translate(-50%, -8px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

/* ---------- Chip sheet ---------- */
.sheet-wrap {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 40;
}
.sheet-scrim {
  position: absolute;
  inset: 0;
  background: rgba(26, 20, 16, 0.35);
  opacity: 0;
  transition: opacity 240ms ease;
}
.sheet-wrap.open { pointer-events: auto; }
.sheet-wrap.open .sheet-scrim { opacity: 1; }

.sheet {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  background: var(--paper);
  border-top: 1.5px solid var(--ink);
  border-radius: 26px 26px 0 0;
  padding: 14px 22px 22px;
  transform: translateY(100%);
  transition: transform 280ms cubic-bezier(.2,.7,.2,1);
  box-shadow: 0 -10px 40px rgba(0,0,0,0.18);
}
.sheet-wrap.open .sheet { transform: translateY(0); }

.sheet-handle {
  width: 44px; height: 4px;
  background: var(--line-strong);
  border-radius: 99px;
  margin: 0 auto 14px;
}

.sheet-head h3 {
  margin: 0;
  font-family: 'Fraunces', serif;
  font-weight: 600;
  font-size: 22px;
  font-style: italic;
  letter-spacing: -0.01em;
}
.sheet-head p {
  margin: 4px 0 14px;
  color: var(--ink-2);
  font-size: 13px;
}

.chip-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: var(--paper);
  border: 1.5px solid var(--ink);
  border-radius: 14px;
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
  transition: all 140ms ease;
  box-shadow: var(--shadow-sm);
}
.chip:hover { transform: translateY(-1px); }
.chip.on {
  background: var(--sun);
  font-weight: 700;
}

.chip-check {
  width: 22px; height: 22px;
  border: 1.5px solid var(--ink);
  border-radius: 6px;
  display: grid; place-items: center;
  background: var(--paper);
  color: var(--ink);
  flex-shrink: 0;
}
.chip.on .chip-check { background: var(--ink); color: var(--sun); }

.chip-emoji { font-size: 18px; }
.chip-label { flex: 1; }

.sheet-foot {
  display: flex;
  gap: 10px;
  margin-top: 16px;
  align-items: stretch;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font: inherit;
  font-weight: 700;
  font-size: 14px;
  padding: 14px 18px;
  border-radius: 14px;
  border: 1.5px solid var(--ink);
  cursor: pointer;
  transition: all 140ms ease;
  background: var(--paper);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 4px 0 rgba(26,20,16,0.10); }
.btn:active { transform: translateY(1px); box-shadow: none; }

.btn-primary { background: var(--ink); color: var(--bg); flex: 1; }
.btn-primary.disabled,
.btn-primary[disabled] {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: var(--shadow-sm) !important;
}
.btn-ghost { background: transparent; box-shadow: none; }

.sheet-hint {
  margin-top: 10px;
  text-align: center;
  color: var(--ink-3);
}

.sheet-foot.single { justify-content: stretch; }
.btn.btn-block { width: 100%; flex: 1; }

/* Auto-advance progress bar — animates from 0% to 100% over AUTO_ADVANCE_MS */
.sheet-progress {
  margin-top: 12px;
  height: 3px;
  background: rgba(26, 20, 16, 0.08);
  border-radius: 999px;
  overflow: hidden;
}
.sheet-progress-fill {
  height: 100%;
  background: var(--ink);
  width: 0%;
  animation-name: sheetProgress;
  animation-timing-function: linear;
  animation-fill-mode: forwards;
}
@keyframes sheetProgress {
  from { width: 0%; }
  to { width: 100%; }
}

/* ---------- Summary ---------- */
.summary {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 28px 22px 22px;
  overflow-y: auto;
  background: var(--bg);
}

.summary-head {
  margin-bottom: 20px;
}
.summary-head .mono { color: var(--ink-3); }
.summary-head h1 {
  font-family: 'Fraunces', serif;
  font-weight: 600;
  font-style: italic;
  font-size: 36px;
  line-height: 1.05;
  letter-spacing: -0.025em;
  margin: 6px 0 6px;
  text-wrap: balance;
}
.summary-head p {
  margin: 0;
  color: var(--ink-2);
  font-size: 14px;
}

.summary-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 24px;
}

.day-block {
  background: var(--paper);
  border: 1.5px solid var(--ink);
  border-radius: 18px;
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
}
.day-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-3);
  font-weight: 600;
  margin-bottom: 10px;
}

.day-event {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 0;
  border-top: 1px dashed var(--line-strong);
  text-decoration: none;
  color: inherit;
  -webkit-tap-highlight-color: rgba(26, 20, 16, 0.06);
  transition: background 120ms ease, padding 120ms ease;
}
a.day-event { cursor: pointer; }
a.day-event:hover {
  background: rgba(26, 20, 16, 0.04);
  border-radius: 8px;
  padding-left: 8px;
  padding-right: 8px;
  margin-left: -8px;
  margin-right: -8px;
}
a.day-event:hover .day-event-arrow { opacity: 1; transform: translate(2px, -2px); }
.day-event:first-of-type { border-top: 0; padding-top: 0; }
.day-event-arrow {
  color: var(--ink-3);
  flex-shrink: 0;
  margin-top: 4px;
  opacity: 0.45;
  transition: opacity 140ms ease, transform 140ms ease;
}

.dot {
  width: 12px; height: 12px;
  border-radius: 50%;
  background: oklch(72% 0.14 var(--hue));
  border: 1.5px solid var(--ink);
  margin-top: 4px;
  flex-shrink: 0;
}

.day-event-body { flex: 1; min-width: 0; }
.day-event-title {
  font-weight: 700;
  font-size: 14px;
  line-height: 1.25;
  letter-spacing: -0.01em;
}
.day-event-meta {
  display: flex;
  gap: 6px;
  font-size: 12px;
  color: var(--ink-2);
  margin-top: 3px;
  flex-wrap: wrap;
}
.day-event-meta .sep { opacity: 0.5; }

.summary-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 18px;
}
.btn.big {
  padding: 16px 18px;
  font-size: 15px;
  flex-direction: row;
  justify-content: flex-start;
  gap: 12px;
  position: relative;
}
.btn.big .btn-icon {
  font-size: 22px;
  width: 28px;
  text-align: center;
}
.btn.big .btn-sub {
  font-size: 11px;
  font-weight: 500;
  opacity: 0.65;
  margin-left: auto;
  font-family: 'JetBrains Mono', monospace;
}
.btn-primary.big { background: var(--sun); color: var(--ink); border-color: var(--ink); box-shadow: 3px 3px 0 var(--ink); }
.btn-primary.big:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--ink); }
.btn-primary.big:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
.btn-secondary.big { background: var(--paper); box-shadow: 3px 3px 0 var(--ink); }
.btn-secondary.big:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--ink); }
.btn-secondary.big:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }

.link-btn {
  background: transparent;
  border: 0;
  font: inherit;
  font-size: 13px;
  color: var(--ink-2);
  cursor: pointer;
  padding: 8px;
  text-align: center;
  text-decoration: underline;
  text-underline-offset: 3px;
  align-self: center;
}
.link-btn:hover { color: var(--ink); }

.summary.empty {
  align-items: center;
  justify-content: center;
  text-align: center;
}
.summary.empty .summary-head { margin-bottom: 24px; }

/* ---------- Image preview overlay (mobile-friendly long-press-to-save) ---------- */
.image-preview-overlay {
  position: fixed;
  inset: 0;
  background: rgba(26, 20, 16, 0.92);
  z-index: 100;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 18px 12px 24px;
}
.image-preview-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  width: 100%;
  max-width: 420px;
}
.image-preview-hint {
  color: var(--bg);
  font-size: 11px;
  text-align: center;
  margin: 0;
  opacity: 0.9;
  padding: 6px 14px;
  background: rgba(255, 253, 247, 0.12);
  border-radius: 999px;
}
.image-preview-content img {
  max-width: 100%;
  height: auto;
  border-radius: 14px;
  display: block;
  background: var(--paper);
  border: 1.5px solid var(--ink);
  box-shadow: 0 16px 40px -8px rgba(0, 0, 0, 0.5);
  -webkit-touch-callout: default; /* allow iOS long-press menu on the image */
}
.image-preview-actions {
  display: flex;
  gap: 10px;
  width: 100%;
}
.image-preview-actions .btn { flex: 1; }
.image-preview-actions .btn-ghost.image-preview-close {
  background: transparent;
  color: var(--bg);
  border-color: rgba(255, 253, 247, 0.3);
  box-shadow: none;
}
.image-preview-actions .btn-ghost.image-preview-close:hover {
  background: rgba(255, 253, 247, 0.08);
}
