/* ─────────────────────────────────────────────────────────────────────────── */
/* Village Web — Corkboard Styles                                               */
/* ─────────────────────────────────────────────────────────────────────────── */

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

/* The hidden attribute must ALWAYS win. Author display rules (grid/flex/etc.)
   have equal-or-higher specificity than the UA [hidden]{display:none}, so
   toggling el.hidden silently fails on any styled element (gift options not
   cascading, upload showing under Money, tab bleed, etc.). This is the fix. */
[hidden] { display: none !important; }

:root {
  /* Cork board palette */
  --cork:        #C4A882;
  --cork-dark:   #A8895F;
  --cork-light:  #D4BC98;

  /* Warm neutrals */
  --sand:        #EAD9BF;
  --sand-deep:   #D4C8B0;
  --sand-light:  #F5EDD8;
  --paper:       #FFFEF9;

  /* Frame / wood */
  --frame:       #5C3D2E;
  --frame-mid:   #7A5040;
  --frame-text:  #FFF8EE;
  --frame-sub:   rgba(255, 248, 238, 0.65);

  /* Ink */
  --forest:      #1C3D2E;
  --forest-mid:  #2D6B4F;
  --ink:         #3B1A08;
  --ink-soft:    #5C3D2E;
  --ink-muted:   #7A6A58;
  --amber:       #B8621A;
  --amber-light: #FBF0E0;
  --white:       #FFFFFF;
  --border:      #E0D4BC;

  /* Type-specific */
  --labor-red:          #8B2020;
  --birth-gold:         #B8621A;
  --ultrasound-purple:  #6B4C8B;

  /* Shadows — lifted-paper look */
  --shadow:    3px 6px 20px rgba(0,0,0,0.25), 0 1px 3px rgba(0,0,0,0.15);
  --shadow-lg: 5px 10px 30px rgba(0,0,0,0.35), 0 2px 6px rgba(0,0,0,0.2);

  --radius:     8px;
  --font-serif: Georgia, 'Times New Roman', serif;
  --font-sans:  -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
}

html {
  scroll-behavior: smooth;
  /* Phase WEB-1: kill any horizontal rubber-band on mobile browsers. */
  overflow-x: hidden;
  max-width: 100vw;
}

/* ── Cork board background ──────────────────────────────────────────────────── */
body {
  overflow-x: hidden;
  max-width: 100vw;
  background-color: var(--cork);
  background-image:
    repeating-radial-gradient(circle at 18% 22%, transparent 0, transparent 2px,
      rgba(0,0,0,0.018) 2px, rgba(0,0,0,0.018) 4px),
    repeating-radial-gradient(circle at 76% 54%, transparent 0, transparent 3px,
      rgba(0,0,0,0.012) 3px, rgba(0,0,0,0.012) 5px),
    repeating-radial-gradient(circle at 42% 80%, transparent 0, transparent 2px,
      rgba(255,255,255,0.04) 2px, rgba(255,255,255,0.04) 4px);
  color: var(--ink);
  font-family: var(--font-sans);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ─────────────────────────────────────────────────────────────────────────── */
/* Password gate                                                                */
/* ─────────────────────────────────────────────────────────────────────────── */

#gate {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  min-height: 100vh;
  padding: 56px 24px 48px;
  gap: 28px;
  background-color: var(--cork);
  background-image:
    repeating-radial-gradient(circle at 18% 22%, transparent 0, transparent 2px,
      rgba(0,0,0,0.018) 2px, rgba(0,0,0,0.018) 4px),
    repeating-radial-gradient(circle at 76% 54%, transparent 0, transparent 3px,
      rgba(0,0,0,0.012) 3px, rgba(0,0,0,0.012) 5px);
}

#gate.hidden { display: none; }

/* ── Landing hero ──────────────────────────────────────────────────────── */

.landing-hero {
  width: 100%;
  max-width: 520px;
  text-align: center;
  color: var(--frame-text);
  padding: 0 8px;
}

.landing-leaf {
  display: inline-block;
  font-size: 56px;
  margin-bottom: 8px;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.25));
}

.landing-wordmark {
  font-family: var(--font-serif);
  font-size: 56px;
  font-weight: 700;
  letter-spacing: -1.2px;
  color: var(--frame-text);
  margin: 0 0 6px;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.landing-tagline {
  font-family: 'Caveat', cursive;
  font-size: 24px;
  color: rgba(255, 248, 238, 0.92);
  margin: 0;
}

@media (max-width: 520px) {
  .landing-wordmark { font-size: 44px; letter-spacing: -0.8px; }
  .landing-leaf { font-size: 44px; }
  .landing-tagline { font-size: 20px; }
}

/* ── Code-first flow: invitee vs returning visibility ─────────────────── */

/* Returning mode is the default. Invitee mode (post-code-validation) toggles
   via the .gate-card.invitee-mode class set by JS. */

.invitee-only { display: none; }
.gate-card.invitee-mode .returning-only { display: none; }
.gate-card.invitee-mode .invitee-only { display: block; }
.gate-card.invitee-mode .invitee-only.auth-toggle { display: flex; }

/* Hide post-auth-only invite note unless we're actively in invitee mode.
   (Replaces the old .auth-confirm-hidden toggle, which is now handled by
    .invitee-only above for the same element.) */
#auth-invite-note.invitee-only { margin-top: 12px; }

.invitee-back-btn {
  position: absolute;
  top: 10px;
  left: 12px;
  background: transparent;
  border: 0;
  color: var(--ink-muted);
  font-family: var(--font-sans);
  font-size: 13px;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 6px;
  transition: background 0.15s ease, color 0.15s ease;
}
.invitee-back-btn:hover {
  background: rgba(92, 61, 46, 0.06);
  color: var(--ink-soft);
}

.first-time-block {
  margin-top: 12px;
}

.gate-divider {
  height: 1px;
  background: linear-gradient(
    to right,
    transparent 0%,
    var(--border) 20%,
    var(--border) 80%,
    transparent 100%
  );
  margin: 16px 0 14px;
}

.first-time-btn {
  width: 100%;
  background: transparent;
  border: 1px dashed var(--border);
  color: var(--forest);
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  padding: 14px 16px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.first-time-btn:hover {
  background: rgba(28, 61, 46, 0.04);
  border-color: var(--forest);
}

.gate-card {
  background: var(--paper);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  padding: 32px 36px 32px;
  max-width: 400px;
  width: 100%;
  text-align: center;
  border: 1.5px solid var(--border);
  position: relative;
}

/* Pushpin on gate card */
.gate-card::before {
  content: '';
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #E8D060, #D4A000 45%, #8B6000);
  box-shadow: 0 2px 6px rgba(0,0,0,0.45), inset 0 1px 2px rgba(255,255,255,0.4);
  z-index: 10;
}

.gate-leaf { font-size: 44px; margin-bottom: 16px; display: block; }

.gate-title {
  font-family: var(--font-serif);
  font-size: 22px;
  color: var(--ink);
  margin: 0 0 8px;
  letter-spacing: -0.3px;
}

.gate-subtitle {
  font-size: 14px;
  color: var(--ink-muted);
  margin-bottom: 24px;
  line-height: 1.5;
}

.gate-input {
  width: 100%;
  padding: 14px 18px;
  border: 1.5px solid var(--sand-deep);
  border-radius: 10px;
  font-size: 16px;
  font-family: var(--font-sans);
  color: var(--ink);
  background: var(--sand-light);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  margin-bottom: 16px;
  letter-spacing: 0.1em;
}

.gate-input:focus {
  border-color: var(--forest);
  box-shadow: 0 0 0 3px rgba(28, 61, 46, 0.1);
}

.gate-input::placeholder { letter-spacing: normal; color: var(--ink-muted); }

.gate-btn {
  width: 100%;
  padding: 14px;
  background: var(--frame);
  color: var(--frame-text);
  border: none;
  border-radius: 10px;
  font-size: 16px;
  font-family: var(--font-sans);
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  letter-spacing: 0.2px;
}

.gate-btn:hover  { background: var(--frame-mid); }
.gate-btn:active { transform: scale(0.98); }

.gate-error {
  margin-top: 14px;
  font-size: 14px;
  color: #B04040;
  min-height: 20px;
  font-weight: 500;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  15%       { transform: translateX(-8px); }
  30%       { transform: translateX(8px); }
  45%       { transform: translateX(-6px); }
  60%       { transform: translateX(6px); }
  75%       { transform: translateX(-3px); }
  90%       { transform: translateX(3px); }
}

.gate-card.shake { animation: shake 0.5s ease; }

/* ─────────────────────────────────────────────────────────────────────────── */
/* Main app                                                                     */
/* ─────────────────────────────────────────────────────────────────────────── */

#app { display: none; min-height: 100vh; flex-direction: column; }
#app.visible { display: flex; }

/* ─── Header — wooden frame ──────────────────────────────────────────────── */

#header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--frame);
  border-bottom: 3px solid #3D2218;
  box-shadow: 0 3px 14px rgba(0,0,0,0.35), 0 1px 4px rgba(0,0,0,0.2);
  padding: 0 28px;
  height: 88px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 8px;
  /* Phase WEB-1: allow the logo to shrink + ellipsize instead of pushing the
     right cluster off-screen on narrow viewports. Don't fight header-center
     for grow space — just shrink when needed. */
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
}

.header-logo {
  font-family: var(--font-serif);
  font-size: 30px;
  color: var(--frame-text);
  font-weight: normal;
  letter-spacing: -0.3px;
  display: block;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-center {
  font-size: 13px;
  color: var(--frame-sub);
  text-align: center;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.live-badge {
  font-size: 12px;
  color: var(--frame-text);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  opacity: 0.9;
  flex-shrink: 0;
}
.live-text { display: inline; }

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  display: inline-block;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.5; transform: scale(0.75); }
}

.live-dot { animation: pulse-dot 2s ease-in-out infinite; }

/* ─── Toast ──────────────────────────────────────────────────────────────── */

#toast {
  position: fixed;
  top: 78px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  background: var(--frame);
  color: var(--frame-text);
  padding: 10px 22px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  z-index: 200;
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.3s ease;
  white-space: nowrap;
  box-shadow: var(--shadow);
  pointer-events: none;
}

#toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ─────────────────────────────────────────────────────────────────────────── */
/* View tabs — Feed / Family Activity                                          */
/* ─────────────────────────────────────────────────────────────────────────── */

#view-tabs {
  display: none;
  background: rgba(255, 248, 238, 0.94);
  border-bottom: 1px solid rgba(92, 61, 46, 0.18);
  padding: 0 16px;
  gap: 6px;
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
#app.visible #view-tabs {
  display: flex;
  justify-content: center;
}

.view-tab {
  flex: 0 1 220px;
  padding: 14px 12px 12px;
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  font-family: var(--font-serif);
  font-size: 15px;
  letter-spacing: 0.2px;
  color: var(--ink-muted);
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.view-tab:hover {
  color: var(--ink-soft);
}
.view-tab.is-active {
  color: var(--forest);
  border-bottom-color: var(--forest);
  font-weight: 600;
}

/* ─────────────────────────────────────────────────────────────────────────── */
/* Photos view — chronological grid of every photo across the family's posts  */
/* ─────────────────────────────────────────────────────────────────────────── */

/* Tab containers MUST honor the hidden attribute. #feed sets display:grid,
   which otherwise overrides [hidden]'s display:none and leaves the Feed (and
   its posts) bleeding onto the Photos and Moon tabs. */
#feed[hidden],
#photos-view[hidden],
#moon-view[hidden] { display: none; }

#photos-view {
  width: min(100%, 720px);
  margin: 0 auto;
  padding-top: 24px;
}

/* Checkpoint 2: justified masonry gallery — CSS multicol keeps mixed aspect
   ratios natural (no cropping to squares), with cork-board cards. */
#photos-grid {
  column-count: 3;
  column-gap: 12px;
}

.photo-cell {
  display: block;
  width: 100%;
  margin: 0 0 12px;
  break-inside: avoid;
  -webkit-column-break-inside: avoid;
  position: relative;
  background: var(--sand-light);
  border: 0;
  padding: 0;
  cursor: pointer;
  overflow: hidden;
  border-radius: 10px;
  box-shadow: 2px 4px 14px rgba(0, 0, 0, 0.18), 0 1px 2px rgba(0, 0, 0, 0.12);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  /* Loading placeholder height so the masonry has something to flow around;
     cleared (.is-ready) once the natural image height is known. */
  min-height: 200px;
}
.photo-cell.is-ready { min-height: 0; }
.photo-cell::before {
  /* Subtle shimmer while the URL resolves. */
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, var(--sand-light) 30%, var(--sand-deep) 50%, var(--sand-light) 70%);
  background-size: 220% 100%;
  animation: photo-shimmer 1.4s ease-in-out infinite;
  opacity: 1;
  transition: opacity 0.25s ease;
}
.photo-cell.is-ready::before { opacity: 0; }
@keyframes photo-shimmer {
  0%   { background-position: 120% 0; }
  100% { background-position: -120% 0; }
}
.photo-cell img {
  position: relative;
  width: 100%;
  height: auto;
  display: block;
  opacity: 0;
  transition: opacity 0.35s ease;
}
.photo-cell img.is-loaded { opacity: 1; }
.photo-cell:hover {
  transform: translateY(-2px);
  box-shadow: 3px 7px 22px rgba(0, 0, 0, 0.26), 0 2px 4px rgba(0, 0, 0, 0.16);
}
.photo-cell:active { transform: translateY(0) scale(0.99); }
.photo-cell.is-failed {
  background: rgba(139, 32, 32, 0.06);
  border: 1px solid rgba(139, 32, 32, 0.18);
  min-height: 120px;
}
.photo-cell.is-failed::before { display: none; }
.photo-cell.is-failed::after {
  content: 'Unavailable';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-sans);
  font-size: 11px;
  color: var(--labor-red);
  font-weight: 600;
}

.photos-empty,
.photos-loading {
  column-span: all;
  padding: 64px 20px;
  text-align: center;
  font-family: var(--font-serif);
  color: var(--ink-muted);
}
.photos-empty-emoji,
.photos-loading-emoji {
  font-size: 36px;
  margin-bottom: 12px;
}
.photos-empty-title {
  font-family: var(--font-serif);
  font-size: 18px;
  color: var(--ink-soft);
  margin-bottom: 6px;
}

@media (max-width: 600px) {
  #photos-grid { column-count: 2; column-gap: 8px; }
  .photo-cell { margin-bottom: 8px; border-radius: 8px; min-height: 150px; }
}

/* ─────────────────────────────────────────────────────────────────────────── */
/* Who's-here widget (header button + dropdown panel)                          */
/* ─────────────────────────────────────────────────────────────────────────── */

.whos-here-btn {
  position: relative;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 9px 6px 10px;
  background: transparent;
  border: 1px solid rgba(255, 248, 238, 0.18);
  border-radius: 16px;
  color: var(--frame-text);
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.3px;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.whos-here-btn:hover {
  background: rgba(255, 248, 238, 0.1);
  border-color: rgba(255, 248, 238, 0.3);
}
.whos-here-btn[aria-expanded="true"] {
  background: rgba(255, 248, 238, 0.14);
  border-color: rgba(255, 248, 238, 0.36);
}
.whos-here-btn .header-icon-svg {
  width: 16px;
  height: 16px;
}
.whos-here-count {
  font-variant-numeric: tabular-nums;
  min-width: 10px;
  text-align: center;
}

.whos-here-panel {
  position: absolute;
  top: calc(100% + 6px);
  right: 28px;
  width: 280px;
  max-width: calc(100vw - 32px);
  background: var(--paper);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  z-index: 200;
  overflow: hidden;
  animation: whos-here-pop 0.18s ease-out;
}
@keyframes whos-here-pop {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.whos-here-header {
  font-family: var(--font-serif);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
  padding: 14px 16px 8px;
  border-bottom: 1px solid var(--border);
}

.whos-here-list {
  max-height: 360px;
  overflow-y: auto;
  padding: 6px 0;
}

.whos-here-loading,
.whos-here-empty {
  padding: 24px 16px;
  text-align: center;
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--ink-muted);
}

.whos-here-row {
  display: grid;
  grid-template-columns: 32px 1fr;
  gap: 12px;
  align-items: center;
  padding: 9px 16px;
  font-family: var(--font-sans);
}
.whos-here-row + .whos-here-row {
  border-top: 1px solid rgba(224, 212, 188, 0.4);
}
.whos-here-row.is-offline { opacity: 0.72; }

.whos-here-avatar {
  position: relative;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--sand-light);
  border: 1.5px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-serif);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
  background-size: cover;
  background-position: center;
  overflow: hidden;
}
.whos-here-avatar.is-online::after {
  content: '';
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #22c55e;
  border: 2px solid var(--paper);
}

.whos-here-meta { min-width: 0; }
.whos-here-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.whos-here-status {
  font-size: 12px;
  color: var(--ink-muted);
  margin-top: 1px;
}
.whos-here-status.is-online-text {
  color: #15803d;
  font-weight: 600;
}

@media (max-width: 480px) {
  .whos-here-panel { right: 12px; }
  .whos-here-btn { padding: 5px 8px 5px 9px; }
}

/* ─────────────────────────────────────────────────────────────────────────── */
/* Moon — letters to baby                                                      */
/* ─────────────────────────────────────────────────────────────────────────── */

#moon-view {
  width: min(100%, 560px);
  margin: 0 auto;
  padding-top: 24px;
}

/* Checkpoint 3: the night-sky focal panel — the live moon, a quiet starfield,
   and an occasional shooting star. Letters below are "sent up" to it. */
