body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at top, #1a1440, #05050a 70%);
  color: #f0eefc;
  font-family: system-ui, sans-serif;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

h1 {
  font-size: 4rem;
  letter-spacing: 0.1em;
  margin: 0;
  background: linear-gradient(90deg, #ffffff, #a78bfa);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

p {
  font-size: 1.25rem;
  opacity: 0.7;
}

button, .btn {
  text-decoration: none;
  display: inline-block;
  margin-top: 1.5rem;
  padding: 0.9rem 2rem;
  font-size: 1rem;
  color: white;
  background: #7c3aed;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 0 30px rgba(124, 58, 237, 0.6);
  transition: transform 0.2s, box-shadow 0.2s;
}

button:hover, .btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 50px rgba(124, 58, 237, 0.9);
}
.eyebrow {
  font-size: 0.8rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: #a78bfa;
  opacity: 1;
  margin-bottom: 0.5rem;
}
.countdown {
  font-size: 1rem;
  letter-spacing: 0.15em;
  color: #a78bfa;
  opacity: 1;
  font-variant-numeric: tabular-nums;
}
.page-title {
  font-size: 2.5rem;
}

.card {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  width: min(420px, 90vw);
  margin-top: 2rem;
  padding: 2rem;
  text-align: left;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(167, 139, 250, 0.2);
  border-radius: 20px;
  backdrop-filter: blur(10px);
}

label {
  font-size: 0.85rem;
  opacity: 0.8;
  margin-top: 0.75rem;
}

input, textarea {
  padding: 0.75rem 1rem;
  font: inherit;
  color: #f0eefc;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(167, 139, 250, 0.25);
  border-radius: 10px;
  color-scheme: dark;
}

input:focus, textarea:focus {
  outline: none;
  border-color: #a78bfa;
}

.back-link {
  color: #a78bfa;
  margin-top: 1rem;
  opacity: 0.7;
}
.secondary {
  background: transparent;
  border: 1px solid rgba(167, 139, 250, 0.4);
  box-shadow: none;
  margin-top: 0.5rem;
}
.capsule-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: min(420px, 90vw);
  margin: 2rem 0;
}

.capsule {
  margin-top: 0;
}

.capsule h2 {
  margin: 0;
  font-size: 1.25rem;
}

.message {
  white-space: pre-wrap;
  opacity: 1;
  margin: 0.5rem 0 0;
}
/* Protected pages stay hidden until the log-in check passes */
.protected {
  visibility: hidden;
}
/* Make sure the hidden attribute always wins over display rules */
[hidden] {
  display: none !important;
}

/* Centre text inside link-buttons */
.btn {
  text-align: center;
}

/* Capsule cards on the My capsules page are clickable */
.capsule-link {
  color: inherit;
  text-decoration: none;
  transition: border-color 0.2s, transform 0.2s;
}

.capsule-link:hover {
  border-color: #a78bfa;
  transform: translateY(-2px);
}
.hint {
  opacity: 0.6;
  font-size: 0.85em;
}
/* ===== The reveal ===== */

