/* ============================================================
   ALE'S HEART — combined styles (v2, pro polish)
   ============================================================ */
:root {
  --glow: 1.6;
  --heartGlow: 1.5;
  --buttonGlow: 1.6;
  --edgeIntensity: 1.4;
  --pinkHue: 335;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; width: 100%; }
body {
  background: #000;
  overflow: hidden;
  font-family: "Inter Tight", -apple-system, BlinkMacSystemFont, "SF Pro Display", "Helvetica Neue", sans-serif;
  user-select: none;
  color: #ffd9ec;
  -webkit-font-smoothing: antialiased;
}

/* ============================================================
   SCREEN SYSTEM
   ============================================================ */
.screen {
  position: fixed; inset: 0;
  display: flex;
  align-items: center; justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 1s cubic-bezier(.4,0,.2,1);
  z-index: 10;
}
.screen.active { opacity: 1; pointer-events: all; }

/* Inactive screens must NOT receive any input — even from children that
   explicitly set pointer-events: all (cards, buttons). Without this the
   invisible cards on the neural screen still capture clicks when the user
   is on the landing/hack/heart screens after navigating back. */
.screen:not(.active),
.screen:not(.active) * {
  pointer-events: none !important;
}

/* Sparkles canvas overlay — sits behind screen content but above the
   constellation. Keep low so memory cards and panels are never overlapped. */
#sparkles-canvas {
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 1;
  mix-blend-mode: screen;
}
/* Constellation sits BEHIND everything */
#constellation-canvas {
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 0;
  transition: opacity 0.9s ease;
}
/* Dim the constellation on the neural screen so cards really pop. */
body.on-neural #constellation-canvas { opacity: 0.18; }
body.on-neural #sparkles-canvas       { opacity: 0.45; }

/* ============================================================
   LIQUID GLASS SYSTEM
   Real refraction via SVG turbulence + displacement (strong).
   Layered:  glass-filter (refracted backdrop)
           + glass-tint   (pink wash)
           + glass-specular (mouse-tracked highlight)
           + glass-edge   (1px rim + inner shadow)
           + glass-content (label)
   ============================================================ */
.glass {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}

.glass .glass-filter,
.glass .glass-tint,
.glass .glass-specular,
.glass .glass-edge {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
}

.glass .glass-filter {
  z-index: 1;
  backdrop-filter: blur(6px) saturate(150%) brightness(1.06);
  -webkit-backdrop-filter: blur(6px) saturate(150%) brightness(1.06);
}
/* Reserve the expensive liquid distortion ONLY for the marquee elements
   (main CTA buttons + progress bar). Each filter:url() instance costs a
   full re-displace per frame; running it on every card melted the FPS. */
.glass-btn .glass-filter,
.lgbar .glass-filter {
  filter: url(#glass-distortion);
}

.glass .glass-tint {
  z-index: 2;
  background:
    radial-gradient(120% 80% at 30% 15%, rgba(255, 170, 210, 0.30), rgba(255, 90, 160, 0.10) 60%, transparent 100%),
    linear-gradient(180deg, rgba(255, 120, 180, 0.20), rgba(255, 50, 130, 0.08));
  mix-blend-mode: screen;
}

.glass .glass-specular {
  z-index: 3;
  mix-blend-mode: screen;
  background:
    radial-gradient(60% 50% at 50% 0%, rgba(255,255,255,0.55), rgba(255,255,255,0) 65%);
  transition: background 0.15s ease;
}

.glass .glass-edge {
  z-index: 4;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.55),
    inset 0 -2px 4px rgba(255, 80, 150, 0.30),
    inset 0 -8px 18px -6px rgba(255, 60, 130, 0.35);
}

.glass .glass-content {
  position: relative;
  z-index: 5;
}

/* ============================================================
   LIQUID GLASS BUTTON
   ============================================================ */
.glass-btn {
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 22px 52px;
  border-radius: 999px;
  outline: none;
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), filter 0.3s ease, box-shadow 0.5s ease;
  box-shadow:
    0 30px 60px -20px rgba(255, 92, 168, calc(0.50 * var(--buttonGlow, 1))),
    0 8px 30px -4px rgba(255, 92, 168, calc(0.35 * var(--buttonGlow, 1))),
    0 0 80px rgba(255, 60, 120, calc(0.22 * var(--buttonGlow, 1)));
  animation: btnPulse 3.8s ease-in-out infinite;
}
@keyframes btnPulse {
  0%, 100% { box-shadow:
    0 30px 60px -20px rgba(255, 92, 168, calc(0.50 * var(--buttonGlow, 1))),
    0 8px 30px -4px rgba(255, 92, 168, calc(0.35 * var(--buttonGlow, 1))),
    0 0 80px rgba(255, 60, 120, calc(0.22 * var(--buttonGlow, 1))); }
  50% { box-shadow:
    0 36px 72px -20px rgba(255, 92, 168, calc(0.70 * var(--buttonGlow, 1))),
    0 12px 40px -4px rgba(255, 92, 168, calc(0.55 * var(--buttonGlow, 1))),
    0 0 140px rgba(255, 60, 120, calc(0.42 * var(--buttonGlow, 1))); }
}
.glass-btn:hover { transform: scale(1.05) translateY(-2px); filter: brightness(calc(1.0 + 0.15 * var(--buttonGlow, 1))); }
.glass-btn:active { transform: scale(0.96) translateY(1px); filter: brightness(1.3) saturate(1.2); }

.glass-btn .glass-content {
  font-family: "Inter Tight", sans-serif;
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: #fff;
  text-shadow:
    0 0 calc(18px * var(--buttonGlow, 1)) rgba(255, 160, 200, calc(0.85 * var(--buttonGlow, 1))),
    0 0 calc(38px * var(--buttonGlow, 1)) rgba(255, 100, 170, calc(0.5 * var(--buttonGlow, 1))),
    0 1px 2px rgba(0,0,0,0.4);
  pointer-events: none;
  display: inline-block;
  white-space: nowrap;
}
.glass-btn.size-md { padding: 16px 38px; }
.glass-btn.size-md .glass-content { font-size: 0.92rem; letter-spacing: 0.24em; }
.glass-btn.size-sm { padding: 10px 22px; }
.glass-btn.size-sm .glass-content { font-size: 0.75rem; letter-spacing: 0.22em; }

/* Click ripple */
.glass-btn .ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 200, 230, 0.45);
  box-shadow: 0 0 50px rgba(255, 140, 200, 0.7);
  transform: scale(0);
  animation: ripple-anim 0.8s cubic-bezier(.4,0,.2,1);
  pointer-events: none;
  z-index: 6;
}
@keyframes ripple-anim {
  0%   { transform: scale(0); opacity: 1; }
  100% { transform: scale(4); opacity: 0; }
}

/* ============================================================
   HOME BUTTON (small, top-right, persistent on screens 2-4)
   ============================================================ */
.home-btn {
  position: fixed;
  top: 22px; right: 22px;
  z-index: 150;
  width: 46px; height: 46px;
  border-radius: 50%;
  cursor: pointer;
  background: transparent;
  border: none;
  outline: none;
  opacity: 0;
  pointer-events: none;
  transform: scale(0.85);
  transition: opacity 0.6s ease, transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.home-btn.visible {
  opacity: 1;
  pointer-events: auto;
  transform: scale(1);
}
.home-btn:hover { transform: scale(1.08); }
.home-btn:active { transform: scale(0.92); }
.home-btn .glass-content {
  display: flex; align-items: center; justify-content: center;
  width: 100%; height: 100%;
  color: rgba(255, 220, 235, 0.95);
  font-size: 1.05rem;
  text-shadow: 0 0 12px rgba(255, 120, 180, 0.8);
  pointer-events: none;
}

/* ============================================================
   SCREEN 1: LANDING
   ============================================================ */
#screen-landing { flex-direction: column; }
#landing-canvas { position: absolute; inset: 0; pointer-events: none; }
.landing-content {
  position: relative; z-index: 5;
  display: flex; flex-direction: column;
  align-items: center; gap: 42px;
}

/* ============================================================
   ARI — crystal liquid glass typography
   The letters look like pink translucent glass with bright liquid
   shimmer inside. Built from layers:
     .ari-fill : transparent letters with hot pink liquid gradient,
                 multiple text-shadows for outer + inner glow.
     .ari-spec : same letters drawn on top with a moving sheen.
   ============================================================ */
.ari-crystal {
  position: relative;
  font-family: "Cormorant Garamond", "Playfair Display", Georgia, serif;
  font-style: italic;
  font-weight: 600;
  font-size: clamp(2rem, 16vw, 12rem);
  line-height: 0.9;
  letter-spacing: 0.04em;
  z-index: 200;                /* above sparkles & constellation */
  filter: drop-shadow(0 0 30px rgba(255, 90, 170, 0.65))
          drop-shadow(0 0 60px rgba(255, 60, 150, 0.45));
  pointer-events: auto;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  animation: ariFloat 6s ease-in-out infinite;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), filter 0.25s ease;
  white-space: nowrap;
  max-width: 96vw;
}
.ari-crystal:hover {
  filter: drop-shadow(0 0 40px rgba(255, 90, 170, 0.85))
          drop-shadow(0 0 80px rgba(255, 60, 150, 0.6));
}
.ari-crystal:active {
  transform: scale(0.96);
}
.ari-crystal.swapping .ari-fill,
.ari-crystal.swapping .ari-spec {
  animation: ariSwap 0.55s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes ariSwap {
  0%   { transform: scale(1); filter: blur(0); opacity: 1; }
  35%  { transform: scale(1.08); filter: blur(6px) brightness(1.6); opacity: 0.55; }
  100% { transform: scale(1); filter: blur(0); opacity: 1; }
}
@keyframes ariFloat {
  0%, 100% { transform: translateY(0) scale(1); }
  50%      { transform: translateY(-6px) scale(1.015); }
}
.ari-crystal .ari-fill,
.ari-crystal .ari-spec {
  display: inline-block;
  background-image:
    linear-gradient(180deg,
      rgba(255, 240, 247, 1) 0%,
      rgba(255, 180, 220, 1) 18%,
      rgba(255, 110, 180, 1) 42%,
      rgba(255, 70, 150, 1) 68%,
      rgba(220, 30, 110, 1) 100%);
  -webkit-background-clip: text;
          background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  text-shadow:
    0 0 1px rgba(255, 240, 247, 0.55),
    0 0 18px rgba(255, 130, 195, 0.85),
    0 0 40px rgba(255, 60, 150, 0.5);
}
/* Specular sheen sweeping across — gives the "liquid moving inside" feel */
.ari-crystal .ari-spec {
  position: absolute;
  inset: 0;
  background-image: linear-gradient(
    100deg,
    transparent 0%,
    transparent 35%,
    rgba(255, 255, 255, 0.85) 49%,
    rgba(255, 255, 255, 0.95) 51%,
    transparent 65%,
    transparent 100%
  );
  background-size: 250% 100%;
  -webkit-background-clip: text;
          background-clip: text;
  mix-blend-mode: screen;
  animation: ariSheen 4.5s ease-in-out infinite;
  text-shadow: none;
}
@keyframes ariSheen {
  0%   { background-position: 150% 0; opacity: 0; }
  10%  { opacity: 1; }
  70%  { opacity: 1; }
  100% { background-position: -50% 0; opacity: 0; }
}
.landing-kicker {
  font-family: "JetBrains Mono", "SF Mono", monospace;
  font-size: 0.68rem;
  letter-spacing: 0.62em;
  text-transform: uppercase;
  color: rgba(255, 160, 200, 0.55);
  animation: fadeKicker 4s ease-in-out infinite alternate;
}
@keyframes fadeKicker { from { opacity: 0.3; } to { opacity: 0.8; } }
.landing-hint {
  position: absolute;
  bottom: 38px;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.6rem;
  letter-spacing: 0.5em;
  text-transform: uppercase;
  color: rgba(255, 160, 200, 0.4);
  animation: hintFade 3s ease-in-out infinite alternate;
}
@keyframes hintFade { from { opacity: 0.3; } to { opacity: 0.7; } }

/* ============================================================
   SCREEN 2: HACKING — pro hacker layout
   ============================================================ */
#screen-hack { flex-direction: column; gap: 30px; }
#hack-canvas { position: absolute; inset: 0; pointer-events: none; }

/* CRT vignette + faint scanlines */
.hack-crt {
  position: absolute; inset: 0;
  pointer-events: none;
  z-index: 4;
  background:
    radial-gradient(ellipse at center, transparent 50%, rgba(0,0,0,0.55) 100%),
    repeating-linear-gradient(
      0deg,
      rgba(255, 60, 130, 0.04) 0px,
      rgba(255, 60, 130, 0.04) 1px,
      transparent 1px,
      transparent 3px
    );
  mix-blend-mode: screen;
}

/* Horizontal scan beam — sweeps top→bottom continuously */
.hack-scanline {
  position: absolute; inset: 0;
  pointer-events: none;
  z-index: 5;
  background: linear-gradient(180deg,
    transparent 0%,
    transparent 47%,
    rgba(255, 130, 200, 0.18) 49%,
    rgba(255, 200, 230, 0.45) 50%,
    rgba(255, 130, 200, 0.18) 51%,
    transparent 53%,
    transparent 100%);
  animation: scanSweep 4.5s linear infinite;
  mix-blend-mode: screen;
}
@keyframes scanSweep {
  0%   { transform: translateY(-100%); }
  100% { transform: translateY(100%); }
}

/* Glitch flicker overlay — pulsed by JS */
.hack-glitch {
  position: absolute; inset: 0;
  pointer-events: none;
  z-index: 6;
  background:
    linear-gradient(90deg, rgba(255, 0, 100, 0.6), rgba(0, 200, 255, 0.4));
  mix-blend-mode: screen;
  opacity: 0;
  transition: opacity 0.08s linear;
}
.hack-glitch.flash {
  opacity: 0.85;
  transform: translateX(6px);
  transition: opacity 0.04s linear, transform 0.04s linear;
}

/* ============================================================
   HACK PANELS — bordered glass frames in 4 corners
   ============================================================ */
.hack-panel {
  position: absolute;
  z-index: 10;
  padding: 12px 14px;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(40, 8, 22, 0.62), rgba(15, 4, 10, 0.72));
  border: 1px solid rgba(255, 130, 190, 0.35);
  box-shadow:
    0 0 0 1px rgba(255, 130, 190, 0.08) inset,
    0 0 24px rgba(255, 70, 140, 0.18),
    0 8px 30px rgba(0,0,0,0.5);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  font-family: "JetBrains Mono", monospace;
  color: rgba(255, 180, 210, 0.85);
}
.hack-panel .panel-header {
  display: flex; align-items: center; gap: 8px;
  font-size: 0.62rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: rgba(255, 200, 220, 0.9);
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255, 130, 190, 0.2);
}
.hack-panel .panel-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: #ff5fa8;
  box-shadow: 0 0 10px #ff5fa8;
}
.hack-panel .panel-dot.pulse { animation: dotBlink 0.7s ease-in-out infinite alternate; }
.hack-panel .panel-title { flex: 1; }
.hack-panel .panel-blink {
  color: #ff5fa8;
  text-shadow: 0 0 8px #ff5fa8;
  animation: dotBlink 0.4s ease-in-out infinite alternate;
}
.hack-panel .panel-status {
  font-size: 0.6rem;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255, 60, 140, 0.18);
  border: 1px solid rgba(255, 130, 190, 0.55);
  color: #fff;
  letter-spacing: 0.22em;
  text-shadow: 0 0 8px rgba(255, 80, 160, 0.7);
}

