html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
    'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
    sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

#root {
  height: 100%;
  overflow: hidden;
}

code {
  font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
    monospace;
}
:root {
  --primary-color: /* ===== Lock Screen ===== */
  --secondary-color: #666;
  --hover-color: #e60000;
  --font-family: "Lobster", cursive;
  /* Safe area CSS variables for notched iPhones */
  --sai-top: env(safe-area-inset-top, 0px);
  --sai-bottom: env(safe-area-inset-bottom, 0px);
  --sai-left: env(safe-area-inset-left, 0px);
  --sai-right: env(safe-area-inset-right, 0px);
}

body {
  font-family: var(--font-family);
  text-align: center;
  margin: 0;
  /* Prevent white flash / white gap on any page */
  background: #0a0515;
}

/* Root app container — must fill viewport */
.App {
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  position: relative;
}

/* Root app container â€” must fill viewport */
.App {
  min-height: 100vh;
  min-height: 100dvh;
  position: relative;
}

/* ===== Lock Screen ===== */
.lock-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0a0515 0%, #1a0a2e 25%, #2d1230 50%, #1a0820 75%, #050210 100%);
  background-size: 400% 400%;
  animation: lockBg 12s ease infinite;
  overflow: hidden;
  z-index: 50;
  /* Prevent overscroll bounce in iOS WebViews (FB Messenger) */
  overscroll-behavior: none;
  -webkit-overflow-scrolling: touch;
}

/* Subtle star overlay for lock screen */
.lock-screen::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(1px 1px at 8% 15%, rgba(255,200,220,0.3) 0%, transparent 100%),
    radial-gradient(1px 1px at 25% 55%, rgba(255,255,255,0.25) 0%, transparent 100%),
    radial-gradient(1.5px 1.5px at 45% 10%, rgba(255,180,200,0.35) 0%, transparent 100%),
    radial-gradient(1px 1px at 65% 40%, rgba(255,255,255,0.2) 0%, transparent 100%),
    radial-gradient(1px 1px at 80% 75%, rgba(255,200,230,0.3) 0%, transparent 100%),
    radial-gradient(1.5px 1.5px at 15% 80%, rgba(255,180,255,0.25) 0%, transparent 100%),
    radial-gradient(1px 1px at 55% 85%, rgba(255,255,255,0.2) 0%, transparent 100%),
    radial-gradient(1px 1px at 92% 8%, rgba(255,180,220,0.3) 0%, transparent 100%);
  pointer-events: none;
  animation: twinkle 4s ease-in-out infinite alternate;
}

@keyframes lockBg {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

@keyframes twinkle {
  0% { opacity: 0.6; }
  100% { opacity: 1; }
}

/* Vignette for lock screen */
.lock-screen::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, transparent 30%, rgba(0,0,0,0.5) 100%);
  pointer-events: none;
}

.lock-icon {
  font-size: 48px;
  margin-bottom: 24px;
  animation: lockPulse 2s ease-in-out infinite;
  filter: drop-shadow(0 0 12px rgba(255, 150, 180, 0.5));
  position: relative;
  z-index: 2;
}

@keyframes lockPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

.lock-input {
  width: 200px;
  padding: 14px 20px;
  font-size: 24px;
  text-align: center;
  border: 2px solid rgba(255, 180, 200, 0.4);
  border-radius: 30px;
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(8px);
  color: #f8c8dc;
  outline: none;
  letter-spacing: 8px;
  transition: border-color 0.3s, box-shadow 0.3s;
  font-family: var(--font-family);
  position: relative;
  z-index: 2;
}

.lock-input:focus {
  border-color: rgba(255, 180, 200, 0.7);
  box-shadow: 0 0 20px rgba(255, 150, 180, 0.3);
}

.lock-input::placeholder {
  color: transparent;
}

.lock-input.shake {
  animation: shake 0.4s ease;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-6px); }
  80% { transform: translateX(6px); }
}

/* ===== Falling Petals (Lock Screen) ===== */
.falling-petals {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: hidden;
  z-index: 1;
}

.petal {
  position: absolute;
  top: -30px;
  animation:
    petalFall var(--sway-duration, 12s) linear infinite,
    petalSway var(--sway-duration, 4s) ease-in-out infinite alternate;
  will-change: transform;
}

@keyframes petalFall {
  0% {
    top: -8%;
    opacity: 0;
  }
  5% {
    opacity: 1;
  }
  90% {
    opacity: 1;
  }
  100% {
    top: 105%;
    opacity: 0;
    transform: rotate(calc(var(--initial-rotation, 0deg) + 360deg));
  }
}

@keyframes petalSway {
  0% {
    margin-left: 0;
    transform: rotate(var(--initial-rotation, 0deg));
  }
  100% {
    margin-left: var(--sway-amount, 40px);
    transform: rotate(calc(var(--initial-rotation, 0deg) + 45deg));
  }
}


/* ===== Lock Screen Responsive ===== */
@media (max-width: 768px) {
  .lock-icon {
    font-size: 64px;
    margin-bottom: 30px;
  }
  .lock-input {
    width: 220px;
    padding: 16px 24px;
    font-size: 28px; /* > 16px prevents iOS auto-zoom */
  }
}

/* Landscape lock screen */
@media (max-height: 500px) and (orientation: landscape) {
  .lock-icon {
    font-size: 36px;
    margin-bottom: 12px;
  }
  .lock-input {
    width: 180px;
    padding: 10px 16px;
    font-size: 22px;
  }
}

/* Safe area for notched iPhones — lock screen */
@supports (padding: env(safe-area-inset-bottom)) {
  .lock-screen {
    padding-top: env(safe-area-inset-top);
  }
}

/* iPhone PWA — lock screen */
@media only screen and (max-device-width: 480px) and (-webkit-min-device-pixel-ratio: 2) {
  .lock-screen {
    padding-top: calc(40px + env(safe-area-inset-top, 0px));
  }
}

/* â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•
   RomanticApp.css â€” All styles for the Romantic/Garden app
   Separated from App.css for clean architecture
   â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â• */

.App-body {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  /* Background matches the cinema pages so no white peeks through */
  background: linear-gradient(135deg, #fff0f3 0%, #ffe0e8 50%, #fff5f7 100%);
}

.App-text {
  font-size: calc(10px + 4vmin);
  font-weight: bold;
}

.App-text:hover {
  color: #391253;
}

.App-gif {
  width: 80%;
  max-width: 300px;
  height: auto; /* Maintain aspect ratio */
}

.App-button {
  margin: 10px;
  padding: 15px 20px;
  font-size: 20px;
  cursor: pointer;
  background-color: var(--primary-color);
  color: white;
  border: none;
  border-radius: 8px;
  transition: background-color 0.3s ease, transform 0.3s ease;
}

.App-button:before {
  content: "\1F498";
  font-size: 20px;
  margin-right: 5px;
}

.App-button:hover {
  background-color: var(--hover-color);
  transform: scale(1.1);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.App-button:nth-child(2) {
  background-color: var(--secondary-color);
}

.App-button:nth-child(2):before {
  content: "\1F494";
  color: var(--secondary-color);
}

.App-button:nth-child(2):hover {
  background-color: #404040;
}

.App-text-success {
  font-size: 19px;
  line-height: 1.5;
}

.App-text-success:before {
  content: "\1F496";
  color: var(--primary-color);
  margin-right: 5px;
  font-size: 24px;
}

.App-text-success:hover {
  color: var(--primary-color);
}

.App-text-date {
  font-size: 18px;
}

.App-text-date:before {
  content: "\1F495";
  color: var(--primary-color);
  margin-right: 5px;
}

.App-success {
  padding: 20px;
}

.App-memory-btn-container {
  display: flex;
  justify-content: center;
  margin-top: 30px;
  margin-bottom: 20px;
}

.App-memory-btn {
  padding: 15px 30px;
  font-size: 18px;
  font-family: var(--font-family);
  cursor: pointer;
  background: linear-gradient(135deg, #ff4d4d, #ff85a2);
  color: white;
  border: none;
  border-radius: 30px;
  transition: background 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
  box-shadow: 0 4px 12px rgba(255, 77, 77, 0.3);
}

.App-memory-btn:hover {
  background: linear-gradient(135deg, #e60000, #ff4d6d);
  transform: scale(1.05);
  box-shadow: 0 6px 16px rgba(255, 77, 77, 0.5);
}

/* Memory Lane Page Ã¢â‚¬â€ Immersive Single-Panel Layout */
/* ===== Memory Lane Ã¢â‚¬â€ Full-screen unified canvas ===== */
.memory-lane {
  height: 100vh;
  height: 100dvh;
  height: -webkit-fill-available;
  width: 100vw;
  position: fixed;
  top: 0;
  left: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  background-image: url('/assets/background-BRHioK1-.png');
  background-size: 105%;
  background-position: center;
  background-repeat: no-repeat;
  transition: background-position 0.15s ease-out;
  overscroll-behavior: none;
  overflow: hidden;
}

/* Subtle gradient overlay */
.memory-lane::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    135deg,
    rgba(10, 5, 21, 0.4) 0%,
    rgba(30, 10, 40, 0.3) 40%,
    rgba(60, 15, 45, 0.35) 70%,
    rgba(10, 5, 21, 0.5) 100%
  );
  z-index: 0;
  pointer-events: none;
}

/* Twinkling starfield canvas Ã¢â‚¬â€ full page background */
.starfield-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

.memory-lane-overlay {
  background: rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(6px);
  border-radius: 24px;
  padding: 50px 40px;
  max-width: 520px;
  width: 85%;
  box-shadow: 0 8px 32px rgba(255, 100, 130, 0.25);
  text-align: center;
}

.memory-lane-title {
  font-family: var(--font-family);
  font-size: 2.5em;
  color: #d63384;
  margin-bottom: 10px;
  text-shadow: 0 2px 8px rgba(214, 51, 132, 0.2);
}

.memory-lane-subtitle {
  font-family: var(--font-family);
  font-size: 1.2em;
  color: #e75480;
  margin-bottom: 30px;
}

.memory-lane-content {
  margin-top: 20px;
}

.memory-lane-text {
  font-family: var(--font-family);
  font-size: 1.1em;
  color: #6b3a5d;
  line-height: 1.8;
  margin-bottom: 18px;
}

/* ===== Media Showcase Ã¢â‚¬â€ Unity Harmonic Full-screen Gallery ===== */
.media-showcase {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  z-index: 1;
  contain: layout style;
}

.showcase-loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: rgba(255, 200, 220, 0.7);
  font-family: var(--font-family);
  font-size: 1.3em;
  animation: loadPulse 1.5s ease-in-out infinite;
}

@keyframes loadPulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

/* Base box styles Ã¢â‚¬â€ 3D transform ready */
.showcase-box {
  position: absolute;
  border-radius: 13px;
  overflow: hidden;
  z-index: 10;
  box-shadow:
    0 0 18px rgba(255, 150, 180, 0.25),
    0 4px 16px rgba(0, 0, 0, 0.10),
    inset 0 0.5px 0 rgba(255, 255, 255, 0.20);
  contain: layout style paint;
  will-change: transform, opacity, filter;
  box-sizing: border-box;
}

/* Foreground state Ã¢â‚¬â€ sharp + interactive */
.showcase-box.showcase-fg {
  z-index: 10;
  opacity: 1;
  filter: none;
  transform: scale(1);
  pointer-events: auto;
  cursor: pointer;
}

/* Background state Ã¢â‚¬â€ simple 2D shrink, no 3D transforms */
.showcase-box.showcase-bg-pushed {
  z-index: 5;
  opacity: 0.38;
  filter: blur(6px);
  transform: scale(0.6);
  pointer-events: none;
  box-shadow: none;
}

/* Inner glass pane behind the media Ã¢â‚¬â€ subtle frosted edge effect only */
.showcase-glass-inner {
  position: absolute;
  inset: 0;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  pointer-events: none;
  z-index: 0;
}

/* Hover only applies to foreground boxes */
.showcase-box.showcase-fg:hover {
  z-index: 20;
  box-shadow:
    0 0 30px rgba(255, 150, 180, 0.45),
    0 8px 28px rgba(0, 0, 0, 0.18),
    inset 0 0.5px 0 rgba(255, 255, 255, 0.30);
}

/* Aura glow behind the box */
.showcase-aura {
  position: absolute;
  border-radius: 50%;
  filter: blur(50px);
  opacity: 0.3;
  z-index: -1;
  pointer-events: none;
  transition: opacity 0.5s ease;
}

.showcase-box.showcase-fg:hover .showcase-aura {
  opacity: 0.5;
}

/* Specular shine highlight */
.showcase-shine {
  position: absolute;
  width: 60%;
  height: 60%;
  background: radial-gradient(ellipse at center, rgba(255,255,255,0.25), transparent 70%);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
  transform: translate(-50%, -50%);
  z-index: 5;
}

.showcase-box.showcase-fg:hover .showcase-shine {
  opacity: 1;
}

/* Media element Ã¢â‚¬â€ fills the freely-sized box edge to edge, no bars */
.showcase-media {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 11px;
  background: rgba(0, 0, 0, 0.08);
}

/* "Falling Away" background boxes Ã¢â‚¬â€ blurred living wallpaper */
/* No separate animation needed Ã¢â‚¬â€ JS handles the 3s transition inline */


/* ===== Love Counter (floating glassmorphism header Ã¢â‚¬â€ top center) ===== */
.love-counter-overlay {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 40;
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: none;
  width: 90%;
  max-width: 820px;
}

.love-counter-growing {
  font-family: 'Dancing Script', cursive;
  font-size: 16px;
  color: #ffb3d0;
  margin: 6px 0 0;
  text-align: center;
  text-shadow: 0 0 12px rgba(255, 80, 120, 0.6), 0 1px 4px rgba(0,0,0,0.7);
}

.love-counter-message {
  font-family: 'Playfair Display', serif;
  font-size: 17px;
  font-style: italic;
  font-weight: 500;
  color: #ffd6e3;
  text-align: center;
  margin: 0 0 6px;
  line-height: 1.4;
  text-shadow: 0 0 10px rgba(255, 100, 150, 0.5), 0 2px 8px rgba(0,0,0,0.8);
  max-width: 600px;
}

.love-counter-clock {
  display: flex;
  gap: 8px;
  background: rgba(120, 30, 60, 0.4);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  border: 1px solid rgba(255, 255, 255, 0.20);
  border-radius: 50px;
  padding: 14px 28px;
  box-shadow: 0 0 30px rgba(255, 70, 120, 0.25), 0 4px 16px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.08);
}

.love-counter-unit {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 52px;
}

.love-counter-num {
  font-family: 'Courier Prime', monospace;
  font-size: 48px;
  font-weight: 700;
  color: #ff4d88;
  text-shadow: 0 0 14px rgba(255, 80, 140, 0.8), 0 0 30px rgba(255, 60, 120, 0.4), 0 2px 4px rgba(0,0,0,0.6);
  line-height: 1;
}

.love-counter-label {
  font-family: var(--font-family);
  font-size: 10px;
  font-weight: 600;
  color: rgba(255, 220, 235, 0.95);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  text-shadow: 0 0 6px rgba(255, 100, 150, 0.4), 0 1px 2px rgba(0,0,0,0.5);
}

/* Responsive: single-panel adjustments for mobile */
@media (max-width: 768px) {
  .memory-lane {
    height: 100vh;
    height: 100dvh;
    height: -webkit-fill-available;
    background-size: cover !important;
    background-position: left center !important;
  }

  /* Gradient overlay adjusts for mobile */
  .memory-lane::before {
    background: linear-gradient(
      135deg,
      rgba(10, 5, 21, 0.45) 0%,
      rgba(30, 10, 40, 0.35) 40%,
      rgba(60, 15, 45, 0.4) 70%,
      rgba(10, 5, 21, 0.55) 100%
    );
  }

  /* Ã¢â€â‚¬Ã¢â€â‚¬ Mailbox: hidden on mobile Ã¢â‚¬â€ Letter is in bottom nav Ã¢â€â‚¬Ã¢â€â‚¬ */
  .postbox-wrapper {
    display: none !important;
  }

  /* Ã¢â€â‚¬Ã¢â€â‚¬ Love counter compact on mobile Ã¢â€â‚¬Ã¢â€â‚¬ */
  .love-counter-overlay {
    top: calc(6px + env(safe-area-inset-top, 0px));
    max-width: 520px;
    gap: 2px;
    z-index: 100;
  }
  .love-counter-message {
    display: none; /* hide the quote on mobile â€” clock is enough */
  }
  .love-counter-growing {
    font-size: 11px;
    margin: 2px 0 0;
  }

  /* â”€â”€ Clock: tight single-row pill â”€â”€ */
  .love-counter-clock {
    display: flex;
    justify-content: center;
    flex-wrap: nowrap;
    gap: 5px;
    padding: 6px 10px;
    border-radius: 20px;
    width: auto;
    box-sizing: border-box;
  }
  .love-counter-num {
    font-size: 17px;
  }
  .love-counter-unit {
    min-width: auto;
    flex: 0 0 auto;
    text-align: center;
  }
  .love-counter-label {
    font-size: 7px;
    letter-spacing: 0.4px;
    margin-top: 1px;
  }

  /* Ã¢â€â‚¬Ã¢â€â‚¬ Hide desktop view-switcher Ã¢â‚¬â€ mobile-bottom-nav replaces it Ã¢â€â‚¬Ã¢â€â‚¬ */
  .view-switcher-container {
    display: none;
  }

  /* Ã¢â€â‚¬Ã¢â€â‚¬ Add memory FAB: hidden on mobile Ã¢â‚¬â€ Add is in bottom nav Ã¢â€â‚¬Ã¢â€â‚¬ */
  .add-memory-fab {
    display: none !important;
  }

  /* Ã¢â€â‚¬Ã¢â€â‚¬ Content spacing: push content below the clock, above bottom nav Ã¢â€â‚¬Ã¢â€â‚¬ */
  .story-timeline-scroll {
    padding-top: 80px;
    padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px));
  }

  /* Showcase boxes Ã¢â‚¬â€ touch active state (foreground only) */
  .showcase-box.showcase-fg:active {
    z-index: 20;
    box-shadow: 0 0 35px rgba(255, 150, 180, 0.5), 0 8px 30px rgba(0, 0, 0, 0.25);
  }
  .showcase-box.showcase-fg:active .showcase-caption {
    opacity: 1;
    pointer-events: auto;
  }
  .showcase-box.showcase-fg:active .showcase-aura {
    opacity: 0.5;
  }

  /* Modals Ã¢â‚¬â€ prevent iOS zoom on inputs (font-size >= 16px enforced) */
  .add-memory-input,
  .add-memory-textarea,
  .letter-textarea {
    font-size: 16px !important;
  }

  /* Ã¢â€â‚¬Ã¢â€â‚¬ Timeline-active mode: hide counter extras, tighter spacing â”€â”€ */
  .memory-lane--timeline .love-counter-growing {
    display: none;
  }
  .memory-lane--timeline .love-counter-clock {
    padding: 5px 10px;
    gap: 4px;
  }
  .memory-lane--timeline .love-counter-num {
    font-size: 14px;
  }
  .memory-lane--timeline .love-counter-unit {
    min-width: auto;
  }
  .memory-lane--timeline .love-counter-label {
    font-size: 7px;
  }
  .memory-lane--timeline .story-timeline-scroll {
    padding-top: 60px;
    padding-bottom: calc(56px + env(safe-area-inset-bottom, 0px));
  }
  .memory-lane--timeline .starfield-canvas {
    opacity: 0.3;
  }
}


/* Ã¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢ÂÃ¢â€¢Â */
.mobile-bottom-nav {
  display: none; /* hidden on desktop */
}

@media (max-width: 768px) {
  .mobile-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    display: flex;
    justify-content: space-around;
    align-items: center;
    background: rgba(20, 8, 30, 0.75);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid rgba(255, 200, 220, 0.15);
    padding: 4px 0;
    padding-bottom: calc(4px + env(safe-area-inset-bottom, 0px));
    z-index: 2000;
  }
  .mobile-bottom-nav-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
    background: none;
    border: none;
    color: rgba(255, 220, 230, 0.6);
    font-size: 18px;
    padding: 3px 10px;
    cursor: pointer;
    transition: color 0.2s, transform 0.15s;
    -webkit-tap-highlight-color: transparent;
  }
  .mobile-bottom-nav-btn.active {
    color: #ffb3d0;
    text-shadow: 0 0 8px rgba(255, 179, 208, 0.4);
  }
  .mobile-bottom-nav-btn:active {
    transform: scale(0.92);
  }
  .mobile-bottom-nav-label {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 9px;
    font-weight: 500;
    letter-spacing: 0.3px;
  }
  /* Active indicator dot â€” removed to save vertical space */
  .mobile-bottom-nav-btn.active::after {
    content: '';
    display: block;
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: #ffb3d0;
    margin-top: 1px;
    box-shadow: 0 0 4px rgba(255, 179, 208, 0.5);
  }
}
/* ===== Red Postbox (fixed bottom-left, on top of media) ===== */
.postbox-wrapper {
  position: absolute;
  bottom: 18px;
  left: 12px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 50;
  transition: transform 0.3s ease;
  transform: scale(0.8);
  transform-origin: bottom left;
}

.postbox-wrapper:hover {
  transform: scale(1.08);
}

.postbox {
  position: relative;
  width: 68px;
}

.postbox-body {
  width: 68px;
  height: 78px;
  background: linear-gradient(135deg, #e53935, #c62828);
  border: 2px solid #b71c1c;
  border-radius: 6px 6px 2px 2px;
  position: relative;
  box-shadow:
    0 4px 16px rgba(0,0,0,0.35),
    inset 0 2px 6px rgba(255,255,255,0.12),
    inset -4px 0 8px rgba(0,0,0,0.15);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* Mail slot */
.postbox-slot {
  width: 34px;
  height: 6px;
  background: #1a1a1a;
  border-radius: 1px;
  border: 1px solid #b71c1c;
  margin-top: -4px;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.6);
}

.postbox-heart {
  font-size: 18px;
  margin-top: 5px;
  filter: drop-shadow(0 1px 3px rgba(0,0,0,0.4));
}

/* Flag that flips up on hover */
.postbox-flag {
  position: absolute;
  right: -10px;
  top: 8px;
  width: 6px;
  height: 22px;
  background: linear-gradient(to bottom, #ff8f00, #f57f17);
  border-radius: 2px;
  transform-origin: bottom center;
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 2px 5px rgba(0,0,0,0.3);
  z-index: 2;
}

.postbox-flag::after {
  content: "";
  position: absolute;
  top: 0;
  left: -3px;
  width: 12px;
  height: 8px;
  background: #ff6f00;
  border-radius: 2px;
}

.postbox-wrapper:hover .postbox-flag {
  transform: rotate(-70deg);
}

/* Glow on hover */
.postbox-wrapper:hover .postbox-body {
  box-shadow:
    0 0 20px rgba(255, 80, 80, 0.4),
    0 4px 16px rgba(0,0,0,0.35),
    inset 0 2px 6px rgba(255,255,255,0.12);
}

.postbox-base {
  width: 72px;
  height: 7px;
  background: linear-gradient(to bottom, #8d6e63, #5d4037);
  border-radius: 0 0 3px 3px;
  margin: 0 auto;
}

/* Swinging sign below postbox */
.postbox-sign {
  margin-top: 6px;
  padding: 5px 14px;
  background: rgba(229, 57, 53, 0.85);
  border: 1.5px solid #b71c1c;
  border-radius: 4px;
  font-family: 'Dancing Script', cursive;
  font-size: 12px;
  color: #fff1f0;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.6);
  transform-origin: top center;
  animation: gentleSwing 3.5s ease-in-out infinite;
  white-space: nowrap;
  box-shadow: 0 3px 10px rgba(0,0,0,0.25);
}

@keyframes gentleSwing {
  0%, 100% { transform: rotate(-1.5deg); }
  50% { transform: rotate(1.5deg); }
}

/* ===== Letter Modal ===== */
.letter-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.letter-modal {
  width: 66%;
  max-width: 750px;
  max-height: 85vh;
  background: #fffaf5;
  border-radius: 20px;
  padding: 40px 36px 30px;
  box-shadow: 0 12px 48px rgba(214, 51, 132, 0.25), 0 0 0 1px rgba(255, 200, 200, 0.3);
  display: flex;
  flex-direction: column;
  position: relative;
  animation: slideUp 0.35s ease;
}

@keyframes slideUp {
  from { transform: translateY(30px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.letter-close {
  position: absolute;
  top: 14px;
  right: 18px;
  background: none;
  border: none;
  font-size: 22px;
  color: #c2185b;
  cursor: pointer;
  transition: transform 0.2s;
}

.letter-close:hover {
  transform: scale(1.2);
}

.letter-title {
  font-family: var(--font-family);
  font-size: 1.8em;
  color: #d63384;
  text-align: center;
  margin: 0 0 6px;
}

.letter-hint {
  font-family: var(--font-family);
  font-size: 0.95em;
  color: #b06080;
  text-align: center;
  margin-bottom: 20px;
}

.letter-textarea {
  flex: 1;
  min-height: 220px;
  width: 100%;
  border: 2px solid #f3c4d8;
  border-radius: 14px;
  padding: 18px 20px;
  font-family: "Georgia", serif;
  font-size: 16px;
  line-height: 1.7;
  color: #4a2040;
  background: #fff;
  resize: vertical;
  outline: none;
  transition: border-color 0.3s;
  box-sizing: border-box;
}

.letter-textarea:focus {
  border-color: #e75480;
  box-shadow: 0 0 0 3px rgba(231, 84, 128, 0.15);
}

.letter-textarea::placeholder {
  color: #d4a0b8;
  font-style: italic;
}

.letter-send-wrapper {
  display: flex;
  justify-content: center;
  margin-top: 22px;
}

.letter-send-btn {
  /* Heart shape via clip-path */
  width: 110px;
  height: 100px;
  background: linear-gradient(135deg, #ff4d6d, #ff85a2);
  color: white;
  font-family: var(--font-family);
  font-size: 16px;
  font-weight: bold;
  border: none;
  cursor: pointer;
  clip-path: path("M55 90 C55 90 10 60 10 35 A22 22 0 0 1 55 25 A22 22 0 0 1 100 35 C100 60 55 90 55 90 Z");
  transition: transform 0.3s ease, filter 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-bottom: 12px;
  text-shadow: 0 1px 4px rgba(0,0,0,0.2);
}

.letter-send-btn:hover:not(:disabled) {
  transform: scale(1.1);
  filter: brightness(1.1);
}

.letter-send-btn:disabled {
  opacity: 0.7;
  cursor: default;
}

/* Responsive letter modal */
@media (max-width: 768px) {
  .letter-modal {
    width: 92%;
    padding: 24px 16px 20px;
    max-height: 75dvh;
    max-height: 75vh;
    -webkit-overflow-scrolling: touch;
  }
  .letter-textarea {
    min-height: 160px;
    font-size: 16px; /* prevent iOS zoom */
  }
  .letter-title {
    font-size: 1.4em;
  }
  .letter-send-btn {
    width: 90px;
    height: 82px;
    font-size: 14px;
  }
}

/* ===== Cinematic Intro & Pages System ===== */

/* Ã¢â€â‚¬Ã¢â€â‚¬ Shared cinematic full-screen page Ã¢â€â‚¬Ã¢â€â‚¬ */
.cinema-intro,
.cinema-page {
  position: fixed;
  inset: 0;
  z-index: 100;
  min-height: 100vh;
  min-height: 100dvh;
  min-height: -webkit-fill-available;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  opacity: 0;
  transform: scale(1.02);
  transition: opacity 0.9s cubic-bezier(0.4, 0, 0.2, 1), transform 0.9s cubic-bezier(0.4, 0, 0.2, 1);
  /* Prevent overscroll bounce in iOS WebViews */
  overscroll-behavior: none;
}

.cinema-intro--visible,
.cinema-page--visible {
  opacity: 1;
  transform: scale(1);
}

.cinema-intro--fadeout {
  opacity: 0;
  transform: scale(0.97);
  transition: opacity 1s cubic-bezier(0.4, 0, 0.2, 1), transform 1s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Ã¢â€â‚¬Ã¢â€â‚¬ Intro: bright light pink Ã¢â€â‚¬Ã¢â€â‚¬ */
.cinema-intro {
  background: linear-gradient(135deg, #fff0f3 0%, #ffe0e8 20%, #ffccd5 40%, #ffc2d1 60%, #ffe0e8 80%, #fff5f7 100%);
  background-size: 400% 400%;
  animation: cinemaLightShift 10s ease infinite;
}

/* Ã¢â€â‚¬Ã¢â€â‚¬ Asking: warm bright pink Ã¢â€â‚¬Ã¢â€â‚¬ */
.cinema-page--asking {
  background: linear-gradient(135deg, #fff0f5 0%, #fce4ec 25%, #f8bbd0 50%, #fce4ec 75%, #fff5f8 100%);
  background-size: 400% 400%;
  animation: cinemaLightShift 12s ease infinite;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-top: var(--sai-top);
  padding-bottom: var(--sai-bottom);
}

/* Ã¢â€â‚¬Ã¢â€â‚¬ Success: warm celebration pink Ã¢â€â‚¬Ã¢â€â‚¬ */
.cinema-page--success {
  background: linear-gradient(135deg, #fff5f7 0%, #fce4ec 20%, #f48fb1 45%, #f8bbd0 70%, #fff0f3 100%);
  background-size: 400% 400%;
  animation: cinemaLightShift 10s ease infinite;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-top: var(--sai-top);
  padding-bottom: var(--sai-bottom);
}

@keyframes cinemaLightShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* (cinemaGradientShift removed Ã¢â€â‚¬ replaced by cinemaLightShift above) */

/* Ã¢â€â‚¬Ã¢â€â‚¬ Film grain overlay Ã¢â‚¬â€ very subtle on light backgrounds Ã¢â€â‚¬Ã¢â€â‚¬ */
.cinema-grain {
  position: absolute;
  inset: -50%;
  width: 200%;
  height: 200%;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.06'/%3E%3C/svg%3E");
  opacity: 0.025;
  pointer-events: none;
  z-index: 3;
  animation: grainDrift 0.8s steps(6) infinite;
}

@keyframes grainDrift {
  0%, 100% { transform: translate(0, 0); }
  20% { transform: translate(-2%, -1%); }
  40% { transform: translate(1%, 2%); }
  60% { transform: translate(-1%, 1%); }
  80% { transform: translate(2%, -2%); }
}

/* Ã¢â€â‚¬Ã¢â€â‚¬ Vignette Ã¢â‚¬â€ soft pink edges for light theme Ã¢â€â‚¬Ã¢â€â‚¬ */
.cinema-vignette {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, transparent 50%, rgba(244,143,177,0.15) 100%);
  pointer-events: none;
  z-index: 2;
}

/* Ã¢â€â‚¬Ã¢â€â‚¬ Floating particles Ã¢â€â‚¬Ã¢â€â‚¬ */
.cinema-particles {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 3;
}

.cinema-particle {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,20,80,0.5) 0%, rgba(255,105,180,0.25) 60%, transparent 100%);
  animation: cinemaFloat var(--duration, 10s) ease-in-out infinite;
  animation-delay: var(--delay, 0s);
  box-shadow: 0 0 8px rgba(255,105,180,0.3), 0 0 16px rgba(233,30,99,0.1);
}

@keyframes cinemaFloat {
  0%   { transform: translateY(0) translateX(0) scale(1); }
  25%  { transform: translateY(-50px) translateX(var(--drift, 15px)) scale(1.3); }
  50%  { transform: translateY(-100px) translateX(calc(var(--drift, 15px) * -0.6)) scale(0.7); }
  75%  { transform: translateY(-50px) translateX(var(--drift, 15px)) scale(1.15); }
  100% { transform: translateY(0) translateX(0) scale(1); }
}

/* Ã¢â€â‚¬Ã¢â€â‚¬ Typewriter text (intro page) Ã¢â€â‚¬Ã¢â€â‚¬ */
.cinema-text-area {
  text-align: center;
  min-height: 180px;
  position: relative;
  z-index: 10;
  padding: 0 20px;
  animation: cinemaTextAreaIn 1s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes cinemaTextAreaIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.cinema-heading {
  font-family: 'Courier Prime', 'Courier New', var(--font-family);
  font-size: calc(20px + 4vmin);
  color: #c2185b;
  margin: 0 0 8px;
  display: inline;
  text-shadow: 0 0 20px rgba(194, 24, 91, 0.2), 0 2px 8px rgba(233, 30, 99, 0.1);
  letter-spacing: 2px;
  animation: cinemaLineReveal 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.cinema-body {
  font-family: 'Courier Prime', 'Courier New', var(--font-family);
  font-size: calc(10px + 2vmin);
  color: #ad1457;
  margin: 6px 0;
  line-height: 1.7;
  text-shadow: 0 0 15px rgba(173, 20, 87, 0.15);
  letter-spacing: 1px;
  animation: cinemaLineReveal 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.cinema-line {
  min-height: 1.4em;
  transform: translateY(0);
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.cinema-break {
  height: 20px;
}

.cinema-cursor {
  display: inline-block;
  color: #e91e63;
  font-weight: 100;
  font-family: 'Courier Prime', monospace;
  margin-left: 1px;
  font-size: 1.2em;
  text-shadow: 0 0 10px rgba(233, 30, 99, 0.3);
  transition: opacity 0.15s ease;
}

.cinema-cursor-hidden {
  opacity: 0;
}

@keyframes cinemaLineReveal {
  from {
    opacity: 0.7;
    filter: blur(1px);
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    filter: blur(0);
    transform: translateY(0);
  }
}

/* Ã¢â€â‚¬Ã¢â€â‚¬ Cinema enter button Ã¢â‚¬â€ vibrant on light bg Ã¢â€â‚¬Ã¢â€â‚¬ */
.cinema-enter-btn {
  margin-top: 40px;
  padding: 16px 36px;
  font-size: 18px;
  font-family: var(--font-family);
  cursor: pointer;
  background: linear-gradient(135deg, #e91e63, #ff4081, #ff1744);
  color: white;
  border: none;
  border-radius: 30px;
  box-shadow: 0 4px 20px rgba(233, 30, 99, 0.35), 0 0 40px rgba(255, 64, 129, 0.15);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  animation: cinemaBtnIn 0.8s cubic-bezier(0.22, 1, 0.36, 1) forwards, cinemaBtnPulse 2.5s ease-in-out 1s infinite;
  opacity: 0;
  position: relative;
  z-index: 10;
  letter-spacing: 1px;
}

.cinema-enter-btn--warm {
  background: linear-gradient(135deg, #c2185b, #e91e63, #ff4081);
  max-width: 420px;
  font-size: 16px;
  line-height: 1.4;
}

.cinema-enter-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 30px rgba(233, 30, 99, 0.5), 0 0 60px rgba(255, 64, 129, 0.25);
}

@keyframes cinemaBtnIn {
  from { opacity: 0; transform: translateY(25px) scale(0.95); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes cinemaBtnPulse {
  0%, 100% { box-shadow: 0 4px 20px rgba(233,30,99,0.35), 0 0 40px rgba(255,64,129,0.15); }
  50% { box-shadow: 0 6px 30px rgba(233,30,99,0.5), 0 0 60px rgba(255,64,129,0.3); }
}

/* Ã¢â€â‚¬Ã¢â€â‚¬ Cinematic page content (Asking & Success) Ã¢â€â‚¬Ã¢â€â‚¬ */
.cinema-page-content {
  position: relative;
  z-index: 10;
  text-align: center;
  padding: 40px 24px;
  max-width: 600px;
  width: 100%;
}

/* GIF frame Ã¢â‚¬â€ soft glow on light bg */
.cinema-gif-frame {
  display: inline-block;
  border-radius: 16px;
  overflow: hidden;
  box-shadow:
    0 0 25px rgba(233, 30, 99, 0.2),
    0 0 50px rgba(255, 105, 180, 0.1),
    0 8px 24px rgba(136, 14, 79, 0.15);
  margin-bottom: 24px;
  border: 2px solid rgba(233, 30, 99, 0.15);
}

.cinema-gif {
  width: 80%;
  max-width: 280px;
  height: auto;
  display: block;
}

/* Cinematic text lines Ã¢â‚¬â€ dark text on light bg */
.cinema-text {
  font-family: var(--font-family);
  font-size: calc(12px + 3vmin);
  color: #880e4f;
  text-shadow: 0 0 15px rgba(233, 30, 99, 0.15), 0 2px 4px rgba(136, 14, 79, 0.08);
  margin: 8px 0;
  opacity: 0;
  animation: cinemaTextIn 0.53s ease forwards;
  line-height: 1.5;
}

.cinema-text-question {
  font-size: calc(14px + 3.5vmin);
  color: #c2185b;
  text-shadow: 0 0 20px rgba(194, 24, 91, 0.2), 0 0 40px rgba(233, 30, 99, 0.1);
  margin-top: 16px;
}

.cinema-text-success {
  font-size: calc(10px + 2vmin);
  line-height: 1.6;
  color: #ad1457;
}

/* Staggered animation delays (1.5x faster) */
.cinema-text-delay-1 { animation-delay: 0.2s; }
.cinema-text-delay-2 { animation-delay: 0.47s; }
.cinema-text-delay-3 { animation-delay: 0.73s; }
.cinema-text-delay-4 { animation-delay: 1.0s; }
.cinema-text-delay-5 { animation-delay: 1.27s; }
.cinema-text-delay-6 { animation-delay: 1.53s; opacity: 0; animation: cinemaTextIn 0.53s ease 1.53s forwards; }

@keyframes cinemaTextIn {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Ã¢â€â‚¬Ã¢â€â‚¬ Cinematic buttons (Asking page) Ã¢â€â‚¬Ã¢â€â‚¬ */
.cinema-button-group {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 24px;
  opacity: 0;
  animation: cinemaTextIn 0.53s ease forwards;
}

.cinema-btn {
  padding: 14px 28px;
  font-size: 18px;
  font-family: var(--font-family);
  cursor: pointer;
  border: none;
  border-radius: 12px;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  letter-spacing: 1px;
}

.cinema-btn-yes {
  background: linear-gradient(135deg, #e91e63, #ff4081);
  color: white;
  box-shadow: 0 4px 20px rgba(233, 30, 99, 0.35);
  animation: cinemaBtnPulse 2.5s ease-in-out infinite;
}

.cinema-btn-yes:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 30px rgba(233, 30, 99, 0.5);
}

.cinema-btn-no {
  background: rgba(136, 14, 79, 0.08);
  color: #880e4f;
  border: 1.5px solid rgba(233, 30, 99, 0.25);
  backdrop-filter: blur(4px);
}

.cinema-btn-no:hover {
  background: rgba(136, 14, 79, 0.12);
  transform: scale(1.05);
  color: #ad1457;
}

/* ===== Music Button Pulse ===== */
@keyframes musicPulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 20px rgba(255, 100, 150, 0.5); }
  50% { transform: scale(1.08); box-shadow: 0 0 30px rgba(255, 100, 150, 0.7), 0 0 60px rgba(255, 100, 150, 0.3); }
}

/* ===== View Switcher Ã¢â‚¬â€ Centered below counter ===== */
.view-switcher-container {
  position: absolute;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
}

.view-switcher {
  display: flex;
  gap: 0;
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(18px);
  border-radius: 30px;
  padding: 5px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.18), inset 0 0 0 1px rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 200, 220, 0.15);
}

.view-switcher-btn {
  padding: 10px 24px;
  font-family: 'Playfair Display', serif;
  font-size: 13px;
  font-weight: 600;
  border: none;
  border-radius: 26px;
  cursor: pointer;
  background: transparent;
  color: rgba(255, 220, 230, 0.75);
  transition: all 0.35s ease;
  white-space: nowrap;
  letter-spacing: 0.5px;
}

.view-switcher-btn.active {
  background: linear-gradient(135deg, rgba(233, 30, 99, 0.85), rgba(255, 64, 129, 0.85));
  color: white;
  box-shadow: 0 2px 14px rgba(233, 30, 99, 0.45);
  text-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.view-switcher-btn:hover:not(.active) {
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 220, 230, 1);
}

/* ===== Story Timeline ===== */
.story-timeline-scroll {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch; /* Smooth momentum scroll in iOS WebViews */
  overscroll-behavior-y: contain; /* Prevent scroll chaining in FB Messenger */
  padding: 200px 40px 120px;
  box-sizing: border-box;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 150, 180, 0.3) transparent;
  z-index: 2;
}

.story-timeline-scroll::-webkit-scrollbar {
  width: 6px;
}

.story-timeline-scroll::-webkit-scrollbar-thumb {
  background: rgba(255, 150, 180, 0.3);
  border-radius: 3px;
}

.story-timeline {
  position: relative;
  max-width: 800px;
  margin: 0 auto;
  padding: 20px 0;
}

.story-timeline-line {
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(
    to bottom,
    rgba(255, 150, 180, 0),
    rgba(255, 150, 180, 0.5) 10%,
    rgba(255, 150, 180, 0.5) 90%,
    rgba(255, 150, 180, 0)
  );
  transform: translateX(-50%);
}

.story-timeline-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: rgba(255, 220, 230, 0.7);
  font-family: var(--font-family);
  font-size: 1.3em;
  text-align: center;
  padding: 40px;
}

.story-timeline-empty-icon {
  font-size: 3em;
  margin-bottom: 16px;
  animation: loadPulse 2s ease-in-out infinite;
}

.story-timeline-empty-hint {
  font-size: 0.7em;
  color: rgba(255, 200, 220, 0.5);
  margin-top: 12px;
}

/* ===== Timeline Nodes ===== */
.timeline-node {
  position: relative;
  width: 45%;
  margin-bottom: 50px;
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.timeline-node-visible {
  opacity: 1;
  transform: translateY(0);
}

.timeline-node-left {
  margin-right: auto;
  margin-left: 0;
  padding-right: 40px;
  text-align: right;
}

.timeline-node-right {
  margin-left: auto;
  margin-right: 0;
  padding-left: 40px;
  text-align: left;
}

.timeline-node-highlight .timeline-card {
  animation: nodeGlow 1s ease 2;
}

@keyframes nodeGlow {
  0%, 100% { box-shadow: 0 4px 20px rgba(255, 100, 150, 0.2); }
  50% { box-shadow: 0 4px 30px rgba(255, 100, 150, 0.6), 0 0 40px rgba(255, 100, 150, 0.3); }
}

/* Timeline Dot */
.timeline-dot {
  position: absolute;
  top: 20px;
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, #ff4d6d, #ff85a2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 16px rgba(255, 77, 109, 0.5);
  z-index: 5;
}

.timeline-node-left .timeline-dot {
  right: -18px;
}

.timeline-node-right .timeline-dot {
  left: -18px;
}

.timeline-dot-icon {
  font-size: 16px;
}

/* Timeline Date */
.timeline-date {
  font-family: var(--font-family);
  font-size: 0.8em;
  color: rgba(255, 200, 220, 0.6);
  margin-bottom: 8px;
}

/* Timeline Card */
.timeline-card {
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 200, 220, 0.2);
  border-radius: 16px;
  padding: 18px 20px;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.timeline-card:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 200, 220, 0.4);
  box-shadow: 0 4px 24px rgba(255, 100, 150, 0.25);
  transform: translateY(-2px);
}

.timeline-card-locked {
  filter: grayscale(0.5) blur(1px);
  cursor: default;
}

.timeline-card-locked:hover {
  animation: lockedShake 0.4s ease;
  filter: grayscale(0.5) blur(1px);
}

@keyframes lockedShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

.timeline-card-letter {
  cursor: pointer;
  border-color: rgba(255, 200, 150, 0.3);
}

.timeline-card-letter:hover:not(.timeline-card-locked) {
  border-color: rgba(255, 200, 150, 0.6);
  box-shadow: 0 4px 24px rgba(255, 180, 130, 0.3);
}

.timeline-lock-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 18px;
}

.timeline-card-title {
  font-family: var(--font-family);
  font-size: 1.1em;
  color: rgba(255, 230, 240, 0.95);
  margin: 0 0 8px;
}

.timeline-card-media {
  border-radius: 10px;
  overflow: hidden;
  margin: 10px 0;
}

.timeline-media-el {
  width: 100%;
  max-height: 280px;
  object-fit: cover;
  border-radius: 10px;
  display: block;
}

.timeline-card-text {
  font-family: "Georgia", serif;
  font-size: 0.95em;
  color: rgba(255, 220, 230, 0.8);
  line-height: 1.6;
  margin: 8px 0 0;
}

.timeline-card-text-locked {
  filter: blur(4px);
  user-select: none;
}

.timeline-letter-prompt {
  font-family: var(--font-family);
  font-size: 0.8em;
  color: rgba(255, 200, 150, 0.7);
  margin-top: 10px;
  font-style: italic;
}

.timeline-edit-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(255, 255, 255, 0.15);
  border: none;
  border-radius: 50%;
  width: 30px;
  height: 30px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: background 0.2s;
  z-index: 5;
}

.timeline-edit-btn:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* ===== Letter Reader ===== */
.letter-reader-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  animation: fadeIn 0.3s ease;
}

.letter-reader-modal {
  width: 66%;
  max-width: 700px;
  max-height: 85vh;
  overflow-y: auto;
  background: linear-gradient(135deg, #fffaf5, #fff5ee);
  border-radius: 20px;
  padding: 50px 44px 40px;
  box-shadow: 0 12px 60px rgba(160, 80, 100, 0.3);
  position: relative;
  animation: slideUp 0.4s ease;
}

.letter-reader-seal {
  text-align: center;
  font-size: 2.5em;
  margin-bottom: 10px;
}

.letter-reader-title {
  font-family: var(--font-family);
  font-size: 1.8em;
  color: #8B3A62;
  text-align: center;
  margin: 0 0 6px;
}

.letter-reader-date {
  font-family: "Georgia", serif;
  font-size: 0.9em;
  color: #b06080;
  text-align: center;
  margin-bottom: 24px;
  font-style: italic;
}

.letter-reader-content {
  font-family: "Georgia", serif;
  font-size: 1.05em;
  color: #4a2040;
  line-height: 1.9;
  white-space: pre-wrap;
  text-align: left;
}

.letter-reader-blurred {
  filter: blur(5px);
  user-select: none;
  color: #999;
}

.letter-reader-signature {
  font-family: var(--font-family);
  font-size: 1.1em;
  color: #d63384;
  text-align: right;
  margin-top: 30px;
}

.letter-reader-locked {
  text-align: center;
}

.letter-reader-lock-icon {
  font-size: 3em;
  margin-bottom: 12px;
  animation: lockPulse 2s ease-in-out infinite;
}

.letter-reader-lock-msg {
  font-family: var(--font-family);
  font-size: 1.1em;
  color: #8B3A62;
  margin-bottom: 20px;
}

/* ===== Add Memory Modal ===== */
.add-memory-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  animation: fadeIn 0.3s ease;
}

.add-memory-modal {
  width: 90%;
  max-width: 520px;
  max-height: 85vh;
  overflow-y: auto;
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 200, 220, 0.25);
  border-radius: 24px;
  padding: 36px 30px 28px;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.3);
  position: relative;
  animation: slideUp 0.35s ease;
  color: #fff;
}

.add-memory-title {
  font-family: var(--font-family);
  font-size: 1.6em;
  color: rgba(255, 230, 240, 0.95);
  text-align: center;
  margin: 0 0 20px;
}

.add-memory-subtitle {
  font-family: var(--font-family);
  font-size: 1em;
  color: rgba(255, 220, 230, 0.7);
  text-align: center;
  margin-bottom: 16px;
}

.add-memory-categories {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.add-memory-cat-btn {
  padding: 14px 20px;
  font-family: var(--font-family);
  font-size: 15px;
  border: 1px solid rgba(255, 200, 220, 0.2);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 230, 240, 0.9);
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 10px;
}

.add-memory-cat-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 200, 220, 0.4);
  transform: translateX(4px);
}

.add-memory-cat-icon {
  font-size: 1.4em;
}

.add-memory-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.add-memory-back {
  background: none;
  border: none;
  color: rgba(255, 200, 220, 0.7);
  font-family: var(--font-family);
  font-size: 14px;
  cursor: pointer;
  align-self: flex-start;
  padding: 4px 0;
  transition: color 0.2s;
}

.add-memory-back:hover {
  color: rgba(255, 200, 220, 1);
}

.add-memory-label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-family: var(--font-family);
  font-size: 0.9em;
  color: rgba(255, 220, 230, 0.8);
}

.add-memory-input {
  padding: 10px 14px;
  border: 1px solid rgba(255, 200, 220, 0.25);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-family: var(--font-family);
  font-size: 15px;
  outline: none;
  transition: border-color 0.2s;
}

.add-memory-input:focus {
  border-color: rgba(255, 150, 180, 0.5);
}

.add-memory-textarea {
  padding: 12px 14px;
  border: 1px solid rgba(255, 200, 220, 0.25);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-family: "Georgia", serif;
  font-size: 15px;
  line-height: 1.6;
  outline: none;
  resize: vertical;
  min-height: 80px;
  transition: border-color 0.2s;
}

.add-memory-textarea:focus {
  border-color: rgba(255, 150, 180, 0.5);
}

.add-memory-hint {
  font-size: 0.8em;
  color: rgba(255, 200, 220, 0.5);
  margin-top: 2px;
}

.add-memory-upload {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.add-memory-upload-btn {
  padding: 12px 18px;
  font-family: var(--font-family);
  font-size: 14px;
  border: 2px dashed rgba(255, 200, 220, 0.3);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  color: rgba(255, 220, 230, 0.8);
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}

.add-memory-upload-btn:hover {
  border-color: rgba(255, 200, 220, 0.5);
  background: rgba(255, 255, 255, 0.08);
}

.add-memory-preview {
  border-radius: 12px;
  overflow: hidden;
  max-height: 200px;
}

.add-memory-preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 8px;
  border-radius: 12px;
  overflow: hidden;
  max-height: 280px;
  overflow-y: auto;
}

.add-memory-preview-media {
  width: 100%;
  max-height: 200px;
  object-fit: cover;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.1);
}

