:root {
  --sand-light: #FAF6F0;
  --sand-medium: #F0E6D8;
  --sand-dark: #D4C4B0;
  --sage-light: #A4B49C;
  --sage-medium: #7B9278;
  --sage-dark: #576C54;
  --warm-white: #FFFDFB;
  --stone-gray: #7D7266;
  --charcoal: #3D3A36;
  --accent-gold: #C8A882;
  --shadow-light: rgba(0,0,0,0.04);
  --shadow-medium: rgba(0,0,0,0.08);
  --shadow-heavy: rgba(0,0,0,0.16);
  --gradient-primary: linear-gradient(135deg, var(--sage-medium), var(--sage-light));
  --gradient-secondary: linear-gradient(135deg, var(--accent-gold), #E6D4B7);
  --glass-bg: color-mix(in srgb, var(--warm-white) 92%, white);
  --glass-border: color-mix(in srgb, var(--sand-dark) 18%, transparent);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  background: linear-gradient(180deg, var(--sand-medium), var(--sand-light));
  color: var(--charcoal);
}

.sky::after { /* subtle animated breathing highlight */
  content: '';
  position: fixed; inset: 0;
  background: radial-gradient(40% 30% at 50% 10%, rgba(164,180,156,0.10), transparent 60%);
  animation: breathe 16s ease-in-out infinite alternate;
}

@keyframes breathe { 
  0% { opacity: 0.6; transform: scale(1) rotate(0deg); } 
  50% { opacity: 0.8; transform: scale(1.02) rotate(0.5deg); }
  100% { opacity: 1; transform: scale(1.05) rotate(0deg); } 
}

.sky { position: fixed; inset: 0; background:
  radial-gradient(1200px 600px at -10% -10%, rgba(164,180,156,0.22), transparent 60%),
  radial-gradient(900px 500px at 110% -20%, rgba(240,230,216,0.5), transparent 60%),
  linear-gradient(180deg, var(--sand-medium), var(--sand-light));
  z-index: -1; }

.container { min-height: 100%; display: flex; flex-direction: column; }
.sidebar { position: fixed; left: 12px; top: 24px; bottom: 24px; width: 68px; z-index: 70;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 20px; 
  box-shadow: 0 8px 32px var(--shadow-light), inset 0 1px 0 rgba(255,255,255,0.5);
  backdrop-filter: blur(12px);
  overflow: hidden; 
  transition: all 280ms cubic-bezier(0.4, 0, 0.2, 1);
}
.sidebar:hover { 
  width: 220px; 
  box-shadow: 0 12px 40px var(--shadow-medium), inset 0 1px 0 rgba(255,255,255,0.5);
  transform: translateY(-2px);
}
.side-inner { display: grid; gap: 6px; padding: 8px; }
.side-logo { width: 42px; height: 42px; object-fit: cover; border-radius: 8px; margin: 6px; box-shadow: 0 3px 8px rgba(0,0,0,0.12); }
.close-menu { display:none; position:absolute; top:8px; right:8px; border:none; background: transparent; color: var(--sage-dark); font-size: 20px; padding: 6px; border-radius: 10px; cursor: pointer; }
.close-menu:hover { background: var(--shadow-light); }
.sidebar .item { display: grid; grid-template-columns: 28px 1fr; align-items: center; gap: 8px; 
  border: none; background: transparent; text-align: left; padding: 10px 12px; border-radius: 14px; cursor: pointer;
  transition: all 200ms cubic-bezier(0.4, 0, 0.2, 1);
  position: relative; overflow: hidden;
}
.sidebar .item:hover { 
  background: var(--shadow-light);
  transform: translateX(2px);
}
.sidebar .item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  width: 3px;
  height: 0;
  background: var(--gradient-primary);
  border-radius: 0 2px 2px 0;
  transform: translateY(-50%);
  transition: height 200ms ease;
}
.sidebar .item:hover::before { height: 60%; }
.sidebar .ico { display:grid; place-items:center; width: 28px; height: 28px; border-radius: 50%; 
  background: var(--gradient-primary); color: var(--warm-white); 
  box-shadow: 0 4px 12px rgba(87,108,84,0.25), inset 0 1px 0 rgba(255,255,255,0.2); 
  font-size: 14px; font-weight: 700;
  transition: all 200ms cubic-bezier(0.4, 0, 0.2, 1);
}
.sidebar .item:hover .ico {
  transform: scale(1.1) rotate(5deg);
  box-shadow: 0 6px 16px rgba(87,108,84,0.35), inset 0 1px 0 rgba(255,255,255,0.3);
}
.sidebar .lbl { white-space: nowrap; color: var(--charcoal); font-weight: 600; }