.hack-log-panel    { top: 22px; left: 22px; width: 320px; }
.hack-target-panel { top: 22px; right: 22px; width: 280px; }
.hack-modules-panel{ bottom: 22px; left: 22px; width: 320px; }
.hack-ascii-panel  { bottom: 22px; right: 22px; width: 250px; }

/* Mobile hack layout — panels scale to half-width each */
@media (max-width: 640px) {
  .hack-panel { padding: 8px 10px; border-radius: 10px; }
  .hack-panel .panel-header { font-size: 0.50rem; margin-bottom: 5px; padding-bottom: 5px; }
  .hack-log-panel    { top: 10px; left: 8px;  width: calc(52% - 12px); }
  .hack-target-panel { top: 10px; right: 8px; width: calc(48% - 12px); }
  .hack-modules-panel{ bottom: 10px; left: 8px;  width: calc(52% - 12px); }
  .hack-ascii-panel  { bottom: 10px; right: 8px; width: calc(48% - 12px); }
  .hack-log { font-size: 0.57rem; max-height: 120px; line-height: 1.5; }
  .target-body { gap: 5px; font-size: 0.58rem; }
  .target-row .k { font-size: 0.48rem; }
  .target-row .vitals { width: 80px; }
  .module-row { grid-template-columns: 72px 1fr 28px; font-size: 0.55rem; gap: 5px; }
  .ascii-heart { font-size: 7px; }
  .hack-status { font-size: 0.58rem; letter-spacing: 0.2em; gap: 10px; }
  .hack-substatus { gap: 8px; font-size: 0.50rem; flex-wrap: wrap; justify-content: center; }
  .hack-center { gap: 14px; width: clamp(260px, 86vw, 500px); }
}

/* Log lines — typewriter feel */
.hack-log {
  font-size: 0.7rem;
  line-height: 1.65;
  color: rgba(255, 170, 200, 0.82);
  text-shadow: 0 0 6px rgba(255, 80, 160, 0.35);
  max-height: 220px;
  overflow: hidden;
}
.hack-log .log-line { display: block; animation: logIn 0.3s cubic-bezier(.4,0,.2,1); }
.hack-log .log-line.success { color: #ff96c8; text-shadow: 0 0 10px rgba(255, 100, 170, 0.8); }
@keyframes logIn { from { opacity: 0; transform: translateX(-6px); } to { opacity: 1; transform: translateX(0); } }

/* Target profile rows */
.target-body { display: flex; flex-direction: column; gap: 8px; font-size: 0.7rem; }
.target-row {
  display: flex; justify-content: space-between; align-items: center;
  gap: 10px;
}
.target-row .k {
  color: rgba(255, 150, 190, 0.6);
  font-size: 0.6rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}
.target-row .v {
  color: rgba(255, 230, 240, 0.95);
  letter-spacing: 0.05em;
}
.target-row .v.warn { color: #ffb84d; text-shadow: 0 0 8px rgba(255, 170, 80, 0.6); }
.target-row .v.fail { color: #ff5577; text-shadow: 0 0 8px rgba(255, 90, 130, 0.7); }
.target-row .v.hot  { color: #ff6fbe; text-shadow: 0 0 10px rgba(255, 110, 190, 0.8); font-weight: 500; }
.target-row .vitals {
  width: 130px; height: 22px; display: flex; align-items: center;
}
.ecg {
  width: 100%; height: 100%;
}
.ecg path {
  fill: none;
  stroke: #ff6fbe;
  stroke-width: 1.4;
  filter: drop-shadow(0 0 4px rgba(255, 110, 190, 0.95));
  stroke-dasharray: 240;
  stroke-dashoffset: 240;
  animation: ecgRun 1.4s linear infinite;
}
@keyframes ecgRun {
  0%   { stroke-dashoffset: 240; }
  100% { stroke-dashoffset: -240; }
}

/* Glitch text effect */
.glitch-text {
  position: relative;
  display: inline-block;
}
.glitch-text::before,
.glitch-text::after {
  content: attr(data-text);
  position: absolute; top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
}
.glitch-text::before {
  color: rgba(255, 80, 160, 0.85);
  transform: translate(-1.5px, 0);
  mix-blend-mode: screen;
  opacity: 0;
  animation: glitchA 4s steps(1, end) infinite;
}
.glitch-text::after {
  color: rgba(80, 200, 255, 0.85);
  transform: translate(1.5px, 0);
  mix-blend-mode: screen;
  opacity: 0;
  animation: glitchB 4s steps(1, end) infinite;
}
@keyframes glitchA {
  0%, 92%, 100% { opacity: 0; transform: translate(-1.5px, 0); }
  93%           { opacity: 1; transform: translate(-3px, 1px); }
  95%           { opacity: 1; transform: translate(2px, -1px); }
  97%           { opacity: 0; }
}
@keyframes glitchB {
  0%, 92%, 100% { opacity: 0; transform: translate(1.5px, 0); }
  93%           { opacity: 1; transform: translate(3px, -1px); }
  95%           { opacity: 1; transform: translate(-2px, 1px); }
  97%           { opacity: 0; }
}

/* Module mini progress bars */
.module-list { display: flex; flex-direction: column; gap: 8px; }
.module-row {
  display: grid;
  grid-template-columns: 110px 1fr 38px;
  gap: 8px;
  align-items: center;
  font-size: 0.66rem;
}
.module-row .m-name {
  color: rgba(255, 170, 200, 0.78);
  letter-spacing: 0.05em;
}
.module-row .m-bar {
  display: block;
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 90, 160, 0.12);
  border: 1px solid rgba(255, 130, 190, 0.22);
  overflow: hidden;
}
.module-row .m-bar span {
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, rgba(255, 130, 200, 0.9), rgba(255, 60, 140, 1));
  box-shadow: 0 0 10px rgba(255, 100, 170, 0.7);
  border-radius: 999px;
  transition: width 0.3s ease;
}
.module-row .m-pct {
  font-size: 0.62rem;
  color: rgba(255, 200, 220, 0.85);
  text-align: right;
}
.module-row.done .m-pct { color: #ff96c8; text-shadow: 0 0 8px rgba(255, 100, 170, 0.8); }

/* ASCII heart — slowly fills as hack progresses */
.ascii-heart {
  font-family: "JetBrains Mono", monospace;
  font-size: 9px;
  line-height: 1.1;
  color: #ff6fbe;
  text-shadow: 0 0 10px rgba(255, 100, 170, 0.85);
  letter-spacing: 0;
  white-space: pre;
  margin: 0;
  text-align: center;
}

.hack-center {
  position: relative; z-index: 8;
  display: flex; flex-direction: column; align-items: center;
  gap: 22px;
  width: clamp(300px, 72vw, 600px);
}
.hack-status {
  display: flex; align-items: center; gap: 16px;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.7rem;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: #ffb7d5;
  text-shadow: 0 0 12px rgba(255, 100, 170, 0.6);
}
.hack-status .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #ff5fa8;
  box-shadow: 0 0 12px #ff5fa8;
  animation: dotBlink 0.6s ease-in-out infinite alternate;
}
@keyframes dotBlink { from { opacity: 0.3; } to { opacity: 1; } }

.hack-label {
  font-family: "JetBrains Mono", monospace;
  font-size: clamp(0.9rem, 2vw, 1.2rem);
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: rgba(255,180,210,0.95);
  font-weight: 500;
  text-shadow: 0 0 20px rgba(255,80,150,0.8);
  animation: hackPulse 0.5s ease-in-out infinite alternate;
}
@keyframes hackPulse {
  from { opacity: 0.78; text-shadow: 0 0 10px rgba(255,80,150,0.6); }
  to   { opacity: 1; text-shadow: 0 0 30px rgba(255,80,150,1), 0 0 60px rgba(255,80,150,0.4); }
}

/* Liquid glass progress bar */
.lgbar.glass {
  width: 100%;
  height: 30px;
  border-radius: 999px;
  box-shadow:
    0 0 40px rgba(255, 90, 160, 0.35),
    0 6px 24px -6px rgba(255, 90, 160, 0.4);
}
.lgbar-fill {
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(180deg,
    rgba(255,210,235,0.98),
    rgba(255,100,170,0.92) 55%,
    rgba(210,30,110,0.95));
  z-index: 6;
  transition: width 0.18s cubic-bezier(.4,0,.2,1);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.7),
    inset 0 -2px 6px rgba(180, 20, 90, 0.55),
    0 0 28px rgba(255, 110, 180, 0.75);
  overflow: hidden;
}
.lgbar-fill::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(100deg, transparent 30%, rgba(255,255,255,0.55) 50%, transparent 70%);
  animation: lgShine 1.5s linear infinite;
}
@keyframes lgShine { 0% { transform: translateX(-100%); } 100% { transform: translateX(100%); } }

.hack-pct {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: rgba(255,240,245,0.98);
  text-shadow: 0 1px 3px rgba(120,0,60,0.7);
  z-index: 7;
  pointer-events: none;
}

.hack-substatus {
  display: flex; gap: 22px;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.62rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(255, 160, 200, 0.6);
  margin-top: 4px;
}
.hack-substatus span:nth-child(2) { color: rgba(255, 200, 220, 0.9); text-shadow: 0 0 8px rgba(255,100,170,0.5); }

/* Remove old absolute log positioning (now inside panel) */

/* Edge heartbeat glow */
#edge-glow {
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 1;
  box-shadow: inset 0 0 0 rgba(255, 60, 120, 0);
  transition: box-shadow 0.06s ease;
}