.add-memory-file-info {
  display: block;
  text-align: center;
  font-size: 11px;
  color: rgba(255, 180, 200, 0.8);
  margin-top: 6px;
  font-family: 'Courier Prime', monospace;
  letter-spacing: 0.3px;
}

.add-memory-save-btn {
  padding: 14px 28px;
  font-family: var(--font-family);
  font-size: 16px;
  border: none;
  border-radius: 30px;
  background: linear-gradient(135deg, #ff4d6d, #ff85a2);
  color: white;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 16px rgba(255, 77, 109, 0.35);
  align-self: center;
}

.add-memory-save-btn:hover:not(:disabled) {
  transform: scale(1.04);
  box-shadow: 0 6px 24px rgba(255, 77, 109, 0.5);
}

.add-memory-save-btn:disabled {
  opacity: 0.6;
  cursor: default;
}

.add-memory-saved {
  text-align: center;
  padding: 40px 0;
}

.add-memory-saved-icon {
  font-size: 3em;
  margin-bottom: 12px;
  animation: loadPulse 1s ease-in-out infinite;
}

.add-memory-saved p {
  font-family: var(--font-family);
  font-size: 1.3em;
  color: rgba(255, 230, 240, 0.95);
}

/* ===== FAB (Floating Add Button) Ã¢â‚¬â€ vertically centered with postbox ===== */
.add-memory-fab {
  position: absolute;
  bottom: 38px;
  right: 30px;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, #ff4d6d, #ff85a2);
  color: white;
  font-size: 27px;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(255, 77, 109, 0.5);
  z-index: 100;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.add-memory-fab:hover {
  transform: scale(1.1) rotate(90deg);
  box-shadow: 0 6px 28px rgba(255, 77, 109, 0.7);
}

/* ===== Admin Badge ===== */
.admin-badge {
  position: absolute;
  top: 18px;
  right: 18px;
  background: rgba(255, 77, 109, 0.8);
  color: white;
  font-family: var(--font-family);
  font-size: 12px;
  padding: 6px 14px;
  border-radius: 20px;
  z-index: 100;
  animation: fadeIn 0.3s ease;
}

/* ===== Edit Actions ===== */
.edit-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 20px;
}

/* Ã¢â€â‚¬Ã¢â€â‚¬ Edit Memory modal: restyle dark-themed form elements for cream bg Ã¢â€â‚¬Ã¢â€â‚¬ */
.letter-modal .add-memory-input,
.letter-modal .add-memory-textarea {
  background: #fff !important;
  color: #4a2040 !important;
  border: 2px solid #f3c4d8 !important;
}
.letter-modal .add-memory-input::placeholder,
.letter-modal .add-memory-textarea::placeholder {
  color: #c89aaa;
}
.letter-modal .add-memory-input:focus,
.letter-modal .add-memory-textarea:focus {
  border-color: #e75480 !important;
  box-shadow: 0 0 0 3px rgba(231, 84, 128, 0.15);
}
.letter-modal .add-memory-label {
   color: #8b3a62;
  font-size: 0.95em;
  margin-bottom: 8px;
}
.letter-modal .letter-title {
  color: #c2185b;
}
.letter-modal .add-memory-save-btn {
  margin-top: 8px;
}
.letter-modal .edit-actions {
  margin-top: 24px;
}
.letter-modal .edit-delete-btn {
  background: rgba(220, 50, 50, 0.08);
  border-color: rgba(220, 50, 50, 0.3);
}

.edit-delete-btn {
  padding: 10px 20px;
  font-family: var(--font-family);
  font-size: 14px;
  border: 1px solid rgba(220, 50, 50, 0.4);
  border-radius: 20px;
  background: rgba(220, 50, 50, 0.1);
  color: #e74c3c;
  cursor: pointer;
  transition: all 0.2s;
}

.edit-delete-btn:hover {
  background: rgba(220, 50, 50, 0.2);
  border-color: rgba(220, 50, 50, 0.6);
}

/* ===== Media Story Modal Ã¢â‚¬â€ click a gallery box to view/add/edit ===== */
.media-story-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
   height: 100dvh;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.3s ease;
  padding: 20px;
  box-sizing: border-box;
}

.media-story-modal {
  width: 96%;
  max-width: 720px;
  max-height: 92vh;
  max-height: 92dvh;
  background: linear-gradient(135deg, rgba(40, 15, 35, 0.95), rgba(60, 20, 50, 0.92));
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255, 200, 220, 0.2);
  border-radius: 24px;
  padding: 0;
  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.5),
    0 0 40px rgba(255, 80, 140, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  position: relative;
  animation: slideUp 0.35s ease;
  overflow: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.media-story-close {
  position: absolute;
  top: 12px;
  right: 14px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  font-size: 18px;
  color: rgba(255, 220, 230, 0.9);
  cursor: pointer;
  transition: all 0.2s;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
}

.media-story-close:hover {
  background: rgba(233, 30, 99, 0.6);
  transform: scale(1.1);
}

/* Media display area Ã¢â‚¬â€ large viewport-proportional image */
.media-story-media-wrapper {
  width: 100%;
  max-height: 70vh;
  min-height: 30vh;
  overflow: hidden;
  border-radius: 24px 24px 0 0;
  background: rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.media-story-media {
  width: 100%;
  max-height: 70vh;
  object-fit: contain;
  display: block;
}

/* View mode Ã¢â‚¬â€ story content */
.media-story-content {
  padding: 24px 28px 28px;
}

.media-story-title {
  font-family: 'Playfair Display', serif;
  font-size: 22px;
  font-weight: 700;
  color: #ffd6e3;
  margin: 0 0 6px;
  line-height: 1.3;
  text-shadow: 0 0 8px rgba(255, 100, 150, 0.3);
}

.media-story-date {
  font-family: var(--font-family);
  font-size: 13px;
  color: rgba(255, 180, 200, 0.7);
  margin: 0 0 16px;
  font-style: italic;
}

.media-story-text {
  font-family: var(--font-family);
  font-size: 15px;
  color: rgba(255, 230, 240, 0.9);
  line-height: 1.7;
  margin: 0 0 20px;
  white-space: pre-wrap;
  word-wrap: break-word;
}

/* Form mode */
.media-story-form {
  padding: 24px 28px 28px;
}

.media-story-form-title {
  font-family: 'Playfair Display', serif;
  font-size: 20px;
  font-weight: 600;
  color: #ffd6e3;
  margin: 0 0 20px;
  text-align: center;
  text-shadow: 0 0 8px rgba(255, 100, 150, 0.3);
}

.media-story-label {
  display: flex;
  flex-direction: column;
  font-family: var(--font-family);
  font-size: 13px;
  font-weight: 600;
  color: rgba(255, 200, 220, 0.8);
  margin-bottom: 16px;
  gap: 6px;
}

.media-story-input {
  width: 100%;
  padding: 12px 16px;
  font-family: var(--font-family);
  font-size: 15px;
  border: 1px solid rgba(255, 200, 220, 0.2);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 230, 240, 0.95);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-sizing: border-box;
}

.media-story-input:focus {
  border-color: rgba(255, 100, 150, 0.5);
  box-shadow: 0 0 12px rgba(255, 80, 140, 0.2);
}

.media-story-textarea {
  width: 100%;
  padding: 12px 16px;
  font-family: var(--font-family);
  font-size: 15px;
  border: 1px solid rgba(255, 200, 220, 0.2);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 230, 240, 0.95);
  outline: none;
  resize: vertical;
  min-height: 80px;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-sizing: border-box;
}

.media-story-textarea:focus {
  border-color: rgba(255, 100, 150, 0.5);
  box-shadow: 0 0 12px rgba(255, 80, 140, 0.2);
}

/* Action buttons */
.media-story-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 8px;
  flex-wrap: wrap;
}

.media-story-btn {
  padding: 12px 24px;
  font-family: 'Playfair Display', serif;
  font-size: 15px;
  font-weight: 600;
  border: none;
  border-radius: 22px;
  cursor: pointer;
  transition: all 0.25s ease;
  letter-spacing: 0.3px;
}

.media-story-btn-save {
  background: linear-gradient(135deg, rgba(233, 30, 99, 0.85), rgba(255, 64, 129, 0.85));
  color: white;
  box-shadow: 0 4px 16px rgba(233, 30, 99, 0.35);
}

.media-story-btn-save:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 24px rgba(233, 30, 99, 0.5);
}

.media-story-btn-save:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.media-story-btn-edit {
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 220, 230, 0.9);
  border: 1px solid rgba(255, 200, 220, 0.25);
}

.media-story-btn-edit:hover {
  background: rgba(255, 255, 255, 0.18);
  transform: scale(1.05);
}

.media-story-btn-delete {
  background: rgba(220, 50, 50, 0.12);
  color: #ff6b6b;
  border: 1px solid rgba(220, 50, 50, 0.25);
}

.media-story-btn-delete:hover {
  background: rgba(220, 50, 50, 0.25);
  transform: scale(1.05);
}

.media-story-btn-delete:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.media-story-btn-cancel {
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 220, 230, 0.7);
  border: 1px solid rgba(255, 200, 220, 0.15);
}

.media-story-btn-cancel:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* Saved confirmation */
.media-story-saved {
  padding: 30px 28px;
  text-align: center;
}

.media-story-saved-icon {
  font-size: 48px;
  display: block;
  margin-bottom: 10px;
}

.media-story-saved p {
  font-family: 'Playfair Display', serif;
  font-size: 20px;
  color: #ffd6e3;
  margin: 0;
}

/* Mobile responsive */
@media (max-width: 768px) {
  .media-story-modal {
    width: 96%;
    max-width: 100%;
    max-height: 90vh;
    max-height: 90dvh;
    border-radius: 20px;
  }

  .media-story-media-wrapper {
    max-height: 40vh;
  }

  .media-story-media {
    max-height: 40vh;
  }

  .media-story-content,
  .media-story-form {
    padding: 20px 20px 24px;
  }

  .media-story-title {
    font-size: 19px;
  }

  .media-story-text {
    font-size: 14px;
  }

  .media-story-input,
  .media-story-textarea {
    font-size: 16px; /* prevent iOS zoom */
  }

  .media-story-btn {
    padding: 10px 20px;
    font-size: 14px;
  }
}

/* ===== Showcase Caption (hover overlay on gallery boxes) ===== */
.showcase-caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 10px 12px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
  border-radius: 0 0 12px 12px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.showcase-box:hover .showcase-caption {
  opacity: 1;
  pointer-events: auto;
}

.showcase-caption-text {
  font-family: var(--font-family);
  font-size: 12px;
  color: rgba(255, 255, 255, 0.9);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.showcase-caption-link {
  cursor: pointer;
  font-size: 16px;
  margin-left: 8px;
  transition: transform 0.2s;
  flex-shrink: 0;
}

.showcase-caption-link:hover {
  transform: scale(1.3);
}

/* ===== Responsive Timeline & Mobile Enhancements ===== */
/* Priority targets: iPhone 14 Pro Max (430Ãƒâ€”932), iPhone 16 Pro Max (440Ãƒâ€”956) */
/* Browsers: Safari, Chrome iOS, Facebook Messenger in-app browser (WKWebView) */
@media (max-width: 768px) {
  /* Cinematic pages mobile */
  .cinema-page-content {
    padding: 24px 16px;
    padding-top: calc(24px + var(--sai-top));
    padding-bottom: calc(24px + var(--sai-bottom));
  }
  .cinema-gif {
    max-width: 220px;
  }
  .cinema-text {
    font-size: calc(10px + 2.5vmin);
  }
  .cinema-text-question {
    font-size: calc(12px + 2.5vmin);
  }
  .cinema-enter-btn {
    padding: 18px 40px;
    font-size: 20px;
    /* Ensure tap target is large enough for iOS */
    min-height: 48px;
  }
  .cinema-heading {
    font-size: calc(16px + 3vmin);
  }
  .cinema-body {
    font-size: calc(9px + 1.5vmin);
  }

  /* Ã¢â€â‚¬Ã¢â€â‚¬ FB Messenger / Safari WebView fixes Ã¢â€â‚¬Ã¢â€â‚¬ */
  /* These browsers eat ~90px of viewport with their chrome */
  .cinema-intro,
  .cinema-page {
    height: 100vh;
    height: 100dvh;
    height: -webkit-fill-available;
  }

  /* Reduce film grain on mobile for performance in WebViews */
  .cinema-grain {
    opacity: 0.015;
    animation: none; /* Kill animation to save GPU in WebViews */
  }

  /* Reduce floating particles for WebView performance */
  .cinema-particle {
    will-change: auto; /* Reduce GPU layers in FB Messenger */
  }

  /* Timeline mobile Ã¢â‚¬â€ left-aligned "Path" layout */
  .story-timeline {
    padding-left: 6px;
    overflow-x: hidden;
    box-sizing: border-box;
    width: 100%;
  }

  .story-timeline-line {
    left: 16px;
    transform: none;
  }

  .story-timeline-scroll {
    padding: 120px 6px 100px;
    padding-bottom: calc(100px + env(safe-area-inset-bottom, 0px));
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
    overflow-x: hidden;
  }

  /* All nodes branch to the right only Ã¢â‚¬â€ single column */
  .timeline-node {
    width: auto;
    margin-left: 36px !important;
    margin-right: 0 !important;
    padding-left: 14px !important;
    padding-right: 0 !important;
    text-align: left !important;
    margin-bottom: 16px;
    box-sizing: border-box;
  }

  .timeline-dot {
    left: -28px !important;
    right: auto !important;
    width: 24px;
    height: 24px;
  }
  .timeline-dot .timeline-dot-icon {
    font-size: 11px;
  }

  /* Timeline card: full width, no crop on media */
  .timeline-card {
    width: 100% !important;
    max-width: none !important;
    box-sizing: border-box;
    min-width: 0;
    overflow: hidden;
  }

  .timeline-media-el {
    object-fit: contain !important;
    max-height: 260px;
    background: rgba(0, 0, 0, 0.15);
  }

  .timeline-date {
    font-size: 0.72em;
  }

  .timeline-card-title {
    font-size: 1em;
  }

  .timeline-card-text {
    font-size: 0.9em;
  }

  /* ── Compact timeline card (collapsed tray) ── */
  .timeline-card-compact {
    padding: 0 !important;
    cursor: pointer;
    overflow: hidden;
    transition: all 0.35s cubic-bezier(0.25, 1, 0.5, 1);
  }
  .timeline-compact-tray {
    display: flex;
    align-items: stretch;
    gap: 0;
    width: 100%;
    min-height: 72px;
    min-width: 0;
    overflow: hidden;
  }
  /* — Left accent border per category — */
  .timeline-compact-tray::before {
    content: '';
    flex-shrink: 0;
    width: 3px;
    border-radius: 3px 0 0 3px;
    background: linear-gradient(180deg, #ff6b8a, #ff85a2);
  }
  .timeline-compact-tray--letter::before {
    background: linear-gradient(180deg, #ffc078, #ffab6b);
  }
  .timeline-compact-tray--note::before {
    background: linear-gradient(180deg, #a78bfa, #c4b5fd);
  }
  .timeline-compact-tray--event::before {
    background: linear-gradient(180deg, #60a5fa, #93c5fd);
  }

  /* — Text area — */
  .timeline-compact-text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 10px 10px 10px 12px;
    justify-content: center;
  }
  .timeline-compact-header {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 1px;
  }
  .timeline-compact-icon {
    font-size: 11px;
    line-height: 1;
  }
  .timeline-compact-date {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 0.65em;
    color: rgba(255, 200, 220, 0.45);
    letter-spacing: 0.3px;
  }
  .timeline-date-hidden {
    display: none;
  }
  .timeline-compact-text .timeline-card-title {
    font-size: 0.88em;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
  }
  .timeline-card-snippet {
    font-family: "Georgia", serif;
    font-size: 0.78em;
    color: rgba(255, 220, 230, 0.55);
    line-height: 1.35;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .timeline-tap-hint,
  .timeline-compact-text .timeline-letter-prompt {
    font-size: 0.68em;
    color: rgba(255, 200, 220, 0.35);
    margin-top: 1px;
  }

  /* — Media thumbnails area (right side) — */
  .timeline-compact-media {
    display: flex;
    gap: 2px;
    flex-shrink: 0;
    align-items: stretch;
    align-self: stretch;
    max-width: 40%;
  }
  .timeline-compact-thumb {
    width: 52px;
    height: 100%;
    min-height: 68px;
    object-fit: cover;
    background: rgba(0, 0, 0, 0.2);
    display: block;
  }
  /* Single thumb — round the right corners */
  .timeline-compact-media:not(.timeline-compact-media--duo) .timeline-compact-thumb {
    border-radius: 0 16px 16px 0;
  }
  /* Duo thumbs — only last one gets rounded right corners */
  .timeline-compact-media--duo .timeline-compact-thumb:last-of-type {
    border-radius: 0 16px 16px 0;
  }
  .timeline-compact-more {
    width: 28px;
    min-height: 68px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.68em;
    font-weight: 600;
    color: rgba(255, 200, 220, 0.7);
    background: rgba(255, 255, 255, 0.06);
    border-radius: 0 16px 16px 0;
  }

  /* — No-media placeholder (category icon) — */
  .timeline-compact-placeholder {
    width: 44px;
    min-height: 68px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    border-radius: 0 16px 16px 0;
    background: linear-gradient(135deg, rgba(255, 107, 138, 0.15), rgba(255, 133, 162, 0.08));
    opacity: 0.7;
  }
  .timeline-compact-placeholder--letter {
    background: linear-gradient(135deg, rgba(255, 192, 120, 0.15), rgba(255, 171, 107, 0.08));
  }
  .timeline-compact-placeholder--note {
    background: linear-gradient(135deg, rgba(167, 139, 250, 0.15), rgba(196, 181, 253, 0.08));
  }
  .timeline-compact-placeholder--event {
    background: linear-gradient(135deg, rgba(96, 165, 250, 0.15), rgba(147, 197, 253, 0.08));
  }

  /* — Collapse button — */
  .timeline-collapse-btn {
    display: block;
    width: 100%;
    margin-top: 10px;
    padding: 6px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 200, 220, 0.15);
    border-radius: 8px;
    color: rgba(255, 200, 220, 0.5);
    font-size: 0.72em;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    cursor: pointer;
    transition: background 0.2s;
  }
  .timeline-collapse-btn:active {
    background: rgba(255, 255, 255, 0.12);
  }
  .timeline-card-media-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
    margin-top: 8px;
  }
  .timeline-card-media-grid img,
  .timeline-card-media-grid video {
    width: 100%;
    height: auto;
    border-radius: 10px;
    object-fit: cover;
    max-height: 200px;
  }

  .add-memory-modal {
    width: 95%;
    padding: 24px 14px 20px;
    max-height: 80dvh;
    max-height: 80vh;
    -webkit-overflow-scrolling: touch;
  }

  .letter-reader-modal {
    width: 92%;
    padding: 28px 18px 22px;
    max-height: 80dvh;
    max-height: 80vh;
    -webkit-overflow-scrolling: touch;
  }

  .admin-badge {
    top: auto;
    bottom: 80px;
    right: 16px;
    font-size: 10px;
  }

  /* Starfield fewer particles visual effect */
  .starfield-canvas {
    opacity: 0.7;
  }

  /* Showcase boxes Ã¢â‚¬â€ no extra backdrop blur on mobile, keep crisp */

  /* iOS Safari/Chrome: prevent rubber-banding on fixed layouts */
  .memory-lane {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    height: 100dvh;
    height: -webkit-fill-available;
  }

  /* Letter overlay Ã¢â‚¬â€ full viewport in WebViews */
  .letter-overlay,
  .letter-reader-overlay,
  .add-memory-overlay {
    height: 100vh;
    height: 100dvh;
    height: -webkit-fill-available;
  }
}

/* â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•
   iPHONE PWA â€” High-density Retina + Standalone Safe Areas
   Targets: iPhone 14 Pro Max (430Ã—932), iPhone 16 Pro Max (440Ã—956)
   â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â• */
@media only screen and (max-device-width: 480px) and (-webkit-min-device-pixel-ratio: 2) {
  /* Clock header: clear the Dynamic Island / notch */
  .love-counter-overlay {
    padding-top: calc(10px + env(safe-area-inset-top, 0px));
  }

  /* Bottom nav: clear the home indicator (compact height) */
  .mobile-bottom-nav {
    padding-bottom: calc(4px + env(safe-area-inset-bottom, 0px));
    height: calc(52px + env(safe-area-inset-bottom, 0px));
  }

  /* Timeline media: let vertical photos breathe â€” no max-height crop */
  .timeline-media-el {
    max-height: 60vh !important;
    object-fit: contain !important;
  }

  /* Timeline cards stretch to fit tall photos */
  .timeline-card-media {
    max-height: none;
    overflow: visible;
  }
}

/* â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•
   MOBILE HARMONY â€” Clock, Bottom Nav, Polish
   Designed for iPhone 14/16 Pro Max (430â€“440 Ã— 932â€“956)
   â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â• */

/* â€” 1. Tabular-lining numerals for clock â€” prevents jittery width â€” */
.love-counter-num {
  font-variant-numeric: tabular-nums lining-nums;
}

/* â€” 2. Pulse-glow keyframe synced to clock seconds via CSS custom property â€” */
@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 0 18px var(--glow-color, rgba(255,150,180,0.25)), 0 4px 16px rgba(0,0,0,0.10); }
  50% { box-shadow: 0 0 28px var(--glow-color, rgba(255,150,180,0.45)), 0 4px 20px rgba(0,0,0,0.15); }
}

/* â€” 3. (Removed ambient-bob â€” was causing mobile jitter) â€” */

/* â€” 4. Cinematic grain overlay for memory-lane (very subtle) â€” */
.memory-lane::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.06'/%3E%3C/svg%3E");
  opacity: 0.018;
  pointer-events: none;
  z-index: 0;
  mix-blend-mode: overlay;
}

/* â€” 5. Matched border-radius across the system (16 px base) â€” */
.showcase-box { border-radius: 16px; }
.showcase-media { border-radius: 14px; }
.timeline-card { border-radius: 16px; }
.letter-reader-modal { border-radius: 20px; }
.add-memory-modal { border-radius: 20px; }
.view-switcher { border-radius: 32px; }

/* â€” 6. Timeline card dark glassmorphism backing â€” */
.timeline-card {
  background: rgba(30, 10, 25, 0.55);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 200, 220, 0.18);
}
.timeline-card:hover {
  background: rgba(40, 15, 35, 0.65);
  border-color: rgba(255, 200, 220, 0.35);
}

/* â€” 7. Timeline date pill backgrounds â€” */
.timeline-date {
  display: inline-block;
  background: rgba(255, 100, 150, 0.12);
  padding: 3px 10px;
  border-radius: 12px;
  color: rgba(255, 200, 220, 0.75);
}

/* â€” 8. Letter Reader â€” dark ink on parchment â€” */
.letter-reader-content {
  color: #2c1810;
}
.letter-reader-title {
  color: #4a1e2e;
}
.letter-reader-date {
  color: #6b3a4a;
}
.letter-reader-signature {
  color: #8b2252;
}
.letter-reader-lock-msg {
  color: #4a1e2e;
}

/* â€” 9. Background blur when timeline is active â€” */
.story-timeline-scroll ~ .starfield-canvas {
  filter: blur(3px);
  transition: filter 0.5s ease;
}

/* â€” Timeline-active mode: general (all viewports) â€” */
.memory-lane--timeline .postbox-wrapper {
  display: none;
}
.memory-lane--timeline .love-counter-growing {
  display: none;
}

/* â€” 10. Timeline card zoom on hover â€” */
.timeline-card:hover {
  transform: translateY(-3px) scale(1.015);
}