/* Hide sidebar labels until expanded (desktop) or menu open (mobile) */
.sidebar .lbl { 
  opacity: 0; 
  width: 0; 
  overflow: hidden; 
  transform: translateX(-6px);
  transition: opacity 180ms ease, width 180ms ease, transform 180ms ease;
}
.sidebar:hover .lbl,
body.menu-open .sidebar .lbl {
  opacity: 1;
  width: auto;
  transform: translateX(0);
}

/* Collapse label column and gap when not expanded */
.sidebar:not(:hover) .item { grid-template-columns: 28px 0fr; gap: 0; }
.sidebar:hover .item,
body.menu-open .sidebar .item { grid-template-columns: 28px 1fr; gap: 8px; }

/* Brand fixed (mobile) + menu button */
.brand-fixed { position: fixed; top: 10px; left: 12px; width: 56px; height: 56px; object-fit: cover; border-radius: 10px; box-shadow: 0 3px 8px rgba(0,0,0,0.15); display: none; z-index: 45; }
.menu-btn { position: fixed; bottom: 12px; left: 12px; height: 44px; min-width: 44px; padding: 0 12px; border-radius: 22px; border: 1px solid color-mix(in srgb, var(--sand-dark) 18%, transparent); background: color-mix(in srgb, var(--warm-white) 85%, white); box-shadow: 0 3px 8px rgba(0,0,0,0.1); cursor: pointer; display: none; z-index: 45; }
.menu-btn svg { vertical-align: middle; }
.hero { text-align: center; padding: 36px 16px 10px; position: relative; }
.hero-head { display: inline-flex; align-items: center; justify-content: center; gap: 14px; }
.title-logo { width: 56px; height: 56px; object-fit: cover; border-radius: 12px; box-shadow: 0 3px 8px rgba(0,0,0,0.15); border: 1px solid var(--glass-border); }
.hero-divider { width: 140px; height: 2px; margin: 14px auto 0; background: var(--gradient-primary); border-radius: 1px; opacity: 0.7; }
.hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  width: 100px;
  height: 2px;
  background: var(--gradient-primary);
  border-radius: 1px;
  transform: translateX(-50%);
  opacity: 0.6;
}
.title { 
  margin: 0 0 12px; 
  font-size: clamp(28px, 4vw, 40px); 
  font-weight: 700; 
  color: var(--charcoal);
  background: linear-gradient(135deg, var(--charcoal), var(--sage-dark));
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: titleGlow 3s ease-in-out infinite alternate;
}
@keyframes titleGlow {
  from { filter: brightness(1); }
  to { filter: brightness(1.05); }
}
.tag { 
  margin: 0; 
  color: var(--stone-gray);
  font-size: 16px;
  line-height: 1.5;
  max-width: 600px;
  margin: 0 auto;
}

.deck { 
  width: min(1000px, 96%); 
  margin: 20px auto; 
  overflow: hidden;
  position: relative;
}
.pages { display: flex; width: 500%; transition: transform 420ms cubic-bezier(.22,.61,.36,1); will-change: transform; }
.pages.show-viewer { transform: translateX(-20%); }
.pages.show-journal { transform: translateX(-40%); }
.pages.show-about { transform: translateX(-60%); }
.pages.show-privacy { transform: translateX(-80%); }
.page { width: 20%; padding: 0 8px; }
.panel {
  width: min(880px, 96%);
  margin: 0 auto;
  border-radius: 24px;
  padding: 24px;
  position: relative;
  overflow: hidden;
}
.panel::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.6), transparent);
}

.glass { 
  background: var(--glass-bg);
  box-shadow: 
    0 8px 32px var(--shadow-light),
    0 1px 0 rgba(255,255,255,0.5),
    inset 0 1px 0 rgba(255,255,255,0.8);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(16px);
  transition: all 300ms cubic-bezier(0.4, 0, 0.2, 1);
}
.glass:hover {
  box-shadow: 
    0 12px 40px var(--shadow-medium),
    0 1px 0 rgba(255,255,255,0.6),
    inset 0 1px 0 rgba(255,255,255,0.9);
  transform: translateY(-2px);
}

.row { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; margin-bottom: 10px; }
.label { font-weight: 600; display: inline-flex; align-items: center; gap: 8px; }
.icon { font-size: 14px; }
.chip { 
  width: 28px; height: 28px; 
  display:grid; place-items:center; 
  border-radius: 50%;
  background: var(--gradient-primary); 
  color: var(--warm-white);
  box-shadow: 
    0 4px 12px rgba(87,108,84,0.25),
    inset 0 1px 0 rgba(255,255,255,0.2); 
  font-size: 13px; font-weight: 700;
  transition: all 200ms cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}
.chip::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(45deg, transparent, rgba(255,255,255,0.1), transparent);
  transform: rotate(-45deg);
  animation: chipShimmer 3s linear infinite;
}
@keyframes chipShimmer {
  0% { transform: translateX(-100%) translateY(-100%) rotate(-45deg); }
  50% { transform: translateX(100%) translateY(100%) rotate(-45deg); }
  100% { transform: translateX(-100%) translateY(-100%) rotate(-45deg); }
}
.chip .ico-svg { width: 16px; height: 16px; fill: currentColor; color: var(--warm-white); }

