/* Our Story — timeline screen */
.story {
  position: fixed; inset: 0; z-index: 20;
  max-width: 480px; margin: 0 auto;
  display: grid; grid-template-rows: auto 1fr auto;
  background-color: var(--bg);
  background-image:
    radial-gradient(120% 60% at 50% 0%, rgba(180, 107, 255, 0.10), transparent 60%),
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: auto, 24px 24px, 24px 24px;
  animation: story-in 0.28s ease-out;
}
@keyframes story-in { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }

.story-head {
  display: flex; align-items: center; gap: 12px;
  padding: calc(10px + var(--safe-t)) 14px 10px;
  border-bottom: 1px solid var(--line);
}
.story-heading p { margin: 0; font-size: 11px; }
.story-heading h2 { margin: 0; font-size: 22px; line-height: 1.15; outline: none; }

.story-scroll { overflow-y: auto; padding: 14px 14px 24px; overscroll-behavior: contain; }
.story-foot {
  padding: 10px 14px calc(10px + var(--safe-b));
  border-top: 1px solid var(--line);
  background: rgba(7, 6, 13, 0.92);
}

/* ---------- stats strip ---------- */
.stats {
  list-style: none; margin: 0 0 18px; padding: 0;
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
}
.stats li {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 10px 4px;
  background: rgba(18, 14, 32, 0.85);
  border: 1px solid var(--line); border-radius: 12px;
}
.stat-val { font: 700 22px/1.1 var(--font); color: var(--text); text-shadow: 0 0 12px rgba(255, 79, 139, 0.45); font-variant-numeric: tabular-nums; }
.stat-lbl { font: 400 10px/1.2 var(--mono); color: var(--dim); text-transform: uppercase; letter-spacing: 0.06em; }
.stats li:nth-child(3) .stat-val { color: var(--mint); text-shadow: 0 0 12px rgba(108, 240, 200, 0.45); }

.section-h { font-size: 12px; font-weight: 600; color: var(--purple); margin: 0 0 10px; }
.empty { font-size: 12px; color: var(--muted); margin: 0 0 14px; padding-left: 44px; }

/* ---------- timeline line ---------- */
.timeline { list-style: none; margin: 0; padding: 0 0 0 44px; position: relative; }
.timeline::before {
  content: ''; position: absolute; left: 19px; top: 6px; bottom: 6px; width: 2px;
  background: linear-gradient(var(--pink), var(--purple) 70%, rgba(180, 107, 255, 0.15));
  box-shadow: 0 0 8px rgba(255, 79, 139, 0.7), 0 0 20px rgba(180, 107, 255, 0.35);
  border-radius: 2px;
}

.ms { position: relative; margin-bottom: 14px; }
.ms-node {
  position: absolute; left: -36px; top: 14px;
  width: 24px; height: 22px; padding: 3px;
  display: grid; place-items: center;
  background: var(--bg); border-radius: 6px;
}
.ms--unlocked .ms-node { color: var(--pink); filter: drop-shadow(0 0 5px rgba(255, 79, 139, 0.8)); }
.ms--manual .ms-node { color: var(--purple); filter: drop-shadow(0 0 5px rgba(180, 107, 255, 0.8)); }
.ms--locked .ms-node { color: var(--dim); padding: 4px; }

.ms-card {
  padding: 12px 14px;
  background: rgba(18, 14, 32, 0.92);
  border: 1px solid var(--line); border-radius: var(--radius);
  transition: border-color 0.4s ease, box-shadow 0.4s ease;
}
.ms--manual .ms-card { border-color: rgba(180, 107, 255, 0.35); }