/* ============================================================
   SCREEN 3: HEART (3D rotating phrase heart)
   ============================================================ */
#screen-heart {
  flex-direction: column;
  /* ease-in for both: accelerates into the zoom like a camera flying forward */
  transition: opacity 0.9s cubic-bezier(0.4, 0, 1, 1), transform 0.95s cubic-bezier(0.4, 0, 1, 1);
}
#screen-heart.zoom-into-heart {
  /* large scale so the heart phrases visually fill the screen */
  transform: scale(9);
  opacity: 0;
  pointer-events: none;
}
#heart-canvas {
  position: absolute; inset: 0;
}
#heart-glow {
  position: absolute;
  left: 50%; top: 50%;
  width: 80vmin; height: 70vmin;
  transform: translate(-50%, -44%);
  background: radial-gradient(closest-side,
    rgba(255, 80, 150, calc(0.22 * var(--heartGlow, 1))),
    rgba(255, 60, 150, calc(0.08 * var(--heartGlow, 1))) 50%,
    transparent 75%);
  opacity: 0;
  transition: opacity 1.6s ease;
  pointer-events: none;
  z-index: 0;
  filter: blur(calc(8px * var(--heartGlow, 1)));
}

/* ============================================================
   3D Crystal "A" at the center of the heart — VOLUMETRIC
   Built as a stack of letter copies at progressively deeper translateZ
   values to create true 3D extrusion. Layers:
     .A-depth-* — back faces, darker pink, providing the "side" volume.
     .A-front   — the bright crystal front face.
     .A-liquid  — pink fluid filling roughly the lower half (sloshes).
     .A-spec    — bright moving sheen on top.
   Built programmatically in JS so we can dial in any depth.
   ============================================================ */
.heart-A {
  position: absolute;
  left: 50%; top: 54%;
  z-index: 12;
  pointer-events: none;
  user-select: none;
  /* NOTE: do NOT apply `filter` here — it creates a stacking context that
     flattens the 3D preserve-3d below. Glow is applied via text-shadow on
     each layer instead. */
  opacity: 0;
  transition: opacity 1.4s ease;
}
.heart-A.visible { opacity: 1; }

.heart-A .A-stack {
  position: relative;
  display: grid;
  grid-template-areas: "a";
  transform-style: preserve-3d;
  font-family: "Cormorant Garamond", "Playfair Display", Georgia, serif;
  font-style: italic;
  font-weight: 700;
  font-size: clamp(7rem, 22vmin, 22rem);
  line-height: 1;
  letter-spacing: 0;
  text-align: center;
}
.heart-A .A-layer {
  grid-area: a;
  display: block;
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  will-change: transform;
}

/* Crystal front face — TRANSPARENT with a strong pink rim/edge.
   This lets the empty (upper) portion of the letter actually look empty,
   while the bottom half is filled by the bright .A-liquid layer. */
.heart-A .A-front {
  background-image: linear-gradient(180deg,
    rgba(255, 240, 247, 0.20) 0%,
    rgba(255, 200, 230, 0.16) 40%,
    rgba(255, 150, 210, 0.13) 60%,
    rgba(255, 110, 185, 0.10) 100%);
  /* tight text-shadows form the crystal RIM (bright white→pink outline),
     wide text-shadows form the outer pink glow */
  text-shadow:
    0 0  1px rgba(255, 255, 255, 0.95),
    0 0  2px rgba(255, 240, 250, 0.85),
    0 0  4px rgba(255, 210, 235, 0.75),
    0 0 30px rgba(255, 130, 195, 0.85),
    0 0 60px rgba(255, 60, 150, 0.45);
}

/* Pink LIQUID — clearly visible, half-full at rest, with a bright meniscus
   line at the top of the fluid. The gradient has a sharp transition at
   ~50% so the empty/full boundary reads as a real surface. */
.heart-A .A-liquid {
  background-image: linear-gradient(
    180deg,
    transparent 0%,
    transparent 48%,
    rgba(255, 250, 252, 0.95) 49.5%,     /* meniscus highlight */
    rgba(255, 200, 225, 0.92) 51%,
    rgba(255, 130, 195, 0.95) 62%,
    rgba(255, 70, 155, 0.98) 82%,
    rgba(220, 30, 110, 1) 100%
  );
  background-size: 100% 240%;
  background-position: 0% 50%;
  filter: blur(0.6px);
}

/* Moving sheen */
.heart-A .A-spec {
  background-image: linear-gradient(
    100deg,
    transparent 0%,
    transparent 38%,
    rgba(255, 255, 255, 0.92) 50%,
    transparent 62%,
    transparent 100%
  );
  background-size: 280% 100%;
  animation: heartASheen 5.5s ease-in-out infinite;
}
@keyframes heartASheen {
  0%   { background-position: 160% 0; opacity: 0; }
  10%  { opacity: 1; }
  70%  { opacity: 1; }
  100% { background-position: -60% 0; opacity: 0; }
}
#heart-glow.visible { opacity: 1; animation: heartGlowBeat 1.15s ease-in-out infinite; }
@keyframes heartGlowBeat {
  0%, 55%, 100% { transform: translate(-50%, -44%) scale(1); opacity: 0.95; }
  20%           { transform: translate(-50%, -44%) scale(1.10); opacity: 1.0; }
  35%           { transform: translate(-50%, -44%) scale(0.97); opacity: 0.88; }
  45%           { transform: translate(-50%, -44%) scale(1.06); opacity: 1.0; }
}
#heart-enter-wrap {
  position: absolute;
  /* Centred horizontally; vertically at 54% (matches heart cy on desktop) */
  top: 54%;
  left: 50%;
  transform: translate(-50%, -50%) translateY(28px) scale(0.96);
  z-index: 20;
  opacity: 0;
  transition: opacity 1.2s ease, transform 1.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  filter: drop-shadow(0 0 40px rgba(0,0,0,0.75));
}
#heart-enter-wrap.visible {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}
#heart-enter-wrap.hiding {
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.82);
  pointer-events: none;
  transition: opacity 0.28s ease-in, transform 0.28s cubic-bezier(0.4, 0, 1, 1);
}
/* On mobile the heart is centred at 50% — match all elements */
@media (max-width: 640px) {
  #heart-enter-wrap { top: 50%; }
  .heart-A { top: 50%; }
  #heart-glow { transform: translate(-50%, -50%); }
}
/* The button itself sits on a stronger glass plate so it pops out of the
   phrase cloud. */
#heart-enter-wrap .glass-btn {
  position: relative;
}
#heart-enter-wrap .glass-btn::before {
  /* dark backplate that fades out at the edges */
  content: "";
  position: absolute;
  inset: -30px -50px;
  border-radius: 999px;
  background: radial-gradient(closest-side, rgba(0,0,0,0.55), rgba(0,0,0,0.25) 60%, transparent 100%);
  z-index: -1;
  pointer-events: none;
}

/* ============================================================
   SCREEN 4: NEURAL NETWORK — true graph topology with core hub,
   clustered memory nodes, curved synapses and animated signal flow.
   Cards float ABOVE all background layers via z-index 50.
   ============================================================ */
#screen-neural {
  cursor: grab;
  background:
    radial-gradient(ellipse at 50% 50%, rgba(50, 8, 28, 0.45), rgba(0, 0, 0, 0.92) 80%);
}
#screen-neural.dragging { cursor: grabbing; }
#neural-canvas {
  position: absolute; inset: 0;
  z-index: 4;
  opacity: 0;  /* hidden until galaxy exits — avoids ghosting during 10s rain */
}
#neural-canvas.neural-ready {
  animation: neuralDrop 1.5s cubic-bezier(0.34, 1.08, 0.64, 1) forwards;
}
@keyframes neuralDrop {
  /* Soft cinematic focus-in: starts blazing-bright and blurred, resolves to sharp */
  0%   { opacity: 0;    filter: blur(22px) brightness(3.5) saturate(0.3); transform: scale(1.06); }
  18%  { opacity: 0.85; filter: blur(10px) brightness(2.2) saturate(0.7); transform: scale(1.03); }
  55%  { opacity: 1;    filter: blur(3px)  brightness(1.4) saturate(1.1); transform: scale(1.005); }
  80%  { opacity: 1;    filter: blur(0px)  brightness(1.05) saturate(1.0); transform: scale(1); }
  100% { opacity: 1;    filter: blur(0px)  brightness(1)   saturate(1);   transform: scale(1); }
}

/* Inline SVG icon helper */
.icon { display: inline-block; vertical-align: middle; line-height: 0; }
.icon svg { display: block; width: 100%; height: 100%; }

.node-card {
  position: absolute;
  left: 0; top: 0;        /* transform drives actual position */
  width: 240px;
  padding: 16px;
  border-radius: 22px;
  cursor: pointer;
  pointer-events: all;
  z-index: 50;
  will-change: transform; /* promote to GPU layer */
  transition:
    box-shadow 0.4s ease,
    border-color 0.3s ease;

  background:
    linear-gradient(180deg, rgba(30, 8, 22, 0.88), rgba(14, 4, 12, 0.94));
  border: 1px solid rgba(255, 160, 200, 0.32);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.04) inset,
    0 0 24px rgba(255, 80, 150, 0.22),
    0 18px 40px -8px rgba(255, 60, 140, 0.28),
    0 30px 80px -20px rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px) saturate(140%);
  -webkit-backdrop-filter: blur(8px) saturate(140%);
}
.node-card::before {
  /* subtle pink halo behind the card so it reads as "active" against bg */
  content: "";
  position: absolute;
  inset: -16px;
  border-radius: 28px;
  background: radial-gradient(closest-side, rgba(255, 90, 170, 0.18), transparent 70%);
  z-index: -1;
  pointer-events: none;
  opacity: 0.5;
}
.node-card:hover {
  transform: scale(1.05) translateY(-2px);
  border-color: rgba(255, 200, 220, 0.65);
  box-shadow:
    0 0 0 1px rgba(255, 210, 230, 0.5) inset,
    0 0 60px rgba(255, 90, 170, 0.55),
    0 24px 60px -8px rgba(255, 90, 170, 0.5);
  z-index: 60;
}
.node-card:hover::before { opacity: 1; }

.node-card .photo-slot {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  border-radius: 14px;
  overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 12px;
  background:
    linear-gradient(135deg, rgba(255, 90, 160, 0.18), rgba(80, 12, 50, 0.5)),
    radial-gradient(120% 80% at 30% 0%, rgba(255, 180, 220, 0.12), transparent 60%);
}
.node-card .photo-slot::before {
  /* diagonal weave for the empty plate */
  content: "";
  position: absolute; inset: 0;
  background: repeating-linear-gradient(45deg, rgba(255,255,255,0.04) 0 8px, transparent 8px 16px);
  opacity: 0.55;
}
.node-card .photo-slot img {
  width: 100%; height: 100%;
  object-fit: cover;
  position: relative; z-index: 1;
}
.node-card .photo-slot .placeholder {
  position: relative; z-index: 1;
  width: 40px; height: 40px;
  color: rgba(255, 190, 215, 0.7);
}
.node-card .photo-corner {
  position: absolute; top: 8px; right: 8px;
  z-index: 2;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.55rem;
  letter-spacing: 0.22em;
  padding: 4px 8px;
  border-radius: 999px;
  color: rgba(255, 220, 235, 0.85);
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(255, 160, 200, 0.4);
  text-transform: uppercase;
}
.node-card .memory-type {
  display: flex; align-items: center; gap: 6px;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.55rem;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: rgba(255, 140, 190, 0.78);
  margin-bottom: 6px;
}
.node-card .memory-type .icon { width: 11px; height: 11px; opacity: 0.85; }
.node-card .memory-text {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-style: italic;
  font-weight: 500;
  font-size: 1.02rem;
  line-height: 1.3;
  color: rgba(255, 235, 245, 0.98);
  text-align: left;
  text-shadow: 0 0 8px rgba(255, 100, 170, 0.35);
}
.node-card .memory-date {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.58rem;
  letter-spacing: 0.24em;
  color: rgba(255, 150, 180, 0.6);
  text-align: left;
  margin-top: 8px;
  text-transform: uppercase;
}

/* CORE HUB — a central permanent node that all memories connect to.
   It's a stylized glowing ring, not a card. */