.editor { position: relative; }
.select, .textarea {
  width: 100%;
  border-radius: 16px;
  border: 1px solid var(--glass-border);
  background: var(--warm-white);
  padding: 14px 16px;
  color: var(--charcoal);
  outline: none;
  font-size: 15px;
  transition: all 200ms cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.05);
}
.select:focus, .textarea:focus { 
  border-color: var(--sage-medium); 
  box-shadow: 
    0 0 0 3px rgba(123,146,120,0.15),
    inset 0 1px 2px rgba(0,0,0,0.05),
    0 4px 12px rgba(123,146,120,0.1);
  transform: translateY(-1px);
}
.textarea {
  resize: vertical;
  min-height: 120px;
  font-family: inherit;
  line-height: 1.5;
}

.actions { display: flex; align-items: center; gap: 12px; margin-top: 12px; flex-wrap: wrap; }
.helper-row { display:flex; align-items:center; justify-content: space-between; margin-top: 6px; padding: 0 2px; }
.counter { color: var(--stone-gray); font-size: 12px; }
.hint { color: var(--stone-gray); font-size: 12px; }
.btn {
  background: var(--gradient-primary);
  color: var(--warm-white);
  border: none;
  border-radius: 16px;
  padding: 14px 24px;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  box-shadow: 
    0 6px 16px rgba(87,108,84,0.25),
    inset 0 1px 0 rgba(255,255,255,0.2);
  display:inline-flex; 
  align-items:center; 
  gap:8px;
  position: relative; 
  overflow: hidden;
  transition: all 250ms cubic-bezier(0.4, 0, 0.2, 1);
  text-decoration: none;
  user-select: none;
}
.btn .spark { 
  position: relative; 
  z-index: 1;
  transition: transform 200ms ease;
}
.btn::after { /* shimmer */
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(60deg, transparent 0%, rgba(255,255,255,0.3) 50%, transparent 100%);
  transform: translateX(-120%);
  animation: shine 3s ease-in-out 2s infinite;
}
@keyframes shine { 
  0% { transform: translateX(-120%); }
  50% { transform: translateX(0%); }
  100% { transform: translateX(120%); }
}
.btn:hover { 
  transform: translateY(-2px) scale(1.02);
  box-shadow: 
    0 8px 24px rgba(87,108,84,0.35),
    inset 0 1px 0 rgba(255,255,255,0.3);
}
.btn:hover .spark {
  transform: scale(1.1) rotate(12deg);
}
.btn:active {
  transform: translateY(0) scale(0.98);
  box-shadow: 0 4px 12px rgba(87,108,84,0.2);
}
.btn[disabled] { 
  opacity: 0.6; 
  cursor: not-allowed; 
  transform: none;
  box-shadow: 0 2px 8px rgba(87,108,84,0.15);
}
.status { 
  color: var(--stone-gray); 
  font-size: 14px;
  transition: all 300ms ease;
}
.status:not(:empty) { 
  background: var(--glass-bg); 
  padding: 12px 16px; 
  border-radius: 16px; 
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(8px);
  box-shadow: 0 4px 12px var(--shadow-light);
  animation: statusSlide 300ms cubic-bezier(0.4, 0, 0.2, 1);
}
@keyframes statusSlide {
  from { opacity: 0; transform: translateY(-8px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.result { width: min(880px, 92%); margin: 0 auto 32px; display: grid; gap: 14px; }
.hidden { display: none; }

.suggestions { display:flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.suggestion { 
  border: 1px solid var(--glass-border);
  background: var(--warm-white);
  color: var(--charcoal);
  padding: 8px 12px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 13px;
  transition: all 200ms ease;
}
.suggestion:hover { transform: translateY(-1px); box-shadow: 0 4px 10px var(--shadow-light); }
.suggestion:active { transform: translateY(0); }

.card-slide {
  background: var(--glass-bg);
  border-radius: 24px; 
  padding: 28px;
  border: 1px solid var(--glass-border);
  box-shadow: 
    0 8px 32px var(--shadow-light),
    inset 0 1px 0 rgba(255,255,255,0.5);
  width: 100%; 
  margin: 0 auto;
  backdrop-filter: blur(16px);
  position: relative;
  overflow: hidden;
  transition: all 300ms cubic-bezier(0.4, 0, 0.2, 1);
}
.card-slide::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.8), transparent);
}
.card-slide:hover {
  transform: translateY(-3px) scale(1.01);
  box-shadow: 
    0 16px 48px var(--shadow-medium),
    inset 0 1px 0 rgba(255,255,255,0.6);
}
.slide-title { 
  display:flex; 
  justify-content:space-between; 
  align-items:baseline; 
  gap: 16px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(164,180,156,0.1);
  position: relative;
}
.slide-title::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 40px;
  height: 2px;
  background: var(--gradient-primary);
  border-radius: 1px;
}
.slide-title h3 { 
  margin: 0; 
  font-size: 20px;
  font-weight: 700;
  color: var(--charcoal);
  background: linear-gradient(135deg, var(--charcoal), var(--sage-dark));
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.badge { 
  font-size: 12px; 
  color: var(--stone-gray);
  background: rgba(164,180,156,0.1);
  padding: 4px 8px;
  border-radius: 8px;
  font-weight: 500;
  border: 1px solid rgba(164,180,156,0.15);
}

.footer { text-align:center; padding: 24px; margin-top:auto; }
.muted { color: var(--stone-gray); }

/* Small Mobile Optimization */
@media (max-width: 520px) {
  .hero {
    padding: 20px 12px 12px;
  }
  .hero-head { gap: 10px; }
  .title-logo { width: 44px; height: 44px; border-radius: 10px; }
  .hero-divider { width: 120px; margin-top: 12px; }
  .title { 
    font-size: clamp(22px, 6vw, 28px);
    margin-bottom: 8px;
  }
  .tag {
    font-size: 14px;
    padding: 0 8px;
  }
  .deck {
    width: 98%;
    margin: 12px auto;
  }
  .panel {
    padding: 16px;
    border-radius: 18px;
  }
  .card-slide {
    padding: 16px;
    border-radius: 18px;
  }
  .slides {
    padding: 0 8px;
  }
  .slide-item {
    padding: 0 4px;
  }
  .nav {
    width: 36px;
    height: 36px;
    font-size: 16px;
  }
  .dots {
    gap: 8px;
    margin-top: 12px;
  }
  .dot {
    width: 8px;
    height: 8px;
  }
  
  /* Mobile form improvements */
  .btn {
    padding: 12px 20px;
    font-size: 14px;
    border-radius: 14px;
  }
  .select, .textarea {
    padding: 12px 14px;
    border-radius: 14px;
    font-size: 16px; /* prevent iOS zoom on focus */
  }
  
  /* Journal mobile optimization */
  .journal-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  .helper-row { flex-direction: row; gap: 8px; }
  .counter, .hint { font-size: 11px; }
  .suggestions { gap: 6px; }
  .suggestion { padding: 6px 10px; font-size: 12px; }
  .journal-actions {
    width: 100%;
    justify-content: space-between;
  }
  .journal-actions .btn.small {
    flex: 1;
    justify-content: center;
    min-width: 0;
  }
}

/* Enhanced Typography */
.card-slide h2 {
  color: var(--charcoal);
  font-size: 24px;
  font-weight: 700;
  margin: 0 0 16px;
  line-height: 1.3;
}
.card-slide h3 {
  color: var(--sage-dark);
  font-size: 18px;
  font-weight: 600;
  margin: 0 0 12px;
}
.card-slide p {
  color: var(--charcoal);
  font-size: 16px;
  line-height: 1.6;
  margin: 0 0 12px;
}
.card-slide em {
  color: var(--sage-dark);
  font-style: italic;
  position: relative;
}
.card-slide small {
  color: var(--stone-gray);
  font-size: 14px;
  font-weight: 500;
}
.card-slide ol, .card-slide ul {
  margin: 0;
  padding-left: 20px;
}
.card-slide li {
  margin-bottom: 8px;
  color: var(--charcoal);
  line-height: 1.5;
}
.card-slide li::marker {
  color: var(--sage-medium);
}

/* Tip row */
.tip { 
  display:flex; 
  align-items:center; 
  gap:10px; 
  margin-top:16px; 
  padding: 12px 16px;
  background: rgba(164,180,156,0.05);
  border-radius: 12px;
  border: 1px solid rgba(164,180,156,0.1);
  color: var(--stone-gray); 
  font-size: 14px;
  line-height: 1.5;
  transition: all 200ms ease;
}
.tip:hover {
  background: rgba(164,180,156,0.08);
  transform: translateY(-1px);
}
.tip-icon { font-size: 16px; }

/* Modal viewer */
.modal { position: fixed; inset: 0; display:grid; place-items:center; background: rgba(0,0,0,0.25); z-index: 50; }
.modal.hidden { display: none; }
.modal .modal-content { width: min(1000px, 94%); border-radius: 22px; padding: 16px; }
.viewer-header {
  display:flex;
  justify-content: space-between;
  align-items:center;
  margin-bottom: 16px;
  padding: 0 16px 12px 16px;
  border-bottom: 1px solid var(--glass-border);
  position: relative;
  flex-shrink: 0;
}
.viewer-header::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 60px;
  height: 2px;
  background: var(--gradient-primary);
  border-radius: 1px;
  animation: headerAccent 2s ease-in-out infinite alternate;
}
@keyframes headerAccent {
  from { width: 60px; opacity: 0.6; }
  to { width: 120px; opacity: 1; }
}
.viewer-title { margin: 0; font-size: 18px; color: var(--charcoal); }
.icon-btn { 
  border: none; 
  background: transparent; 
  cursor: pointer; 
  font-size: 20px;
  padding: 8px;
  border-radius: 12px;
  transition: all 200ms cubic-bezier(0.4, 0, 0.2, 1);
  color: var(--sage-dark);
  display: flex;
  align-items: center;
  justify-content: center;
}
.icon-btn:hover {
  background: var(--shadow-light);
  transform: scale(1.1) rotate(-2deg);
  color: var(--sage-medium);
}
.viewer-actions { display:flex; gap:8px; }
.btn.small { 
  padding: 10px 16px; 
  border-radius: 12px; 
  font-weight: 600;
  font-size: 13px;
  box-shadow: 0 3px 8px rgba(87,108,84,0.2);
}
.btn.small:hover {
  transform: translateY(-1px) scale(1.02);
  box-shadow: 0 4px 12px rgba(87,108,84,0.25);
}
.slides { 
  position: relative; 
  padding: 0 36px;
  transition: padding 300ms ease;
}
.slide-wrap { 
  overflow: hidden; 
  width: 100%;
  border-radius: 20px;
  position: relative;
  transition: height 300ms cubic-bezier(0.4, 0, 0.2, 1);
  touch-action: pan-y;
}
.slide-track { 
  display: flex; 
  align-items: flex-start; /* avoid equal-height stretching to tallest slide */
  transition: transform 400ms cubic-bezier(0.4, 0, 0.2, 1); 
  gap: 0;
  will-change: transform;
}
.slide-item { 
  min-width: 100%; 
  padding: 0 12px; 
  display: flex; 
  justify-content: center;
  align-items: flex-start; /* let card height follow its own content */
  opacity: 1;
  transition: opacity 200ms ease;
}
/* Hide legacy overlay nav buttons if still present */
.slides .nav { display: none !important; }
.dots { 
  display:flex; 
  justify-content:center; 
  gap: 12px; 
  margin-top: 16px;
  padding: 8px;
}
.dot { 
  width: 10px; 
  height: 10px; 
  border-radius: 50%; 
  background: var(--sand-dark); 
  opacity: 0.4;
  cursor: pointer;
  transition: all 250ms cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}
