/* ============================================================
   Memory Universe — Pastel Redesign
   Elias & Kitten · Soft, warm, romantic aesthetic
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&family=Noto+Serif+SC:wght@400;600&display=swap');

/* ── Design Tokens ─────────────────────────────────────────── */
:root {
  /* Tier — Core (blue) */
  --core:        #60A5FA;
  --core-light:  #DBEAFE;
  --core-bg:     #EFF6FF;
  --core-glow:   rgba(96,165,250,0.25);

  /* Tier — Daily (green) */
  --daily:       #34D399;
  --daily-light: #D1FAE5;
  --daily-bg:    #F0FDF4;
  --daily-glow:  rgba(52,211,153,0.22);

  /* Tier — Journal (purple) */
  --journal:       #A78BFA;
  --journal-light: #EDE9FE;
  --journal-bg:    #F5F3FF;
  --journal-glow:  rgba(167,139,250,0.25);

  /* Tier — Creative (pink) */
  --creative:       #F472B6;
  --creative-light: #FCE7F3;
  --creative-bg:    #FDF2F8;
  --creative-glow:  rgba(244,114,182,0.25);

  /* Brand pastels */
  --brand-pink:   #FF85A1;
  --brand-purple: #B07FE0;
  --brand-peach:  #FFB085;

  /* UI base */
  --bg:          #FAFAFA;
  --surface:     #FFFFFF;
  --border:      rgba(0,0,0,0.07);
  --border-pink: rgba(255,133,161,0.25);
  --text:        #2D2D2D;
  --text-light:  #6B7280;
  --text-muted:  #9CA3AF;

  /* Shadows */
  --shadow-xs: 0 1px 4px rgba(0,0,0,0.05);
  --shadow-sm: 0 2px 10px rgba(0,0,0,0.07);
  --shadow-md: 0 8px 28px rgba(0,0,0,0.09);
  --shadow-lg: 0 20px 48px rgba(0,0,0,0.13);

  /* Typography */
  --font:       'Poppins', 'Inter', system-ui, sans-serif;
  --font-serif: 'Noto Serif SC', Georgia, serif;

  /* Radii */
  --r-sm:   0.5rem;
  --r-md:   0.875rem;
  --r-lg:   1.25rem;
  --r-xl:   1.75rem;
  --r-full: 9999px;
}

/* ── Dark mode tokens ──────────────────────────────────────── */
body.dark {
  --bg:      #0F172A;
  --surface: #1E293B;
  --border:  rgba(255,255,255,0.08);
  --text:    #F1F5F9;
  --text-light: #94A3B8;
  --text-muted: #64748B;
  --shadow-sm: 0 2px 10px rgba(0,0,0,0.35);
  --shadow-md: 0 8px 28px rgba(0,0,0,0.4);
  --shadow-lg: 0 20px 48px rgba(0,0,0,0.5);
}