.neural-core {
  position: absolute;
  width: 200px;
  height: 200px;
  z-index: 45;
  pointer-events: none;
  transform: translate(-50%, -50%);
  display: flex; align-items: center; justify-content: center;
}
.neural-core .core-disc {
  position: absolute; inset: 30%;
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 30%, rgba(255, 230, 245, 0.95), rgba(255, 130, 195, 0.85) 35%, rgba(220, 30, 110, 0.6) 100%);
  box-shadow:
    0 0 30px rgba(255, 100, 170, 0.85),
    0 0 80px rgba(255, 60, 150, 0.55),
    inset 0 -8px 16px rgba(150, 10, 70, 0.5),
    inset 0 4px 10px rgba(255, 240, 248, 0.5);
}
.neural-core .core-ring {
  position: absolute; inset: 0;
  border-radius: 50%;
  border: 1px solid rgba(255, 160, 200, 0.4);
  animation: coreRing 6s linear infinite;
}
.neural-core .core-ring.r2 { inset: 12%; animation-duration: 9s; animation-direction: reverse; }
.neural-core .core-ring.r3 { inset: 22%; animation-duration: 12s; }
@keyframes coreRing {
  from { transform: rotate(0deg);   box-shadow: 0 0 0px rgba(255, 100, 170, 0); }
  50%  { box-shadow: 0 0 26px rgba(255, 100, 170, 0.35); }
  to   { transform: rotate(360deg); box-shadow: 0 0 0px rgba(255, 100, 170, 0); }
}
.neural-core .core-label {
  position: absolute; bottom: -36px;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.62rem;
  letter-spacing: 0.42em;
  color: rgba(255, 200, 220, 0.85);
  text-shadow: 0 0 10px rgba(255, 100, 170, 0.7);
  white-space: nowrap;
}

/* HUD */
.neural-hud {
  position: fixed;
  top: 22px; left: 22px;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.65rem;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: rgba(255, 170, 210, 0.7);
  z-index: 100;
  pointer-events: none;
  text-shadow: 0 0 8px rgba(255, 80, 160, 0.4);
}
.neural-hud .hud-line { display: flex; gap: 10px; align-items: center; margin-bottom: 4px; }
.neural-hud .hud-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: #ff5fa8;
  box-shadow: 0 0 10px #ff5fa8;
  animation: dotBlink 1.4s ease-in-out infinite alternate;
}

.neural-hint {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.65rem;
  letter-spacing: 0.4em;
  text-transform: uppercase;
  color: rgba(255, 170, 210, 0.55);
  pointer-events: none;
  animation: fadeHint 5s ease-in-out infinite;
}
@keyframes fadeHint {
  0%, 100% { opacity: 0.15; }
  40%, 70% { opacity: 0.85; }
}

/* ============================================================
   FAB — heart button + radial menu
   ============================================================ */
.fab-wrap {
  position: fixed;
  bottom: 32px; right: 28px;
  z-index: 110;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0;
  /* Hidden by default — JS adds .fab-visible when on neural screen */
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}
.fab-wrap.fab-visible {
  opacity: 1;
  pointer-events: all;
}

/* Main heart button */
.fab-heart-btn {
  position: relative;
  width: 62px; height: 62px;
  border-radius: 50%;
  border: none;
  background:
    radial-gradient(circle at 38% 32%, rgba(255, 220, 240, 0.28), rgba(255, 80, 150, 0.14) 55%, transparent 75%),
    linear-gradient(145deg, rgba(255, 130, 185, 0.22), rgba(200, 30, 100, 0.18));
  box-shadow:
    0 0 0 1.5px rgba(255, 190, 220, 0.5),
    0 0 0 1px rgba(255,255,255,0.15) inset,
    0 8px 32px rgba(255, 80, 150, 0.45),
    0 0 70px rgba(255, 60, 130, 0.25);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  cursor: pointer;
  outline: none;
  display: flex; align-items: center; justify-content: center;
  transition:
    transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1),
    box-shadow 0.3s ease;
  -webkit-tap-highlight-color: transparent;
  animation: fabPulse 3.2s ease-in-out infinite;
}
@keyframes fabPulse {
  0%,100% { box-shadow: 0 0 0 1.5px rgba(255,190,220,0.5), 0 8px 32px rgba(255,80,150,0.45), 0 0 70px rgba(255,60,130,0.25); }
  50%      { box-shadow: 0 0 0 1.5px rgba(255,210,230,0.8), 0 8px 48px rgba(255,80,150,0.65), 0 0 110px rgba(255,60,130,0.45); }
}
.fab-heart-btn:hover {
  transform: scale(1.1);
  animation-play-state: paused;
  box-shadow:
    0 0 0 2px rgba(255, 210, 230, 0.8),
    0 12px 48px rgba(255, 80, 150, 0.65),
    0 0 110px rgba(255, 60, 130, 0.45);
}
.fab-heart-btn:active { transform: scale(0.93); }
.fab-heart-btn.open {
  transform: scale(1.12) rotate(45deg);
  animation-play-state: paused;
}

.fab-heart-icon {
  position: absolute;
  width: 28px; height: 28px;
  color: rgba(255, 235, 245, 0.95);
  filter: drop-shadow(0 0 8px rgba(255, 130, 185, 0.9));
  transition: opacity 0.25s ease, transform 0.35s ease;
}
.fab-heart-btn.open .fab-heart-icon { opacity: 0; transform: scale(0.5); }

.fab-heart-plus {
  position: absolute;
  font-size: 1.5rem;
  font-weight: 200;
  color: rgba(255, 240, 250, 0.95);
  line-height: 1;
  text-shadow: 0 0 12px rgba(255, 150, 200, 0.9);
  opacity: 0;
  transform: scale(0.5) rotate(-45deg);
  transition: opacity 0.25s ease, transform 0.35s ease;
}
.fab-heart-btn.open .fab-heart-plus {
  opacity: 1;
  transform: scale(1) rotate(0deg);
}

/* Expanded pill menu */
.fab-menu {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 9px;
  margin-bottom: 14px;
  pointer-events: none;
}
.fab-menu.open { pointer-events: all; }

/* Polished glass pill buttons */
.fab-pill {
  position: relative;   /* needed for story-dot absolute child */
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 11px 20px 11px 15px;
  border-radius: 999px;
  border: 1px solid rgba(255, 180, 215, 0.38);
  background:
    linear-gradient(145deg, rgba(40, 8, 28, 0.88), rgba(18, 2, 12, 0.92));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.10),
    inset 0 -1px 0 rgba(0, 0, 0, 0.25),
    0 4px 28px rgba(255, 60, 130, 0.28),
    0 1px 6px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(24px) saturate(160%);
  -webkit-backdrop-filter: blur(24px) saturate(160%);
  cursor: pointer;
  outline: none;
  -webkit-tap-highlight-color: transparent;
  color: rgba(255, 225, 242, 0.95);
  font-family: "Inter Tight", sans-serif;
  font-size: 0.80rem;
  font-weight: 500;
  letter-spacing: 0.03em;
  white-space: nowrap;
  opacity: 0;
  transform: translateX(20px) scale(0.90);
  transition:
    opacity 0.30s cubic-bezier(0.34, 1.56, 0.64, 1),
    transform 0.30s cubic-bezier(0.34, 1.56, 0.64, 1),
    box-shadow 0.2s ease,
    border-color 0.2s ease;
}
.fab-pill svg {
  width: 15px; height: 15px;
  flex-shrink: 0;
  opacity: 0.88;
  filter: drop-shadow(0 0 5px rgba(255, 130, 185, 0.65));
}
.fab-menu.open .fab-pill {
  opacity: 1;
  transform: translateX(0) scale(1);
}
/* Stagger from bottom (closest to FAB) upward — 8 pills total */
.fab-menu.open .fab-pill:nth-child(8) { transition-delay: 0.00s; }
.fab-menu.open .fab-pill:nth-child(7) { transition-delay: 0.03s; }
.fab-menu.open .fab-pill:nth-child(6) { transition-delay: 0.06s; }
.fab-menu.open .fab-pill:nth-child(5) { transition-delay: 0.09s; }
.fab-menu.open .fab-pill:nth-child(4) { transition-delay: 0.12s; }
.fab-menu.open .fab-pill:nth-child(3) { transition-delay: 0.15s; }
.fab-menu.open .fab-pill:nth-child(2) { transition-delay: 0.18s; }
.fab-menu.open .fab-pill:nth-child(1) { transition-delay: 0.21s; }
.fab-pill:hover {
  border-color: rgba(255, 210, 235, 0.60);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.14),
    inset 0 -1px 0 rgba(0, 0, 0, 0.20),
    0 6px 36px rgba(255, 60, 130, 0.46),
    0 0 64px rgba(255, 60, 130, 0.22),
    0 1px 6px rgba(0, 0, 0, 0.4);
}
.fab-pill:active { transform: scale(0.95); transition-duration: 0.08s; }

/* ============================================================
   CUSTOM CONFIRM DIALOG
   ============================================================ */
.custom-confirm-overlay {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  z-index: 300;
  display: flex; align-items: center; justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}
.custom-confirm-overlay.open {
  opacity: 1;
  pointer-events: all;
}
.custom-confirm-box {
  width: clamp(280px, 88vw, 380px);
  padding: 36px 28px 28px;
  border-radius: 28px;
  background: linear-gradient(180deg, rgba(55, 10, 35, 0.85), rgba(18, 3, 12, 0.92));
  border: 1.5px solid rgba(255, 150, 200, 0.38);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.04) inset,
    0 0 80px rgba(255, 80, 150, 0.3),
    0 40px 80px rgba(0, 0, 0, 0.65);
  display: flex; flex-direction: column; align-items: center;
  gap: 14px;
  transform: scale(0.9) translateY(12px);
  transition: transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.custom-confirm-overlay.open .custom-confirm-box {
  transform: scale(1) translateY(0);
}
.confirm-heart-icon {
  width: 44px; height: 44px;
  color: rgba(255, 120, 180, 0.85);
  filter: drop-shadow(0 0 14px rgba(255, 90, 160, 0.8));
  animation: confirmHeartBeat 1s ease-in-out infinite;
}
@keyframes confirmHeartBeat {
  0%,100% { transform: scale(1); }
  15%     { transform: scale(1.18); }
  30%     { transform: scale(0.95); }
  45%     { transform: scale(1.1); }
}
.confirm-heart-icon svg { width: 100%; height: 100%; }
.confirm-title {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-style: italic;
  font-size: 1.55rem;
  color: rgba(255, 235, 245, 0.98);
  text-align: center;
  text-shadow: 0 0 22px rgba(255, 90, 170, 0.5);
}
.confirm-body {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.65rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(255, 160, 195, 0.65);
  text-align: center;
  line-height: 1.6;
}
.confirm-actions {
  display: flex; gap: 10px;
  margin-top: 8px;
  width: 100%;
}

/* ============================================================
   MODAL (Add / View / Edit memory)
   ============================================================ */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.72);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  z-index: 200;
  display: flex; align-items: center; justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s cubic-bezier(.4,0,.2,1);
}
.modal-overlay.open { opacity: 1; pointer-events: all; }