.ms-date { margin: 0 0 4px; font-size: 11px; color: var(--pink); display: flex; align-items: center; gap: 8px; text-transform: lowercase; }
.ms--manual .ms-date { color: var(--purple); }
.ms-title { margin: 0; font: 700 17px/1.3 var(--font); }
.ms-note { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.ms-log { margin: 8px 0 0; font-size: 11px; color: var(--dim); overflow-wrap: anywhere; }
.cipher { white-space: pre-wrap; }

.tag {
  font: 600 9px/1 var(--mono); text-transform: uppercase; letter-spacing: 0.08em;
  padding: 3px 6px; border-radius: 4px;
  color: var(--purple); border: 1px solid rgba(180, 107, 255, 0.5);
}
.tag--pending { color: #FFD36C; border-color: rgba(255, 211, 108, 0.5); }

/* ---------- locked slots ---------- */
.ms--locked .ms-card {
  background: repeating-linear-gradient(-45deg, rgba(18, 14, 32, 0.9) 0 8px, rgba(26, 20, 48, 0.9) 8px 16px);
  border-style: dashed; border-color: rgba(138, 128, 166, 0.35);
}
.ms--locked .ms-title { font: 600 14px/1.3 var(--mono); color: var(--muted); letter-spacing: 0.08em; animation: flicker 4s steps(1) infinite; }
.ms-hint { margin: 4px 0 0; font-size: 11px; color: var(--dim); }
@keyframes flicker { 0%, 92%, 100% { opacity: 1; } 93% { opacity: 0.4; } 95% { opacity: 0.85; } 97% { opacity: 0.5; } }

/* ---------- unlock animation ---------- */
.ms.is-sealed .ms-card { border-color: rgba(138, 128, 166, 0.35); }
.ms.is-sealed .cipher { color: var(--dim); }
.ms.is-sealed .ms-node { color: var(--dim); filter: none; }
.ms.is-unlocking .ms-card {
  border-color: var(--pink);
  box-shadow: 0 0 0 1px rgba(255, 79, 139, 0.4), var(--glow-pink);
  animation: card-glitch 0.5s steps(2) 2;
}
.ms.is-unlocking .cipher { color: var(--mint); text-shadow: 0 0 8px rgba(108, 240, 200, 0.6); }
.ms.is-fresh .ms-card { border-color: rgba(255, 79, 139, 0.6); box-shadow: 0 0 18px rgba(255, 79, 139, 0.18); }
.ms-node.pulse { animation: heart-pulse 0.9s ease-in-out 3; }

@keyframes heart-pulse {
  0%, 100% { transform: scale(1); filter: drop-shadow(0 0 4px rgba(255, 79, 139, 0.8)); }
  25% { transform: scale(1.45); filter: drop-shadow(0 0 14px rgba(255, 79, 139, 1)); }
  50% { transform: scale(1.05); }
  65% { transform: scale(1.25); }
}
@keyframes card-glitch {
  0% { transform: translateX(0); }
  50% { transform: translateX(-2px); clip-path: inset(10% 0 40% 0); }
  100% { transform: translateX(1px); clip-path: none; }
}

/* ---------- pending moments ---------- */
.pending-wrap { margin-bottom: 20px; }
.pending-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.pend-card {
  padding: 12px 14px; border-radius: var(--radius);
  background: rgba(18, 14, 32, 0.92);
  border: 1px dashed rgba(255, 211, 108, 0.45);
}
.pend-card .ms-date { color: #FFD36C; }
.pend-card .ms-title { font-size: 16px; }
.pend-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; }
.pend-actions .btn { flex: 1 1 120px; }
.waiting { margin: 0; font-size: 12px; flex: 1 1 100%; }

/* ---------- log-a-moment dialog ---------- */
.moment-dialog {
  width: min(440px, calc(100vw - 24px));
  padding: 20px; border-radius: var(--radius);
  background: var(--card); color: var(--text);
  border: 1px solid rgba(180, 107, 255, 0.5);
  box-shadow: var(--glow-purple);
}
.moment-dialog::backdrop { background: rgba(4, 3, 8, 0.75); backdrop-filter: blur(3px); }
.moment-dialog p { margin: 0; font-size: 11px; }
.moment-dialog h3 { margin: 4px 0 2px; font-size: 20px; }
.moment-dialog .hint { color: var(--muted); }
.moment-dialog textarea { resize: vertical; }
.moment-dialog input[type="date"] { color-scheme: dark; }
.dialog-actions { display: flex; gap: 8px; margin-top: 16px; }
.dialog-actions .btn { flex: 1; }