/* â€” 11. Mobile timeline entrance â€” slide-in from left with scale â€” */
@media (max-width: 768px) {
  .timeline-node {
    transform: translateX(-20px) translateY(20px);
    opacity: 0;
    transition: opacity 0.5s ease, transform 0.5s cubic-bezier(0.25, 1, 0.5, 1);
  }
  .timeline-node-visible {
    opacity: 1;
    transform: translateX(0) translateY(0);
  }
  /* Active/tap state for timeline cards on touch */
  .timeline-card:active {
    transform: scale(0.98);
    transition: transform 0.1s ease;
  }
}
/* =========================================
   CLEAN NOTEBOOK – Private Journal (2103)
   Ivory Tower Desktop · Clean Mobile
   ========================================= */

/* ── Universal Fluid Typography Scale ── */
html {
  /* Scales entire UI to ~87.5% — no browser zoom needed */
  font-size: 14px;
}
:root {
  --fs-xs: clamp(0.6rem, 0.5vw + 0.4rem, 0.72rem);
  --fs-sm: clamp(0.72rem, 0.6vw + 0.45rem, 0.85rem);
  --fs-base: clamp(0.85rem, 0.7vw + 0.5rem, 1rem);
  --fs-md: clamp(0.95rem, 0.8vw + 0.5rem, 1.15rem);
  --fs-lg: clamp(1.1rem, 1vw + 0.5rem, 1.4rem);
  --fs-xl: clamp(1.3rem, 1.2vw + 0.5rem, 1.7rem);
  --fs-2xl: clamp(1.5rem, 1.5vw + 0.5rem, 2.2rem);
  --sp-xs: clamp(2px, 0.3vw, 4px);
  --sp-sm: clamp(4px, 0.5vw, 8px);
  --sp-md: clamp(8px, 1vw, 16px);
  --sp-lg: clamp(12px, 1.5vw, 24px);

  /* ── Color Tokens (Light / Ivory Tower) ── */
  --bg-primary: #fdfdfd;
  --bg-secondary: #faf8f5;
  --bg-tertiary: #f5f1ec;
  --bg-hover: #ebe6df;
  --bg-input: #fff;
  --bg-card: #fff;
  --bg-overlay: rgba(250, 248, 245, 0.95);

  --text-primary: #1a1a1a;
  --text-secondary: #2c1810;
  --text-muted: #555;
  --text-faint: #888;
  --text-placeholder: #c0b8a8;

  --border-primary: #e8e3db;
  --border-secondary: #d1cdc5;
  --border-accent: #8b7355;

  --accent-primary: #8b7355;
  --accent-warm: #c9a96e;
  --accent-success: #22c55e;
  --accent-error: #ef4444;
  --accent-warning: #f59e0b;
  --accent-info: #3b82f6;
  --accent-purple: #8b5cf6;

  /* Citation pill palette */
  --citation-bg: #f0ecff;
  --citation-bg-end: #e8e0ff;
  --citation-text: #6d28d9;
  --citation-border: rgba(139, 92, 246, 0.2);
  --citation-bg-hover: #e8e0ff;
  --citation-bg-hover-end: #ddd4ff;
  --citation-border-hover: rgba(139, 92, 246, 0.35);

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 2px 8px rgba(0,0,0,0.10), 0 1px 3px rgba(0,0,0,0.06);
  --shadow-lg: 0 4px 24px rgba(0,0,0,0.12), 0 2px 6px rgba(0,0,0,0.06);

  /* ── Standardised Border Radius Scale ── */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
}

.notebook-container {
  background: var(--bg-primary);
  color: var(--text-primary);
  height: 100vh;
  height: 100dvh;
  width: 100%;
  max-width: 860px;
  margin: 0 auto;
  padding: var(--sp-md) 20px 0;
  padding-top: calc(var(--sp-md) + env(safe-area-inset-top, 0px));
  font-family: 'Georgia', 'Times New Roman', serif;
  text-align: left;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
}

/* ── Mobile container: full bleed, no dark gaps ── */
.notebook-container.mobile-layout {
  max-width: 100%;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  min-height: 100dvh;
  padding: 6px 12px 0;
  padding-top: calc(6px + env(safe-area-inset-top, 0px));
}

/* ── Header ── */
.notebook-header {
  border-bottom: 1px solid var(--border-primary);
  margin-bottom: var(--sp-sm);
  padding-bottom: var(--sp-xs);
  flex-shrink: 0;
}
.notebook-header h1 {
  font-family: 'Playfair Display', 'Georgia', serif;
  font-size: var(--fs-xl);
  font-weight: 700;
  margin: 0;
  color: var(--text-primary);
  letter-spacing: 0.5px;
}
.notebook-header p {
  margin: 4px 0 0;
  font-size: var(--fs-xs);
  color: var(--text-faint);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  text-transform: uppercase;
  letter-spacing: 2px;
}

/* ── Composer ── */
.notebook-composer {
  background: var(--bg-card);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-md);
  padding: var(--sp-md);
  margin-bottom: var(--sp-sm);
  position: relative;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  overflow: visible;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s ease;
}
.notebook-composer:focus-within {
  box-shadow: var(--shadow-md);
}
.notebook-composer textarea {
  width: 100%;
  border: none;
  font-family: 'Times New Roman', Times, serif;
  font-size: 12pt;
  resize: none;
  min-height: 200px;
  outline: none;
  line-height: 1.15;
  color: var(--text-primary);
  box-sizing: border-box;
  overflow-y: hidden; /* auto-grow handles scrolling */
  flex: 1;
  min-height: 0;
  /* paragraph spacing: 0 before, 6pt after — simulated via padding */
  padding-bottom: 6pt;
}
.notebook-composer textarea::placeholder {
  color: var(--text-placeholder);
}
.notebook-controls {
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
  margin-top: 6px;
  border-top: 1px solid var(--border-primary);
  padding-top: 6px;
  flex-shrink: 0;
  flex-wrap: wrap;
  min-height: 0;
}
.copyright-watermark {
  white-space: nowrap;
  font-size: 9px;
  color: var(--text-muted);
  opacity: 0.5;
  margin-left: auto;
  flex-shrink: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  letter-spacing: 0.2px;
}
.attach-btn {
  cursor: pointer;
  font-size: calc(var(--fs-sm) * 1.15);
  color: var(--text-muted);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  transition: color 0.2s;
  padding: 4px 0;
  flex-shrink: 0;
}
.attach-btn:hover {
  color: var(--text-primary);
}
/* ── PDF Extract Button ── */
.pdf-extract-btn {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 5px 12px;
  font-size: var(--fs-xs);
  cursor: pointer;
  transition: opacity 0.2s, transform 0.1s;
  white-space: nowrap;
}
.pdf-extract-btn:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}
.pdf-extract-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}
/* ── Feed ── */
.notebook-feed {
  display: flex;
  flex-direction: column;
  gap: 0;
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  padding-bottom: 24px;
}

/* Mobile scrollable area below composer */
.mobile-scroll-area {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  -webkit-overflow-scrolling: touch;
}
.mobile-scroll-area .notebook-feed {
  overflow-y: visible;
  flex: none;
}

/* Desktop scrollable area below composer */
.desktop-scroll-area {
  flex: 1;
  overflow-y: auto !important;
  min-height: 0 !important; /* Magic rule to ensure flexbox scrolling works */
  padding-bottom: 80px;
}
.desktop-scroll-area .notebook-feed {
  overflow-y: visible;
  flex: none;
}
.notebook-empty {
  text-align: center;
  color: var(--text-placeholder);
  font-size: var(--fs-md);
  margin-top: 40px;
  font-style: italic;
}

/* ── Entry ── */
.notebook-entry {
  padding: 24px 0;
  border-bottom: 1px solid var(--border-primary);
}
.notebook-entry:first-child {
  padding-top: 0;
}
.notebook-entry time {
  display: block;
  font-size: var(--fs-xs);
  color: var(--text-faint);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-bottom: 8px;
}
.entry-content p {
  font-size: var(--fs-md);
  line-height: 1.85;
  color: var(--text-primary);
  margin: 0;
  white-space: pre-wrap;
}
.notebook-entry img {
  max-width: 100%;
  border-radius: 4px;
  margin-top: 18px;
}

/* ── Mobile adjustments ── */
@media (max-width: 768px) {
  .notebook-container {
    padding: 12px 16px 0;
    padding-top: calc(12px + env(safe-area-inset-top, 0px));
  }
  .notebook-header h1 {
    font-size: var(--fs-xl);
  }
  .notebook-composer textarea {
    font-size: 16px; /* >= 16px prevents iOS auto-zoom on focus */
    min-height: 120px;
  }
  .entry-content p {
    font-size: var(--fs-base);
    line-height: 1.75;
  }
}

/* ── Header row (date + save indicator) ── */
.notebook-header-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.save-indicator {
  font-size: var(--fs-xs);
  color: var(--text-faint);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  letter-spacing: 0.5px;
  white-space: nowrap;
  transition: opacity 0.3s;
}

/* ── Daily Composer tweaks ── */
.notebook-composer--daily textarea {
  min-height: 260px; /* base; desktop override in DESKTOP COMPOSER-FIRST section */
}
.composer-hint {
  font-size: var(--fs-xs);
  color: var(--text-placeholder);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  letter-spacing: 0.5px;
}

/* ═════════════════════════════════════════
   BUJO PARSER (NoteParser.js)
   ═════════════════════════════════════════ */
.bujo-parsed {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.bujo-bullet,
.bujo-task,
.bujo-task-done,
.bujo-task-migrated,
.bujo-insight,
.bujo-plain {
  font-size: var(--fs-base);
  line-height: 1.75;
  color: var(--text-primary);
  margin: 0;
}
.bujo-symbol {
  display: inline-block;
  width: 22px;
  font-size: var(--fs-sm);
  text-align: center;
  margin-right: 6px;
  flex-shrink: 0;
  color: var(--text-muted);
}
.bujo-bullet {
  display: flex;
  align-items: baseline;
  padding-left: 8px;
}
.bujo-task {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  color: var(--text-primary);
  padding-left: 8px;
  margin-bottom: 4px;
}
.bujo-task-done {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  text-decoration: line-through;
  opacity: 0.55;
  color: var(--text-faint);
  padding-left: 8px;
  margin-bottom: 4px;
}
.bujo-task-migrated {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  color: var(--text-faint);
  font-style: italic;
  text-decoration: line-through;
  padding-left: 8px;
  margin-bottom: 4px;
}
.bujo-insight {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  border-left: 3px solid #ffd700;
  padding: 8px 12px;
  font-weight: 600;
  background: rgba(255, 215, 0, 0.15);
  border-radius: 0 4px 4px 0;
  margin: 10px 0;
  color: var(--text-secondary);
}
.bujo-exclaim {
  flex-shrink: 0;
  font-size: var(--fs-sm);
}
/* Interactive checkboxes */
.bujo-box.clickable {
  cursor: pointer;
  transition: color 0.2s;
  user-select: none;
}
.bujo-box.clickable:hover {
  color: var(--text-secondary);
}
.bujo-task.completed {
  color: var(--text-faint);
}
.bujo-image {
  max-width: 100%;
  border-radius: 4px;
  margin: 12px 0;
}
.bujo-file-link {
  display: inline-block;
  color: #0056b3;
  text-decoration: none;
  font-size: var(--fs-sm);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-tertiary);
  padding: 6px 14px;
  border-radius: 6px;
  margin: 6px 0;
  transition: background 0.15s;
}
.bujo-file-link:hover {
  background: var(--bg-hover);
  text-decoration: underline;
}
.bujo-spacer {
  height: 8px;
}
.bujo-tag {
  color: #0056b3;
  font-weight: 600;
  cursor: pointer;
  border-radius: 3px;
  transition: background 0.15s;
}
.bujo-tag:hover {
  background: rgba(0, 86, 179, 0.08);
}
.bujo-wikilink {
  color: var(--text-secondary);
  text-decoration: underline;
  text-decoration-style: dotted;
  cursor: pointer;
}
.clickable-wikilink {
  color: var(--text-secondary);
  text-decoration: underline dotted;
  cursor: pointer;
  transition: background-color 0.2s;
  border-radius: 3px;
  padding: 0 2px;
}
.clickable-wikilink:hover {
  background-color: rgba(74, 44, 42, 0.1);
}
.clickable-wikilink:focus-visible {
  outline: 2px solid #4a2c2a;
  outline-offset: 1px;
}
/* Sprint 43: Invalid citation in plain-text renderer */
.citation-invalid {
  color: #991b1b;
  background: #fee2e2;
  border-radius: 3px;
  padding: 0 4px;
  font-style: italic;
  cursor: help;
  text-decoration: none;
}

/* ═════════════════════════════════════════
   DISCOVERY ENGINE (Search + Tag Cloud)
   ═════════════════════════════════════════ */
.journal-discovery {
  margin-bottom: 0;
  border-top: none;
  padding-top: 0;
  flex-shrink: 0;
}
.journal-search {
  width: 100%;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border-secondary);
  font-family: 'Georgia', serif;
  font-size: var(--fs-md);
  padding: 4px 0;
  color: var(--text-primary);
  outline: none;
  box-sizing: border-box;
  transition: border-color 0.2s;
}
.journal-search:focus {
  border-bottom-color: var(--text-faint);
}
.journal-search::placeholder {
  color: var(--text-placeholder);
  font-style: italic;
}

/* ── Search Row: flex container for search + synthesize button ── */
.search-row {
  display: flex;
  gap: 10px;
  align-items: center;
  width: 100%;
  margin-bottom: 4px;
}
.search-row .journal-search {
  flex: 1;
  margin-bottom: 0;
}

.search-scope-toggle {
  display: flex;
  background: var(--bg-tertiary);
  padding: 3px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-primary);
  margin-left: 4px;
}

.scope-btn {
  padding: 5px 12px;
  border-radius: calc(var(--radius-md) - 2px);
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.82em;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.scope-btn:hover:not(:disabled) {
  color: var(--text-primary);
  background: rgba(0,0,0,0.03);
}

.scope-btn.active {
  background: var(--bg-card);
  color: var(--accent-purple);
  box-shadow: var(--shadow-sm);
  font-weight: 600;
}

.scope-btn:disabled {
  opacity: 0.6;
  cursor: wait;
}

.import-btn {
  margin-left: auto;
  font-size: 0.82em;
  padding: 4px 10px !important;
  border: 1px solid var(--accent-purple) !important;
  border-radius: 6px;
  color: var(--accent-purple) !important;
  background: transparent !important;
}

.import-btn:hover {
  background: rgba(139, 92, 246, 0.08) !important;
}

/* ── Weekly Insight Tracker ── */
.weekly-insight-tracker {
  font-size: var(--fs-sm);
  color: var(--text-secondary);
  font-weight: 600;
  padding: 4px 0;
}
.weekly-insight-tracker.tracker-ready {
  color: #4a7c59;
}
.tracker-bar {
  height: 3px;
  background: var(--border-primary);
  border-radius: 2px;
  margin-top: 4px;
  overflow: hidden;
}
.tracker-fill {
  height: 100%;
  background: #8b5cf6;
  border-radius: 2px;
  transition: width 0.3s ease;
}
.tracker-ready .tracker-fill {
  background: #4a7c59;
}

/* ── Omnibar Autocomplete ── */
.autocomplete-wrapper {
  position: relative;
  flex: 1;
  display: flex;
}
.autocomplete-wrapper .journal-search {
  flex: 1;
  margin-bottom: 0;
}
.autocomplete-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  max-height: 220px;
  overflow-y: auto;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 8px 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,.1);
  z-index: 1000;
  list-style: none;
  margin: 0;
  padding: 4px 0;
}
.autocomplete-item {
  padding: 6px 14px;
  font-size: var(--fs-sm);
  color: var(--text);
  cursor: pointer;
  transition: background .12s;
}
.autocomplete-item:hover,
.autocomplete-item:focus {
  background: var(--accent-light, #f5ebe0);
}

.synthesize-btn {
  padding: 2px 8px;
  font-size: var(--fs-sm);
  white-space: nowrap;
  line-height: 1.2;
}

.journal-tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
  margin-bottom: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.tag-pill {
  display: inline-block;
  background: var(--bg-tertiary);
  color: var(--text-muted);
  border: none;
  border-radius: 14px;
  padding: 3px 10px;
  font-size: var(--fs-xs);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-weight: 500;
  cursor: pointer;
  letter-spacing: 0.3px;
  transition: background 0.2s, color 0.2s;
  white-space: nowrap;
}
.tag-pill:hover {
  background: var(--bg-hover);
}
.tag-pill--active {
  background: var(--accent-primary);
  color: #fff;
}
.tag-pill--active:hover {
  background: var(--accent-primary);
}

/* ── History separator ── */
.journal-history {
  border-top: none;
  padding-top: 0;
  margin-top: 0;
}

/* ═════════════════════════════════════════
   DAILY SPARK (Zettelkasten resurface)
   ═════════════════════════════════════════ */
.daily-spark {
  margin-top: 60px;
  padding: 24px;
  border-top: 1px solid var(--border-primary);
  text-align: center;
}
.daily-spark .spark-label {
  display: block;
  font-size: var(--fs-xs);
  color: var(--text-placeholder);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 12px;
}
.daily-spark p {
  font-family: 'Georgia', serif;
  font-size: var(--fs-md);
  line-height: 1.7;
  color: var(--text-faint);
  font-style: italic;
  margin: 0;
}
.daily-spark .spark-date {
  display: block;
  font-size: var(--fs-xs);
  color: var(--text-placeholder);
  margin-top: 8px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* ── Mobile adjustments for new journal features ── */
@media (max-width: 768px) {
  .notebook-composer--daily textarea {
    min-height: 160px;
  }
  .journal-tag-cloud {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 4px;
  }
  .journal-search {
    font-size: var(--fs-sm);
  }
  .bujo-bullet,
  .bujo-task,
  .bujo-task-done,
  .bujo-task-migrated,
  .bujo-insight,
  .bujo-plain {
    font-size: var(--fs-sm);
    line-height: 1.65;
  }
  .daily-spark {
    margin-top: 40px;
    padding: 20px 12px;
  }
}

/* ═════════════════════════════════════════
   IDENTITY ANCHOR & HELP MODAL (Cheat Sheet)
   ═════════════════════════════════════════ */
.identity-anchor {
  text-transform: uppercase;
  letter-spacing: 2px;
  font-size: var(--fs-xs);
  color: var(--text-muted);
  text-align: center;
  margin-top: 0;
  margin-bottom: var(--sp-sm);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  border-bottom: 1px solid var(--border-primary);
  padding-bottom: var(--sp-xs);
  flex-shrink: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 700;
}

.help-toggle-btn {
  color: var(--text-faint);
  font-family: 'Georgia', serif;
  font-style: italic;
}

.principles-toggle-btn {
  color: #8b5cf6;
  font-family: 'Georgia', serif;
  font-weight: 700;
}

.principles-toggle-btn:hover {
  background: var(--accent-purple);
  color: #fff;
  border-color: var(--accent-purple);
  transform: scale(1.1);
}

.help-toggle-btn:hover {
  background: var(--accent-primary);
  color: #fff;
  border-color: var(--text-secondary);
  transform: scale(1.1);
}

.help-modal {
  position: fixed;
  bottom: 116px;
  right: max(16px, 2vw);
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-primary);
  box-shadow: 0 8px 30px rgba(0,0,0,0.08);
  border-radius: 12px;
  padding: 20px 24px;
  width: min(580px, 90vw);
  max-height: calc(100vh - 140px);
  overflow-y: auto;
  z-index: 1000;
  animation: helpFadeIn 0.2s ease-out;
}

@keyframes helpFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.help-close-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  background: none;
  border: none;
  font-size: var(--fs-xl);
  line-height: 1;
  cursor: pointer;
  color: var(--text-faint);
  transition: color 0.2s;
}
.help-close-btn:hover { color: var(--text-primary); }

.help-header {
  margin: 0 0 14px 0;
  font-size: var(--fs-sm);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--text-secondary);
}

.help-grid-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.help-column {}

.help-section { margin-bottom: 14px; }
.help-section h4 {
  margin: 0 0 6px 0;
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-faint);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.help-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.help-list li {
  font-size: var(--fs-xs);
  line-height: 1.7;
  color: var(--text-muted);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
.help-list code {
  background: var(--bg-tertiary);
  padding: 1px 5px;
  border-radius: 3px;
  font-size: var(--fs-xs);
  color: var(--text-secondary);
  font-weight: 600;
}

/* ── Mobile: stack help grid ── */
@media (max-width: 768px) {
  .help-modal {
    right: 12px;
    left: 12px;
    width: auto;
    bottom: 64px;
    max-height: 70vh;
  }
  .help-grid-container {
    grid-template-columns: 1fr;
    gap: 12px;
  }
}

/* ═════════════════════════════════════════
   SLIP-BOX VIEW TOGGLE
   ═════════════════════════════════════════ */
.journal-view-toggle {
  display: flex;
  gap: 12px;
  margin-bottom: 0;
  border-bottom: 1px solid var(--border-primary);
  padding-bottom: 0;
  align-items: center;
}
.journal-view-toggle button {
  background: none;
  border: none;
  font-family: 'Georgia', serif;
  font-size: var(--fs-sm);
  color: var(--text-faint);
  cursor: pointer;
  padding: 4px 2px 6px;
  transition: color 0.2s;
}
.journal-view-toggle button.active {
  color: var(--text-primary);
  font-weight: bold;
  border-bottom: 2px solid var(--accent-primary);
}
/* Analytics & Export buttons inline with view-toggle */
.view-toggle-actions {
  margin-left: auto;
  display: flex;
  gap: 4px;
  align-items: center;
}
.view-toggle-action-btn {
  background: none;
  border: none;
  font-size: calc(var(--fs-sm) * 1.2);
  cursor: pointer;
  padding: 2px 4px;
  color: var(--text-faint);
  transition: color 0.15s;
  line-height: 1;
}
.view-toggle-action-btn:hover {
  color: #4a2080;
}

/* ═════════════════════════════════════════
   GHOST GRAPH (Unlinked Mentions)
   ═════════════════════════════════════════ */
.ghost-mention {
  border-bottom: 1px dashed var(--border-secondary);
  cursor: help;
  transition: border-color 0.2s;
}
.ghost-mention:hover {
  border-bottom-color: var(--text-faint);
}

/* ═════════════════════════════════════════
   SPOTLIGHT HIGHLIGHTING (Search)
   ═════════════════════════════════════════ */
.search-highlight {
  background-color: rgba(255, 215, 0, 0.4);
  color: inherit;
  padding: 0 2px;
  border-radius: 2px;
}

/* ═════════════════════════════════════════
   WIKILINK AUTO-COMPLETE DROPDOWN
   ═════════════════════════════════════════ */
.suggestion-dropdown {
  position: fixed;
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--border-primary);
  border-radius: 8px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.12);
  z-index: 50;
  max-height: 200px;
  overflow-y: auto;
  min-width: 200px;
}
.suggestion-item {
  padding: 8px 14px;
  cursor: pointer;
  font-size: var(--fs-sm);
  font-family: 'Georgia', serif;
  color: var(--text-secondary);
  transition: background 0.15s;
}
.suggestion-item:hover {
  background: rgba(74, 44, 42, 0.08);
}
.suggestion-item:first-child {
  border-radius: 8px 8px 0 0;
}
.suggestion-item:last-child {
  border-radius: 0 0 8px 8px;
}

/* ═════════════════════════════════════════
   DEADLINE COUNTDOWN BANNER
   ═════════════════════════════════════════ */
.deadline-banner {
  text-align: center;
  padding: 8px 16px;
  background: rgba(44, 24, 16, 0.05);
  border: 1px solid rgba(44, 24, 16, 0.12);
  border-radius: 8px;
  font-size: var(--fs-base);
  color: var(--text-secondary);
  font-family: 'Georgia', serif;
  margin-bottom: 10px;
  cursor: pointer;
  position: relative;
  transition: background 0.2s;
  flex-shrink: 0;
}
.deadline-banner:hover {
  background: rgba(44, 24, 16, 0.09);
}
.deadline-edit-icon {
  margin-left: 8px;
  opacity: 0;
  transition: opacity 0.2s;
  font-size: var(--fs-xs);
}
.deadline-banner:hover .deadline-edit-icon {
  opacity: 1;
}
.deadline-banner.deadline-editing {
  cursor: default;
  padding: 12px 16px;
}
.deadline-banner.deadline-add {
  opacity: 0.5;
  font-style: italic;
  border-style: dashed;
}
.deadline-banner.deadline-add:hover {
  opacity: 0.8;
}
/* Compact deadline in left panel */
.deadline-banner.deadline-compact {
  font-size: calc(var(--fs-xs) * 1.2);
  padding: 2px 8px;
  margin-bottom: 4px;
  border-radius: 6px;
  background: rgba(44, 24, 16, 0.03);
  border-color: rgba(44, 24, 16, 0.08);
  color: #4a2080;
}
.deadline-edit-row {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
  flex-wrap: wrap;
  justify-content: center;
}
.deadline-input-name {
  flex: 1;
  min-width: 140px;
  padding: 6px 10px;
  border: 1px solid rgba(44, 24, 16, 0.2);
  border-radius: 6px;
  background: var(--bg-card);
  font-family: 'Georgia', serif;
  font-size: var(--fs-sm);
  color: var(--text-secondary);
}
.deadline-input-date {
  padding: 6px 10px;
  border: 1px solid rgba(44, 24, 16, 0.2);
  border-radius: 6px;
  background: var(--bg-card);
  font-family: 'Georgia', serif;
  font-size: var(--fs-sm);
  color: var(--text-secondary);
}
.deadline-edit-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}
.deadline-btn {
  padding: 4px 14px;
  border: none;
  border-radius: 6px;
  font-size: var(--fs-xs);
  font-family: 'Georgia', serif;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}