.dot:hover {
  opacity: 0.6;
  transform: scale(1.2);
}
.dot.active { 
  opacity: 1; 
  background: var(--sage-medium);
  transform: scale(1.3);
  box-shadow: 0 0 0 3px rgba(123,146,120,0.2);
}
.dot.active::after {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(123,146,120,0.3), transparent 60%);
  animation: dotPulse 2s ease-in-out infinite;
}
@keyframes dotPulse {
  0%, 100% { opacity: 0.5; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.2); }
}

/* Compact control bar with arrows and dots */
.controls { display:flex; align-items:center; justify-content:center; gap: 10px; margin-top: 10px; }
.top-controls { margin-bottom: 8px; }
.ctrl { 
  border: none; background: rgba(255,255,255,0.9); color: var(--sage-dark);
  border-radius: 10px; width: 36px; height: 32px; cursor: pointer; display:flex; align-items:center; justify-content:center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12), inset 0 1px 0 rgba(255,255,255,0.6);
  transition: transform 150ms ease, box-shadow 150ms ease;
}
.ctrl:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,0.18), inset 0 1px 0 rgba(255,255,255,0.7); }
.ctrl:disabled { opacity: .4; cursor: default; transform: none; box-shadow: 0 1px 4px rgba(0,0,0,0.08); }