/* Full-screen layer on top of everything */
.reveal {
  position: fixed;
  inset: 0;
  z-index: 10;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  text-align: center;
  padding: 1.5rem;
  background: radial-gradient(circle at center, #1a1440, #05050a 70%);
  transition: opacity 0.8s ease;
}

.reveal h2 {
  font-size: 2rem;
  margin: 0;
}

/* The glowing seal */
.seal {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  margin-bottom: 1rem;
  background: radial-gradient(circle, #a78bfa, #7c3aed);
  animation: pulse 2s ease-in-out infinite;
}

.seal-icon {
  font-size: 3rem;
}

/* Gentle breathing glow while waiting */
@keyframes pulse {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 0 40px rgba(124, 58, 237, 0.5);
  }
  50% {
    transform: scale(1.06);
    box-shadow: 0 0 90px rgba(124, 58, 237, 0.9);
  }
}

/* When tapped: the seal shakes, flares white, then bursts outward */
.reveal.opening .seal {
  animation: burst 1.2s ease-in forwards;
}

@keyframes burst {
  0%   { transform: scale(1) rotate(0deg); }
  25%  { transform: scale(0.9) rotate(-8deg); }
  50%  { transform: scale(1.15) rotate(6deg); box-shadow: 0 0 140px rgba(255, 255, 255, 0.95); }
  100% { transform: scale(14); opacity: 0; }
}

/* The text fades away as the seal bursts */
.reveal-text {
  transition: opacity 0.3s ease;
}

.reveal.opening .reveal-text {
  opacity: 0;
}

/* The whole layer fades out to show the messages */
.reveal.fade-out {
  opacity: 0;
  pointer-events: none;
}

/* ===== Messages rise in one by one ===== */
.message-card {
  opacity: 0;
  animation: rise 0.8s ease forwards;
  animation-delay: calc(var(--i) * 0.4s + 0.2s);
}

@keyframes rise {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Respect people who've asked their device for less motion */
@media (prefers-reduced-motion: reduce) {
  .seal,
  .reveal.opening .seal,
  .message-card {
    animation: none;
    opacity: 1;
  }
}
/* ===== Homepage ===== */

html {
  scroll-behavior: smooth;
}

/* The homepage scrolls normally instead of centring one block */
.home {
  display: block;
}

.site-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1000px;
  margin: 0 auto;
  padding: 1.25rem 1.5rem;
}

.logo {
  font-weight: 700;
  letter-spacing: 0.3em;
  color: #f0eefc;
  text-decoration: none;
}

.nav-link {
  color: #a78bfa;
  text-decoration: none;
}

.section {
  max-width: 1000px;
  margin: 0 auto;
  padding: 5rem 1.5rem;
}

.section h2 {
  font-size: clamp(1.75rem, 5vw, 2.5rem);
  margin: 0.5rem 0 2.5rem;
}

/* Hero */
.hero {
  min-height: 75vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.hero h1 {
  font-size: clamp(2.5rem, 8vw, 5rem);
  line-height: 1.1;
  letter-spacing: 0.02em;
}

.lead {
  max-width: 600px;
  margin: 1.5rem auto 0;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem;
}

/* Cards laid out in a grid that adapts to any screen */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
}

.grid .card {
  width: auto;
  margin-top: 0;
}

.card h3 {
  margin: 0.5rem 0;
  font-size: 1.25rem;
}

.card p {
  margin: 0;
  font-size: 1rem;
}

.step-number {
  letter-spacing: 0.3em;
  color: #a78bfa;
  opacity: 1;
}

.occasion-icon {
  font-size: 2rem !important;
  opacity: 1;
}

/* Live demo */
.demo {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  min-height: 380px;
  padding: 3rem 1.5rem;
  border-radius: 24px;
  border: 1px solid rgba(167, 139, 250, 0.2);
  background: rgba(255, 255, 255, 0.03);
}

.demo.opening .seal {
  animation: burst 1.2s ease-in forwards;
}

.demo-messages {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: min(420px, 100%);
}

.demo-messages .card {
  width: auto;
  margin-top: 0;
  text-align: left;
}

/* Final call + footer */
.final-call {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.site-footer {
  padding: 2rem 1.5rem 3rem;
}

.site-footer p {
  font-size: 0.9rem;
}
/* Hero buttons: same spacing, same height, perfectly aligned */
.hero-actions {
  margin-top: 1.5rem;
  align-items: center;
}

.hero-actions .btn {
  margin-top: 0;
}

/* Slightly less empty space above the headline */
.hero {
  min-height: 65vh;
}
/* Give the gradient room for letters that hang below the line (g, y, p) */
.hero h1 {
  padding-bottom: 0.15em;
}
/* ===== Account basics ===== */

/* A button that looks like a text link */
.link-button {
  background: none;
  border: none;
  box-shadow: none;
  padding: 0;
  margin-top: 0.5rem;
  color: #a78bfa;
  font-size: 0.9rem;
  text-decoration: underline;
  cursor: pointer;
}

.link-button:hover {
  box-shadow: none;
  transform: none;
}

/* Small status messages under forms */
.card .form-message {
  margin: 0.5rem 0 0;
  font-size: 0.95rem;
  color: #a78bfa;
  opacity: 1;
}

/* Danger zone: clearly different from everything else */
.danger-zone {
  border-color: rgba(248, 113, 113, 0.35);
}

.danger {
  background: #dc2626;
  box-shadow: 0 0 30px rgba(220, 38, 38, 0.4);
}

.danger:hover {
  box-shadow: 0 0 50px rgba(220, 38, 38, 0.7);
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
/* ===== Photos ===== */

input[type="file"] {
  padding: 0.6rem;
  cursor: pointer;
}

.photo-preview {
  max-width: 100%;
  max-height: 240px;
  object-fit: cover;
  border-radius: 12px;
  margin-top: 0.5rem;
}

.message-photo {
  display: block;
  width: 100%;
  margin-top: 0.75rem;
  border-radius: 12px;
}
/* ===== Legal pages ===== */
.legal-page {
  max-width: 720px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
  text-align: left;
}

.legal-page h1 {
  font-size: clamp(2rem, 6vw, 3rem);
  margin-bottom: 1.5rem;
}

.legal-page h2 {
  font-size: 1.3rem;
  margin: 2.25rem 0 0.75rem;
}

.legal-page p,
.legal-page li {
  font-size: 1rem;
  line-height: 1.7;
  opacity: 0.85;
}

.legal-page ul {
  padding-left: 1.25rem;
}

.site-footer a,
.legal-note a {
  color: #a78bfa;
}

.card .legal-note {
  margin: 0.75rem 0 0;
  font-size: 0.8rem;
  opacity: 0.6;
}

/* ===== Members card ===== */
.card h3 {
  margin: 0 0 0.5rem;
}

.member-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.6rem 0;
  border-bottom: 1px solid rgba(167, 139, 250, 0.12);
}

.small-btn {
  margin-top: 0;
  padding: 0.35rem 1rem;
  font-size: 0.85rem;
}

.leave-btn {
  background: transparent;
  color: #fca5a5;
  border: 1px solid rgba(248, 113, 113, 0.5);
  box-shadow: none;
}

.leave-btn:hover {
  box-shadow: 0 0 20px rgba(248, 113, 113, 0.35);
}

.report-btn {
  align-self: flex-start;
  font-size: 0.8rem;
  opacity: 0.6;
}
/* ===== Installable app ===== */
.nav-actions {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.nav-install {
  margin-top: 0;
  font-size: 1rem;
  text-decoration: none;
}

.ios-hint {
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 1.5rem;
  font-size: 0.9rem;
  color: #a78bfa;
  opacity: 1;
}
/* Make the Install app button look exactly like the Log in link */
.nav-install {
  font: inherit;
  line-height: inherit;
  padding: 0;
  margin: 0;
  border: none;
  background: none;
  box-shadow: none;
  color: #a78bfa;
  text-decoration: none;
}

.nav-install:hover {
  transform: none;
  box-shadow: none;
  text-decoration: underline;
}
/* ===== Live nebula background (homepage) ===== */
.nebula {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.cloud {
  position: absolute;
  border-radius: 50%;
  will-change: transform;
}

/* Deep purple, top left */
.cloud-1 {
  width: 75vmax;
  height: 75vmax;
  top: -30vmax;
  left: -25vmax;
  background: radial-gradient(circle, rgba(124, 58, 237, 0.45), transparent 65%);
  animation: drift-1 38s ease-in-out infinite alternate;
}

/* Dark violet, bottom right */
.cloud-2 {
  width: 80vmax;
  height: 80vmax;
  bottom: -35vmax;
  right: -30vmax;
  background: radial-gradient(circle, rgba(76, 29, 149, 0.55), transparent 65%);
  animation: drift-2 46s ease-in-out infinite alternate;
}

/* Pink-violet, top right */
.cloud-3 {
  width: 55vmax;
  height: 55vmax;
  top: -10vmax;
  right: -15vmax;
  background: radial-gradient(circle, rgba(192, 38, 211, 0.22), transparent 65%);
  animation: drift-3 52s ease-in-out infinite alternate;
}

/* A hint of gold, like the star in your icon */
.cloud-4 {
  width: 45vmax;
  height: 45vmax;
  top: 40%;
  left: 35%;
  background: radial-gradient(circle, rgba(251, 191, 36, 0.12), transparent 65%);
  animation: drift-4 30s ease-in-out infinite alternate;
}

@keyframes drift-1 {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(18vmax, 12vmax) scale(1.15); }
}

@keyframes drift-2 {
  from { transform: translate(0, 0) scale(1.1); }
  to   { transform: translate(-20vmax, -10vmax) scale(0.95); }
}

@keyframes drift-3 {
  from { transform: translate(0, 0) scale(0.9); }
  to   { transform: translate(-12vmax, 18vmax) scale(1.2); }
}

@keyframes drift-4 {
  from { transform: translate(-8vmax, 0) scale(0.9); opacity: 0.6; }
  to   { transform: translate(10vmax, -8vmax) scale(1.2); opacity: 1; }
}

/* People who've asked their device for less motion get a still nebula */
@media (prefers-reduced-motion: reduce) {
  .cloud {
    animation: none;
  }
}
/* Rising lights (homepage) */
.particles {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
/* ===== Your sealed messages ===== */
.my-message {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1rem 0;
  border-bottom: 1px solid rgba(167, 139, 250, 0.12);
}

.my-message:last-child {
  border-bottom: none;
}

.my-message .message-photo {
  margin-top: 0;
  max-height: 220px;
  object-fit: cover;
}

.message-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.message-actions .link-button {
  margin-top: 0;
}

.danger-link {
  color: #fca5a5;
}

.check-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.25rem;
  font-size: 0.9rem;
}

.check-label input {
  width: auto;
}
/* ===== Edit window ===== */
.edit-timer {
  margin: 0;
  font-size: 0.8rem;
  color: #a78bfa;
  opacity: 1;
  font-variant-numeric: tabular-nums;
}

.sealed-count {
  margin: 0.75rem 0 0;
  font-size: 0.95rem;
  opacity: 0.85;
}
.sealing-note {
  margin: 0;
  font-size: 0.8rem;
  opacity: 0.7;
}
/* ===== Capsule themes ===== */
.theme-violet   { --theme-a: #8b5cf6; --theme-b: #1e1b4b; }
.theme-sunset   { --theme-a: #fb923c; --theme-b: #7c2d12; }
.theme-ocean    { --theme-a: #38bdf8; --theme-b: #0c4a6e; }
.theme-forest   { --theme-a: #4ade80; --theme-b: #14532d; }
.theme-rose     { --theme-a: #f472b6; --theme-b: #831843; }
.theme-gold     { --theme-a: #fbbf24; --theme-b: #451a03; }
.theme-midnight { --theme-a: #6366f1; --theme-b: #020617; }

.theme-bg {
  background-color: var(--theme-b);
  background-image: linear-gradient(135deg, var(--theme-a), var(--theme-b));
  background-size: cover;
  background-position: center;
}

/* Banner at the top of a capsule page */
.capsule-cover {
  width: min(420px, 90vw);
  height: 170px;
  border-radius: 20px;
  margin-bottom: 1.25rem;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.45);
}

/* Banner along the top of each card on My capsules */
.card-cover {
  height: 96px;
  margin: -2rem -2rem 0.75rem;
  border-radius: 20px 20px 0 0;
}

.capsule-link {
  overflow: hidden;
}

/* Theme picker: round colour swatches */
.theme-picker {
  border: none;
  padding: 0;
  margin: 0.75rem 0 0;
}

.theme-picker legend {
  font-size: 0.85rem;
  opacity: 0.8;
  margin-bottom: 0.5rem;
}

.theme-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.theme-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  margin: 0;
  cursor: pointer;
}

/* Hide the real radio button but keep it usable by keyboard and screen readers */
.theme-option input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.theme-swatch {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.15);
  transition: transform 0.15s;
}

.theme-name {
  font-size: 0.7rem;
  opacity: 0.7;
}

.theme-option input:checked + .theme-swatch {
  border-color: #ffffff;
  transform: scale(1.12);
  box-shadow: 0 0 18px var(--theme-a);
}

.theme-option input:focus-visible + .theme-swatch {
  outline: 2px solid #a78bfa;
  outline-offset: 3px;
}
/* Cards include their padding in their width, so they always fit their container */
.card {
  box-sizing: border-box;
}
/* ===== The capsule page takes on its theme's colours ===== */
body.themed {
  background: radial-gradient(circle at top, color-mix(in srgb, var(--theme-a) 30%, #05050a), #05050a 70%);
  background-attachment: fixed;
}

body.themed .eyebrow,
body.themed .countdown,
body.themed .edit-timer,
body.themed .card h3 {
  color: var(--theme-a);
}

body.themed .card {
  border-color: color-mix(in srgb, var(--theme-a) 35%, transparent);
}

body.themed .capsule-cover {
  box-shadow: 0 10px 50px color-mix(in srgb, var(--theme-a) 35%, transparent);
}
/* ===== Voice notes ===== */
.voice-recorder {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.voice-status {
  font-size: 0.85rem;
  color: #a78bfa;
  font-variant-numeric: tabular-nums;
}

.voice-recorder audio,
.voice-note {
  display: block;
  width: 100%;
  margin-top: 0.5rem;
}
/* ===== Friendly error message ===== */
.error-toast {
  position: fixed;
  left: 50%;
  bottom: 1.5rem;
  transform: translateX(-50%);
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 1rem;
  width: min(480px, calc(100vw - 2rem));
  box-sizing: border-box;
  padding: 0.9rem 1.25rem;
  border-radius: 14px;
  background: #1f1530;
  border: 1px solid rgba(248, 113, 113, 0.45);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  font-size: 0.95rem;
  text-align: left;
}

.error-toast .link-button {
  margin-top: 0;
  white-space: nowrap;
}
/* ===== Founder dashboard ===== */
.dashboard {
  width: min(960px, 92vw);
  margin: 0 auto;
  text-align: left;
}

.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1rem;
}

.dashboard-heading {
  font-size: 1.1rem;
  margin: 2.25rem 0 0.75rem;
  opacity: 0.9;
}

.tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.tile {
  box-sizing: border-box;
  padding: 1.25rem;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(167, 139, 250, 0.18);
}

.tile p {
  margin: 0;
  opacity: 1;
}

.tile-label {
  font-size: 0.85rem;
  color: #c4bfe0;
}

.tile-value {
  font-size: 2rem;
  font-weight: 700;
  margin: 0.35rem 0 0.2rem !important;
  color: #f0eefc;
  font-variant-numeric: tabular-nums;
}

.tile-big .tile-value {
  font-size: 2.75rem;
}

.tile-detail {
  font-size: 0.85rem;
  color: #9f99bf;
}

/* Bar chart */
.chart-tile {
  padding-bottom: 0.75rem;
}

.bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 160px;
  border-bottom: 1px solid rgba(240, 238, 252, 0.2);
}

.bar {
  flex: 1;
  min-height: 2px;
  background: #a78bfa;
  border-radius: 4px 4px 0 0;
  transition: background 0.15s;
}

.bar:hover {
  background: #c4b5fd;
}

.bar-axis {
  display: flex;
  gap: 4px;
  margin-top: 0.4rem;
  font-size: 0.75rem;
  color: #9f99bf;
}

.bar-axis span {
  flex: 1;
  text-align: center;
  white-space: nowrap;
}
/* ===== The reveal, version 2: an envelope that opens ===== */
 
/* Soft glow behind the envelope, in the capsule's theme colour */
.reveal-glow {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 440px;
  height: 440px;
  margin: -300px 0 0 -220px;
  border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--theme-a, #a78bfa) 45%, transparent), transparent 65%);
  pointer-events: none;
  animation: glow-breathe 3s ease-in-out infinite;
}
 
.envelope {
  position: relative;
  width: 220px;
  height: 140px;
  margin-bottom: 1.75rem;
  perspective: 900px;
  animation: envelope-float 3s ease-in-out infinite;
}
 
/* Inside of the envelope */
.envelope-back {
  position: absolute;
  inset: 0;
  border-radius: 10px;
  background: color-mix(in srgb, var(--theme-b, #1e1b4b) 70%, #000);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
}
 
/* The letter waiting inside */
.letter {
  position: absolute;
  left: 8%;
  right: 8%;
  top: 8%;
  height: 84%;
  z-index: 2;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: linear-gradient(#fffaf0, #efe3cf);
  color: var(--theme-a, #a78bfa);
  font-size: 1.6rem;
}
 
/* Front pocket, with a V cut out of the top */
.envelope-front {
  position: absolute;
  inset: 0;
  z-index: 3;
  border-radius: 10px;
  background: linear-gradient(160deg,
    color-mix(in srgb, var(--theme-a, #a78bfa) 55%, #1e1b4b),
    color-mix(in srgb, var(--theme-b, #1e1b4b) 85%, #000));
  clip-path: polygon(0 0, 50% 52%, 100% 0, 100% 100%, 0 100%);
}
 
/* The triangular flap that swings open */
.envelope-flap {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 58%;
  z-index: 4;
  transform-origin: top center;
  background: linear-gradient(180deg,
    color-mix(in srgb, var(--theme-a, #a78bfa) 80%, #ffffff),
    color-mix(in srgb, var(--theme-a, #a78bfa) 70%, #1e1b4b));
  clip-path: polygon(0 0, 100% 0, 50% 100%);
}
 
/* The glowing wax seal at the tip of the flap */
.wax-seal {
  position: absolute;
  left: 50%;
  top: 58%;
  width: 46px;
  height: 46px;
  margin: -23px 0 0 -23px;
  z-index: 5;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #ffffff;
  font-size: 1.1rem;
  background: radial-gradient(circle at 35% 30%,
    color-mix(in srgb, var(--theme-a, #a78bfa) 55%, #ffffff),
    var(--theme-a, #a78bfa) 55%,
    color-mix(in srgb, var(--theme-a, #a78bfa) 55%, #000000));
  box-shadow: 0 0 28px color-mix(in srgb, var(--theme-a, #a78bfa) 75%, transparent);
  animation: seal-pulse 2s ease-in-out infinite;
}
 
/* Where the sparkles start from */
.sparkles {
  position: absolute;
  left: 50%;
  top: 15%;
  width: 0;
  height: 0;
  z-index: 6;
}
 
.sparkle {
  position: absolute;
  width: 6px;
  height: 6px;
  margin: -3px;
  border-radius: 50%;
  background: var(--c);
  box-shadow: 0 0 10px var(--c);
  opacity: 0;
  animation: sparkle-fly 1.1s ease-out forwards;
  animation-delay: calc(1.35s + var(--delay));
}
 
/* ----- While waiting ----- */
@keyframes envelope-float {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-8px); }
}
 
@keyframes glow-breathe {
  0%, 100% { transform: scale(1);    opacity: 0.7; }
  50%      { transform: scale(1.08); opacity: 1; }
}
 
@keyframes seal-pulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.08); }
}
 
/* ----- The opening sequence (one class, many timed steps) ----- */
.reveal.opening .envelope {
  animation: envelope-shake 0.35s ease-in-out;
}
 
.reveal.opening .wax-seal {
  animation: seal-pop 0.3s ease-in 0.3s forwards;
}
 
.reveal.opening .envelope-flap {
  animation: flap-open 0.6s ease-in-out 0.55s forwards;
}
 
.reveal.opening .letter {
  animation: letter-rise 0.7s cubic-bezier(0.2, 0.8, 0.2, 1) 1s forwards;
}
 
.reveal.opening .reveal-glow {
  animation: glow-burst 0.9s ease-out 1.35s forwards;
}
 
@keyframes envelope-shake {
  0%, 100% { transform: rotate(0); }
  20%      { transform: rotate(-4deg); }
  40%      { transform: rotate(4deg); }
  60%      { transform: rotate(-3deg); }
  80%      { transform: rotate(2deg); }
}
 
@keyframes seal-pop {
  to { transform: scale(1.7); opacity: 0; }
}
 
@keyframes flap-open {
  0%   { transform: rotateX(0deg);   z-index: 4; }
  49%  { z-index: 4; }
  50%  { z-index: 1; }
  100% { transform: rotateX(180deg); z-index: 1; }
}
 
@keyframes letter-rise {
  to {
    transform: translateY(-78%);
    box-shadow: 0 0 45px color-mix(in srgb, var(--theme-a, #a78bfa) 70%, transparent);
  }
}
 
@keyframes glow-burst {
  to { transform: scale(4); opacity: 0; }
}
 
@keyframes sparkle-fly {
  0%   { transform: translate(0, 0) scale(0.4); opacity: 1; }
  100% { transform: translate(var(--x), var(--y)) scale(1); opacity: 0; }
}
 
/* People who've asked for less motion: everything stays still */
@media (prefers-reduced-motion: reduce) {
  .reveal-glow,
  .envelope,
  .wax-seal,
  .reveal.opening .envelope,
  .reveal.opening .wax-seal,
  .reveal.opening .envelope-flap,
  .reveal.opening .letter,
  .reveal.opening .reveal-glow,
  .sparkle {
    animation: none;
  }
}
/* ===== Memory Lane: a full-screen story of the capsule's memories ===== */
body.lane-open {
  overflow: hidden;
}

.lane {
  position: fixed;
  inset: 0;
  z-index: 30;
  overflow: hidden;
  background: #05050a;
  color: #ffffff;
  text-align: left;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  cursor: pointer;
}

.lane-stage {
  position: absolute;
  inset: 0;
}

/* Progress bars along the top, one per slide */
.lane-progress {
  position: absolute;
  top: max(12px, env(safe-area-inset-top));
  left: 12px;
  right: 56px;
  z-index: 5;
  display: flex;
  gap: 4px;
}

.lane-seg {
  flex: 1;
  height: 3px;
  border-radius: 2px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.25);
}

.lane-fill {
  display: block;
  width: 0;
  height: 100%;
  background: #ffffff;
}

/* Close and previous/next buttons */
.lane .lane-close,
.lane .lane-nav {
  position: absolute;
  z-index: 6;
  margin: 0;
  color: #ffffff;
  border: none;
  box-shadow: none;
  cursor: pointer;
}

.lane .lane-close {
  top: max(2px, env(safe-area-inset-top));
  right: 6px;
  padding: 0.35rem 0.7rem;
  background: none;
  font-size: 1.4rem;
}

.lane .lane-nav {
  top: 50%;
  width: 44px;
  height: 44px;
  margin-top: -22px;
  padding: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 1.6rem;
  line-height: 1;
  background: rgba(255, 255, 255, 0.12);
}

.lane .lane-nav-prev { left: 12px; }
.lane .lane-nav-next { right: 12px; }

.lane .lane-close:hover,
.lane .lane-nav:hover {
  transform: none;
  box-shadow: none;
  background: rgba(255, 255, 255, 0.2);
}

/* Each slide fades in over the previous one */
.lane-slide {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  opacity: 0;
  transition: opacity 0.7s ease;
}

.lane-slide.visible {
  opacity: 1;
}

/* Photo slides: a blurred backdrop, the photo slowly zooming, a dark fade for the text */
.lane-photo-bg {
  position: absolute;
  inset: -40px;
  width: calc(100% + 80px);
  height: calc(100% + 80px);
  object-fit: cover;
  filter: blur(30px) brightness(0.45);
}

.lane-photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  animation: ken-burns var(--dur, 8s) linear forwards;
}

@keyframes ken-burns {
  from { transform: scale(1); }
  to   { transform: scale(1.12) translate(var(--kx, 0), var(--ky, 0)); }
}

.lane-shade {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(5, 5, 10, 0.92) 0%, rgba(5, 5, 10, 0.4) 35%, transparent 60%);
}

/* The words */
.lane-caption {
  position: relative;
  width: 100%;
  max-width: 680px;
  margin: 0 auto;
  padding: 2rem 1.5rem calc(2.5rem + env(safe-area-inset-bottom));
  box-sizing: border-box;
}

.lane-author {
  margin: 0 0 0.5rem;
  font-size: 0.8rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: #e9e3ff;
  opacity: 0.9;
}

.lane-message {
  margin: 0;
  max-height: 45vh;
  overflow: auto;
  font-size: clamp(1.15rem, 3.5vw, 1.6rem);
  line-height: 1.45;
  white-space: pre-wrap;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.6);
  opacity: 1;
}

.lane-caption audio {
  display: block;
  width: 100%;
  margin-top: 1rem;
}

/* Messages without a photo: a big quote on the theme colour */
.lane-no-photo {
  justify-content: center;
}

.lane-no-photo .lane-caption {
  text-align: center;
}

.lane-no-photo .lane-message {
  font-size: clamp(1.4rem, 4.5vw, 2.2rem);
}

/* Title and ending cards */
.lane-text-slide {
  justify-content: center;
  align-items: center;
  padding: 2rem;
  text-align: center;
}

.lane-eyebrow {
  margin: 0;
  font-size: 0.8rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  opacity: 0.85;
}

.lane-text-slide h2 {
  margin: 0.75rem 0;
  font-size: clamp(2rem, 6vw, 3.2rem);
}

.lane-text-slide p {
  opacity: 0.85;
}

.lane-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem;
  margin-top: 1.5rem;
}

.lane-actions button {
  margin-top: 0;
}

/* Hold to pause */
.lane-paused {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 6;
  transform: translate(-50%, -50%);
  padding: 0.5rem 1.1rem;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.55);
  font-size: 0.9rem;
  pointer-events: none;
}

.lane.paused .lane-photo {
  animation-play-state: paused;
}

/* The "Play memory lane" button on the capsule page */
.memory-lane-btn {
  margin: 0.5rem 0 1rem;
}

/* On phones, people tap the sides of the screen, so the arrow buttons would only cover the words */
@media (max-width: 600px) {
  .lane .lane-nav { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .lane-photo { animation: none; }
  .lane-slide { transition: none; }
}
/* ===== SSealSoonl photos per message ===== */

/* Thumbnails while picking photos (create page, add-message form, editor) */
.photo-thumbs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
  gap: 8px;
  margin-top: 0.75rem;
}

.photo-thumbs[hidden] {
  display: none;
}

.photo-thumb {
  position: relative;
  aspect-ratio: 1;
  border-radius: 10px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.06);
}

.photo-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.photo-thumbs .photo-thumb-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 26px;
  height: 26px;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 0.8rem;
  line-height: 1;
  color: #ffffff;
  background: rgba(0, 0, 0, 0.65);
  box-shadow: none;
  cursor: pointer;
}

.photo-thumbs .photo-thumb-remove:hover {
  transform: none;
  box-shadow: none;
  background: rgba(0, 0, 0, 0.85);
}

.photo-limit {
  margin: 0.4rem 0 0;
  font-size: 0.8rem;
}

/* A message's photos: a neat grid you can tap to enlarge */
.photo-gallery {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
  margin-top: 1rem;
  border-radius: 14px;
  overflow: hidden;
}

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

/* 3 or 5 photos: the first one goes full width so there's no gap */
.photo-gallery.odd > :first-child {
  grid-column: 1 / -1;
  aspect-ratio: 16 / 9;
}

.photo-gallery .gallery-item {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 0;
  background: rgba(255, 255, 255, 0.06);
  box-shadow: none;
  overflow: hidden;
  cursor: zoom-in;
}

.photo-gallery.single .gallery-item {
  aspect-ratio: auto;
}

.photo-gallery .gallery-item:hover {
  transform: none;
  box-shadow: none;
}

.photo-gallery img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.photo-gallery.single img {
  height: auto;
  max-height: 70vh;
  object-fit: contain;
}

.photo-gallery .gallery-item:hover img {
  transform: scale(1.04);
}

/* Full-screen photo viewer */
body.lightbox-open {
  overflow: hidden;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 3.5rem 1rem;
  background: rgba(5, 5, 10, 0.94);
  animation: lightbox-in 0.25s ease;
}

@keyframes lightbox-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.lightbox-img {
  max-width: 100%;
  max-height: 100%;
  border-radius: 8px;
  object-fit: contain;
}

.lightbox .lightbox-close,
.lightbox .lightbox-nav {
  position: absolute;
  margin: 0;
  border: none;
  color: #ffffff;
  box-shadow: none;
  cursor: pointer;
}

.lightbox .lightbox-close {
  top: max(8px, env(safe-area-inset-top));
  right: 8px;
  padding: 0.35rem 0.7rem;
  background: none;
  font-size: 1.4rem;
}

.lightbox .lightbox-nav {
  top: 50%;
  width: 44px;
  height: 44px;
  margin-top: -22px;
  padding: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 1.6rem;
  line-height: 1;
  background: rgba(255, 255, 255, 0.14);
}

.lightbox .lightbox-prev { left: 10px; }
.lightbox .lightbox-next { right: 10px; }

.lightbox .lightbox-close:hover,
.lightbox .lightbox-nav:hover {
  transform: none;
  box-shadow: none;
  background: rgba(255, 255, 255, 0.24);
}

.lightbox-counter {
  position: absolute;
  bottom: max(14px, env(safe-area-inset-bottom));
  left: 0;
  right: 0;
  margin: 0;
  text-align: center;
  font-size: 0.85rem;
  opacity: 0.8;
}

/* Memory Lane: sSealSoonl photos in one memory cross-fade like a mini slideshow */
.lane-photo-layer {
  position: absolute;
  inset: 0;
  overflow: hidden;
  opacity: 0;
  transition: opacity 0.9s ease;
}

.lane-photo-layer.active {
  opacity: 1;
}

.lane-photo-layer .lane-photo {
  animation: none; /* only the photo on screen zooms */
}

.lane-photo-layer.active .lane-photo {
  animation: ken-burns var(--dur, 8s) linear forwards;
}

.lane.paused .lane-photo-layer.active .lane-photo {
  animation-play-state: paused;
}

.lane-photo-count {
  position: absolute;
  top: calc(max(12px, env(safe-area-inset-top)) + 16px);
  left: 12px;
  z-index: 2;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  background: rgba(0, 0, 0, 0.45);
}

@media (prefers-reduced-motion: reduce) {
  .lane-photo-layer { transition: none; }
  .lane-photo-layer.active .lane-photo { animation: none; }
  .photo-gallery img { transition: none; }
  .lightbox { animation: none; }
}

/* ===== Reactions and the group chat (after a capsule opens) ===== */

/* ❤️ 😂 😭 🔥 under each memory */
.reaction-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 1rem;
}

.reaction-bar .reaction {
  margin: 0;
  padding: 0.3rem 0.7rem;
  border: 1px solid rgba(167, 139, 250, 0.25);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  color: inherit;
  font-size: 0.9rem;
  line-height: 1.3;
  box-shadow: none;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.15s;
}

.reaction-bar .reaction:hover {
  transform: translateY(-1px);
  box-shadow: none;
  border-color: rgba(167, 139, 250, 0.6);
}

.reaction-bar .reaction.mine {
  background: rgba(124, 58, 237, 0.3);
  border-color: #a78bfa;
}

.reaction-bar .reaction:disabled {
  opacity: 0.7;
}

/* The chat card */
.chat-card {
  margin-top: 1.5rem;
  box-sizing: border-box;
}

.chat-card h3 {
  margin-bottom: 0.25rem;
}

.chat-feed {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  max-height: 420px;
  overflow-y: auto;
  margin-top: 1rem;
  padding: 0.25rem 0.25rem 0.5rem 0;
}

.chat-empty {
  margin: 0.5rem 0;
}

.chat-msg {
  position: relative;
  max-width: 85%;
  padding: 0.55rem 0.85rem 0.45rem;
  border-radius: 14px 14px 14px 4px;
  background: rgba(255, 255, 255, 0.06);
  align-self: flex-start;
  text-align: left;
}

.chat-msg.mine {
  align-self: flex-end;
  border-radius: 14px 14px 4px 14px;
  background: rgba(124, 58, 237, 0.28);
}

.chat-meta {
  margin: 0;
  font-size: 0.75rem;
  opacity: 0.75;
}

.chat-meta b {
  font-weight: 600;
}

.chat-text {
  margin: 0.15rem 0 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.chat-msg .chat-action {
  margin: 0.2rem 0 0;
  padding: 0;
  font-size: 0.72rem;
  opacity: 0;
  transition: opacity 0.15s;
}

/* Delete / Report appear on hover (always visible on touch screens) */
.chat-msg:hover .chat-action,
.chat-msg:focus-within .chat-action {
  opacity: 0.8;
}

@media (hover: none) {
  .chat-msg .chat-action { opacity: 0.6; }
}

.chat-form {
  display: flex;
  gap: 0.5rem;
  align-items: flex-end;
  margin-top: 0.75rem;
}

.chat-form textarea {
  flex: 1;
  min-width: 0;
  min-height: 2.8rem;
  max-height: 8rem;
  margin: 0;
  resize: vertical;
}

.chat-form button {
  flex-shrink: 0;
  margin: 0;
}

@media (prefers-reduced-motion: reduce) {
  .reaction-bar .reaction,
  .chat-msg .chat-action { transition: none; }
  .reaction-bar .reaction:hover { transform: none; }
}

/* ===== Usernames, search and invites ===== */

/* "@" in front of the username box */
.username-field {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.username-at {
  font-size: 1.2rem;
  opacity: 0.7;
}

.username-field input {
  flex: 1;
  min-width: 0;
  margin: 0;
}

/* Invite by username (capsule page) */
.invite-username {
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid rgba(167, 139, 250, 0.2);
}

.user-results {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-top: 0.5rem;
}

.user-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
}

.user-who {
  display: flex;
  flex-direction: column;
  min-width: 0;
  text-align: left;
}

.user-name {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-handle {
  font-size: 0.85rem;
  opacity: 0.7;
}

.user-row button {
  flex-shrink: 0;
  margin: 0;
}

/* My capsules page: username nudge and pending invites */
#invites {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

#invites:empty {
  display: none;
}

.username-nudge {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  text-decoration: none;
  color: inherit;
  border: 1px dashed rgba(167, 139, 250, 0.5);
  box-sizing: border-box;
}

.invites-heading {
  margin: 0.5rem 0 0;
}

.invite-card {
  box-sizing: border-box;
}

.invite-card h2 {
  margin: 0.25rem 0;
}

.invite-from {
  margin: 0;
  font-size: 0.85rem;
  opacity: 0.85;
}

/* ===== App shell: bottom tab bar, starting animation, Activity, Play, Profile ===== */

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* Leave room at the bottom so the tab bar never covers content */
body.has-tab-bar {
  padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px));
}

/* ----- Bottom tab bar ----- */
.tab-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  display: flex;
  justify-content: space-around;
  align-items: center;
  max-width: 560px;
  margin: 0 auto;
  padding: 0.4rem max(12px, env(safe-area-inset-right, 0px)) calc(0.4rem + env(safe-area-inset-bottom, 0px)) max(12px, env(safe-area-inset-left, 0px));
  background: rgba(10, 8, 20, 0.82);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-top: 1px solid rgba(167, 139, 250, 0.18);
}

@media (min-width: 600px) {
  .tab-bar {
    bottom: 14px;
    border: 1px solid rgba(167, 139, 250, 0.22);
    border-radius: 22px;
    padding-bottom: 0.4rem;
  }
}

.tab {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 0.35rem 0;
  color: rgba(240, 238, 252, 0.55);
  font-size: 0.68rem;
  text-decoration: none;
  transition: color 0.15s;
}

.tab svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tab:hover {
  color: rgba(240, 238, 252, 0.85);
}

.tab.active {
  color: #ffffff;
}

.tab.active svg {
  stroke: #c4b5fd;
  filter: drop-shadow(0 0 6px rgba(167, 139, 250, 0.6));
}

.tab:focus-visible {
  outline: 2px solid #a78bfa;
  outline-offset: 2px;
  border-radius: 12px;
}

/* The big ➕ in the middle */
.tab.tab-create {
  flex: 0 0 auto;
  width: 52px;
  height: 52px;
  margin: -22px 0.5rem 0;
  justify-content: center;
  border-radius: 50%;
  background: linear-gradient(135deg, #8b5cf6, #6d28d9);
  color: #ffffff;
  box-shadow: 0 6px 24px rgba(124, 58, 237, 0.55);
}

.tab.tab-create svg {
  width: 26px;
  height: 26px;
  stroke-width: 2.4;
}

.tab.tab-create:hover {
  transform: translateY(-1px);
}

/* Red dot on Activity */
.tab-dot {
  position: absolute;
  top: 4px;
  left: calc(50% + 8px);
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #f43f5e;
  box-shadow: 0 0 0 2px rgba(10, 8, 20, 0.9);
}

/* ----- Starting animation ----- */
.splash {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  background: radial-gradient(circle at center, #1a1440, #05050a 70%);
  transition: opacity 0.45s ease;
  cursor: pointer;
}

.splash.done {
  opacity: 0;
  pointer-events: none;
}

.splash-seal {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  color: #ffffff;
  font-size: 1.5rem;
  background: radial-gradient(circle at 35% 30%, #ddd6fe, #8b5cf6 55%, #4c1d95);
  box-shadow: 0 0 40px rgba(167, 139, 250, 0.7);
  animation: splash-seal 0.7s cubic-bezier(0.2, 0.8, 0.2, 1.3) both;
}

.splash-word {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: 0.45em;
  margin-right: -0.45em; /* keeps the spaced-out word centred */
  animation: splash-rise 0.6s ease 0.25s both;
}

.splash-line {
  font-size: 0.85rem;
  opacity: 0.7;
  animation: splash-rise 0.6s ease 0.45s both;
}

@keyframes splash-seal {
  from { transform: scale(0.3) rotate(-30deg); opacity: 0; }
  to   { transform: scale(1) rotate(0); opacity: 1; }
}

@keyframes splash-rise {
  from { transform: translateY(10px); opacity: 0; }
  to   { transform: translateY(0); }
}

/* ----- Activity page ----- */
.activity-group {
  max-width: 560px;
  margin: 0 auto 1.5rem;
  text-align: left;
}

.activity-group h3 {
  margin: 0 0 0.5rem;
  font-size: 0.8rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  opacity: 0.7;
}

.activity-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.activity-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 0.9rem;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid transparent;
  color: inherit;
  text-decoration: none;
  transition: background 0.15s;
}

.activity-item:hover {
  background: rgba(255, 255, 255, 0.08);
}

.activity-item.new {
  border-color: rgba(167, 139, 250, 0.4);
  background: rgba(124, 58, 237, 0.12);
}

.activity-icon {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  font-size: 1.15rem;
}

.activity-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.activity-text {
  overflow-wrap: anywhere;
}

.activity-text b {
  font-weight: 600;
}

.activity-time {
  font-size: 0.78rem;
  opacity: 0.6;
}

.activity-new {
  flex-shrink: 0;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  background: #7c3aed;
}

.activity-empty {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.25rem;
  box-sizing: border-box;
}

/* ----- Play page ----- */
.play-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-width: 560px;
  margin: 0 auto;
}

.play-card {
  position: relative;
  text-align: left;
  box-sizing: border-box;
}

.play-card h2 {
  margin: 0.6rem 0 0.4rem;
  font-size: 1.25rem;
}

.play-card p {
  margin: 0;
  opacity: 0.9;
}

.play-badge {
  display: inline-block;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  background: rgba(0, 0, 0, 0.35);
}

/* ----- Profile page links ----- */
.profile-links {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  box-sizing: border-box;
}

.profile-link {
  display: flex;
  justify-content: space-between;
  padding: 0.7rem 0.25rem;
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid rgba(167, 139, 250, 0.12);
}

.profile-link:hover {
  color: #c4b5fd;
}

.profile-links .leave-btn {
  margin-top: 1rem;
}

@media (prefers-reduced-motion: reduce) {
  .splash, .splash-seal, .splash-word, .splash-line { animation: none; transition: none; }
  .tab, .activity-item { transition: none; }
}
/* ===== Step 28b: vault opening (My capsules) and capsules rising in ===== */

.vault {
  position: fixed;
  inset: 0;
  z-index: 50;
  overflow: hidden;
  pointer-events: auto;
  cursor: pointer;
}

/* Two heavy doors that meet in the middle */
.vault-door {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 50.5%;
  background:
    repeating-linear-gradient(90deg, rgba(167, 139, 250, 0.05) 0 2px, transparent 2px 46px),
    linear-gradient(180deg, #1a1440, #0a0816);
  transition: transform 0.9s cubic-bezier(0.7, 0, 0.2, 1) 0.35s;
}

.vault-left {
  left: 0;
  border-right: 1px solid rgba(167, 139, 250, 0.35);
  box-shadow: inset -30px 0 60px rgba(0, 0, 0, 0.5);
}

.vault-right {
  right: 0;
  border-left: 1px solid rgba(167, 139, 250, 0.35);
  box-shadow: inset 30px 0 60px rgba(0, 0, 0, 0.5);
}

/* The glowing seal where the doors meet */
.vault-seal {
  position: absolute;
  top: 50%;
  left: 50%;
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  margin: -36px 0 0 -36px;
  border-radius: 50%;
  color: #ffffff;
  font-size: 1.6rem;
  background: radial-gradient(circle at 35% 30%, #ddd6fe, #8b5cf6 55%, #4c1d95);
  box-shadow: 0 0 45px rgba(167, 139, 250, 0.75);
  transition: transform 0.45s ease, opacity 0.45s ease;
}

.vault.open .vault-left  { transform: translateX(-101%); }
.vault.open .vault-right { transform: translateX(101%); }

/* The seal turns like a lock, then bursts */
.vault.open .vault-seal {
  animation: vault-unlock 0.5s ease forwards;
}

@keyframes vault-unlock {
  0%   { transform: rotate(0) scale(1); opacity: 1; }
  50%  { transform: rotate(90deg) scale(1.1); opacity: 1; }
  100% { transform: rotate(90deg) scale(2.2); opacity: 0; }
}

/* Your capsules rise in one after another (every time the page loads).
   When the vault plays, they wait until the doors are open. */
body.after-vault {
  --rise-wait: 0.8s;
}

#capsule-list > .capsule-link,
#invites > * {
  animation: capsule-rise 0.55s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

#capsule-list > .capsule-link:nth-child(1) { animation-delay: calc(var(--rise-wait, 0s) + 0.05s); }
#capsule-list > .capsule-link:nth-child(2) { animation-delay: calc(var(--rise-wait, 0s) + 0.12s); }
#capsule-list > .capsule-link:nth-child(3) { animation-delay: calc(var(--rise-wait, 0s) + 0.19s); }
#capsule-list > .capsule-link:nth-child(4) { animation-delay: calc(var(--rise-wait, 0s) + 0.26s); }
#capsule-list > .capsule-link:nth-child(5) { animation-delay: calc(var(--rise-wait, 0s) + 0.33s); }
#capsule-list > .capsule-link:nth-child(n+6) { animation-delay: calc(var(--rise-wait, 0s) + 0.4s); }

@keyframes capsule-rise {
  from { opacity: 0; transform: translateY(24px) scale(0.98); }
  to   { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .vault { display: none; }
  #capsule-list > .capsule-link,
  #invites > * { animation: none; }
}

/* ===== Future Prediction Battles ===== */

/* Play page: "Start a battle" and your battles */
.play-card .play-start {
  display: inline-block;
  margin-top: 1rem;
}

.my-battles {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-top: 1rem;
}

.my-battles-heading {
  margin: 0.25rem 0 0;
  font-size: 0.75rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  opacity: 0.8;
}

.battle-row {
  display: flex;
  flex-direction: column;
  padding: 0.6rem 0.8rem;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.28);
  color: inherit;
  text-decoration: none;
}

.battle-row:hover {
  background: rgba(0, 0, 0, 0.4);
}

.battle-row-title {
  font-weight: 600;
}

.battle-row-when {
  font-size: 0.8rem;
  opacity: 0.85;
}

/* New battle form */
.quick-dates {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.5rem;
}

.quick-dates button {
  margin: 0;
}

.question-picker {
  margin: 1.25rem 0 0;
  padding: 0;
  border: none;
}

.question-picker legend {
  margin-bottom: 0.5rem;
  font-weight: 600;
}

#question-options {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.question-option {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.1rem 0.6rem;
  align-items: start;
  margin: 0;
  padding: 0.6rem 0.75rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
  text-align: left;
}

.question-option input {
  grid-row: span 2;
  margin-top: 0.2rem;
  width: auto;
}

.question-text {
  font-weight: 500;
}

.question-kind {
  font-size: 0.78rem;
  opacity: 0.65;
}

.custom-question {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.custom-question input {
  flex: 1 1 220px;
  min-width: 0;
  margin: 0;
}

.custom-question select,
.custom-question button {
  margin: 0;
}

/* Before the reveal: who has predicted */
.progress-list {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin-top: 0.5rem;
}

.progress-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.45rem 0;
  border-bottom: 1px solid rgba(167, 139, 250, 0.12);
}

.progress-state {
  opacity: 0.6;
}

.progress-state.done {
  opacity: 1;
  color: #86efac;
}

/* Before the reveal: your predictions */
.prediction-questions {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin: 1rem 0;
  text-align: left;
}

.prediction-question label {
  display: block;
  margin-bottom: 0.4rem;
  font-weight: 600;
}

.prediction-question select,
.prediction-question textarea {
  width: 100%;
  box-sizing: border-box;
  margin: 0;
}

/* After the reveal: leaderboard */
.leaderboard-list {
  margin: 0.75rem 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.leaderboard-row {
  display: flex;
  justify-content: space-between;
  padding: 0.55rem 0.8rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
}

.leaderboard-row.winner {
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.25), rgba(124, 58, 237, 0.2));
  border: 1px solid rgba(251, 191, 36, 0.5);
  font-weight: 600;
}

.leaderboard-points {
  font-variant-numeric: tabular-nums;
  opacity: 0.8;
}

/* After the reveal: every question with everyone's predictions */
.reveal-questions {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1rem;
}

.reveal-question {
  text-align: left;
  box-sizing: border-box;
  animation: capsule-rise 0.55s cubic-bezier(0.2, 0.8, 0.2, 1) both;
  animation-delay: calc(var(--i, 0) * 0.08s);
}

.reveal-summary {
  margin: 0 0 0.5rem;
  font-size: 0.85rem;
  color: #fde68a;
}

.prediction-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.1rem 0.75rem;
  align-items: center;
  padding: 0.6rem 0;
  border-top: 1px solid rgba(167, 139, 250, 0.12);
}

.prediction-who {
  grid-column: 1;
  margin: 0;
  font-size: 0.78rem;
  opacity: 0.65;
}

.prediction-what {
  grid-column: 1;
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.prediction-row .vote-btn {
  grid-column: 2;
  grid-row: 1 / span 2;
  margin: 0;
  padding: 0.35rem 0.8rem;
  border: 1px solid rgba(134, 239, 172, 0.4);
  border-radius: 999px;
  background: transparent;
  color: inherit;
  font-size: 0.8rem;
  box-shadow: none;
  white-space: nowrap;
  cursor: pointer;
}

.prediction-row .vote-btn:hover {
  transform: none;
  box-shadow: none;
  background: rgba(134, 239, 172, 0.1);
}

.prediction-row .vote-btn.mine {
  background: rgba(34, 197, 94, 0.25);
  border-color: #86efac;
}

#battle-delete {
  display: block;
  margin: 2rem auto 0;
}

@media (prefers-reduced-motion: reduce) {
  .reveal-question { animation: none; }
}

/* ===== Find people (search by @username) ===== */

.people-search {
  box-sizing: border-box;
  text-align: left;
}

.search-field {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0 0.85rem;
  border: 1px solid rgba(167, 139, 250, 0.3);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
}

.search-field:focus-within {
  border-color: #a78bfa;
  box-shadow: 0 0 0 3px rgba(167, 139, 250, 0.2);
}

.search-field input {
  flex: 1;
  min-width: 0;
  margin: 0;
  border: none;
  background: transparent;
  box-shadow: none;
  outline: none;
}

.people-results {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-top: 0.75rem;
}

.person-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.75rem;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.05);
}

.person-row .user-who {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.person-row .user-name {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.person-row .user-handle {
  font-size: 0.85rem;
  opacity: 0.7;
}

.person-row button {
  flex-shrink: 0;
  margin: 0;
}

.person-avatar {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-weight: 700;
  color: #ffffff;
  background: linear-gradient(135deg, #8b5cf6, #6d28d9);
}

.person-invite {
  margin: -0.15rem 0 0.4rem;
  padding: 0.75rem;
  border-radius: 0 0 14px 14px;
  background: rgba(124, 58, 237, 0.12);
}

.person-invite label {
  margin-top: 0;
}

.person-invite-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.person-invite-row select {
  flex: 1 1 200px;
  min-width: 0;
  margin: 0;
}

.person-invite-row button {
  margin: 0;
}

/* Profile page: the "Find people" link */
.find-people {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-bottom: 1rem;
  color: inherit;
  text-decoration: none;
  text-align: left;
  box-sizing: border-box;
}

.find-people strong {
  display: block;
}

.find-people-icon {
  font-size: 1.5rem;
}

/* ===== Friends ===== */

/* Buttons next to a person: Add friend + Invite */
.person-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.4rem;
  flex-shrink: 0;
}

.person-actions button {
  margin: 0;
}

.user-row .person-actions {
  margin-left: auto;
}

/* The friend button changes look with each state */
.friend-btn.friend-none {
  background: transparent;
  border: 1px solid rgba(167, 139, 250, 0.6);
  box-shadow: none;
}

.friend-btn.friend-requested {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid transparent;
  box-shadow: none;
  opacity: 0.85;
}

.friend-btn.friend-incoming {
  background: linear-gradient(135deg, #22c55e, #15803d);
  box-shadow: 0 0 14px rgba(34, 197, 94, 0.35);
}

.friend-btn.friend-friends {
  background: rgba(34, 197, 94, 0.18);
  border: 1px solid rgba(134, 239, 172, 0.5);
  box-shadow: none;
}

.friend-btn.confirming {
  background: rgba(244, 63, 94, 0.2);
  border: 1px solid rgba(253, 164, 175, 0.7);
}

/* Profile page: requests and friends list */
.friends-section {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 1rem;
  text-align: left;
  box-sizing: border-box;
}

#friends-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

#friends-list h3 {
  margin: 0.5rem 0 0.25rem;
}

#friends-list h3:first-child {
  margin-top: 0;
}

/* On narrow phones, put the buttons under the name */
@media (max-width: 420px) {
  .person-row {
    flex-wrap: wrap;
  }
  .person-row .person-actions {
    width: 100%;
    justify-content: flex-start;
    padding-left: calc(40px + 0.75rem);
  }
}