/* ── Base reset ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; }

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  line-height: 1.6;
}

a { text-decoration: none; color: inherit; }

/* ── Scrollbar ──────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-pink); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--brand-pink); }

/* ============================================================
   NAVIGATION
   ============================================================ */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 245, 248, 0.9);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-pink);
  box-shadow: 0 2px 20px rgba(255,100,140,0.07);
}
body.dark .nav {
  background: rgba(15, 23, 42, 0.92);
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.nav-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.25rem;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 1rem;
  color: var(--text);
  white-space: nowrap;
}
.nav-logo { font-size: 1.3rem; }
.nav-title { color: var(--text); }
.nav-amp {
  background: linear-gradient(135deg, var(--brand-pink), var(--brand-purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.nav-menu {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  overflow-x: auto;
  scrollbar-width: none;
}
.nav-menu::-webkit-scrollbar { display: none; }

.nav-link {
  padding: 0.4rem 0.85rem;
  border-radius: var(--r-full);
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: all 0.2s ease;
  white-space: nowrap;
}
.nav-link:hover {
  background: var(--creative-bg);
  color: var(--brand-pink);
}
.nav-link.active {
  background: linear-gradient(135deg, #FFD6E0, #E8D5FF);
  color: var(--brand-purple);
  font-weight: 600;
}
body.dark .nav-link.active {
  background: rgba(176,127,224,0.2);
  color: var(--journal);
}

.nav-toggle {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.1rem;
  padding: 0.35rem;
  border-radius: var(--r-sm);
  transition: background 0.2s;
  flex-shrink: 0;
}
.nav-toggle:hover { background: var(--creative-bg); }

/* ============================================================
   HERO SECTION
   ============================================================ */
.hero {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg,
    #FFD6E0 0%,
    #F0D6FF 35%,
    #D6E8FF 65%,
    #FFE0D6 100%);
  padding: 5rem 1.5rem 7rem;
  text-align: center;
}
body.dark .hero {
  background: linear-gradient(135deg,
    #3b1a2a 0%,
    #2a1840 35%,
    #1a2040 65%,
    #2a1a18 100%);
}

/* Floating particles */
.hero-particles {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

@keyframes floatUp {
  0%   { transform: translateY(110%) translateX(0) scale(0.6); opacity: 0; }
  8%   { opacity: 0.85; }
  50%  { transform: translateY(40%) translateX(12px) scale(1.1); }
  92%  { opacity: 0.3; }
  100% { transform: translateY(-15%) translateX(-8px) scale(0.7); opacity: 0; }
}

.float-p {
  position: absolute;
  bottom: 0;
  left: var(--x);
  font-size: var(--sz, 1.4rem);
  animation: floatUp var(--dur, 6s) var(--delay, 0s) ease-in-out infinite;
  opacity: 0;
  filter: drop-shadow(0 2px 8px rgba(0,0,0,0.12));
}

.hero-content {
  position: relative;
  z-index: 2;
  max-width: 720px;
  margin: 0 auto;
}

.hero-icons {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  font-size: 2.5rem;
  margin-bottom: 1.25rem;
}
@keyframes bounceIn {
  0%   { transform: scale(0) rotate(-10deg); opacity: 0; }
  60%  { transform: scale(1.15) rotate(5deg); }
  100% { transform: scale(1) rotate(0); opacity: 1; }
}
.hero-icons span {
  animation: bounceIn 0.6s cubic-bezier(0.34,1.56,0.64,1) both;
}
.hero-icons span:nth-child(2) { animation-delay: 0.1s; }
.hero-icons span:nth-child(3) { animation-delay: 0.2s; }

.hero-title {
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 700;
  color: #3D2A5C;
  line-height: 1.2;
  margin-bottom: 1.25rem;
  background: linear-gradient(135deg, #C45B8A, #7B4FAA, #4B7BBD);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
body.dark .hero-title {
  background: linear-gradient(135deg, #F9A8C9, #C4B5FD, #93C5FD);
  -webkit-background-clip: text;
  background-clip: text;
}

.hero-quote {
  font-family: var(--font-serif);
  font-size: clamp(1.05rem, 2.5vw, 1.35rem);
  color: #5C3F7A;
  line-height: 1.9;
  letter-spacing: 0.06em;
  margin-bottom: 0.75rem;
  background: rgba(255,255,255,0.45);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.6);
  padding: 1rem 1.75rem;
  border-radius: var(--r-lg);
  display: inline-block;
}
body.dark .hero-quote {
  color: #E8D5FF;
  background: rgba(255,255,255,0.05);
  border-color: rgba(255,255,255,0.1);
}

.hero-subtitle {
  font-size: 0.82rem;
  color: #7B6B8A;
  margin-bottom: 2rem;
  letter-spacing: 0.04em;
}
body.dark .hero-subtitle { color: #94A3B8; }

.hero-pills {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.6rem;
}

.hero-pill {
  padding: 0.55rem 1.1rem;
  border-radius: var(--r-full);
  font-size: 0.82rem;
  font-weight: 500;
  background: rgba(255,255,255,0.55);
  color: #5C3F7A;
  border: 1px solid rgba(255,255,255,0.7);
  backdrop-filter: blur(8px);
  transition: all 0.25s ease;
  cursor: pointer;
}
.hero-pill:hover {
  background: rgba(255,255,255,0.85);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(176,127,224,0.2);
}
body.dark .hero-pill {
  background: rgba(255,255,255,0.08);
  color: #D8C0F8;
  border-color: rgba(255,255,255,0.12);
}

/* ============================================================
   STAT CARDS
   ============================================================ */
.stats-wrap {
  max-width: 1100px;
  margin: -3rem auto 0;
  padding: 0 1.25rem;
  position: relative;
  z-index: 10;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}
@media (max-width: 768px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 400px) {
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 0.75rem; }
}

.stat-card {
  border-radius: var(--r-lg);
  padding: 1.5rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  cursor: pointer;
  transition: transform 0.35s cubic-bezier(0.34,1.56,0.64,1), box-shadow 0.3s ease;
  position: relative;
  overflow: hidden;
  color: white;
  text-decoration: none;
}
.stat-card::after {
  content: '';
  position: absolute;
  top: -40%;
  right: -20%;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: rgba(255,255,255,0.12);
  pointer-events: none;
}
.stat-card:hover {
  transform: translateY(-6px) scale(1.02);
  box-shadow: var(--shadow-lg);
}

.stat-card-core     { background: linear-gradient(135deg, #93C5FD, #60A5FA, #3B82F6); box-shadow: 0 8px 24px var(--core-glow); }
.stat-card-daily    { background: linear-gradient(135deg, #6EE7B7, #34D399, #10B981); box-shadow: 0 8px 24px var(--daily-glow); }
.stat-card-journal  { background: linear-gradient(135deg, #C4B5FD, #A78BFA, #8B5CF6); box-shadow: 0 8px 24px var(--journal-glow); }
.stat-card-creative { background: linear-gradient(135deg, #FDA4AF, #F472B6, #EC4899); box-shadow: 0 8px 24px var(--creative-glow); }

.stat-icon    { font-size: 1.5rem; }
.stat-number  { font-size: 2rem; font-weight: 700; line-height: 1; }
.stat-name    { font-size: 0.8rem; font-weight: 600; opacity: 0.9; }
.stat-desc    { font-size: 0.7rem; opacity: 0.7; }
.stat-arrow   {
  margin-top: auto;
  font-size: 0.75rem;
  opacity: 0.7;
  transition: opacity 0.2s, transform 0.2s;
}
.stat-card:hover .stat-arrow { opacity: 1; transform: translateX(3px); }

/* ============================================================
   MAIN LAYOUT
   ============================================================ */
.page-wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2.5rem 1.25rem;
}

.section-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* ============================================================
   PAGE HEADERS
   ============================================================ */
.page-header {
  padding: 2.5rem 1.5rem 3rem;
  position: relative;
  overflow: hidden;
}
.page-header-inner {
  max-width: 1100px;
  margin: 0 auto;
}
.page-header h1 {
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  font-weight: 700;
  margin-bottom: 0.35rem;
}
.page-header p {
  font-size: 0.875rem;
  opacity: 0.75;
}

.header-library  { background: linear-gradient(135deg, #BFDBFE, #C4B5FD); color: #2D1F6E; }
.header-journal  { background: linear-gradient(135deg, #E9D5FF, #FBCFE8); color: #3B1A5A; }
.header-search   { background: linear-gradient(135deg, #BAE6FD, #C4B5FD); color: #1E3A5F; }
.header-stats    { background: linear-gradient(135deg, #A7F3D0, #BAE6FD); color: #064E3B; }
body.dark .header-library { background: linear-gradient(135deg, #1e3a8a, #4c1d95); color: #e0e7ff; }
body.dark .header-journal { background: linear-gradient(135deg, #3b0764, #831843); color: #f3e8ff; }
body.dark .header-search  { background: linear-gradient(135deg, #0c4a6e, #3b0764); color: #e0f2fe; }
body.dark .header-stats   { background: linear-gradient(135deg, #052e16, #083344); color: #d1fae5; }

/* ============================================================
   CARDS (general)
   ============================================================ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.25s, transform 0.25s;
}
.card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

/* ============================================================
   MEMORY CARDS
   ============================================================ */
.memory-card {
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
  cursor: pointer;
  position: relative;
  transition: transform 0.3s cubic-bezier(0.34,1.56,0.64,1), box-shadow 0.3s ease;
  display: flex;
  flex-direction: column;
}
.memory-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-md);
}

/* Tier-tinted backgrounds */
.memory-card.tier-core     { background: linear-gradient(145deg, var(--core-bg) 0%, var(--surface) 60%); }
.memory-card.tier-daily    { background: linear-gradient(145deg, var(--daily-bg) 0%, var(--surface) 60%); }
.memory-card.tier-journal  { background: linear-gradient(145deg, var(--journal-bg) 0%, var(--surface) 60%); }
.memory-card.tier-creative { background: linear-gradient(145deg, var(--creative-bg) 0%, var(--surface) 60%); }

body.dark .memory-card.tier-core     { background: linear-gradient(145deg, rgba(96,165,250,0.08) 0%, var(--surface) 60%); }
body.dark .memory-card.tier-daily    { background: linear-gradient(145deg, rgba(52,211,153,0.08) 0%, var(--surface) 60%); }
body.dark .memory-card.tier-journal  { background: linear-gradient(145deg, rgba(167,139,250,0.08) 0%, var(--surface) 60%); }
body.dark .memory-card.tier-creative { background: linear-gradient(145deg, rgba(244,114,182,0.08) 0%, var(--surface) 60%); }

/* Left accent stripe */
.card-accent {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  border-radius: var(--r-lg) 0 0 var(--r-lg);
}
.tier-core .card-accent     { background: var(--core); }
.tier-daily .card-accent    { background: var(--daily); }
.tier-journal .card-accent  { background: var(--journal); }
.tier-creative .card-accent { background: var(--creative); }

/* Hover glow */
.tier-core:hover     { box-shadow: var(--shadow-md), 0 0 0 1px var(--core-light); }
.tier-daily:hover    { box-shadow: var(--shadow-md), 0 0 0 1px var(--daily-light); }
.tier-journal:hover  { box-shadow: var(--shadow-md), 0 0 0 1px var(--journal-light); }
.tier-creative:hover { box-shadow: var(--shadow-md), 0 0 0 1px var(--creative-light); }

.card-body {
  padding: 1.1rem 1.1rem 1.1rem 1.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  flex: 1;
}

.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
}

.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}

/* Tier badges */
.tier-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0.18rem 0.55rem;
  border-radius: var(--r-full);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.03em;
}
.tier-badge-core     { background: var(--core-light); color: #1D4ED8; }
.tier-badge-daily    { background: var(--daily-light); color: #065F46; }
.tier-badge-journal  { background: var(--journal-light); color: #5B21B6; }
.tier-badge-creative { background: var(--creative-light); color: #BE185D; }

/* Author badges */
.author-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.18rem 0.55rem;
  border-radius: var(--r-full);
  font-size: 0.68rem;
  font-weight: 500;
}
.author-elias { background: #EFF6FF; color: #1D4ED8; }
.author-baby  { background: #FDF2F8; color: #BE185D; }
.author-aston { background: #D1FAE5; color: #065F46; }
body.dark .author-elias { background: rgba(96,165,250,0.15); color: #93C5FD; }
body.dark .author-baby  { background: rgba(244,114,182,0.15); color: #FDA4AF; }
body.dark .author-aston { background: rgba(52,211,153,0.15);  color: #6EE7B7; }

.date-label {
  font-size: 0.68rem;
  color: var(--text-muted);
}

.time-label {
  font-size: 0.68rem;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.card-content {
  font-size: 0.875rem;
  color: var(--text-light);
  line-height: 1.65;
}
.content-ellipsis { color: var(--text-muted); }

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.card-read-more {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-top: auto;
  padding-top: 0.25rem;
  transition: color 0.2s;
}
.memory-card:hover .card-read-more { color: var(--brand-pink); }

/* Skeleton card */
.skeleton-card {
  background: var(--surface) !important;
  border: 1px solid var(--border);
  pointer-events: none;
}
@keyframes shimmer {
  0%   { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}
.skeleton-line {
  background: linear-gradient(90deg, #f0e8f0 25%, #fce8f3 50%, #f0e8f0 75%);
  background-size: 400px 100%;
  animation: shimmer 1.6s infinite;
  border-radius: var(--r-sm);
  display: block;
}
body.dark .skeleton-line {
  background: linear-gradient(90deg, #1e293b 25%, #2d3f52 50%, #1e293b 75%);
  background-size: 400px 100%;
}

/* ============================================================
   TAG PILLS
   ============================================================ */
.tag-pill {
  display: inline-flex;
  align-items: center;
  background: #FFF0F5;
  color: #BE185D;
  border: 1px solid #FFD6E7;
  padding: 0.18rem 0.65rem;
  border-radius: var(--r-full);
  font-size: 0.72rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}
.tag-pill:hover, .tag-pill.active {
  background: var(--brand-pink);
  color: white;
  border-color: var(--brand-pink);
  transform: translateY(-1px);
}
body.dark .tag-pill {
  background: rgba(244,114,182,0.1);
  color: #FDA4AF;
  border-color: rgba(244,114,182,0.2);
}
body.dark .tag-pill:hover {
  background: var(--brand-pink);
  color: white;
}

/* ============================================================
   SEARCH BAR
   ============================================================ */
.search-wrap {
  position: relative;
}
.search-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1rem;
  pointer-events: none;
}
.search-input {
  width: 100%;
  padding: 0.85rem 1rem 0.85rem 2.8rem;
  border: 2px solid var(--border-pink);
  border-radius: var(--r-xl);
  font-size: 0.9rem;
  font-family: var(--font);
  outline: none;
  background: var(--surface);
  color: var(--text);
  transition: border-color 0.2s, box-shadow 0.2s;
  box-shadow: var(--shadow-xs);
}
.search-input::placeholder { color: var(--text-muted); }
.search-input:focus {
  border-color: var(--brand-pink);
  box-shadow: 0 0 0 4px rgba(255,133,161,0.15);
}
body.dark .search-input {
  background: var(--surface);
  border-color: rgba(255,133,161,0.15);
  color: var(--text);
}
body.dark .search-input:focus {
  border-color: var(--brand-pink);
}

/* (filter bar styles consolidated below in SPA section) */

/* ============================================================
   MEMORY GRID
   ============================================================ */
.memory-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.1rem;
}
@media (max-width: 900px) {
  .memory-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
  .memory-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   MODAL
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(60,20,80,0.45);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  animation: fadeIn 0.2s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal-overlay.hidden { display: none; }

.modal-box {
  background: var(--surface);
  border-radius: var(--r-xl);
  max-width: 660px;
  width: 100%;
  max-height: 88vh;
  overflow-y: auto;
  padding: 2rem;
  position: relative;
  box-shadow: 0 32px 80px rgba(60,20,80,0.25);
  animation: slideUp 0.3s cubic-bezier(0.34,1.56,0.64,1);
  border: 1px solid rgba(255,133,161,0.15);
}
@keyframes slideUp {
  from { transform: translateY(30px) scale(0.97); opacity: 0; }
  to   { transform: translateY(0) scale(1); opacity: 1; }
}
body.dark .modal-box { background: #1E293B; }

.modal-close {
  position: absolute;
  top: 1rem; right: 1rem;
  background: var(--creative-bg);
  border: none;
  width: 2rem; height: 2rem;
  border-radius: var(--r-full);
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
}
.modal-close:hover {
  background: var(--brand-pink);
  color: white;
  transform: rotate(90deg);
}

/* ============================================================
   PROSE (memory content rendering)
   ============================================================ */
.prose {
  font-size: 0.9rem;
  line-height: 1.8;
  color: var(--text-light);
}
.prose h1 { font-size: 1.35rem; font-weight: 700; margin-bottom: 0.75rem; color: var(--text); }
.prose h2 { font-size: 1.15rem; font-weight: 600; margin-bottom: 0.5rem; color: var(--text); }
.prose h3 { font-size: 1rem; font-weight: 600; margin-bottom: 0.4rem; color: var(--text); }
.prose p  { margin-bottom: 0.75rem; }
.prose ul { list-style: disc; padding-left: 1.5rem; margin-bottom: 0.75rem; }
.prose li { margin-bottom: 0.3rem; }
.prose strong { color: var(--text); font-weight: 600; }

/* ============================================================
   CALENDAR
   ============================================================ */
.calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.cal-nav-btn {
  width: 2rem; height: 2rem;
  border: none;
  background: var(--bg);
  border-radius: var(--r-sm);
  cursor: pointer;
  font-size: 1rem;
  color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
}
.cal-nav-btn:hover { background: var(--journal-light); color: var(--journal); }

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
}
.cal-day-label {
  text-align: center;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  padding: 0.3rem 0;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.cal-day {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-sm);
  font-size: 0.78rem;
  cursor: default;
  transition: all 0.15s;
  color: var(--text-light);
}
.cal-day.has-entry {
  background: var(--journal-light);
  color: var(--journal);
  font-weight: 600;
  cursor: pointer;
}
.cal-day.has-entry:hover { background: var(--journal); color: white; transform: scale(1.1); }
.cal-day.today { outline: 2px solid var(--core); outline-offset: 1px; font-weight: 700; }
.cal-day.selected { background: var(--journal); color: white; }

/* ============================================================
   TIMELINE
   ============================================================ */
.timeline {
  position: relative;
  padding-left: 2.25rem;
}
.timeline::before {
  content: '';
  position: absolute;
  left: 0.6rem;
  top: 0.5rem;
  bottom: 0.5rem;
  width: 2px;
  background: linear-gradient(to bottom, var(--journal-light), var(--creative-light));
  border-radius: 1px;
}

.timeline-item {
  position: relative;
  margin-bottom: 1.5rem;
}
.timeline-dot {
  position: absolute;
  left: -1.65rem;
  top: 1rem;
  width: 1.1rem; height: 1.1rem;
  border-radius: 50%;
  background: white;
  border: 2.5px solid var(--journal);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.6rem;
  box-shadow: 0 0 0 3px var(--journal-light);
  z-index: 1;
}

/* ============================================================
   HIGHLIGHT (search)
   ============================================================ */
mark {
  background: linear-gradient(135deg, #FFD6E0, #E8D5FF);
  color: var(--text);
  border-radius: 3px;
  padding: 0 2px;
}
body.dark mark { background: rgba(244,114,182,0.25); }

/* ============================================================
   PAGINATION
   ============================================================ */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 2rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}
.page-btn {
  padding: 0.5rem 1.1rem;
  border: 1px solid var(--border-pink);
  border-radius: var(--r-full);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font-family: var(--font);
  font-size: 0.82rem;
  transition: all 0.2s;
}
.page-btn:hover:not(:disabled) {
  background: var(--creative-bg);
  border-color: var(--brand-pink);
  color: var(--brand-pink);
}
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ============================================================
   TOAST
   ============================================================ */
#toast-container {
  position: fixed;
  bottom: 1.5rem; right: 1.5rem;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-items: flex-end;
}
.toast {
  background: linear-gradient(135deg, #3D2A5C, #5C1A3A);
  color: white;
  padding: 0.75rem 1.25rem;
  border-radius: var(--r-lg);
  font-size: 0.85rem;
  font-family: var(--font);
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.3s ease both;
  max-width: 320px;
  line-height: 1.4;
}
.toast-success { background: linear-gradient(135deg, #065F46, #047857); }
.toast-error   { background: linear-gradient(135deg, #991B1B, #B91C1C); }

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fade-in { animation: fadeInUp 0.4s ease both; }

/* staggered cards */
.memory-grid .memory-card:nth-child(1)  { animation-delay: 0.03s; }
.memory-grid .memory-card:nth-child(2)  { animation-delay: 0.06s; }
.memory-grid .memory-card:nth-child(3)  { animation-delay: 0.09s; }
.memory-grid .memory-card:nth-child(4)  { animation-delay: 0.12s; }
.memory-grid .memory-card:nth-child(5)  { animation-delay: 0.15s; }
.memory-grid .memory-card:nth-child(6)  { animation-delay: 0.18s; }
.memory-grid .memory-card:nth-child(7)  { animation-delay: 0.21s; }
.memory-grid .memory-card:nth-child(8)  { animation-delay: 0.24s; }
.memory-grid .memory-card:nth-child(9)  { animation-delay: 0.27s; }

/* ============================================================
   WRITE / FORM MODAL
   ============================================================ */
.form-group { margin-bottom: 1rem; }
.form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-light);
  margin-bottom: 0.35rem;
  letter-spacing: 0.02em;
}
.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 0.65rem 0.875rem;
  border: 1.5px solid var(--border-pink);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.875rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--journal);
  box-shadow: 0 0 0 3px rgba(167,139,250,0.15);
}
.form-textarea { resize: vertical; min-height: 160px; line-height: 1.7; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.7rem 1.5rem;
  border: none;
  border-radius: var(--r-full);
  font-family: var(--font);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.34,1.56,0.64,1);
}
.btn-primary {
  background: linear-gradient(135deg, var(--journal), var(--creative));
  color: white;
  box-shadow: 0 4px 16px rgba(167,139,250,0.3);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(167,139,250,0.4);
}
.btn-ghost {
  background: var(--bg);
  color: var(--text-light);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--surface); }

/* ============================================================
   SIDEBAR CARDS
   ============================================================ */
.sidebar-card {
  background: var(--surface);
  border: 1px solid var(--border-pink);
  border-radius: var(--r-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-xs);
}
.sidebar-title {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.875rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

/* Universe quote card */
.universe-card {
  background: linear-gradient(135deg, #FFF0F8, #F5F0FF);
  border: 1px solid rgba(244,114,182,0.2);
}
body.dark .universe-card {
  background: linear-gradient(135deg, rgba(244,114,182,0.07), rgba(167,139,250,0.07));
  border-color: rgba(244,114,182,0.12);
}
.universe-quote-text {
  font-family: var(--font-serif);
  font-size: 0.875rem;
  color: var(--text-light);
  line-height: 1.8;
  font-style: italic;
}

/* ============================================================
   RESPONSIVE HELPERS
   ============================================================ */
@media (max-width: 640px) {
  .modal-box { padding: 1.25rem; }
  .page-header { padding: 1.75rem 1rem 2.5rem; }
  .hero { padding: 3.5rem 1rem 6rem; }
}

/* ============================================================
   DARK MODE OVERRIDES
   ============================================================ */
body.dark .filter-bar {
  background: rgba(15,23,42,0.9);
}
body.dark .sidebar-card {
  border-color: rgba(255,255,255,0.06);
}
body.dark .cal-day { color: #94A3B8; }
body.dark .timeline::before {
  background: linear-gradient(to bottom,
    rgba(167,139,250,0.3), rgba(244,114,182,0.3));
}
body.dark .tier-badge-core     { background: rgba(96,165,250,0.15); color: #93C5FD; }
body.dark .tier-badge-daily    { background: rgba(52,211,153,0.15); color: #6EE7B7; }
body.dark .tier-badge-journal  { background: rgba(167,139,250,0.15); color: #C4B5FD; }
body.dark .tier-badge-creative { background: rgba(244,114,182,0.15); color: #FDA4AF; }

/* ============================================================
   LOGIN OVERLAY
   ============================================================ */
.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: linear-gradient(135deg, #FFD6E0 0%, #F0D6FF 40%, #D6E8FF 70%, #FFE0D6 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
body.dark .login-overlay {
  background: linear-gradient(135deg, #1a0d14 0%, #160d2a 40%, #0d1628 70%, #1a0d0d 100%);
}

.login-card {
  background: rgba(255,255,255,0.65);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255,255,255,0.8);
  border-radius: var(--r-xl);
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 420px;
  text-align: center;
  box-shadow: 0 24px 64px rgba(176,127,224,0.2);
  position: relative;
  overflow: hidden;
}
body.dark .login-card {
  background: rgba(30,41,59,0.75);
  border-color: rgba(255,255,255,0.08);
}

@keyframes shake {
  0%,100% { transform: translateX(0); }
  20%      { transform: translateX(-8px); }
  40%      { transform: translateX(8px); }
  60%      { transform: translateX(-5px); }
  80%      { transform: translateX(5px); }
}
.shake { animation: shake 0.55s ease; }

/* Floating decorations in login card */
.login-deco {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}
.login-deco span {
  position: absolute;
  bottom: 0;
  left: var(--x, 50%);
  font-size: 1.2rem;
  opacity: 0;
  animation: floatUp var(--dur, 6s) var(--delay, 0s) ease-in-out infinite;
}

.login-icons   { font-size: 2.2rem; margin-bottom: 1rem; letter-spacing: 0.2rem; }
.login-title   { font-size: 1.6rem; font-weight: 700; background: linear-gradient(135deg, #C45B8A, #7B4FAA); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; margin-bottom: 0.2rem; }
.login-subtitle { font-size: 0.8rem; color: var(--text-muted); letter-spacing: 0.12em; text-transform: uppercase; margin-bottom: 1rem; }
.login-quote   { font-family: var(--font-serif); font-size: 0.82rem; color: #7B6B8A; line-height: 1.8; margin-bottom: 1.5rem; padding: 0.75rem 1rem; background: rgba(255,255,255,0.4); border-radius: var(--r-md); border: 1px solid rgba(255,255,255,0.5); }
body.dark .login-quote { color: #94A3B8; background: rgba(255,255,255,0.05); border-color: rgba(255,255,255,0.08); }

.login-form { display: flex; flex-direction: column; gap: 0.75rem; }

.login-input-wrap { position: relative; }
.login-input {
  width: 100%;
  padding: 0.8rem 1.25rem;
  border: 2px solid rgba(255,133,161,0.3);
  border-radius: var(--r-full);
  background: rgba(255,255,255,0.7);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  text-align: center;
}
.login-input:focus {
  border-color: var(--brand-pink);
  box-shadow: 0 0 0 4px rgba(255,133,161,0.15);
}
body.dark .login-input { background: rgba(255,255,255,0.07); border-color: rgba(255,255,255,0.15); color: var(--text); }

.login-btn {
  padding: 0.8rem;
  border: none;
  border-radius: var(--r-full);
  background: linear-gradient(135deg, var(--brand-pink), var(--brand-purple));
  color: white;
  font-family: var(--font);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.34,1.56,0.64,1);
  box-shadow: 0 4px 16px rgba(176,127,224,0.3);
}
.login-btn:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(176,127,224,0.4); }

.login-error { font-size: 0.8rem; color: #ef4444; text-align: center; }

/* ============================================================
   SPA NAV ADDITIONS
   ============================================================ */
.nav-stats {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-left: auto;
  margin-right: 0.5rem;
}
.nav-stat {
  font-size: 0.78rem;
  color: var(--text-muted);
  white-space: nowrap;
}
.nav-stat strong { color: var(--text); }

/* ============================================================
   FILTER BAR (SPA sticky version)
   ============================================================ */
.filter-bar {
  position: sticky;
  top: 60px;
  z-index: 40;
  background: rgba(255,245,248,0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-pink);
  padding: 0.6rem 0;
  box-shadow: 0 2px 12px rgba(255,100,140,0.05);
}
body.dark .filter-bar {
  background: rgba(15,23,42,0.93);
  border-color: rgba(255,255,255,0.06);
}

.filter-bar-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* Row 1: search + sort + author + clear — all in one line */
.filter-top-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: nowrap;
}
.filter-top-row .search-wrap {
  flex: 1 1 0;
  min-width: 120px;
}
.filter-top-row .search-input {
  width: 100%;
  padding: 0.45rem 0.75rem 0.45rem 2.2rem;
  font-size: 0.8rem;
  border-radius: var(--r-full);
  border-width: 1px;
  box-shadow: none;
}
.filter-top-row .search-icon {
  left: 0.7rem;
  font-size: 0.8rem;
}

.tag-toggle {
  background: transparent !important;
  color: var(--brand-pink) !important;
  border-color: var(--brand-pink) !important;
  font-size: 0.7rem !important;
}

/* Row 2: tier pills */
.tier-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.tier-pill {
  padding: 0.3rem 0.75rem;
  border-radius: var(--r-full);
  font-size: 0.75rem;
  font-weight: 500;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.34,1.56,0.64,1);
}
.tier-pill:hover {
  background: var(--surface);
  color: var(--text);
  transform: translateY(-1px);
  box-shadow: var(--shadow-xs);
}

/* Filter selects (inline) */
.filter-select {
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--border-pink);
  border-radius: var(--r-full);
  background: var(--surface);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.75rem;
  outline: none;
  cursor: pointer;
  transition: border-color 0.2s;
  white-space: nowrap;
  flex-shrink: 0;
}
.filter-select:focus { border-color: var(--brand-pink); }
body.dark .filter-select {
  border-color: rgba(255,255,255,0.08);
  background: var(--surface);
  color: var(--text);
}

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

.clear-btn {
  padding: 0.3rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 0.72rem;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  flex-shrink: 0;
}
.clear-btn:hover { background: var(--creative-bg); color: var(--brand-pink); border-color: var(--brand-pink); }

.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}
.tag-count  { font-size: 0.6rem; opacity: 0.6; margin-left: 2px; }
.tier-count { font-size: 0.68rem; opacity: 0.75; margin-left: 2px; }

/* Active tag chips */
.active-tags { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.active-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: linear-gradient(135deg, #FFD6E0, #E8D5FF);
  color: #5C3070;
  padding: 0.18rem 0.55rem 0.18rem 0.7rem;
  border-radius: var(--r-full);
  font-size: 0.72rem;
  font-weight: 500;
}
body.dark .active-tag { background: rgba(176,127,224,0.2); color: #C4B5FD; }
.active-tag button {
  border: none;
  background: none;
  cursor: pointer;
  font-size: 0.8rem;
  color: inherit;
  opacity: 0.7;
  line-height: 1;
  padding: 0;
}
.active-tag button:hover { opacity: 1; }

/* tier-pill active state (generic — used by app.js) */
.tier-pill.active {
  background: linear-gradient(135deg, #FFD6E0, #E8D5FF);
  color: #5C3070;
  border-color: transparent;
  font-weight: 600;
}

/* ── Mobile filter bar ──────────────────────────────────────── */
@media (max-width: 560px) {
  .filter-top-row {
    flex-wrap: wrap;
  }
  .filter-top-row .search-wrap {
    flex: 1 1 100%;
  }
  .tier-pills {
    gap: 0.25rem;
  }
  .tier-pill {
    padding: 0.25rem 0.55rem;
    font-size: 0.7rem;
  }
}

/* ============================================================
   MAIN CONTENT WRAPPER
   ============================================================ */
.main-content {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 4rem;
}

/* ============================================================
   NEW MEMORY CARD STRUCTURE
   ============================================================ */
.card-accent-bar {
  height: 4px;
  background: var(--card-accent, #ccc);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  flex-shrink: 0;
}

.memory-card {
  background: var(--card-bg, var(--surface));
}
body.dark .memory-card {
  filter: brightness(0.88) saturate(0.7);
}

.card-inner {
  padding: 1rem 1.1rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex: 1;
}

.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.card-time {
  font-size: 0.68rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.card-preview {
  font-size: 0.85rem;
  color: var(--text-light);
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: auto;
  padding-top: 0.4rem;
}

.read-more-link {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 500;
  transition: color 0.2s;
}
.memory-card:hover .read-more-link { color: var(--brand-pink); }

/* Author chip */
.author-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.18rem 0.6rem;
  border-radius: var(--r-full);
  font-size: 0.68rem;
  font-weight: 500;
  white-space: nowrap;
}
.author-baby  { background: #FDF2F8; color: #BE185D; }
.author-elias { background: #EFF6FF; color: #1D4ED8; }
.author-aston { background: #D1FAE5; color: #065F46; }
body.dark .author-baby  { background: rgba(244,114,182,0.15); color: #FDA4AF; }
body.dark .author-elias { background: rgba(96,165,250,0.15);  color: #93C5FD; }
body.dark .author-aston { background: rgba(52,211,153,0.15);  color: #6EE7B7; }

/* Tier badge lg variant */
.tier-badge.lg { font-size: 0.78rem; padding: 0.25rem 0.75rem; }

/* Card fade-in animation */
@keyframes cardIn {
  from { opacity: 0; transform: translateY(14px) scale(0.98); }
  to   { opacity: 1; transform: none; }
}
.memory-card.appeared {
  animation: cardIn 0.38s cubic-bezier(0.34,1.56,0.64,1) both;
}

/* skel-line (used in js skeletons) */
.skel-line {
  background: linear-gradient(90deg, #f0e8f0 25%, #fce8f3 50%, #f0e8f0 75%);
  background-size: 400px 100%;
  animation: shimmer 1.6s infinite;
  border-radius: var(--r-sm);
  display: block;
}
body.dark .skel-line {
  background: linear-gradient(90deg, #1e293b 25%, #2d3f52 50%, #1e293b 75%);
  background-size: 400px 100%;
}

/* ============================================================
   FLOATING ACTION BUTTON
   ============================================================ */
.fab {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 100;
  width: 3.5rem;
  height: 3.5rem;
  border-radius: var(--r-full);
  border: none;
  background: linear-gradient(135deg, var(--brand-pink), var(--brand-purple));
  color: white;
  cursor: pointer;
  box-shadow: 0 6px 24px rgba(176,127,224,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s cubic-bezier(0.34,1.56,0.64,1);
}
.fab:hover { transform: scale(1.12) rotate(90deg); box-shadow: 0 10px 32px rgba(176,127,224,0.55); }
.fab-icon { font-size: 1.6rem; line-height: 1; font-weight: 300; }

/* ============================================================
   MODAL SYSTEM (SPA version — .modal is the backdrop)
   ============================================================ */
.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(60,20,80,0.45);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal.open {
  display: flex;
  animation: fadeIn 0.2s ease;
}

.modal-box {
  background: var(--surface);
  border-radius: var(--r-xl);
  max-width: 660px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 2rem;
  position: relative;
  box-shadow: 0 32px 80px rgba(60,20,80,0.25);
  border: 1px solid rgba(255,133,161,0.15);
  animation: slideUp 0.3s cubic-bezier(0.34,1.56,0.64,1);
}
body.dark .modal-box { background: #1E293B; border-color: rgba(255,255,255,0.06); }

.modal-box-sm  { max-width: 420px; text-align: center; }
.modal-box-form { max-width: 600px; }

.modal-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 1.25rem;
  padding-right: 2rem;
}

.modal-body { padding: 0.25rem 0; }

.modal-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

/* ============================================================
   VIEW MODAL INNER
   ============================================================ */
.view-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}
.view-time      { font-size: 0.72rem; color: var(--text-muted); margin-left: auto; }
.view-date-chip { font-size: 0.72rem; color: var(--text-muted); background: var(--journal-bg); padding: 0.2rem 0.6rem; border-radius: var(--r-full); }
.view-content   { margin-bottom: 1rem; }
.view-tags      { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.75rem; }
.view-expiry    { font-size: 0.72rem; color: var(--text-muted); margin-top: 0.5rem; }

/* ============================================================
   FORM MODAL ADDITIONS
   ============================================================ */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 1rem;
}
@media (max-width: 480px) { .form-grid { grid-template-columns: 1fr; } }

.form-hint { font-size: 0.7rem; color: var(--text-muted); font-weight: 400; margin-left: 0.4rem; }

.radio-group {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 0.4rem 0;
}
.radio-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  cursor: pointer;
  user-select: none;
}
.radio-label input[type="radio"] { accent-color: var(--brand-pink); width: 1rem; height: 1rem; cursor: pointer; }

/* ============================================================
   CONFIRM DELETE MODAL
   ============================================================ */
.confirm-icon    { font-size: 2.5rem; margin-bottom: 0.5rem; }
.confirm-preview { font-size: 0.85rem; color: var(--text-light); background: var(--bg); border-radius: var(--r-md); padding: 0.6rem 0.875rem; margin: 0.75rem 0 0.5rem; font-style: italic; line-height: 1.5; }
.confirm-warning { font-size: 0.78rem; color: var(--text-muted); }

/* ============================================================
   BUTTONS — DANGER
   ============================================================ */
.btn-danger {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.7rem 1.5rem;
  border: none;
  border-radius: var(--r-full);
  font-family: var(--font);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: white;
  box-shadow: 0 4px 16px rgba(239,68,68,0.3);
  transition: all 0.25s cubic-bezier(0.34,1.56,0.64,1);
}
.btn-danger:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(239,68,68,0.4); }
.btn-danger:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-danger-ghost {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.7rem 1.5rem;
  border: 1.5px solid rgba(239,68,68,0.4);
  border-radius: var(--r-full);
  font-family: var(--font);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  background: transparent;
  color: #ef4444;
  transition: all 0.2s;
}
.btn-danger-ghost:hover { background: rgba(239,68,68,0.07); border-color: #ef4444; }

/* Ensure existing btn-primary / btn-ghost work without .btn base */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.7rem 1.5rem;
  border: none;
  border-radius: var(--r-full);
  font-family: var(--font);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  background: linear-gradient(135deg, var(--journal), var(--creative));
  color: white;
  box-shadow: 0 4px 16px rgba(167,139,250,0.3);
  transition: all 0.25s cubic-bezier(0.34,1.56,0.64,1);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(167,139,250,0.4); }
.btn-primary:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.7rem 1.5rem;
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  font-family: var(--font);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  background: var(--bg);
  color: var(--text-light);
  transition: all 0.2s;
}
.btn-ghost:hover { background: var(--surface); }

/* ============================================================
   LOADING SPINNER
   ============================================================ */
.load-spinner {
  display: flex;
  justify-content: center;
  padding: 2rem;
}
@keyframes spin { to { transform: rotate(360deg); } }
.spinner {
  width: 2rem;
  height: 2rem;
  border: 3px solid var(--border-pink);
  border-top-color: var(--brand-pink);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* ============================================================
   EMPTY / ERROR STATE
   ============================================================ */
.empty-state, .error-state {
  text-align: center;
  padding: 4rem 2rem;
  grid-column: 1 / -1;
}
.empty-icon  { font-size: 3rem; margin-bottom: 1rem; }
.empty-title { font-size: 1.05rem; font-weight: 600; color: var(--text); margin-bottom: 0.4rem; }
.empty-sub   { font-size: 0.85rem; color: var(--text-muted); }
.link-btn {
  background: none;
  border: none;
  padding: 0;
  color: var(--brand-pink);
  font-family: var(--font);
  font-size: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
}

/* ============================================================
   TOAST ANIMATION (show/hide)
   ============================================================ */
.toast {
  opacity: 0;
  transform: translateY(8px) scale(0.97);
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.toast.toast-show {
  opacity: 1;
  transform: none;
}

/* ============================================================
   PROSE EXTENDED (marked.js output)
   ============================================================ */
.prose code {
  background: rgba(167,139,250,0.12);
  color: #7B4FAA;
  padding: 0.1em 0.4em;
  border-radius: 4px;
  font-size: 0.85em;
  font-family: 'Fira Code', 'Courier New', monospace;
}
.prose pre {
  background: rgba(0,0,0,0.04);
  border-radius: var(--r-md);
  padding: 1rem;
  overflow-x: auto;
  margin-bottom: 1rem;
}
body.dark .prose pre  { background: rgba(255,255,255,0.05); }
body.dark .prose code { background: rgba(167,139,250,0.15); color: #C4B5FD; }
.prose blockquote {
  border-left: 3px solid var(--journal);
  padding-left: 1rem;
  color: var(--text-muted);
  font-style: italic;
  margin: 0.75rem 0;
}
.prose ol { list-style: decimal; padding-left: 1.5rem; margin-bottom: 0.75rem; }
.prose a  { color: var(--brand-pink); text-decoration: underline; }
.prose hr { border: none; border-top: 1px solid var(--border); margin: 1rem 0; }

/* ============================================================
   RESPONSIVE ADDITIONS
   ============================================================ */
@media (max-width: 640px) {
  .fab { bottom: 1.25rem; right: 1.25rem; width: 3rem; height: 3rem; }
  .fab-icon { font-size: 1.4rem; }
  .modal-actions { flex-direction: column-reverse; }
  .modal-actions > * { width: 100%; justify-content: center; }
  .nav-stats { display: none; }
}