.modal-box {
  width: clamp(320px, 92vw, 480px);
  max-height: 88vh;
  overflow-y: auto;
  scrollbar-width: none;
  padding: 30px;
  border-radius: 28px;
  background:
    linear-gradient(180deg, rgba(60, 10, 40, 0.78), rgba(20, 4, 14, 0.88));
  border: 1.5px solid rgba(255, 160, 200, 0.4);
  box-shadow:
    0 0 80px rgba(255, 80, 150, 0.35),
    0 30px 80px rgba(0,0,0,0.6);
  display: flex; flex-direction: column;
  gap: 16px;
  position: relative;
  transform: scale(0.94);
  transition: transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.modal-overlay.open .modal-box { transform: scale(1); }
.modal-box::-webkit-scrollbar { display: none; }

.modal-box h3 {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-style: italic;
  color: rgba(255, 240, 245, 0.98);
  font-size: 1.7rem;
  text-align: center;
  margin-bottom: 4px;
  text-shadow: 0 0 22px rgba(255, 90, 170, 0.55);
}
.modal-photo-view {
  width: 100%;
  border-radius: 16px;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(255, 90, 160, 0.18), rgba(120, 20, 70, 0.35)),
    repeating-linear-gradient(45deg, rgba(255,255,255,0.04) 0 8px, transparent 8px 16px);
  min-height: 200px;
  display: flex; align-items: center; justify-content: center;
  color: rgba(255, 200, 230, 0.55);
  font-family: "JetBrains Mono", monospace;
  font-size: 0.7rem;
  letter-spacing: 0.3em;
}
.modal-photo-view img { width: 100%; display: block; }
.modal-text-view {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-style: italic;
  font-size: 1.2rem;
  line-height: 1.5;
  color: rgba(255, 230, 240, 0.95);
  text-align: center;
}
.modal-date-view {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.62rem;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  color: rgba(255, 150, 180, 0.65);
  text-align: center;
  margin-top: -8px;
}
.modal-box .field-label {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.6rem;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: rgba(255, 160, 200, 0.65);
  margin-bottom: -10px;
}
.modal-box input[type="text"],
.modal-box textarea {
  background: rgba(255, 80, 150, 0.07);
  border: 1px solid rgba(255, 160, 200, 0.3);
  border-radius: 14px;
  padding: 13px 16px;
  color: rgba(255, 230, 240, 0.95);
  font-size: 0.95rem;
  outline: none;
  resize: none;
  font-family: inherit;
  transition: border-color 0.25s, box-shadow 0.25s;
}
.modal-box input::placeholder, .modal-box textarea::placeholder { color: rgba(255, 180, 210, 0.35); }
.modal-box input:focus, .modal-box textarea:focus {
  border-color: rgba(255, 200, 220, 0.7);
  box-shadow: 0 0 22px rgba(255, 80, 150, 0.3);
}
.file-picker {
  position: relative;
  width: 100%;
  border-radius: 14px;
  border: 1.5px dashed rgba(255, 160, 200, 0.4);
  background: rgba(255, 80, 150, 0.05);
  padding: 22px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.25s, background 0.25s;
}
.file-picker:hover { border-color: rgba(255, 200, 220, 0.7); background: rgba(255, 80, 150, 0.1); }
.file-picker input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.file-picker .fp-label {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.7rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: rgba(255, 180, 210, 0.7);
}
.file-picker.has-file {
  border-style: solid;
  border-color: rgba(255, 200, 220, 0.55);
  padding: 0;
  background: transparent;
}
.file-picker img.preview,
.file-picker video.preview { width: 100%; display: block; border-radius: 13px; }