.deadline-btn:active { transform: scale(0.96); }
.deadline-btn.save {
  background: #4a7c59;
  color: #fff;
}
.deadline-btn.save:hover { background: #3a6a49; }
.deadline-btn.cancel {
  background: rgba(44, 24, 16, 0.1);
  color: var(--text-secondary);
}
.deadline-btn.cancel:hover { background: rgba(44, 24, 16, 0.18); }
.deadline-btn.remove {
  background: rgba(180, 40, 40, 0.1);
  color: #b42828;
}
.deadline-btn.remove:hover { background: rgba(180, 40, 40, 0.2); }

/* ═════════════════════════════════════════
   BACKLINKS PANEL
   ═════════════════════════════════════════ */
.backlinks-panel {
  background: var(--bg-secondary);
  border-left: 4px solid var(--accent-primary);
  padding: 15px;
  margin-bottom: 20px;
  border-radius: 0 8px 8px 0;
}
.backlinks-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.backlinks-header h4 {
  margin: 0;
  font-size: var(--fs-sm);
  color: var(--text-secondary);
  font-family: 'Georgia', serif;
}
.backlinks-close {
  background: none;
  border: none;
  font-size: var(--fs-lg);
  cursor: pointer;
  color: var(--text-faint);
  transition: color 0.2s;
}
.backlinks-close:hover {
  color: var(--text-primary);
}
.backlinks-empty {
  font-size: var(--fs-sm);
  color: var(--text-faint);
  font-style: italic;
}
.backlink-snippet {
  font-size: var(--fs-sm);
  color: var(--text-muted);
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px dashed var(--border-primary);
}
.backlink-snippet:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}
.backlink-snippet time {
  display: block;
  font-size: var(--fs-xs);
  color: var(--text-faint);
  margin-bottom: 4px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
.backlink-snippet p {
  margin: 0;
  line-height: 1.5;
  word-break: break-word;
}

/* ═════════════════════════════════════════
   BUJO HEADING (### lines rendered)
   ═════════════════════════════════════════ */
.bujo-heading {
  font-size: var(--fs-sm);
  font-family: 'Georgia', serif;
  margin: 12px 0 6px 0;
  color: var(--text-secondary);
}

/* ═════════════════════════════════════════
   EXPORT BUTTON (header)
   ═════════════════════════════════════════ */
.export-btn {
  background: none;
  border: none;
  font-size: var(--fs-lg);
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 6px;
  transition: background 0.2s;
  margin-left: 8px;
}
.export-btn:hover { background: rgba(44, 24, 16, 0.08); }

/* ═════════════════════════════════════════
   EXPORT MODAL
   ═════════════════════════════════════════ */
.export-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 20px;
}
.export-modal {
  background: var(--bg-card);
  padding: 28px;
  border-radius: 14px;
  max-width: 420px;
  width: 100%;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
  font-family: 'Georgia', serif;
  color: var(--text-secondary);
  max-height: 90vh;
  overflow-y: auto;
}
.export-modal h3 {
  margin: 0 0 20px 0;
  font-size: var(--fs-md);
  border-bottom: 2px solid var(--border-primary);
  padding-bottom: 12px;
}
.export-group {
  margin-bottom: 18px;
}
.export-label {
  display: block;
  font-weight: bold;
  font-size: var(--fs-sm);
  margin-bottom: 8px;
  color: var(--text-secondary);
}
.export-dates {
  display: flex;
  align-items: center;
  gap: 10px;
}
.export-dates input[type="date"] {
  flex: 1;
  padding: 8px 10px;
  border: 1px solid var(--border-primary);
  border-radius: 8px;
  font-family: 'Georgia', serif;
  font-size: var(--fs-sm);
  color: var(--text-secondary);
}
.export-dates span {
  color: var(--text-faint);
  font-size: var(--fs-sm);
}
.export-checkboxes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.export-cat-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--fs-sm);
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 8px;
  transition: background 0.2s;
}
.export-cat-label:hover { background: rgba(0,0,0,0.03); }
.export-cat-label input[type="checkbox"] {
  accent-color: var(--text-secondary);
  width: 16px;
  height: 16px;
}
.export-cat-self { color: #2e7d32; }
.export-cat-success { color: #1565c0; }
.export-cat-social { color: #e65100; }
.export-cat-service { color: #6a1b9a; }
.export-query {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border-primary);
  border-radius: 8px;
  font-family: 'Georgia', serif;
  font-size: var(--fs-sm);
  color: var(--text-secondary);
  box-sizing: border-box;
}
.export-query::placeholder { color: var(--text-placeholder); }
.export-format-btns {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.export-format-btn {
  flex: 1;
  padding: 8px 6px;
  border: 1px solid var(--border-primary);
  border-radius: 8px;
  background: var(--bg-card);
  font-family: 'Georgia', serif;
  font-size: var(--fs-xs);
  cursor: pointer;
  transition: all 0.2s;
  color: var(--text-secondary);
  text-align: center;
  min-width: 0;
}
.export-format-btn.active {
  background: var(--accent-primary);
  color: #fff;
  border-color: var(--text-secondary);
}
.export-format-btn:hover:not(.active) {
  background: rgba(44, 24, 16, 0.06);
}
.export-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 22px;
}
.export-go {
  background: var(--accent-primary);
  color: #fff;
  border: none;
  padding: 10px 24px;
  border-radius: 8px;
  font-family: 'Georgia', serif;
  font-size: var(--fs-sm);
  font-weight: bold;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}
.export-go:hover { background: var(--accent-primary); }
.export-go:active { transform: scale(0.97); }
.export-cancel {
  background: var(--bg-tertiary);
  color: var(--text-muted);
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  font-family: 'Georgia', serif;
  font-size: var(--fs-sm);
  cursor: pointer;
  transition: background 0.2s;
}
.export-cancel:hover { background: var(--bg-hover); }
.export-preview-count {
  font-size: var(--fs-xs);
  color: var(--text-faint);
  margin-right: auto;
  align-self: center;
  font-style: italic;
}

/* ── Sprint 26B: New Project Gateway Modal ── */
.new-project-modal {
  background: var(--bg-card);
  padding: 32px;
  border-radius: 16px;
  max-width: 640px;
  width: 100%;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
  font-family: 'Georgia', serif;
  color: var(--text-secondary);
}
.new-project-title {
  margin: 0 0 6px 0;
  font-size: var(--fs-lg);
  color: var(--text-primary);
}
.new-project-subtitle {
  margin: 0 0 24px 0;
  font-size: var(--fs-sm);
  color: var(--text-faint);
}
.new-project-options {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}
.new-project-card {
  background: var(--bg-secondary, #faf8f5);
  border: 2px solid var(--border-primary, #e8e3db);
  border-radius: 12px;
  padding: 20px 16px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
  position: relative;
}
.new-project-card:hover {
  border-color: var(--accent-primary, #8b7355);
  box-shadow: 0 4px 16px rgba(44, 24, 16, 0.08);
  transform: translateY(-2px);
}
.new-project-card-accent {
  border-color: #d4b8ff;
  background: #faf8ff;
}
.new-project-card-accent:hover {
  border-color: #8b5cf6;
  box-shadow: 0 4px 16px rgba(139, 92, 246, 0.15);
}
.new-project-icon {
  font-size: 2rem;
  display: block;
  margin-bottom: 10px;
}
.new-project-card h4 {
  margin: 0 0 8px 0;
  font-size: var(--fs-base);
  color: var(--text-primary);
}
.new-project-card p {
  margin: 0;
  font-size: var(--fs-xs);
  color: var(--text-muted);
  line-height: 1.5;
}
.new-project-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: linear-gradient(135deg, #8b5cf6, #6d28d9);
  color: white;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
@media (max-width: 640px) {
  .new-project-options { grid-template-columns: 1fr; }
  .new-project-modal { padding: 20px; }
}

@media (max-width: 480px) {
  .export-modal { padding: 20px; }
  .export-checkboxes { grid-template-columns: 1fr; }
  .export-format-btns { flex-direction: column; }
}

/* ═════════════════════════════════════════
   INLINE SAVE BUTTON (iMessage-style)
   ═════════════════════════════════════════ */
.notebook-composer {
  position: relative;
}
.inline-save-btn {
  width: 25px;
  height: 25px;
  border-radius: 50%;
  background: var(--accent-primary);
  color: #fff;
  border: none;
  font-size: calc(var(--fs-xs) * 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(44, 24, 16, 0.25);
  transition: transform 0.15s, background 0.2s, box-shadow 0.2s;
  flex-shrink: 0;
  margin-left: auto;
}
.inline-save-btn:hover {
  background: var(--accent-primary);
  transform: scale(1.08);
  box-shadow: 0 4px 14px rgba(44, 24, 16, 0.4);
}
.inline-save-btn:active {
  transform: scale(0.9);
  background: var(--accent-primary);
}

/* ═════════════════════════════════════════
   ACTION DRAWER TOGGLE + MODE BUTTONS
   (formerly zen mode — kept for drawer/manuscript UI)
   ═════════════════════════════════════════ */
.zen-toggle-btn {
  background: none;
  border: none;
  font-size: var(--fs-md);
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 6px;
  transition: background 0.2s;
  margin-left: 4px;
}
.zen-toggle-btn:hover {
  background: rgba(44, 24, 16, 0.08);
}
.mode-btn {
  background: none;
  border: 1px solid transparent;
  font-size: var(--fs-xs);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  cursor: pointer;
  padding: 3px 10px;
  border-radius: 6px;
  color: var(--text-faint);
  transition: all 0.2s;
  white-space: nowrap;
}
.mode-btn:hover {
  background: rgba(44, 24, 16, 0.06);
  color: var(--text-muted);
}

/* ═════════════════════════════════════════
   RESEARCH MODE (Desktop split-screen)
   Container-query aware panes
   ═════════════════════════════════════════ */
.notebook-container.research-mode-on {
  display: grid !important;
  max-width: 100% !important;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  padding: 0 !important;
  transition: all 0.3s ease;
}
.research-split {
  grid-template-columns: 60fr 8px 40fr;
  gap: 0;
}

/* ── Left Pane: Writing ── */
.research-left {
  container-type: inline-size;
  container-name: left-pane;
  padding: 4px var(--sp-md) var(--sp-sm) var(--sp-md) !important;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-sizing: border-box;
}

.research-left.research-left-manuscript {
  padding: 0 !important;
}
.research-left .mode-toggle-row {
  margin-bottom: var(--sp-sm);
  flex-shrink: 0;
}
.research-left .notebook-composer {
  flex: 1;
  display: flex;
  flex-direction: column;
  border: none;
  background: transparent;
  padding: 2px 0 0;
  box-shadow: none;
  margin-bottom: 0;
  min-height: 0;
  overflow: visible;
  width: 100% !important;
  max-width: 100% !important;
}
.research-left .notebook-composer textarea {
  flex: 1;
  font-family: 'Times New Roman', Times, serif !important;
  font-size: 12pt;
  line-height: 1.15;
  min-height: 0;
  color: var(--text-secondary);
  overflow-y: auto !important;
  resize: none;
  width: 100% !important;
  max-width: 100%;
}
/* Ensure controls never vanish */
.research-left .notebook-controls {
  flex-shrink: 0 !important;
  min-height: 28px;
  overflow: visible !important;
}
.research-left .notebook-composer:focus-within {
  box-shadow: none;
}

/* Container-query shrink rules for left pane */
@container left-pane (max-width: 450px) {
  .notebook-composer textarea { font-size: 10pt !important; line-height: 1.15 !important; }
  .format-toolbar button { font-size: 0.7rem !important; padding: 2px 5px !important; }
  .composer-top-bar { gap: 4px !important; padding: 4px 6px !important; }
  .composer-hint { display: none !important; }
  .word-count { font-size: 0.65rem !important; }
}

/* ── Right Pane: Reference ── */
.research-right {
  container-type: inline-size;
  container-name: right-pane;
  padding: 4px var(--sp-md) 0 var(--sp-md);
  overflow-y: auto;
  height: 100vh;
  height: 100dvh;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--border-primary);
}
.research-right .notebook-header {
  margin-bottom: 0;
  padding-bottom: 4px;
  border-bottom: none;
  flex-shrink: 0;
}
/* Inline header: everything on one row */
.notebook-header-inline {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: nowrap;
  padding: 14px 10px;
  margin: 0;
  min-height: 52px;
}
.notebook-header-inline h1 {
  margin-right: 4px;
  white-space: nowrap;
  font-size: var(--fs-lg);
  color: #4a2080;
}
.notebook-header-inline p {
  margin: 0;
  margin-right: auto;
  white-space: nowrap;
  font-size: var(--fs-base);
  color: #f5b731;
  font-weight: 700;
}
/* Deadline counter centered in the header row */
.deadline-header-center {
  flex: 1;
  text-align: center;
  font-size: var(--fs-md);
  padding: 6px 12px;
  margin: 0;
  border-radius: 6px;
  background: rgba(44, 24, 16, 0.03);
  border: 1px solid rgba(44, 24, 16, 0.08);
  cursor: pointer;
  white-space: nowrap;
}
.deadline-header-center:hover { background: rgba(44, 24, 16, 0.06); }
.deadline-header-inline {
  flex: 1;
}
/* Action drawer button matching deadline height */
.action-drawer-header {
  font-size: calc(var(--fs-sm) * 1.2) !important;
  padding: 3px 8px !important;
  flex-shrink: 0;
  align-self: center;
}
.notebook-header-inline .icon-btn,
.notebook-header-inline .zen-toggle-btn,
.notebook-header-inline .export-btn {
  font-size: var(--fs-md);
  color: #4a2080;
}
.research-right .notebook-header h1 {
  font-size: var(--fs-lg);
  color: #4a2080;
}
.research-right .notebook-entry {
  padding: var(--sp-md) 0;
}
.research-right .entry-content p {
  font-size: var(--fs-base);
  line-height: 1.7;
}
.research-right .notebook-feed {
  flex: none;
  overflow-y: visible;
  min-height: 0;
}

/* Container-query shrink rules for right pane */
@container right-pane (max-width: 400px) {
  .notebook-header h1 { font-size: 1rem !important; }
  .notebook-header p { font-size: 0.65rem !important; }
  .journal-search { font-size: 0.85rem !important; }
  .tag-pill { font-size: 0.7rem !important; padding: 3px 8px !important; }
  .notebook-entry { padding: 10px 0 !important; }
  .entry-content p { font-size: 0.85rem !important; line-height: 1.6 !important; }
  .notebook-entry time { font-size: 0.6rem !important; }
}

/* ═════════════════════════════════════════
   PRIORITY TASK (NoteParser)
   ═════════════════════════════════════════ */
.bujo-task-priority {
  border-left: 3px solid #e53935;
  padding-left: 12px;
  background: rgba(229, 57, 53, 0.04);
  border-radius: 0 4px 4px 0;
}

/* ═════════════════════════════════════════
   TASK PROGRESS BAR (NoteParser)
   ═════════════════════════════════════════ */
.task-progress {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed var(--border-primary);
}
.task-progress-bar {
  flex: 1;
  height: 5px;
  background: var(--bg-tertiary);
  border-radius: 3px;
  overflow: hidden;
}
.task-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #4a7c59, #2e7d32);
  border-radius: 3px;
  transition: width 0.5s ease;
}
.task-progress-label {
  font-size: var(--fs-xs);
  color: var(--text-faint);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  white-space: nowrap;
}

/* ═════════════════════════════════════════
   DRAG-AND-DROP HIGHLIGHT
   ═════════════════════════════════════════ */
.notebook-composer.drag-over {
  border-color: var(--accent-success);
  background: rgba(74, 124, 89, 0.03);
}

/* ═════════════════════════════════════════
   MOBILE-SPECIFIC OVERRIDES
   ═════════════════════════════════════════ */
@media (max-width: 768px) {
  /* Tighter padding on mobile */
  .notebook-composer {
    padding: 16px;
    padding-bottom: 12px;
    margin-bottom: 12px;
    position: relative;
    flex-shrink: 0;
    max-height: none;
    overflow: visible;
    display: flex;
    flex-direction: column;
    flex: 1;
  }
  .notebook-composer textarea {
    min-height: 120px;
    overflow-y: auto; /* mobile: allow scroll instead of auto-grow */
    flex: 1;
  }

  /* Float the inline save button over the textarea bottom-right on mobile */
  .mobile-layout .inline-save-btn {
    position: absolute;
    bottom: 56px; /* above the controls row */
    right: 16px;
    z-index: 10;
    width: 40px;
    height: 40px;
    box-shadow: 0 3px 12px rgba(44, 24, 16, 0.35);
  }

  /* Simplified controls row on mobile */
  .notebook-controls {
    flex-wrap: wrap;
    gap: 8px;
  }
  .composer-hint {
    display: none;
  }

  /* Stack header row elements */
  .notebook-header-row {
    flex-wrap: wrap;
    gap: 6px;
  }

  /* Full-width view toggle on mobile */
  .journal-view-toggle {
    justify-content: space-around;
  }
  .journal-view-toggle button {
    font-size: var(--fs-sm);
  }

  /* Deadline banner compact */
  .deadline-banner {
    font-size: var(--fs-xs);
    padding: 6px 12px;
  }
  .deadline-edit-row {
    flex-direction: column;
    gap: 6px;
  }

  /* Hide action drawer toggle + mode buttons on mobile */
  .zen-toggle-btn {
    display: none;
  }
}

/* ═════════════════════════════════════════
   FOLDABLE SECTIONS (NoteParser heading collapse)
   ═════════════════════════════════════════ */
.foldable-section {
  margin: 0;
}
.foldable-header {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  user-select: none;
  transition: opacity 0.2s;
}
.foldable-header:hover {
  opacity: 0.7;
}
.fold-arrow {
  font-size: var(--fs-xs);
  color: var(--text-faint);
  transition: transform 0.2s;
  flex-shrink: 0;
  line-height: 1;
}
.fold-arrow.collapsed {
  transform: rotate(-90deg);
}
.foldable-body {
  animation: foldOpen 0.15s ease-out;
}
@keyframes foldOpen {
  from { opacity: 0; max-height: 0; }
  to { opacity: 1; max-height: 2000px; }
}
.foldable-header .bujo-heading {
  margin: 0;
}

/* ═════════════════════════════════════════
   SUB-TASK INDENTATION
   ═════════════════════════════════════════ */
.bujo-indent {
  border-left: 1px solid var(--border-primary);
  padding-left: 4px;
}

/* ═════════════════════════════════════════
   PIN BUTTON & PINNED ENTRIES
   ═════════════════════════════════════════ */
.entry-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.entry-header-row time {
  margin-bottom: 0;
}
.pin-btn {
  background: none;
  border: none;
  font-size: var(--fs-sm);
  cursor: pointer;
  opacity: 0.25;
  transition: opacity 0.2s, transform 0.15s;
  padding: 2px 4px;
}
.pin-btn:hover {
  opacity: 0.6;
  transform: scale(1.15);
}
.pin-btn.pinned {
  opacity: 1;
  transform: rotate(-15deg);
}
.entry-pinned {
  background: rgba(255, 215, 0, 0.04);
  border-left: 3px solid rgba(255, 215, 0, 0.5);
  padding-left: 16px;
  border-radius: 0 4px 4px 0;
}

/* ═════════════════════════════════════════
   WORD COUNT / READING TIME
   ═════════════════════════════════════════ */
.word-count {
  font-size: calc(var(--fs-xs) * 1.15);
  color: var(--text-placeholder);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

/* ═════════════════════════════════════════
   ENTRY ACTIONS (Edit / Delete / Copy)
   ═════════════════════════════════════════ */
.entry-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}
.entry-action-btn {
  background: none;
  border: none;
  font-size: var(--fs-xs);
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
  opacity: 0.35;
  transition: opacity 0.2s, background 0.15s, transform 0.1s;
  pointer-events: auto;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.entry-action-btn:hover {
  opacity: 1;
  background: rgba(44, 24, 16, 0.06);
}
.entry-action-btn:active {
  opacity: 1;
  transform: scale(0.92);
}
.entry-delete-btn:hover {
  background: rgba(220, 40, 40, 0.08);
}

/* ── Inline Delete Confirmation Bar ── */
.delete-confirm-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  margin: 4px 0 8px;
  background: rgba(220, 40, 40, 0.06);
  border: 1px solid rgba(220, 40, 40, 0.15);
  border-radius: 10px;
  animation: slideDown 0.2s ease-out;
}
.delete-confirm-msg {
  flex: 1;
  font-size: var(--fs-xs);
  color: #8b4040;
  font-weight: 500;
}
.delete-confirm-yes {
  background: #c62828;
  color: #fff;
  border: none;
  padding: 6px 16px;
  border-radius: 8px;
  font-size: var(--fs-xs);
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}
.delete-confirm-yes:hover {
  background: #b71c1c;
}
.delete-confirm-yes:active {
  transform: scale(0.95);
}
.delete-confirm-no {
  background: transparent;
  color: #8b7355;
  border: 1px solid rgba(139, 115, 85, 0.25);
  padding: 6px 14px;
  border-radius: 8px;
  font-size: var(--fs-xs);
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
}
.delete-confirm-no:hover {
  background: var(--bg-tertiary);
}

/* ═══════════════════════════════════════════════════════════════
   FLOATING HIGHLIGHT TOOLBAR — appears on text selection (BubbleMenu)
   ═══════════════════════════════════════════════════════════════ */
.floating-highlight-toolbar {
  display: flex;
  align-items: center;
  gap: 2px;
  background: var(--accent-primary);
  border-radius: 8px;
  padding: 4px 6px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
  animation: highlightFadeIn 0.15s ease;
}
@keyframes highlightFadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}
.floating-highlight-toolbar button {
  background: transparent;
  border: none;
  color: #fff;
  font-size: var(--fs-xs);
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
  white-space: nowrap;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  transition: background 0.15s;
}
.floating-highlight-toolbar button.is-active {
  background: rgba(255, 255, 255, 0.25);
}
.floating-highlight-toolbar button:hover {
  background: rgba(255, 255, 255, 0.15);
}
.floating-highlight-toolbar .toolbar-divider {
  width: 1px;
  height: 18px;
  background: rgba(255, 255, 255, 0.3);
  margin: 0 2px;
}

/* ═══════════════════════════════════════════════════════════════
   COMMAND MENU DROPDOWN — Notion-style / command palette
   ═══════════════════════════════════════════════════════════════ */
.command-menu-dropdown {
  position: absolute;
  z-index: 100;
  bottom: 100%;
  left: 12px;
  right: 12px;
  max-height: 280px;
  overflow-y: auto;
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-primary);
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.06);
  padding: 6px 0;
  animation: cmdMenuIn 0.12s ease;
}
@keyframes cmdMenuIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.command-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 14px;
  cursor: pointer;
  transition: background 0.1s;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
.command-item:hover {
  background: #f5f0eb;
}
.command-icon {
  font-size: var(--fs-sm);
  width: 24px;
  text-align: center;
  flex-shrink: 0;
}
.command-label {
  font-size: var(--fs-sm);
  color: var(--text-primary);
}
.command-menu-empty {
  text-align: center;
  padding: 16px;
  color: var(--text-faint);
  font-size: var(--fs-xs);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* ═══════════════════════════════════════════════════════════════
   DESKTOP COMPOSER-FIRST LAYOUT — prioritise the writing surface
   ═══════════════════════════════════════════════════════════════ */
@media (min-width: 769px) {
  /* Compact the chrome above the composer */
  .desktop-layout .identity-anchor {
    margin-bottom: 10px;
    padding-bottom: 8px;
    font-size: var(--fs-xs);
  }
  .desktop-layout .notebook-header {
    margin-bottom: 14px;
    padding-bottom: 8px;
    border-bottom-width: 1px;
  }
  .desktop-layout .notebook-header h1 {
    font-size: var(--fs-xl);
  }
  .desktop-layout .deadline-banner {
    margin-bottom: 10px;
    padding: 6px 14px;
    font-size: var(--fs-xs);
  }
  .desktop-layout .sticky-mit-banner {
    margin-bottom: 6px;
  }

  /* HERO COMPOSER — the main writing surface */
  .desktop-layout .notebook-composer {
    padding: 16px 20px;
    margin-bottom: 12px;
    border-radius: 8px;
    border-color: var(--border-primary);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
    transition: box-shadow 0.3s, border-color 0.3s;
    flex-shrink: 0;
    max-height: 40vh !important; /* STRICT LIMIT: Never consume the whole screen */
    display: flex;
    flex-direction: column;
    overflow: visible;
  }
  .desktop-layout .notebook-composer:focus-within {
    border-color: var(--border-secondary);
    box-shadow: 0 2px 12px rgba(44, 24, 16, 0.08);
  }
  .desktop-layout .notebook-composer textarea {
    font-family: 'Times New Roman', Times, serif;
    font-size: 12pt;
    line-height: 1.15;
    min-height: 150px;
    max-height: 100%;
    overflow-y: auto !important; /* Force internal scrolling */
    resize: none;
    flex: 1;
  }
  .desktop-layout .notebook-composer--daily textarea {
    min-height: 280px;
  }

  /* Compact the discovery/search block */
  .desktop-layout .journal-discovery {
    margin-bottom: 0;
    padding-top: 0;
    flex-shrink: 0;
  }
  .desktop-layout .journal-view-toggle {
    margin-bottom: 2px;
    padding-bottom: 2px;
  }
  .desktop-layout .journal-search {
    font-size: var(--fs-sm);
  }
  .desktop-layout .journal-tag-cloud {
    margin-top: 2px;
  }

  /* Tighten entry spacing */
  .desktop-layout .notebook-entry {
    padding: 24px 0;
  }

  /* Daily spark tighter */
  .desktop-layout .daily-spark {
    margin-top: 40px;
    padding: 20px;
  }
}

/* ═══════════════════════════════════════════════════════════════
   DESKTOP FULL-SCREEN FIX — viewport-locked, no browser scroll
   ═══════════════════════════════════════════════════════════════ */
@media (min-width: 769px) {
  .notebook-container.desktop-layout {
    max-width: 100% !important;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    padding: 16px 28px 0;
    display: flex;
    flex-direction: column;
  }
  .desktop-layout .desktop-main {
    max-width: 1200px !important; /* Expanded from 960px to breathe */
    margin: 0 auto;
    width: 100%;
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: visible;
  }
  .desktop-layout.ivory-right-only {
    max-width: 100% !important;
    display: grid !important;
    grid-template-columns: minmax(auto, 860px) minmax(320px, 1fr);
    flex-direction: unset;
    gap: 0;
  }
  .desktop-layout.ivory-right-only .desktop-main {
    overflow-y: auto;
  }
  .ivory-sidebar-right {
    width: 100%;
    max-width: 100%;
    overflow-y: auto;
    height: 100vh;
    height: 100dvh;
    box-sizing: border-box;
  }
}

/* ════════════════════════════════════════════
   GTD Action Drawer + ZTD Sticky MITs
   ════════════════════════════════════════════ */

/* Action Drawer Button Badge */
.action-drawer-btn {
  position: relative;
}
.action-badge {
  position: absolute;
  top: -4px;
  right: -6px;
  background: #e74c3c;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  padding: 0 3px;
}

/* ── Sticky MIT Banner ── */
.sticky-mit-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(135deg, #fdf6e3 0%, #fef9ef 100%);
  border: 1px solid #f0d87030;
  border-radius: 8px;
  padding: 8px 14px;
  margin: 0 0 8px 0;
  font-size: 13px;
  flex-wrap: wrap;
  flex-shrink: 0;
}
.mit-banner-label {
  font-weight: 700;
  color: #b8860b;
  white-space: nowrap;
  font-size: 12px;
  letter-spacing: 0.3px;
}
.mit-banner-items {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.mit-banner-item {
  background: var(--bg-card);
  border: 1px solid #f0d87050;
  border-radius: 6px;
  padding: 3px 10px;
  font-size: 12.5px;
  color: #4a3c1a;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.mit-remove-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  color: #c0a050;
  padding: 0;
  line-height: 1;
  opacity: 0.5;
  transition: opacity 0.15s;
}
.mit-remove-btn:hover {
  opacity: 1;
  color: #e74c3c;
}

/* ── Action Drawer Overlay ── */
.action-drawer-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.35);
  z-index: 2000;
  display: flex;
  justify-content: flex-end;
  animation: fadeInOverlay 0.2s ease-out;
}
@keyframes fadeInOverlay {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ── Action Drawer (sliding panel) ── */
.zen-action-drawer {
  width: 380px;
  max-width: 90vw;
  height: 100%;
  background: #fafaf8;
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.12);
  display: flex;
  flex-direction: column;
  animation: slideInDrawer 0.25s ease-out;
  overflow: hidden;
}
@keyframes slideInDrawer {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}
.drawer-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--border-primary);
  background: var(--bg-card);
}
.drawer-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}
.drawer-count {
  font-size: 12px;
  color: var(--text-faint);
  margin-left: auto;
  margin-right: 8px;
}
.drawer-empty {
  text-align: center;
  color: var(--text-faint);
  padding: 40px 20px;
  font-size: 14px;
}

/* ── Drawer Task List ── */
.drawer-task-list {
  list-style: none;
  margin: 0;
  padding: 8px 0;
  overflow-y: auto;
  flex: 1;
}
.drawer-task-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--border-primary);
  transition: background 0.12s;
}
.drawer-task-item:hover {
  background: #f5f5f0;
}
.drawer-task-urgent {
  border-left: 3px solid #e74c3c;
  padding-left: 17px;
}
.drawer-task-text {
  flex: 1;
  font-size: 13.5px;
  color: var(--text-primary);
  line-height: 1.4;
}
.drawer-task-date {
  font-size: 11px;
  color: var(--text-placeholder);
  white-space: nowrap;
}
.drawer-task-check {
  background: none;
  border: 1.5px solid #ccc;
  border-radius: 4px;
  width: 26px;
  height: 26px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-faint);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  flex-shrink: 0;
}
.drawer-task-check:hover {
  background: #27ae60;
  color: #fff;
  border-color: #27ae60;
}

/* ── MIT Star Button ── */
.mit-star {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 18px;
  padding: 0;
  line-height: 1;
  flex-shrink: 0;
  opacity: 0.4;
  transition: opacity 0.15s, transform 0.15s;
}
.mit-star:hover {
  opacity: 1;
  transform: scale(1.15);
}
.mit-star-active {
  opacity: 1;
}
.mit-star:disabled {
  opacity: 0.15;
  cursor: default;
}

/* ── Drawer MIT Summary Section ── */
.drawer-mit-section {
  border-top: 1px solid var(--border-primary);
  padding: 14px 20px;
  background: #fdf6e3;
}
.drawer-mit-section h4 {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 700;
  color: #b8860b;
}
.drawer-mit-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 5px 0;
  font-size: 13px;
  color: #4a3c1a;
}

/* ══════════════════════════════════════════════
   ZOOM RESILIENCE — prevent layout breakage at browser zoom
   ══════════════════════════════════════════════ */
.notebook-container,
.notebook-container.desktop-layout,
.notebook-container.research-mode-on {
  box-sizing: border-box;
}

/* Prevent fixed elements from going off-screen at high zoom */
.help-toggle-btn,
.principles-toggle-btn,
.quick-dump-fab {
  position: fixed;
  right: 20px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1px solid var(--border-primary);
  font-size: var(--fs-md);
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  z-index: 1000;
  transition: all 0.2s;
}
.help-toggle-btn {
  bottom: 20px;
}
.principles-toggle-btn {
  bottom: 68px;
}

/* Sprint 44: Token balance pill — positioned above principles button */
.token-balance-pill {
  position: fixed;
  right: 14px;
  bottom: 118px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-card);
  border: 1px solid var(--border-primary);
  border-radius: 16px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  z-index: 1000;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  white-space: nowrap;
  line-height: 1;
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

/* Sprint 52.1: Wallet pulse — flash green on reward claim */
.token-balance-pill.wallet-pulse {
  animation: walletPulse 0.7s ease;
  border-color: #10b981;
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.4);
}
@keyframes walletPulse {
  0% { transform: scale(1); }
  25% { transform: scale(1.12); border-color: #10b981; box-shadow: 0 0 16px rgba(16, 185, 129, 0.5); }
  50% { transform: scale(1.06); }
  100% { transform: scale(1); }
}

.quick-dump-fab {
  bottom: 152px;
}
.quick-dump-fab:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 16px rgba(0,0,0,0.12);
}

/* Ensure modals scale and stay visible at any zoom level */
.export-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
}
.export-modal,
.analytics-modal,
.principles-modal,
.audit-modal {
  max-height: 90vh;
  max-width: 95vw;
  overflow-y: auto;
}

/* ══════════════════════════════════════════════
   PHASE 1 – Master Principles Modal
   ══════════════════════════════════════════════ */
.principles-modal {
  max-width: 640px;
  width: 90vw;
}

.principles-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid #e8e4dc;
}

.principles-modal-header h3 {
  margin: 0;
  font-size: var(--fs-md);
  color: #2d2a24;
}

.principles-textarea {
  width: 100%;
  min-height: 360px;
  padding: 16px 20px;
  border: none;
  outline: none;
  font-family: 'Georgia', serif;
  font-size: var(--fs-sm);
  line-height: 1.7;
  resize: vertical;
  color: #2d2a24;
  background: #fdfcfa;
  box-sizing: border-box;
}

.principles-textarea::placeholder {
  color: #b0a898;
}

.principles-modal-footer {
  padding: 12px 20px;
  border-top: 1px solid #e8e4dc;
  display: flex;
  justify-content: flex-end;
}

.principles-modal-footer .export-go.saving {
  background: #10b981;
  pointer-events: none;
}

/* ══════════════════════════════════════════════
   PHASE 4 – Analytics Dashboard Modal
   ══════════════════════════════════════════════ */
.analytics-modal {
  max-width: 1400px !important; /* Much wider for charts */
  width: 90vw !important;
  max-height: 85vh;
  overflow-y: auto;
  padding: 24px;
}

.analytics-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid #e8e4dc;
  flex-wrap: wrap;
  gap: 8px;
}

.analytics-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.analytics-title-group h3 {
  margin: 0;
  font-size: var(--fs-md);
  color: #2d2a24;
}

.analytics-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.timeframe-select {
  padding: 4px 10px;
  border-radius: 8px;
  border: 1px solid var(--border-secondary);
  font-size: 13px;
  background: white;
  color: #2d2a24;
  cursor: pointer;
}

.analytics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(450px, 1fr)); /* Auto-wrapping grid */
  gap: 30px;
  padding: 20px 0;
}

.analytics-widget {
  background: #fdfcfa;
  border: 1px solid #e8e4dc;
  border-radius: 12px;
  padding: 16px;
}

.analytics-widget.full-width {
  grid-column: 1 / -1;
}

.analytics-widget h4 {
  margin: 0 0 12px 0;
  font-size: var(--fs-sm);
  color: #6b6455;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.chart-container {
  height: 350px !important; /* Taller charts */
  width: 100%;
}

.pie-container {
  display: flex;
  align-items: center;
  gap: 20px;
}

.pie-legend {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #4b5563;
}

.legend-color {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  display: inline-block;
  flex-shrink: 0;
}

/* Analytics responsive — single column on small screens */
@media (max-width: 800px) {
  .analytics-grid {
    grid-template-columns: 1fr;
  }
  .analytics-modal {
    max-height: 90vh;
    width: 95vw;
  }
}

/* ══════════════════════════════════════════════
   REALITY ENGINE – Tab Bar & New Visualizations
   ══════════════════════════════════════════════ */
.re-tab-bar {
  display: flex;
  gap: 0;
  border-bottom: 2px solid #e8e4dc;
  padding: 0 16px;
  background: #fdfcfa;
}
.re-tab {
  padding: 10px 18px;
  border: none;
  background: none;
  font-size: var(--fs-md);
  font-weight: 600;
  color: #9b9488;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.15s;
}
.re-tab:hover { color: #6b6455; }
.re-tab.active {
  color: #8b5cf6;
  border-bottom-color: #8b5cf6;
}
.weekly-insight-tracker {
  font-size: var(--fs-md);
  color: var(--text-secondary);
  padding: 4px 0;
  font-family: 'Georgia', serif;
}
.weekly-insight-tracker.tracker-ready {
  color: #4a7c59;
}

/* ── Momentum Heatmap ── */
.re-heatmap-container {
  padding: 8px 0;
}
.re-heatmap-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
}
.re-heatmap-cell {
  width: 36px;
  height: 36px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  cursor: default;
  transition: transform 0.1s;
}
.re-heatmap-cell:hover {
  transform: scale(1.2);
  z-index: 2;
}
.re-heatmap-label {
  font-size: 9px;
  color: rgba(255,255,255,0.85);
  font-weight: 600;
}
.re-heatmap-legend {
  display: flex;
  gap: 14px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.re-heatmap-legend .legend-item {
  font-size: 12px;
}

/* ── Constellation SVG ── */
.re-constellation-container {
  min-height: 320px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.re-constellation-svg {
  width: 100%;
  height: 400px;
  max-height: 50vh;
}

/* ── Top Tags & Commands bars ── */
.re-tag-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow: hidden;
}
.re-tag-item {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 3px 0;
  overflow: hidden;
}
.re-tag-item:hover .re-tag-name { color: #8b5cf6; }
.re-tag-name {
  font-size: 13px;
  font-weight: 500;
  color: #4b5563;
  min-width: 80px;
  transition: color 0.15s;
}
.re-tag-bar {
  height: 6px;
  background: linear-gradient(90deg, #8b5cf6, #c4b5fd);
  border-radius: 3px;
  flex-shrink: 1;
  max-width: calc(100% - 120px);
  transition: width 0.3s ease;
}
.re-cmd-bar {
  background: linear-gradient(90deg, #10b981, #6ee7b7);
}
.re-tag-count {
  font-size: 12px;
  color: #9b9488;
  min-width: 24px;
  text-align: right;
}

/* ── Smart Brief Tab ── */
.re-brief-container {
  padding: 20px;
}
.re-brief-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.re-lens-picker {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.re-lens-btn {
  padding: 6px 14px;
  border: 1px solid var(--border-secondary);
  border-radius: 8px;
  background: white;
  font-size: 12px;
  font-weight: 500;
  color: #6b6455;
  cursor: pointer;
  transition: all 0.15s;
}
.re-lens-btn:hover { border-color: var(--accent-purple); color: #8b5cf6; }
.re-lens-btn.active {
  background: var(--accent-purple);
  color: white;
  border-color: var(--accent-purple);
}
.re-brief-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: #9b9488;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 6px;
}
.re-lens-desc {
  font-style: italic;
  color: #b0a896;
}
.re-brief-output {
  background: #fdfcfa;
  border: 1px solid #e8e4dc;
  border-radius: 12px;
  padding: 20px;
  min-height: 200px;
  max-height: 50vh;
  overflow-y: auto;
}
.re-brief-text {
  line-height: 1.7;
  font-size: var(--fs-sm);
  color: #3b3a36;
}
.re-brief-text h2 {
  font-size: var(--fs-md);
  color: #2d2a24;
  margin: 18px 0 8px 0;
  border-bottom: 1px solid #e8e4dc;
  padding-bottom: 4px;
}
.re-brief-text h3 {
  font-size: var(--fs-base);
  color: #4b5563;
  margin: 14px 0 6px 0;
}
.re-brief-text h4 {
  font-size: var(--fs-sm);
  color: #6b6455;
  margin: 10px 0 4px 0;
}
.re-brief-text p {
  margin: 4px 0;
}
.re-brief-text li {
  margin-left: 20px;
  margin-bottom: 3px;
}
.re-brief-placeholder {
  color: #9b9488;
  text-align: center;
  padding: 30px 20px;
}
.re-brief-placeholder ul {
  text-align: left;
  max-width: 420px;
  margin: 16px auto 0;
  list-style: none;
  padding: 0;
}
.re-brief-placeholder li {
  padding: 6px 0;
  border-bottom: 1px solid #f0ece4;
  font-size: 13px;
}
.re-brief-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
  justify-content: flex-end;
}

/* ══════════════════════════════════════════════
   PHASE 5 – Reviewer Card (full overlay modal matching lit modal)
   ══════════════════════════════════════════════ */
.reviewer-card-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}

.reviewer-card {
  position: relative;
  max-width: 850px;
  width: 90vw;
  max-height: 85vh;
  background: white;
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
  z-index: 10000;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: "Times New Roman", Times, serif;
  font-size: 1.15rem;
  text-align: justify;
  padding: 30px;
  animation: litModalIn 0.25s ease;
}

.reviewer-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 16px;
  border-bottom: 1px solid #e8e4dc;
}

.reviewer-card-header h4 {
  margin: 0;
  font-size: 1.3rem;
  color: #2d2a24;
  font-family: "Times New Roman", Times, serif;
}

/* Sprint 42: Critique mode badge — academic labels only */
.rc-badge {
  display: inline-block;
  margin-left: 10px;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 0.72rem;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-weight: 600;
  letter-spacing: 0.03em;
  vertical-align: middle;
  white-space: nowrap;
}
.rc-badge--red      { background: #fee2e2; color: #991b1b; }
.rc-badge--blue     { background: #dbeafe; color: #1e40af; }
.rc-badge--green    { background: #dcfce7; color: #166534; }
.rc-badge--amber    { background: #fef3c7; color: #92400e; }
.rc-badge--purple   { background: #ede9fe; color: #5b21b6; }

.reviewer-card-body {
  padding: 20px 0;
  overflow-y: auto;
  flex: 1;
  font-size: 1.15rem;
  line-height: 1.75;
  color: #3b3a36;
  font-family: "Times New Roman", Times, serif;
}

.reviewer-card-body p {
  margin: 0 0 8px 0;
}

.reviewer-card-footer {
  padding-top: 14px;
  border-top: 1px solid #e8e4dc;
  font-size: 0.85rem;
  color: #9b9488;
  text-align: center;
}

/* ── Streaming Typing Cursor ── */
.typing-cursor {
  display: inline-block;
  color: #3b82f6;
  font-weight: bold;
  animation: blink 0.7s step-end infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* ══════════════════════════════════════════════
   PHASE 6 – Nexus Side Panel
   ══════════════════════════════════════════════ */
.nexus-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 380px;
  height: 100vh;
  background: white;
  box-shadow: -6px 0 24px rgba(0,0,0,0.12);
  z-index: 1200;
  display: flex;
  flex-direction: column;
  animation: slideInRight 0.3s ease;
}

@keyframes slideInRight {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

.nexus-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid #e8e4dc;
  background: #f8f7f4;
}

.nexus-header h3 {
  margin: 0;
  font-size: var(--fs-md);
  color: #2d2a24;
}

.nexus-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

.nexus-spinner {
  text-align: center;
  padding: 40px 0;
  color: #8b5cf6;
  font-style: italic;
}

.nexus-section {
  margin-bottom: 24px;
}

.nexus-section h4 {
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #6b6455;
  margin: 0 0 8px 0;
}

.nexus-section p {
  font-size: var(--fs-sm);
  line-height: 1.65;
  color: #3b3a36;
  margin: 0;
}

.link-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.suggested-link {
  display: inline-block;
  background: #ede9fe;
  color: #7c3aed;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s;
}

.suggested-link:hover {
  background: #ddd6fe;
}

/* ══════════════════════════════════════════════
   PHASE 6 – Audit Modal
   ══════════════════════════════════════════════ */
.audit-modal {
  max-width: 640px;
  width: 90vw;
}

.audit-results {
  padding: 20px;
  min-height: 120px;
  max-height: 50vh;
  overflow-y: auto;
  color: #3b3a36;
}
.audit-results-content {
  white-space: pre-wrap;
  line-height: 1.6;
  font-size: var(--fs-base);
}

/* ══════════════════════════════════════════════
   PHASE 5 – AI Scalpel Toolbar
   ══════════════════════════════════════════════ */
.ai-scalpel-toolbar button {
  font-size: 14px;
}

.ai-scalpel-toolbar button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.ai-spinner {
  font-size: 13px;
  color: #8b5cf6;
  font-style: italic;
  padding: 4px 0;
}

/* ══════════════════════════════════════════════
   PHASE 3/6 – Drawer Upgrades (Slice, Audit, Sections)
   ══════════════════════════════════════════════ */
.audit-btn {
  background: none;
  border: 1px solid var(--border-secondary);
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 12px;
  cursor: pointer;
  color: #6b6455;
  transition: all 0.15s;
}

.audit-btn:hover {
  background: #ece9e1;
}

.slice-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 13px;
  padding: 2px 4px;
  opacity: 0.6;
  transition: opacity 0.15s;
}

.slice-btn:hover {
  opacity: 1;
}

.nexus-trigger-btn {
  background: none;
  border: 1px solid #ddd6fe;
  border-radius: 6px;
  padding: 2px 8px;
  font-size: 12px;
  cursor: pointer;
  color: #7c3aed;
  transition: all 0.15s;
  margin-left: auto;
}

.nexus-trigger-btn:hover {
  background: #ede9fe;
}

.drawer-section {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid #e8e4dc;
}

.drawer-section-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #9b9488;
  margin: 0 0 6px 0;
  font-weight: 600;
}

.drawer-task-deferred {
  opacity: 0.5;
  font-style: italic;
}

.error-text {
  color: #ef4444;
  font-size: var(--fs-sm);
}

/* ══════════════════════════════════════════════
   Responsive – Analytics & Nexus
   ══════════════════════════════════════════════ */
@media (max-width: 700px) {
  .analytics-grid {
    grid-template-columns: 1fr;
  }
  .analytics-modal {
    width: 98vw;
    max-height: 90vh;
  }
  .nexus-panel {
    width: 100vw;
  }
  .reviewer-card {
    width: calc(100vw - 32px);
    right: 16px;
    bottom: 16px;
  }
  .pie-container {
    flex-direction: column;
  }
}

/* ══════════════════════════════════════════════
   MARKDOWN FORMATTING TOOLBAR & COMPOSER TOP BAR
   ══════════════════════════════════════════════ */
.composer-top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #f8f7f4;
  border-bottom: 1px solid #e8e4dc;
  padding: 4px 10px;
  flex-wrap: wrap;
  gap: 8px;
}

.format-toolbar {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Sprint 52: Utility controls (Sort, Font size) — right-aligned cluster */
.utility-controls {
  display: flex;
  align-items: center;
  gap: 4px;
}
.utility-controls button {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  border-radius: 4px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-family: 'Georgia', serif;
  font-size: 14px;
  transition: background 0.15s, color 0.15s;
}
.utility-controls button:hover {
  background: var(--bg-hover);
  color: var(--text-secondary);
}

.format-toolbar button {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  border-radius: 4px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-family: 'Georgia', serif;
  font-size: 14px;
  transition: background 0.15s, color 0.15s;
}

.format-toolbar button:hover {
  background: var(--bg-hover);
  color: var(--text-secondary);
}

.format-toolbar button.is-active {
  background: var(--accent-primary);
  color: #fff;
  border-color: var(--accent-primary);
}

.toolbar-divider {
  width: 1px;
  height: 16px;
  background: #d1cdc5;
  margin: 0 4px;
}

/* ── Font Size Controls ── */
.font-size-btn {
  font-family: 'Georgia', serif !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  letter-spacing: -0.5px;
}

.font-size-label {
  font-size: 11px;
  color: var(--text-faint);
  min-width: 20px;
  text-align: center;
  font-family: 'SF Mono', 'Cascadia Code', monospace;
  user-select: none;
}

/* ── Sort Select (Discovery) ── */
.sort-select {
  background: transparent;
  border: 1px solid var(--border-secondary);
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 0.75rem;
  padding: 3px 6px;
  cursor: pointer;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}

.sort-select:hover,
.sort-select:focus {
  border-color: #8b7355;
  color: var(--text-secondary);
}

/* ═════════════════════════════════════════
   LITERATURE BROWSER
   ═════════════════════════════════════════ */
.lit-browser {
  padding: 0;
  animation: fadeIn 0.2s ease;
}

/* ── Literature Sort Bar ── */
.lit-sort-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 0;
  margin-top: 0;
}
.lit-sort-label {
  font-size: var(--fs-xs);
  color: var(--text-faint);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.lit-sort-pills {
  display: flex;
  background: #f5f4f1;
  border-radius: 6px;
  padding: 3px;
}
.lit-sort-btn {
  background: transparent;
  border: none;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: var(--fs-xs);
  cursor: pointer;
  color: var(--text-muted);
  transition: all 0.15s;
}
.lit-sort-btn.active {
  background: var(--bg-card);
  color: #111;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── Search row ── */
.lit-search-row {
  position: relative;
  margin-bottom: 16px;
}

.lit-panel-search-row {
  position: relative;
  margin-bottom: 10px;
}

.lit-search {
  width: 100%;
  box-sizing: border-box;
}

.lit-clear-search {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  font-size: var(--fs-lg);
  color: var(--text-faint);
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
}

.lit-clear-search:hover {
  color: var(--text-primary);
}

/* ── Card list ── */
.lit-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.lit-card {
  background: var(--bg-card);
  border: 1px solid #e8e4dc;
  border-radius: 8px;
  padding: 8px 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  box-shadow: 0 1px 3px rgba(0,0,0,0.03);
}

.lit-card:hover {
  border-color: #c4b5a0;
  box-shadow: 0 2px 12px rgba(44, 24, 16, 0.06);
  transform: translateY(-1px);
}

.lit-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2px;
}

.lit-card-ref {
  font-family: 'Georgia', serif;
  font-size: var(--fs-xs);
  color: #8b5cf6;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.lit-card-title {
  font-family: 'Georgia', serif;
  font-size: var(--fs-sm);
  color: var(--text-primary);
  margin: 0 0 2px 0;
  line-height: 1.3;
  font-weight: 600;
}

.lit-card-keywords {
  font-size: var(--fs-xs);
  color: var(--text-faint);
  margin: 0;
  font-style: italic;
}

.lit-card-snippet {
  font-size: var(--fs-sm);
  color: var(--text-muted);
  margin: 0;
  line-height: 1.5;
}

/* ── Sprint 26A: Literature Review Synthesizer ── */
.lit-card-selected {
  border-color: #8b5cf6;
  background: #faf8ff;
  box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.15);
}
.lit-card-checkbox {
  accent-color: #8b5cf6;
  width: 16px;
  height: 16px;
  margin: 0;
  cursor: pointer;
  flex-shrink: 0;
}
.lit-synth-panel {
  background: #faf8ff;
  border: 1px solid #e0d4f5;
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.lit-synth-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: var(--fs-sm);
  color: #6d28d9;
  font-weight: 600;
}
.lit-synth-header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex-wrap: wrap;
}
.lit-synth-thesis {
  font-family: 'Georgia', serif;
  font-size: var(--fs-sm);
  border: 1px solid #e0d4f5;
  border-radius: 6px;
  padding: 8px 12px;
  resize: vertical;
  background: var(--bg-card);
  color: var(--text-primary);
  line-height: 1.5;
}
.lit-synth-thesis::placeholder {
  color: var(--text-faint);
  font-style: italic;
}
.lit-synth-result {
  background: var(--bg-card);
  border: 1px solid #e0d4f5;
  border-radius: 8px;
  overflow: hidden;
}
.lit-synth-result-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: #f5f0ff;
  border-bottom: 1px solid #e0d4f5;
  font-size: var(--fs-sm);
  color: #6d28d9;
}
.lit-synth-result-body {
  padding: 14px 16px;
  font-size: var(--fs-sm);
  color: var(--text-primary);
  line-height: 1.7;
  max-height: 400px;
  overflow-y: auto;
}
.lit-synth-result-body .bujo-parsed,
.lit-synth-modal-body .bujo-parsed {
  background: #fffdf8;
  border: 1px solid #ebe2d6;
  border-radius: 8px;
  color: #29231c;
  font-family: Georgia, "Times New Roman", serif;
  line-height: 1.78;
  padding: 18px 20px;
}
.lit-synth-result-body .bujo-parsed {
  max-height: 320px;
  overflow: hidden;
}
.lit-synth-result-body .bujo-heading,
.lit-synth-modal-body .bujo-heading {
  color: #22170f;
  font-weight: 700;
  letter-spacing: 0;
  margin: 0.85em 0 0.35em;
}
.lit-synth-result-body .bujo-heading:first-child,
.lit-synth-modal-body .bujo-heading:first-child {
  margin-top: 0;
}
.lit-synth-result-body .bujo-heading-1,
.lit-synth-modal-body .bujo-heading-1 {
  font-size: 1.35rem;
}
.lit-synth-result-body .bujo-heading-2,
.lit-synth-modal-body .bujo-heading-2 {
  font-size: 1.12rem;
}
.lit-synth-result-body .bujo-plain,
.lit-synth-modal-body .bujo-plain {
  margin: 0 0 0.7em;
}
.lit-synth-result-body .bujo-wikilink,
.lit-synth-modal-body .bujo-wikilink {
  white-space: nowrap;
}

.lit-synth-modal {
  max-width: min(920px, 92vw);
  width: 920px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
}
.lit-synth-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid #e8e4dc;
}
.lit-synth-modal-header h3 {
  margin: 0;
}
.lit-synth-modal-header p {
  margin: 4px 0 0;
  color: var(--text-faint);
  font-size: var(--fs-sm);
}
.lit-synth-modal-body {
  flex: 1;
  overflow-y: auto;
  line-height: 1.72;
  padding: 16px 4px;
  color: var(--text-primary);
  font-family: Georgia, "Times New Roman", serif;
}
.lit-synth-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid #e8e4dc;
}