/* Journal list */
.journal-list { display:grid; gap:12px; }
.journal-item { 
  display:flex; 
  align-items:center; 
  justify-content: space-between; 
  gap:16px; 
  padding:16px 20px; 
  border:1px solid var(--glass-border); 
  border-radius:16px; 
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  box-shadow: 
    0 4px 12px var(--shadow-light),
    inset 0 1px 0 rgba(255,255,255,0.5);
  transition: all 250ms cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}
.journal-item:hover {
  transform: translateY(-2px) scale(1.01);
  box-shadow: 
    0 8px 24px var(--shadow-medium),
    inset 0 1px 0 rgba(255,255,255,0.6);
}
.journal-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  width: 3px;
  height: 100%;
  background: var(--gradient-primary);
  opacity: 0;
  transition: opacity 250ms ease;
}
.journal-item:hover::before {
  opacity: 1;
}
.journal-meta { display:flex; flex-direction:column; gap:4px; }
.journal-actions { display:flex; gap:8px; }
.journal-actions .btn.small { display:inline-flex; align-items:center; gap:6px; }

/* Breathing overlay */
/* Loading overlay */
.loading {
  position: fixed;
  inset: 0;
  display:grid;
  place-items:center;
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(8px);
  z-index: 100;
  opacity: 1;
  transition: opacity 300ms ease;
}
.loading.hidden { 
  opacity: 0;
  pointer-events: none;
}
.loading-inner { 
  width: min(420px, 90%); 
  border-radius: 24px; 
  padding: 32px; 
  text-align:center;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  box-shadow: 
    0 12px 40px rgba(0,0,0,0.2),
    inset 0 1px 0 rgba(255,255,255,0.6);
  backdrop-filter: blur(16px);
  animation: loadingPulse 3.2s ease-in-out infinite alternate;
}
@keyframes loadingPulse {
  from { transform: scale(1); }
  to { transform: scale(1.02); }
}
.loading-video { 
  width: min(240px, 70vw);
  margin: 0 auto;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0,0,0,0.15), inset 0 1px 0 rgba(255,255,255,0.4);
  animation: videoPulse 4.5s ease-in-out infinite;
}
.loading-vid { display:block; width: 100%; height: auto; object-fit: cover; }
.loading-text {
  margin-top: 12px;
  font-size: 16px;
  font-weight: 600;
  text-align: center;
  min-height: 24px;
  background: linear-gradient(90deg, var(--sage-dark), var(--sage-medium), var(--accent-gold), var(--sage-medium), var(--sage-dark));
  background-size: 200% auto;
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: loadingTextShimmer 3s linear infinite;
  line-height: 1.4;
  padding: 0 20px;
}
@keyframes loadingTextShimmer {
  0% { background-position: 200% center; }
  100% { background-position: -200% center; }
}
@keyframes videoPulse {
  0% { transform: scale(0.985); }
  50% { transform: scale(1.015); }
  100% { transform: scale(0.985); }
}