.moon-sky {
  position: relative;
  overflow: hidden;
  text-align: center;
  padding: 30px 24px 26px;
  margin-bottom: 18px;
  border-radius: 18px;
  border: 1px solid #232544;
  background:
    radial-gradient(120% 90% at 50% -10%, #2C2F5A 0%, #1B1D38 46%, #14152A 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 6px 22px rgba(10, 12, 30, 0.35);
}

.moon-stars {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(1.4px 1.4px at 12% 22%, rgba(255,255,255,0.9) 50%, transparent 51%),
    radial-gradient(1px 1px at 26% 64%, rgba(255,255,255,0.7) 50%, transparent 51%),
    radial-gradient(1.6px 1.6px at 38% 14%, rgba(255,255,255,0.85) 50%, transparent 51%),
    radial-gradient(1px 1px at 62% 40%, rgba(255,255,255,0.6) 50%, transparent 51%),
    radial-gradient(1.3px 1.3px at 74% 72%, rgba(255,255,255,0.8) 50%, transparent 51%),
    radial-gradient(1px 1px at 84% 26%, rgba(255,255,255,0.65) 50%, transparent 51%),
    radial-gradient(1.2px 1.2px at 92% 58%, rgba(255,255,255,0.75) 50%, transparent 51%),
    radial-gradient(1px 1px at 50% 84%, rgba(255,255,255,0.55) 50%, transparent 51%),
    radial-gradient(1px 1px at 8% 80%, rgba(255,255,255,0.55) 50%, transparent 51%);
  animation: moon-twinkle 4.5s ease-in-out infinite;
}
@keyframes moon-twinkle {
  0%, 100% { opacity: 0.85; }
  50%      { opacity: 0.5; }
}

.moon-shooting-star {
  position: absolute;
  top: 16%;
  left: -10%;
  width: 90px;
  height: 1.5px;
  pointer-events: none;
  background: linear-gradient(90deg, rgba(255,255,255,0) 0%, rgba(255,255,255,0.85) 100%);
  border-radius: 2px;
  opacity: 0;
  transform: rotate(18deg);
  filter: drop-shadow(0 0 4px rgba(255,255,255,0.7));
  animation: moon-shoot 9s ease-in infinite;
}
@keyframes moon-shoot {
  0%, 72%   { opacity: 0; transform: translate(0, 0) rotate(18deg); }
  78%       { opacity: 0.9; }
  92%       { opacity: 0; }
  100%      { opacity: 0; transform: translate(360px, 120px) rotate(18deg); }
}

.moon-visual {
  position: relative;
  width: 118px;
  height: 118px;
  margin: 4px auto 14px;
  border-radius: 50%;
  filter: drop-shadow(0 0 22px rgba(247, 240, 214, 0.42));
}
.moon-phase-svg { width: 100%; height: 100%; display: block; }
.moon-loading-orb {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: radial-gradient(circle at 38% 34%, #EFE2BE, #2A2740 78%);
  animation: moon-twinkle 2s ease-in-out infinite;
}

.moon-phase-label {
  position: relative;
  font-family: var(--font-sans);
  font-size: 12px;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: rgba(247, 240, 214, 0.78);
  margin: 0 0 12px;
}

.moon-blurb {
  position: relative;
  font-family: var(--font-serif);
  font-size: 15px;
  line-height: 1.6;
  color: rgba(243, 240, 255, 0.9);
  margin: 0 auto;
  max-width: 38ch;
}

.moon-composer {
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 22px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}
.moon-title-input,
.moon-body-input {
  width: 100%;
  background: var(--sand-light);
  border: 1px solid var(--sand-deep);
  border-radius: 10px;
  padding: 10px 14px;
  font-family: var(--font-serif);
  color: var(--ink);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.moon-title-input {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 10px;
}
.moon-body-input {
  font-size: 15px;
  line-height: 1.55;
  resize: vertical;
  min-height: 90px;
}
.moon-title-input:focus,
.moon-body-input:focus {
  border-color: var(--forest);
  box-shadow: 0 0 0 3px rgba(28, 61, 46, 0.08);
}
.moon-title-input::placeholder,
.moon-body-input::placeholder {
  color: var(--ink-muted);
  font-style: italic;
}

.moon-composer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
}
.moon-composer-error {
  font-family: var(--font-sans);
  font-size: 12px;
  color: var(--labor-red);
  flex: 1;
  min-width: 0;
}
.moon-submit-btn {
  background: var(--frame);
  color: var(--frame-text);
  border: 0;
  border-radius: 999px;
  padding: 9px 18px;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, opacity 0.15s ease, transform 0.1s ease;
  flex-shrink: 0;
}
.moon-submit-btn:hover { background: var(--frame-mid); }
.moon-submit-btn:active { transform: scale(0.98); }
.moon-submit-btn:disabled { opacity: 0.55; cursor: not-allowed; }

.moon-letters {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.moon-letter {
  position: relative;
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 22px 16px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
  /* Faint paper-edge feel: a soft inner shadow on the right side */
  background-image:
    linear-gradient(to right, transparent 0%, transparent 96%, rgba(59, 26, 8, 0.04) 100%);
}
.moon-letter-author {
  font-family: 'Caveat', cursive;
  font-size: 22px;
  color: var(--ink-soft);
  line-height: 1.1;
}
.moon-letter-rel {
  font-family: var(--font-sans);
  font-size: 12px;
  color: var(--ink-muted);
  margin-left: 8px;
  font-weight: normal;
}
.moon-letter-title {
  font-family: var(--font-serif);
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
  margin: 8px 0 4px;
  line-height: 1.3;
}
.moon-letter-body {
  font-family: var(--font-serif);
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink);
  margin: 8px 0 12px;
  white-space: pre-wrap;
  word-break: break-word;
}
.moon-letter-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  font-family: var(--font-sans);
  font-size: 11px;
  color: var(--ink-muted);
  border-top: 1px dashed rgba(224, 212, 188, 0.6);
  padding-top: 10px;
}
.moon-letter-date {
  letter-spacing: 0.3px;
}
.moon-letter-delete {
  background: transparent;
  border: 0;
  color: var(--ink-muted);
  font-family: var(--font-sans);
  font-size: 11px;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 4px;
  transition: color 0.15s ease, background 0.15s ease;
}
.moon-letter-delete:hover {
  color: var(--labor-red);
  background: rgba(139, 32, 32, 0.06);
}

.moon-empty,
.moon-loading {
  padding: 48px 20px;
  text-align: center;
  font-family: var(--font-serif);
  color: var(--ink-muted);
}
.moon-empty-glyph {
  font-size: 40px;
  margin-bottom: 12px;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.12));
}
.moon-empty-title {
  font-family: var(--font-serif);
  font-size: 18px;
  color: var(--ink-soft);
  margin-bottom: 6px;
}

@media (max-width: 480px) {
  .moon-sky { padding: 24px 16px 20px; }
  .moon-visual { width: 100px; height: 100px; }
  .moon-composer { padding: 14px; }
  .moon-letter { padding: 16px 18px 14px; }
}

/* ─────────────────────────────────────────────────────────────────────────── */
/* Send-a-gift header widget                                                   */
/* ─────────────────────────────────────────────────────────────────────────── */

.gift-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  background: transparent;
  border: 1px solid rgba(255, 248, 238, 0.18);
  border-radius: 50%;
  color: var(--frame-text);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}
.gift-btn:hover {
  background: rgba(255, 248, 238, 0.1);
  border-color: rgba(255, 248, 238, 0.3);
  transform: scale(1.05);
}
.gift-btn[aria-expanded="true"] {
  background: rgba(255, 248, 238, 0.14);
  border-color: rgba(255, 248, 238, 0.36);
}

.gift-panel {
  position: absolute;
  top: calc(100% + 6px);
  right: 28px;
  width: 320px;
  max-width: calc(100vw - 32px);
  background: var(--paper);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  z-index: 200;
  overflow: hidden;
  animation: gift-pop 0.18s ease-out;
}
@keyframes gift-pop {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.gift-header {
  font-family: var(--font-serif);
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-soft);
  padding: 14px 16px 8px;
  border-bottom: 1px solid var(--border);
}
.gift-body {
  max-height: 480px;
  overflow-y: auto;
  padding: 8px 0 14px;
}
.gift-loading,
.gift-empty {
  padding: 24px 16px;
  text-align: center;
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--ink-muted);
}
.gift-explainer {
  padding: 4px 14px 12px;
  font-family: var(--font-sans);
  font-size: 12px;
  line-height: 1.45;
  color: var(--ink-muted);
}
.gift-setup {
  margin: 0 14px 12px;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--sand-deep);
  border: 1px solid var(--border);
  font-family: var(--font-sans);
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--ink-soft);
}
.gift-setup strong { color: var(--ink); }
.gift-sent {
  padding: 10px 14px 14px;
  border-top: 1px solid var(--border);
}
.gift-sent-toggle {
  width: 100%;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px dashed var(--border);
  background: transparent;
  font-family: var(--font-sans);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-soft);
  cursor: pointer;
}
.gift-sent-toggle:hover { background: var(--sand-deep); }
.gift-sent-form { display: grid; gap: 8px; }
.gift-sent-amount,
.gift-sent-method {
  width: 100%;
  box-sizing: border-box;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--paper);
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--ink);
}
.gift-sent-submit {
  padding: 9px 12px;
  border-radius: 10px;
  border: 0;
  background: var(--amber);
  color: #fff;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.gift-sent-submit:hover { filter: brightness(1.05); }
.gift-section-title {
  font-family: var(--font-sans);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--ink-muted);
  padding: 10px 16px 6px;
  font-weight: 600;
}
.gift-section + .gift-section { border-top: 1px solid rgba(224, 212, 188, 0.5); margin-top: 4px; }

.gift-handle,
.gift-registry {
  display: grid;
  grid-template-columns: 30px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 9px 16px;
  background: transparent;
  border: 0;
  width: 100%;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--ink);
  transition: background 0.12s ease;
}
.gift-handle:hover,
.gift-registry:hover { background: var(--sand-light); }
.gift-handle-icon,
.gift-registry-icon {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--sand-light);
  border: 1px solid var(--border);
  border-radius: 50%;
  font-size: 14px;
}
.gift-registry-icon.has-preview {
  border-radius: 8px;
}
.gift-handle-meta { min-width: 0; }
.gift-handle-label,
.gift-registry-label {
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.gift-handle-sub,
.gift-registry-sub {
  font-size: 11px;
  color: var(--ink-muted);
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.gift-handle-action {
  font-size: 11px;
  color: var(--amber);
  font-weight: 600;
}
.gift-note {
  margin: 8px 16px 6px;
  padding: 10px 12px;
  background: var(--sand-light);
  border-left: 3px solid var(--amber);
  border-radius: 4px;
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 13px;
  color: var(--ink-soft);
  line-height: 1.45;
}

@media (max-width: 480px) {
  .gift-panel { right: 12px; }
}

/* ─────────────────────────────────────────────────────────────────────────── */
/* Feed — centered corkboard column                                            */
/* ─────────────────────────────────────────────────────────────────────────── */

#feed-wrap {
  flex: 1;
  padding: 40px 32px 64px;
}

#feed {
  width: min(100%, 560px);
  max-width: 560px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  padding-top: 24px; /* room above cards for pushpin */
}

/* ─── Loading / empty states ─────────────────────────────────────────────── */

.loading-state {
  column-span: all;
  text-align: center;
  color: var(--paper);
  padding: 80px 0;
  font-size: 15px;
  text-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.loading-spinner {
  width: 28px;
  height: 28px;
  border: 2.5px solid rgba(255,255,255,0.3);
  border-top-color: var(--paper);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 16px;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Empty state — blank paper pinned to the board */
.empty-state {
  column-span: all;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--paper);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1.5px solid var(--border);
  padding: 64px 48px;
  max-width: 420px;
  margin: 40px auto;
  position: relative;
}

/* Gold pushpin on empty state card */
.empty-state::before {
  content: '';
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #E8D060, #D4A000 45%, #8B6000);
  box-shadow: 0 2px 6px rgba(0,0,0,0.45), inset 0 1px 2px rgba(255,255,255,0.4);
}

.empty-state .empty-emoji { font-size: 44px; margin-bottom: 16px; display: block; }
.empty-state h3 { font-family: var(--font-serif); font-size: 20px; color: var(--ink); margin-bottom: 8px; }
.empty-state p  { color: var(--ink-muted); font-size: 15px; line-height: 1.5; text-align: center; }
.empty-action {
  margin-top: 18px;
  border: 0;
  border-radius: 999px;
  background: var(--frame);
  color: var(--frame-text);
  padding: 10px 18px;
  font: 700 14px var(--font-sans);
  cursor: pointer;
}
.empty-action:hover { background: var(--frame-mid); }

.welcome-card {
  background: linear-gradient(160deg, var(--paper) 0%, #FFF8EE 100%);
  border: 1.5px solid var(--border);
  text-align: center;
}

.welcome-kicker {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--amber);
  font-weight: 700;
  margin-bottom: 8px;
}

.welcome-card h2 {
  font-family: var(--font-serif);
  font-size: 24px;
  line-height: 1.25;
  color: var(--ink);
  margin-bottom: 8px;
}

.welcome-card p {
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink-soft);
}

/* ─────────────────────────────────────────────────────────────────────────── */
/* Card wrapper — pushpin + rotation + lift on hover                           */
/* ─────────────────────────────────────────────────────────────────────────── */

.card-wrap {
  display: block;
  width: 100%;
  margin-bottom: 24px;
  margin-top: 20px; /* breathing room for pushpin above */
  position: relative;
  overflow: visible; /* allow pushpin ::before to show above card */
  /* CSS custom property lets hover combine rotation + scale cleanly */
  --rot: 0deg;
  transform: rotate(var(--rot));
  transform-origin: center top;
  transition: transform 0.2s ease, filter 0.2s ease;
  cursor: default;
  z-index: 1;
}

.card-wrap:hover {
  transform: rotate(var(--rot)) scale(1.02);
  filter: drop-shadow(0 8px 24px rgba(0,0,0,0.28));
  z-index: 20;
}

/* Six alternating tilts — naturally pinned look */
.card-wrap:nth-child(6n+1) { --rot: -1.5deg; }
.card-wrap:nth-child(6n+2) { --rot:  1deg;   }
.card-wrap:nth-child(6n+3) { --rot: -2deg;   }
.card-wrap:nth-child(6n+4) { --rot:  2.5deg; }
.card-wrap:nth-child(6n+5) { --rot: -0.5deg; }
.card-wrap:nth-child(6n+6) { --rot:  1.8deg; }

/* ── Pushpin — red by default ─────────────────────────────────────────────── */
.card-wrap::before {
  content: '';
  position: absolute;
  top: -9px;
  left: 50%;
  transform: translateX(-50%);
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #E05555, #C0392B 45%, #7B1515);
  box-shadow: 0 2px 5px rgba(0,0,0,0.45), inset 0 1px 2px rgba(255,255,255,0.35);
  z-index: 10;
  pointer-events: none;
}

/* ── Gold pin for pinned posts ────────────────────────────────────────────── */
.card-wrap:has(.pinned-badge)::before {
  width: 18px;
  height: 18px;
  top: -10px;
  background: radial-gradient(circle at 35% 30%, #FFE066, #D4A000 45%, #8B6000);
  box-shadow: 0 2px 6px rgba(0,0,0,0.5), inset 0 1px 2px rgba(255,255,255,0.5);
}

/* ─────────────────────────────────────────────────────────────────────────── */
/* Card base — warm paper, lifted shadow                                        */
/* ─────────────────────────────────────────────────────────────────────────── */

.card {
  background: var(--paper);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  border: 1px solid var(--border);
  position: relative;
  /* No transition here — shadow handled by card-wrap hover filter */
}

/* Fade-in on first load — applied to .card-wrap */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(14px) rotate(var(--rot, 0deg)); }
  to   { opacity: 1; transform: translateY(0)    rotate(var(--rot, 0deg)); }
}

.card-wrap.fade-in { animation: fadeInUp 0.4s ease both; }