/* ── Detail view ── */
.lit-detail {
  animation: fadeIn 0.2s ease;
}

.lit-detail-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid #e8e4dc;
}

.lit-back-btn {
  background: none;
  border: none;
  font-family: 'Georgia', serif;
  font-size: var(--fs-sm);
  color: #8b5cf6;
  cursor: pointer;
  padding: 4px 0;
  transition: color 0.2s;
}

.lit-back-btn:hover {
  color: #6d28d9;
}

.lit-detail-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.lit-detail-title {
  font-family: 'Georgia', serif;
  font-size: var(--fs-lg);
  color: #8b5cf6;
  margin: 0 0 20px 0;
  font-weight: 700;
}

.lit-detail-fields {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.lit-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.lit-field-label {
  font-family: 'Georgia', serif;
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.lit-field-value {
  font-size: var(--fs-sm);
  color: var(--text-primary);
  line-height: 1.6;
  padding: 8px 12px;
  background: var(--bg-secondary);
  border-radius: 6px;
  border: 1px solid transparent;
  white-space: pre-wrap;
}

.lit-field-empty {
  color: var(--text-placeholder);
  font-style: italic;
}

.lit-field-edit {
  font-family: 'Georgia', serif;
  font-size: var(--fs-sm);
  color: var(--text-primary);
  line-height: 1.6;
  padding: 8px 12px;
  background: var(--bg-card);
  border: 1px solid #c4b5a0;
  border-radius: 6px;
  resize: vertical;
  width: 100%;
  box-sizing: border-box;
  transition: border-color 0.2s;
}

.lit-field-edit:focus {
  outline: none;
  border-color: var(--accent-purple);
  box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.1);
}

/* ── Lit Note Quick-Edit Popup (right panel) ── */
.lit-popup-panel {
  background: var(--bg-secondary);
  border: 1px solid #e0dbd5;
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 12px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
  max-height: 60vh;
  overflow-y: auto;
}
.lit-popup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  border-bottom: 1px solid #e8e4dc;
  padding-bottom: 8px;
}
.lit-popup-header h4 {
  margin: 0;
  font-size: var(--fs-base);
  color: var(--text-secondary);
  font-family: 'Georgia', serif;
}
.lit-popup-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}
.lit-popup-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.lit-popup-field {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.lit-popup-field .lit-field-label {
  font-size: var(--fs-xs);
}
.lit-popup-field .lit-field-value {
  font-size: var(--fs-sm);
  padding: 2px 0;
}
.lit-popup-field .lit-field-edit {
  font-size: var(--fs-sm);
  padding: 4px 8px;
  min-height: unset;
}

/* ── Citing entries section ── */
.lit-citing-entries {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid #e8e4dc;
}

.lit-citing-entries h4 {
  font-family: 'Georgia', serif;
  font-size: var(--fs-sm);
  color: var(--text-muted);
  margin: 0 0 12px 0;
}

.lit-citing-entries .backlink-snippet {
  cursor: pointer;
  transition: background 0.2s;
  padding: 8px 12px;
  border-radius: 6px;
}

.lit-citing-entries .backlink-snippet:hover {
  background: #f5f0ea;
}

/* ── Mobile responsiveness for lit browser ── */
@media (max-width: 768px) {
  .lit-card {
    padding: 12px 14px;
  }

  .lit-detail-title {
    font-size: var(--fs-md);
  }

  .lit-field-edit {
    font-size: var(--fs-sm);
  }

  .lit-detail-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
}

/* ══════════════════════════════════════════
   MOBILE TAB SWITCHER (Write / Browse)
   ══════════════════════════════════════════ */
.mobile-tab-switcher {
  display: none;
}

/* ══════════════════════════════════════════
   MOBILE AI BAR (runs on full note)
   ══════════════════════════════════════════ */
.mobile-ai-bar {
  display: none;
}

/* ══════════════════════════════════════════
   MOBILE SUBMIT ROW (center bottom)
   ══════════════════════════════════════════ */
.mobile-submit-row {
  display: none;
}

@media (max-width: 768px) {
  .mobile-tab-switcher {
    display: flex;
    gap: 0;
    margin: 4px 0 8px;
    border: 1px solid #d6cfc5;
    border-radius: 8px;
    overflow: hidden;
    background: #f5f0eb;
  }
  .mobile-tab-btn {
    flex: 1;
    padding: 8px 0;
    font-size: 0.85rem;
    font-weight: 600;
    border: none;
    background: transparent;
    color: #8b8478;
    cursor: pointer;
    transition: all 0.2s;
  }
  .mobile-tab-btn.mobile-tab-active {
    background: var(--bg-card);
    color: #2c2825;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  }

  /* ── Mobile AI Action Bar ── */
  .mobile-ai-bar {
    display: flex;
    gap: 4px;
    padding: 6px 8px;
    background: #f9f7f5;
    border: 1px solid #e8e4dc;
    border-radius: 8px;
    margin: 4px 0;
    justify-content: center;
    flex-wrap: wrap;
  }
  .mobile-ai-bar button {
    background: var(--bg-card);
    border: 1px solid #d6cfc5;
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.15s;
    color: var(--text-secondary);
  }
  .mobile-ai-bar button:hover {
    background: #f0ebe5;
  }
  .mobile-ai-bar button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
  }

  /* ── Mobile Submit Row ── */
  .mobile-submit-row {
    display: flex;
    justify-content: center;
    padding: 8px 0 16px;
  }
  .mobile-submit-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--accent-primary);
    color: #fff;
    border: none;
    border-radius: 20px;
    padding: 10px 24px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 3px 12px rgba(44, 24, 16, 0.3);
    transition: all 0.15s;
  }
  .mobile-submit-btn:hover {
    background: var(--accent-primary);
    transform: scale(1.02);
  }
  .mobile-submit-btn:active {
    transform: scale(0.96);
  }

  /* ── Mobile Lit Popup Bottom Sheet ── */
  .lit-popup-bottom-sheet {
    max-height: 80vh;
    overflow-y: auto;
  }
  .lit-popup-bottom-sheet .lit-popup-header {
    position: sticky;
    top: 0;
    background: var(--bg-card);
    z-index: 1;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-primary);
  }
  .lit-popup-bottom-sheet .lit-popup-body {
    padding-top: 8px;
  }
}

/* ══════════════════════════════════════════
   MOBILE COMPACT HEADER (1-line)
   ══════════════════════════════════════════ */
@media (max-width: 768px) {
  .mobile-anchor {
    font-size: 0.6rem !important;
    letter-spacing: 1.5px !important;
    margin: 2px 0 0 !important;
    padding: 0 !important;
    border: none !important;
    opacity: 0.5;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-primary) !important;
  }
  .mobile-header-compact {
    padding: 4px 0 !important;
    margin: 0 !important;
  }
  .mobile-header-compact h1 {
    font-size: 1rem !important;
    margin: 0 !important;
    color: var(--text-primary) !important;
  }
  .mobile-header-line {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
    white-space: nowrap;
  }
  .mobile-header-line p {
    font-size: 0.75rem !important;
    margin: 0 !important;
    color: #9b9488;
  }
  .mobile-header-line .save-indicator {
    font-size: 0.7rem !important;
  }
  .mobile-header-line .icon-btn,
  .mobile-header-line .action-drawer-btn {
    font-size: 0.85rem !important;
    padding: 2px !important;
  }

  /* ── Hide export button on mobile ── */
  .mobile-layout .export-btn {
    display: none !important;
  }

  /* ── Hide deadline on mobile ── */
  .mobile-layout .deadline-banner {
    display: none !important;
  }

  /* ── Composer compaction ── */
  .mobile-layout .composer-top-bar {
    flex-wrap: nowrap !important;
    gap: 4px !important;
    padding: 4px 8px !important;
  }
  .mobile-layout .format-toolbar button {
    font-size: 0.75rem !important;
    padding: 3px 6px !important;
    min-width: unset !important;
  }

  /* ── Textarea: TNR 12pt, 16 lines × 40 chars ── */
  .mobile-layout .notebook-composer textarea {
    font-family: 'Times New Roman', Times, serif !important;
    font-size: 12pt !important;
    line-height: 1.15 !important;
    min-height: calc(16 * 12pt * 1.15) !important;
    max-height: none !important;
    flex: 1 !important;
    overflow-y: auto !important;
  }

  /* ── Controls row: shrink attach, hide word count, reposition submit ── */
  .mobile-layout .attach-btn {
    font-size: 0.75rem !important;
    padding: 3px 8px !important;
  }
  .mobile-layout .word-count {
    display: none !important;
  }
  .mobile-layout .composer-hint {
    display: none !important;
  }
  .mobile-layout .notebook-controls {
    flex-wrap: nowrap !important;
    gap: 4px !important;
  }
  .mobile-layout .inline-save-btn {
    display: none !important;
  }
}

/* ══════════════════════════════════════════
   DRAGGABLE SPLIT DIVIDER (Desktop Research)
   ══════════════════════════════════════════ */
.split-divider {
  width: 8px;
  cursor: col-resize;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
  z-index: 5;
  margin: 0 -4px;
}
.split-divider:hover .split-divider-line,
.split-divider:active .split-divider-line {
  background: var(--accent-purple);
  width: 3px;
}
.split-divider-line {
  width: 2px;
  height: 60px;
  background: #d6cfc5;
  border-radius: 2px;
  transition: all 0.15s;
}

/* ══════════════════════════════════════════
   RESEARCH LEFT HEADER (Desktop)
   ══════════════════════════════════════════ */