/* Enhanced card animations */
.card-slide { 
  animation: slideInUp 400ms cubic-bezier(0.4, 0, 0.2, 1) forwards; 
  opacity: 0; 
  transform: translateY(20px) scale(0.95);
  touch-action: pan-y;
  overscroll-behavior: contain;
}
@keyframes slideInUp { 
  0% { opacity: 0; transform: translateY(20px) scale(0.95); }
  60% { opacity: 0.8; transform: translateY(-2px) scale(1.01); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

/* Staggered animation for multiple cards */
.slide-item:nth-child(1) .card-slide { animation-delay: 0ms; }
.slide-item:nth-child(2) .card-slide { animation-delay: 100ms; }
.slide-item:nth-child(3) .card-slide { animation-delay: 200ms; }
.slide-item:nth-child(4) .card-slide { animation-delay: 300ms; }
.slide-item:nth-child(5) .card-slide { animation-delay: 400ms; }

/* Progressive Enhancement - Tablet */
@media (max-width: 1024px) {
  .panel {
    width: min(880px, 98%);
    padding: 20px;
  }
  .card-slide {
    padding: 24px;
  }
}

/* Mobile Landscape */
@media (max-width: 768px) {
  .hero {
    padding: 24px 16px 16px;
  }
  .title {
    font-size: clamp(24px, 5vw, 32px);
  }
  .slides {
    padding: 0 24px;
  }
  .nav {
    width: 44px;
    height: 44px;
    font-size: 20px;
    padding: 10px;
  }
  .panel {
    border-radius: 20px;
  }
}

/* Mobile Portrait - Enhanced */
@media (max-width: 720px) {
  html, body, .container { height: 100dvh; }
  body { overflow: hidden; }
  .footer { display: none; }
  /* Hide hero only when viewer is open to keep Create screen welcoming */
  body.viewer-open .hero { display: none; }
  .sidebar { 
    transform: translateX(-110%); /* ensure fully off-screen */
    opacity: 0;                 /* hide any sliver + shadow */
    pointer-events: none;       /* prevent intercepting taps when closed */
    transition: transform 300ms cubic-bezier(0.4, 0, 0.2, 1), opacity 200ms ease; 
    width: min(280px, 80vw);
    left: 0;
    top: 0;
    bottom: 0;
    border-radius: 0 20px 20px 0;
    box-shadow: 8px 0 32px rgba(0,0,0,0.15);
  }
  /* Neutralize desktop hover expansion on mobile */
  .sidebar:hover { width: min(280px, 80vw); }
  .close-menu { display:block; }
  body.menu-open .sidebar { 
    transform: translateX(0);
    opacity: 1;
    pointer-events: auto;
    box-shadow: 8px 0 48px rgba(0,0,0,0.25);
  }
  .brand-fixed, .menu-btn { display: block; }
  body.menu-open .brand-fixed { display: none; }
  /* Dim background when menu is open */
  .menu-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.25); z-index: 60; opacity: 0; pointer-events: none; transition: opacity 200ms ease; }
  body.menu-open .menu-overlay { opacity: 1; pointer-events: auto; }
  
  /* Enhanced mobile card layout / app-like layout */
  .deck { height: 100dvh; margin: 0 auto; width: 100%; }
  .page { height: 100%; }
  .panel {
    height: calc(100dvh - 16px);
    margin: 8px auto;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  /* Make info-body scrollable on mobile */
  .info-body {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 16px;
    flex: 1;
  }
  .slides {
    padding: 0 8px;
    display: flex;
    flex-direction: column;
    height: 100%;
  }
  .top-controls, .bottom-controls { flex: 0 0 auto; }
  .slide-wrap { flex: 1 1 auto; height: auto; min-height: 0; }
  .slide-track { height: 100%; }
  .controls { gap: 8px; margin-top: 8px; }
  .ctrl { width: 32px; height: 28px; }
  .slide-item {
    padding: 0 2px; /* tighter gutter between slides */
    height: 100%;
  }
  .card-slide {
    padding: 16px; /* slimmer inside padding on mobile */
    border-radius: 20px;
    /* Remove max-width constraint for mobile */
    max-width: none;
    height: 100%;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
  }
  .nav {
    width: 40px;
    height: 40px;
    font-size: 18px;
    padding: 8px;
  }
  .nav.left { left: 4px; }
  .nav.right { right: 4px; }
  
  /* Improved mobile typography */
  .card-slide h3 {
    font-size: 18px;
    margin-bottom: 12px;
  }
  .card-slide p {
    font-size: 15px;
    line-height: 1.6;
  }
  .badge {
    font-size: 11px;
  }
}

/* Modern Scrollbar Styling */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: rgba(164,180,156,0.1);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb {
  background: var(--sage-medium);
  border-radius: 4px;
  transition: background 200ms ease;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--sage-dark);
}