/* New post highlight (gold flash) */
@keyframes goldFlash {
  0%   { box-shadow: var(--shadow);    background-color: var(--paper); }
  25%  { box-shadow: 0 0 0 3px #B8621A55, var(--shadow-lg); background-color: #FFFBF0; }
  100% { box-shadow: var(--shadow);    background-color: var(--paper); }
}

.card.new-post { animation: goldFlash 2s ease; }

/* Pinned badge — now decorative text only (pin handled by ::before) */
.pinned-badge {
  position: absolute;
  top: 14px;
  right: 14px;
  background: #E8F2EC;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 600;
  color: var(--forest);
}

/* Card header row */
.card-header { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 14px; }
.card-emoji  { font-size: 28px; line-height: 1; flex-shrink: 0; margin-top: 2px; }
.card-header-text { flex: 1; }

.card-title {
  font-family: var(--font-serif);
  font-size: 18px;
  color: var(--ink);
  margin-bottom: 6px;
  line-height: 1.35;
}

.card-body {
  font-size: 14px;
  color: var(--ink-soft);
  line-height: 1.65;
  margin-bottom: 14px;
  white-space: pre-wrap;
}

.card-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.type-badge {
  display: inline-block;
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.card-date {
  font-size: 11px;
  color: var(--ink-muted);
}

.card-author-inline {
  font-size: 11px;
  color: var(--ink-muted);
  font-style: italic;
  margin-left: auto;
}

/* ─── Type badge colors ──────────────────────────────────────────────────── */
.badge-text               { background: #E8F2EC; color: var(--forest); }
.badge-photo              { background: #EDF3EE; color: var(--forest); }
.badge-data_card          { background: #EDF2F7; color: #2A4D6B; }
.badge-milestone          { background: #FBF0E0; color: #5C2D0A; }
.badge-workout            { background: #F5EDE8; color: #8B3A1A; }
.badge-ultrasound         { background: #EDE8F7; color: var(--ultrasound-purple); }
.badge-labor_alert        { background: #fde8e8; color: var(--labor-red); }
.badge-birth_announcement { background: #FDE8D0; color: var(--amber); }
.badge-postpartum         { background: #F7EEF5; color: #6B2A5C; }

/* ─── Stat chips ─────────────────────────────────────────────────────────── */
.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.stat-chip {
  background: var(--sand-light);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 12px;
}

.stat-chip .chip-label {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  font-weight: 700;
  color: var(--ink-muted);
  display: block;
  margin-bottom: 2px;
}

.stat-chip .chip-value {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}

/* ─── Photo grid ─────────────────────────────────────────────────────────── */
.photo-grid {
  display: grid;
  gap: 8px;
  border-radius: 8px;
  margin-bottom: 14px;
}

.photo-grid.count-1,
.photo-grid.count-2,
.photo-grid.count-3plus {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.photo-grid.count-1 { grid-template-columns: 1fr; }

.photo-tile {
  position: relative;
  display: block;
  width: 100%;
  min-width: 0;
  aspect-ratio: 1;
  padding: 0;
  border: 0;
  border-radius: 8px;
  overflow: hidden;
  background: var(--sand-light);
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(59, 26, 8, 0.12);
}

.photo-grid.count-1 .photo-tile { aspect-ratio: 4 / 3; }

.photo-grid img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 0.2s, transform 0.2s;
}

.photo-tile:hover img { opacity: 0.9; transform: scale(1.02); }

.photo-tile.photo-loading {
  cursor: progress;
}

.photo-loading-label {
  position: absolute;
  inset: 0;
  color: var(--ink-muted);
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
  text-align: center;
}

/* Diagnostic states — added 2026-04-24 to surface load failures clearly
   instead of showing the browser's tiny broken-image icon + alt text. */
.photo-tile.photo-failed {
  background: repeating-linear-gradient(
    45deg,
    rgba(139, 32, 32, 0.10),
    rgba(139, 32, 32, 0.10) 10px,
    rgba(139, 32, 32, 0.18) 10px,
    rgba(139, 32, 32, 0.18) 20px
  );
  cursor: default;
}

.photo-tile.photo-failed::after {
  content: 'Photo could not load';
  position: absolute;
  inset: 0;
  color: var(--labor-red);
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
  text-align: center;
}

.photo-tile.photo-failed img { opacity: 0; }

.photo-tile.photo-loaded img {
  animation: photoFadeIn 0.2s ease-out;
}
@keyframes photoFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ─── Lightbox ───────────────────────────────────────────────────────────── */
/* Checkpoint 2: gallery lightbox with fade/scale transition + prev-next. */
#lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.22s ease, visibility 0.22s ease;
}
#lightbox.open { opacity: 1; visibility: visible; }

#lightbox img {
  max-width: 92vw;
  max-height: 86vh;
  border-radius: 10px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6);
  object-fit: contain;
  cursor: default;
}
#lightbox img.is-swapped-in { animation: lightbox-zoom 0.24s cubic-bezier(0.2, 0.8, 0.3, 1); }
@keyframes lightbox-zoom {
  from { opacity: 0.45; transform: scale(0.975); }
  to   { opacity: 1; transform: scale(1); }
}

.lightbox-close,
.lightbox-nav {
  position: absolute;
  z-index: 2;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  transition: background 0.15s, transform 0.1s, opacity 0.15s;
}
.lightbox-close:hover,
.lightbox-nav:hover { background: rgba(255, 255, 255, 0.22); }
.lightbox-close:active,
.lightbox-nav:active { transform: scale(0.92); }

.lightbox-close {
  top: max(16px, env(safe-area-inset-top));
  right: 16px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  font-size: 18px;
  line-height: 1;
}
.lightbox-nav {
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 64px;
  border-radius: 12px;
  font-size: 34px;
  line-height: 1;
  padding-bottom: 4px;
}
.lightbox-nav.lightbox-prev { left: 14px; }
.lightbox-nav.lightbox-next { right: 14px; }
.lightbox-nav:active { transform: translateY(-50%) scale(0.92); }
.lightbox-nav[hidden] { display: none; }
.lightbox-nav:disabled { opacity: 0.28; cursor: default; }
.lightbox-nav:disabled:hover { background: rgba(255, 255, 255, 0.1); }

.lightbox-counter {
  position: absolute;
  bottom: max(18px, env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  color: rgba(255, 255, 255, 0.85);
  font-family: var(--font-sans);
  font-size: 13px;
  letter-spacing: 0.6px;
  background: rgba(0, 0, 0, 0.35);
  padding: 4px 12px;
  border-radius: 999px;
}
.lightbox-counter[hidden] { display: none; }

@media (max-width: 600px) {
  .lightbox-nav { width: 40px; height: 56px; font-size: 28px; }
  .lightbox-nav.lightbox-prev { left: 8px; }
  .lightbox-nav.lightbox-next { right: 8px; }
}

/* ─────────────────────────────────────────────────────────────────────────── */
/* Card type styles                                                             */
/* ─────────────────────────────────────────────────────────────────────────── */

/* Milestone — green left accent */
.card-milestone {
  border-left: 5px solid var(--forest);
  background: linear-gradient(135deg, #F0F7F2 0%, var(--paper) 50%);
}

.card-milestone .milestone-title {
  font-family: var(--font-serif);
  font-size: 20px;
  color: var(--forest);
  line-height: 1.3;
  margin-bottom: 10px;
}

/* Data card — fun fact box */
.fun-fact-box {
  background: var(--amber-light);
  border: 1px solid #E8D5B5;
  border-radius: 8px;
  padding: 11px 14px;
  margin-bottom: 14px;
  font-size: 13px;
  color: #5C2D0A;
  font-style: italic;
  line-height: 1.55;
}

/* Workout — amber top stripe */
.card-workout { border-top: 4px solid var(--amber); }

.workout-badges {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.workout-badge {
  background: var(--amber-light);
  border: 1px solid #E0C8A0;
  border-radius: 6px;
  padding: 5px 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--amber);
}

/* Ultrasound — purple border */
.card-ultrasound { border: 1.5px solid var(--ultrasound-purple); }

.card-ultrasound .photo-grid {
  background: #F0EBF8;
  padding: 4px;
  border-radius: 10px;
}

.card-ultrasound .photo-grid img:hover {
  opacity: 0.85;
  filter: brightness(0.97) saturate(1.1);
}

/* Labor alert — full red, dramatic shadow */
.card-labor-alert {
  background: var(--labor-red);
  border: 2px solid #6B1515;
  color: var(--white);
  text-align: center;
  padding: 36px 22px;
  box-shadow: 4px 8px 28px rgba(139,32,32,0.55), 0 2px 6px rgba(0,0,0,0.3);
}

@keyframes labor-pulse {
  0%, 100% { box-shadow: 4px 8px 28px rgba(139,32,32,0.55), 0 0 0 0 rgba(139, 32, 32, 0.4); }
  50%       { box-shadow: 4px 8px 28px rgba(139,32,32,0.55), 0 0 0 10px rgba(139, 32, 32, 0); }
}

.card-labor-alert { animation: labor-pulse 2.5s ease infinite; }

.labor-siren { font-size: 52px; display: block; margin-bottom: 14px; }

.labor-headline {
  font-family: var(--font-serif);
  font-size: 24px;
  font-weight: bold;
  color: var(--white);
  letter-spacing: 1px;
  margin-bottom: 12px;
}

.labor-message {
  font-size: 16px;
  color: rgba(255,255,255,0.9);
  margin-bottom: 8px;
  line-height: 1.5;
}

.labor-hospital {
  font-size: 13px;
  color: rgba(255,255,255,0.75);
  margin-top: 8px;
}

.card-labor-alert .card-meta   { justify-content: center; margin-top: 20px; }
.card-labor-alert .card-date   { color: rgba(255,255,255,0.65); }
.card-labor-alert .card-author { color: rgba(255,255,255,0.65); }
.card-labor-alert .type-badge  { background: rgba(255,255,255,0.2); color: var(--white); }

/* Birth announcement — the most special card on the board */
.card-birth {
  border: 2px solid var(--birth-gold);
  background: linear-gradient(160deg, var(--paper) 0%, #FFF8EE 100%);
  padding: 30px 26px;
  box-shadow: 4px 8px 28px rgba(184,98,26,0.2), 2px 4px 12px rgba(0,0,0,0.15);
}

.birth-headline {
  font-family: var(--font-serif);
  font-size: 17px;
  color: var(--amber);
  margin-bottom: 8px;
  font-weight: normal;
}

.birth-name {
  font-family: var(--font-serif);
  font-size: 38px;
  color: var(--ink);
  letter-spacing: -1.5px;
  margin-bottom: 18px;
  line-height: 1.1;
}

.birth-stats {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 18px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
}

.birth-stat { text-align: center; }
.birth-stat .stat-label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.6px; font-weight: 700; color: var(--ink-muted); margin-bottom: 4px; }
.birth-stat .stat-val   { font-family: var(--font-serif); font-size: 17px; color: var(--ink); }

.birth-message {
  font-size: 15px;
  color: var(--ink-soft);
  font-style: italic;
  line-height: 1.7;
  margin-bottom: 16px;
}

/* Postpartum */
.card-postpartum {
  background: linear-gradient(135deg, #FEF5F8 0%, var(--paper) 60%);
  border-color: #E8C8D8;
}

/* ─── Footer ─────────────────────────────────────────────────────────────── */
#footer {
  text-align: center;
  padding: 28px 24px 40px;
  font-size: 13px;
  color: rgba(255,248,238,0.7);
  background: var(--frame);
  border-top: 3px solid #3D2218;
}

/* ─────────────────────────────────────────────────────────────────────────── */
/* Name modal                                                                   */
/* ─────────────────────────────────────────────────────────────────────────── */

#name-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(42, 31, 20, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 400;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

#name-modal.open { display: flex; }

.name-modal-card {
  background: var(--paper);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  padding: 44px 36px 40px;
  max-width: 380px;
  width: 100%;
  text-align: center;
  border: 1.5px solid var(--border);
  animation: fadeInUp 0.25s ease both;
  position: relative;
}

.name-modal-card::before {
  content: '';
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #E05555, #C0392B 45%, #7B1515);
  box-shadow: 0 2px 5px rgba(0,0,0,0.4), inset 0 1px 2px rgba(255,255,255,0.35);
}

.name-modal-emoji { font-size: 40px; display: block; margin-bottom: 14px; }

.name-modal-title {
  font-family: var(--font-serif);
  font-size: 24px;
  color: var(--ink);
  margin-bottom: 8px;
  font-weight: normal;
}

.name-modal-sub {
  font-size: 14px;
  color: var(--ink-muted);
  margin-bottom: 28px;
  line-height: 1.5;
}

/* ─────────────────────────────────────────────────────────────────────────── */
/* Interaction zone — reactions + comments (unchanged functionality)            */
/* ─────────────────────────────────────────────────────────────────────────── */

.interaction-zone {
  margin-top: 16px;
}

.reaction-divider {
  height: 1px;
  background: var(--border);
  margin-bottom: 14px;
}

/* Labor alert needs readable interactions on red background */
.card-labor-alert .interaction-zone {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  padding: 14px;
  text-align: left;
  margin-top: 20px;
}

.card-labor-alert .reaction-divider         { display: none; }
.card-labor-alert .comments-toggle          { color: rgba(255,255,255,0.8); }
.card-labor-alert .comments-toggle:hover    { color: var(--white); }
.card-labor-alert .reaction-hint            { color: rgba(255,255,255,0.6); }

/* Reaction bar */
.reaction-bar {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.reaction-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  max-width: 100%;
  /* 6 per row: each button ~44px + 4px gap → 6×44 + 5×4 = 284px */
  overflow-x: auto;
}

.reaction-btn {
  background: none;
  border: 1.5px solid transparent;
  border-radius: 999px;
  font-size: 20px;
  line-height: 1;
  padding: 6px 8px;
  cursor: pointer;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}

.reaction-btn:hover {
  background: var(--sand-light);
  border-color: var(--border);
  transform: scale(1.12);
}

.reaction-btn:active { transform: scale(0.96); }

.reaction-bar.empty .reaction-btn       { opacity: 0.5; }
.reaction-bar.empty .reaction-btn:hover { opacity: 1; }

.reaction-btn.active {
  background: var(--amber-light);
  border-color: var(--amber);
  opacity: 1;
}

.reaction-hint {
  font-size: 12px;
  color: var(--ink-muted);
  font-style: italic;
  margin-left: 4px;
}

.reaction-bar:not(.empty) .reaction-hint { display: none; }

/* Reactor name pills */
.reactor-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
  min-height: 0;
}

.reactor-pill {
  background: var(--sand);
  border: 1px solid var(--sand-deep);
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 12px;
  color: var(--ink);
  white-space: nowrap;
}

/* Comments toggle */
.comments-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
  padding: 4px 0;
  font-size: 13px;
  color: var(--ink-muted);
  cursor: pointer;
  font-family: var(--font-sans);
  transition: color 0.15s;
  margin-bottom: 2px;
}

.comments-toggle:hover  { color: var(--forest); }
.comments-toggle.is-open { color: var(--forest); font-weight: 600; }

/* Comments collapse/expand (CSS grid trick) */
.comments-section {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.3s ease;
}

.comments-section.open { grid-template-rows: 1fr; }

.comments-section-inner { overflow: hidden; min-height: 0; }

.comments-section.open .comments-section-inner { padding-top: 12px; }

/* Comment items */
.comments-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 14px;
}

.comments-empty {
  font-size: 13px;
  color: var(--ink-muted);
  font-style: italic;
  text-align: center;
  padding: 8px 0 4px;
}

.comment-item {
  background: var(--sand-light);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 11px 13px;
}

.comment-header {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 5px;
}

.comment-name {
  font-family: var(--font-serif);
  font-size: 14px;
  font-weight: bold;
  color: var(--ink);
}

.comment-time {
  font-size: 11px;
  color: var(--ink-muted);
}

.comment-message {
  font-size: 14px;
  color: var(--ink-soft);
  line-height: 1.55;
  white-space: pre-wrap;
}

/* Comment composer */
.comment-composer {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.comment-textarea {
  flex: 1;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  font-family: var(--font-sans);
  color: var(--ink);
  background: var(--white);
  outline: none;
  resize: none;
  line-height: 1.5;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.comment-textarea:focus {
  border-color: var(--forest);
  box-shadow: 0 0 0 3px rgba(28, 61, 46, 0.08);
}

.comment-textarea::placeholder { color: var(--ink-muted); }

.comment-send-btn {
  flex-shrink: 0;
  padding: 10px 16px;
  background: var(--frame);
  color: var(--frame-text);
  border: none;
  border-radius: 10px;
  font-size: 13px;
  font-family: var(--font-sans);
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  white-space: nowrap;
  height: 42px;
}

.comment-send-btn:hover    { background: var(--frame-mid); }
.comment-send-btn:active   { transform: scale(0.97); }
.comment-send-btn:disabled { opacity: 0.5; cursor: default; }

/* ─────────────────────────────────────────────────────────────────────────── */
/* Responsive                                                                   */
/* ─────────────────────────────────────────────────────────────────────────── */

/* Tablet */
@media (max-width: 900px) {
  #feed-wrap { padding: 28px 20px 48px; }
}

/* Mobile — reduced rotation, larger touch targets */
@media (max-width: 640px) {
  #feed-wrap { padding: 16px 16px 48px; }

  /* Dial down tilts on mobile so stacked cards don't clip */
  .card-wrap:nth-child(6n+1) { --rot: -0.8deg; }
  .card-wrap:nth-child(6n+2) { --rot:  0.5deg; }
  .card-wrap:nth-child(6n+3) { --rot: -1deg;   }
  .card-wrap:nth-child(6n+4) { --rot:  1deg;   }
  .card-wrap:nth-child(6n+5) { --rot: -0.3deg; }
  .card-wrap:nth-child(6n+6) { --rot:  0.8deg; }

  #header { padding: 12px 14px; height: auto; min-height: 76px; gap: 10px; }
  .header-logo { font-size: 24px; }
  .gate-card { padding: 36px 24px 32px; }
  .gate-title { font-size: 26px; }
  .birth-name { font-size: 30px; }
  .labor-headline { font-size: 20px; }
  .card { padding: 18px; }
  .card-birth { padding: 22px 18px; }
  .comment-composer { flex-direction: column; }
  .comment-textarea { width: 100%; }
  .comment-send-btn { width: 100%; }
  .name-modal-card { padding: 36px 24px 32px; }

  /* 48px minimum touch targets for reactions */
  .reaction-btn { min-width: 48px; min-height: 48px; font-size: 22px; }
}

/* Very small — hide subtitle, keep title + live dot only */
@media (max-width: 480px) {
  .header-center { display: none; }
  /* Collapse the "Live" label but keep the pulsing green dot. */
  .live-text { display: none; }
  .live-badge { gap: 0; }
}

/* Below 380px — drop the live badge altogether; every pixel matters. */
@media (max-width: 379px) {
  .live-badge { display: none; }
}

/* Phase WEB-1 — feed cards: center + cap width on mobile, 20px inner padding */
@media (max-width: 640px) {
  .card-wrap {
    max-width: 560px;
    margin-left: auto;
    margin-right: auto;
    width: 100%;
  }
  .card { padding: 20px; }

  /* Reaction grid: 6 columns, uniform 12px gap. 12 emojis → 2 rows. */
  .reaction-buttons {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 12px;
    width: 100%;
    overflow-x: visible;
  }
  .reaction-bar { flex-direction: column; align-items: stretch; gap: 10px; }
  .reaction-btn {
    min-width: 0;
    width: 100%;
    padding: 6px 2px;
  }

  /* Admin sheet stats — stack vertically on very narrow viewports. */
  #admin-invites-sheet { padding: 12px; }
  .admin-invites-card { padding: 18px; }
}

@media (max-width: 400px) {
  .admin-invites-stats { flex-direction: column; gap: 8px; }
  .admin-invites-header { grid-template-columns: auto 1fr auto; gap: 6px; }
  .admin-invites-new-btn { padding: 8px 10px; font-size: 12px; }
}

/* ── Reaction hint — Caveat handwritten ──────────────────────────────────── */
.reaction-hint {
  font-family: 'Caveat', 'Caveat Brush', cursive;
  font-size: 18px;
  font-style: normal;
  color: var(--ink-muted);
  letter-spacing: 0.2px;
}

/* ── Ghost "Add a note…" affordance when a post has no comments ──────────── */
.comments-toggle.is-empty {
  display: flex;
  align-items: center;
  width: 100%;
  text-align: left;
  padding: 12px 14px;
  margin-top: 6px;
  margin-bottom: 0;
  border: 1.5px dashed var(--border);
  border-radius: 10px;
  background: var(--sand-light);
  color: var(--ink-muted);
  font-family: 'Caveat', 'Caveat Brush', cursive;
  font-size: 18px;
  font-style: normal;
  font-weight: 600;
  letter-spacing: 0.2px;
  transition: background 0.15s, border-color 0.15s;
}
.comments-toggle.is-empty:hover {
  background: var(--paper);
  border-color: var(--sand-deep);
  color: var(--ink-soft);
}

/* ── Loading escape-hatch link (Phase WEB-1 Layer 2) ─────────────────────── */
.loading-refresh-link {
  display: block;
  margin: 20px auto 0;
  background: transparent;
  border: 0;
  color: var(--frame-sub);
  font-family: 'Caveat', 'Caveat Brush', cursive;
  font-size: 18px;
  font-style: normal;
  text-decoration: underline;
  cursor: pointer;
  padding: 8px 12px;
}
.loading-refresh-link:hover { color: var(--frame-text); }


/* ─────────────────────────────────────────────────────────────────────────── */
/* Phase 4a — auth gate (replaces password gate)                               */
/* ─────────────────────────────────────────────────────────────────────────── */

.auth-toggle {
  display: flex;
  background: var(--surface-alt, #EFE6D7);
  border-radius: 10px;
  padding: 3px;
  margin: 8px 0 18px;
  gap: 2px;
}
.auth-toggle-btn {
  flex: 1;
  border: 0;
  background: transparent;
  padding: 10px 0;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  /* Fixed dark text — the pill background is always light (cream), so don't use
     theme ink tokens (they flip to light in dark mode → invisible). */
  color: #6B5640;
  cursor: pointer;
  font-family: inherit;
}
.auth-toggle-btn.is-active {
  background: #FFFFFF;
  color: #2A1505;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
}

.auth-google-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  background: #FFFFFF;
  padding: 12px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  color: #2A1505;
  cursor: pointer;
  font-family: inherit;
  margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
}
.auth-google-btn:hover { background: #FFFDF8; }
.auth-google-btn:disabled { opacity: 0.55; cursor: not-allowed; }
.auth-google-g {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4285F4 0%, #34A853 40%, #FBBC04 70%, #EA4335 100%);
  color: white;
  font-weight: 700;
  font-size: 12px;
}

.auth-or {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}
.auth-or-line {
  flex: 1;
  height: 1px;
  background: var(--border, rgba(59, 26, 8, 0.12));
}
.auth-or-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--ink-faint, #A89B87);
}

.auth-confirm-hidden { display: none; }
.auth-mode-signup .auth-confirm-hidden { display: block; }
.auth-mode-signup #gate-subtitle::after { content: ' Create your account.'; display: none; }

.auth-helper {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(184, 98, 26, 0.08);
  border: 1px solid rgba(184, 98, 26, 0.16);
  color: var(--ink-muted, #7A6A58);
  font-size: 12px;
  line-height: 1.45;
}

.auth-forgot-btn {
  background: transparent;
  border: 0;
  color: var(--accent, #B8621A);
  font-size: 12px;
  font-weight: 500;
  margin-top: 10px;
  cursor: pointer;
  align-self: flex-end;
  font-family: inherit;
}
.auth-forgot-btn:hover { text-decoration: underline; }

.gate-notice {
  color: var(--accent, #1C3D2E);
  font-size: 13px;
  margin-top: 10px;
  text-align: center;
  min-height: 18px;
}

.auth-invite-note {
  font-size: 11px;
  color: var(--ink-faint, #A89B87);
  text-align: center;
  margin-top: 14px;
  line-height: 1.5;
}

/* Sign-out button in header — Phase WEB-1: 40x40 hit target, SVG door icon */
.sign-out-btn {
  background: rgba(255, 248, 238, 0.08);
  border: 1px solid rgba(255, 248, 238, 0.22);
  color: var(--frame-text);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
  padding: 0;
  flex-shrink: 0;
  transition: background 0.15s, transform 0.1s;
}
.sign-out-btn:hover  { background: rgba(255, 248, 238, 0.18); }
.sign-out-btn:active { transform: scale(0.94); }

/* Shared header-button SVG sizing */
.header-icon-svg {
  width: 20px;
  height: 20px;
  display: block;
}

/* ─────────────────────────────────────────────────────────────────────────── */
/* Phase 4b — profile edit sheet + header avatar button                         */
/* ─────────────────────────────────────────────────────────────────────────── */

.profile-btn {
  background: transparent;
  border: 0;
  padding: 0;
  cursor: pointer;
  font-family: inherit;
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.profile-btn-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--sand-deep, #DCC5A3);
  color: var(--ink, #3B1A08);
  font-family: Georgia, serif;
  font-weight: 700;
  font-size: 15px;
  border: 2px solid rgba(255, 248, 238, 0.28);
  overflow: hidden;
  background-size: cover;
  background-position: center;
}

#profile-sheet {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}
#profile-sheet.open { display: flex; }

.profile-sheet-card {
  background: var(--surface, #FBF6EE);
  border-radius: 16px;
  padding: 28px 24px 24px;
  max-width: 420px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  box-shadow: 0 8px 24px rgba(59, 26, 8, 0.18);
}

.profile-sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.profile-sheet-title {
  font-family: Georgia, serif;
  font-size: 22px;
  font-weight: 700;
  color: var(--ink, #3B1A08);
  margin: 0;
}
.profile-close-btn {
  background: transparent;
  border: 0;
  font-size: 18px;
  color: var(--ink-muted, #7A6A58);
  cursor: pointer;
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  padding: 0;
}
.profile-close-btn:hover { background: rgba(59, 26, 8, 0.06); }

.profile-avatar-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}
.profile-avatar-preview {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: var(--sand-deep, #DCC5A3);
  color: var(--ink, #3B1A08);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: Georgia, serif;
  font-size: 38px;
  font-weight: 700;
  border: 2px solid var(--border, rgba(59, 26, 8, 0.12));
  overflow: hidden;
  background-size: cover;
  background-position: center;
}
.profile-avatar-actions {
  display: flex;
  gap: 10px;
}
.profile-avatar-btn {
  display: inline-block;
  padding: 8px 14px;
  border-radius: 8px;
  background: var(--accent-dark, #1C3D2E);
  color: var(--cream, #FBF6EE);
  border: 0;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
}
.profile-avatar-btn-subtle {
  background: transparent;
  color: var(--ink-muted, #7A6A58);
  border: 1px solid var(--border, rgba(59, 26, 8, 0.12));
}

.profile-field-label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--ink-muted, #7A6A58);
  margin: 14px 0 6px;
}
.profile-select {
  width: 100%;
  padding: 10px 12px;
  font-size: 14px;
  color: var(--ink, #3B1A08);
  background: var(--surface, #FBF6EE);
  border: 1px solid var(--border, rgba(59, 26, 8, 0.12));
  border-radius: 8px;
  font-family: inherit;
}
.profile-color-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  justify-content: flex-start;
}
/* Phase WEB-1: ring is a 44x44 hit target; the visible swatch is 36x36 inside. */
.profile-color-ring {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid transparent;
  padding: 0;
  cursor: pointer;
  background: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s, transform 0.1s;
}
.profile-color-ring:hover { transform: scale(1.06); }
.profile-color-ring.is-active {
  border-color: var(--labor-red, #8B2020);
}
.profile-color-swatch {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.12);
  display: block;
}

/* ─────────────────────────────────────────────────────────────────────────── */
/* Phase 4c — inline author avatar on post cards (gated by USE_V2_PROFILES)    */
/* ─────────────────────────────────────────────────────────────────────────── */

.card-author-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  margin-right: 6px;
  background: var(--sand-deep, #DCC5A3);
  color: var(--ink, #3B1A08);
  font-family: Georgia, serif;
  font-weight: 700;
  font-size: 11px;
  border: 2px solid var(--border, rgba(59, 26, 8, 0.12));
  vertical-align: middle;
  overflow: hidden;
  flex-shrink: 0;
}

/* ─────────────────────────────────────────────────────────────────────────── */
/* Phase 4e-1 — invite code gate                                                */
/* ─────────────────────────────────────────────────────────────────────────── */

#invite-gate {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--bg, #EAD9BF);
  align-items: center;
  justify-content: center;
  z-index: 500;
  padding: 20px;
}
#invite-gate.open { display: flex; }

.invite-code-input {
  text-align: center;
  font-family: 'Menlo', 'Courier New', monospace;
  /* 24px ≥ 16px — prevents mobile Safari auto-zoom on focus. */
  font-size: 24px;
  letter-spacing: 4px;
  text-transform: uppercase;
}

/* Phase WEB-1 — guarantee a 48px Continue button + 44px sign-out hit area. */
#invite-submit-btn { min-height: 48px; }
#invite-signout-btn {
  padding-top: 14px;
  padding-bottom: 14px;
  min-height: 44px;
}

.invite-help {
  color: var(--ink-muted, #7A6A58);
  font-size: 13px;
  line-height: 1.45;
  margin: -16px 0 18px;
}

/* ─────────────────────────────────────────────────────────────────────────── */
/* Phase 4e-2 — admin invites sheet                                             */
/* ─────────────────────────────────────────────────────────────────────────── */

.admin-hidden { display: none !important; }

.admin-invites-btn {
  background: rgba(255, 248, 238, 0.08);
  border: 1px solid rgba(255, 248, 238, 0.22);
  color: var(--frame-text);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  flex-shrink: 0;
  transition: background 0.15s, transform 0.1s;
}
.admin-invites-btn:hover  { background: rgba(255, 248, 238, 0.18); }
.admin-invites-btn:active { transform: scale(0.94); }

#admin-invites-sheet {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 900;
  padding: 20px;
}
#admin-invites-sheet.open { display: flex; }

.admin-invites-card {
  background: var(--surface, #FBF6EE);
  border-radius: 16px;
  padding: 24px;
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 8px 24px rgba(59, 26, 8, 0.18);
}
.admin-invites-header {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.admin-invites-helper {
  color: var(--ink-muted, #7A6A58);
  font-size: 13px;
  line-height: 1.45;
  margin: 0 0 18px;
  text-align: center;
}

.admin-invites-new-btn {
  background: var(--accent-dark, #1C3D2E);
  color: var(--cream, #FBF6EE);
  border: 0;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
}
.admin-invites-stats {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}
.admin-stat-pill {
  flex: 1;
  background: var(--cream, #FBF6EE);
  border: 1px solid var(--border, rgba(59, 26, 8, 0.12));
  border-radius: 8px;
  padding: 10px;
  text-align: center;
}
.admin-stat-value {
  display: block;
  font-family: Georgia, serif;
  font-size: 22px;
  font-weight: 700;
  color: var(--ink, #3B1A08);
}
.admin-stat-label {
  display: block;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--ink-muted, #7A6A58);
}
.admin-invites-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.admin-invites-section-title {
  font-family: Georgia, serif;
  font-weight: 700;
  font-size: 16px;
  color: var(--ink, #3B1A08);
  margin: 0 0 8px;
}
.admin-invites-empty {
  font-size: 13px;
  color: var(--ink-muted, #7A6A58);
  font-style: italic;
}
.admin-code-card {
  background: var(--cream, #FBF6EE);
  border: 1px solid var(--border, rgba(59, 26, 8, 0.12));
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 10px;
  box-shadow: 0 2px 4px rgba(59, 26, 8, 0.06);
}
.admin-code-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
.admin-code-text {
  font-family: 'Menlo', 'Courier New', monospace;
  font-size: 20px;
  letter-spacing: 2px;
  color: var(--ink, #3B1A08);
}
.admin-code-pill {
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--cream, #FBF6EE);
}
.admin-code-pill.active { background: var(--accent-dark, #3B6B52); }
.admin-code-pill.joined { background: var(--accent, #D89456); }
.admin-code-pill.revoked { background: rgba(59, 26, 8, 0.25); }
.admin-code-note {
  font-family: 'Caveat', cursive;
  font-size: 18px;
  color: var(--ink-muted, #6B3A1F);
  margin: 4px 0 6px;
}
.admin-code-meta {
  font-size: 11px;
  color: var(--ink-muted, #7A6A58);
  margin-bottom: 8px;
}
.admin-code-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}
.admin-code-actions button {
  flex: 1;
  padding: 8px;
  border-radius: 8px;
  border: 0;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}
.admin-code-actions .admin-code-share {
  background: var(--accent-dark, #1C3D2E);
  color: var(--cream, #FBF6EE);
}
.admin-code-actions .admin-code-copy {
  background: transparent;
  border: 1px solid var(--border, rgba(59, 26, 8, 0.12));
  color: var(--ink, #3B1A08);
}
.admin-code-actions .admin-code-revoke {
  background: rgba(184, 98, 26, 0.15);
  color: var(--ink-muted, #6B3A1F);
}

#admin-create-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 950;
  padding: 20px;
}
#admin-create-modal.open { display: flex; }

.admin-create-card {
  background: var(--surface, #FBF6EE);
  border-radius: 16px;
  padding: 24px;
  max-width: 420px;
  width: 100%;
  box-shadow: 0 8px 24px rgba(59, 26, 8, 0.22);
}

.admin-create-helper,
.admin-created-share-hint {
  color: var(--ink-muted, #7A6A58);
  font-size: 13px;
  line-height: 1.45;
  text-align: center;
}

.admin-create-helper {
  margin: -4px 0 4px;
}

.admin-created-share-hint {
  margin: -6px 0 12px;
}

.admin-create-actions {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}
.admin-create-actions > * {
  flex: 1;
}
/* Phase WEB-1: code success view — large tappable code block. */
.admin-created-code {
  display: block;
  width: 100%;
  font-family: 'Menlo', 'Courier New', monospace;
  font-size: 36px;
  font-weight: 700;
  letter-spacing: 6px;
  text-align: center;
  color: var(--ink, #3B1A08);
  background: var(--cream, #FBF6EE);
  border: 1.5px solid var(--border, rgba(59, 26, 8, 0.12));
  border-radius: 12px;
  padding: 20px 12px;
  margin: 16px 0 6px;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}
.admin-created-code:hover  { background: var(--sand-light, #F5EDD8); }
.admin-created-code:active { transform: scale(0.99); }
.admin-created-code-hint {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--ink-muted, #7A6A58);
  text-align: center;
  margin: 0 0 14px;
  font-weight: 600;
}
.admin-created-note {
  font-family: 'Caveat', cursive;
  font-size: 20px;
  color: var(--ink-muted, #6B3A1F);
  text-align: center;
  margin-bottom: 12px;
}
.admin-done-link {
  background: transparent;
  border: 0;
  color: var(--ink-muted, #7A6A58);
  text-decoration: underline;
  font-size: 13px;
  margin-top: 14px;
  cursor: pointer;
  display: block;
  width: 100%;
  text-align: center;
  font-family: inherit;
}

/* ─────────────────────────────────────────────────────────────────────────── */
/* Phase 4d — Apple sign-in button                                              */
/* ─────────────────────────────────────────────────────────────────────────── */

.auth-apple-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 0;
  background: #000000;
  color: #FFFFFF;
  padding: 12px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  margin-bottom: 10px;
}
.auth-apple-btn:hover { background: #1a1a1a; }
.auth-apple-btn:disabled { opacity: 0.55; cursor: not-allowed; }
.auth-apple-logo {
  color: #FFFFFF;
  flex-shrink: 0;
}

/* ── Audio attachments (Phase VILLAGE-AUDIO web) ─────────────────────────── */
.audio-block {
  margin: 12px 0 14px;
  padding: 12px 14px;
  background: var(--sand-light);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.04);
}
.audio-label {
  font-family: 'Caveat', 'Caveat Brush', cursive;
  font-size: 18px;
  color: var(--ink-soft);
  text-align: center;
  margin-bottom: 8px;
}
.audio-player {
  width: 100%;
  /* Explicit min-height — mobile Safari/Chrome can collapse <audio controls>
     to 0 height, making the player invisible despite being in the DOM. */
  min-height: 44px;
  height: 44px;
  display: block;
  outline: none;
}
.audio-filename {
  margin-top: 6px;
  font-size: 11px;
  color: var(--ink-muted);
  font-family: 'Menlo', 'Courier New', monospace;
  word-break: break-all;
}

/* ─────────────────────────────────────────────────────────────────────────── */
/* Phase WEB-3 parity — reactions + comments + picker modal                   */
/* ─────────────────────────────────────────────────────────────────────────── */

/* ── Reaction chips + trigger (replaces the 12-button grid) ──────────────── */
.reaction-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 6px;
  min-height: 0;
  cursor: pointer;
}
.reaction-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 12px;
  color: var(--ink-muted);
  font-weight: 600;
  line-height: 1.4;
}
.reaction-chip.is-mine {
  border-color: var(--amber);
  background: rgba(184, 98, 26, 0.10);
  color: var(--amber);
}
.reaction-chip-emoji { font-size: 13px; }
.reaction-chip-count { font-variant-numeric: tabular-nums; }

.reaction-trigger {
  display: block;
  background: transparent;
  border: 0;
  padding: 6px 0;
  color: var(--ink-muted);
  font-family: 'Caveat', 'Caveat Brush', cursive;
  font-size: 16px;
  font-style: normal;
  cursor: pointer;
  text-align: left;
}
.reaction-trigger:hover { color: var(--ink-soft); }

.interaction-error {
  margin: 6px 0 10px;
  padding: 8px 10px;
  border: 1px solid rgba(139, 32, 32, 0.22);
  border-radius: 10px;
  background: rgba(139, 32, 32, 0.08);
  color: var(--labor-red);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
}
.interaction-error[hidden] { display: none; }

/* ── Reaction picker modal (shared across all posts) ─────────────────────── */
.reaction-picker-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1200;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.reaction-picker-modal.open { display: flex; }
.reaction-picker-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
}
.reaction-picker-card {
  position: relative;
  background: var(--cream, #FBF6EE);
  border-radius: 20px;
  padding: 28px 24px 20px;
  max-width: 360px;
  width: 100%;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
  z-index: 1;
}
.reaction-picker-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: transparent;
  border: 0;
  color: var(--ink-muted);
  font-size: 16px;
  cursor: pointer;
}
.reaction-picker-close:hover { background: rgba(0,0,0,0.05); }
.reaction-picker-title {
  font-family: Georgia, serif;
  font-size: 20px;
  color: var(--ink);
  text-align: center;
  margin: 0 0 4px;
}
.reaction-picker-sub {
  font-size: 13px;
  color: var(--ink-muted);
  text-align: center;
  margin: 0 0 18px;
}
.reaction-picker-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.reaction-picker-cell {
  aspect-ratio: 1;
  border-radius: 14px;
  border: 1.5px solid var(--border);
  background: var(--paper);
  font-size: 30px;
  cursor: pointer;
  transition: transform 0.1s, border-color 0.15s, background 0.15s;
}
.reaction-picker-cell:hover { transform: scale(1.05); border-color: var(--sand-deep); }
.reaction-picker-cell.is-active {
  border-width: 2px;
  border-color: var(--amber);
  background: rgba(184, 98, 26, 0.08);
}

/* ── Comments — Instagram-style composer + threading + hearts ────────────── */
.comments-section {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.3s ease;
}
.comments-section.open { grid-template-rows: 1fr; }
.comments-section-inner { overflow: hidden; min-height: 0; }

.comments-empty {
  font-size: 13px;
  color: var(--ink-muted);
  font-style: italic;
  text-align: center;
  padding: 8px 0 4px;
}
.comments-error {
  font-size: 13px;
  color: var(--labor-red);
  font-weight: 700;
  line-height: 1.4;
  padding: 10px 0 6px;
}

.comment-item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-bottom: 10px;
  /* Reset legacy single-bubble styles — the bubble is now a child. */
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 0;
}
.comment-item-reply {
  margin-left: 28px;
}
.comment-bubble {
  flex: 1;
  min-width: 0;
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 8px 12px;
}
.comment-header {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 2px;
}
.comment-name {
  font-family: Georgia, serif;
  font-weight: 700;
  font-size: 13px;
  color: var(--ink);
}
.comment-time {
  font-size: 11px;
  color: var(--ink-muted);
}
.comment-message {
  font-size: 14px;
  color: var(--ink-soft);
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}
.comment-deleted {
  font-style: italic;
  color: var(--ink-muted);
}

.comment-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding-top: 6px;
  flex-shrink: 0;
}
.comment-heart {
  background: transparent;
  border: 0;
  padding: 2px 4px;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  color: var(--ink-muted);
}
.comment-heart.is-mine { color: var(--amber); font-weight: 600; }
.comment-heart-count {
  font-size: 11px;
  font-weight: 600;
}
.comment-action-btn {
  background: transparent;
  border: 0;
  padding: 2px 4px;
  font-size: 11px;
  color: var(--forest);
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.comment-action-btn:hover { text-decoration: underline; }
.comment-delete-btn { color: rgba(139, 32, 32, 0.85); }

/* Reply banner above composer */
.reply-banner {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  margin: 4px 0;
  background: rgba(184, 98, 26, 0.10);
  border-radius: 10px;
  align-self: flex-start;
  font-size: 12px;
  color: var(--amber);
  font-weight: 600;
}
.reply-banner[hidden] { display: none; }
.reply-banner-cancel {
  background: transparent;
  border: 0;
  color: var(--amber);
  font-weight: 700;
  cursor: pointer;
  font-size: 12px;
  padding: 0;
}
.reply-banner-cancel:hover { text-decoration: underline; }

/* Instagram-style comment composer: [avatar] [pill input] [send] */
.comment-composer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 8px;
}
.comment-composer-avatar {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--sand-deep, #DCC5A3);
  color: var(--ink, #3B1A08);
  font-family: Georgia, serif;
  font-weight: 700;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--border);
  overflow: hidden;
  background-size: cover;
  background-position: center;
}
.comment-textarea {
  flex: 1;
  min-height: 36px;
  max-height: 120px;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 14px;
  font-family: var(--font-sans);
  color: var(--ink);
  background: var(--paper);
  outline: none;
  resize: none;
  line-height: 1.45;
}
.comment-textarea:focus { border-color: var(--sand-deep); }
.comment-send-btn {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--frame);
  color: var(--frame-text);
  border: 1px solid var(--amber);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
  opacity: 0.55;
  transition: opacity 0.15s, background 0.15s;
}
.comment-send-btn.is-ready { opacity: 1; }
.comment-send-btn:hover { background: var(--frame-mid); }
.comment-send-btn:disabled { opacity: 0.35; cursor: default; }

/* Retire legacy rules: old .reaction-buttons grid no longer rendered, but
   keep the class selectors as no-ops in case any cached bundle emits them. */
.reaction-buttons { display: none; }
.reaction-bar { display: none; }
.reactor-pills { display: none; }
.reaction-hint { display: none; }

/* ─────────────────────────────────────────────────────────────────────────── */
/* Checkpoint 1 — About button + first-visit onboarding + privacy line          */
/* ─────────────────────────────────────────────────────────────────────────── */

/* Header About (ⓘ) button — mirrors the sign-out button's translucent pill. */
.about-btn {
  background: rgba(255, 248, 238, 0.08);
  border: 1px solid rgba(255, 248, 238, 0.22);
  color: var(--frame-text);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
  padding: 0;
  flex-shrink: 0;
  transition: background 0.15s, transform 0.1s;
}
.about-btn:hover  { background: rgba(255, 248, 238, 0.18); }
.about-btn:active { transform: scale(0.94); }

/* Footer — privacy assurance line, kept quiet beneath the "Made with 💛" line. */
.footer-line { font-size: 13px; }
.footer-privacy {
  margin-top: 6px;
  font-size: 12px;
  letter-spacing: 0.2px;
  color: rgba(255, 248, 238, 0.5);
}

/* Onboarding overlay */
.onboarding-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}
.onboarding-overlay[hidden] { display: none; }
body.onboarding-open { overflow: hidden; }

.onboarding-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(42, 31, 20, 0.62);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}

.onboarding-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 460px;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow-lg);
  padding: 30px 26px 26px;
  animation: onboarding-rise 0.28s cubic-bezier(0.2, 0.8, 0.3, 1);
}
@keyframes onboarding-rise {
  from { opacity: 0; transform: translateY(14px) scale(0.985); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.onboarding-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--sand-light);
  color: var(--ink-soft);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, transform 0.1s;
}
.onboarding-close:hover  { background: var(--sand-deep); }
.onboarding-close:active { transform: scale(0.92); }

.onboarding-hero { text-align: center; margin-bottom: 18px; }
.onboarding-leaf { font-size: 38px; display: block; line-height: 1; }
.onboarding-title {
  font-family: var(--font-serif);
  font-size: 24px;
  line-height: 1.2;
  color: var(--ink);
  margin: 10px 0 4px;
}
.onboarding-tagline {
  font-family: 'Caveat', var(--font-serif);
  font-size: 19px;
  color: var(--amber);
  margin: 0;
}

.onboarding-steps { display: flex; flex-direction: column; gap: 12px; }
.onboarding-step {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  background: var(--sand-light);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 14px;
}
.onboarding-step-promise {
  background: var(--amber-light);
  border-color: #EAD3B4;
}
.onboarding-step-icon { font-size: 22px; line-height: 1.2; flex-shrink: 0; }
.onboarding-step-body { min-width: 0; }
.onboarding-step-title {
  font-family: var(--font-serif);
  font-size: 16px;
  color: var(--ink);
  margin: 0 0 4px;
}
.onboarding-step-text {
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink-soft);
  margin: 0;
}
.onboarding-list {
  margin: 0;
  padding-left: 18px;
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink-soft);
}
.onboarding-list li { margin: 0; }
.onboarding-list strong { color: var(--forest); }

.onboarding-done {
  display: block;
  width: 100%;
  margin-top: 20px;
  background: var(--forest);
  color: var(--frame-text);
  border: 0;
  border-radius: 12px;
  padding: 14px 18px;
  font-family: var(--font-sans);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}
.onboarding-done:hover  { background: var(--forest-mid); }
.onboarding-done:active { transform: scale(0.98); }

@media (max-width: 520px) {
  .onboarding-card { padding: 26px 18px 20px; border-radius: 16px; }
  .onboarding-title { font-size: 21px; }
  .about-btn { width: 38px; height: 38px; }
}

/* ─────────────────────────────────────────────────────────────────────────── */
/* Checkpoint 4 — sealed time-capsule moon letters                              */
/* ─────────────────────────────────────────────────────────────────────────── */

.moon-seal-controls { margin-top: 12px; }

.moon-seal-toggle {
  display: inline-flex;
  gap: 4px;
  padding: 3px;
  border-radius: 999px;
  background: var(--sand-deep);
  border: 1px solid var(--border);
}
.moon-seal-opt {
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  padding: 7px 16px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.moon-seal-opt.is-active {
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

.moon-seal-when {
  margin-top: 12px;
  padding: 14px;
  border-radius: 12px;
  border: 1px solid #2A2740;
  background: radial-gradient(120% 120% at 90% -10%, #2C2F5A 0%, #1C1E3A 60%, #181A30 100%);
  color: rgba(243, 240, 255, 0.92);
}
.moon-seal-when-label {
  font-family: var(--font-sans);
  font-size: 12px;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: rgba(247, 240, 214, 0.72);
  margin-bottom: 10px;
}
.moon-seal-modes { display: flex; flex-wrap: wrap; gap: 6px; }
.moon-mode-opt {
  border: 1px solid rgba(247, 240, 214, 0.28);
  background: rgba(255, 255, 255, 0.05);
  color: rgba(243, 240, 255, 0.9);
  font-family: var(--font-sans);
  font-size: 12.5px;
  font-weight: 600;
  padding: 7px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.moon-mode-opt.is-active {
  background: rgba(247, 240, 214, 0.92);
  color: #1C1E3A;
  border-color: rgba(247, 240, 214, 0.92);
}
.moon-seal-date-input,
.moon-seal-milestone-select {
  margin-top: 10px;
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(247, 240, 214, 0.3);
  background: rgba(255, 255, 255, 0.95);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 14px;
}
.moon-seal-hint {
  margin: 10px 0 0;
  font-size: 12px;
  line-height: 1.45;
  color: rgba(247, 240, 214, 0.7);
}

/* Sealed letter card — cosmic, with the body withheld until opened. */
.moon-letter-sealed {
  text-align: center;
  border: 1px solid #2A2740;
  background: radial-gradient(120% 120% at 50% -20%, #2C2F5A 0%, #1C1E3A 58%, #181A30 100%);
  color: rgba(243, 240, 255, 0.92);
}
.moon-letter-sealed .moon-letter-author { color: rgba(247, 240, 214, 0.95); }
.moon-letter-sealed .moon-letter-rel { color: rgba(247, 240, 214, 0.62); }
.moon-sealed-emblem {
  font-size: 30px;
  line-height: 1;
  margin: 10px 0 6px;
  filter: drop-shadow(0 0 8px rgba(255, 240, 200, 0.45));
}
.moon-sealed-title {
  font-family: var(--font-serif);
  font-size: 18px;
  color: #FBF3DC;
  margin-bottom: 4px;
}
.moon-sealed-when {
  font-size: 13px;
  line-height: 1.5;
  color: rgba(243, 240, 255, 0.8);
}
.moon-foot-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.moon-open-btn {
  border: 0;
  background: #F7F0D6;
  color: #1C1E3A;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 700;
  padding: 7px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 0.1s, background 0.15s;
}
.moon-open-btn:hover  { background: #fff; }
.moon-open-btn:active { transform: scale(0.96); }
.moon-letter-sealed .moon-letter-date { color: rgba(247, 240, 214, 0.55); }
.moon-letter-sealed .moon-letter-delete { color: rgba(255, 200, 200, 0.85); }

.moon-ready-chip {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.3px;
  color: #1C1E3A;
  background: rgba(247, 240, 214, 0.92);
  padding: 4px 9px;
  border-radius: 999px;
}
.moon-opened-chip {
  font-size: 11px;
  font-weight: 700;
  color: var(--amber);
  margin-right: 4px;
}

.moon-gift-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 10px;
  border: 1px solid rgba(184, 98, 26, 0.4);
  background: var(--amber-light);
  color: var(--amber);
  font-family: var(--font-sans);
  font-size: 12.5px;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}
.moon-gift-badge:hover  { background: #F6E2C6; }
.moon-gift-badge:active { transform: scale(0.96); }
.moon-letter-sealed .moon-gift-badge {
  border-color: rgba(247, 240, 214, 0.4);
  background: rgba(247, 240, 214, 0.12);
  color: #F7E9C8;
}

/* Checkpoint 5 — "Attach a gift" toggle in the moon composer */
.moon-gift-attach {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 6px 10px;
  margin-top: 12px;
  cursor: pointer;
}
.moon-gift-attach input {
  width: 18px;
  height: 18px;
  accent-color: var(--amber);
  cursor: pointer;
}
.moon-gift-attach-text {
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-soft);
}
.moon-gift-attach-hint {
  grid-column: 2;
  font-size: 12px;
  line-height: 1.4;
  color: var(--ink-muted);
}

/* Gift composer — money / song / note options */
.moon-gift-options {
  margin-top: 10px;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--sand-deep);
  display: grid;
  gap: 10px;
}
.moon-gift-kinds {
  display: inline-flex;
  gap: 4px;
  padding: 3px;
  border-radius: 999px;
  background: var(--paper);
  border: 1px solid var(--border);
  width: fit-content;
}
.moon-gift-kind {
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  padding: 6px 13px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.moon-gift-kind.is-active {
  background: var(--amber-light);
  color: var(--amber);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}
.moon-gift-money-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  align-self: flex-start;
  padding: 9px 15px;
  border-radius: 10px;
  border: 1px solid rgba(184, 98, 26, 0.45);
  background: var(--amber);
  color: #fff;
  font-family: var(--font-sans);
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  transition: filter 0.15s, transform 0.1s;
}
.moon-gift-money-btn:hover  { filter: brightness(1.05); }
.moon-gift-money-btn:active { transform: scale(0.97); }
.moon-gift-input {
  width: 100%;
  box-sizing: border-box;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--paper);
  font-family: var(--font-sans);
  font-size: 14px;
  color: var(--ink);
}
.moon-gift-options-hint {
  font-size: 12px;
  line-height: 1.4;
  color: var(--ink-muted);
  margin: 0;
}
.moon-gift-upload-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.moon-gift-upload { display: inline-flex; cursor: pointer; }
.moon-gift-upload input[type="file"] {
  width: 0.1px;
  height: 0.1px;
  opacity: 0;
  position: absolute;
  z-index: -1;
}
.moon-gift-upload-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 8px 13px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--paper);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
}
.moon-gift-upload-btn:hover { background: var(--sand-light); }
.moon-gift-file-name {
  font-family: var(--font-sans);
  font-size: 12px;
  color: var(--ink-muted);
  word-break: break-all;
}
.moon-gift-audio {
  margin-top: 10px;
  width: 100%;
}
.moon-gift-song-preview { margin-top: 4px; }
.moon-gift-song-ready {
  font-family: var(--font-sans);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--amber);
}

/* Rendered gift on a letter */
.moon-gift-song {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 10px;
  border: 1px solid rgba(184, 98, 26, 0.4);
  background: var(--amber-light);
  color: var(--amber);
  font-family: var(--font-sans);
  font-size: 12.5px;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 999px;
  text-decoration: none;
  transition: background 0.15s, transform 0.1s;
}
.moon-gift-song:hover  { background: #F6E2C6; }
.moon-gift-song:active { transform: scale(0.96); }
.moon-gift-note {
  margin-top: 10px;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid rgba(184, 98, 26, 0.28);
  background: var(--amber-light);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 1.45;
}
.moon-gift-sealed {
  margin-top: 10px;
  font-family: var(--font-sans);
  font-size: 12.5px;
  font-weight: 600;
  color: rgba(247, 240, 214, 0.78);
}

/* ── Scan timeline keepsake ───────────────────────────────────────────────── */
.card-scan {
  background: var(--sand-light);
}
.scan-masthead {
  text-align: center;
  margin-bottom: 22px;
}
.scan-kicker {
  font-family: 'Caveat', cursive;
  font-size: 20px;
  color: var(--amber);
}
.scan-heading {
  font-family: 'Playfair Display', var(--font-serif);
  font-size: 30px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.1;
  margin-top: 2px;
}
.scan-sub {
  font-size: 14px;
  color: var(--ink-muted);
  margin-top: 6px;
}

.scan-timeline {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 30px;
  padding-top: 8px;
}
/* faint thread running down the timeline */
.scan-timeline::before {
  content: '';
  position: absolute;
  top: 4px;
  bottom: 24px;
  left: 50%;
  width: 2px;
  background: linear-gradient(var(--sand-deep), rgba(212, 200, 176, 0));
  transform: translateX(-50%);
  opacity: 0.6;
  z-index: 0;
}

.scan-card {
  position: relative;
  z-index: 1;
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}
/* red pushpin holding each card to the board */
.scan-card::before {
  content: '';
  position: absolute;
  top: -9px;
  left: 50%;
  transform: translateX(-50%);
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #e86a6a, #b02020 50%, #6e1212);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4), inset 0 1px 2px rgba(255, 255, 255, 0.4);
  z-index: 2;
}

.scan-card-tabs {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin: 4px 0 12px;
}
.scan-group {
  background: var(--forest);
  color: var(--frame-text);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.3px;
  padding: 3px 10px;
  border-radius: 999px;
}
.scan-time {
  font-size: 12px;
  color: var(--ink-muted);
}

.scan-card-photo {
  border-radius: 6px;
  overflow: hidden;
  background: var(--sand);
  margin-bottom: 12px;
}
.scan-card-photo img {
  display: block;
  width: 100%;
  height: auto;
}

.scan-card-title {
  font-family: 'Playfair Display', var(--font-serif);
  font-size: 19px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 4px;
}
.scan-card-intro {
  font-family: 'Caveat', cursive;
  font-size: 21px;
  color: var(--ink-soft);
  line-height: 1.2;
  margin-bottom: 8px;
}
.scan-card-detail {
  font-family: var(--font-serif);
  font-size: 15px;
  color: var(--ink);
  line-height: 1.55;
}

/* scroll reveal — only applied once JS wires the observer, so cards stay
   visible if scripting is unavailable */
.scan-card.reveal-ready {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.scan-card.reveal-ready.reveal-in {
  opacity: 1;
  transform: none;
}
@media (prefers-reduced-motion: reduce) {
  .scan-card.reveal-ready {
    transition: none;
    opacity: 1;
    transform: none;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════ */
/* SOCIAL DASHBOARD REDESIGN (v2)                                               */
/* A modern 3-column layout (left rail / center stream / right panel) in the    */
/* Village's warm palette, with a charcoal dark theme via token overrides and a */
/* phone-friendly bottom tab bar. Every original :root color is untouched —     */
/* this section only reassigns where they're applied and adds new components.   */
/* ═══════════════════════════════════════════════════════════════════════════ */

:root {
  --rail-w: 290px;
  --right-w: 340px;
  --shell-max: 1500px;
  --shell-gap: 22px;
  --topbar-h: 56px;
  --tabbar-h: 60px;
  --v-online: #22c55e;
}

/* ── App shell ──────────────────────────────────────────────────────────── */
#app { background: transparent; }
#app.visible { display: flex; flex-direction: column; min-height: 100vh; }

/* Original tab bar is retired — its 3 buttons are reparented into the left rail. */
#view-tabs, #app.visible #view-tabs { display: none !important; }

.village-shell {
  flex: 1;
  width: 100%;
  max-width: var(--shell-max);
  margin: 0 auto;
  display: grid;
  grid-template-columns: var(--rail-w) minmax(0, 1fr) var(--right-w);
  gap: var(--shell-gap);
  padding: var(--shell-gap);
  align-items: start;
}

/* Sticky columns that scroll independently of the page on desktop. */
.v-left, .v-right { position: sticky; top: var(--shell-gap); align-self: start; }
.v-left-scroll, .v-right-scroll {
  max-height: calc(100vh - var(--shell-gap) * 2);
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-right: 4px;
  scrollbar-width: thin;
}
.v-left-scroll::-webkit-scrollbar, .v-right-scroll::-webkit-scrollbar { width: 7px; }
.v-left-scroll::-webkit-scrollbar-thumb, .v-right-scroll::-webkit-scrollbar-thumb {
  background: rgba(0,0,0,0.18); border-radius: 99px;
}

/* Shared card surface for rail/right panels. */
.v-card, .v-left-scroll > .v-profile, .v-left-scroll > .v-contacts {
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

/* ── Mobile top bar (hidden on desktop) ─────────────────────────────────── */
.v-topbar { display: none; }

/* ── LEFT RAIL ──────────────────────────────────────────────────────────── */
.v-brand { display: flex; align-items: center; gap: 10px; padding: 4px 6px 0; }
.v-brand-mark { font-size: 26px; filter: drop-shadow(0 1px 2px rgba(0,0,0,0.2)); }
.v-brand-text { display: flex; flex-direction: column; min-width: 0; }
.v-brand-sub { font-family: 'Caveat', cursive; font-size: 15px; color: var(--ink-muted); line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.v-brand-sub:empty { display: none; }
.v-left .header-logo {
  font-family: var(--font-serif);
  font-size: 24px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.4px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* Profile card */
.v-profile {
  display: flex; flex-direction: column; align-items: center;
  text-align: center;
  padding: 22px 18px 18px;
}
.v-profile-avatar-btn {
  width: 84px; height: 84px;
  border-radius: 50%;
  border: 3px solid var(--forest);
  background: var(--sand-light);
  padding: 0; cursor: pointer;
  overflow: hidden;
  display: grid; place-items: center;
  box-shadow: 0 4px 14px rgba(0,0,0,0.18);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.v-profile-avatar-btn:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(0,0,0,0.24); }
.v-profile-avatar-btn .profile-btn-avatar {
  width: 100%; height: 100%;
  display: grid; place-items: center;
  font-family: var(--font-serif);
  font-size: 32px; font-weight: 700;
  color: var(--frame-text);
  background: var(--forest);
  object-fit: cover;
}
.v-profile-avatar-btn .profile-btn-avatar img { width: 100%; height: 100%; object-fit: cover; }
.v-profile-id { display: flex; align-items: center; gap: 5px; margin-top: 12px; }
.v-profile-name {
  font-family: var(--font-serif);
  font-size: 19px; font-weight: 700; color: var(--ink);
  letter-spacing: -0.3px;
}
.v-verified { width: 17px; height: 17px; color: var(--ocean, #2A4D6B); flex-shrink: 0; }
.v-profile-sub { font-size: 13px; color: var(--ink-muted); margin-top: 2px; min-height: 16px; }
.v-profile-bio {
  font-size: 13px; line-height: 1.5; color: var(--ink-soft);
  margin-top: 10px; max-width: 220px;
}
.v-profile-stats {
  display: flex; justify-content: space-around;
  width: 100%; margin-top: 16px; padding-top: 14px;
  border-top: 1px solid var(--border);
  gap: 6px;
}
.v-stat { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.v-stat-num { font-family: var(--font-serif); font-size: 18px; font-weight: 700; color: var(--forest); }
.v-stat-label { font-size: 11px; color: var(--ink-muted); text-transform: uppercase; letter-spacing: 0.4px; }

/* Nav */
.v-nav { display: flex; flex-direction: column; gap: 3px; }
.v-nav-secondary { display: flex; flex-direction: column; gap: 3px; }
.v-nav-item {
  display: flex; align-items: center; gap: 13px;
  width: 100%;
  padding: 11px 14px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 600;
  color: var(--ink-soft);
  cursor: pointer;
  text-align: left;
  position: relative;
  transition: background 0.14s ease, color 0.14s ease;
}
.v-nav-item:hover { background: var(--sand-light); color: var(--ink); }
.v-nav-item.is-active { background: var(--forest); color: var(--frame-text); box-shadow: 0 4px 12px rgba(28,61,46,0.28); }
.v-nav-item.is-active .v-nav-ico { color: var(--frame-text); }
.v-nav-ico {
  width: 22px; height: 22px;
  display: inline-grid; place-items: center;
  color: var(--forest);
  font-size: 18px; line-height: 1;
  flex-shrink: 0;
}
.v-nav-item.is-active .v-nav-ico svg { stroke: var(--frame-text); }
.v-nav-ico svg { width: 21px; height: 21px; }
.v-nav-text { flex: 1; }
.v-nav-badge {
  min-width: 20px; height: 20px; padding: 0 6px;
  border-radius: 99px;
  background: var(--amber);
  color: #fff; font-size: 12px; font-weight: 700;
  display: inline-grid; place-items: center;
}
.v-nav-sep { height: 1px; background: var(--border); margin: 4px 8px; }
.v-signout .v-nav-ico { color: var(--ink-muted); }
.v-signout:hover { color: var(--labor-red); }
.v-signout:hover .v-nav-ico svg { stroke: var(--labor-red); }

/* Contacts / who's-here list in the rail */
.v-contacts { padding: 14px 12px 12px; }
.v-contacts-head { display: flex; align-items: center; justify-content: space-between; padding: 0 6px 10px; }
.v-contacts-title { font-family: var(--font-serif); font-size: 15px; font-weight: 700; color: var(--ink); }
.v-contacts-live {
  display: flex; align-items: center; gap: 5px;
  border: 0; background: transparent; cursor: pointer;
  font-size: 12px; font-weight: 700; color: var(--forest-mid);
}
.v-contacts-live .live-dot { width: 7px; height: 7px; }
.v-contacts-list { display: flex; flex-direction: column; gap: 2px; }
.v-contacts-loading { font-size: 13px; color: var(--ink-muted); padding: 6px; }
.v-contact-row {
  display: flex; align-items: center; gap: 11px;
  padding: 7px 6px; border-radius: 11px;
  transition: background 0.14s ease;
}
.v-contact-row:hover { background: var(--sand-light); }
.v-contact-av {
  width: 38px; height: 38px; border-radius: 50%;
  display: grid; place-items: center; flex-shrink: 0;
  font-family: var(--font-serif); font-weight: 700; font-size: 15px;
  color: #fff; overflow: hidden;
  position: relative;
}
.v-contact-av img { width: 100%; height: 100%; object-fit: cover; }
.v-contact-av, .v-composer-avatar, .v-presence-av, .v-profile-avatar-btn .profile-btn-avatar { background-size: cover; background-position: center; }
.v-contact-av.is-online::after {
  content: ''; position: absolute; right: -1px; bottom: -1px;
  width: 11px; height: 11px; border-radius: 50%;
  background: var(--v-online); border: 2px solid var(--paper);
}
.v-contact-meta { min-width: 0; flex: 1; }
.v-contact-name { font-size: 14px; font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.v-contact-sub { font-size: 12px; color: var(--ink-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Rail footer */
.v-left-foot { display: flex; flex-direction: column; gap: 8px; padding-top: 4px; }
.v-theme-toggle {
  display: flex; align-items: center; gap: 12px;
  width: 100%; padding: 9px 14px;
  border: 1px solid var(--border); border-radius: 12px;
  background: var(--sand-light); cursor: pointer;
  font-family: var(--font-sans); font-size: 14px; font-weight: 600; color: var(--ink-soft);
}
.v-theme-track {
  width: 40px; height: 22px; border-radius: 99px;
  background: var(--sand-deep); position: relative; flex-shrink: 0;
  transition: background 0.2s ease;
}
.v-theme-thumb {
  position: absolute; top: 2px; left: 2px;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--paper); box-shadow: 0 1px 3px rgba(0,0,0,0.3);
  transition: transform 0.2s ease;
}
html[data-theme="dark"] .v-theme-track { background: var(--forest-mid); }
html[data-theme="dark"] .v-theme-thumb { transform: translateX(18px); }

/* ── CENTER STREAM ──────────────────────────────────────────────────────── */
#feed-wrap.v-center { flex: initial; padding: 0; min-width: 0; }
#feed-wrap.v-center > #feed,
#feed-wrap.v-center > #photos-view,
#feed-wrap.v-center > #moon-view,
#feed-wrap.v-center > #messages-view,
#feed-wrap.v-center > #notifications-view {
  width: 100%; max-width: 620px; margin: 0 auto;
}
#feed-wrap.v-center > #feed { padding-top: 6px; }

/* Intentional empty states for views whose backend is still landing. */
.v-view-empty { text-align: center; padding: 56px 28px; max-width: 460px; margin: 26px auto; }
.v-view-empty-emoji { font-size: 44px; display: block; margin-bottom: 14px; }
.v-view-empty h3 { font-family: var(--font-serif); font-size: 22px; color: var(--ink); margin-bottom: 8px; }
.v-view-empty p { font-size: 15px; line-height: 1.6; color: var(--ink-muted); }

/* Presence strip (the "stories" row, repurposed for live presence) */
.v-presence-strip {
  display: flex; gap: 14px;
  max-width: 620px; margin: 0 auto 16px;
  padding: 14px 16px;
  overflow-x: auto;
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
  scrollbar-width: none;
}
.v-presence-strip::-webkit-scrollbar { display: none; }
.v-presence-strip:empty { display: none; }
.v-presence-item { display: flex; flex-direction: column; align-items: center; gap: 6px; flex-shrink: 0; width: 62px; }
.v-presence-ring {
  width: 56px; height: 56px; border-radius: 50%;
  padding: 2.5px;
  background: linear-gradient(135deg, var(--amber), var(--forest-mid));
  display: grid; place-items: center;
}
.v-presence-ring.is-offline { background: var(--sand-deep); }
.v-presence-av {
  width: 100%; height: 100%; border-radius: 50%;
  border: 2.5px solid var(--paper);
  display: grid; place-items: center; overflow: hidden;
  font-family: var(--font-serif); font-weight: 700; font-size: 18px; color: #fff;
}
.v-presence-av img { width: 100%; height: 100%; object-fit: cover; }
.v-presence-name { font-size: 11px; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }

/* Composer (letters-only) */
.v-composer {
  display: flex; align-items: center; gap: 12px;
  max-width: 620px; margin: 0 auto 18px;
  padding: 14px 16px;
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
}
.v-composer-avatar {
  width: 42px; height: 42px; border-radius: 50%; flex-shrink: 0;
  display: grid; place-items: center; overflow: hidden;
  background: var(--forest); color: var(--frame-text);
  font-family: var(--font-serif); font-weight: 700; font-size: 17px;
}
.v-composer-avatar img { width: 100%; height: 100%; object-fit: cover; }
.v-composer-prompt {
  flex: 1; text-align: left;
  padding: 11px 16px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--sand-light);
  color: var(--ink-muted); font-family: var(--font-sans); font-size: 15px; cursor: pointer;
  transition: background 0.14s ease;
}
.v-composer-prompt:hover { background: var(--sand); }
.v-composer-hint {
  flex-shrink: 0; font-size: 12px; font-weight: 600; color: var(--amber);
  background: var(--amber-light); padding: 6px 11px; border-radius: 999px;
  white-space: nowrap;
}

/* ── RIGHT PANEL ────────────────────────────────────────────────────────── */
.v-right-messages, .v-right-gift { padding: 16px; }
.v-rm-head, .v-rg-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.v-rm-title, .v-rg-title { font-family: var(--font-serif); font-size: 18px; font-weight: 700; color: var(--ink); }
.v-rm-new {
  width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--sand-light); color: var(--ink-soft); cursor: pointer;
  display: grid; place-items: center;
}
.v-rm-new:hover { background: var(--forest); color: var(--frame-text); border-color: var(--forest); }
.v-rm-new svg { width: 17px; height: 17px; }
.v-rm-search { position: relative; margin-bottom: 12px; }
.v-rm-search-ico { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--ink-muted); pointer-events: none; }
.v-rm-search-input {
  width: 100%; padding: 10px 14px 10px 36px;
  border: 1px solid var(--border); border-radius: 999px;
  background: var(--sand-light); color: var(--ink); font-size: 14px; font-family: var(--font-sans);
}
.v-rm-search-input:focus { outline: none; border-color: var(--forest); background: var(--white); }
.v-rm-list { display: flex; flex-direction: column; gap: 2px; max-height: 360px; overflow-y: auto; }
.v-rm-empty { font-size: 13px; color: var(--ink-muted); padding: 10px 6px; line-height: 1.5; }
.v-rg-body { display: flex; flex-direction: column; gap: 10px; }
.v-rg-cta {
  width: 100%; padding: 12px; border-radius: 12px; border: 0; cursor: pointer;
  background: var(--amber); color: #fff; font-family: var(--font-sans); font-size: 14px; font-weight: 700;
}
.v-rg-cta:hover { filter: brightness(1.05); }

/* Footer inside the right column */
.v-right #footer {
  background: transparent; border: 0; padding: 8px 4px;
  text-align: left; color: var(--ink-muted);
}
.v-right #footer .footer-line { font-weight: 600; }
.v-right #footer .footer-privacy { margin-top: 4px; font-size: 12px; }

/* ── BOTTOM TAB BAR (phone only) ────────────────────────────────────────── */
.v-tabbar { display: none; }

/* ═══ DARK THEME — charcoal, accent pops (Moon zone already dark) ═══ */
html[data-theme="dark"] {
  --cork:        #14161b;
  --cork-dark:   #0f1115;
  --cork-light:  #1b1e25;
  --sand:        #2a2f39;
  --sand-deep:   #222630;
  --sand-light:  #20242c;
  --paper:       #1d2028;
  --frame:       #0f1116;
  --frame-mid:   #1c2028;
  --frame-text:  #F4F2EC;
  --frame-sub:   rgba(244,242,236,0.62);
  --forest:      #46b083;
  --forest-mid:  #5cc796;
  --ink:         #ECEAE3;
  --ink-soft:    #C7C2B8;
  --ink-muted:   #8B8678;
  --amber:       #E0852F;
  --amber-light: #2b2117;
  --white:       #15181f;
  --border:      #2e333d;
  --shadow:    0 6px 22px rgba(0,0,0,0.5), 0 1px 3px rgba(0,0,0,0.4);
  --shadow-lg: 0 14px 44px rgba(0,0,0,0.62), 0 2px 6px rgba(0,0,0,0.45);
}
html[data-theme="dark"] body { background-color: var(--cork); }
/* Patches for surfaces that hardcode warm values and would otherwise glare. */
html[data-theme="dark"] .loading-state { color: var(--ink-soft); text-shadow: none; }
html[data-theme="dark"] .v-profile-avatar-btn { border-color: var(--forest); }
html[data-theme="dark"] .v-composer-hint { color: var(--amber); }
html[data-theme="dark"] .v-nav-item.is-active { box-shadow: 0 4px 14px rgba(0,0,0,0.5); }
html[data-theme="dark"] .v-contact-av.is-online::after,
html[data-theme="dark"] .v-presence-av { border-color: var(--paper); }

/* ── RESPONSIVE ─────────────────────────────────────────────────────────── */

/* Tablet — drop the right column; it's reachable via overlays. */
@media (max-width: 1080px) {
  .village-shell { grid-template-columns: var(--rail-w) minmax(0, 1fr); }
  .v-right { display: none; }
}

/* Narrow tablet — collapse rail to icon-only width. */
@media (max-width: 860px) {
  :root { --rail-w: 76px; }
  .v-brand .header-logo,
  .v-profile-bio, .v-profile-stats, .v-profile-id, .v-profile-sub,
  .v-nav-text, .v-nav-badge, .v-contacts, .v-theme-label,
  .v-nav-sep { display: none; }
  .v-nav-item { justify-content: center; padding: 12px 0; }
  .v-profile { padding: 14px 6px; }
  .v-profile-avatar-btn { width: 48px; height: 48px; }
  .v-theme-toggle { justify-content: center; padding: 9px 0; }
}

/* Phone — full app shell: top bar + single column + bottom tab bar. */
@media (max-width: 720px) {
  :root { --rail-w: 0px; }
  #app.visible { padding-bottom: var(--tabbar-h); }

  .v-topbar {
    display: flex; align-items: center; gap: 10px;
    position: sticky; top: 0; z-index: 100;
    height: var(--topbar-h);
    padding: 0 16px;
    background: var(--frame);
    border-bottom: 1px solid var(--cork-dark);
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
  }
  .v-topbar-brand { font-size: 22px; }
  .v-topbar-title { font-family: var(--font-serif); font-size: 20px; font-weight: 700; color: var(--frame-text); flex: 1; }
  .v-topbar .live-badge { color: var(--frame-text); }

  .village-shell {
    grid-template-columns: minmax(0, 1fr);
    gap: 0; padding: 14px 12px 24px; max-width: 640px;
  }
  /* The rail collapses into the profile + contacts shown ABOVE the feed,
     while nav lives in the bottom tab bar. */
  .v-left { position: static; display: none; }
  .v-right { display: none; }
  .v-left-scroll { max-height: none; }

  #feed-wrap.v-center > #feed,
  #feed-wrap.v-center > #photos-view,
  #feed-wrap.v-center > #moon-view,
  #feed-wrap.v-center > #messages-view,
  #feed-wrap.v-center > #notifications-view,
  .v-presence-strip, .v-composer { max-width: 100%; }

  .v-tabbar {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 120;
    height: var(--tabbar-h);
    background: var(--paper);
    border-top: 1px solid var(--border);
    box-shadow: 0 -2px 14px rgba(0,0,0,0.16);
    padding-bottom: env(safe-area-inset-bottom, 0);
  }
  .v-tab {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    border: 0; background: transparent; cursor: pointer; position: relative;
    color: var(--ink-muted); font-family: var(--font-sans);
  }
  .v-tab-ico { font-size: 20px; line-height: 1; filter: grayscale(0.4); opacity: 0.75; }
  .v-tab-label { font-size: 10px; font-weight: 600; }
  .v-tab.is-active { color: var(--forest); }
  .v-tab.is-active .v-tab-ico { filter: none; opacity: 1; }
  .v-tab-badge {
    position: absolute; top: 6px; left: 56%;
    min-width: 16px; height: 16px; padding: 0 4px;
    background: var(--amber); color: #fff; font-size: 10px; font-weight: 700;
    border-radius: 99px; display: grid; place-items: center;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════ */
/* SOCIAL DASHBOARD v2.1 — full-width top header + denser / wider tuning         */
/* ═══════════════════════════════════════════════════════════════════════════ */

:root {
  --rail-w: 256px;
  --right-w: 308px;
  --shell-max: 1660px;
  --shell-gap: 16px;
  --topbar-h: 58px;
}

/* ── Full-width top header (all breakpoints) ──────────────────────────────── */
.v-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  position: sticky;
  top: 0;
  z-index: 200;
  height: var(--topbar-h);
  padding: 0 22px;
  background: var(--paper);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}
.v-topbar-brand { display: flex; align-items: center; gap: 11px; min-width: 0; }
.v-topbar .v-brand-mark { font-size: 23px; filter: drop-shadow(0 1px 2px rgba(0,0,0,0.18)); }
.v-topbar-titles { display: flex; flex-direction: column; min-width: 0; line-height: 1.12; }
.v-topbar-title {
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.4px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.v-topbar-sub {
  font-family: 'Caveat', cursive;
  font-size: 14px;
  color: var(--ink-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.v-topbar-sub:empty { display: none; }
.v-topbar-actions { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.v-topbar .live-badge { color: var(--ink-muted); font-weight: 700; font-size: 12px; opacity: 0.85; }

/* Compact theme toggle living in the header */
.v-theme-toggle-top { width: auto; padding: 5px 13px 5px 7px; border-radius: 999px; gap: 9px; }
.v-theme-toggle-top .v-theme-label { font-size: 13px; }

/* ── Columns sit below the sticky header ──────────────────────────────────── */
.v-left, .v-right { top: calc(var(--topbar-h) + 12px); }
.v-left-scroll, .v-right-scroll { max-height: calc(100vh - var(--topbar-h) - 24px); }

/* ── Denser chrome (the feed cards themselves are unchanged) ──────────────── */
.v-card, .v-left-scroll > .v-profile, .v-left-scroll > .v-contacts { border-radius: 16px; }
.v-left-scroll, .v-right-scroll { gap: 13px; }
.v-profile { padding: 18px 16px 14px; }
.v-profile-avatar-btn { width: 70px; height: 70px; border-width: 2.5px; }
.v-profile-avatar-btn .profile-btn-avatar { font-size: 27px; }
.v-profile-id { margin-top: 10px; }
.v-profile-name { font-size: 17px; }
.v-profile-bio { font-size: 12.5px; margin-top: 8px; }
.v-profile-stats { margin-top: 12px; padding-top: 12px; }
.v-stat-num { font-size: 16px; }
.v-stat-label { font-size: 10px; }
.v-nav-item { padding: 8px 12px; font-size: 14px; gap: 11px; border-radius: 11px; }
.v-nav-ico { width: 20px; height: 20px; font-size: 17px; }
.v-nav-ico svg { width: 19px; height: 19px; }
.v-contacts { padding: 12px 10px 10px; }
.v-contact-row { padding: 6px; }
.v-contact-av { width: 36px; height: 36px; }
.v-right-messages, .v-right-gift { padding: 14px; }
.v-rm-title, .v-rg-title { font-size: 17px; }
.v-presence-strip, .v-composer { margin-bottom: 14px; padding: 12px 14px; border-radius: 16px; }
.v-presence-ring { width: 52px; height: 52px; }
.v-composer-avatar { width: 40px; height: 40px; }

/* Center column: slightly wider feed for the "wide-angle" feel. */
#feed-wrap.v-center > #feed,
#feed-wrap.v-center > #photos-view,
#feed-wrap.v-center > #moon-view,
#feed-wrap.v-center > #messages-view,
#feed-wrap.v-center > #notifications-view,
.v-presence-strip, .v-composer { max-width: 640px; }

/* ── Header on phone ──────────────────────────────────────────────────────── */
@media (max-width: 720px) {
  .v-topbar { padding: 0 14px; height: 54px; }
  .v-topbar-title { font-size: 18px; }
  .v-topbar-sub { display: none; }
  .v-topbar .live-badge .live-text { display: none; }
  .v-theme-toggle-top .v-theme-label { display: none; }
  .v-theme-toggle-top { padding: 5px; }
  .v-left, .v-right { top: 0; }
}

/* ═══════════════════════════════════════════════════════════════════════════ */
/* DIRECT MESSAGES — right-panel list + center conversation                      */
/* ═══════════════════════════════════════════════════════════════════════════ */

/* #messages-view states: desktop shows empty-hint or conversation; phone shows
   the thread list, then the conversation when one is active. */
#messages-view .dm-empty { display: block; text-align: center; padding: 56px 28px; max-width: 460px; margin: 26px auto; }
#messages-view .dm-list-mobile { display: none; }
#messages-view .dm-convo { display: none; }
#messages-view.has-active .dm-empty,
#messages-view.has-active .dm-list-mobile { display: none; }
#messages-view.has-active .dm-convo { display: flex; }
@media (max-width: 720px) {
  #messages-view .dm-empty { display: none; }
  #messages-view:not(.has-active) .dm-list-mobile { display: block; }
}
.dm-empty-emoji { font-size: 44px; display: block; margin-bottom: 12px; }
.dm-empty h3 { font-family: var(--font-serif); font-size: 22px; color: var(--ink); margin-bottom: 8px; }
.dm-empty p { font-size: 15px; line-height: 1.6; color: var(--ink-muted); margin-bottom: 16px; }
.dm-empty .v-rg-cta { max-width: 240px; margin: 0 auto; }

.dm-list-head { display: flex; align-items: center; justify-content: space-between; padding: 4px 4px 12px; }
.dm-list-title { font-family: var(--font-serif); font-size: 20px; font-weight: 700; color: var(--ink); }

/* Thread rows (used in the right panel and the mobile list) */
.dm-row { display: flex; align-items: center; gap: 11px; width: 100%; padding: 9px 10px; border: 0; background: transparent; border-radius: 12px; cursor: pointer; text-align: left; position: relative; }
.dm-row:hover, .dm-row.is-active { background: var(--sand-light); }
.dm-row-av { width: 42px; height: 42px; border-radius: 50%; flex-shrink: 0; display: grid; place-items: center; color: #fff; font-family: var(--font-serif); font-weight: 700; font-size: 16px; overflow: hidden; background-size: cover; background-position: center; }
.dm-row-meta { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 2px; }
.dm-row-top { display: flex; justify-content: space-between; gap: 8px; }
.dm-row-name { font-size: 14px; font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dm-row-time { font-size: 11px; color: var(--ink-muted); flex-shrink: 0; }
.dm-row-preview { font-size: 13px; color: var(--ink-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dm-row.is-unread .dm-row-name, .dm-row.is-unread .dm-row-preview { color: var(--ink); font-weight: 700; }
.dm-row-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--amber); flex-shrink: 0; }

/* Conversation pane */
.dm-convo { flex-direction: column; height: calc(100vh - var(--topbar-h) - 40px); max-height: 780px; background: var(--paper); border: 1px solid var(--border); border-radius: 16px; overflow: hidden; box-shadow: var(--shadow); }
.dm-convo-head { display: flex; align-items: center; gap: 11px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.dm-back { display: grid; place-items: center; width: 32px; height: 32px; border: 0; background: transparent; color: var(--ink-soft); cursor: pointer; border-radius: 8px; }
.dm-back svg { width: 20px; height: 20px; }
.dm-back:hover { background: var(--sand-light); }
.dm-convo-av { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-family: var(--font-serif); font-weight: 700; overflow: hidden; background-size: cover; background-position: center; background: var(--forest); }
.dm-convo-name { font-family: var(--font-serif); font-size: 17px; font-weight: 700; color: var(--ink); }
.dm-messages { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 7px; }
.dm-day { text-align: center; font-size: 12px; color: var(--ink-muted); margin: 8px 0; }
.dm-bubble { max-width: 76%; align-self: flex-start; background: var(--sand-light); border: 1px solid var(--border); padding: 8px 12px; border-radius: 16px 16px 16px 4px; display: flex; flex-direction: column; gap: 3px; }
.dm-bubble.is-mine { align-self: flex-end; background: var(--forest); border-color: var(--forest); border-radius: 16px 16px 4px 16px; }
.dm-bubble-text { font-size: 14px; line-height: 1.45; color: var(--ink); white-space: pre-wrap; word-break: break-word; }
.dm-bubble.is-mine .dm-bubble-text { color: var(--frame-text); }
.dm-bubble-time { font-size: 10px; color: var(--ink-muted); align-self: flex-end; }
.dm-bubble.is-mine .dm-bubble-time { color: rgba(255,255,255,0.72); }
.dm-composer { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--border); }
.dm-input { flex: 1; padding: 11px 16px; border: 1px solid var(--border); border-radius: 999px; background: var(--sand-light); color: var(--ink); font-size: 14px; font-family: var(--font-sans); }
.dm-input:focus { outline: none; border-color: var(--forest); background: var(--white); }
.dm-send { width: 44px; height: 44px; border: 0; border-radius: 50%; background: var(--forest); color: #fff; cursor: pointer; display: grid; place-items: center; flex-shrink: 0; }
.dm-send svg { width: 19px; height: 19px; }
.dm-send:hover { filter: brightness(1.08); }

/* New-message picker (rendered inside the conversation pane) */
.dm-pick-head { font-size: 13px; color: var(--ink-muted); padding: 4px 4px 8px; }
.dm-pick { display: flex; align-items: center; gap: 11px; width: 100%; padding: 9px 10px; border: 0; background: transparent; border-radius: 12px; cursor: pointer; text-align: left; }
.dm-pick:hover { background: var(--sand-light); }
.dm-pick-name { font-size: 15px; font-weight: 600; color: var(--ink); }

@media (max-width: 720px) {
  .dm-convo { height: calc(100vh - 54px - var(--tabbar-h) - 16px); max-height: none; border-radius: 0; border: 0; box-shadow: none; }
  .dm-back { display: grid; place-items: center; }
}

/* ═══════════════════════════════════════════════════════════════════════════ */
/* TOP-BAR: leaf-as-info button, presence state, account menu                    */
/* ═══════════════════════════════════════════════════════════════════════════ */

.v-leaf-btn { border: 0; background: transparent; cursor: pointer; padding: 0; line-height: 1; }

/* Live presence dot reflects who's online; quiet (grey, no pulse) when alone. */
.v-topbar .live-badge.is-quiet .live-dot { background: #6B7280; animation: none; }
.v-topbar .live-badge.is-quiet { opacity: 0.7; }

.v-account { position: relative; }
.v-account-btn {
  width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0;
  border: 1px solid var(--border); background: var(--forest); color: var(--frame-text);
  cursor: pointer; display: grid; place-items: center; overflow: hidden; padding: 0;
  font-family: var(--font-serif); font-weight: 700; font-size: 15px;
  background-size: cover; background-position: center;
}
.v-account-btn:hover { filter: brightness(1.08); }
.v-account-menu {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 300;
  min-width: 220px; padding: 6px;
  background: var(--paper); border: 1px solid var(--border); border-radius: 14px;
  box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; gap: 2px;
}
.v-account-item {
  display: flex; align-items: center; gap: 8px;
  width: 100%; padding: 10px 12px; border: 0; border-radius: 10px;
  background: transparent; color: var(--ink-soft); cursor: pointer;
  font-family: var(--font-sans); font-size: 14px; font-weight: 600; text-align: left;
}
.v-account-item:hover { background: var(--sand-light); color: var(--ink); }
.v-account-signout { color: var(--ink-muted); }
.v-account-signout:hover { color: var(--labor-red); }

/* Profile circles + contacts are tappable (open the profile bubble). */
.v-presence-item, .v-contact-row { cursor: pointer; }

/* On phones, an open conversation becomes a full-screen panel whose height is
   driven by the visual viewport (JS) so the composer always sits on the
   keyboard instead of below it. */
@media (max-width: 720px) {
  #messages-view.has-active .dm-convo {
    position: fixed; left: 0; right: 0; top: 0;
    height: 100dvh; max-height: none; z-index: 130;
    border-radius: 0; border: 0; box-shadow: none;
  }
}

/* Profile bubble */
.profile-popover {
  position: fixed; inset: 0; z-index: 350;
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.profile-popover-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.55); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
.profile-popover-card {
  position: relative; z-index: 1; width: 100%; max-width: 320px;
  background: var(--paper); border: 1px solid var(--border); border-radius: 20px;
  box-shadow: var(--shadow-lg); padding: 28px 22px 22px; text-align: center;
}
.profile-popover-close { position: absolute; top: 12px; right: 14px; border: 0; background: transparent; color: var(--ink-muted); font-size: 18px; cursor: pointer; }
.pp-avatar {
  width: 84px; height: 84px; border-radius: 50%; margin: 0 auto 14px;
  display: grid; place-items: center; overflow: hidden;
  background-size: cover; background-position: center;
  background: var(--forest); color: var(--frame-text);
  font-family: var(--font-serif); font-weight: 700; font-size: 32px;
  border: 3px solid var(--forest);
}
.pp-name { font-family: var(--font-serif); font-size: 20px; font-weight: 700; color: var(--ink); }
.pp-rel { font-size: 13px; color: var(--ink-muted); margin-top: 3px; }
.pp-bio { font-size: 14px; line-height: 1.5; color: var(--ink-soft); margin-top: 12px; }
.pp-message { margin-top: 18px; width: 100%; padding: 12px; border: 0; border-radius: 12px; background: var(--forest); color: var(--frame-text); font-family: var(--font-sans); font-size: 15px; font-weight: 700; cursor: pointer; }
.pp-message:hover { filter: brightness(1.08); }

/* ═══════════════════════════════════════════════════════════════════════════ */
/* BOOKMARKS + NOTIFICATIONS + SAVED VIEW                                        */
/* ═══════════════════════════════════════════════════════════════════════════ */

/* Bookmark action on post cards (sits beside the existing reactions + notes) */
.bookmark-toggle {
  display: inline-flex; align-items: center; gap: 5px;
  margin-top: 8px; padding: 6px 12px;
  border: 1px solid var(--border); border-radius: 999px;
  background: transparent; color: var(--ink-muted);
  font-family: var(--font-sans); font-size: 13px; font-weight: 600; cursor: pointer;
  transition: background 0.14s ease, color 0.14s ease, border-color 0.14s ease;
}
.bookmark-toggle:hover { background: var(--amber-light); color: var(--amber); border-color: var(--amber); }
.bookmark-toggle.is-saved { background: var(--amber); color: #fff; border-color: var(--amber); }

/* Notifications + Saved live in the center column */
#feed-wrap.v-center > #saved-view,
#feed-wrap.v-center > #notifications-view { max-width: 640px; margin: 0 auto; }
.notif-head, .saved-head { padding: 4px 4px 14px; }
.notif-title, .saved-title { font-family: var(--font-serif); font-size: 22px; font-weight: 700; color: var(--ink); }

.notif-row {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 12px 14px; margin-bottom: 8px;
  border: 1px solid var(--border); border-radius: 14px;
  background: var(--paper); cursor: pointer; text-align: left;
  box-shadow: var(--shadow);
}
.notif-row:hover { border-color: var(--forest); }
.notif-row.is-new { border-left: 3px solid var(--amber); }
.notif-row.is-labor { border-left: 3px solid var(--labor-red); }
.notif-ico { font-size: 20px; flex-shrink: 0; }
.notif-text { flex: 1; font-size: 14px; color: var(--ink); }
.notif-time { font-size: 12px; color: var(--ink-muted); flex-shrink: 0; }

.saved-card {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 12px 14px; margin-bottom: 8px;
  border: 1px solid var(--border); border-radius: 14px;
  background: var(--paper); cursor: pointer; box-shadow: var(--shadow);
}
.saved-card:hover { border-color: var(--forest); }
.saved-card-main { flex: 1; min-width: 0; }
.saved-card-top { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 3px; }
.saved-card-author { font-weight: 700; font-size: 14px; color: var(--ink); }
.saved-card-time { font-size: 12px; color: var(--ink-muted); flex-shrink: 0; }
.saved-card-text { font-size: 13px; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.saved-card-thumb { width: 48px; height: 48px; border-radius: 10px; background-size: cover; background-position: center; flex-shrink: 0; }
.saved-card-remove { background: transparent; border: 0; cursor: pointer; font-size: 18px; flex-shrink: 0; }
.saved-card-remove:hover { transform: scale(1.12); }

/* Profile bio editor */
.profile-bio-input { resize: vertical; min-height: 52px; font-family: var(--font-sans); }

/* ═══════════════════════════════════════════════════════════════════════════ */
/* VILLAGE REVAMP 2026-06 · PASS 1 — grandmother-grade foundation               */
/* Layered override block (same pattern as v2/v2.1): type scale up for older    */
/* eyes, ≥44px touch targets, ≥16px inputs (smaller makes iPhone Safari         */
/* zoom-jump on focus), render diet for old phones, offline grace, and          */
/* prefers-reduced-motion respect. Tokens untouched — both themes inherit.      */
/* ═══════════════════════════════════════════════════════════════════════════ */

/* ── Gate fix — invitee-only chrome must actually hide for returning family ──
   `.invitee-only { display:none }` (line ~148) loses to the later
   `.auth-toggle { display:flex }` (line ~2363) at equal specificity, so the
   Sign-in/Create-account toggle and the "invite locked in" note leaked onto
   the default Welcome-back view — pointing returning grandparents at
   "Create account". Same scar class as the [hidden]-vs-display gotcha;
   higher specificity makes the hide unbeatable regardless of file order. */
.gate-card:not(.invitee-mode) .invitee-only { display: none !important; }

/* ── Type scale — the feed is read at arm's length on a phone ─────────────── */
.card-title          { font-size: 19px; }
.card-body           { font-size: 16px; line-height: 1.7; }
.card-date           { font-size: 12.5px; }
.card-author-inline  { font-size: 12.5px; }
.type-badge          { font-size: 11px; padding: 3px 11px; }
.stat-chip .chip-value { font-size: 14px; }
.fun-fact-box        { font-size: 15px; }
.welcome-card p      { font-size: 15.5px; }
.empty-state p       { font-size: 16px; }
.comment-name        { font-size: 14.5px; }
.comment-time        { font-size: 12px; }
.comment-message     { font-size: 15.5px; line-height: 1.55; }
.comments-toggle     { font-size: 15px; }
.comments-empty      { font-size: 14.5px; }
.reaction-chip       { font-size: 14px; padding: 5px 12px; gap: 5px; }
.reaction-chip-emoji { font-size: 16px; }
.reaction-trigger    { font-size: 18px; padding: 10px 0; }
.comments-toggle.is-empty { font-size: 19px; }
.interaction-error   { font-size: 13.5px; }
.bookmark-toggle     { font-size: 14px; padding: 8px 14px; }
.notif-text          { font-size: 15px; }
.dm-bubble-text      { font-size: 15px; }
.dm-row-name         { font-size: 15px; }
.dm-row-preview      { font-size: 13.5px; }
.v-contact-name      { font-size: 15px; }
.v-contact-sub       { font-size: 12.5px; }
.whos-here-status    { font-size: 13px; }
.gift-handle-sub     { font-size: 13.5px; }
.moon-letter-body    { font-size: 16px; line-height: 1.7; }
#toast               { font-size: 15px; white-space: normal; max-width: min(92vw, 480px); text-align: center; }

/* ── Inputs ≥16px — anything smaller triggers the iOS focus zoom-jump ──────── */
.comment-textarea,
.dm-input,
.v-rm-search-input,
.moon-body-input,
.moon-gift-input,
.gift-sent-amount,
.gift-sent-method { font-size: 16px; }

/* ── Touch targets — fingers first, cursors second ─────────────────────────── */
.comment-send-btn        { width: 44px; height: 44px; }
.comment-send-btn svg    { width: 18px; height: 18px; }
.comment-composer-avatar { width: 32px; height: 32px; font-size: 13px; }
.comment-textarea        { min-height: 44px; padding: 10px 16px; }
.comment-heart           { font-size: 18px; padding: 8px 10px; min-width: 40px; min-height: 36px; justify-content: center; }
.comment-heart-count     { font-size: 13px; }
.comment-action-btn      { font-size: 13px; padding: 7px 10px; min-height: 32px; }
.v-account-btn           { width: 40px; height: 40px; font-size: 16px; }
.saved-card-remove       { width: 44px; height: 44px; display: grid; place-items: center; }
.moon-letter-delete      { padding: 8px 12px; }
.reply-banner-cancel     { padding: 6px 10px; min-height: 30px; }
.first-time-btn          { font-size: 15px; }
.auth-forgot-btn         { padding: 10px 12px; }

/* ── Render diet for old phones ────────────────────────────────────────────── */
/* content-visibility lives on .card (NOT .card-wrap — paint containment would
   clip the pushpin ::before that floats above the wrap). Off-screen cards skip
   layout + paint entirely; `auto` remembers the real size once measured, so
   scroll anchoring stays stable. Older Safari ignores it gracefully. */
.card {
  content-visibility: auto;
  contain-intrinsic-size: auto 480px;
}

/* ── Offline grace ─────────────────────────────────────────────────────────── */
.offline-note {
  position: fixed;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 76px);
  transform: translateX(-50%);
  z-index: 260;
  display: flex;
  align-items: center;
  gap: 9px;
  max-width: min(92vw, 440px);
  padding: 11px 18px;
  border-radius: 999px;
  background: var(--paper);
  border: 1.5px solid var(--amber);
  box-shadow: var(--shadow-lg);
  color: var(--ink-soft);
  font-family: var(--font-sans);
  font-size: 14.5px;
  font-weight: 600;
  line-height: 1.35;
  pointer-events: none;
}
.offline-dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--amber);
  flex-shrink: 0;
  animation: pulse-dot 2s ease-in-out infinite;
}

/* ── Reduced motion — the board holds still for whoever needs it to ───────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  html { scroll-behavior: auto; }
  .card-wrap:hover { transform: rotate(var(--rot)); }
}

/* ═══════════════════════════════════════════════════════════════════════════ */
/* VILLAGE REVAMP 2026-06 · PASS 2 — the feed, alive                            */
/* Pushpin landings, sticker-press reactions, handwritten warmth, month         */
/* chapters in Photos, and a deeper cork/paper texture (light theme only —      */
/* the charcoal theme keeps its own quiet).                                     */
/* ═══════════════════════════════════════════════════════════════════════════ */

/* ── Pushpin landing — a live post drops onto the board, then the pin
      presses in with a little overshoot ─────────────────────────────────────── */
@keyframes cardLand {
  0%   { opacity: 0; transform: translateY(-26px) rotate(var(--rot)) scale(1.02); }
  62%  { opacity: 1; transform: translateY(3px) rotate(var(--rot)) scale(1); }
  100% { opacity: 1; transform: translateY(0) rotate(var(--rot)); }
}
@keyframes pinDrop {
  0%   { opacity: 0; transform: translateX(-50%) translateY(-16px) scale(1.8); }
  55%  { opacity: 1; transform: translateX(-50%) translateY(1.5px) scale(0.9); }
  100% { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
}
.card-wrap.pin-landing { animation: cardLand 0.55s cubic-bezier(0.2, 0.9, 0.32, 1.18) both; }
.card-wrap.pin-landing::before { animation: pinDrop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) 0.32s both; }

/* ── Reactions land like stickers ──────────────────────────────────────────── */
@keyframes chipPop {
  0%   { transform: scale(0.55); }
  60%  { transform: scale(1.28) rotate(-3deg); }
  100% { transform: scale(1) rotate(0deg); }
}
.reaction-chip.chip-pop { animation: chipPop 0.38s cubic-bezier(0.34, 1.56, 0.64, 1); }

.emoji-burst { position: fixed; z-index: 1300; width: 0; height: 0; pointer-events: none; }
.emoji-burst-bit {
  position: absolute; left: 0; top: 0;
  font-size: 22px; line-height: 1;
  animation: burstFly 0.8s cubic-bezier(0.16, 0.84, 0.44, 1) both;
}
@keyframes burstFly {
  0%   { opacity: 0; transform: translate(-50%, -50%) scale(0.5) rotate(0deg); }
  18%  { opacity: 1; }
  100% { opacity: 0; transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(1.15) rotate(var(--rot)); }
}

/* ── The board greets you in handwriting ───────────────────────────────────── */
.welcome-greeting {
  font-family: 'Caveat', cursive;
  font-size: 23px;
  color: var(--amber);
  margin-bottom: 6px;
}

/* ── Photos browse by chapter ──────────────────────────────────────────────── */
.photos-month {
  column-span: all;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 4px 12px;
  font-family: 'Caveat', cursive;
  font-size: 24px;
  color: var(--ink-soft);
}
.photos-month::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}
#photos-grid > .photos-month:first-child { padding-top: 4px; }

/* ── Cork + paper, deepened (light theme only) ─────────────────────────────── */
/* Soft top-light vignette over the cork, like a lamp over the board. The
   three original speckle layers are restated verbatim beneath it. */
html:not([data-theme="dark"]) body {
  background-image:
    radial-gradient(130% 85% at 50% -5%, rgba(255, 252, 240, 0.12), transparent 58%),
    repeating-radial-gradient(circle at 18% 22%, transparent 0, transparent 2px,
      rgba(0,0,0,0.018) 2px, rgba(0,0,0,0.018) 4px),
    repeating-radial-gradient(circle at 76% 54%, transparent 0, transparent 3px,
      rgba(0,0,0,0.012) 3px, rgba(0,0,0,0.012) 5px),
    repeating-radial-gradient(circle at 42% 80%, transparent 0, transparent 2px,
      rgba(255,255,255,0.04) 2px, rgba(255,255,255,0.04) 4px);
}
/* Faint laid-paper grain on every card — invisible until you look, warm once
   you do. Color-stop syntax kept long-form for older Safari. */
html:not([data-theme="dark"]) .card {
  background-image: repeating-linear-gradient(0deg,
    transparent 0, transparent 3px,
    rgba(59, 26, 8, 0.013) 3px, rgba(59, 26, 8, 0.013) 4px);
}
/* The top bar remembers the wooden frame: a rail of stained wood under the
   paper masthead. */
html:not([data-theme="dark"]) .v-topbar {
  border-bottom: 3px solid var(--frame);
  box-shadow: 0 2px 12px rgba(61, 34, 24, 0.16);
}

/* ═══════════════════════════════════════════════════════════════════════════ */
/* VILLAGE REVAMP 2026-06 · PASS 3 — THE LABOR ALERT                            */
/* Full-takeover moment, pinned until acknowledged. Drill variant runs the      */
/* identical journey in unmistakable practice-run amber.                        */
/* ═══════════════════════════════════════════════════════════════════════════ */

.labor-takeover {
  position: fixed;
  inset: 0;
  z-index: 1400;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}
body.labor-open { overflow: hidden; }

.labor-takeover-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(60, 8, 8, 0.84);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  animation: laborBackdropPulse 2.4s ease-in-out infinite;
}
.labor-takeover.is-drill-mode .labor-takeover-backdrop {
  background: rgba(84, 56, 10, 0.84);
  animation: none;
}

.labor-takeover-card {
  position: relative;
  width: 100%;
  max-width: 430px;
  max-height: calc(100vh - 36px);
  overflow-y: auto;
  background: var(--labor-red);
  color: #fff;
  border: 2px solid #6B1515;
  border-radius: 20px;
  padding: 36px 26px 20px;
  text-align: center;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.5);
  animation: laborCardIn 0.45s cubic-bezier(0.2, 0.9, 0.3, 1.15) both;
}
.labor-takeover.is-drill-mode .labor-takeover-card {
  background: #8A5A14;
  border-color: #6B4410;
}

.labor-takeover-close {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 0;
  background: rgba(255, 255, 255, 0.14);
  color: rgba(255, 255, 255, 0.88);
  font-size: 18px;
  cursor: pointer;
}
.labor-takeover-close:hover { background: rgba(255, 255, 255, 0.26); }

.labor-takeover-drill {
  display: inline-block;
  background: #FFE9C4;
  color: #6B4410;
  font-family: var(--font-sans);
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 1.2px;
  padding: 7px 16px;
  border-radius: 999px;
  margin-bottom: 14px;
}

.labor-takeover-siren {
  font-size: 56px;
  display: block;
  margin-bottom: 10px;
  animation: sirenSwing 1.6s ease-in-out infinite;
}
.labor-takeover-headline {
  font-family: var(--font-serif);
  font-size: 30px;
  font-weight: bold;
  letter-spacing: 1.5px;
  margin-bottom: 10px;
}
.labor-takeover-message {
  font-size: 17px;
  line-height: 1.55;
  color: rgba(255, 255, 255, 0.96);
  margin-bottom: 8px;
  white-space: pre-wrap;
}
.labor-takeover-hospital {
  font-size: 16.5px;
  font-weight: 700;
  margin-bottom: 6px;
}
.labor-takeover-time {
  font-size: 13.5px;
  color: rgba(255, 255, 255, 0.75);
  margin-bottom: 18px;
}

.labor-takeover-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.labor-ack-btn {
  width: 100%;
  min-height: 56px;
  padding: 15px 18px;
  border-radius: 14px;
  border: 0;
  font-family: var(--font-sans);
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.1s ease, filter 0.15s ease;
}
.labor-ack-btn:active { transform: scale(0.98); }
.labor-ack-btn:disabled { opacity: 0.6; cursor: default; }
.labor-ack-primary { background: #fff; color: var(--labor-red); }
.labor-ack-primary:hover { filter: brightness(0.96); }
.labor-takeover.is-drill-mode .labor-ack-primary { color: #6B4410; }
.labor-ack-secondary {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  border: 1.5px solid rgba(255, 255, 255, 0.5);
}
.labor-ack-secondary:hover { background: rgba(255, 255, 255, 0.24); }

.labor-takeover-error {
  min-height: 18px;
  font-size: 14.5px;
  font-weight: 700;
  color: #FFD9D9;
  margin-top: 10px;
}
.labor-takeover-note {
  font-size: 12.5px;
  color: rgba(255, 255, 255, 0.68);
  margin-top: 6px;
}

@keyframes laborCardIn {
  from { opacity: 0; transform: translateY(22px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes sirenSwing {
  0%, 100% { transform: rotate(-8deg); }
  50%      { transform: rotate(8deg); }
}
@keyframes laborBackdropPulse {
  0%, 100% { background-color: rgba(60, 8, 8, 0.84); }
  50%      { background-color: rgba(84, 12, 12, 0.9); }
}

/* ── Acknowledgements on the siren card — the couple sees the family move ── */
.labor-acks {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.labor-ack-row {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 15px;
  line-height: 1.5;
  text-align: left;
  color: #fff;
}

/* Ack comments read as little status lines in the thread too. */
.comment-item-ack .comment-bubble {
  background: var(--amber-light);
  border-color: var(--amber);
}

/* ── Drill variant of the feed card — same siren, unmistakably practice ──── */
.card-labor-drill {
  background: #8A5A14;
  border-color: #6B4410;
  box-shadow: 4px 8px 28px rgba(107, 68, 16, 0.5), 0 2px 6px rgba(0, 0, 0, 0.3);
  animation: none;
}
.labor-drill-ribbon {
  display: inline-block;
  background: #FFE9C4;
  color: #6B4410;
  font-family: var(--font-sans);
  font-weight: 800;
  font-size: 12px;
  letter-spacing: 1.2px;
  padding: 6px 14px;
  border-radius: 999px;
  margin-bottom: 12px;
}

/* ═══════════════════════════════════════════════════════════════════════════ */
/* VILLAGE REVAMP 2026-06 · PASS 4 — the keepsake layer                         */
/* Moon letters that read like letters, milestones that feel like artifacts,    */
/* and Memories — the story so far, month by month.                             */
/* ═══════════════════════════════════════════════════════════════════════════ */

/* ── Moon letters sign off like letters ────────────────────────────────────── */
.moon-letter-signature {
  font-family: 'Caveat', cursive;
  font-size: 21px;
  color: var(--ink-soft);
  text-align: right;
  margin-top: 10px;
  line-height: 1.2;
}
.moon-letter-sealed .moon-letter-signature { color: rgba(247, 240, 214, 0.9); }

/* One-shot reveal when the couple opens a sealed letter — a soft starlight
   bloom, run exactly once (the marker clears after it paints). */
@keyframes moonReveal {
  0%   { opacity: 0.15; transform: scale(0.985); box-shadow: 0 0 0 rgba(247, 224, 150, 0); }
  45%  { opacity: 1; box-shadow: 0 0 34px rgba(247, 224, 150, 0.55); }
  100% { opacity: 1; transform: scale(1); box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06); }
}
.moon-letter-reveal { animation: moonReveal 1.1s ease-out both; }

/* ── Milestones feel like certificates ─────────────────────────────────────── */
.card-milestone {
  border: 1.5px solid rgba(184, 98, 26, 0.45);
  border-left: 5px solid var(--forest);
  box-shadow: var(--shadow),
              inset 0 0 0 4px var(--paper),
              inset 0 0 0 5px rgba(184, 98, 26, 0.28);
}
.card-milestone .milestone-title { font-size: 22px; }

/* ── Memories — the story so far ───────────────────────────────────────────── */
#feed-wrap.v-center > #memories-view { width: 100%; max-width: 640px; margin: 0 auto; }
.memories-loading { padding: 40px; text-align: center; color: var(--ink-muted); }

.memories-head { padding: 4px 4px 14px; }
.memories-title {
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 700;
  color: var(--ink);
}
.memories-sub {
  font-family: 'Caveat', cursive;
  font-size: 20px;
  color: var(--amber);
  margin-top: 2px;
}

.memory-month {
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 16px 18px 16px;
  margin-bottom: 16px;
}
.memory-month-title {
  font-family: 'Caveat', cursive;
  font-size: 27px;
  color: var(--ink);
  line-height: 1.1;
}
.memory-month-stats {
  font-size: 13px;
  color: var(--ink-muted);
  margin: 3px 0 12px;
}
.memory-highlights { display: flex; flex-direction: column; gap: 6px; margin-bottom: 4px; }
.memory-highlight {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  min-height: 48px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--sand-light);
  cursor: pointer;
  text-align: left;
  font-family: var(--font-sans);
  transition: border-color 0.14s ease, background 0.14s ease;
}
.memory-highlight:hover { border-color: var(--forest); background: var(--paper); }
.memory-highlight-ico { font-size: 19px; flex-shrink: 0; }
.memory-highlight-text {
  flex: 1;
  min-width: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.memory-highlight-date { font-size: 12.5px; color: var(--ink-muted); flex-shrink: 0; }

.memory-thumbs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.memory-thumb {
  width: 84px;
  height: 84px;
  border: 0;
  border-radius: 10px;
  overflow: hidden;
  padding: 0;
  background: var(--sand-light);
  cursor: pointer;
  box-shadow: 1px 2px 8px rgba(0, 0, 0, 0.14);
  transition: transform 0.14s ease;
}
.memory-thumb:hover { transform: translateY(-2px) rotate(-1deg); }
.memory-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.memory-thumb.is-ready img { opacity: 1; }
.memory-thumb-more {
  display: grid;
  place-items: center;
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 700;
  color: var(--ink-soft);
  background: var(--sand);
}
@media (max-width: 480px) {
  .memory-thumb { width: 72px; height: 72px; }
}