.research-left-header {
  display: flex;
  flex-direction: column;
  margin-bottom: 2px;
  gap: 2px;
  padding: 2px 0;
}
.research-left-header .identity-anchor {
  margin: 0 !important;
  padding: 0 !important;
  border: none !important;
  font-size: clamp(0.65rem, 2cqi, 0.85rem);
  color: #4a2080;
  opacity: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  text-align: center;
  line-height: 1.4;
  font-weight: 700;
}
/* Row 2: toolbars left, mode icons right */
.research-left-row2 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
}
.research-left-toolbars {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
  overflow: hidden;
}
.format-toolbar--header {
  display: flex;
  gap: 2px;
  flex-shrink: 0;
}
.format-toolbar--header button {
  background: none;
  border: none;
  font-size: calc(var(--fs-xs) * 1.2);
  cursor: pointer;
  color: var(--text-faint);
  padding: 3px 6px;
  border-radius: 3px;
  transition: background 0.15s;
}
.format-toolbar--header button:hover { background: rgba(44,24,16,0.06); }
.research-left-controls {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.mode-btn-icon {
  font-size: calc(var(--fs-sm) * 1.2) !important;
  padding: 3px 7px !important;
  line-height: 1;
}
.mode-btn-icon:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
.research-left-controls .save-indicator {
  font-size: calc(var(--fs-xs) * 0.9);
  color: #4a2080;
  white-space: nowrap;
}

/* ── Research split: use CSS grid with dynamic columns (inline style overrides) ── */
.research-split {
  display: grid !important;
  gap: 0 !important;
  align-items: start;
}

/* =========================================
   COMPACT NOTE CARDS (Timeline Trays)
   ========================================= */
.note-tray-collapsed {
  cursor: pointer;
  padding: 12px 16px;
  background: var(--bg-surface, #ffffff);
  border: 1px solid var(--border-color, #e8e4dc);
  border-radius: 8px;
  margin-bottom: 12px;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.note-tray-collapsed:hover {
  border-color: var(--accent-primary, #8b5cf6);
  box-shadow: var(--shadow-sm, 0 2px 8px rgba(0,0,0,0.05));
  transform: translateY(-1px);
}

.note-tray-snippet {
  font-size: 0.95rem;
  color: var(--text-secondary, #555);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-top: 8px;
  margin-bottom: 8px;
}

.note-tray-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.note-tray-tags .tag-pill {
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: 12px;
  background: var(--bg-tag, #f3f0eb);
  color: var(--text-secondary, #6b6455);
  cursor: pointer;
  transition: background 0.15s ease;
}

.note-tray-tags .tag-pill:hover {
  background: var(--accent-primary, #8b5cf6);
  color: #fff;
}

/* When expanded, mark with accent border */
.notebook-entry.is-expanded {
  border-left: 3px solid var(--accent-primary, #8b5cf6);
  padding-left: 13px;
}
/* ══════════════════════════════════════════════
   TRUE MODAL: Literature Detail / Edit Popup
   Times New Roman, 1.2x scale, justify
   ══════════════════════════════════════════════ */
.lit-modal-overlay {
  z-index: 9999 !important;
}

.lit-modal {
  max-width: 850px !important;
  width: 90vw !important;
  max-height: 85vh !important;
  display: flex !important;
  flex-direction: column !important;
  font-family: "Times New Roman", Times, serif !important;
  font-size: 1.15rem !important;
  text-align: justify !important;
  padding: 30px !important;
  border-radius: 12px !important;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3) !important;
  animation: litModalIn 0.25s ease;
}

@keyframes litModalIn {
  from { transform: scale(0.95); opacity: 0; }
  to   { transform: scale(1);    opacity: 1; }
}

.lit-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  border-bottom: 2px solid var(--border-primary, #e8e4dc);
  padding-bottom: 15px;
  margin-bottom: 20px;
}

.lit-modal-title {
  margin: 0;
  font-size: 1.4rem;
  color: var(--accent-primary, #8b5cf6);
  text-align: left;
  font-family: "Times New Roman", Times, serif;
}

.lit-modal-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-shrink: 0;
}

.lit-modal-save-btn {
  background: var(--color-success, #10b981);
  color: #fff;
  border: none;
  padding: 6px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: bold;
  font-size: 1rem;
  transition: background 0.15s;
}
.lit-modal-save-btn:hover { background: #059669; }
.lit-modal-save-btn:disabled { opacity: 0.6; cursor: not-allowed; }

.lit-modal-cancel-btn,
.lit-modal-edit-btn {
  background: var(--bg-hover, #f0eee8);
  border: none;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 1rem;
  color: var(--text-primary, #2d2a24);
  transition: background 0.15s;
}
.lit-modal-cancel-btn:hover,
.lit-modal-edit-btn:hover {
  background: var(--border-primary, #e8e4dc);
}

.lit-modal-close-btn {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-muted, #9b9488);
  margin-left: 10px;
  padding: 0 4px;
  line-height: 1;
  transition: color 0.15s;
}
.lit-modal-close-btn:hover { color: var(--text-primary); }

.lit-modal-body {
  overflow-y: auto;
  padding-right: 15px;
  flex: 1;
}

.lit-modal-field {
  margin-bottom: 20px;
}

.lit-modal-field-label {
  display: block;
  font-weight: bold;
  margin-bottom: 8px;
  color: var(--text-secondary, #6b6860);
  font-size: 1rem;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  text-align: left;
}

.lit-modal-field-edit {
  width: 100%;
  padding: 12px;
  border-radius: 6px;
  border: 1px solid var(--accent-primary, #8b5cf6);
  background: var(--bg-main, #faf9f6);
  color: var(--text-primary, #2d2a24);
  resize: vertical;
  font-family: "Times New Roman", Times, serif;
  font-size: 1.15rem;
  line-height: 1.6;
  box-sizing: border-box;
  transition: border-color 0.15s;
}
.lit-modal-field-edit:focus {
  outline: none;
  border-color: var(--accent-secondary, #7c3aed);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15);
}

.lit-modal-field-value {
  line-height: 1.6;
  color: var(--text-primary, #2d2a24);
  font-family: "Times New Roman", Times, serif;
  font-size: 1.15rem;
}

/* ── AI Thinking Indicator (Normal Mode) ── */
.ai-thinking-indicator {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  background: rgba(139, 92, 246, 0.1);
  color: #7c3aed;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 600;
  animation: aiThinkPulse 1.5s ease-in-out infinite;
  white-space: nowrap;
}

@keyframes aiThinkPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* ── Mobile responsive for lit modal ── */
@media (max-width: 768px) {
  .lit-modal {
    max-width: 100vw !important;
    width: 96vw !important;
    max-height: 92vh !important;
    padding: 18px !important;
    font-size: 1rem !important;
    border-radius: 10px !important;
  }
  .lit-modal-title {
    font-size: 1.2rem;
  }
  .lit-modal-field-edit {
    font-size: 1rem;
    padding: 10px;
  }
  .lit-modal-field-value {
    font-size: 1rem;
  }
}

/* ══════════════════════════════════════════
   TIME SLICER (Pomodoro/Deep Work)
   ══════════════════════════════════════════ */

/* ── Sticky Focus Banner ── */
.focus-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 9999;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  border-bottom: 2px solid #e94560;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  animation: focusBannerSlide 0.3s ease-out;
  box-shadow: 0 4px 20px rgba(233, 69, 96, 0.3);
}

.focus-banner-timer {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 2rem;
  font-weight: 700;
  color: #e94560;
  letter-spacing: 2px;
  min-width: 100px;
  text-align: center;
}

.focus-banner-task {
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.95rem;
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.focus-banner-actions {
  display: flex;
  gap: 8px;
}

.focus-btn {
  padding: 6px 14px;
  border-radius: 6px;
  border: none;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.focus-btn-pause {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}
.focus-btn-pause:hover {
  background: rgba(255, 255, 255, 0.25);
}

.focus-btn-finish {
  background: #e94560;
  color: #fff;
}
.focus-btn-finish:hover {
  background: #d63851;
}

@keyframes focusBannerSlide {
  from { transform: translateY(-100%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* ── Focus Log Modal ── */
.focus-log-modal {
  position: fixed;
  inset: 0;
  z-index: 10001;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
}

.focus-log-modal > div {
  background: #1e1e2e;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 24px;
  width: 90%;
  max-width: 480px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.focus-log-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: #e94560;
  margin-bottom: 4px;
}

.focus-log-task {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.5);
  margin-bottom: 14px;
}

.focus-log-textarea {
  width: 100%;
  min-height: 120px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 12px;
  color: #fff;
  font-size: 0.95rem;
  font-family: inherit;
  resize: vertical;
  margin-bottom: 14px;
}
.focus-log-textarea:focus {
  outline: none;
  border-color: #e94560;
}

.focus-log-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.focus-log-cancel {
  padding: 8px 16px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: transparent;
  color: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  font-size: 0.85rem;
}
.focus-log-cancel:hover {
  background: rgba(255, 255, 255, 0.05);
}

.focus-log-save {
  padding: 8px 16px;
  border-radius: 6px;
  border: none;
  background: #e94560;
  color: #fff;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.85rem;
}
.focus-log-save:hover {
  background: #d63851;
}

/* ── Mobile responsive for focus banner ── */
@media (max-width: 768px) {
  .focus-banner {
    flex-direction: column;
    gap: 8px;
    padding: 8px 12px;
  }
  .focus-banner-timer {
    font-size: 1.6rem;
  }
  .focus-banner-task {
    max-width: 90vw;
    font-size: 0.85rem;
  }
}
/* ══════════════════════════════════════════
   MANUSCRIPT EDITOR — Isolated 3-Pane Layout
   Phase 4: Manuscript Mode
   Sprint 25: Harmonised with JournalApp.css token system
   ══════════════════════════════════════════ */

/* ── Full-screen overlay ── */
.manuscript-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--bg-secondary, #faf8f5);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: msSlideIn 0.3s ease;
}

@keyframes msSlideIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── Top Bar ── */
.manuscript-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 18px;
  border-bottom: 1px solid var(--border-primary, #e8e3db);
  background: var(--bg-secondary, #faf8f5);
  gap: 14px;
  flex-shrink: 0;
  min-height: 48px;
}

.manuscript-topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.manuscript-close-btn {
  background: var(--bg-tertiary, #f5f0ea);
  border: 1px solid var(--border-secondary, #d1cdc5);
  border-radius: var(--radius-md, 8px);
  padding: 6px 14px;
  color: var(--text-secondary, #4a3f35);
  cursor: pointer;
  font-size: 0.82rem;
  white-space: nowrap;
  transition: all 0.2s;
  font-weight: 500;
  box-shadow: var(--shadow-sm, 0 1px 3px rgba(0,0,0,0.08));
}

.manuscript-close-btn:hover {
  background: var(--bg-hover, #ebe6df);
  color: var(--text-primary, #2c1810);
  border-color: var(--accent-primary, #8b7355);
  box-shadow: var(--shadow-md, 0 2px 8px rgba(0,0,0,0.10));
}

.manuscript-title-input {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  font-size: 1.15rem;
  font-family: 'Georgia', 'Times New Roman', serif;
  font-weight: 600;
  color: var(--text-primary, #2c1810);
  padding: 4px 0;
  flex: 1;
  min-width: 0;
  outline: none;
  transition: border-color 0.2s;
}

.manuscript-title-input:focus {
  border-bottom-color: #8b7355;
}

.manuscript-topbar-center {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
}

.manuscript-wordcount {
  font-size: 0.82rem;
  color: var(--text-faint, #888);
  font-family: 'SF Mono', 'Cascadia Code', monospace;
}

.manuscript-save-status {
  font-size: 0.72rem;
  font-weight: 500;
}

.manuscript-save-status.saved { color: #22c55e; }
.manuscript-save-status.saving { color: #f59e0b; }
.manuscript-save-status.error { color: #ef4444; }
.manuscript-save-status.editing { color: var(--text-faint, #888); }

.manuscript-topbar-right {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

.ms-toolbar-btn {
  background: var(--bg-tertiary, #f5f0ea);
  border: 1px solid transparent;
  color: var(--text-secondary, #4a3f35);
  border-radius: 6px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-family: 'Georgia', serif;
  font-size: 13px;
  transition: all 0.15s;
}

.ms-toolbar-btn:hover {
  background: var(--bg-hover, #ebe6df);
  color: var(--text-primary, #2c1810);
  border-color: var(--border-secondary, #d1cdc5);
}

.ms-toolbar-btn.active {
  background: var(--bg-hover, #ebe6df);
  border-color: var(--border-accent, #8b7355);
  color: var(--text-primary, #2c1810);
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.ms-toolbar-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.ms-font-label {
  font-size: 11px;
  color: var(--text-faint, #888);
  min-width: 20px;
  text-align: center;
  font-family: 'SF Mono', 'Cascadia Code', monospace;
}

.ms-toolbar-divider {
  width: 1px;
  height: 18px;
  background: #d1cdc5;
  margin: 0 4px;
}

/* ── 3-Pane Body ── */
.manuscript-body {
  display: flex;
  flex: 1;
  overflow: hidden;
  min-height: 0;
}

/* ── Left Pane: ToC ── */
.manuscript-toc {
  width: 220px;
  min-width: 180px;
  border-right: 1px solid var(--border-primary, #e8e3db);
  padding: 16px 14px;
  overflow-y: auto;
  flex-shrink: 0;
  background: var(--bg-tertiary, #f7f3ee);
}

.toc-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-secondary, #4a3f35);
  margin: 0 0 14px 0;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.toc-empty {
  font-size: 0.82rem;
  color: var(--text-faint, #999);
  font-style: italic;
  line-height: 1.6;
}

.toc-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.toc-item {
  padding: 5px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.82rem;
  color: var(--text-secondary, #4a3f35);
  line-height: 1.4;
  transition: all 0.15s;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.toc-item:hover {
  background: var(--bg-hover, #ebe6df);
  color: var(--text-primary, #2c1810);
}

.toc-level-1 { font-weight: 600; padding-left: 10px; }
.toc-level-2 { padding-left: 22px; }
.toc-level-3 { padding-left: 34px; font-size: 0.82rem; }
.toc-level-4 { padding-left: 46px; font-size: 0.72rem; color: var(--text-faint, #888); }

.toc-stats {
  margin-top: 24px;
  padding-top: 12px;
  border-top: 1px solid var(--border-primary, #e8e3db);
}

.toc-stat {
  font-size: 0.72rem;
  color: var(--text-faint, #999);
  margin-bottom: 4px;
}

/* ── Center Pane: Editor ── */
.manuscript-editor-pane {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  min-width: 0;
}

.manuscript-textarea {
  flex: 1;
  border: none;
  outline: none;
  resize: none;
  padding: 32px 48px;
  font-family: 'Georgia', 'Times New Roman', serif;
  font-size: 16px;
  line-height: 1.85;
  color: var(--text-primary, #2c1810);
  background: var(--bg-secondary, #faf8f5);
  overflow-y: auto;
  tab-size: 4;
}

.manuscript-textarea::placeholder {
  color: var(--text-placeholder, #c0b8a8);
  font-style: italic;
}

.manuscript-textarea:focus {
  background: #fffdf9;
}

.manuscript-graveyard-float {
  position: absolute;
  bottom: 16px;
  right: 16px;
  background: #f5f1ec;
  border: 1px solid var(--border-secondary, #d1cdc5);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 0.82rem;
  color: var(--text-faint, #888);
  cursor: pointer;
  transition: all 0.2s;
  opacity: 0.6;
}

.manuscript-graveyard-float:hover {
  opacity: 1;
  background: var(--bg-hover, #ebe6df);
  color: var(--text-primary, #2c1810);
  border-color: var(--border-accent, #8b7355);
}

/* ── Right Pane: Graveyard + AI ── */
.manuscript-right-pane {
  width: 300px;
  min-width: 240px;
  border-left: 1px solid var(--border-primary, #e8e3db);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow: hidden;
  background: var(--bg-tertiary, #f7f3ee);
}

/* ── AI Result Card ── */
.manuscript-ai-result {
  padding: 12px;
  border-bottom: 1px solid var(--border-primary, #e8e3db);
  max-height: 40%;
  overflow-y: auto;
}

.ai-result-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.ai-result-header h4 {
  margin: 0;
  font-size: 0.88rem;
  color: var(--text-primary, #2c1810);
}

.ai-result-close {
  background: transparent;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  color: var(--text-faint, #888);
  padding: 2px 6px;
}

.ai-result-close:hover { color: #ef4444; }

.ai-result-body p {
  font-size: 0.82rem;
  color: var(--text-muted, #555);
  line-height: 1.5;
  margin: 4px 0;
}

.ai-result-insert {
  margin-top: 8px;
  background: #2c1810;
  color: #faf8f5;
  border: none;
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 0.82rem;
  cursor: pointer;
  width: 100%;
  transition: background 0.2s;
}

.ai-result-insert:hover {
  background: #8b7355;
}

/* ── Graveyard ── */
.manuscript-graveyard {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.graveyard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-primary, #e8e3db);
  background: var(--bg-tertiary, #f3efe9);
}

.graveyard-header h4 {
  margin: 0;
  font-size: 0.88rem;
  color: var(--text-secondary, #4a3f35);
  font-weight: 700;
}

.graveyard-count {
  font-size: 0.72rem;
  color: var(--text-faint, #999);
  font-weight: 400;
  margin-left: 6px;
}

.graveyard-restore-btn {
  background: transparent;
  border: 1px solid var(--border-secondary, #d1cdc5);
  border-radius: 5px;
  padding: 3px 10px;
  font-size: 0.72rem;
  color: var(--text-muted, #555);
  cursor: pointer;
  transition: all 0.15s;
}

.graveyard-restore-btn:hover {
  background: var(--bg-hover, #ebe6df);
  color: var(--text-primary, #2c1810);
}

.graveyard-textarea {
  flex: 1;
  border: none;
  outline: none;
  resize: none;
  padding: 12px;
  font-family: 'Georgia', serif;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-faint, #888);
  background: transparent;
  overflow-y: auto;
}

.graveyard-textarea::placeholder {
  color: var(--text-placeholder, #c0b8a8);
  font-style: italic;
}

/* ── AI Processing Overlay ── */
.manuscript-ai-overlay {
  position: absolute;
  inset: 0;
  background: rgba(250, 248, 245, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

.manuscript-ai-spinner {
  background: var(--bg-card, #fff);
  padding: 16px 32px;
  border-radius: 12px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.08);
  font-size: 1rem;
  color: var(--text-primary, #2c1810);
  animation: msPulse 1.5s infinite;
}

@keyframes msPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* ── Focus Mode ── */
.manuscript-overlay.focus-mode .manuscript-topbar {
  opacity: 0.3;
  transition: opacity 0.3s;
}

.manuscript-overlay.focus-mode .manuscript-topbar:hover {
  opacity: 1;
}

.manuscript-overlay.focus-mode .manuscript-textarea {
  padding: 48px 20%;
  max-width: 100%;
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .manuscript-toc { display: none; }
  .manuscript-right-pane { 
    position: fixed;
    right: 0;
    top: 48px;
    bottom: 0;
    width: 85vw;
    max-width: 320px;
    z-index: 10;
    box-shadow: -4px 0 24px rgba(0,0,0,0.1);
  }
  .manuscript-textarea {
    padding: 16px;
  }
  .manuscript-topbar {
    flex-wrap: wrap;
    gap: 6px;
    padding: 6px 10px;
  }
  .manuscript-topbar-right {
    flex-wrap: wrap;
  }
}

/* ── Manuscript Dashboard Grid (in JournalApp) ── */
.manuscripts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  padding: 8px 0;
}

.manuscript-card {
  background: var(--bg-card, #fff);
  border: 1px solid var(--border-primary, #e8e3db);
  border-radius: var(--radius-lg, 12px);
  padding: 16px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: var(--shadow-sm, 0 1px 3px rgba(0,0,0,0.08));
}

.manuscript-card:hover {
  border-color: var(--accent-primary, #8b7355);
  box-shadow: var(--shadow-md, 0 2px 8px rgba(0,0,0,0.10));
  transform: translateY(-1px);
}

.manuscript-card-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary, #2c1810);
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.manuscript-card-meta {
  font-size: 0.72rem;
  color: var(--text-faint, #999);
  display: flex;
  gap: 12px;
}

.manuscript-card-preview {
  font-size: 0.82rem;
  color: #777;
  line-height: 1.4;
  max-height: 3.6em;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

.manuscript-new-card {
  background: transparent;
  border: 2px dashed #d1cdc5;
  border-radius: 10px;
  padding: 24px 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-faint, #999);
  font-size: 0.88rem;
  transition: all 0.2s;
}

.manuscript-new-card:hover {
  border-color: var(--border-accent, #8b7355);
  color: var(--text-primary, #2c1810);
  background: #f5f1ec;
}

.manuscript-delete-btn {
  background: transparent;
  border: none;
  color: #ccc;
  cursor: pointer;
  font-size: 0.82rem;
  padding: 2px 6px;
  border-radius: 4px;
  align-self: flex-end;
  transition: color 0.15s;
}

.manuscript-delete-btn:hover {
  color: #ef4444;
}

/* ══════════════════════════════════════════════════════════
   NATIVE MANUSCRIPT EDITOR  (integrated into left pane)
   ══════════════════════════════════════════════════════════ */

.manuscript-native-editor {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

/* ── Top Bar ── */
.ms-native-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg-secondary, #faf8f5);
  border-bottom: 1px solid #e8e2d9;
  flex-shrink: 0;
  flex-wrap: wrap;
  min-height: 44px;
}

/* ── Manuscript Format Toolbar ── */
.ms-format-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 3px 10px;
  background: #f5f2ed;
  border-bottom: 1px solid #e8e2d9;
  flex-shrink: 0;
  overflow-x: auto;
  flex-wrap: wrap;
  gap: 6px;
}
.ms-format-toolbar .format-toolbar {
  display: flex;
  align-items: center;
  gap: 1px;
  flex-wrap: wrap;
  min-width: 0;
}
.ms-format-toolbar .format-toolbar button {
  background: transparent;
  border: 1px solid transparent;
  color: #4a3a2e;
  font-size: 12px;
  padding: 3px 7px;
  border-radius: 5px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  font-weight: 500;
}
.ms-format-toolbar .format-toolbar button:hover {
  background: rgba(139, 115, 85, 0.08);
  border-color: #d4cdc4;
}
.ms-format-toolbar .toolbar-divider {
  width: 1px;
  height: 14px;
  background: #d4cdc4;
  margin: 0 3px;
}
.ms-format-toolbar .font-size-label {
  font-size: 10px;
  color: #8a7a6a;
  min-width: 18px;
  text-align: center;
}
/* Sprint 52: Utility controls (Sort, Font size) — right-aligned in manuscript toolbar */
.ms-format-toolbar .utility-controls {
  display: flex;
  align-items: center;
  gap: 1px;
}
.ms-format-toolbar .utility-controls button {
  background: transparent;
  border: 1px solid transparent;
  color: #4a3a2e;
  font-size: 12px;
  padding: 3px 7px;
  border-radius: 5px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  font-weight: 500;
}
.ms-format-toolbar .utility-controls button:hover {
  background: rgba(139, 115, 85, 0.08);
  border-color: #d4cdc4;
}

/* ── Permanent AI Scalpel Buttons (own row) ── */
.ms-scalpel-row {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px 12px 4px;
  border-bottom: 1px solid #e8e0d6;
  background: rgba(176, 137, 104, 0.04);
  flex-wrap: wrap;
}
.ms-scalpel-divider {
  border-left: 2px solid #b08968 !important;
  background: #b08968 !important;
  width: 2px !important;
  margin: 0 8px !important;
}
.ms-scalpel-btn {
  color: #8b6914 !important;
  font-weight: 600 !important;
  font-size: 11px !important;
  padding: 3px 6px !important;
  white-space: nowrap !important;
  flex-shrink: 1 !important;
  min-width: 0 !important;
  border-radius: 5px !important;
  background: rgba(176, 137, 104, 0.06) !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}
.ms-scalpel-btn:hover {
  background: rgba(176, 137, 104, 0.15) !important;
  border-color: #b08968 !important;
}
.ms-scalpel-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed !important;
}
.ms-scalpel-row > button,
.ms-tool-select {
  border: 1px solid #ded4c8;
  border-radius: 6px;
  background: #fffdf8;
  color: #5f4a35;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 7px;
}
.ms-tool-select {
  max-width: 112px;
}
.ms-save-indicator.ai {
  color: #b08968;
  font-weight: 600;
}

.ms-native-topbar-left {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
}

.ms-native-topbar-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  flex-wrap: wrap;
}

.ms-back-btn {
  background: var(--bg-tertiary, #f5f0ea);
  border: 1px solid var(--border-secondary, #d1cdc5);
  border-radius: 8px;
  padding: 5px 12px;
  font-size: 0.82rem;
  color: var(--text-secondary, #4a3f35);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
  font-weight: 500;
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}

.ms-back-btn:hover {
  background: var(--bg-hover, #ebe6df);
  border-color: var(--border-accent, #8b7355);
  color: var(--text-primary, #2c1810);
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.ms-toc-toggle {
  background: transparent;
  border: 1px solid var(--border-secondary, #d1cdc5);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 0.82rem;
  color: #6b5b47;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
}

.ms-toc-toggle:hover {
  background: #f0ebe4;
  border-color: var(--border-accent, #8b7355);
}

.ms-native-title {
  flex: 1;
  min-width: 120px;
  border: none;
  background: transparent;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary, #2c1810);
  font-family: 'EB Garamond', 'Crimson Text', Georgia, serif;
  padding: 4px 8px;
  border-radius: 4px;
  outline: none;
  transition: background 0.15s;
}

.ms-native-title:focus {
  background: var(--bg-card, #fff);
  box-shadow: 0 0 0 2px rgba(139, 115, 85, 0.2);
}

.ms-native-title::placeholder {
  color: #b8ad9e;
  font-weight: 400;
}

.ms-wordcount {
  font-size: 0.72rem;
  color: var(--text-faint, #a09080);
  white-space: nowrap;
  letter-spacing: 0.02em;
  flex-shrink: 0;
}

.ms-nexus-btn {
  background: linear-gradient(135deg, #f0ebe4, #e8e2d9);
  border: 1px solid var(--border-secondary, #d1cdc5);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 0.82rem;
  color: #6b5b47;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  flex-shrink: 0;
}

.ms-nexus-btn:hover:not(:disabled) {
  background: linear-gradient(135deg, #e8e2d9, #d1cdc5);
  border-color: var(--border-accent, #8b7355);
  color: var(--text-primary, #2c1810);
}

.ms-nexus-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.ms-tool-btn {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 0.88rem;
  cursor: pointer;
  transition: all 0.15s;
  flex-shrink: 0;
}

.ms-tool-btn:hover {
  background: #f0ebe4;
  border-color: var(--border-secondary, #d1cdc5);
}

.ms-tool-btn.active {
  background: #e8e2d9;
  border-color: var(--border-accent, #8b7355);
}

.ms-tool-btn.ms-delete-btn:hover {
  background: #fef2f2;
  border-color: #fca5a5;
}

.ms-save-indicator {
  font-size: 0.72rem;
  color: var(--text-faint, #a09080);
  transition: color 0.3s;
  white-space: nowrap;
  flex-shrink: 0;
}

.ms-save-indicator.saving { color: #d97706; }
.ms-save-indicator.saved  { color: #16a34a; }
.ms-save-indicator.error  { color: #ef4444; }

/* ── Nexus Result Banner ── */
.ms-nexus-result {
  background: linear-gradient(135deg, #fefce8, #fef9c3);
  border: 1px solid #fde68a;
  border-radius: 8px;
  margin: 8px 12px;
  padding: 0;
  overflow: hidden;
  animation: ms-nexus-fade-in 0.3s ease;
}

@keyframes ms-nexus-fade-in {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.ms-nexus-result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px 4px;
  font-size: 0.82rem;
  color: #92400e;
}

.ms-nexus-close {
  background: transparent;
  border: none;
  font-size: 1rem;
  cursor: pointer;
  color: var(--text-faint, #a09080);
  padding: 0 4px;
  line-height: 1;
}

.ms-nexus-close:hover { color: #2c1810; }

.ms-nexus-result-body {
  padding: 4px 12px 10px;
  font-size: 0.82rem;
  line-height: 1.6;
  color: #44403c;
  white-space: pre-wrap;
}

/* ── Body: ToC + Canvas + Manuscript Research Panel ── */
.ms-native-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.ms-native-body.ms-has-toc {
  grid-template-columns: 180px minmax(0, 1fr);
}
.ms-native-body.ms-has-right-panel {
  grid-template-columns: minmax(0, 1fr) minmax(320px, 380px);
}
.ms-native-body.ms-has-toc.ms-has-right-panel {
  grid-template-columns: 180px minmax(0, 1fr) minmax(320px, 380px);
}

/* ── Table of Contents Sidebar ── */
.ms-native-toc {
  width: 180px;
  min-width: 140px;
  max-width: 220px;
  background: var(--bg-secondary, #faf8f5);
  border-right: 1px solid #e8e2d9;
  padding: 12px 10px;
  overflow-y: auto;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ms-toc-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--accent-primary, #8b7355);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 0;
}

.ms-toc-empty {
  font-size: 0.72rem;
  color: #b8ad9e;
  font-style: italic;
  margin: 0;
}

.ms-toc-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ms-toc-item {
  font-size: 0.8rem;
  line-height: 1.4;
  color: #6b5b47;
  cursor: pointer;
  padding: 3px 6px;
  border-radius: 4px;
  transition: all 0.15s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ms-toc-item:hover {
  background: #f0ebe4;
  color: var(--text-primary, #2c1810);
}

.ms-toc-item.ms-toc-level-1 { padding-left: 6px; font-weight: 600; }
.ms-toc-item.ms-toc-level-2 { padding-left: 16px; }
.ms-toc-item.ms-toc-level-3 { padding-left: 26px; font-size: 0.78rem; }
.ms-toc-item.ms-toc-level-4 { padding-left: 36px; font-size: 0.75rem; color: var(--text-faint, #a09080); }

.ms-toc-stats {
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px solid #e8e2d9;
  font-size: 0.75rem;
  color: var(--text-faint, #a09080);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* ── Canvas (textarea + scalpels) ── */
.ms-native-canvas {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  position: relative;
}

.ms-native-textarea {
  flex: 1;
  width: 100%;
  border: none;
  outline: none;
  background: #fffdf8;
  color: var(--text-primary, #2c1810);
  font-family: 'EB Garamond', 'Crimson Text', Georgia, serif;
  font-size: 15px;
  line-height: 1.8;
  padding: 16px 20px;
  resize: none;
  overflow-y: auto;
  tab-size: 4;
}

.ms-native-textarea::placeholder {
  color: #c8bfb0;
  font-style: italic;
}

.ms-native-textarea:focus {
  background: #fffef9;
}

/* ── Graveyard Pane ── */
.ms-graveyard-pane {
  border-top: 1px solid #e8e2d9;
  background: var(--bg-secondary, #faf8f5);
  display: flex;
  flex-direction: column;
  max-height: 200px;
  min-height: 100px;
  flex-shrink: 0;
}

.ms-graveyard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px;
  border-bottom: 1px solid #e8e2d9;
}

.ms-graveyard-header h4 {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--accent-primary, #8b7355);
  margin: 0;
}

.ms-graveyard-count {
  font-size: 0.72rem;
  font-weight: 400;
  color: var(--text-faint, #a09080);
  margin-left: 6px;
}

.ms-graveyard-action {
  background: transparent;
  border: 1px solid var(--border-secondary, #d1cdc5);
  border-radius: 5px;
  padding: 2px 8px;
  font-size: 0.72rem;
  color: #6b5b47;
  cursor: pointer;
  margin-left: 4px;
  transition: all 0.15s;
}

.ms-graveyard-action:hover {
  background: #f0ebe4;
  border-color: var(--border-accent, #8b7355);
}

.ms-graveyard-textarea {
  flex: 1;
  width: 100%;
  border: none;
  outline: none;
  background: #faf6f0;
  color: #78716c;
  font-family: 'EB Garamond', 'Crimson Text', Georgia, serif;
  font-size: 13px;
  line-height: 1.7;
  padding: 10px 14px;
  resize: none;
  overflow-y: auto;
  font-style: italic;
}

.ms-graveyard-textarea::placeholder {
  color: #c8bfb0;
}

/* ── Trash Banner (soft-delete view) ── */
.ms-trash-banner {
  grid-column: 1 / -1;
  background: #fef2f2;
  border: 1px solid #fca5a5;
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 0.82rem;
  color: #b91c1c;
  text-align: center;
}

.ms-card-deleted {
  opacity: 0.7;
  border-style: dashed !important;
}

/* ══════════════════════════════════════════
   WRITE MODE — Phase 9: Tri-Panel Assembly Engine
   Deterministic Academic Compiler UI
   ══════════════════════════════════════════ */

/* ── Container ── */
.wm-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  background: var(--bg-secondary, #faf8f5);
}

/* ── Top Bar ── */
.wm-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  border-bottom: 1px solid var(--border-primary, #e8e3db);
  background: var(--bg-secondary, #faf8f5);
  gap: 12px;
  flex-shrink: 0;
  min-height: 48px;
}

.wm-topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.wm-topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.wm-title-input {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  font-size: 1.15rem;
  font-family: 'Georgia', 'Times New Roman', serif;
  font-weight: 600;
  color: var(--text-primary, #2c1810);
  padding: 4px 0;
  flex: 1;
  min-width: 0;
  outline: none;
  transition: border-color 0.2s;
}

.wm-title-input:focus {
  border-bottom-color: #8b7355;
}

.wm-action-btn {
  background: var(--bg-tertiary, #f5f0ea);
  border: 1px solid var(--border-secondary, #d1cdc5);
  border-radius: 8px;
  padding: 6px 14px;
  font-size: 0.82rem;
  color: var(--text-secondary, #4a3f35);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
  font-weight: 500;
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}

.wm-action-btn:hover {
  background: var(--bg-hover, #ebe6df);
  color: var(--text-primary, #2c1810);
  border-color: var(--border-accent, #8b7355);
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.wm-action-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.wm-export-btn {
  background: #e8f5e8;
  border-color: #a3d9a3;
  color: #2d6a2d;
}

.wm-export-btn:hover {
  background: #d4edd4;
  border-color: #6bbb6b;
}

/* ── Tri-Panel Body ── */
.wm-body {
  display: grid;
  grid-template-columns: 220px 1fr 340px;
  gap: 0;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* ── Left Panel: Outline ── */
.wm-panel-left {
  border-right: 1px solid var(--border-primary, #e8e3db);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-tertiary, #f7f3ee);
  padding-bottom: 8px;
}

.wm-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-primary, #e8e3db);
}

.wm-panel-header h4 {
  margin: 0;
  font-size: 0.88rem;
  color: var(--text-secondary, #4a3f35);
  font-weight: 700;
  letter-spacing: 0.2px;
}

.wm-small-btn {
  background: var(--bg-tertiary, #f5f0ea);
  border: 1px solid var(--border-secondary, #d1cdc5);
  border-radius: 5px;
  padding: 3px 10px;
  font-size: 0.72rem;
  color: var(--text-muted, #6b5c4d);
  cursor: pointer;
  transition: all 0.2s;
  font-weight: 500;
}

.wm-small-btn:hover {
  background: var(--bg-hover, #ebe6df);
  color: var(--text-primary, #2c1810);
}

.wm-block-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.wm-block-item {
  padding: 10px 12px;
  border-radius: var(--radius-md, 8px);
  margin-bottom: 6px;
  cursor: pointer;
  transition: all 0.15s;
  border: 1px solid transparent;
  position: relative;
  background: rgba(255,255,255,0.6);
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

.wm-block-item:hover {
  background: var(--bg-hover, #f0ebe4);
  border-color: var(--border-primary, #e8e3db);
  box-shadow: var(--shadow-sm, 0 1px 3px rgba(0,0,0,0.08));
}

.wm-block-active {
  background: var(--bg-hover, #ebe6df);
  border-color: var(--border-accent, #8b7355);
  box-shadow: 0 1px 6px rgba(0,0,0,0.08);
}

.wm-block-locked {
  opacity: 0.8;
}

.wm-block-item-top {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  margin-bottom: 4px;
}

.wm-block-status {
  font-size: 0.72rem;
}

.wm-block-type {
  color: var(--accent-primary, #8b7355);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.68rem;
  letter-spacing: 0.8px;
}

.wm-block-idx {
  color: var(--text-faint, #b0a090);
  font-size: 0.68rem;
  margin-left: auto;
}

.wm-block-goal {
  font-size: 0.82rem;
  color: var(--text-secondary, #3a3228);
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wm-block-goal em {
  color: var(--text-faint, #b0a090);
}

.wm-block-meta {
  display: flex;
  gap: 8px;
  font-size: 0.68rem;
  color: var(--text-faint, #a09080);
  margin-top: 3px;
}

.wm-block-actions {
  display: flex;
  gap: 4px;
  margin-top: 6px;
}

.wm-block-actions button {
  background: var(--bg-tertiary, #f5f0ea);
  border: 1px solid var(--border-secondary, #d1cdc5);
  border-radius: var(--radius-sm, 4px);
  padding: 4px 8px;
  font-size: 0.72rem;
  cursor: pointer;
  transition: all 0.15s;
  color: var(--text-muted, #6b5c4d);
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

.wm-block-actions button:hover {
  background: var(--bg-hover, #e0d8cf);
  box-shadow: var(--shadow-sm, 0 1px 3px rgba(0,0,0,0.08));
}

.wm-block-actions button:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.wm-job-badge {
  font-size: 0.72rem;
  animation: wmPulse 1.5s infinite;
}

@keyframes wmPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ── Center Panel: Workbench ── */
.wm-panel-center {
  display: flex;
  flex-direction: column;
  padding: 18px 24px;
  overflow-y: auto;
  min-height: 0;
}

.wm-workbench-header {
  flex-shrink: 0;
  margin-bottom: 12px;
}

.wm-workbench-type-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.wm-type-select {
  background: var(--bg-tertiary, #f5f0ea);
  border: 1px solid var(--border-secondary, #d1cdc5);
  border-radius: 4px;
  padding: 3px 8px;
  font-size: 0.82rem;
  color: var(--text-secondary, #4a3f35);
  cursor: pointer;
}

.wm-status-badge {
  font-size: 0.72rem;
  padding: 3px 10px;
  border-radius: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.wm-status-empty { background: var(--bg-tertiary, #f3f0ec); color: var(--text-faint, #a09080); }
.wm-status-armed { background: #fef3c7; color: #92400e; }
.wm-status-drafted { background: #d1fae5; color: #065f46; }
.wm-status-locked { background: #e0e7ff; color: #3730a3; }

.wm-goal-input {
  width: 100%;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border-primary, #e8e3db);
  padding: 8px 0;
  font-size: 0.95rem;
  color: var(--text-primary, #2c1810);
  outline: none;
  font-family: 'Georgia', serif;
  transition: border-color 0.2s;
}

.wm-goal-input:focus {
  border-bottom-color: #8b7355;
}

.wm-goal-input::placeholder {
  color: var(--text-placeholder, #c0b8a8);
  font-style: italic;
}

/* ── Attached Note Chips ── */
.wm-attached-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.wm-note-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-tertiary, #f5f0ea);
  border: 1px solid var(--border-secondary, #d1cdc5);
  border-radius: 12px;
  padding: 3px 10px;
  font-size: 0.72rem;
  color: var(--text-muted, #6b5c4d);
}

.wm-note-chip button {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-faint, #b0a090);
  font-size: 0.88rem;
  padding: 0 2px;
  line-height: 1;
}

.wm-note-chip button:hover {
  color: #ef4444;
}

/* ── Compile Row ── */
.wm-compile-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.wm-compile-btn,
.wm-revise-btn {
  background: linear-gradient(135deg, #8b7355, #6b5c4d);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 8px 18px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  letter-spacing: 0.3px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.wm-compile-btn:hover,
.wm-revise-btn:hover {
  background: linear-gradient(135deg, #6b5c4d, #4a3f35);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}

.wm-compile-btn:disabled,
.wm-revise-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.wm-lock-btn, .wm-unlock-btn {
  background: var(--bg-tertiary, #f5f0ea);
  border: 1px solid var(--border-secondary, #d1cdc5);
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 0.82rem;
  cursor: pointer;
  transition: all 0.2s;
  color: var(--text-muted, #6b5c4d);
}

.wm-lock-btn:hover {
  background: #e0e7ff;
  border-color: #818cf8;
  color: #3730a3;
}

.wm-unlock-btn:hover {
  background: #fef3c7;
  border-color: #fbbf24;
  color: #92400e;
}

.wm-version-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  color: var(--accent-primary, #8b7355);
  margin-left: auto;
}

.wm-version-nav button {
  background: var(--bg-tertiary, #f5f0ea);
  border: 1px solid var(--border-secondary, #d1cdc5);
  border-radius: 3px;
  padding: 2px 6px;
  cursor: pointer;
  font-size: 0.72rem;
  color: var(--text-muted, #6b5c4d);
}

.wm-version-nav button:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.wm-stream-card {
  border: 1px solid var(--border-secondary, #d1cdc5);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 12px;
  background: var(--bg-tertiary, #f5f0ea);
}

.wm-stream-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.wm-stream-title {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--text-secondary, #4a3f35);
  letter-spacing: 0.2px;
}

.wm-stream-status {
  font-size: 0.72rem;
  color: var(--accent-primary, #8b7355);
  font-weight: 600;
}

.wm-stream-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 0.7rem;
  color: var(--text-faint, #9f907f);
  margin-bottom: 8px;
}

.wm-stream-preview {
  max-height: 140px;
  overflow: auto;
  font-size: 0.82rem;
  line-height: 1.55;
  color: var(--text-primary, #2c1810);
  background: var(--bg-card, #fff);
  border: 1px solid var(--border-primary, #e8e3db);
  border-radius: 8px;
  padding: 10px;
  margin-bottom: 8px;
  white-space: pre-wrap;
}

.wm-stream-hint {
  margin: 0 0 8px 0;
  font-size: 0.78rem;
  color: var(--text-faint, #9f907f);
}

.wm-stream-error {
  margin: 0 0 8px 0;
  font-size: 0.78rem;
  color: #b91c1c;
}

.wm-stream-actions {
  display: flex;
  gap: 6px;
}

.wm-stream-btn {
  border: 1px solid var(--border-secondary, #d1cdc5);
  background: var(--bg-card, #fff);
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 0.74rem;
  cursor: pointer;
  color: var(--text-secondary, #4a3f35);
}

.wm-stream-btn-stop {
  border-color: #fca5a5;
  color: #991b1b;
}

.wm-stream-btn-resume {
  border-color: #86efac;
  color: #065f46;
}

.wm-stream-btn-dismiss {
  border-color: #cbd5e1;
  color: #334155;
}

/* ── Draft Textarea ── */
.wm-draft-textarea {
  flex: 1;
  min-height: 250px;
  width: 100%;
  background: var(--bg-card, #fff);
  border: 1px solid var(--border-primary, #e8e3db);
  border-radius: 10px;
  padding: 16px 18px;
  font-family: 'Georgia', 'Times New Roman', serif;
  font-size: 1rem;
  line-height: 1.75;
  color: var(--text-primary, #2c1810);
  resize: none;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.03);
}

.wm-draft-textarea:focus {
  border-color: var(--border-accent, #8b7355);
  box-shadow: 0 0 0 3px rgba(139, 115, 85, 0.1);
}

.wm-draft-textarea:disabled {
  background: var(--bg-tertiary, #f7f3ee);
  color: var(--accent-primary, #8b7355);
  cursor: not-allowed;
}

.wm-draft-textarea::placeholder {
  color: var(--text-placeholder, #c0b8a8);
  font-style: italic;
}

.wm-empty-workbench {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  color: var(--text-faint, #b0a090);
  font-style: italic;
}

/* ── Right Panel: Intelligence Hub ── */
.wm-panel-right {
  border-left: 1px solid var(--border-primary, #e8e3db);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-tertiary, #f7f3ee);
  min-width: 0;
}

.ms-workspace-panel {
  min-height: 0;
}

.ms-workspace-panel:not(.wm-drawer-open) {
  display: none;
}

.wm-hub-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-primary, #e8e3db);
  flex-shrink: 0;
  background: var(--bg-tertiary, #f3efe9);
}

.wm-hub-tabs button {
  flex: 1;
  padding: 9px 6px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  font-size: 0.72rem;
  color: var(--accent-primary, #8b7355);
  transition: all 0.2s;
  white-space: nowrap;
  font-weight: 500;
}

.wm-hub-tabs button:hover {
  background: var(--bg-hover, #ebe6df);
  color: var(--text-secondary, #4a3f35);
}

.wm-hub-tabs button.active {
  color: var(--text-primary, #2c1810);
  border-bottom-color: #8b7355;
  font-weight: 700;
  background: var(--bg-tertiary, #f7f3ee);
}

.wm-hub-content {
  flex: 1;
  overflow-y: auto;
  padding: 12px 14px;
}

.wm-hub-section-title {
  font-size: 0.82rem;
  color: var(--text-secondary, #4a3f35);
  margin: 0 0 10px 0;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.wm-hub-empty {
  color: var(--text-faint, #b0a090);
  font-size: 0.82rem;
  font-style: italic;
  text-align: center;
  padding: 32px 12px;
  line-height: 1.6;
}
.wm-data-coming-soon {
  background: #f8fafc;
  border: 1px solid #dbe4ee;
  border-radius: 10px;
  padding: 18px;
  color: #334155;
  line-height: 1.6;
}
.wm-data-coming-soon h4 {
  margin: 0 0 10px;
  color: #0f172a;
  font-size: 1rem;
}
.wm-data-coming-soon p {
  margin: 0 0 10px;
  font-size: 0.86rem;
}
.wm-data-coming-soon span {
  display: inline-flex;
  margin-top: 4px;
  padding: 4px 9px;
  border-radius: 999px;
  background: #e0f2fe;
  color: #075985;
  font-size: 0.72rem;
  font-weight: 700;
}

.wm-zettel-hub {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.wm-zettel-header h4 {
  margin: 0 0 4px;
  color: #1f2937;
}
.wm-zettel-helper {
  margin: 0;
  color: #64748b;
  font-size: 0.8rem;
  line-height: 1.45;
}
.wm-zettel-list {
  display: grid;
  gap: 8px;
}
.wm-zettel-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 10px;
  border: 1px solid #eee4d7;
  border-radius: 8px;
  background: #fffdf8;
}
.wm-zettel-item label {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  min-width: 0;
}
.wm-zettel-text {
  color: #374151;
  font-size: 0.82rem;
  line-height: 1.45;
}
.wm-zettel-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}
.wm-zettel-btn {
  border: 1px solid #d7c8f6;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
}
.wm-zettel-btn-primary {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  border: none;
}
.wm-zettel-btn-link {
  background: transparent;
  color: #6d28d9;
}
.wm-zettel-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.wm-insight-chip {
  background: #fef3c7;
  border-color: #facc15;
  color: #78350f;
}

/* Suggest tab items */
.wm-suggest-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 0.82rem;
  color: var(--text-secondary, #4a3f35);
  border-bottom: 1px solid #f0ebe4;
  transition: background 0.15s;
}

.wm-suggest-item:hover {
  background: rgba(139,115,85,0.04);
}

.wm-suggest-item:last-child {
  border-bottom: none;
}
.wm-rag-results {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}
.wm-rag-suggest-card {
  align-items: flex-start;
  background: #fffdf8;
  border: 1px solid #efe7dc;
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(44, 24, 16, 0.04);
}
.wm-rag-suggest-main {
  display: grid;
  gap: 4px;
  min-width: 0;
}
.wm-rag-suggest-main strong {
  color: #1f2937;
  font-size: 0.88rem;
}
.wm-rag-suggest-title {
  color: #475569;
  font-size: 0.78rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.wm-rag-suggest-main p,
.wm-rag-cost-note {
  margin: 0;
  color: #64748b;
  font-size: 0.76rem;
  line-height: 1.45;
}
.wm-missing-label {
  color: #9ca3af;
  font-size: 0.72rem;
  white-space: nowrap;
}
.wm-rag-cost-note {
  margin-top: 8px;
  text-align: left;
}

.wm-attach-btn {
  background: #d1fae5;
  border: 1px solid #86efac;
  border-radius: 5px;
  padding: 3px 10px;
  font-size: 0.72rem;
  color: #065f46;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
  font-weight: 500;
}

.wm-attach-btn:hover {
  background: #a7f3d0;
}

.wm-detach-btn {
  background: #fef2f2;
  border: 1px solid #fca5a5;
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 0.68rem;
  color: #b91c1c;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}

.wm-detach-btn:hover {
  background: #fecaca;
}

.wm-attached-label {
  font-size: 0.68rem;
  color: #065f46;
  font-weight: 600;
}

/* Notes tab */
.wm-note-search {
  width: 100%;
  background: var(--bg-card, #fff);
  border: 1px solid var(--border-primary, #e8e3db);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 0.82rem;
  color: var(--text-primary, #2c1810);
  outline: none;
  margin-bottom: 8px;
  transition: border-color 0.2s;
}

.wm-note-search:focus {
  border-color: var(--border-accent, #8b7355);
}

.wm-note-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.wm-note-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px;
  border-radius: 4px;
  gap: 6px;
  transition: background 0.15s;
}

.wm-note-item:hover {
  background: #f0ebe4;
}

.wm-note-attached {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
}

.wm-note-item-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.wm-note-item-info strong {
  font-size: 0.72rem;
  color: var(--text-muted, #6b5c4d);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wm-note-title {
  font-size: 0.68rem;
  color: var(--text-faint, #a09080);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Audit tab */
.wm-audit-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.wm-audit-item {
  background: var(--bg-card, #fff);
  border: 1px solid var(--border-primary, #e8e3db);
  border-radius: 6px;
  padding: 8px 10px;
}

.wm-audit-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.wm-audit-block {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted, #6b5c4d);
}

.wm-audit-time {
  font-size: 0.68rem;
  color: var(--text-faint, #b0a090);
}

.wm-audit-body {
  font-size: 0.82rem;
  color: var(--text-secondary, #4a3f35);
  line-height: 1.5;
  white-space: pre-wrap;
}

/* ── Manuscript Card badge for Write Mode ── */
.wm-new-card {
  background: linear-gradient(135deg, #f5f0ea, #ebe6df) !important;
  border-color: #8b7355 !important;
  color: #6b5c4d !important;
}

.wm-card-write {
  border-left: 3px solid #8b7355 !important;
}

.wm-card-badge {
  margin-right: 4px;
}

/* ══════════════════════════════════════════
   SPRINT 4-5: Polish Engine v2, Memory Loop,
   Auto-Injector, Export Engine
   ══════════════════════════════════════════ */

/* ── Polish Mode: Back to Write Mode button ── */
.wm-polish-return-btn {
  background: linear-gradient(135deg, #7c3aed22, #6366f122);
  border: 1px solid #7c3aed44;
  color: #7c3aed;
  font-weight: 600;
  font-size: 0.82rem;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}
.wm-polish-return-btn:hover {
  background: linear-gradient(135deg, #7c3aed33, #6366f133);
  border-color: #7c3aed66;
}

/* ── Audit Checklist Panel (Polish Mode) ── */
.ms-audit-checklist-pane {
  border-top: 1px solid var(--border-primary, #e8e3db);
  padding: 12px 16px;
  background: var(--bg-secondary, #faf8f5);
  max-height: 280px;
  overflow-y: auto;
}
.ms-audit-checklist-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.ms-audit-checklist-header h4 {
  margin: 0;
  font-size: 0.88rem;
  color: var(--text-muted, #555);
}
.ms-audit-count {
  font-size: 0.72rem;
  color: var(--text-faint, #888);
  margin-left: 6px;
}
.ms-audit-checklist-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.ms-audit-check-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
  font-size: 0.82rem;
  color: #444;
  background: var(--bg-card, #fff);
  border: 1px solid var(--border-primary, #e8e3db);
}
.ms-audit-check-item:hover {
  background: #f0eee9;
}
.ms-audit-check-item.ms-audit-resolved {
  opacity: 0.5;
  text-decoration: line-through;
  order: 999;
}
.ms-audit-checkbox {
  flex-shrink: 0;
  font-size: 0.88rem;
}
.ms-audit-check-text {
  flex: 1;
  line-height: 1.4;
}
.ms-audit-dismiss-btn {
  flex-shrink: 0;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.72rem;
  opacity: 0.5;
  padding: 2px 4px;
  border-radius: 4px;
  transition: opacity 0.15s;
}
.ms-audit-dismiss-btn:hover {
  opacity: 1;
  background: #fee2e2;
}

/* ── Auto-Injector: PDF upload row ── */
.wm-auto-inject-row {
  padding: 6px 0 8px;
  border-bottom: 1px solid var(--border-primary, #e8e3db);
  margin-bottom: 8px;
}
.wm-inject-btn {
  width: 100%;
  padding: 8px 12px;
  border: 1px dashed #7c3aed44;
  border-radius: 8px;
  background: linear-gradient(135deg, #7c3aed08, #6366f108);
  color: #7c3aed;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.wm-inject-btn:hover {
  background: linear-gradient(135deg, #7c3aed18, #6366f118);
  border-color: #7c3aed66;
}
.wm-inject-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ══════════════════════════════════════════
   Sprint 46: Co-Pilot UI — Banners & Action Items
   ══════════════════════════════════════════ */

/* Inline Co-Pilot Banner — appears below compiled draft text */
.wm-copilot-banner {
  background: linear-gradient(135deg, #f0fdf4 0%, #ecfdf5 50%, #f0f9ff 100%);
  border: 1px solid #86efac;
  border-radius: 8px;
  padding: 12px 16px;
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  animation: copilotSlideIn 0.3s ease-out;
}
.wm-copilot-banner-outline {
  margin-bottom: 8px;
  background: linear-gradient(135deg, #eff6ff 0%, #f0f9ff 50%, #faf5ff 100%);
  border-color: #93c5fd;
}
.wm-copilot-banner-text {
  font-size: 0.85rem;
  color: #166534;
  font-weight: 500;
  line-height: 1.4;
}
.wm-copilot-banner-outline .wm-copilot-banner-text {
  color: #1e40af;
}
.wm-copilot-banner-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.wm-copilot-btn {
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
}
.wm-copilot-btn-primary {
  background: #16a34a;
  color: #fff;
}
.wm-copilot-btn-primary:hover {
  background: #15803d;
}
.wm-copilot-btn-primary:disabled {
  background: #9ca3af;
  cursor: not-allowed;
}
.wm-copilot-btn-secondary {
  background: transparent;
  color: #6b7280;
  border: 1px solid #d1d5db;
}
.wm-copilot-btn-secondary:hover {
  background: #f3f4f6;
  color: #374151;
}

/* Action Items Tab Cards */
.wm-action-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.wm-action-card {
  background: var(--bg-card, #fff);
  border: 1px solid var(--border-primary, #e8e3db);
  border-left: 3px solid #16a34a;
  border-radius: 6px;
  padding: 10px 12px;
}
.wm-action-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.wm-action-card-desc {
  font-size: 0.82rem;
  color: var(--text-secondary, #4a3f35);
  font-weight: 500;
  line-height: 1.4;
}
.wm-action-card-cost {
  font-size: 0.75rem;
  font-weight: 700;
  color: #d97706;
  background: #fef3c7;
  padding: 2px 8px;
  border-radius: 10px;
  white-space: nowrap;
}
.wm-action-card-actions {
  display: flex;
  gap: 6px;
}

@keyframes copilotSlideIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Dark mode overrides */
@media (prefers-color-scheme: dark) {
  .wm-copilot-banner {
    background: linear-gradient(135deg, #052e16 0%, #064e3b 50%, #0c2937 100%);
    border-color: #166534;
  }
  .wm-copilot-banner-text { color: #86efac; }
  .wm-copilot-banner-outline {
    background: linear-gradient(135deg, #172554 0%, #0c2937 50%, #1e1b4b 100%);
    border-color: #1e40af;
  }
  .wm-copilot-banner-outline .wm-copilot-banner-text { color: #93c5fd; }
  .wm-copilot-btn-primary { background: #15803d; }
  .wm-copilot-btn-secondary { color: #9ca3af; border-color: #4b5563; }
  .wm-copilot-btn-secondary:hover { background: #1f2937; color: #d1d5db; }
}

/* ── Audit item dismiss button ── */
.wm-audit-dismiss {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.72rem;
  opacity: 0.4;
  padding: 2px;
  margin-left: 4px;
  border-radius: 3px;
  transition: all 0.15s;
}
.wm-audit-dismiss:hover {
  opacity: 1;
  background: #fee2e2;
}

/* ── Export Tab ── */
.wm-export-grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.wm-export-action-btn {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border-primary, #e8e3db);
  border-radius: 8px;
  background: var(--bg-card, #fff);
  color: #444;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s;
}
.wm-export-action-btn:hover {
  background: #f0eee9;
  border-color: var(--border-secondary, #d1cdc5);
}
.wm-export-action-btn select {
  width: 100%;
  margin-top: 6px;
  border: 1px solid var(--border-primary, #e8e3db);
  border-radius: 6px;
  background: #fff;
  padding: 6px 8px;
}

/* ── Memory Loop stats ── */
.wm-memory-loop-info {
  font-size: 0.82rem;
  color: var(--text-faint, #888);
  margin: 4px 0 8px;
  line-height: 1.4;
}
.wm-dismissed-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.wm-dismissed-item {
  font-size: 0.72rem;
  color: #666;
  padding: 4px 8px;
  background: #fef2f2;
  border-radius: 6px;
  border: 1px solid #fee2e2;
}
.wm-dismissed-text {
  display: block;
}
.wm-dismissed-reason {
  display: block;
  font-style: italic;
  color: var(--text-faint, #999);
  font-size: 0.72rem;
  margin-top: 2px;
}

/* ══════════════════════════════════════════
   Sprint 16 – Vector 3: iPad / Tablet Responsive Drawers
   Breakpoint: 901px–1024px → drawer-based tri-panel
   ══════════════════════════════════════════ */

/* Drawer toggle buttons – hidden on desktop */
.wm-drawer-toggle {
  display: none;
}

/* Drawer backdrop – hidden by default */
.wm-drawer-backdrop {
  display: none;
}

@media (min-width: 901px) and (max-width: 1024px) {
  /* ── Grid: single column, panels become drawers ── */
  .wm-body {
    grid-template-columns: 1fr;
    position: relative;
    overflow: hidden;
  }

  /* ── Center panel takes full width ── */
  .wm-panel-center {
    grid-column: 1 / -1;
  }

  /* ── Drawer toggle buttons – visible on tablet ── */
  .wm-drawer-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 64px;
    border: 1px solid var(--border-primary, #e8e3db);
    background: var(--bg-tertiary, #f7f3ee);
    color: var(--text-muted, #6b5c4d);
    font-size: 1.1rem;
    cursor: pointer;
    z-index: 110;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  }
  .wm-drawer-toggle:hover {
    background: #f0ebe4;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
  }
  .wm-drawer-toggle:active {
    transform: translateY(-50%) scale(0.96);
  }

  .wm-drawer-toggle-left {
    left: 0;
    border-radius: 0 10px 10px 0;
    border-left: none;
  }
  .wm-drawer-toggle-right {
    right: 0;
    border-radius: 10px 0 0 10px;
    border-right: none;
  }

  /* ── Left panel as sliding drawer ── */
  .wm-panel-left {
    position: fixed;
    top: 0;
    left: -280px;
    width: 260px;
    height: 100vh;
    z-index: 120;
    background: var(--bg-tertiary, #f7f3ee);
    border-right: 1px solid var(--border-primary, #e8e3db);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.1);
    transition: left 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    overflow-y: auto;
  }
  .wm-panel-left.wm-drawer-open {
    left: 0;
  }

  /* ── Right panel as sliding drawer ── */
  .wm-panel-right {
    position: fixed;
    top: 0;
    right: -320px;
    width: 300px;
    height: 100vh;
    z-index: 120;
    background: var(--bg-tertiary, #f7f3ee);
    border-left: 1px solid var(--border-primary, #e8e3db);
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.1);
    transition: right 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    overflow-y: auto;
  }
  .wm-panel-right.wm-drawer-open {
    right: 0;
  }

  /* ── Semi-transparent backdrop ── */
  .wm-drawer-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 115;
    background: rgba(0, 0, 0, 0.25);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    animation: drawerBackdropIn 0.2s ease-out;
  }

  @keyframes drawerBackdropIn {
    from { opacity: 0; }
    to   { opacity: 1; }
  }
}

/* ── Responsive: Collapse panels on phone (≤900px) ── */
@media (max-width: 900px) {
  .wm-body {
    grid-template-columns: 1fr;
  }
  .wm-panel-left {
    display: none;
  }
  .wm-panel-right {
    border-left: none;
    border-top: 1px solid var(--border-primary, #e8e3db);
    max-height: 250px;
  }
  .wm-drawer-toggle {
    display: none;
  }
  .wm-drawer-backdrop {
    display: none;
  }
}

/* ══════════════════════════════════════════
   Sprint 6: Ghost Job, Context Weight, Retry UI
   ══════════════════════════════════════════ */

/* ── Ghost Job Retry Button ── */
.wm-retry-btn {
  padding: 6px 14px;
  border: 1px solid #f97316;
  border-radius: 8px;
  background: #fff7ed;
  color: #c2410c;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.wm-retry-btn:hover {
  background: #fed7aa;
  border-color: #ea580c;
}

/* ── Context Weight Indicator ── */
.wm-context-weight {
  font-size: 0.72rem;
  color: #78716c;
  font-weight: 600;
  padding: 2px 8px;
  background: #f5f0eb;
  border-radius: 10px;
  white-space: nowrap;
}
.wm-context-full {
  color: #dc2626;
  background: #fef2f2;
  border: 1px solid #fca5a5;
}

/* ── Timeout badge in compile button ── */
.wm-compile-btn[disabled],
.wm-revise-btn[disabled] {
  opacity: 0.6;
}

/* ── Keyboard shortcut hint ── */
.wm-shortcut-hint {
  font-size: 0.68rem;
  color: #a8a29e;
  margin-left: 8px;
}

/* ══════════════════════════════════════════
   Sprint 7: Parachute Export Button
   ══════════════════════════════════════════ */
.wm-parachute-btn {
  width: 100%;
  padding: 12px 14px;
  border: 2px dashed #e8e3db;
  border-radius: 10px;
  background: linear-gradient(135deg, #fefce8, #fef9c3);
  color: #854d0e;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  transition: all 0.2s;
  margin-top: 12px;
}
.wm-parachute-btn:hover {
  background: linear-gradient(135deg, #fef9c3, #fde68a);
  border-color: #f59e0b;
}
.wm-parachute-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ══════════════════════════════════════════
   Sprint 8: Spatial Canvas Overlay
   ══════════════════════════════════════════ */
.wm-canvas-overlay {
  position: absolute;
  inset: 0;
  z-index: 100;
  background: #faf9f7;
  border-radius: 12px;
  overflow: hidden;
}

/* ══════════════════════════════════════════
   Sprint 9: Writing Style Selector
   ══════════════════════════════════════════ */
.wm-style-select {
  padding: 5px 10px;
  border: 1px solid var(--border-primary, #e8e3db);
  border-radius: 8px;
  background: #faf9f7;
  color: #44403c;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  outline: none;
  transition: all 0.15s;
}
.wm-style-select:hover {
  border-color: var(--border-secondary, #d1cdc5);
  background: #f0eee9;
}
.wm-style-select:focus {
  border-color: var(--accent-primary, #6366f1);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.15);
}

/* ══════════════════════════════════════════
   Sprint 9: Mad Libs Architect Panel
   ══════════════════════════════════════════ */
.wm-madlibs-panel {
  padding: 12px 14px;
  background: linear-gradient(135deg, #f0f9ff, #eff6ff);
  border: 1px solid #bfdbfe;
  border-radius: 10px;
  margin: 0 8px 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.wm-madlibs-overlay {
  position: fixed;
  inset: 0;
  z-index: 2200;
  background: rgba(15, 23, 42, 0.42);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.wm-madlibs-modal {
  width: min(760px, 94vw);
  max-height: 90vh;
  overflow-y: auto;
  background: #fffdf8;
  border: 1px solid #e5ded2;
  border-radius: 10px;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.28);
  padding: 22px;
}
.wm-madlibs-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid #ebe2d6;
  margin-bottom: 16px;
}
.wm-madlibs-modal-header h3 {
  margin: 0;
  color: #1e293b;
  font-size: 1.35rem;
}
.wm-madlibs-modal-header p {
  margin: 5px 0 0;
  color: #64748b;
  font-size: 0.9rem;
  line-height: 1.5;
}
.wm-madlibs-modal-grid {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr);
  gap: 12px 16px;
  align-items: start;
}
.wm-madlibs-modal-grid .wm-madlibs-label {
  padding-top: 9px;
}
.wm-madlibs-textarea {
  min-height: 76px;
  resize: vertical;
  line-height: 1.55;
}
.wm-madlibs-modal-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid #ebe2d6;
}
@media (max-width: 720px) {
  .wm-madlibs-modal-grid {
    grid-template-columns: 1fr;
  }
  .wm-madlibs-modal-grid .wm-madlibs-label {
    padding-top: 0;
  }
}
.wm-madlibs-intro {
  font-size: 0.82rem;
  color: #64748b;
  margin: 0 0 4px;
  line-height: 1.4;
}
.wm-madlibs-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: #334155;
  margin-top: 2px;
}
.wm-madlibs-optional {
  font-weight: 400;
  color: #94a3b8;
  font-style: italic;
}
.wm-madlibs-select {
  padding: 6px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: var(--bg-card, #fff);
  font-size: 0.82rem;
  color: #1e293b;
}
.wm-madlibs-input {
  padding: 7px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: var(--bg-card, #fff);
  font-size: 0.82rem;
  color: #1e293b;
  width: 100%;
  box-sizing: border-box;
}
.wm-madlibs-input::placeholder {
  color: #94a3b8;
  font-style: italic;
}
.wm-madlibs-input:focus,
.wm-madlibs-select:focus {
  outline: none;
  border-color: #6366f1;
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.15);
}
.wm-madlibs-generate {
  margin-top: 6px;
  padding: 10px 16px;
  border: none;
  border-radius: 8px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}
.wm-madlibs-generate:hover {
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}
.wm-madlibs-generate:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* ══════════════════════════════════════════
   Sprint 9: Playground / Empty State
   ══════════════════════════════════════════ */
.wm-playground-prompt {
  text-align: center;
  padding: 40px 24px;
  max-width: 480px;
  margin: 0 auto;
}
.wm-playground-prompt h3 {
  font-size: 1.3rem;
  color: #1c1917;
  margin: 0 0 8px;
  font-weight: 700;
}
.wm-playground-prompt > p {
  font-size: 0.88rem;
  color: #78716c;
  margin: 0 0 24px;
  line-height: 1.5;
}
.wm-playground-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.wm-playground-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 18px 24px;
  border: 2px solid #e8e3db;
  border-radius: 14px;
  background: var(--bg-card, #fff);
  color: #1c1917;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}
.wm-playground-btn:hover {
  border-color: #6366f1;
  background: #f0f0ff;
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.15);
}
.wm-playground-example {
  border-style: dashed;
  background: linear-gradient(135deg, #fefce8, #fff);
}
.wm-playground-example:hover {
  border-color: #f59e0b;
  background: #fffbeb;
}
.wm-playground-subtitle {
  font-size: 0.72rem;
  font-weight: 400;
  color: #78716c;
  line-height: 1.3;
}

/* ══════════════════════════════════════════
   Sprint 21: Workspace Toggle — Dual-Lens Paradigm
   ══════════════════════════════════════════ */
.workspace-toggle {
  display: flex;
  align-items: center;
  background: #f0ece6;
  border-radius: 10px;
  padding: 3px;
  gap: 2px;
  flex-shrink: 0;
  border: 1px solid #e0dbd3;
}

.workspace-toggle-btn {
  background: transparent;
  border: none;
  padding: 6px 16px;
  font-size: 0.82rem;
  font-family: 'Georgia', 'Times New Roman', serif;
  font-weight: 500;
  color: #78716c;
  cursor: pointer;
  border-radius: 8px;
  transition: all 0.25s ease;
  white-space: nowrap;
  letter-spacing: 0.01em;
}

.workspace-toggle-btn:hover:not(.workspace-toggle-active) {
  background: rgba(255, 255, 255, 0.6);
  color: #44403c;
}

.workspace-toggle-active {
  background: var(--bg-card, #fff);
  color: var(--text-primary, #2c1810);
  font-weight: 600;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1), 0 0 0 1px rgba(0, 0, 0, 0.04);
  cursor: default;
}

/* Responsive: stack toggle vertically on narrow screens */
@media (max-width: 768px) {
  .workspace-toggle {
    order: -1;
    width: 100%;
    justify-content: center;
  }
  .workspace-toggle-btn {
    flex: 1;
    text-align: center;
    padding: 8px 12px;
    font-size: 0.82rem;
  }
  .wm-topbar {
    flex-wrap: wrap;
  }
}

/* ══════════════════════════════════════════════════════════════════
   Sprint 42: Nexus Action Drawer — unified validation results panel
   ══════════════════════════════════════════════════════════════════ */

.nexus-drawer {
  background: var(--bg-primary, #fffdf8);
  border: 1px solid #e8e2d9;
  border-radius: 8px;
  margin: 8px 12px;
  overflow: hidden;
  animation: ms-nexus-fade-in 0.3s ease;
  max-height: 60vh;
  display: flex;
  flex-direction: column;
}

.nexus-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px 6px;
  border-bottom: 1px solid #f0ebe3;
}
.nexus-drawer-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.88rem;
  color: var(--text-primary, #2c1810);
}
.nexus-confidence {
  font-size: 0.78rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 12px;
}
.nexus-confidence.high { background: #dcfce7; color: #166534; }
.nexus-confidence.mid  { background: #fef3c7; color: #92400e; }
.nexus-confidence.low  { background: #fee2e2; color: #991b1b; }

.nexus-verdict {
  padding: 6px 14px;
  font-size: 0.8rem;
  font-style: italic;
  color: var(--text-secondary, #78716c);
  border-bottom: 1px solid #f0ebe3;
}

.nexus-summary-strip {
  display: flex;
  gap: 6px;
  padding: 8px 14px;
  flex-wrap: wrap;
}
.nexus-chip {
  font-size: 0.72rem;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 600;
}
.chip-ok    { background: #dcfce7; color: #166534; }
.chip-warn  { background: #fef3c7; color: #92400e; }
.chip-struct { background: #f3e8ff; color: #6b21a8; }
.chip-logic { background: #dbeafe; color: #1e40af; }
.chip-blind { background: #e0f2fe; color: #0c4a6e; }

.nexus-tabs {
  display: flex;
  border-bottom: 1px solid #e8e2d9;
  padding: 0 8px;
}
.nexus-tab {
  background: transparent;
  border: none;
  padding: 8px 14px;
  font-size: 0.78rem;
  cursor: pointer;
  color: var(--text-secondary, #78716c);
  border-bottom: 2px solid transparent;
  transition: all 0.15s ease;
}
.nexus-tab:hover { color: var(--text-primary, #2c1810); }
.nexus-tab.active {
  color: var(--accent-primary, #b45309);
  border-bottom-color: var(--accent-primary, #b45309);
  font-weight: 600;
}

.nexus-drawer-body {
  overflow-y: auto;
  padding: 10px 12px;
  flex: 1;
  min-height: 0;
}

.nexus-card {
  border-left: 3px solid #ccc;
  border-radius: 6px;
  padding: 10px 12px;
  margin-bottom: 8px;
  font-size: 0.8rem;
  line-height: 1.5;
  transition: box-shadow 0.15s ease;
}
.nexus-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.06); }

.nexus-card-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.nexus-card-emoji { font-size: 0.9rem; }
.nexus-card-severity {
  margin-left: auto;
  font-weight: 700;
  font-size: 0.68rem;
}

.nexus-card-claim {
  color: var(--text-primary, #2c1810);
  margin-bottom: 4px;
}
.nexus-card-evidence {
  font-size: 0.75rem;
  color: var(--text-secondary, #78716c);
  font-style: italic;
  margin-bottom: 4px;
}
.nexus-card-fix {
  font-size: 0.75rem;
  color: #b45309;
  font-weight: 500;
}

.nexus-section-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-secondary, #78716c);
  padding: 10px 0 4px;
  letter-spacing: 0.05em;
}

.nexus-empty {
  text-align: center;
  color: var(--text-secondary, #78716c);
  padding: 20px;
  font-size: 0.82rem;
  font-style: italic;
}

/* ═══════════════════════════════════════════════
   Sprint 48: Dashboard & Admin Panel Styles
   ═══════════════════════════════════════════════ */

/* ── Shared dashboard modal overrides ── */
.dashboard-modal,
.admin-modal {
  max-width: 680px;
  width: 95%;
}

.dashboard-header,
.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.dashboard-header h3,
.admin-header h3 {
  margin: 0;
  font-size: 1.15rem;
}

/* ── Card grid ── */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.dash-card {
  background: var(--card-bg, #f9fafb);
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 10px;
  padding: 14px;
  text-align: center;
}
.dash-card-wallet {
  border-left: 3px solid #8b5cf6;
}
.dash-card-admin {
  border-left: 3px solid #f59e0b;
}
.dash-card-cost {
  border-left: 3px solid #ef4444;
}

.dash-card-icon {
  font-size: 1.5rem;
  margin-bottom: 4px;
}
.dash-card-body {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.dash-card-value {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text-primary, #1f2937);
}
.dash-card-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary, #6b7280);
  margin-top: 2px;
}
.dash-card-sub {
  font-size: 0.7rem;
  color: var(--text-tertiary, #9ca3af);
  margin-top: 4px;
}

/* ── Velocity snapshot ── */
.dash-velocity {
  margin-top: 12px;
}
.dash-velocity h4 {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary, #6b7280);
  margin: 0 0 8px;
}
.dash-vel-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 0.85rem;
  border-bottom: 1px solid var(--border, #f3f4f6);
}
.dash-vel-row:last-child {
  border-bottom: none;
}

/* ── Admin: Tool usage breakdown ── */
.admin-tool-usage {
  margin-top: 18px;
}
.admin-tool-usage h4 {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary, #6b7280);
  margin: 0 0 8px;
}
.admin-tool-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.admin-tool-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
}
.admin-tool-row span:first-child {
  min-width: 120px;
  text-align: right;
  color: var(--text-secondary, #6b7280);
}
.admin-tool-bar-wrap {
  flex: 1;
  height: 14px;
  background: var(--border, #e5e7eb);
  border-radius: 7px;
  overflow: hidden;
}
.admin-tool-bar {
  height: 100%;
  background: linear-gradient(90deg, #8b5cf6, #a78bfa);
  border-radius: 7px;
  transition: width 0.3s ease;
}
.admin-tool-row span:last-child {
  min-width: 32px;
  font-weight: 600;
}

/* ── Admin days selector ── */
.admin-days-select {
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid var(--border, #d1d5db);
  font-size: 0.8rem;
  background: var(--card-bg, #fff);
}

/* ── Admin daily breakdown ── */
.admin-daily {
  margin-top: 18px;
}
.admin-daily h4 {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary, #6b7280);
  margin: 0 0 8px;
}
.admin-daily-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.admin-daily-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
  padding: 4px 0;
  border-bottom: 1px solid var(--border, #f3f4f6);
}

/* ── Loading / empty states ── */
.admin-loading,
.admin-empty {
  text-align: center;
  padding: 32px;
  font-size: 0.9rem;
  color: var(--text-secondary, #9ca3af);
}

/* ── Dark mode overrides ── */
@media (prefers-color-scheme: dark) {
  .dash-card {
    background: #1e1e2e;
    border-color: #313244;
  }
  .dash-card-value {
    color: #cdd6f4;
  }
  .admin-tool-bar-wrap {
    background: #313244;
  }
  .admin-days-select {
    background: #1e1e2e;
    border-color: #313244;
    color: #cdd6f4;
  }
}

/* ═══════════════════════════════════════════════
   Sprint 49: Zero-State Tutors
   ═══════════════════════════════════════════════ */

.zero-state-tutor {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  border: 2px dashed var(--border, #d1d5db);
  border-radius: 14px;
  padding: 36px 24px;
  margin: 20px auto;
  max-width: 420px;
  background: var(--card-bg, #fafbfc);
}
.zero-state-tutor-lg {
  max-width: 520px;
  padding: 48px 32px;
}
.zero-state-icon {
  font-size: 2.6rem;
  opacity: 0.45;
  margin-bottom: 12px;
}
.zero-state-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-primary, #1f2937);
  margin: 0 0 8px;
}
.zero-state-helper {
  font-size: 0.84rem;
  color: var(--text-secondary, #6b7280);
  line-height: 1.55;
  margin: 0 0 18px;
  max-width: 380px;
}
.zero-state-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}
.zero-state-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: 8px;
  border: 1px solid var(--border, #d1d5db);
  background: var(--card-bg, #fff);
  color: var(--text-primary, #374151);
  font-size: 0.84rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}
.zero-state-cta:hover:not(:disabled) {
  border-color: #8b5cf6;
  color: #8b5cf6;
  background: #f5f3ff;
}
.zero-state-cta:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
.zero-state-cta-primary {
  background: #8b5cf6;
  color: #fff;
  border-color: #8b5cf6;
  animation: zero-state-pulse 2s infinite;
}
.zero-state-cta-primary:hover:not(:disabled) {
  background: #7c3aed;
  color: #fff;
}
.zero-state-cta-secondary {
  background: transparent;
}

@keyframes zero-state-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(139, 92, 246, 0.4); }
  50% { box-shadow: 0 0 0 8px rgba(139, 92, 246, 0); }
}

/* ═══════════════════════════════════════════════
   Sprint 49: Welcome Wizard Modal
   ═══════════════════════════════════════════════ */

.welcome-modal {
  max-width: 480px;
  width: 90%;
  text-align: center;
  padding: 40px 32px;
}
.welcome-icon {
  font-size: 3.5rem;
  margin-bottom: 12px;
}
.welcome-modal h3 {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0 0 14px;
  color: var(--text-primary, #1f2937);
}
.welcome-body {
  font-size: 0.88rem;
  line-height: 1.65;
  color: var(--text-secondary, #4b5563);
  margin: 0 0 24px;
}
.welcome-token-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: linear-gradient(135deg, #f5f3ff, #ede9fe);
  border: 1px solid #c4b5fd;
  border-radius: 20px;
  padding: 6px 14px;
  font-weight: 600;
  font-size: 1rem;
  color: #7c3aed;
  margin: 0 0 8px;
}
.welcome-subtext {
  font-size: 0.78rem;
  color: var(--text-secondary, #6b7280);
  margin: 0 0 20px;
  opacity: 0.85;
}
.welcome-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 12px 32px;
  border-radius: 10px;
  border: none;
  background: #8b5cf6;
  color: #fff;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}
.welcome-cta:hover {
  background: #7c3aed;
  transform: translateY(-1px);
}

@media (prefers-color-scheme: dark) {
  .zero-state-tutor {
    background: #1e1e2e;
    border-color: #45475a;
  }
  .zero-state-cta {
    background: #1e1e2e;
    border-color: #45475a;
    color: #cdd6f4;
  }
  .zero-state-cta:hover:not(:disabled) {
    background: #2a2a3d;
  }
  .zero-state-cta-primary {
    background: #8b5cf6;
    color: #fff;
    border-color: #8b5cf6;
  }
  .welcome-token-badge {
    background: rgba(139, 92, 246, 0.15);
    border-color: #7c3aed;
  }
}

/* ═══════════════════════════════════════════════
   TUTORIAL COACH (Sprint 51)
   ═══════════════════════════════════════════════ */
.tutorial-coach {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  max-width: 380px;
  width: calc(100% - 48px);
  animation: tutorialSlideIn 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}
.tutorial-coach.left {
  right: auto;
  left: 24px;
}
.tutorial-coach.bottom-right {
  right: 60px;
  bottom: 60px;
}

@keyframes tutorialSlideIn {
  from { opacity: 0; transform: translateY(20px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.tutorial-coach.tutorial-just-advanced .tutorial-coach-card {
  animation: tutorialPulse 0.5s ease;
}
@keyframes tutorialPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.02); }
  100% { transform: scale(1); }
}

.tutorial-coach-card {
  background: var(--bg-primary, #1a1a2e);
  border: 1px solid rgba(139, 92, 246, 0.35);
  border-radius: 14px;
  padding: 0;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(139, 92, 246, 0.15);
  overflow: hidden;
}

/* Progress bar */
.tutorial-progress-bar {
  height: 3px;
  background: rgba(139, 92, 246, 0.12);
  width: 100%;
}
.tutorial-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #8b5cf6, #10b981);
  border-radius: 0 2px 2px 0;
  transition: width 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Header */
.tutorial-coach-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px 0;
}
.tutorial-step-badge {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: rgba(139, 92, 246, 0.8);
}
.tutorial-reward-badge {
  font-size: 0.72rem;
  font-weight: 700;
  color: #f59e0b;
  background: rgba(245, 158, 11, 0.12);
  padding: 2px 8px;
  border-radius: 10px;
  letter-spacing: 0.3px;
}
.tutorial-coach-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}
.tutorial-skip-btn {
  background: none;
  border: none;
  color: var(--text-secondary, #888);
  font-size: 0.72rem;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
}
.tutorial-skip-btn:hover {
  color: var(--text-primary, #e0e0e0);
  background: rgba(255, 255, 255, 0.06);
}
.tutorial-dismiss-btn {
  background: none;
  border: none;
  color: var(--text-secondary, #666);
  font-size: 1rem;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
  transition: color 0.15s;
}
.tutorial-dismiss-btn:hover {
  color: var(--text-primary, #e0e0e0);
}

/* Content */
.tutorial-coach-content {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 14px 8px;
}
.tutorial-coach-icon {
  font-size: 1.8rem;
  flex-shrink: 0;
  line-height: 1;
  margin-top: 2px;
}
.tutorial-coach-text {
  flex: 1;
  min-width: 0;
}
.tutorial-coach-text h4 {
  margin: 0 0 4px;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-primary, #e0e0e0);
}
.tutorial-coach-text p {
  margin: 0 0 4px;
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--text-secondary, #aaa);
}
.tutorial-hint {
  font-size: 0.73rem !important;
  font-style: italic;
  opacity: 0.6;
  margin-top: 2px !important;
}

/* Phase label */
.tutorial-phase-label {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: #10b981;
  background: rgba(16, 185, 129, 0.12);
  padding: 2px 7px;
  border-radius: 8px;
}

/* Grind progress counter */
.tutorial-grind-counter {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}
.tutorial-grind-bar {
  flex: 1;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 3px;
  overflow: hidden;
}
.tutorial-grind-fill {
  height: 100%;
  background: linear-gradient(90deg, #8b5cf6, #f59e0b);
  border-radius: 3px;
  transition: width 0.4s ease;
}
.tutorial-grind-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: #f59e0b;
  min-width: 28px;
  text-align: right;
}

/* Future phase dot — dimmer for quests in later phases */
.tutorial-dot-future-phase {
  opacity: 0.3;
}

/* Step dots */
.tutorial-dots {
  display: flex;
  justify-content: center;
  gap: 6px;
  padding: 6px 14px 4px;
}

/* Next step teaser — open loop psychology */
.tutorial-next-teaser {
  text-align: center;
  font-size: 0.68rem;
  color: var(--text-secondary, #9ca3af);
  padding: 0 14px 10px;
  opacity: 0.7;
  font-style: italic;
  letter-spacing: 0.2px;
}
.tutorial-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(139, 92, 246, 0.15);
  transition: background 0.3s, transform 0.3s;
}
.tutorial-dot-done {
  background: #10b981;
}
.tutorial-dot-active {
  background: #8b5cf6;
  transform: scale(1.3);
  box-shadow: 0 0 6px rgba(139, 92, 246, 0.4);
}

/* Celebration flash — contextual message */
.tutorial-celebrate-flash {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(16, 185, 129, 0.95);
  color: #fff;
  font-weight: 700;
  font-size: 0.85rem;
  padding: 10px 20px;
  border-radius: 20px;
  animation: celebrateFlash 1.2s ease forwards;
  pointer-events: none;
  z-index: 10;
  text-align: center;
  max-width: 280px;
  line-height: 1.4;
}
@keyframes celebrateFlash {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.7); }
  20% { opacity: 1; transform: translate(-50%, -50%) scale(1.05); }
  60% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -60%) scale(0.95); }
}

/* Celebrating state — dim card behind flash */
.tutorial-celebrating .tutorial-coach-card {
  opacity: 0.5;
  transition: opacity 0.3s;
}

/* Mobile adjustments */
@media (max-width: 768px) {
  .tutorial-coach {
    bottom: 12px;
    right: 12px;
    left: 12px;
    max-width: none;
    width: auto;
  }
  .tutorial-coach.left {
    left: 12px;
    right: 12px;
  }
  .tutorial-coach.bottom-right {
    right: 12px;
    bottom: 12px;
  }
}

/* ── Sprint 51.2: Spotlight effect for tutorial targets ── */
@keyframes tutorialSpotlightPulse {
  0%   { box-shadow: 0 0 0 0 rgba(76, 175, 80, 0.5); }
  50%  { box-shadow: 0 0 16px 6px rgba(76, 175, 80, 0.35); }
  100% { box-shadow: 0 0 0 0 rgba(76, 175, 80, 0.5); }
}
.tutorial-spotlight {
  animation: tutorialSpotlightPulse 1.6s ease-in-out infinite;
  border-radius: 8px;
  position: relative;
  z-index: 2;
}
/* Tab buttons inside the view toggle get a subtler variant */
.journal-view-toggle .tutorial-spotlight {
  border-radius: 6px;
}
/* The small icon buttons (principles, etc.) */
button.tutorial-spotlight {
  border-radius: 50%;
}
/**
 * EllieText.css — Tiptap editor styling to match existing textarea aesthetics
 */

/* ── Core wrapper: inherits the parent class's layout (flex, sizing) ── */
.ellie-text-wrapper {
  display: flex;
  flex-direction: column;
}

/* ── Tiptap's contenteditable div: match textarea defaults ── */
.ellie-text-wrapper .tiptap {
  flex: 1;
  outline: none;
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-y: auto;
}

/* ── Placeholder text (matches ::placeholder styling) ── */
.ellie-text-wrapper .tiptap p.is-editor-empty:first-child::before {
  content: attr(data-placeholder);
  float: left;
  color: var(--text-placeholder, #c0b8a8);
  font-style: italic;
  pointer-events: none;
  height: 0;
}

/* ── When used as wm-draft-textarea replacement ── */
.ellie-text-wrapper.wm-draft-textarea {
  flex: 1;
  min-height: 250px;
  width: 100%;
  background: var(--bg-card, #fff);
  border: 1px solid var(--border-primary, #e8e3db);
  border-radius: 10px;
  padding: 16px 18px;
  font-family: 'Georgia', 'Times New Roman', serif;
  font-size: 1rem;
  line-height: 1.75;
  color: var(--text-primary, #2c2416);
  resize: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.ellie-text-wrapper.wm-draft-textarea:focus-within {
  border-color: var(--border-accent, #8b7355);
  box-shadow: 0 0 0 3px rgba(139, 115, 85, 0.1);
}

.ellie-text-wrapper.wm-draft-textarea .tiptap {
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
  color: inherit;
}

/* ── Sprint 28C: Capture Mode editor — matches old .notebook-composer textarea ── */
.ellie-text-wrapper.capture-editor {
  flex: 1;
  min-height: 0;
  width: 100%;
  overflow-y: auto;
}
.ellie-text-wrapper.capture-editor .tiptap {
  font-family: 'Times New Roman', Times, serif;
  font-size: 12pt;
  line-height: 1.15;
  color: var(--text-primary, #2c2416);
  padding-bottom: 6pt;
  min-height: 200px;
  outline: none;
}

/* ── Disabled state ── */
.ellie-text-wrapper.wm-draft-textarea[data-disabled="true"] {
  background: var(--bg-tertiary, #f7f3ee);
  color: var(--accent-primary, #8b7355);
  cursor: not-allowed;
}

/* ── Sprint 29: Manuscript Mode editor — matches old .ms-native-textarea ── */
.ellie-text-wrapper.ms-native-textarea {
  flex: 1;
  min-height: 0;
  width: 100%;
  overflow-y: auto;
}
.ellie-text-wrapper.ms-native-textarea .tiptap {
  font-family: 'Times New Roman', Times, serif;
  font-size: 12pt;
  line-height: 1.6;
  color: var(--text-primary, #2c2416);
  padding: 24px 32px;
  min-height: 400px;
  outline: none;
}

/* ── Tiptap resets: remove default paragraph margins ── */
.ellie-text-wrapper .tiptap p {
  margin: 0;
}

/* ── Sprint 51: Rich text formatting styles ── */
.ellie-text-wrapper .tiptap strong { font-weight: 700; }
.ellie-text-wrapper .tiptap em { font-style: italic; }
.ellie-text-wrapper .tiptap u { text-decoration: underline; }
.ellie-text-wrapper .tiptap s { text-decoration: line-through; }
.ellie-text-wrapper .tiptap h1 { font-size: 1.6em; font-weight: 700; margin: 0.4em 0 0.2em; }
.ellie-text-wrapper .tiptap h2 { font-size: 1.35em; font-weight: 700; margin: 0.35em 0 0.15em; }
.ellie-text-wrapper .tiptap h3 { font-size: 1.15em; font-weight: 600; margin: 0.3em 0 0.1em; }
.ellie-text-wrapper .tiptap blockquote {
  border-left: 3px solid var(--accent-primary, #8b7355);
  padding-left: 12px;
  margin: 0.3em 0;
  color: var(--text-secondary, #6b5d4f);
  font-style: italic;
}
.ellie-text-wrapper .tiptap ul,
.ellie-text-wrapper .tiptap ol {
  padding-left: 24px;
  margin: 0.2em 0;
}
.ellie-text-wrapper .tiptap li { margin: 0.1em 0; }
.ellie-text-wrapper .tiptap hr {
  border: none;
  border-top: 1px solid var(--border-primary, #e8e3db);
  margin: 0.5em 0;
}

/* ── Sprint 26B: Citation Pill Styling ── */
.ellie-citation-pill {
  display: inline;
  background: linear-gradient(135deg, var(--citation-bg, #f0ecff), var(--citation-bg-end, #e8e0ff));
  color: var(--citation-text, #6d28d9);
  font-family: 'Georgia', serif;
  font-size: 0.92em;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: var(--radius-sm, 4px);
  border: 1px solid var(--citation-border, rgba(139, 92, 246, 0.2));
  white-space: nowrap;
  cursor: default;
  user-select: all;
  transition: background 0.15s, border-color 0.15s;
}
.ellie-citation-pill:hover {
  background: linear-gradient(135deg, var(--citation-bg-hover, #e8e0ff), var(--citation-bg-hover-end, #ddd4ff));
  border-color: var(--citation-border-hover, rgba(139, 92, 246, 0.35));
}

/* Sprint 43: Invalid/deleted citation fallback styling */
.ellie-citation-pill.citation-invalid {
  background: #fee2e2;
  color: #991b1b;
  border-color: rgba(220, 38, 38, 0.25);
  font-style: italic;
  cursor: help;
}
/* this gets exported as style.css and can be used for the default theming */
/* these are the necessary styles for React/Svelte Flow, they get used by base.css and style.css */
.react-flow {
  direction: ltr;

  --xy-edge-stroke-default: #b1b1b7;
  --xy-edge-stroke-width-default: 1;
  --xy-edge-stroke-selected-default: #555;

  --xy-connectionline-stroke-default: #b1b1b7;
  --xy-connectionline-stroke-width-default: 1;

  --xy-attribution-background-color-default: rgba(255, 255, 255, 0.5);

  --xy-minimap-background-color-default: #fff;
  --xy-minimap-mask-background-color-default: rgba(240, 240, 240, 0.6);
  --xy-minimap-mask-stroke-color-default: transparent;
  --xy-minimap-mask-stroke-width-default: 1;
  --xy-minimap-node-background-color-default: #e2e2e2;
  --xy-minimap-node-stroke-color-default: transparent;
  --xy-minimap-node-stroke-width-default: 2;

  --xy-background-color-default: transparent;
  --xy-background-pattern-dots-color-default: #91919a;
  --xy-background-pattern-lines-color-default: #eee;
  --xy-background-pattern-cross-color-default: #e2e2e2;
  background-color: var(--xy-background-color, var(--xy-background-color-default));
  --xy-node-color-default: inherit;
  --xy-node-border-default: 1px solid #1a192b;
  --xy-node-background-color-default: #fff;
  --xy-node-group-background-color-default: rgba(240, 240, 240, 0.25);
  --xy-node-boxshadow-hover-default: 0 1px 4px 1px rgba(0, 0, 0, 0.08);
  --xy-node-boxshadow-selected-default: 0 0 0 0.5px #1a192b;
  --xy-node-border-radius-default: 3px;

  --xy-handle-background-color-default: #1a192b;
  --xy-handle-border-color-default: #fff;

  --xy-selection-background-color-default: rgba(0, 89, 220, 0.08);
  --xy-selection-border-default: 1px dotted rgba(0, 89, 220, 0.8);

  --xy-controls-button-background-color-default: #fefefe;
  --xy-controls-button-background-color-hover-default: #f4f4f4;
  --xy-controls-button-color-default: inherit;
  --xy-controls-button-color-hover-default: inherit;
  --xy-controls-button-border-color-default: #eee;
  --xy-controls-box-shadow-default: 0 0 2px 1px rgba(0, 0, 0, 0.08);

  --xy-edge-label-background-color-default: #ffffff;
  --xy-edge-label-color-default: inherit;
  --xy-resize-background-color-default: #3367d9;
}
.react-flow.dark {
  --xy-edge-stroke-default: #3e3e3e;
  --xy-edge-stroke-width-default: 1;
  --xy-edge-stroke-selected-default: #727272;

  --xy-connectionline-stroke-default: #b1b1b7;
  --xy-connectionline-stroke-width-default: 1;

  --xy-attribution-background-color-default: rgba(150, 150, 150, 0.25);

  --xy-minimap-background-color-default: #141414;
  --xy-minimap-mask-background-color-default: rgba(60, 60, 60, 0.6);
  --xy-minimap-mask-stroke-color-default: transparent;
  --xy-minimap-mask-stroke-width-default: 1;
  --xy-minimap-node-background-color-default: #2b2b2b;
  --xy-minimap-node-stroke-color-default: transparent;
  --xy-minimap-node-stroke-width-default: 2;

  --xy-background-color-default: #141414;
  --xy-background-pattern-dots-color-default: #777;
  --xy-background-pattern-lines-color-default: #777;
  --xy-background-pattern-cross-color-default: #777;
  --xy-node-color-default: #f8f8f8;
  --xy-node-border-default: 1px solid #3c3c3c;
  --xy-node-background-color-default: #1e1e1e;
  --xy-node-group-background-color-default: rgba(240, 240, 240, 0.25);
  --xy-node-boxshadow-hover-default: 0 1px 4px 1px rgba(255, 255, 255, 0.08);
  --xy-node-boxshadow-selected-default: 0 0 0 0.5px #999;

  --xy-handle-background-color-default: #bebebe;
  --xy-handle-border-color-default: #1e1e1e;

  --xy-selection-background-color-default: rgba(200, 200, 220, 0.08);
  --xy-selection-border-default: 1px dotted rgba(200, 200, 220, 0.8);

  --xy-controls-button-background-color-default: #2b2b2b;
  --xy-controls-button-background-color-hover-default: #3e3e3e;
  --xy-controls-button-color-default: #f8f8f8;
  --xy-controls-button-color-hover-default: #fff;
  --xy-controls-button-border-color-default: #5b5b5b;
  --xy-controls-box-shadow-default: 0 0 2px 1px rgba(0, 0, 0, 0.08);

  --xy-edge-label-background-color-default: #141414;
  --xy-edge-label-color-default: #f8f8f8;
}
.react-flow__background {
  background-color: var(--xy-background-color-props, var(--xy-background-color, var(--xy-background-color-default)));
  pointer-events: none;
  z-index: -1;
}
.react-flow__container {
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
}
.react-flow__pane {
  z-index: 1;
}
.react-flow__pane.draggable {
    cursor: grab;
  }
.react-flow__pane.dragging {
    cursor: grabbing;
  }
.react-flow__pane.selection {
    cursor: pointer;
  }
.react-flow__viewport {
  transform-origin: 0 0;
  z-index: 2;
  pointer-events: none;
}
.react-flow__renderer {
  z-index: 4;
}
.react-flow__selection {
  z-index: 6;
}
.react-flow__nodesselection-rect:focus,
.react-flow__nodesselection-rect:focus-visible {
  outline: none;
}
.react-flow__edge-path {
  stroke: var(--xy-edge-stroke, var(--xy-edge-stroke-default));
  stroke-width: var(--xy-edge-stroke-width, var(--xy-edge-stroke-width-default));
  fill: none;
}
.react-flow__connection-path {
  stroke: var(--xy-connectionline-stroke, var(--xy-connectionline-stroke-default));
  stroke-width: var(--xy-connectionline-stroke-width, var(--xy-connectionline-stroke-width-default));
  fill: none;
}
.react-flow .react-flow__edges {
  position: absolute;
}
.react-flow .react-flow__edges svg {
    overflow: visible;
    position: absolute;
    pointer-events: none;
  }
.react-flow__edge {
  pointer-events: visibleStroke;
}
.react-flow__edge.selectable {
    cursor: pointer;
  }
.react-flow__edge.animated path {
    stroke-dasharray: 5;
    animation: dashdraw 0.5s linear infinite;
  }
.react-flow__edge.animated path.react-flow__edge-interaction {
    stroke-dasharray: none;
    animation: none;
  }
.react-flow__edge.inactive {
    pointer-events: none;
  }
.react-flow__edge.selected,
  .react-flow__edge:focus,
  .react-flow__edge:focus-visible {
    outline: none;
  }
.react-flow__edge.selected .react-flow__edge-path,
  .react-flow__edge.selectable:focus .react-flow__edge-path,
  .react-flow__edge.selectable:focus-visible .react-flow__edge-path {
    stroke: var(--xy-edge-stroke-selected, var(--xy-edge-stroke-selected-default));
  }
.react-flow__edge-textwrapper {
    pointer-events: all;
  }
.react-flow__edge .react-flow__edge-text {
    pointer-events: none;
    -webkit-user-select: none;
       -moz-user-select: none;
            user-select: none;
  }
/* Arrowhead marker styles - use CSS custom properties as default */
.react-flow__arrowhead polyline {
  stroke: var(--xy-edge-stroke, var(--xy-edge-stroke-default));
}
.react-flow__arrowhead polyline.arrowclosed {
  fill: var(--xy-edge-stroke, var(--xy-edge-stroke-default));
}
.react-flow__connection {
  pointer-events: none;
}
.react-flow__connection .animated {
    stroke-dasharray: 5;
    animation: dashdraw 0.5s linear infinite;
  }
svg.react-flow__connectionline {
  z-index: 1001;
  overflow: visible;
  position: absolute;
}
.react-flow__nodes {
  pointer-events: none;
  transform-origin: 0 0;
}
.react-flow__node {
  position: absolute;
  -webkit-user-select: none;
     -moz-user-select: none;
          user-select: none;
  pointer-events: all;
  transform-origin: 0 0;
  box-sizing: border-box;
  cursor: default;
}
.react-flow__node.selectable {
    cursor: pointer;
  }
.react-flow__node.draggable {
    cursor: grab;
    pointer-events: all;
  }
.react-flow__node.draggable.dragging {
      cursor: grabbing;
    }
.react-flow__nodesselection {
  z-index: 3;
  transform-origin: left top;
  pointer-events: none;
}
.react-flow__nodesselection-rect {
    position: absolute;
    pointer-events: all;
    cursor: grab;
  }
.react-flow__handle {
  position: absolute;
  pointer-events: none;
  min-width: 5px;
  min-height: 5px;
  width: 6px;
  height: 6px;
  background-color: var(--xy-handle-background-color, var(--xy-handle-background-color-default));
  border: 1px solid var(--xy-handle-border-color, var(--xy-handle-border-color-default));
  border-radius: 100%;
}
.react-flow__handle.connectingfrom {
    pointer-events: all;
  }
.react-flow__handle.connectionindicator {
    pointer-events: all;
    cursor: crosshair;
  }
.react-flow__handle-bottom {
    top: auto;
    left: 50%;
    bottom: 0;
    transform: translate(-50%, 50%);
  }
.react-flow__handle-top {
    top: 0;
    left: 50%;
    transform: translate(-50%, -50%);
  }
.react-flow__handle-left {
    top: 50%;
    left: 0;
    transform: translate(-50%, -50%);
  }
.react-flow__handle-right {
    top: 50%;
    right: 0;
    transform: translate(50%, -50%);
  }
.react-flow__edgeupdater {
  cursor: move;
  pointer-events: all;
}
.react-flow__pane.selection .react-flow__panel {
  pointer-events: none;
}
.react-flow__panel {
  position: absolute;
  z-index: 5;
  margin: 15px;
}
.react-flow__panel.top {
    top: 0;
  }
.react-flow__panel.bottom {
    bottom: 0;
  }
.react-flow__panel.top.center, .react-flow__panel.bottom.center {
      left: 50%;
      transform: translateX(-15px) translateX(-50%);
    }
.react-flow__panel.left {
    left: 0;
  }
.react-flow__panel.right {
    right: 0;
  }
.react-flow__panel.left.center, .react-flow__panel.right.center {
      top: 50%;
      transform: translateY(-15px) translateY(-50%);
    }
.react-flow__attribution {
  font-size: 10px;
  background: var(--xy-attribution-background-color, var(--xy-attribution-background-color-default));
  padding: 2px 3px;
  margin: 0;
}
.react-flow__attribution a {
    text-decoration: none;
    color: #999;
  }
@keyframes dashdraw {
  from {
    stroke-dashoffset: 10;
  }
}
.react-flow__edgelabel-renderer {
  position: absolute;
  width: 100%;
  height: 100%;
  pointer-events: none;
  -webkit-user-select: none;
     -moz-user-select: none;
          user-select: none;
  left: 0;
  top: 0;
}
.react-flow__viewport-portal {
  position: absolute;
  width: 100%;
  height: 100%;
  left: 0;
  top: 0;
  -webkit-user-select: none;
     -moz-user-select: none;
          user-select: none;
}
.react-flow__minimap {
  background: var(
    --xy-minimap-background-color-props,
    var(--xy-minimap-background-color, var(--xy-minimap-background-color-default))
  );
}
.react-flow__minimap-svg {
    display: block;
  }
.react-flow__minimap-mask {
    fill: var(
      --xy-minimap-mask-background-color-props,
      var(--xy-minimap-mask-background-color, var(--xy-minimap-mask-background-color-default))
    );
    stroke: var(
      --xy-minimap-mask-stroke-color-props,
      var(--xy-minimap-mask-stroke-color, var(--xy-minimap-mask-stroke-color-default))
    );
    stroke-width: var(
      --xy-minimap-mask-stroke-width-props,
      var(--xy-minimap-mask-stroke-width, var(--xy-minimap-mask-stroke-width-default))
    );
  }
.react-flow__minimap-node {
    fill: var(
      --xy-minimap-node-background-color-props,
      var(--xy-minimap-node-background-color, var(--xy-minimap-node-background-color-default))
    );
    stroke: var(
      --xy-minimap-node-stroke-color-props,
      var(--xy-minimap-node-stroke-color, var(--xy-minimap-node-stroke-color-default))
    );
    stroke-width: var(
      --xy-minimap-node-stroke-width-props,
      var(--xy-minimap-node-stroke-width, var(--xy-minimap-node-stroke-width-default))
    );
  }
.react-flow__background-pattern.dots {
    fill: var(
      --xy-background-pattern-color-props,
      var(--xy-background-pattern-color, var(--xy-background-pattern-dots-color-default))
    );
  }
.react-flow__background-pattern.lines {
    stroke: var(
      --xy-background-pattern-color-props,
      var(--xy-background-pattern-color, var(--xy-background-pattern-lines-color-default))
    );
  }
.react-flow__background-pattern.cross {
    stroke: var(
      --xy-background-pattern-color-props,
      var(--xy-background-pattern-color, var(--xy-background-pattern-cross-color-default))
    );
  }
.react-flow__controls {
  display: flex;
  flex-direction: column;
  box-shadow: var(--xy-controls-box-shadow, var(--xy-controls-box-shadow-default));
}
.react-flow__controls.horizontal {
    flex-direction: row;
  }
.react-flow__controls-button {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 26px;
    width: 26px;
    padding: 4px;
    border: none;
    background: var(--xy-controls-button-background-color, var(--xy-controls-button-background-color-default));
    border-bottom: 1px solid
      var(
        --xy-controls-button-border-color-props,
        var(--xy-controls-button-border-color, var(--xy-controls-button-border-color-default))
      );
    color: var(
      --xy-controls-button-color-props,
      var(--xy-controls-button-color, var(--xy-controls-button-color-default))
    );
    cursor: pointer;
    -webkit-user-select: none;
       -moz-user-select: none;
            user-select: none;
  }
.react-flow__controls-button svg {
      width: 100%;
      max-width: 12px;
      max-height: 12px;
      fill: currentColor;
    }
.react-flow__edge.updating .react-flow__edge-path {
      stroke: #777;
    }
.react-flow__edge-text {
    font-size: 10px;
  }
.react-flow__node.selectable:focus,
  .react-flow__node.selectable:focus-visible {
    outline: none;
  }
.react-flow__node-input,
.react-flow__node-default,
.react-flow__node-output,
.react-flow__node-group {
  padding: 10px;
  border-radius: var(--xy-node-border-radius, var(--xy-node-border-radius-default));
  width: 150px;
  font-size: 12px;
  color: var(--xy-node-color, var(--xy-node-color-default));
  text-align: center;
  border: var(--xy-node-border, var(--xy-node-border-default));
  background-color: var(--xy-node-background-color, var(--xy-node-background-color-default));
}
.react-flow__node-input.selectable:hover, .react-flow__node-default.selectable:hover, .react-flow__node-output.selectable:hover, .react-flow__node-group.selectable:hover {
      box-shadow: var(--xy-node-boxshadow-hover, var(--xy-node-boxshadow-hover-default));
    }
.react-flow__node-input.selectable.selected,
    .react-flow__node-input.selectable:focus,
    .react-flow__node-input.selectable:focus-visible,
    .react-flow__node-default.selectable.selected,
    .react-flow__node-default.selectable:focus,
    .react-flow__node-default.selectable:focus-visible,
    .react-flow__node-output.selectable.selected,
    .react-flow__node-output.selectable:focus,
    .react-flow__node-output.selectable:focus-visible,
    .react-flow__node-group.selectable.selected,
    .react-flow__node-group.selectable:focus,
    .react-flow__node-group.selectable:focus-visible {
      box-shadow: var(--xy-node-boxshadow-selected, var(--xy-node-boxshadow-selected-default));
    }
.react-flow__node-group {
  background-color: var(--xy-node-group-background-color, var(--xy-node-group-background-color-default));
}
.react-flow__nodesselection-rect,
.react-flow__selection {
  background: var(--xy-selection-background-color, var(--xy-selection-background-color-default));
  border: var(--xy-selection-border, var(--xy-selection-border-default));
}
.react-flow__nodesselection-rect:focus,
  .react-flow__nodesselection-rect:focus-visible,
  .react-flow__selection:focus,
  .react-flow__selection:focus-visible {
    outline: none;
  }
.react-flow__controls-button:hover {
      background: var(
        --xy-controls-button-background-color-hover-props,
        var(--xy-controls-button-background-color-hover, var(--xy-controls-button-background-color-hover-default))
      );
      color: var(
        --xy-controls-button-color-hover-props,
        var(--xy-controls-button-color-hover, var(--xy-controls-button-color-hover-default))
      );
    }
.react-flow__controls-button:disabled {
      pointer-events: none;
    }
.react-flow__controls-button:disabled svg {
        fill-opacity: 0.4;
      }
.react-flow__controls-button:last-child {
    border-bottom: none;
  }
.react-flow__controls.horizontal .react-flow__controls-button {
    border-bottom: none;
    border-right: 1px solid
      var(
        --xy-controls-button-border-color-props,
        var(--xy-controls-button-border-color, var(--xy-controls-button-border-color-default))
      );
  }
.react-flow__controls.horizontal .react-flow__controls-button:last-child {
    border-right: none;
  }
.react-flow__resize-control {
  position: absolute;
}
.react-flow__resize-control.left,
.react-flow__resize-control.right {
  cursor: ew-resize;
}
.react-flow__resize-control.top,
.react-flow__resize-control.bottom {
  cursor: ns-resize;
}
.react-flow__resize-control.top.left,
.react-flow__resize-control.bottom.right {
  cursor: nwse-resize;
}
.react-flow__resize-control.bottom.left,
.react-flow__resize-control.top.right {
  cursor: nesw-resize;
}
/* handle styles */
.react-flow__resize-control.handle {
  width: 5px;
  height: 5px;
  border: 1px solid #fff;
  border-radius: 1px;
  background-color: var(--xy-resize-background-color, var(--xy-resize-background-color-default));
  translate: -50% -50%;
}
.react-flow__resize-control.handle.left {
  left: 0;
  top: 50%;
}
.react-flow__resize-control.handle.right {
  left: 100%;
  top: 50%;
}
.react-flow__resize-control.handle.top {
  left: 50%;
  top: 0;
}
.react-flow__resize-control.handle.bottom {
  left: 50%;
  top: 100%;
}
.react-flow__resize-control.handle.top.left {
  left: 0;
}
.react-flow__resize-control.handle.bottom.left {
  left: 0;
}
.react-flow__resize-control.handle.top.right {
  left: 100%;
}
.react-flow__resize-control.handle.bottom.right {
  left: 100%;
}
/* line styles */
.react-flow__resize-control.line {
  border-color: var(--xy-resize-background-color, var(--xy-resize-background-color-default));
  border-width: 0;
  border-style: solid;
}
.react-flow__resize-control.line.left,
.react-flow__resize-control.line.right {
  width: 1px;
  transform: translate(-50%, 0);
  top: 0;
  height: 100%;
}
.react-flow__resize-control.line.left {
  left: 0;
  border-left-width: 1px;
}
.react-flow__resize-control.line.right {
  left: 100%;
  border-right-width: 1px;
}
.react-flow__resize-control.line.top,
.react-flow__resize-control.line.bottom {
  height: 1px;
  transform: translate(0, -50%);
  left: 0;
  width: 100%;
}
.react-flow__resize-control.line.top {
  top: 0;
  border-top-width: 1px;
}
.react-flow__resize-control.line.bottom {
  border-bottom-width: 1px;
  top: 100%;
}
.react-flow__edge-textbg {
  fill: var(--xy-edge-label-background-color, var(--xy-edge-label-background-color-default));
}
.react-flow__edge-text {
  fill: var(--xy-edge-label-color, var(--xy-edge-label-color-default));
}
/**
 * ReviewerCard.css — Sprint 25C: Peer Review Card Styles
 * "No Red Ink" palette — academic colours only.
 */

/* ── Card Base ── */
.rc-card {
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 12px;
  border-left: 4px solid transparent;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  transition: all 0.35s ease-in-out;
  position: relative;
}

.rc-card--resolving {
  opacity: 0;
  transform: translateX(16px);
  background-color: #dcfce7 !important;
  border-left-color: #16a34a !important;
}

.rc-card--resolved {
  opacity: 0.6;
}

/* ── Card Header ── */
.rc-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.rc-card-type {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0.8;
}

.rc-card-block {
  font-size: 0.7rem;
  opacity: 0.5;
  font-style: italic;
}

/* ── Card Body ── */
.rc-card-body {
  font-size: 0.88rem;
  line-height: 1.55;
  margin-bottom: 10px;
}

/* ── Card Actions ── */
.rc-card-actions {
  display: flex;
  gap: 8px;
}

.rc-resolve-btn {
  flex: 1;
  padding: 6px 10px;
  border: none;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  font-weight: 600;
  font-size: 0.8rem;
  transition: background-color 0.2s;
}

.rc-resolve-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.95);
}

.rc-resolve-btn:disabled {
  cursor: default;
  color: #16a34a !important;
  font-weight: 700;
}

.rc-dismiss-btn {
  padding: 6px 10px;
  border: none;
  border-radius: 5px;
  background: transparent;
  color: inherit;
  opacity: 0.4;
  cursor: pointer;
  font-size: 0.75rem;
  transition: opacity 0.2s;
}

.rc-dismiss-btn:hover {
  opacity: 0.8;
}

/* ── Reviewer Drawer (slide-out panel in ManuscriptMode) ── */
.reviewer-drawer {
  display: flex;
  flex-direction: column;
  background: var(--bg-secondary, #f9faf8);
  border-left: 1px solid var(--border-primary, #e8e3db);
  width: 320px;
  min-width: 280px;
  max-width: 380px;
  overflow-y: auto;
  transition: width 0.3s ease;
}

.reviewer-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-primary, #e8e3db);
  position: sticky;
  top: 0;
  background: inherit;
  z-index: 1;
}

.reviewer-drawer-header h4 {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 700;
}

.reviewer-drawer-count {
  font-size: 0.75rem;
  opacity: 0.6;
  margin-left: 6px;
}

.reviewer-drawer-body {
  padding: 12px;
  flex: 1;
}

/* ── Empty State (Celebration) ── */
.reviewer-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  text-align: center;
  color: var(--text-faint, #b0a090);
}

.reviewer-empty-icon {
  font-size: 2.5rem;
  margin-bottom: 12px;
}

.reviewer-empty-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary, #2c2416);
  margin-bottom: 6px;
}

.reviewer-empty-text {
  font-size: 0.85rem;
  line-height: 1.5;
  max-width: 240px;
}
/**
 * LiteratureGraph.css — Sprint 31: Live Literature Graph Styling
 */

/* ── Overlay container ── */
.lit-graph-overlay {
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: var(--bg-primary, #faf8f4);
  display: flex;
  flex-direction: column;
}

/* ── Top bar ── */
.lit-graph-topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--border-primary, #e8e3db);
  background: var(--bg-card, #fff);
  z-index: 1;
}
.lit-graph-topbar h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary, #2c2416);
}
.lit-graph-close-btn {
  background: none;
  border: 1px solid var(--border-primary, #e8e3db);
  border-radius: 8px;
  padding: 4px 12px;
  font-size: 0.85rem;
  cursor: pointer;
  color: var(--text-secondary, #78716c);
  transition: background 0.15s;
}
.lit-graph-close-btn:hover {
  background: var(--bg-tertiary, #f7f3ee);
}
.lit-graph-search {
  flex: 1;
  max-width: 320px;
  padding: 6px 12px;
  border: 1px solid var(--border-primary, #e8e3db);
  border-radius: 8px;
  font-size: 0.85rem;
  font-family: inherit;
  background: var(--bg-primary, #faf8f4);
  color: var(--text-primary, #2c2416);
}
.lit-graph-search::placeholder {
  color: var(--text-placeholder, #c0b8a8);
}
.lit-graph-stats {
  font-size: 0.75rem;
  color: var(--text-secondary, #78716c);
  margin-left: auto;
}

/* ── Graph canvas ── */
.lit-graph-canvas {
  flex: 1;
  min-height: 0;
}

/* ── Custom lit node ── */
.lit-graph-node {
  background: #fff;
  border: 2px solid var(--border-primary, #e8e3db);
  border-radius: 10px;
  padding: 10px 14px;
  min-width: 200px;
  max-width: 260px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.lit-graph-node:hover {
  border-color: var(--accent-primary, #8b7355);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}
.lit-graph-node.highlighted {
  border-color: #6d28d9;
  box-shadow: 0 0 0 3px rgba(109, 40, 217, 0.15);
}
.lit-graph-node.dimmed {
  opacity: 0.3;
}

.lit-node-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-primary, #2c2416);
  line-height: 1.3;
  margin-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.lit-node-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}
.lit-node-author {
  font-size: 0.7rem;
  color: var(--text-secondary, #78716c);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}
.lit-node-year {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 8px;
  background: var(--accent-primary, #8b7355);
  color: #fff;
  white-space: nowrap;
}
.lit-node-keywords {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
}
.lit-node-keyword {
  font-size: 0.6rem;
  padding: 1px 5px;
  border-radius: 4px;
  background: linear-gradient(135deg, #f0ecff, #e8e0ff);
  color: #6d28d9;
  white-space: nowrap;
}

/* ── React Flow overrides ── */
.lit-graph-canvas .react-flow__minimap {
  border-radius: 8px;
  border: 1px solid var(--border-primary, #e8e3db);
}
.lit-graph-canvas .react-flow__controls {
  border-radius: 8px;
  border: 1px solid var(--border-primary, #e8e3db);
}
.academic-ally-app {
  min-height: 100vh;
  background: #eef2f5;
  color: #15202b;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr) 360px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.aa-left-rail,
.aa-context-panel {
  background: #ffffff;
  border-color: #d9e1e8;
  min-height: 100vh;
}

.aa-left-rail {
  border-right: 1px solid #d9e1e8;
  padding: 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.aa-context-panel {
  border-left: 1px solid #d9e1e8;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
}

.aa-brand {
  display: grid;
  gap: 4px;
  padding: 4px 8px 14px;
  border-bottom: 1px solid #e8edf2;
}

.aa-brand strong {
  color: #102a32;
  font-size: 18px;
  line-height: 1.18;
}

.aa-brand span,
.aa-rail-footer span,
.aa-rail-footer small,
.aa-muted {
  color: #667784;
  font-size: 12px;
}

.aa-project-switcher {
  display: grid;
  gap: 7px;
}

.aa-project-switcher label,
.aa-kicker,
.aa-record-kicker {
  color: #667784;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.aa-primary-nav {
  display: grid;
  gap: 5px;
}

.aa-nav-button {
  border: 0;
  background: transparent;
  border-radius: 8px;
  padding: 10px 11px;
  text-align: left;
  font: inherit;
  font-size: 14px;
  color: #344653;
  cursor: pointer;
}

.aa-nav-button:hover,
.aa-nav-button.active {
  background: #e6f0f2;
  color: #0f4c5c;
}

.aa-rail-footer {
  margin-top: auto;
  border: 1px solid #e1e8ee;
  border-radius: 8px;
  padding: 10px;
  display: grid;
  gap: 4px;
  min-width: 0;
}

.aa-rail-footer small {
  word-break: break-word;
}

.aa-main-surface {
  min-width: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.aa-work-header {
  min-height: 70px;
  background: #ffffff;
  border-bottom: 1px solid #d9e1e8;
  padding: 14px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.aa-work-header h1 {
  margin: 3px 0 0;
  color: #101820;
  font-size: 22px;
  line-height: 1.2;
}

.aa-header-status {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  color: #526575;
  font-size: 12px;
}

.aa-header-status span {
  border: 1px solid #d9e1e8;
  border-radius: 8px;
  padding: 6px 8px;
  background: #f7fafc;
}

.aa-work-scroll {
  flex: 1;
  overflow: auto;
  padding: 18px;
}

.aa-surface-stack {
  display: grid;
  gap: 14px;
  max-width: 1240px;
}

.aa-work-panel,
.aa-context-section {
  background: #ffffff;
  border: 1px solid #d9e1e8;
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.aa-work-panel {
  padding: 16px;
  min-width: 0;
}

.aa-context-section {
  padding: 13px;
}

.aa-section-heading,
.aa-context-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.aa-section-heading.compact {
  align-items: center;
}

.aa-section-heading h2,
.aa-context-heading h3 {
  margin: 0;
  color: #101820;
  line-height: 1.25;
}

.aa-section-heading h2 {
  font-size: 18px;
}

.aa-context-heading h3 {
  font-size: 14px;
}

.aa-section-heading p,
.aa-context-summary p,
.aa-record-card p,
.aa-record-row p {
  margin: 5px 0 0;
  color: #5c6e7c;
  font-size: 13px;
  line-height: 1.45;
}

.aa-context-heading span {
  color: #5c6e7c;
  font-size: 12px;
  white-space: nowrap;
}

.aa-project-create,
.aa-search-row,
.aa-action-row,
.aa-context-input-row,
.aa-cluster-row {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
}

.aa-project-create {
  margin-bottom: 14px;
}

.aa-tab-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin: 0 0 12px;
  border-bottom: 1px solid #e1e8ee;
  padding-bottom: 8px;
}

.aa-tab-button {
  border: 1px solid #d8e3e8;
  border-radius: 8px;
  background: #f7fafb;
  color: #344653;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  padding: 7px 10px;
}

.aa-tab-button.active,
.aa-tab-button:hover {
  background: #175c66;
  border-color: #175c66;
  color: #ffffff;
}

.aa-context-input-row {
  margin-top: 10px;
}

.aa-cluster-row {
  margin: 12px 0;
}

.aa-input,
.aa-select,
.aa-textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid #c8d3dd;
  border-radius: 8px;
  padding: 10px 11px;
  background: #ffffff;
  color: #15202b;
  font: inherit;
  font-size: 14px;
}

.aa-project-create .aa-input,
.aa-search-row .aa-input,
.aa-context-input-row .aa-input {
  flex: 1 1 220px;
}

.aa-textarea {
  resize: vertical;
  line-height: 1.55;
}

.aa-capture-textarea {
  min-height: 230px;
}

.aa-manuscript-textarea {
  min-height: 54vh;
  font-size: 15px;
}

.aa-manuscript-preview {
  margin-top: 10px;
  border: 1px solid #dfe6ec;
  border-radius: 8px;
  background: #fbfdfe;
  padding: 12px;
  max-height: 220px;
  overflow: auto;
  font-size: 13px;
  line-height: 1.55;
}

.aa-manuscript-context-tabs {
  margin-top: 14px;
}

.aa-title-input {
  font-size: 20px;
  font-weight: 800;
  margin-bottom: 10px;
}

.aa-button,
.aa-link-button {
  font: inherit;
  border-radius: 8px;
  cursor: pointer;
}

.aa-button {
  border: 0;
  background: #175c66;
  color: #ffffff;
  padding: 10px 13px;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.aa-button.secondary {
  background: #e9eef3;
  color: #243743;
}

.aa-button:disabled,
.aa-link-button:disabled {
  opacity: 0.48;
  cursor: not-allowed;
}

.aa-link-button {
  border: 0;
  background: transparent;
  color: #0f5f73;
  padding: 0;
  font-size: 12px;
  font-weight: 800;
}

.aa-stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.aa-stat-tile {
  background: #ffffff;
  border: 1px solid #d9e1e8;
  border-radius: 8px;
  padding: 13px;
  display: grid;
  gap: 6px;
}

.aa-stat-tile span {
  color: #667784;
  font-size: 12px;
}

.aa-stat-tile strong {
  color: #102a32;
  font-size: 24px;
  line-height: 1;
}

.aa-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 10px;
}

.aa-card-grid.compact {
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}

.aa-record-card,
.aa-record-row {
  border: 1px solid #dfe6ec;
  border-radius: 8px;
  background: #ffffff;
  padding: 12px;
  min-width: 0;
}

.aa-record-button {
  text-align: left;
  font: inherit;
  cursor: pointer;
}

.aa-record-button:hover,
.aa-record-button.active {
  border-color: #175c66;
  background: #f2f8f9;
}

.aa-record-card strong,
.aa-record-row strong {
  display: block;
  color: #132935;
  line-height: 1.3;
}

.aa-record-card small {
  display: block;
  color: #667784;
  font-size: 12px;
  margin-top: 10px;
}

.aa-record-list {
  display: grid;
  gap: 9px;
}

.aa-record-titleline {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.aa-record-titleline span {
  color: #667784;
  font-size: 12px;
  white-space: nowrap;
}

.aa-empty {
  border: 1px dashed #bdc9d4;
  border-radius: 8px;
  padding: 16px;
  background: #fbfdfe;
  color: #667784;
  font-size: 13px;
  line-height: 1.45;
}

.aa-empty.small {
  padding: 10px;
  font-size: 12px;
}

.aa-data-coming-soon {
  display: grid;
  gap: 6px;
}

.aa-data-coming-soon strong {
  color: #102a32;
  font-size: 14px;
}

.aa-context-summary {
  display: grid;
  gap: 10px;
}

.aa-context-summary strong {
  color: #102a32;
  font-size: 15px;
}

.aa-mini-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.aa-mini-metrics span,
.aa-badge {
  border-radius: 8px;
  background: #edf3f5;
  color: #40525f;
  font-size: 12px;
  padding: 6px 8px;
}

.aa-badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  font-weight: 700;
}

.aa-source-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.aa-source-pill {
  border: 1px solid #d8e3e8;
  border-radius: 8px;
  background: #f7fafb;
  color: #23434d;
  padding: 6px 8px;
  font-size: 12px;
  cursor: pointer;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.aa-chat-log,
.aa-task-list {
  display: grid;
  gap: 8px;
  max-height: 290px;
  overflow-y: auto;
}

.aa-message {
  border-radius: 8px;
  padding: 9px 10px;
  font-size: 13px;
  line-height: 1.45;
}

.aa-message.user {
  background: #eef2f5;
  margin-left: 26px;
}

.aa-message.ellie {
  background: #e9f4f5;
  border-left: 3px solid #175c66;
  margin-right: 26px;
}

.aa-task {
  border: 1px solid #e2d5b8;
  border-left: 4px solid #b7791f;
  border-radius: 8px;
  background: #fffaf0;
  padding: 9px;
  display: grid;
  gap: 5px;
}

.aa-task.done {
  border-color: #b7d9c4;
  border-left-color: #1f7a4d;
  background: #f2fbf5;
}

.aa-task strong {
  color: #2f3d24;
  font-size: 12px;
  line-height: 1.35;
}

.aa-task span {
  color: #667784;
  font-size: 11px;
}

.aa-analysis-panel > div:last-child {
  border-radius: 8px;
  overflow: hidden;
}

.aa-select.compact {
  min-width: 96px;
  max-width: 130px;
}

.aa-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(9, 24, 31, 0.44);
}

.aa-artifact-modal {
  width: min(940px, 100%);
  max-height: min(820px, calc(100vh - 48px));
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  gap: 12px;
  border: 1px solid #d7e0e6;
  border-radius: 8px;
  background: #fffdf8;
  box-shadow: 0 24px 70px rgba(18, 42, 51, 0.28);
  padding: 18px;
}

.aa-modal-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.aa-modal-heading h2 {
  margin: 4px 0 0;
  color: #102a32;
  font-size: 20px;
  line-height: 1.2;
}

.aa-icon-button {
  width: 32px;
  height: 32px;
  border: 1px solid #d7e0e6;
  border-radius: 8px;
  background: #f8fbfc;
  color: #41545f;
  cursor: pointer;
}

.aa-modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.aa-artifact-preview {
  min-height: 240px;
  overflow: auto;
  border: 1px solid #e0e6ea;
  border-radius: 8px;
  background: #ffffff;
  padding: 16px;
  color: #18313b;
  line-height: 1.55;
}

.aa-meta-prompt {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid #cde0d4;
  border-radius: 8px;
  background: #f3fbf6;
  padding: 12px;
}

.aa-meta-prompt div:first-child {
  display: grid;
  gap: 4px;
}

.aa-meta-prompt span {
  color: #526775;
  font-size: 12px;
}

@media (max-width: 1180px) {
  .academic-ally-app {
    grid-template-columns: 220px minmax(0, 1fr);
  }

  .aa-context-panel {
    grid-column: 1 / -1;
    border-left: 0;
    border-top: 1px solid #d9e1e8;
    min-height: auto;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .academic-ally-app {
    grid-template-columns: 1fr;
  }

  .aa-left-rail {
    min-height: auto;
    border-right: 0;
    border-bottom: 1px solid #d9e1e8;
  }

  .aa-primary-nav {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .aa-nav-button {
    text-align: center;
  }

  .aa-work-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .aa-work-scroll {
    padding: 12px;
  }

  .aa-stat-grid,
  .aa-context-panel {
    grid-template-columns: 1fr;
  }

  .aa-card-grid,
  .aa-card-grid.compact {
    grid-template-columns: 1fr;
  }

  .aa-record-titleline {
    display: grid;
  }

  .aa-modal-backdrop {
    padding: 12px;
  }

  .aa-meta-prompt {
    align-items: stretch;
    flex-direction: column;
  }
}
.marketing-wrapper {
  width: 100%;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: #000;
  overflow: hidden;
  position: relative;
}

.marketing-header {
  height: 70px;
  background: rgba(0, 0, 0, 0.95);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  z-index: 1000;
  display: flex;
  align-items: center;
  padding: 0 40px;
  position: sticky;
  top: 0;
}

.header-content {
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header-title {
  color: #fff;
  font-family: 'Playfair Display', serif;
  font-size: 1.6rem;
  font-weight: 800;
  margin: 0;
  letter-spacing: -0.5px;
}

.header-nav {
  display: flex;
  gap: 10px;
}

.header-nav button {
  background: none;
  border: none;
  color: #888;
  font-family: 'Manrope', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  padding: 8px 16px;
  border-radius: 6px;
}

.header-nav button:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.header-nav button.active {
  color: #fff;
  background: rgba(99, 102, 241, 0.2);
  box-shadow: inset 0 0 0 1px rgba(99, 102, 241, 0.4);
}

.cta-overlay {
  position: absolute;
  top: 90px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  z-index: 1500;
  pointer-events: none;
}

.cta-buttons {
  display: flex;
  gap: 20px;
  pointer-events: auto;
  background: rgba(0, 0, 0, 0.4);
  padding: 10px;
  border-radius: 20px;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 20px 40px rgba(0,0,0,0.4);
}

.cta-btn {
  width: 240px;
  height: 64px;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: all 0.3s cubic-bezier(0.19, 1, 0.22, 1);
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

.cta-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0,0,0,0.5);
  filter: brightness(1.15);
}

.cta-btn:active {
  transform: translateY(1px) scale(0.98);
}

.demo-btn {
  background: linear-gradient(135deg, #6366f1 0%, #818cf8 100%);
  color: white;
  animation: pulse-indigo 2s infinite;
}

.partner-btn {
  background: linear-gradient(135deg, #10b981 0%, #34d399 100%);
  color: white;
}

@keyframes pulse-indigo {
  0% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.4); }
  70% { box-shadow: 0 0 0 15px rgba(99, 102, 241, 0); }
  100% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0); }
}

.btn-label {
  font-family: 'Lexend', sans-serif;
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: 0.5px;
}

.btn-sub {
  font-family: 'Manrope', sans-serif;
  font-size: 0.7rem;
  opacity: 0.85;
  font-weight: 600;
  margin-top: 2px;
}

.marketing-main {
  flex: 1;
  width: 100%;
  position: relative;
  background: #000;
}

.landing-container {
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.landing-iframe {
  width: 100%;
  height: 100%;
  border: none;
  background: #000;
}

.landing-injection-container {
  width: 100%;
  height: 100%;
  overflow-y: auto;
  background: #000;
  color: #fff;
}

/* Ensure injected designs don't have double scrollbars */
.landing-injection-container::-webkit-scrollbar {
  width: 8px;
}
.landing-injection-container::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.1);
  border-radius: 4px;
}

@media (max-width: 768px) {
  .marketing-header {
    height: auto;
    padding: 15px 20px;
  }
  .header-content {
    flex-direction: column;
    gap: 12px;
  }
  .header-nav {
    width: 100%;
    justify-content: center;
  }
  .cta-overlay {
    top: auto;
    bottom: 40px;
  }
  .cta-buttons {
    flex-direction: column;
    gap: 10px;
    padding: 15px;
    border-radius: 15px;
  }
  .cta-btn {
    width: 180px;
    height: 54px;
  }
  .btn-label {
    font-size: 0.95rem;
  }
}