/* Focus Styles for Accessibility */
.btn:focus-visible,
.select:focus-visible,
.textarea:focus-visible,
.icon-btn:focus-visible,
.nav:focus-visible,
.dot:focus-visible {
  outline: 2px solid var(--sage-medium);
  outline-offset: 2px;
}

/* Selection Styling */
::selection {
  background: rgba(123,146,120,0.2);
  color: var(--charcoal);
}

/* Smooth scrolling */
html {
  scroll-behavior: smooth;
}

/* Page transitions */
.page {
  animation: pageSlide 500ms cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes pageSlide {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

/* Enhanced card interaction */
.card-slide:active {
  transform: scale(0.98);
}

/* Floating action styles */
.floating-gradient {
  background: linear-gradient(135deg, 
    var(--sage-light) 0%, 
    var(--accent-gold) 50%, 
    var(--sage-medium) 100%);
  background-size: 200% 200%;
  animation: gradientShift 4s ease infinite;
}

@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .sky::after,
  .title,
  .chip::after,
  .book {
    animation: none;
  }
  html {
    scroll-behavior: auto;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  :root {
    --glass-border: rgba(0,0,0,0.4);
    --shadow-light: rgba(0,0,0,0.2);
    --shadow-medium: rgba(0,0,0,0.3);
  }
  .glass,
  .card-slide {
    border: 2px solid var(--sage-dark);
  }
  .btn {
    border: 2px solid var(--warm-white);
  }
}

/* Print styles */
@media print {
  .sidebar,
  .menu-btn,
  .brand-fixed,
  .nav,
  .dots,
  .loading {
    display: none !important;
  }
  .card-slide {
    break-inside: avoid;
    page-break-inside: avoid;
  }
}

/* Auth Modal */
.auth-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}

.auth-modal.hidden {
  display: none;
}

.auth-modal-content {
  background: var(--warm-white);
  border-radius: 16px;
  padding: 32px;
  max-width: 400px;
  width: 100%;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  position: relative;
}

.close-auth {
  position: absolute;
  top: 16px;
  right: 16px;
  background: none;
  border: none;
  font-size: 28px;
  color: var(--stone-gray);
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background-color 0.2s;
}

.close-auth:hover {
  background-color: var(--sand-medium);
}

.auth-modal-content h2 {
  margin: 0 0 24px 0;
  color: var(--charcoal);
  font-size: 24px;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  margin-bottom: 6px;
  color: var(--stone-gray);
  font-size: 14px;
  font-weight: 500;
}

.form-input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--sand-dark);
  border-radius: 8px;
  font-size: 15px;
  font-family: inherit;
  background: var(--warm-white);
  color: var(--charcoal);
  transition: border-color 0.2s;
}

.form-input:focus {
  outline: none;
  border-color: var(--sage-medium);
}

.auth-error {
  background: #fee;
  color: #c33;
  padding: 10px 12px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 14px;
}