/* ─── Tag system ─── */
.tag-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: center;
  min-height: 32px;
  margin-top: 2px;
}
.tag-pill {
  padding: 4px 13px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.06);
  color: rgba(255, 220, 240, 0.7);
  font-family: "JetBrains Mono", monospace;
  font-size: 0.58rem;
  letter-spacing: 0.15em;
  cursor: pointer;
  transition: all 0.18s;
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  -webkit-tap-highlight-color: transparent;
}
.tag-pill:hover { background: rgba(255,255,255,0.12); }
.tag-pill.selected {
  border-color: var(--tc, #ff6fae);
  background: color-mix(in srgb, var(--tc, #ff6fae) 22%, transparent);
  color: color-mix(in srgb, var(--tc, #ff6fae) 100%, #fff);
  box-shadow: 0 0 10px color-mix(in srgb, var(--tc, #ff6fae) 35%, transparent);
}
.tag-del {
  opacity: 0.45;
  cursor: pointer;
  font-size: 0.85rem;
  line-height: 1;
  padding: 0 1px;
}
.tag-del:hover { opacity: 1; }
.tag-add-btn {
  padding: 4px 11px;
  border-radius: 999px;
  border: 1px dashed rgba(255, 160, 200, 0.35);
  background: transparent;
  color: rgba(255, 160, 200, 0.6);
  font-size: 1.05rem;
  line-height: 1;
  cursor: pointer;
  transition: border-color 0.18s, color 0.18s;
}
.tag-add-btn:hover { border-color: rgba(255,160,200,0.7); color: rgba(255,160,200,0.9); }
.tag-new-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.tag-new-input {
  background: rgba(255, 80, 150, 0.07);
  border: 1px solid rgba(255, 160, 200, 0.3);
  border-radius: 10px;
  color: rgba(255, 235, 245, 0.95);
  padding: 4px 10px;
  font-size: 0.65rem;
  font-family: "JetBrains Mono", monospace;
  width: 110px;
  outline: none;
  letter-spacing: 0.1em;
}
.tag-new-ok {
  background: rgba(255, 80, 150, 0.22);
  border: 1px solid rgba(255, 150, 200, 0.4);
  border-radius: 50%;
  color: rgba(255, 235, 245, 0.9);
  width: 26px;
  height: 26px;
  font-size: 0.8rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}
.card-tag-chip {
  padding: 2px 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--tc, #ff6fae) 20%, rgba(0,0,0,0.2));
  border: 1px solid color-mix(in srgb, var(--tc, #ff6fae) 45%, transparent);
  color: color-mix(in srgb, var(--tc, #ff6fae) 95%, #fff);
  font-family: "JetBrains Mono", monospace;
  font-size: 0.46rem;
  letter-spacing: 0.12em;
  white-space: nowrap;
}
.modal-tags-view {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.modal-media-view {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.65rem;
  letter-spacing: 0.2em;
  color: rgba(255, 180, 210, 0.45);
  text-align: center;
  padding: 10px 0;
}
.modal-media-view img { width: 100%; border-radius: 12px; display: block; }
.modal-media-view video { width: 100%; border-radius: 12px; display: block; }

/* video on node card */
.photo-slot video { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; display: block; }

/* ─── Memory Brain — live branch hints while typing ─── */
.brain-hints {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 0;
  transition: opacity 0.25s;
}
.brain-pill {
  font-size: 11px;
  font-family: var(--font-mono, monospace);
  padding: 3px 10px;
  border-radius: 20px;
  border: 1px solid var(--bc, rgba(255,110,170,0.3));
  background: rgba(255,255,255,0.04);
  pointer-events: none;
  letter-spacing: 0.3px;
  white-space: nowrap;
  opacity: 0.85;
  transition: opacity 0.2s;
}

/* ─── Pensé en ti overlay ─── */
.thought-overlay {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(10,0,8,0.72);
  backdrop-filter: blur(10px) saturate(1.4);
  display: flex; align-items: flex-end; justify-content: center;
  opacity: 0; pointer-events: none;
  transition: opacity 0.28s;
}
.thought-overlay.open { opacity: 1; pointer-events: auto; }
.thought-box {
  width: 100%; max-width: 480px;
  background: rgba(22,4,16,0.97);
  border: 1px solid rgba(255,110,170,0.2);
  border-bottom: none;
  border-radius: 22px 22px 0 0;
  padding: 22px 24px 36px;
  display: flex; flex-direction: column; gap: 16px;
  box-shadow: 0 -6px 40px rgba(255,80,160,0.14);
  transform: translateY(24px);
  transition: transform 0.28s cubic-bezier(0.22,1,0.36,1);
}
.thought-overlay.open .thought-box { transform: translateY(0); }
.thought-header {
  display: flex; align-items: center; gap: 10px;
}
.thought-label {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 1.15rem; color: rgba(255,218,240,0.92); flex: 1;
}
.thought-time {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.68rem; color: rgba(255,140,190,0.55); letter-spacing: 0.1em;
}
.thought-close {
  background: none; border: none; cursor: pointer;
  color: rgba(255,130,180,0.45); font-size: 1.3rem; line-height: 1;
  padding: 2px 6px; transition: color 0.2s;
}
.thought-close:hover { color: rgba(255,130,180,0.85); }
.thought-emoji-row { display: flex; gap: 8px; flex-wrap: wrap; }
.t-emoji {
  width: 40px; height: 40px; border-radius: 50%;
  border: 1.5px solid rgba(255,110,170,0.15);
  background: rgba(255,255,255,0.03);
  font-size: 1.25rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: border-color 0.18s, background 0.18s, transform 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.t-emoji:hover, .t-emoji:active { transform: scale(1.14); }
.t-emoji.active {
  border-color: rgba(255,110,170,0.65);
  background: rgba(255,110,170,0.13);
  box-shadow: 0 0 14px rgba(255,80,160,0.28);
}
.thought-note {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,110,170,0.16);
  border-radius: 11px;
  color: rgba(255,228,244,0.92);
  font-family: 'Inter Tight', sans-serif; font-size: 0.9rem;
  padding: 11px 14px; resize: none; outline: none;
  transition: border-color 0.2s;
}
.thought-note:focus { border-color: rgba(255,110,170,0.42); }
.thought-note::placeholder { color: rgba(255,140,190,0.3); }
.thought-stats {
  display: flex; gap: 18px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.64rem; color: rgba(255,140,190,0.45);
  letter-spacing: 0.07em; min-height: 14px;
}
.thought-stats b { color: rgba(255,165,210,0.75); font-weight: 500; }
.thought-save {
  display: block; width: 100%;   /* always full-width */
  background: linear-gradient(135deg,rgba(255,80,160,0.32),rgba(190,50,120,0.22));
  border: 1px solid rgba(255,110,170,0.38);
  border-radius: 13px;
  color: rgba(255,228,244,0.92);
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 1rem; padding: 12px; cursor: pointer;
  transition: background 0.2s, box-shadow 0.2s;
  letter-spacing: 0.06em;
}
.thought-save:hover, .thought-save:active {
  background: linear-gradient(135deg,rgba(255,80,160,0.48),rgba(190,50,120,0.35));
  box-shadow: 0 0 22px rgba(255,80,160,0.22);
}

/* ─── Thought tabs (Nota / Historia 24H) ─── */
.thought-tabs {
  display: flex;
  border-bottom: 1px solid rgba(255,110,170,0.14);
  margin: 0 -20px;
  padding: 0 20px;
}
.t-tab {
  flex: 1; padding: 9px 0;
  background: none; border: none; border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  color: rgba(255,140,190,0.45); font-size: 0.8rem;
  font-family: inherit; cursor: pointer; letter-spacing: 0.04em;
  transition: color 0.18s, border-color 0.18s;
}
.t-tab.active {
  color: rgba(255,185,215,0.95);
  border-bottom-color: rgba(255,100,165,0.65);
}
.tp { display: flex; flex-direction: column; gap: 12px; }

/* ─── Historia 24H – foto opcional (botón sutil integrado en el flujo) ─── */
.story-add-photo {
  display: flex; align-items: center; gap: 8px;
  width: 100%;
  background: rgba(255,100,170,0.06);
  border: 1px solid rgba(255,110,170,0.16);
  border-radius: 10px; padding: 10px 14px;
  color: rgba(255,150,195,0.55); font-size: 0.8rem;
  font-family: inherit; cursor: pointer; text-align: left;
  transition: all 0.18s;
}
.story-add-photo:hover, .story-add-photo:active {
  background: rgba(255,100,170,0.13);
  color: rgba(255,175,210,0.85);
  border-color: rgba(255,110,170,0.32);
}
/* Image preview before publishing */
.story-preview-wrap {
  position: relative; width: 100%; border-radius: 14px; overflow: hidden;
  max-height: 200px; background: #000;
}
.story-preview-wrap img {
  width: 100%; height: 200px; object-fit: cover; display: block;
}
.story-rm {
  position: absolute; top: 8px; right: 8px;
  width: 30px; height: 30px; border-radius: 50%;
  background: rgba(0,0,0,0.65); border: none;
  color: rgba(255,255,255,0.9); font-size: 1rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  touch-action: manipulation;
}
/* Active story card */
.story-cur {
  display: flex; gap: 14px; align-items: flex-start;
  background: rgba(255,80,160,0.07);
  border: 1px solid rgba(255,110,170,0.2);
  border-radius: 14px; padding: 13px; cursor: pointer;
}
.story-cur-img {
  width: 70px; height: 70px; object-fit: cover;
  border-radius: 10px; flex-shrink: 0;
  border: 1.5px solid rgba(255,110,170,0.3);
}
.story-cur-info { flex: 1; }
.story-cur-time {
  font-size: 0.72rem; color: rgba(255,140,190,0.52);
  margin: 0 0 4px; font-family: 'JetBrains Mono', monospace; letter-spacing: 0.05em;
}
.story-cur-cap { font-size: 0.83rem; color: rgba(255,210,230,0.8); margin: 0; }
.s-btn-primary {
  flex: 1; padding: 7px 10px; border-radius: 10px;
  background: linear-gradient(135deg, rgba(255,80,160,0.35), rgba(190,50,120,0.22));
  border: 1px solid rgba(255,110,170,0.35);
  color: rgba(255,220,235,0.9); font-size: 0.78rem;
  cursor: pointer; font-family: inherit; touch-action: manipulation;
}
.s-btn-ghost {
  flex: 1; padding: 7px 10px; border-radius: 10px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  color: rgba(255,185,210,0.5); font-size: 0.78rem;
  cursor: pointer; font-family: inherit; touch-action: manipulation;
}

/* ─── FAB story-dot indicator ─── */
.story-dot {
  position: absolute; top: 7px; right: 7px;
  width: 9px; height: 9px; border-radius: 50%;
  background: #ff4080;
  border: 1.5px solid rgba(10,0,8,0.95);
  box-shadow: 0 0 8px rgba(255,64,128,0.85);
  display: none;
  animation: storyPulse 1.8s ease-in-out infinite;
  pointer-events: none;
}
.story-dot.visible { display: block; }
@keyframes storyPulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50%       { transform: scale(1.4); opacity: 0.6; }
}

/* ─── Historia fullscreen viewer ─── */
.story-viewer {
  position: fixed; inset: 0; z-index: 700;
  background: #000;
  opacity: 0; pointer-events: none;
  transition: opacity 0.3s ease;
}
.story-viewer.open { opacity: 1; pointer-events: auto; }
.sv-img {
  position: absolute; inset: 0;
  width: 100%; height: 100%; object-fit: cover;
  user-select: none;
}
/* Time-remaining bar at top */
.sv-progress {
  position: absolute;
  top: calc(env(safe-area-inset-top, 0px) + 12px);
  left: 16px; right: 16px;
  height: 3px; background: rgba(255,255,255,0.2);
  border-radius: 3px; z-index: 10; overflow: hidden;
}
.sv-bar {
  height: 100%; border-radius: 3px;
  background: linear-gradient(to right, #ff6fae, #ff9a3c);
}
/* Close button */
.sv-close {
  position: absolute;
  top: calc(env(safe-area-inset-top, 0px) + 22px);
  right: calc(env(safe-area-inset-right, 0px) + 16px);
  z-index: 10;
  width: 46px; height: 46px; border-radius: 50%;
  background: rgba(0,0,0,0.52); border: 1px solid rgba(255,255,255,0.22);
  color: rgba(255,255,255,0.92); font-size: 1.4rem;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.sv-close:active { background: rgba(255,60,120,0.5); }
/* Caption + meta at bottom */
.sv-bottom {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: 60px 24px calc(env(safe-area-inset-bottom, 0px) + 30px);
  background: linear-gradient(to top, rgba(0,0,0,0.78) 0%, transparent 100%);
  z-index: 10;
}
.sv-caption {
  font-size: 1rem; color: rgba(255,255,255,0.95); margin: 0 0 8px;
  text-shadow: 0 1px 10px rgba(0,0,0,0.7); line-height: 1.4;
}
.sv-meta {
  font-size: 0.72rem; color: rgba(255,200,220,0.65); margin: 0;
  font-family: 'JetBrains Mono', monospace; letter-spacing: 0.06em;
}

/* ============================================================
   GALAXIA DE RECUERDOS — pantalla de carga
   z-index 800: encima de todo excepto modales (999+)
   ============================================================ */
.galaxy-loader {
  position: fixed; inset: 0; z-index: 800;
  background:
    radial-gradient(circle at 50% 35%, rgba(255,74,176,0.18), transparent 32%),
    radial-gradient(circle at center, #100613 0%, #050106 65%, #000 100%);
  perspective: 1000px;
  overflow: hidden;
  opacity: 0; pointer-events: none;
  transition: opacity 1.0s ease-in-out;
  touch-action: none; user-select: none;
}
.galaxy-loader.open    { opacity: 1; pointer-events: auto; }
.galaxy-loader.fade-out { opacity: 0; pointer-events: none; }

.galaxy-space {
  position: absolute; inset: 0;
  overflow: hidden;
}
.memory-depth {
  position: absolute;
  top: -15%;   /* off-screen above — animation pulls it down */
  will-change: transform, opacity;
}
.memory-item {
  white-space: nowrap;
  display: flex; align-items: center; justify-content: center;
  animation-name: rainDown;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
  will-change: transform, opacity;
}
/* Text items */
.memory-item.text {
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: clamp(1.15rem, 5.2vw, 2.8rem);
  font-weight: 500;
  letter-spacing: -0.04em;
  color: rgba(255,244,251,0.96);
  text-shadow:
    0 0 8px  rgba(255,255,255,0.55),
    0 0 18px rgba(255,94,190,0.65),
    0 0 42px rgba(255,94,190,0.35);
  max-width: 80vw; white-space: normal; text-align: center; line-height: 1.25;
}
/* Icon items */
.memory-item.icon { font-size: clamp(1.7rem, 5vw, 3.2rem); }
.memory-item.heart {
  color: #ff4fae;
  text-shadow: 0 0 12px rgba(255,79,174,0.95), 0 0 30px rgba(255,79,174,0.55);
}
.memory-item.spider { filter: drop-shadow(0 0 10px rgba(255,118,205,0.65)); }
.memory-item.moon {
  color: #fff1fb;
  text-shadow: 0 0 12px rgba(255,255,255,0.75), 0 0 26px rgba(255,118,205,0.45);
}
.memory-item.star {
  color: #ffb8e6;
  text-shadow: 0 0 12px rgba(255,184,230,0.9), 0 0 28px rgba(255,97,190,0.45);
}
/* Image items */
.memory-item.image { white-space: normal; }
.memory-item.image .img-container {
  padding: 5px; border-radius: 18px;
  background: linear-gradient(145deg, rgba(255,255,255,0.16), rgba(255,105,190,0.04));
  border: 1px solid rgba(255,194,230,0.22);
  box-shadow: 0 0 18px rgba(255,140,210,0.22), 0 0 45px rgba(255,80,180,0.16);
  backdrop-filter: blur(12px);
}
.memory-item.image img {
  width: clamp(110px, 30vw, 200px);
  height: clamp(145px, 40vw, 265px);
  object-fit: cover; border-radius: 16px; display: block; opacity: 0.92;
}
/* Header */
.mg-header {
  position: absolute; z-index: 20;
  top: max(18px, env(safe-area-inset-top, 18px));
  left: 20px; right: 20px;
  pointer-events: none;
}
.mg-header p {
  margin: 0; font-size: 0.72rem;
  color: rgba(255,210,236,0.6); letter-spacing: 0.2em; text-transform: uppercase;
}
.mg-header h2 {
  margin: 3px 0 0; font-size: clamp(1.2rem, 4vw, 1.9rem);
  color: #fff; letter-spacing: -0.04em;
  text-shadow: 0 0 22px rgba(255,83,181,0.55);
}
/* Background layers */
.mg-stars, .mg-bokeh, .mg-glow { position: absolute; inset: 0; pointer-events: none; }
.mg-stars {
  background-image:
    radial-gradient(circle, rgba(255,255,255,0.45) 1px, transparent 1px),
    radial-gradient(circle, rgba(255,136,220,0.32) 1px, transparent 1px);
  background-size: 120px 120px, 210px 210px;
  opacity: 0.4; animation: starsScroll 65s linear infinite;
}
.mg-bokeh {
  background-image: radial-gradient(circle, rgba(255,160,215,0.18) 2px, transparent 42px);
  background-size: 290px 290px;
  opacity: 0.52; animation: starsScroll 34s linear infinite reverse;
}
.mg-glow {
  background:
    radial-gradient(circle at 20% 20%, rgba(255,59,177,0.18), transparent 30%),
    radial-gradient(circle at 80% 75%, rgba(255,151,216,0.12), transparent 34%);
}
/* Giant "A" that appears in the center — simulates arriving at the heart's core */
.mg-center-a {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%) scale(3.2);
  font-size: clamp(9rem, 36vw, 22rem);
  font-weight: 900;
  font-family: "Inter Tight", -apple-system, BlinkMacSystemFont, sans-serif;
  /* 3D gradient text: white → rose → deep pink */
  background: linear-gradient(162deg, #fff8fc 0%, #ffcce8 22%, #ff6db8 52%, #d4006a 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  /* 3D extrusion via stacked drop-shadows + atmospheric glow */
  filter:
    drop-shadow(0 2px 0 rgba(200, 0, 90, 1.00))
    drop-shadow(0 4px 0 rgba(165, 0, 74, 0.90))
    drop-shadow(0 7px 0 rgba(130, 0, 58, 0.75))
    drop-shadow(0 11px 2px rgba(90, 0, 40, 0.55))
    drop-shadow(0 0 50px  rgba(255, 80, 180, 0.95))
    drop-shadow(0 0 120px rgba(255, 80, 180, 0.60));
  pointer-events: none;
  z-index: 15;
  opacity: 0;
  animation:
    centerAReveal 1.1s 0.75s cubic-bezier(0.22, 0.61, 0.36, 1) both,
    centerAPulse  2.4s 1.9s  ease-in-out infinite alternate;
}
/* Animations */
@keyframes rainDown {
  /* Items fall from -15% (off-screen top) to 115vh (off-screen bottom).
     translateX(--dx) adds a gentle horizontal drift per item. */
  0%   { opacity: 0;    transform: translateY(0)      translateX(0)                  rotate(var(--rot, 0deg)) scale(var(--sc, 1)); }
  8%   { opacity: 0.92; }
  87%  { opacity: 0.88; }
  100% { opacity: 0;    transform: translateY(125vh)  translateX(var(--dx, 0px))     rotate(var(--rot, 0deg)) scale(var(--sc, 1)); }
}
@keyframes centerAReveal {
  /* A zooms in from large → normal, as if the camera arrived at the heart's core */
  from { opacity: 0;   transform: translate(-50%, -50%) scale(3.2); }
  to   { opacity: 1;   transform: translate(-50%, -50%) scale(1);   }
}
@keyframes centerAPulse {
  from {
    opacity: 0.78;
    filter:
      drop-shadow(0 2px 0 rgba(200, 0, 90, 1.00))
      drop-shadow(0 4px 0 rgba(165, 0, 74, 0.90))
      drop-shadow(0 7px 0 rgba(130, 0, 58, 0.75))
      drop-shadow(0 11px 2px rgba(90, 0, 40, 0.55))
      drop-shadow(0 0 50px  rgba(255, 80, 180, 0.85))
      drop-shadow(0 0 110px rgba(255, 80, 180, 0.45));
  }
  to {
    opacity: 1;
    filter:
      drop-shadow(0 3px 0 rgba(230, 0, 110, 1.00))
      drop-shadow(0 6px 0 rgba(185, 0, 85, 0.90))
      drop-shadow(0 10px 0 rgba(145, 0, 65, 0.75))
      drop-shadow(0 15px 3px rgba(100, 0, 50, 0.55))
      drop-shadow(0 0 70px  rgba(255, 80, 180, 1.00))
      drop-shadow(0 0 180px rgba(255, 80, 180, 0.65))
      drop-shadow(0 0 320px rgba(255, 80, 180, 0.35));
  }
}
@keyframes starsScroll {
  from { background-position: 0 0, 0 0; }
  to   { background-position: 220px 420px, -220px 240px; }
}
@media (max-width: 520px) {
  .mg-header { top: max(12px, env(safe-area-inset-top, 12px)); left: 14px; right: 14px; }
  .memory-item.text { font-size: clamp(0.9rem, 5.5vw, 1.8rem); }
}

/* ─── App toast ─── */
.app-toast {
  position: fixed; bottom: 96px; left: 50%;
  transform: translateX(-50%) translateY(14px);
  background: rgba(22,4,16,0.96);
  border: 1px solid rgba(255,110,170,0.28);
  border-radius: 26px;
  color: rgba(255,228,244,0.9);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem; letter-spacing: 0.06em;
  padding: 10px 22px; z-index: 400;
  opacity: 0; pointer-events: none;
  transition: opacity 0.28s, transform 0.28s;
  white-space: nowrap;
  box-shadow: 0 4px 24px rgba(255,80,160,0.13);
}
.app-toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ─── Tag filter panel ─── */
.filter-backdrop {
  position: fixed;
  inset: 0;
  background: transparent;
  z-index: 900;
  display: none;
}
.filter-backdrop.open { display: block; }
.filter-panel {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%) translateY(110%);
  width: min(480px, 96vw);
  background: rgba(14, 3, 20, 0.96);
  border: 1px solid rgba(255, 120, 180, 0.2);
  border-bottom: none;
  border-radius: 24px 24px 0 0;
  padding: 12px 20px 32px;
  z-index: 901;
  transition: transform 0.38s cubic-bezier(0.34, 1.56, 0.64, 1);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}
.filter-panel.open { transform: translateX(-50%) translateY(0); }
.filter-panel-handle {
  width: 36px;
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 120, 180, 0.3);
  margin: 0 auto 16px;
}
.filter-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.filter-panel-title {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.6rem;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: rgba(255, 160, 200, 0.7);
}
.filter-clear {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.58rem;
  letter-spacing: 0.2em;
  color: rgba(255, 120, 180, 0.6);
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 8px;
  transition: color 0.18s, background 0.18s;
}
.filter-clear:hover { color: rgba(255, 160, 210, 0.9); background: rgba(255, 80, 150, 0.1); }
.filter-clear.active { color: rgba(255, 200, 230, 0.95); }
.filter-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.filter-tag-pill {
  padding: 6px 16px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.05);
  color: rgba(255, 220, 240, 0.65);
  font-family: "JetBrains Mono", monospace;
  font-size: 0.6rem;
  letter-spacing: 0.15em;
  cursor: pointer;
  transition: all 0.18s;
  display: flex;
  align-items: center;
  gap: 7px;
}
.filter-tag-pill .ftag-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--tc, #ff6fae);
  flex-shrink: 0;
}
.filter-tag-pill.active {
  border-color: var(--tc, #ff6fae);
  background: color-mix(in srgb, var(--tc, #ff6fae) 20%, transparent);
  color: color-mix(in srgb, var(--tc, #ff6fae) 100%, #fff);
  box-shadow: 0 0 12px color-mix(in srgb, var(--tc, #ff6fae) 30%, transparent);
}
.filter-tag-pill .ftag-count {
  opacity: 0.55;
  font-size: 0.52rem;
}
/* Node cards dimmed when filter active */
.node-card.filter-dim { opacity: 0.12; pointer-events: none; }

.modal-actions { display: flex; gap: 12px; justify-content: flex-end; margin-top: 6px; }
.modal-btn {
  padding: 11px 22px;
  border-radius: 999px;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.25s ease;
}
.modal-btn:active { transform: scale(0.96); }
.modal-btn.cancel {
  border: 1px solid rgba(255, 160, 200, 0.35);
  background: transparent;
  color: rgba(255, 200, 220, 0.75);
}
.modal-btn.cancel:hover { background: rgba(255, 80, 150, 0.08); color: #fff; }
.modal-btn.save {
  border: 1px solid rgba(255, 200, 220, 0.55);
  background: linear-gradient(180deg, rgba(255, 130, 180, 0.5), rgba(255, 60, 130, 0.4));
  color: #fff;
  box-shadow: 0 0 20px rgba(255, 80, 150, 0.4), inset 0 1px 0 rgba(255,255,255,0.3);
}
.modal-btn.save:hover { box-shadow: 0 0 36px rgba(255, 80, 150, 0.7), inset 0 1px 0 rgba(255,255,255,0.4); }
.modal-btn.delete {
  border: 1px solid rgba(255, 100, 130, 0.45);
  background: transparent;
  color: rgba(255, 150, 170, 0.85);
  margin-right: auto;
}
.modal-btn.delete:hover { background: rgba(200, 30, 60, 0.18); color: #fff; }

/* ============================================================
   TWEAKS PANEL
   ============================================================ */
.tweaks-panel {
  position: fixed;
  bottom: 22px; right: 22px;
  z-index: 300;
  width: 280px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(35, 8, 22, 0.92), rgba(15, 4, 12, 0.94));
  border: 1px solid rgba(255, 160, 200, 0.35);
  box-shadow: 0 20px 60px -10px rgba(0,0,0,0.6), 0 0 40px rgba(255, 80, 150, 0.18);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  color: rgba(255, 230, 240, 0.92);
  font-family: "Inter Tight", sans-serif;
  font-size: 0.78rem;
  transform: translateY(10px) scale(0.96);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.tweaks-panel.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}
.tweaks-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255, 160, 200, 0.18);
  cursor: grab;
  user-select: none;
}
.tweaks-header:active { cursor: grabbing; }
.tweaks-title {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.7rem;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: rgba(255, 180, 210, 0.85);
}
.tweaks-close {
  width: 24px; height: 24px;
  border-radius: 50%;
  background: rgba(255, 100, 160, 0.15);
  border: 1px solid rgba(255, 160, 200, 0.3);
  color: rgba(255, 230, 240, 0.9);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  display: flex; align-items: center; justify-content: center;
}
.tweaks-close:hover { background: rgba(255, 100, 160, 0.3); }

.tweaks-body {
  padding: 14px 16px 16px;
  display: flex; flex-direction: column; gap: 14px;
  max-height: 70vh;
  overflow-y: auto;
}
.tweak-row { display: flex; flex-direction: column; gap: 6px; }
.tweak-label {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 0.72rem;
  color: rgba(255, 200, 220, 0.85);
}
.tweak-value {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.68rem;
  color: rgba(255, 160, 200, 0.85);
  letter-spacing: 0.08em;
}
.tweak-row input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 100, 160, 0.2);
  outline: none;
}
.tweak-row input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: linear-gradient(180deg, rgba(255, 200, 230, 0.95), rgba(255, 100, 170, 0.85));
  border: 1px solid rgba(255, 220, 240, 0.7);
  box-shadow: 0 0 14px rgba(255, 100, 170, 0.7);
  cursor: pointer;
}
.tweak-row input[type="range"]::-moz-range-thumb {
  width: 16px; height: 16px;
  border-radius: 50%;
  background: linear-gradient(180deg, rgba(255, 200, 230, 0.95), rgba(255, 100, 170, 0.85));
  border: 1px solid rgba(255, 220, 240, 0.7);
  box-shadow: 0 0 14px rgba(255, 100, 170, 0.7);
  cursor: pointer;
}
.tweak-toggle-row {
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  font-size: 0.78rem;
}
.tweak-toggle {
  width: 40px; height: 22px;
  border-radius: 999px;
  background: rgba(255, 100, 160, 0.18);
  border: 1px solid rgba(255, 160, 200, 0.3);
  position: relative;
  cursor: pointer;
  transition: background 0.25s ease;
}
.tweak-toggle::after {
  content: "";
  position: absolute;
  top: 1px; left: 1px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: rgba(255, 230, 245, 0.9);
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 0 8px rgba(255, 130, 200, 0.5);
}
.tweak-toggle.on { background: rgba(255, 100, 160, 0.5); }
.tweak-toggle.on::after { transform: translateX(18px); }

.tweaks-reset {
  margin-top: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(255, 100, 160, 0.12);
  border: 1px solid rgba(255, 160, 200, 0.3);
  color: rgba(255, 230, 240, 0.85);
  font-family: inherit;
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.2s ease;
}
.tweaks-reset:hover { background: rgba(255, 100, 160, 0.25); }

/* ============================================================
   MOBILE — performance, layout & quality overrides
   Targets: iPhones, Android phones (portrait & landscape)
   ============================================================ */
@media (max-width: 768px) {

  /* === PERFORMANCE: Kill every backdrop-filter on mobile.
     Each blurred layer forces the GPU to composite the entire screen region
     behind it. With 10+ cards visible this causes severe frame drops.
     Replace with an opaque tinted background that looks identical. === */
  .node-card,
  .glass,
  .glass .glass-filter,
  .home-btn,
  .fab-heart,
  .modal-box,
  .thought-overlay,
  .capsule-overlay,
  .wish-overlay {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }
  .thought-overlay  { background: rgba(10,0,8,0.88); }
  .capsule-overlay  { background: rgba(10,0,8,0.88); }
  .wish-overlay     { background: rgba(10,0,8,0.88); }

  /* Cards: opaque dark glass substitute — fast, looks identical on dark bg */
  .node-card {
    width: 200px;
    padding: 14px;
    border-radius: 18px;
    background: rgba(18, 4, 14, 0.92) !important;
    transition: box-shadow 0.3s ease, border-color 0.3s ease;
  }
  .node-card:hover { transform: none; }

  /* Glass buttons: opaque substitute */
  .glass .glass-tint { background: rgba(255, 80, 160, 0.18) !important; }

  /* Disable SVG distortion filter on all glass elements */
  .glass-btn .glass-filter,
  .lgbar .glass-filter { filter: none; }

  /* --- Glass buttons: slightly smaller on small screens --- */
  .glass-btn { padding: 18px 40px; }
  .glass-btn.size-md { padding: 14px 30px; }

  /* --- FAB: safe-area aware (iOS home bar) --- */
  .fab-wrap {
    bottom: calc(28px + env(safe-area-inset-bottom, 0px));
    right: calc(20px + env(safe-area-inset-right, 0px));
  }

  /* --- Home button: safe-area aware --- */
  .home-btn {
    top: calc(14px + env(safe-area-inset-top, 0px));
    right: calc(14px + env(safe-area-inset-right, 0px));
  }

  /* --- Neural screen: pan without triggering browser scroll --- */
  #screen-neural { touch-action: none; }

  /* --- Hacking screen panels --- */
  .hack-panel { font-size: 0.68rem; }
  .hack-label { font-size: 1.1rem; }

  /* --- Modal --- */
  .modal-box {
    width: min(92vw, 400px);
    padding: 20px 18px;
  }

  /* --- Landing ARI crystal --- */
  .ari-crystal { font-size: clamp(5rem, 22vw, 9rem); }

  /* --- Disable ARI crystal animation blur (expensive) --- */
  @keyframes ariSwap {
    0%, 100% { filter: none; opacity: 1; }
    50%       { filter: none; opacity: 0.6; }
  }
}

/* ============================================================
   NUESTRA PELÍCULA — full-screen memory slideshow
   ============================================================ */
.movie-overlay {
  position: fixed; inset: 0; z-index: 600;
  background: #000;
  opacity: 0; pointer-events: none;
  transition: opacity 0.5s ease;
}
.movie-overlay.open { opacity: 1; pointer-events: auto; }

/* Background image with Ken Burns */
.movie-bg {
  position: absolute; inset: -8%;
  background-size: cover; background-position: center;
  opacity: 0;
  transition: opacity 0.8s ease;
  animation: kenburns 10s ease-in-out infinite alternate;
}
.movie-bg.visible { opacity: 1; }
@keyframes kenburns {
  from { transform: scale(1) translate(0, 0); }
  to   { transform: scale(1.1) translate(-2%, 1.5%); }
}

/* Text-only slide (no image) */
.movie-text-card {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 48px 40px;
  opacity: 0;
  transition: opacity 0.8s ease;
  background: radial-gradient(ellipse at 50% 40%, rgba(100,20,60,0.4) 0%, transparent 70%);
}
.movie-text-card.visible { opacity: 1; }
.movie-text-card .mtc-text {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: clamp(1.6rem, 5vw, 3rem);
  font-style: italic;
  color: rgba(255,230,245,0.95);
  text-align: center; line-height: 1.35;
  text-shadow: 0 2px 40px rgba(255,80,160,0.5), 0 0 80px rgba(200,40,100,0.25);
  max-width: 640px;
}
.movie-text-card .mtc-heart {
  margin-top: 24px; font-size: 2rem; opacity: 0.6;
  animation: mtcPulse 2.2s ease-in-out infinite;
}
@keyframes mtcPulse {
  0%,100% { transform: scale(1); opacity: 0.6; }
  50%     { transform: scale(1.18); opacity: 0.9; }
}

/* Caption overlay (image slides) */
.movie-caption {
  position: absolute; bottom: 0; left: 0; right: 0;
  padding: 80px 36px 52px;
  background: linear-gradient(to top, rgba(0,0,0,0.82) 0%, rgba(0,0,0,0.3) 60%, transparent 100%);
  opacity: 0; transition: opacity 0.6s ease 0.3s;
}
.movie-caption.visible { opacity: 1; }
.movie-caption .mc-text {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: clamp(1.1rem, 3.5vw, 1.8rem);
  font-style: italic;
  color: rgba(255,235,248,0.95);
  line-height: 1.4; margin-bottom: 6px;
  text-shadow: 0 1px 12px rgba(0,0,0,0.8);
}
.movie-caption .mc-date {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.68rem; letter-spacing: 0.12em;
  color: rgba(255,180,220,0.65);
  text-transform: uppercase;
}

/* Top progress bar */
.movie-progress {
  position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: rgba(255,255,255,0.15); z-index: 2;
}
.movie-progress-bar {
  height: 100%; width: 0%;
  background: linear-gradient(to right, rgba(255,100,170,0.9), rgba(255,180,220,0.9));
}

/* Slide counter */
.movie-counter {
  position: absolute; top: 18px; left: 50%;
  transform: translateX(-50%);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.65rem; letter-spacing: 0.14em;
  color: rgba(255,255,255,0.45); z-index: 2;
  pointer-events: none;
}

/* Close button — top/right respect iOS safe-area so it stays out of the
   notch / Dynamic Island in PWA standalone mode. */
.movie-close {
  position: absolute;
  /* safe-area-inset-top is 0 in browser, ~44-54 px in PWA standalone */
  top: calc(env(safe-area-inset-top, 0px) + 14px);
  right: calc(env(safe-area-inset-right, 0px) + 16px);
  z-index: 20;               /* higher than overlay children */
  width: 52px; height: 52px; border-radius: 50%;
  background: rgba(0,0,0,0.55); border: 1.5px solid rgba(255,255,255,0.3);
  color: rgba(255,255,255,0.95); font-size: 1.5rem; line-height: 1;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background 0.2s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  pointer-events: all;       /* explicit — no parent can suppress this */
  user-select: none;
}
.movie-close:hover, .movie-close:active { background: rgba(255,80,150,0.55); }

/* Prev / Next */
.movie-prev, .movie-next {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 52px; height: 72px; z-index: 10;
  background: rgba(0,0,0,0.25); border: none;
  color: rgba(255,255,255,0.7); font-size: 2.2rem; line-height: 1;
  cursor: pointer; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.2s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.movie-prev { left: 0; border-radius: 0 6px 6px 0; }
.movie-next { right: 0; border-radius: 6px 0 0 6px; }
.movie-prev:hover, .movie-next:hover,
.movie-prev:active, .movie-next:active { background: rgba(255,60,130,0.4); }

/* ============================================================
   CÁPSULAS DEL TIEMPO
   ============================================================ */
.capsule-overlay {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(10,0,8,0.72);
  backdrop-filter: blur(10px) saturate(1.4);
  display: flex; align-items: flex-end; justify-content: center;
  opacity: 0; pointer-events: none;
  transition: opacity 0.28s;
}
.capsule-overlay.open { opacity: 1; pointer-events: auto; }

.capsule-box {
  width: 100%; max-width: 520px;
  background: rgba(22,4,16,0.97);
  border: 1px solid rgba(255,110,170,0.2);
  border-bottom: none;
  border-radius: 22px 22px 0 0;
  padding: 0 0 env(safe-area-inset-bottom,24px);
  display: flex; flex-direction: column;
  box-shadow: 0 -6px 40px rgba(255,80,160,0.14);
  max-height: 82vh;
  transform: translateY(28px);
  transition: transform 0.3s cubic-bezier(0.22,1,0.36,1);
}
.capsule-overlay.open .capsule-box { transform: translateY(0); }

.capsule-header {
  display: flex; align-items: center;
  padding: 18px 20px 0;
  gap: 8px;
}
.capsule-tabs { display: flex; gap: 6px; flex: 1; }
.capsule-tab {
  background: none; border: 1px solid rgba(255,110,170,0.18);
  border-radius: 999px; padding: 6px 16px;
  font-family: 'Inter Tight', sans-serif; font-size: 0.78rem;
  color: rgba(255,180,220,0.55); cursor: pointer;
  transition: all 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.capsule-tab.active {
  border-color: rgba(255,110,170,0.55);
  background: rgba(255,80,160,0.12);
  color: rgba(255,228,244,0.92);
}
.capsule-close {
  background: none; border: none; cursor: pointer;
  color: rgba(255,130,180,0.45); font-size: 1.3rem;
  padding: 2px 6px; transition: color 0.2s;
  line-height: 1;
}
.capsule-close:hover { color: rgba(255,130,180,0.85); }

.capsule-view { padding: 16px 20px 24px; overflow-y: auto; }

/* List view */
.capsule-list { display: flex; flex-direction: column; gap: 10px; min-height: 80px; }
.cap-empty {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 1rem; font-style: italic;
  color: rgba(255,160,210,0.45); text-align: center;
  padding: 24px 0;
}
.cap-card {
  position: relative;
  display: flex; align-items: flex-start; gap: 12px;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid rgba(255,110,170,0.16);
  background: rgba(255,255,255,0.03);
  transition: border-color 0.3s, box-shadow 0.3s;
  -webkit-tap-highlight-color: transparent;
}
.cap-card.unlocked {
  border-color: rgba(255,130,180,0.4);
  box-shadow: 0 0 20px rgba(255,80,160,0.12), inset 0 0 20px rgba(255,80,160,0.04);
  animation: capGlow 3s ease-in-out infinite;
}
@keyframes capGlow {
  0%,100% { box-shadow: 0 0 20px rgba(255,80,160,0.12), inset 0 0 20px rgba(255,80,160,0.04); }
  50%     { box-shadow: 0 0 35px rgba(255,80,160,0.25), inset 0 0 30px rgba(255,80,160,0.08); }
}
.cap-card-emoji { font-size: 1.5rem; flex-shrink: 0; line-height: 1.2; }
.cap-card-body { flex: 1; min-width: 0; }
.cap-card-title {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 1.05rem; font-weight: 600;
  color: rgba(255,228,244,0.9); margin-bottom: 4px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cap-card-msg {
  font-family: 'Inter Tight', sans-serif; font-size: 0.82rem;
  color: rgba(255,200,230,0.75); line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 3;
  -webkit-box-orient: vertical; overflow: hidden;
  margin-bottom: 6px;
}
.cap-card-lock {
  font-family: 'JetBrains Mono', monospace; font-size: 0.72rem;
  color: rgba(255,140,190,0.5); letter-spacing: 0.06em;
  margin-bottom: 4px;
}
.cap-card-date {
  font-family: 'JetBrains Mono', monospace; font-size: 0.6rem;
  color: rgba(255,140,190,0.35); letter-spacing: 0.08em;
}
.cap-delete {
  position: absolute; top: 10px; right: 10px;
  background: none; border: none;
  color: rgba(255,120,170,0.35); font-size: 1rem;
  cursor: pointer; padding: 2px 6px;
  transition: color 0.2s;
  line-height: 1;
}
.cap-delete:hover { color: rgba(255,100,140,0.8); }

/* New capsule form */
.cap-form { display: flex; flex-direction: column; gap: 12px; }
.cap-input, .cap-textarea {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,110,170,0.16);
  border-radius: 11px;
  color: rgba(255,228,244,0.92);
  font-family: 'Inter Tight', sans-serif; font-size: 0.9rem;
  padding: 11px 14px; outline: none;
  transition: border-color 0.2s;
}
.cap-input:focus, .cap-textarea:focus { border-color: rgba(255,110,170,0.42); }
.cap-input::placeholder, .cap-textarea::placeholder { color: rgba(255,140,190,0.3); }
.cap-textarea { resize: none; }
.cap-date-row {
  display: flex; align-items: center; gap: 10px;
}
.cap-date-label {
  font-family: 'Inter Tight', sans-serif; font-size: 0.82rem;
  color: rgba(255,180,220,0.65); white-space: nowrap;
}
.cap-date-input {
  flex: 1;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,110,170,0.16);
  border-radius: 9px;
  color: rgba(255,228,244,0.92);
  font-family: 'Inter Tight', sans-serif; font-size: 0.88rem;
  padding: 8px 12px; outline: none;
  transition: border-color 0.2s;
  color-scheme: dark;
}
.cap-date-input:focus { border-color: rgba(255,110,170,0.42); }
.cap-emoji-row { display: flex; gap: 8px; flex-wrap: wrap; }
.capsule-save-btn {
  background: linear-gradient(135deg,rgba(255,80,160,0.32),rgba(190,50,120,0.22));
  border: 1px solid rgba(255,110,170,0.38);
  border-radius: 13px;
  color: rgba(255,228,244,0.92);
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 1rem; padding: 13px; cursor: pointer;
  transition: background 0.2s, box-shadow 0.2s;
  letter-spacing: 0.08em;
}
.capsule-save-btn:hover {
  background: linear-gradient(135deg,rgba(255,80,160,0.48),rgba(190,50,120,0.35));
  box-shadow: 0 0 22px rgba(255,80,160,0.22);
}

/* ============================================================
   CAJA DE PENDIENTES
   ============================================================ */
.wish-overlay {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(10,0,8,0.72);
  backdrop-filter: blur(10px) saturate(1.4);
  display: flex; align-items: flex-end; justify-content: center;
  opacity: 0; pointer-events: none;
  transition: opacity 0.28s;
}
.wish-overlay.open { opacity: 1; pointer-events: auto; }

.wish-box {
  width: 100%; max-width: 520px;
  background: rgba(22,4,16,0.97);
  border: 1px solid rgba(255,110,170,0.2);
  border-bottom: none;
  border-radius: 22px 22px 0 0;
  padding: 22px 20px calc(env(safe-area-inset-bottom,24px) + 16px);
  display: flex; flex-direction: column; gap: 14px;
  box-shadow: 0 -6px 40px rgba(255,80,160,0.14);
  max-height: 80vh;
  transform: translateY(28px);
  transition: transform 0.3s cubic-bezier(0.22,1,0.36,1);
}
.wish-overlay.open .wish-box { transform: translateY(0); }

.wish-header {
  display: flex; align-items: center;
}
.wish-title {
  flex: 1;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 1.15rem; color: rgba(255,218,240,0.92);
}
.wish-close {
  background: none; border: none; cursor: pointer;
  color: rgba(255,130,180,0.45); font-size: 1.3rem;
  padding: 2px 6px; transition: color 0.2s; line-height: 1;
}
.wish-close:hover { color: rgba(255,130,180,0.85); }

.wish-progress-wrap {
  display: flex; align-items: center; gap: 10px;
}
.wish-progress-track {
  flex: 1; height: 4px; border-radius: 999px;
  background: rgba(255,110,170,0.12);
  overflow: hidden;
}
.wish-progress-fill {
  height: 100%;
  background: linear-gradient(to right, rgba(255,80,160,0.7), rgba(255,160,210,0.8));
  border-radius: 999px;
  transition: width 0.4s cubic-bezier(0.22,1,0.36,1);
}
.wish-progress-text {
  font-family: 'JetBrains Mono', monospace; font-size: 0.65rem;
  color: rgba(255,140,190,0.5); letter-spacing: 0.08em;
  white-space: nowrap; min-width: 36px; text-align: right;
}

.wish-list {
  flex: 1; overflow-y: auto; display: flex; flex-direction: column;
  gap: 6px; min-height: 60px;
}
.wish-empty {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 1rem; font-style: italic;
  color: rgba(255,160,210,0.45); text-align: center;
  padding: 20px 0;
}
.wish-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border-radius: 11px;
  border: 1px solid rgba(255,110,170,0.12);
  background: rgba(255,255,255,0.02);
  transition: border-color 0.2s, opacity 0.2s;
}
.wish-item.done {
  opacity: 0.48;
  border-color: rgba(255,110,170,0.06);
}
.wish-check {
  width: 26px; height: 26px; border-radius: 50%; flex-shrink: 0;
  border: 1.5px solid rgba(255,110,170,0.35);
  background: none; cursor: pointer;
  color: rgba(255,180,220,0.9); font-size: 0.85rem;
  display: flex; align-items: center; justify-content: center;
  transition: border-color 0.2s, background 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.wish-item.done .wish-check {
  border-color: rgba(255,130,180,0.5);
  background: rgba(255,80,160,0.15);
}
.wish-text {
  flex: 1;
  font-family: 'Inter Tight', sans-serif; font-size: 0.88rem;
  color: rgba(255,228,244,0.88); line-height: 1.4;
}
.wish-item.done .wish-text {
  text-decoration: line-through;
  color: rgba(255,180,220,0.4);
}
.wish-del {
  background: none; border: none; cursor: pointer;
  color: rgba(255,120,170,0.25); font-size: 1rem; line-height: 1;
  padding: 2px 4px; flex-shrink: 0;
  transition: color 0.2s;
}
.wish-del:hover { color: rgba(255,100,140,0.7); }

.wish-add-row {
  display: flex; gap: 8px;
}
.wish-input {
  flex: 1;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,110,170,0.18);
  border-radius: 11px;
  color: rgba(255,228,244,0.92);
  font-family: 'Inter Tight', sans-serif; font-size: 0.88rem;
  padding: 11px 14px; outline: none;
  transition: border-color 0.2s;
}
.wish-input:focus { border-color: rgba(255,110,170,0.44); }
.wish-input::placeholder { color: rgba(255,140,190,0.28); }
.wish-add-btn {
  width: 44px; height: 44px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg,rgba(255,80,160,0.3),rgba(190,50,120,0.2));
  border: 1px solid rgba(255,110,170,0.38);
  color: rgba(255,228,244,0.9); font-size: 1.4rem; line-height: 1;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background 0.2s, box-shadow 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.wish-add-btn:hover {
  background: rgba(255,80,160,0.38);
  box-shadow: 0 0 16px rgba(255,80,160,0.2);
}