.auth-error.hidden {
  display: none;
}

.full-width {
  width: 100%;
}

.auth-toggle {
  margin-top: 16px;
  text-align: center;
  font-size: 14px;
  color: var(--stone-gray);
}

.link-btn {
  background: none;
  border: none;
  color: var(--sage-dark);
  cursor: pointer;
  font-weight: 600;
  padding: 0;
  margin-left: 4px;
  text-decoration: underline;
}

.link-btn:hover {
  color: var(--sage-medium);
}

/* Signup Banner */
.signup-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: linear-gradient(135deg, var(--sage-medium), var(--sage-light));
  color: white;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  z-index: 90;
  animation: slideDown 0.3s ease;
}

.signup-banner.hidden {
  display: none;
}

@keyframes slideDown {
  from { transform: translateY(-100%); }
  to { transform: translateY(0); }
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.banner-content {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}

.banner-icon {
  font-size: 20px;
}

.banner-text {
  font-size: 14px;
  font-weight: 500;
}

.banner-btn {
  background: white;
  color: var(--sage-dark);
  border: none;
  padding: 6px 16px;
  border-radius: 20px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}

.banner-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.banner-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.banner-close-btn {
  background: rgba(255,255,255,0.25);
  border: 1px solid rgba(255,255,255,0.3);
  color: white;
  font-size: 18px;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 10px;
  opacity: 0.9;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
}

.banner-close-btn:hover {
  opacity: 1;
  background: rgba(255,255,255,0.35);
  transform: scale(1.05);
}

/* Better Auth UI */
.auth-login-btn {
  width: 100%;
  background: var(--gradient-primary);
  border: none;
  border-radius: 14px;
  padding: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 4px 12px rgba(87,108,84,0.2);
  color: white;
  font-weight: 600;
  font-size: 15px;
}

.auth-login-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(87,108,84,0.3);
}

.auth-btn-icon {
  width: 36px;
  height: 36px;
  background: rgba(255,255,255,0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.auth-btn-label {
  flex: 1;
  text-align: left;
  white-space: nowrap;
  opacity: 0;
  width: 0;
  overflow: hidden;
  transition: opacity 0.18s ease, width 0.18s ease;
}

.sidebar:hover .auth-login-btn {
  justify-content: flex-start;
  padding: 12px 16px;
}

.sidebar:hover .auth-btn-label,
body.menu-open .sidebar .auth-btn-label {
  opacity: 1;
  width: auto;
}

/* Logged in user card */
.auth-user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  background: rgba(255,255,255,0.05);
  border-radius: 14px;
  transition: all 0.2s;
}

.auth-user-card:hover {
  background: rgba(255,255,255,0.1);
}

.auth-user-icon {
  width: 36px;
  height: 36px;
  background: var(--gradient-primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 20px;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(87,108,84,0.2);
}

.auth-user-info {
  flex: 1;
  min-width: 0;
  opacity: 0;
  width: 0;
  overflow: hidden;
  transition: opacity 0.18s ease, width 0.18s ease;
}

.sidebar:hover .auth-user-info,
body.menu-open .sidebar .auth-user-info {
  opacity: 1;
  width: auto;
}

.auth-user-email {
  font-size: 13px;
  color: white;
  font-weight: 600;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.auth-logout-btn {
  background: none;
  border: none;
  color: rgba(255,255,255,0.7);
  font-size: 12px;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: color 0.2s;
}

.auth-logout-btn:hover {
  color: white;
}

.auth-logout-label {
  white-space: nowrap;
}

/* Adjust container when banner is visible */
body:has(.signup-banner:not(.hidden)) .container {
  padding-top: 50px;
}

body:has(.signup-banner:not(.hidden)) .sidebar {
  top: 74px;
}

@media (max-width: 720px) {
  .signup-banner {
    top: auto;
    bottom: 16px;
    left: auto;
    right: 16px;
    width: calc(100% - 32px);
    max-width: 320px;
    padding: 10px 14px;
    animation: slideUp 0.3s ease;
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
    border-radius: 16px;
  }

  body:has(.signup-banner:not(.hidden)) .container {
    padding-top: 0;
    padding-bottom: 0;
  }

  body:has(.signup-banner:not(.hidden)) .sidebar {
    top: 24px;
    bottom: 24px;
  }

  .banner-content {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .banner-text {
    font-size: 12px;
    text-align: left;
    width: 100%;
    line-height: 1.4;
  }

  .banner-content > div:last-child {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
  }

  .banner-icon {
    font-size: 18px;
  }

  .banner-btn {
    padding: 6px 14px;
    font-size: 12px;
    flex: 1;
  }

  .banner-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
  }

  .banner-close-btn {
    font-size: 16px;
    padding: 6px 8px;
    min-width: 32px;
    height: 32px;
    flex-shrink: 0;
  }
}
