/* ============================================================
   styles.css — Remember App · Polaroid Design Language
   ============================================================ */

/* ── Google Fonts ── */
@import url('https://fonts.googleapis.com/css2?family=Caveat:wght@400;600;700&family=Inter:wght@300;400;500;600;700&display=swap');

/* ── Custom Properties ── */
:root {
  --bg:          #FFF8F0;
  --primary:     #8B6914;
  --accent:      #E8A0BF;
  --text:        #2C1810;
  --card:        #FFFFFF;
  --card-shadow: 0 4px 15px rgba(139, 105, 20, 0.15);
  --muted:       #A89274;
  --border:      #EDE0D0;
  --overlay-bg:  rgba(44, 24, 16, 0.45);
  --nav-h:       68px;
  --header-h:    72px;
  --radius-sm:   8px;
  --radius-md:   14px;
  --radius-lg:   24px;
  --transition:  0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

img { display: block; max-width: 100%; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
input, textarea { font-family: inherit; }

.handwritten { font-family: 'Caveat', cursive; }

/* ── Keyframes ── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes pulse {
  0%, 100% { transform: scale(1);    opacity: 1; }
  50%       { transform: scale(1.08); opacity: 0.75; }
}

@keyframes pulseDot {
  0%, 100% { transform: scale(0.8); opacity: 0.4; }
  50%       { transform: scale(1.2); opacity: 1; }
}

@keyframes cardEntrance {
  from { opacity: 0; transform: translateY(24px) rotate(var(--rot, 0deg)); }
  to   { opacity: 1; transform: translateY(0)    rotate(var(--rot, 0deg)); }
}

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

@keyframes micPulse {
  0%   { box-shadow: 0 0 0 0   rgba(139,105,20,0.4); }
  70%  { box-shadow: 0 0 0 20px rgba(139,105,20,0); }
  100% { box-shadow: 0 0 0 0   rgba(139,105,20,0); }
}

@keyframes pulseRing {
  0%   { transform: scale(1);   opacity: 0.8; }
  100% { transform: scale(1.7); opacity: 0; }
}

@keyframes typingBounce {
  0%, 80%, 100% { transform: translateY(0); }
  40%           { transform: translateY(-6px); }
}

/* ================================================================
   SCREENS — full-viewport layers
   ================================================================ */
.screen {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: none;
  flex-direction: column;
  background: var(--bg);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition), transform var(--transition);
  transform: translateX(24px);
  z-index: 10;
}

.screen.active {
  display: flex;
  opacity: 1;
  pointer-events: auto;
  transform: translateX(0);
}

/* ── Splash Screen ── */
#splash-screen {
  background: linear-gradient(160deg, #FFF8F0 0%, #FFE8F0 60%, #FFF0D8 100%);
  align-items: center;
  justify-content: center;
  gap: 24px;
  z-index: 50;
}

.splash-logo {
  font-family: 'Caveat', cursive;
  font-size: 48px;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: -1px;
  animation: fadeInUp 0.8s ease both;
}

.splash-tagline {
  font-size: 15px;
  color: var(--muted);
  font-weight: 400;
  animation: fadeInUp 0.8s 0.25s ease both;
}

.splash-dots {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  animation: fadeInUp 0.8s 0.45s ease both;
}

.splash-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulseDot 1.2s ease-in-out infinite;
}
.splash-dot:nth-child(2) { animation-delay: 0.2s; }
.splash-dot:nth-child(3) { animation-delay: 0.4s; }

/* ── Onboarding Screen ── */
#onboarding-screen {
  overflow: hidden;
  z-index: 40;
}

.onboarding-viewport {
  flex: 1;
  position: relative;
  overflow: hidden;
}

.onboarding-slide {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 32px;
  text-align: center;
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.ob-icon {
  font-size: 72px;
  margin-bottom: 28px;
  animation: fadeInUp 0.5s ease both;
}

.ob-title {
  font-family: 'Caveat', cursive;
  font-size: 32px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 12px;
}

.ob-body {
  font-size: 15px;
  color: var(--muted);
  line-height: 1.6;
  max-width: 280px;
}

.onboarding-footer {
  padding: 20px 24px 40px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
}

.ob-dots {
  display: flex;
  gap: 6px;
  margin-bottom: 4px;
}

.ob-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--border);
  transition: background var(--transition), transform var(--transition);
}
.ob-dot.active {
  background: var(--primary);
  transform: scale(1.4);
}

.btn-primary {
  width: 100%;
  max-width: 320px;
  padding: 16px;
  background: var(--primary);
  color: #fff;
  border-radius: var(--radius-lg);
  font-size: 16px;
  font-weight: 600;
  transition: opacity 0.2s, transform 0.15s;
}
.btn-primary:active { transform: scale(0.97); opacity: 0.9; }

.btn-ghost {
  font-size: 14px;
  color: var(--muted);
  padding: 8px 16px;
}

/* ================================================================
   APP SHELL (#app-screen)
   ================================================================ */
#app-screen {
  display: flex;
  flex-direction: column;
  transform: none;
  opacity: 1;
  pointer-events: none;
  z-index: 20;
}
#app-screen.active { pointer-events: auto; }

/* ── Header ── */
#app-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--bg);
  padding: 14px 20px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  min-height: var(--header-h);
  flex-shrink: 0;
}

.header-left { display: flex; flex-direction: column; gap: 2px; }

#header-greeting {
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.2;
}

#header-date {
  font-size: 12px;
  color: var(--muted);
  font-weight: 400;
}

#header-streak {
  background: linear-gradient(135deg, #FFF0D8, #FFE0A8);
  border: 1px solid rgba(139,105,20,0.2);
  border-radius: 20px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
}

/* ── Main area ── */
#app-main {
  flex: 1;
  position: relative;
  overflow: hidden;
  margin-bottom: var(--nav-h);
}

/* ── Bottom Nav ── */
#bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--nav-h);
  background: var(--card);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 0 8px;
  padding-bottom: env(safe-area-inset-bottom, 0);
  z-index: 9999;
  box-shadow: 0 -2px 12px rgba(139,105,20,0.08);
  touch-action: manipulation;
}

.nav-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 10px 4px;
  min-height: 48px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  transition: color var(--transition);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  border: none;
  background: none;
  position: relative;
  z-index: 1;
}
.nav-tab .nav-icon { font-size: 20px; line-height: 1; }
.nav-tab.active { color: var(--primary); }

/* Center capture button */
.nav-tab.capture-tab {
  position: relative;
  margin-top: -20px;
}

.capture-btn {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 28px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(139,105,20,0.4);
  transition: transform 0.15s, box-shadow 0.15s;
}
.capture-btn:active { transform: scale(0.93); box-shadow: 0 2px 8px rgba(139,105,20,0.3); }

/* ================================================================
   PANELS
   ================================================================ */
.panel {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
  transform: translateY(8px);
  background: var(--bg);
}

.panel.active {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
  z-index: 1;
}

/* ── Overlay panels ── */
.panel.overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  top: auto;
  height: 92vh;
  transform: translateY(100%);
  transition: opacity 0.32s cubic-bezier(0.4, 0, 0.2, 1), transform 0.32s cubic-bezier(0.4, 0, 0.2, 1);
  background: var(--bg);
  box-shadow: 0 -8px 40px rgba(44,24,16,0.2);
  padding-top: 0;
}

.panel.overlay.active,
.panel.overlay.overlay-visible {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.panel.overlay.overlay-exit {
  transform: translateY(100%);
  opacity: 0;
}

.overlay-backdrop {
  position: fixed;
  inset: 0;
  background: var(--overlay-bg);
  z-index: 59;
  animation: fadeIn 0.25s ease both;
}

.overlay-handle {
  width: 40px;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin: 12px auto 8px;
  flex-shrink: 0;
}

.overlay-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.btn-back {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: var(--text);
  flex-shrink: 0;
}

.overlay-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
}

/* ── Panel enter/exit transitions ── */
.panel-enter {
  animation: panelEnter 0.28s cubic-bezier(0.4, 0, 0.2, 1) both;
}
@keyframes panelEnter {
  from { opacity: 0; transform: translateX(32px); }
  to   { opacity: 1; transform: translateX(0); }
}

.panel-exit {
  animation: panelExit 0.22s cubic-bezier(0.4, 0, 0.2, 1) both;
}
@keyframes panelExit {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(-24px); }
}

/* ================================================================
   SHARED PANEL HEADER / BODY (used by Capsule, Ask, Review, Legacy)
   ================================================================ */
.panel-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 5;
}

.panel-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px;
}

/* ── Shared back button ── */
.back-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: var(--text);
  flex-shrink: 0;
  cursor: pointer;
  transition: background 0.15s;
}
.back-btn:active { background: var(--border); }

/* ── Shared secondary button ── */
.btn-secondary {
  padding: 10px 20px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  background: var(--card);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.btn-secondary:active { background: var(--border); }

/* ── Shared muted text ── */
.muted { color: var(--muted); }

/* ================================================================
   HOME SCREEN
   ================================================================ */

/* Streak banner */
.streak-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(135deg, #FFF3DC, #FFE8C4);
  border: 1px solid rgba(139,105,20,0.18);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  margin-bottom: 20px;
  cursor: default;
  animation: fadeInUp 0.4s ease both;
}

.streak-flame {
  font-size: 26px;
  line-height: 1;
  flex-shrink: 0;
}

.streak-text {
  font-size: 15px;
  font-weight: 600;
  color: var(--primary);
  line-height: 1.2;
}

.streak-sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 1px;
}

/* Today in your past */
.today-past {
  margin-bottom: 24px;
}

/* Section titles */
.section-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Horizontal scroll strip */
.horizontal-scroll {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 6px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  margin-bottom: 24px;
}
.horizontal-scroll::-webkit-scrollbar { display: none; }

/* ── Polaroid Grid (2-column masonry) ── */
.polaroid-grid {
  columns: 2;
  column-gap: 12px;
  padding-bottom: 16px;
}

/* ── Polaroid card ── */
.polaroid {
  break-inside: avoid;
  background: var(--card);
  padding: 8px 8px 36px;
  border-radius: 2px;
  box-shadow: var(--card-shadow);
  margin-bottom: 12px;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  animation: cardEntrance 0.4s ease both;
  position: relative;
  /* slight rotation for authentic Polaroid feel */
  --rot: 0deg;
  transform: rotate(var(--rot));
}
.polaroid:nth-child(odd)  { --rot: -1deg; }
.polaroid:nth-child(even) { --rot:  0.8deg; }
.polaroid:active {
  transform: rotate(0deg) scale(1.02);
  box-shadow: 0 10px 30px rgba(139,105,20,0.25);
  z-index: 2;
}

.polaroid-photo {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
  display: block;
  background: var(--border);
}

.polaroid-placeholder {
  width: 100%;
  aspect-ratio: 4/3;
  background: linear-gradient(135deg, #F5EDE0, #EADAC8);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  color: var(--muted);
}

.polaroid-body {
  padding-top: 8px;
}

.polaroid-caption {
  font-family: 'Caveat', cursive;
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.polaroid-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  flex-wrap: wrap;
}

.polaroid-date {
  font-size: 10px;
  color: var(--muted);
  font-weight: 400;
  flex-shrink: 0;
}

.polaroid-emotions {
  display: flex;
  gap: 3px;
  flex-wrap: wrap;
  flex: 1;
  min-width: 0;
}

.emotion-badge {
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 10px;
  background: #FFF0D8;
  color: var(--primary);
  font-weight: 500;
  white-space: nowrap;
}

/* ── Mini Polaroid (horizontal scroll card) ── */
.mini-polaroid {
  flex-shrink: 0;
  width: 130px;
  background: var(--card);
  padding: 6px 6px 28px;
  border-radius: 2px;
  box-shadow: var(--card-shadow);
  cursor: pointer;
  transition: transform 0.18s ease;
  animation: fadeInUp 0.35s ease both;
}
.mini-polaroid:active { transform: scale(0.97); }

.mini-polaroid-photo {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
  display: block;
  background: var(--border);
}

.mini-polaroid-placeholder {
  width: 100%;
  aspect-ratio: 4/3;
  background: linear-gradient(135deg, #F5EDE0, #EADAC8);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}

.mini-polaroid-body {
  padding-top: 6px;
}

.mini-polaroid-caption {
  font-family: 'Caveat', cursive;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.2;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.mini-polaroid-date {
  font-size: 10px;
  color: var(--muted);
  margin-top: 3px;
}

/* ── Empty state ── */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.empty-icon  { font-size: 52px; opacity: 0.45; }
.empty-text  { font-size: 17px; font-weight: 600; color: var(--text); }
.empty-sub   { font-size: 14px; color: var(--muted); line-height: 1.55; }

/* ================================================================
   SEARCH SCREEN
   ================================================================ */
.search-header {
  padding: 12px 16px 0;
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 5;
}

.search-input {
  width: 100%;
  padding: 12px 16px 12px 40px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 15px;
  background: var(--card);
  color: var(--text);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23A89274' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='M21 21l-4.35-4.35'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 12px center;
}
.search-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(139,105,20,0.1);
}
.search-input::placeholder { color: var(--muted); }

.filter-chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 12px 0 4px;
  scrollbar-width: none;
}
.filter-chips::-webkit-scrollbar { display: none; }

.chip {
  flex-shrink: 0;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  border: 1.5px solid var(--border);
  background: var(--card);
  color: var(--muted);
  cursor: pointer;
  transition: all 0.18s;
}
.chip.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

/* Results mini-grid */
.mini-grid {
  columns: 2;
  column-gap: 10px;
  padding: 12px 0 16px;
}

.result-card {
  break-inside: avoid;
  background: var(--card);
  border-radius: var(--radius-sm);
  overflow: hidden;
  box-shadow: var(--card-shadow);
  margin-bottom: 10px;
  cursor: pointer;
  transition: transform 0.18s;
  animation: fadeInUp 0.3s ease both;
}
.result-card:active { transform: scale(0.98); }

.result-thumb {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
  background: var(--border);
  display: block;
}

.result-thumb-placeholder {
  width: 100%;
  aspect-ratio: 4/3;
  background: linear-gradient(135deg, #F5EDE0, #EADAC8);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}

.result-body {
  padding: 8px 10px 10px;
}

.result-caption {
  font-family: 'Caveat', cursive;
  font-size: 15px;
  color: var(--text);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.result-date {
  font-size: 10px;
  color: var(--muted);
  margin-top: 4px;
}

/* People row in search */
.people-row {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding: 4px 0 12px;
  scrollbar-width: none;
}
.people-row::-webkit-scrollbar { display: none; }

.person-avatar-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
  cursor: pointer;
}

.person-avatar {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #F0C0D8);
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 600;
  color: var(--primary);
  overflow: hidden;
  object-fit: cover;
  transition: border-color 0.2s;
}
.person-avatar-wrap:active .person-avatar { border-color: var(--primary); }

.person-name {
  font-size: 11px;
  color: var(--muted);
  font-weight: 500;
  text-align: center;
  max-width: 60px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ================================================================
   DETAIL SCREEN
   ================================================================ */
.detail-container {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.detail-back {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 10;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255,255,255,0.88);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255,255,255,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: var(--text);
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(44,24,16,0.15);
  transition: background 0.15s;
}
.detail-back:active { background: rgba(255,255,255,0.98); }

.detail-hero-wrap {
  position: relative;
  width: 100%;
  max-height: 58vh;
  overflow: hidden;
  flex-shrink: 0;
  background: #F0E4D0;
}

.detail-hero {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.detail-hero-placeholder {
  width: 100%;
  min-height: 260px;
  background: linear-gradient(160deg, #F5EDE0, #EDD5C0);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 64px;
}

.detail-body {
  padding: 20px 20px 40px;
  background: var(--bg);
  flex: 1;
}

.detail-caption {
  font-family: 'Caveat', cursive;
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
  margin-bottom: 8px;
}

.detail-date {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.detail-location {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.detail-emotions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.emotion-pill {
  padding: 5px 12px;
  border-radius: 20px;
  border: 1.5px solid var(--border);
  background: var(--card);
  font-size: 13px;
  color: var(--text);
  font-weight: 500;
}

.detail-people {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.person-tag {
  padding: 5px 12px;
  border-radius: 20px;
  background: linear-gradient(135deg, #FFF0D8, #FFE4B8);
  border: 1px solid rgba(139,105,20,0.2);
  font-size: 13px;
  color: var(--primary);
  font-weight: 500;
}

.detail-section {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.detail-section-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--muted);
  margin-bottom: 8px;
}

.detail-transcript {
  font-size: 14px;
  color: var(--text);
  line-height: 1.65;
  background: var(--card);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  border: 1px solid var(--border);
}

.detail-audio {
  width: 100%;
  margin-top: 8px;
  border-radius: var(--radius-sm);
  accent-color: var(--primary);
}

.detail-delete {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 13px;
  margin-top: 28px;
  border-radius: var(--radius-lg);
  border: 1.5px solid #FFCDD2;
  background: #FFF5F5;
  color: #C62828;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.detail-delete:active { background: #FFEBEE; }

/* Related cards */
.related-card {
  flex-shrink: 0;
  width: 110px;
  background: var(--card);
  padding: 5px 5px 24px;
  border-radius: 2px;
  box-shadow: var(--card-shadow);
  cursor: pointer;
  transition: transform 0.18s;
}
.related-card:active { transform: scale(0.97); }

.related-thumb {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  display: block;
  background: var(--border);
}

.related-thumb-placeholder {
  width: 100%;
  aspect-ratio: 1;
  background: linear-gradient(135deg, #F5EDE0, #EADAC8);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.related-caption {
  font-family: 'Caveat', cursive;
  font-size: 13px;
  color: var(--text);
  margin-top: 5px;
  line-height: 1.2;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ================================================================
   CAPTURE SCREEN
   ================================================================ */
.capture-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.capture-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--bg);
}

.capture-close {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--bg);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s;
  flex-shrink: 0;
}
.capture-close:active { background: var(--border); }

.capture-title {
  font-family: 'Caveat', cursive;
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  flex: 1;
}

/* Mode toggle buttons */
.capture-modes {
  display: flex;
  gap: 8px;
  padding: 14px 16px 10px;
  flex-shrink: 0;
}

.mode-btn {
  flex: 1;
  padding: 9px 8px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--card);
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.18s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}
.mode-btn.active {
  border-color: var(--primary);
  background: linear-gradient(135deg, #FFF3DC, #FFE8C4);
  color: var(--primary);
  font-weight: 600;
}

/* Form sections */
.capture-section {
  padding: 14px 0 4px;
  border-top: 1px solid var(--border);
  margin-top: 8px;
}
.capture-section:first-child { border-top: none; margin-top: 0; }

/* Photo upload */
.photo-upload-label {
  display: block;
  cursor: pointer;
  width: 100%;
}

.photo-preview-box {
  width: 100%;
  aspect-ratio: 4/3;
  background: linear-gradient(135deg, #F8F0E8, #F0E0D0);
  border: 2px dashed var(--border);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  overflow: hidden;
  position: relative;
  transition: border-color 0.2s, background 0.2s;
}
.photo-preview-box:hover { border-color: var(--primary); background: #FFF5E8; }

.photo-upload-icon {
  font-size: 40px;
  line-height: 1;
  opacity: 0.5;
}

.photo-upload-hint {
  font-size: 13px;
  color: var(--muted);
  text-align: center;
  font-weight: 500;
}

/* Form inputs */
.cap-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.cap-input {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 15px;
  color: var(--text);
  background: var(--card);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.cap-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(139,105,20,0.1);
}
.cap-input::placeholder { color: var(--muted); }

.cap-textarea {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 15px;
  color: var(--text);
  background: var(--card);
  outline: none;
  resize: none;
  min-height: 100px;
  line-height: 1.55;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.cap-textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(139,105,20,0.1);
}
.cap-textarea::placeholder { color: var(--muted); }

/* Emotion picker */
.emotion-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 4px;
}

.emotion-btn {
  padding: 7px 14px;
  border-radius: 20px;
  border: 1.5px solid var(--border);
  background: var(--card);
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
  transition: all 0.18s;
  font-family: inherit;
}
.emotion-btn.active {
  background: linear-gradient(135deg, #FFF0D8, #FFE4B8);
  border-color: var(--primary);
  color: var(--primary);
  font-weight: 600;
}

/* Save button */
.cap-save-btn {
  display: block;
  width: 100%;
  padding: 15px;
  background: var(--primary);
  color: #fff;
  border-radius: var(--radius-lg);
  font-size: 16px;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.15s;
  border: none;
  margin-top: 16px;
}
.cap-save-btn:active { transform: scale(0.97); opacity: 0.9; }

/* ================================================================
   VOICE SCREEN
   ================================================================ */
.voice-shell {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 32px 24px 40px;
  gap: 24px;
  overflow-y: auto;
  min-height: 100%;
}

.voice-title {
  font-family: 'Caveat', cursive;
  font-size: 30px;
  font-weight: 700;
  color: var(--text);
  text-align: center;
}

.voice-hint {
  font-size: 14px;
  color: var(--muted);
  text-align: center;
  line-height: 1.5;
  max-width: 260px;
}

.voice-mic-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 8px 0;
}

.voice-mic-btn {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 24px rgba(139,105,20,0.35);
  transition: transform 0.15s, box-shadow 0.15s;
  cursor: pointer;
  z-index: 1;
  position: relative;
}
.voice-mic-btn:active { transform: scale(0.93); }
.voice-mic-btn.recording { animation: micPulse 1.2s ease-out infinite; }

.voice-pulse-ring {
  position: absolute;
  width: 88px;
  height: 88px;
  border-radius: 50%;
  border: 2px solid var(--primary);
  opacity: 0;
  animation: pulseRing 1.5s ease-out infinite;
}
.voice-pulse-ring:nth-child(2) { animation-delay: 0.5s; }
.voice-pulse-ring:nth-child(3) { animation-delay: 1s; }

.voice-timer {
  font-family: 'Courier New', Courier, monospace;
  font-size: 32px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 3px;
}

.voice-canvas {
  width: 100%;
  max-width: 300px;
  height: 64px;
  border-radius: var(--radius-sm);
  background: var(--card);
  border: 1px solid var(--border);
  display: block;
}

.voice-done-block {
  width: 100%;
  max-width: 340px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  animation: fadeInUp 0.35s ease both;
}

.voice-playback {
  width: 100%;
  border-radius: var(--radius-sm);
  accent-color: var(--primary);
}

.voice-transcript-block {
  background: var(--card);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  padding: 12px 14px;
}

.voice-transcript-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
  margin-bottom: 6px;
}

.voice-transcript-text {
  font-size: 14px;
  color: var(--text);
  line-height: 1.6;
}

.voice-caption-input {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 15px;
  color: var(--text);
  background: var(--card);
  outline: none;
  transition: border-color 0.2s;
}
.voice-caption-input:focus { border-color: var(--primary); }
.voice-caption-input::placeholder { color: var(--muted); }

.voice-emotion-tag {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.voice-save-btn {
  display: block;
  width: 100%;
  padding: 15px;
  background: var(--primary);
  color: #fff;
  border-radius: var(--radius-lg);
  font-size: 16px;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.15s;
  border: none;
}
.voice-save-btn:active { transform: scale(0.97); opacity: 0.9; }

/* ================================================================
   TIMELINE SCREEN
   ================================================================ */
.tl-shell {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--bg);
}

.tl-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--bg);
}

.tl-title {
  font-family: 'Caveat', cursive;
  font-size: 26px;
  font-weight: 700;
  color: var(--text);
  flex: 1;
}

.tl-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 20px 16px 40px;
  position: relative;
}

/* Vertical line */
.tl-line {
  position: absolute;
  left: 36px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(to bottom, transparent, var(--border) 60px, var(--border) calc(100% - 60px), transparent);
  z-index: 0;
}

.tl-year-block {
  margin-bottom: 32px;
  position: relative;
  z-index: 1;
}

.tl-year-marker {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  padding-left: 16px;
}

.tl-year-num {
  font-family: 'Caveat', cursive;
  font-size: 28px;
  font-weight: 700;
  color: var(--primary);
  background: var(--bg);
  padding: 0 8px;
  position: relative;
  z-index: 1;
}

.tl-year-summary {
  font-size: 12px;
  color: var(--muted);
  font-weight: 400;
}

.tl-month-marker {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 4px 0 8px 52px;
}

.tl-node {
  display: flex;
  align-items: flex-start;
  gap: 0;
  margin-bottom: 14px;
  position: relative;
}

.tl-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--primary);
  border: 3px solid var(--bg);
  box-shadow: 0 0 0 1px var(--primary);
  flex-shrink: 0;
  position: relative;
  z-index: 2;
  margin-top: 18px;
  margin-left: 30px;
}

.tl-connector {
  width: 20px;
  height: 2px;
  background: var(--border);
  flex-shrink: 0;
  align-self: flex-start;
  margin-top: 24px;
}

.tl-card {
  flex: 1;
  background: var(--card);
  border-radius: var(--radius-sm);
  overflow: hidden;
  box-shadow: var(--card-shadow);
  cursor: pointer;
  transition: transform 0.18s, box-shadow 0.18s;
  animation: fadeInUp 0.35s ease both;
  display: flex;
  gap: 0;
  min-width: 0;
}
.tl-card:active {
  transform: scale(0.98);
  box-shadow: 0 6px 24px rgba(139,105,20,0.2);
}

.tl-card-img {
  width: 80px;
  min-height: 70px;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--border);
}

.tl-card-placeholder {
  width: 80px;
  min-height: 70px;
  background: linear-gradient(135deg, #F5EDE0, #EADAC8);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
}

.tl-card-body {
  padding: 10px 12px;
  flex: 1;
  min-width: 0;
}

.tl-card-caption {
  font-family: 'Caveat', cursive;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.tl-card-date {
  font-size: 11px;
  color: var(--muted);
  margin-top: 4px;
}

.tl-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 64px 32px;
  text-align: center;
  gap: 10px;
}

/* ================================================================
   SETTINGS SCREEN
   ================================================================ */
.settings-shell {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--bg);
}

.settings-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--bg);
}

.settings-title {
  font-family: 'Caveat', cursive;
  font-size: 26px;
  font-weight: 700;
  color: var(--text);
  flex: 1;
}

.settings-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 20px 16px 40px;
}

/* Profile section */
.settings-profile-section {
  background: var(--card);
  border-radius: var(--radius-md);
  box-shadow: var(--card-shadow);
  padding: 24px 20px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
}

.settings-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #F0C0D8);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  font-weight: 700;
  color: var(--primary);
  position: relative;
  border: 3px solid var(--bg);
  box-shadow: 0 4px 12px rgba(139,105,20,0.2);
  cursor: pointer;
}

.avatar-edit-badge {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--bg);
}

.settings-input {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 15px;
  color: var(--text);
  background: var(--bg);
  outline: none;
  transition: border-color 0.2s;
}
.settings-input:focus { border-color: var(--primary); }
.settings-input::placeholder { color: var(--muted); }

.settings-textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  outline: none;
  resize: none;
  min-height: 80px;
  line-height: 1.55;
  transition: border-color 0.2s;
}
.settings-textarea:focus { border-color: var(--primary); }
.settings-textarea::placeholder { color: var(--muted); }

.settings-save-btn {
  padding: 11px 28px;
  background: var(--primary);
  color: #fff;
  border-radius: var(--radius-lg);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.15s;
  border: none;
  align-self: flex-end;
}
.settings-save-btn:active { transform: scale(0.97); opacity: 0.9; }

/* Settings sections */
.settings-section {
  background: var(--card);
  border-radius: var(--radius-md);
  box-shadow: var(--card-shadow);
  overflow: hidden;
  margin-bottom: 20px;
}

.settings-section-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  padding: 12px 16px 8px;
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 16px;
  border-top: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s;
}
.settings-row:first-of-type { border-top: none; }
.settings-row:active { background: var(--bg); }

.settings-row-label {
  font-size: 15px;
  color: var(--text);
  font-weight: 500;
  flex: 1;
}

.settings-row-value {
  font-size: 13px;
  color: var(--muted);
  margin-right: 6px;
}

.settings-row-chevron {
  font-size: 16px;
  color: var(--muted);
  flex-shrink: 0;
}

/* Toggle switch */
.toggle-track {
  width: 46px;
  height: 26px;
  border-radius: 13px;
  background: var(--border);
  position: relative;
  transition: background 0.25s;
  flex-shrink: 0;
  cursor: pointer;
}
.toggle-track.on { background: var(--primary); }

.toggle-thumb {
  position: absolute;
  left: 3px;
  top: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.18);
  transition: transform 0.25s;
}
.toggle-track.on .toggle-thumb { transform: translateX(20px); }

/* Storage bar */
.settings-storage-bar-wrap {
  padding: 12px 16px 16px;
  border-top: 1px solid var(--border);
}

.settings-storage-bar {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 8px;
}
.settings-storage-bar::after {
  content: '';
  display: block;
  height: 100%;
  width: var(--fill, 40%);
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 3px;
  transition: width 0.6s ease;
}

/* Danger rows */
.danger-row {
  border-top: 1px solid rgba(198,40,40,0.15);
  background: #FFF5F5;
  transition: background 0.15s;
}
.danger-row:active { background: #FFEBEE; }

.danger-label {
  color: #C62828 !important;
  font-size: 15px;
  font-weight: 500;
}

/* Link row */
.link-row {
  cursor: pointer;
  transition: background 0.15s;
}
.link-row:active { background: var(--bg); }

/* ================================================================
   PEOPLE SCREEN
   ================================================================ */
.people-shell {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--bg);
}

.people-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--bg);
}

.people-back-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: var(--text);
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s;
}
.people-back-btn:active { background: var(--border); }

.people-title {
  font-family: 'Caveat', cursive;
  font-size: 26px;
  font-weight: 700;
  color: var(--text);
  flex: 1;
}

.people-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  padding: 16px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  flex: 1;
}

.person-card {
  background: var(--card);
  border-radius: var(--radius-md);
  box-shadow: var(--card-shadow);
  padding: 18px 10px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: transform 0.18s, box-shadow 0.18s;
  animation: fadeInUp 0.35s ease both;
}
.person-card:active {
  transform: scale(0.96);
  box-shadow: 0 2px 8px rgba(139,105,20,0.12);
}

.person-avatar-init {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #F0C0D8);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 700;
  color: var(--primary);
  border: 2px solid rgba(139,105,20,0.12);
}

.person-count {
  font-size: 11px;
  color: var(--muted);
  font-weight: 400;
}

/* Selected person header */
.people-header-person {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 28px 16px 20px;
  background: linear-gradient(160deg, #FFF8F0, #FFE8F4);
  border-bottom: 1px solid var(--border);
  gap: 10px;
  flex-shrink: 0;
}

.people-person-hero {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #F0C0D8);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 34px;
  font-weight: 700;
  color: var(--primary);
  border: 3px solid var(--bg);
  box-shadow: 0 4px 16px rgba(139,105,20,0.2);
}

.people-person-name {
  font-family: 'Caveat', cursive;
  font-size: 26px;
  font-weight: 700;
  color: var(--text);
}

/* Person memories grid */
.pm-grid {
  columns: 2;
  column-gap: 10px;
  padding: 14px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  flex: 1;
}

.pm-card {
  break-inside: avoid;
  background: var(--card);
  padding: 6px 6px 28px;
  border-radius: 2px;
  box-shadow: var(--card-shadow);
  margin-bottom: 10px;
  cursor: pointer;
  transition: transform 0.18s;
  animation: cardEntrance 0.35s ease both;
}
.pm-card:active { transform: scale(0.98); }

.pm-card-img {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
  display: block;
  background: var(--border);
}

.pm-card-placeholder {
  width: 100%;
  aspect-ratio: 4/3;
  background: linear-gradient(135deg, #F5EDE0, #EADAC8);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
}

.pm-card-body {
  padding-top: 6px;
}

.pm-card-caption {
  font-family: 'Caveat', cursive;
  font-size: 15px;
  color: var(--text);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.pm-card-date {
  font-size: 10px;
  color: var(--muted);
  margin-top: 3px;
}

.pm-empty,
.people-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 32px;
  text-align: center;
  gap: 10px;
}

/* ================================================================
   CAPSULE SCREEN
   ================================================================ */

/* Cap cards */
.cap-card {
  background: var(--card);
  border-radius: var(--radius-md);
  box-shadow: var(--card-shadow);
  padding: 16px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 12px;
  cursor: pointer;
  transition: transform 0.18s, box-shadow 0.18s;
  animation: fadeInUp 0.35s ease both;
  border: 1.5px solid transparent;
}
.cap-card:active { transform: scale(0.98); }
.cap-card.ready {
  border-color: rgba(139,105,20,0.3);
  background: linear-gradient(135deg, #FFFBF0, #FFF5DC);
}

.cap-icon {
  font-size: 36px;
  line-height: 1;
  flex-shrink: 0;
}

.cap-info {
  flex: 1;
  min-width: 0;
}

.cap-name {
  font-family: 'Caveat', cursive;
  font-size: 19px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}

.cap-date-line {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

.cap-countdown {
  font-size: 12px;
  color: var(--primary);
  font-weight: 500;
  margin-top: 4px;
}

.cap-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 12px;
  flex-shrink: 0;
  align-self: flex-start;
}
.cap-badge.sealed {
  background: #F5EDE0;
  color: var(--muted);
}
.cap-badge.ready {
  background: #FFF0D8;
  color: var(--primary);
}

.cap-open-btn {
  display: block;
  width: 100%;
  padding: 11px;
  background: var(--primary);
  color: #fff;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  border: none;
  margin-top: 10px;
  transition: opacity 0.2s, transform 0.15s;
}
.cap-open-btn:active { transform: scale(0.97); opacity: 0.9; }

/* New capsule form */
.cap-form {
  background: var(--card);
  border-radius: var(--radius-md);
  box-shadow: var(--card-shadow);
  padding: 20px;
  margin-top: 8px;
}

.cap-form-title {
  font-family: 'Caveat', cursive;
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 16px;
}

.field-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.input-field {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 15px;
  color: var(--text);
  background: var(--bg);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  margin-bottom: 14px;
}
.input-field:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(139,105,20,0.1);
}
.input-field::placeholder { color: var(--muted); }

/* Memory picker */
.cap-mem-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 8px 0;
  max-height: 220px;
  overflow-y: auto;
}

.cap-mem-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.18s;
  background: var(--bg);
}
.cap-mem-item.selected {
  border-color: var(--primary);
  background: linear-gradient(135deg, #FFF8EC, #FFF0D8);
}

.cap-mem-check {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 11px;
  transition: all 0.18s;
}
.cap-mem-item.selected .cap-mem-check {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.cap-mem-thumb {
  width: 40px;
  height: 40px;
  border-radius: 4px;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--border);
}

.cap-mem-pill {
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 10px;
  background: #FFF0D8;
  color: var(--primary);
  font-weight: 500;
}

.cap-mem-pills {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.cap-mem-caption {
  flex: 1;
  min-width: 0;
}
.cap-mem-caption strong {
  display: block;
  font-size: 13px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cap-mem-caption span {
  font-size: 11px;
  color: var(--muted);
}

/* Form buttons */
.cap-form-btns {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}
.cap-form-btns .btn-secondary { flex: 1; text-align: center; }
.cap-form-btns .btn-primary   { flex: 2; text-align: center; padding: 12px; }

.cap-empty-mem {
  text-align: center;
  padding: 28px 16px;
  color: var(--muted);
  font-size: 14px;
}

.cap-memories-reveal {
  animation: fadeInUp 0.35s ease both;
}

/* ================================================================
   LEGACY SCREEN
   ================================================================ */
.leg-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 5;
}

.leg-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 20px 16px 40px;
}

/* Intro (pre-activation) */
.leg-intro {
  background: linear-gradient(160deg, #2C1810, #4A2C1A);
  border-radius: var(--radius-md);
  padding: 32px 24px;
  color: #fff;
  text-align: center;
  margin-bottom: 20px;
  animation: fadeInUp 0.4s ease both;
}

.leg-crest {
  font-size: 56px;
  margin-bottom: 16px;
  line-height: 1;
}

.leg-intro-title {
  font-family: 'Caveat', cursive;
  font-size: 28px;
  font-weight: 700;
  color: #FFD9A0;
  margin-bottom: 10px;
}

.leg-intro-text {
  font-size: 14px;
  line-height: 1.65;
  opacity: 0.85;
  margin-bottom: 14px;
}

.leg-intro-note {
  font-size: 12px;
  opacity: 0.6;
  font-style: italic;
  margin-top: 8px;
}

.leg-activate-btn {
  padding: 13px 28px;
  background: rgba(255,255,255,0.18);
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: var(--radius-lg);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  width: 100%;
  margin-top: 6px;
}
.leg-activate-btn:active { background: rgba(255,255,255,0.28); }

.leg-active-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  background: #E8F5E9;
  color: #2E7D32;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 16px;
}

/* Sections */
.leg-section {
  background: var(--card);
  border-radius: var(--radius-md);
  box-shadow: var(--card-shadow);
  padding: 20px;
  margin-bottom: 16px;
}

.leg-section-title {
  font-family: 'Caveat', cursive;
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
}

.leg-section-desc {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
  margin-bottom: 14px;
}

/* Stats row */
.leg-stats {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}

.leg-stat {
  flex: 1;
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 14px 10px;
  text-align: center;
  border: 1px solid var(--border);
}

.leg-stat-num {
  font-family: 'Caveat', cursive;
  font-size: 28px;
  font-weight: 700;
  color: var(--primary);
  line-height: 1.1;
}

.leg-stat-lbl {
  font-size: 11px;
  color: var(--muted);
  font-weight: 500;
  margin-top: 2px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.leg-stat-caption {
  font-size: 11px;
  color: var(--muted);
  margin-top: 4px;
}

/* Keepers */
.leg-keepers-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 14px;
}

.leg-keeper-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  animation: fadeInUp 0.3s ease both;
}

.leg-keeper-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #F0C0D8);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
  color: var(--primary);
  flex-shrink: 0;
}

.leg-keeper-info {
  flex: 1;
  min-width: 0;
}

.leg-keeper-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.leg-keeper-email {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.leg-keeper-remove {
  font-size: 18px;
  color: var(--muted);
  cursor: pointer;
  padding: 4px;
  flex-shrink: 0;
  transition: color 0.15s;
}
.leg-keeper-remove:active { color: #C62828; }

.leg-no-keepers {
  text-align: center;
  padding: 24px 16px;
  color: var(--muted);
  font-size: 14px;
}

/* Add keeper form */
.leg-add-keeper {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
}

.leg-input-half {
  display: flex;
  gap: 10px;
}
.leg-input-half .input-field {
  flex: 1;
  margin-bottom: 0;
}

.leg-add-btn {
  padding: 11px 20px;
  background: var(--primary);
  color: #fff;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: opacity 0.2s, transform 0.15s;
  align-self: flex-end;
}
.leg-add-btn:active { transform: scale(0.97); opacity: 0.9; }

.leg-preview-btn {
  display: block;
  width: 100%;
  padding: 12px;
  background: transparent;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  color: var(--primary);
  cursor: pointer;
  text-align: center;
  transition: background 0.15s, border-color 0.15s;
}
.leg-preview-btn:active { background: #FFF0D8; border-color: var(--primary); }

/* Preview modal */
.leg-preview-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: var(--overlay-bg);
  display: flex;
  align-items: flex-end;
  animation: fadeIn 0.25s ease both;
}

.leg-preview-inner {
  background: var(--bg);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 24px 20px 40px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  animation: slideUp 0.32s cubic-bezier(0.4,0,0.2,1) both;
}

.leg-preview-heading {
  font-family: 'Caveat', cursive;
  font-size: 26px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}

.leg-preview-sub {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 16px;
}

.leg-preview-memories {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 8px;
  scrollbar-width: none;
  margin-bottom: 16px;
}
.leg-preview-memories::-webkit-scrollbar { display: none; }

.leg-preview-card {
  flex-shrink: 0;
  width: 120px;
  background: var(--card);
  padding: 5px 5px 24px;
  border-radius: 2px;
  box-shadow: var(--card-shadow);
}

.leg-preview-card-body { padding-top: 6px; }
.leg-preview-card-caption {
  font-family: 'Caveat', cursive;
  font-size: 13px;
  color: var(--text);
  line-height: 1.2;
}
.leg-preview-card-date {
  font-size: 10px;
  color: var(--muted);
  margin-top: 2px;
}

.leg-preview-close {
  display: block;
  width: 100%;
  padding: 12px;
  background: var(--primary);
  color: #fff;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  border: none;
  transition: opacity 0.2s;
}
.leg-preview-close:active { opacity: 0.85; }

/* Deactivate zone */
.leg-deactivate-zone {
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  text-align: center;
}

.leg-deactivate-btn {
  padding: 10px 24px;
  background: transparent;
  border: 1.5px solid #FFCDD2;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  color: #C62828;
  cursor: pointer;
  transition: background 0.15s;
}
.leg-deactivate-btn:active { background: #FFEBEE; }

/* ================================================================
   ASK (AI) SCREEN
   ================================================================ */
.ask-chat-wrap {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ask-welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 32px 24px 16px;
  text-align: center;
  gap: 10px;
  animation: fadeInUp 0.4s ease both;
}

.ask-avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #A07820);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  box-shadow: 0 4px 16px rgba(139,105,20,0.3);
  margin-bottom: 4px;
}

/* Message rows */
.ask-row-ai,
.ask-row-user {
  display: flex;
  gap: 8px;
  animation: fadeInUp 0.25s ease both;
  max-width: 100%;
}

.ask-row-user {
  flex-direction: row-reverse;
}

.ask-bubble {
  max-width: 78%;
  padding: 11px 15px;
  border-radius: 18px;
  font-size: 14px;
  line-height: 1.55;
}

.ask-ai {
  background: var(--card);
  color: var(--text);
  border-bottom-left-radius: 4px;
  box-shadow: var(--card-shadow);
  border: 1px solid var(--border);
}

.ask-user {
  background: var(--primary);
  color: #fff;
  border-bottom-right-radius: 4px;
}

/* Typing indicator */
.ask-typing {
  display: flex;
  gap: 5px;
  padding: 12px 16px;
  background: var(--card);
  border-radius: 18px;
  border-bottom-left-radius: 4px;
  box-shadow: var(--card-shadow);
  border: 1px solid var(--border);
  align-self: flex-start;
  width: fit-content;
}

.ask-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted);
  animation: typingBounce 1.2s ease-in-out infinite;
}
.ask-dot:nth-child(2) { animation-delay: 0.15s; }
.ask-dot:nth-child(3) { animation-delay: 0.3s; }

/* Mini polaroid in chat */
.ask-mini-polaroid {
  background: var(--card);
  padding: 5px 5px 22px;
  border-radius: 2px;
  box-shadow: var(--card-shadow);
  width: 100px;
  flex-shrink: 0;
  cursor: pointer;
}
.ask-mini-polaroid-caption {
  font-family: 'Caveat', cursive;
  font-size: 13px;
  color: var(--text);
  margin-top: 5px;
  line-height: 1.2;
}
.ask-mini-polaroid-date {
  font-size: 10px;
  color: var(--muted);
  margin-top: 2px;
}

/* Suggestion chips */
.ask-chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 8px 16px 4px;
  scrollbar-width: none;
  flex-shrink: 0;
}
.ask-chips::-webkit-scrollbar { display: none; }

.ask-chip {
  flex-shrink: 0;
  padding: 7px 14px;
  border-radius: 20px;
  background: var(--card);
  border: 1.5px solid var(--border);
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  transition: all 0.18s;
  white-space: nowrap;
  font-weight: 500;
}
.ask-chip:active {
  background: linear-gradient(135deg, #FFF3DC, #FFE8C4);
  border-color: var(--primary);
  color: var(--primary);
}

/* Input bar */
.ask-input-bar {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: var(--bg);
  flex-shrink: 0;
}

.ask-input {
  flex: 1;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  font-size: 14px;
  background: var(--card);
  color: var(--text);
  outline: none;
  transition: border-color 0.2s;
}
.ask-input:focus { border-color: var(--primary); }
.ask-input::placeholder { color: var(--muted); }

.ask-send-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  cursor: pointer;
  transition: transform 0.15s, opacity 0.2s;
  border: none;
}
.ask-send-btn:active { transform: scale(0.93); opacity: 0.9; }

.ask-chat-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 0;
}
.ask-chat-list li {
  font-size: 14px;
  color: var(--text);
  line-height: 1.55;
  padding: 4px 0;
  border-bottom: 1px solid var(--border);
}

/* ================================================================
   REVIEW (YEAR IN REVIEW) SCREEN
   ================================================================ */
.rv-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px 16px 48px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.rv-card {
  background: var(--card);
  border-radius: var(--radius-md);
  box-shadow: var(--card-shadow);
  padding: 20px;
  animation: fadeInUp 0.4s ease both;
  overflow: hidden;
}

/* Gradient card variants */
.rv-grad-1 {
  background: linear-gradient(135deg, #FFF3DC, #FFE0A0);
}
.rv-grad-2 {
  background: linear-gradient(135deg, #FFE4F4, #F8D0E8);
}
.rv-grad-3 {
  background: linear-gradient(135deg, #E8F5FF, #D0E8F8);
}

.rv-card-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--primary);
  margin-bottom: 4px;
}

.rv-card-sub {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.4;
  margin-top: 2px;
}

.rv-big-num {
  font-family: 'Caveat', cursive;
  font-size: 64px;
  font-weight: 700;
  color: var(--primary);
  line-height: 1;
  margin: 4px 0;
}

/* Polaroid scroll */
.rv-polaroids {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 6px;
  scrollbar-width: none;
  margin-top: 12px;
}
.rv-polaroids::-webkit-scrollbar { display: none; }

.rv-polaroid {
  flex-shrink: 0;
  width: 110px;
  background: #fff;
  padding: 5px 5px 24px;
  border-radius: 2px;
  box-shadow: var(--card-shadow);
  cursor: pointer;
  transition: transform 0.18s;
}
.rv-polaroid:nth-child(odd)  { transform: rotate(-1.2deg); }
.rv-polaroid:nth-child(even) { transform: rotate(0.8deg); }
.rv-polaroid:active { transform: rotate(0deg) scale(1.03); }

.rv-polaroid-img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  display: block;
  background: var(--border);
}

.rv-polaroid-placeholder {
  width: 100%;
  aspect-ratio: 1;
  background: linear-gradient(135deg, #F5EDE0, #EADAC8);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}

.rv-polaroid-cap {
  font-family: 'Caveat', cursive;
  font-size: 13px;
  color: var(--text);
  margin-top: 5px;
  line-height: 1.2;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.rv-polaroid-date {
  font-size: 10px;
  color: var(--muted);
  margin-top: 2px;
}

/* People row */
.rv-people-row {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
  margin-top: 12px;
}
.rv-people-row::-webkit-scrollbar { display: none; }

.rv-person {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

.rv-person-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #F0C0D8);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 700;
  color: var(--primary);
  border: 2px solid var(--bg);
  box-shadow: 0 2px 8px rgba(139,105,20,0.15);
}

.rv-person-name {
  font-size: 12px;
  color: var(--text);
  font-weight: 500;
  max-width: 60px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rv-person-count {
  font-size: 11px;
  color: var(--muted);
}

/* Places */
.rv-places {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}

.rv-place {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--text);
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
}
.rv-place:last-child { border-bottom: none; }

/* Voice stats */
.rv-voice-wrap {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 8px;
}

.rv-voice-icon {
  font-size: 40px;
  line-height: 1;
}

.rv-voice-num {
  font-family: 'Caveat', cursive;
  font-size: 36px;
  font-weight: 700;
  color: var(--primary);
  line-height: 1;
}

.rv-voice-sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

/* Emotion bars */
.rv-bars {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
}

.rv-bar-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.rv-bar-label {
  font-size: 13px;
  color: var(--text);
  width: 80px;
  flex-shrink: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rv-bar-track {
  flex: 1;
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
}

.rv-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 4px;
  transition: width 0.8s cubic-bezier(0.4,0,0.2,1);
}

.rv-bar-pct {
  font-size: 12px;
  color: var(--muted);
  width: 32px;
  text-align: right;
  flex-shrink: 0;
}

/* Share zone */
.rv-share-zone {
  text-align: center;
  margin-top: 4px;
}

.rv-share-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 12px 28px;
  background: linear-gradient(135deg, var(--primary), #A07820);
  color: #fff;
  border-radius: var(--radius-lg);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  box-shadow: 0 4px 16px rgba(139,105,20,0.3);
  transition: transform 0.15s, box-shadow 0.15s;
}
.rv-share-btn:active {
  transform: scale(0.97);
  box-shadow: 0 2px 8px rgba(139,105,20,0.2);
}

/* Toast */
.rv-toast {
  position: fixed;
  bottom: calc(var(--nav-h) + 20px);
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: var(--text);
  color: #fff;
  padding: 10px 20px;
  border-radius: 24px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 4px 16px rgba(44,24,16,0.3);
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
  white-space: nowrap;
}
.rv-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.rv-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 64px 32px;
  text-align: center;
  gap: 10px;
}

/* ================================================================
   UTILITY CLASSES
   ================================================================ */
.divider {
  height: 1px;
  background: var(--border);
  margin: 16px 0;
}

.text-muted   { color: var(--muted); }
.text-primary { color: var(--primary); }
.fw-600       { font-weight: 600; }
.mt-8         { margin-top: 8px; }
.mt-16        { margin-top: 16px; }
.mb-16        { margin-bottom: 16px; }

.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}
.badge-primary { background: #FFF0D8; color: var(--primary); }
.badge-accent  { background: #FFE8F4; color: #C06090; }

.scroll-x {
  display: flex;
  overflow-x: auto;
  gap: 12px;
  padding-bottom: 4px;
  scrollbar-width: none;
}
.scroll-x::-webkit-scrollbar { display: none; }

/* ================================================================
   SKELETON LOADING PLACEHOLDERS
   ================================================================ */
@keyframes shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position:  200% 0; }
}

.skeleton {
  background: linear-gradient(90deg, #f0e6d3 25%, #faf3e8 50%, #f0e6d3 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: 4px;
}

.skeleton-polaroid {
  width: 100%;
  border-radius: 8px;
  background: #fff;
  padding: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.skeleton-polaroid .skeleton-photo {
  width: 100%;
  height: 180px;
  border-radius: 4px;
}

.skeleton-polaroid .skeleton-text {
  height: 14px;
  width: 80%;
  margin-top: 10px;
  border-radius: 7px;
}

.skeleton-polaroid .skeleton-text-short {
  height: 10px;
  width: 50%;
  margin-top: 6px;
  border-radius: 5px;
}

/* ================================================================
   TOAST NOTIFICATION
   ================================================================ */
.remember-toast {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #3D2B1F;
  color: #FFF8F0;
  padding: 12px 24px;
  border-radius: 24px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 8px 24px rgba(61,43,31,0.3);
  opacity: 0;
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 9999;
  pointer-events: none;
  font-family: 'Inter', sans-serif;
}

.remember-toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.remember-toast .toast-icon {
  margin-right: 8px;
}

/* ================================================================
   ACCESSIBILITY
   ================================================================ */

/* Minimum 44px touch targets */
.nav-tab, .btn-primary, .btn-ghost, .emotion-btn,
.cap-save-btn, .voice-save-btn, .voice-mic-btn {
  min-height: 44px;
  min-width: 44px;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Focus visible for keyboard users */
:focus-visible {
  outline: 2px solid #8B5E3C;
  outline-offset: 2px;
  border-radius: 4px;
}

/* Font sizing utility classes */
body.font-sm { font-size: 14px; }
body.font-md { font-size: 16px; }
body.font-lg { font-size: 18px; }
body.font-xl { font-size: 20px; }

/* ================================================================
   ENHANCED EMPTY STATES
   ================================================================ */
.empty-illustration {
  font-size: 64px;
  margin-bottom: 8px;
  filter: grayscale(0.3);
}

.empty-state .empty-text {
  font-family: 'Caveat', cursive;
  font-size: 22px;
  color: #5C4A38;
  font-weight: 600;
}

.empty-state .empty-sub {
  color: #9B8B7B;
  font-size: 14px;
  max-width: 260px;
  line-height: 1.5;
}

.empty-prompt-btn {
  margin-top: 12px;
  background: #8B5E3C;
  color: #fff;
  border: none;
  padding: 12px 24px;
  border-radius: 24px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.2s;
}

.empty-prompt-btn:hover { background: #7A5132; }

/* ── Trust Badge ───────────────────────────────────────────────── */
.trust-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: rgba(139,94,60,0.06);
  border-radius: 20px;
  font-size: 12px;
  color: #8B5E3C;
  font-weight: 500;
  margin-bottom: 12px;
  width: fit-content;
}

/* ── Daily Prompt Card ─────────────────────────────────────────── */
.daily-prompt-card {
  background: linear-gradient(135deg, #FFF8F0 0%, #FFF3E0 100%);
  border: 1px solid rgba(139,94,60,0.12);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 16px;
}
.prompt-label {
  font-size: 12px;
  font-weight: 600;
  color: #8B5E3C;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}
.prompt-text {
  font-family: 'Caveat', cursive;
  font-size: 22px;
  color: #3D2B1F;
  line-height: 1.3;
  margin-bottom: 14px;
}
.prompt-record-btn {
  background: #8B5E3C;
  color: #fff;
  border: none;
  padding: 10px 20px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.2s, transform 0.1s;
}
.prompt-record-btn:hover { background: #7A5132; }
.prompt-record-btn:active { transform: scale(0.97); }

/* ── On This Day Section ───────────────────────────────────────── */
.on-this-day-section {
  margin-bottom: 16px;
}
.on-this-day-header {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 10px;
}
.on-this-day-sub {
  font-size: 12px;
  color: #9B8B7B;
}

/* ── Privacy Trust Banner (Settings) ───────────────────────────── */
.privacy-trust-banner {
  display: flex;
  gap: 12px;
  padding: 14px;
  background: rgba(139,94,60,0.05);
  border-radius: 12px;
  margin-bottom: 12px;
  align-items: flex-start;
}
.trust-icon {
  font-size: 24px;
  flex-shrink: 0;
  margin-top: 2px;
}
.trust-copy {
  font-size: 13px;
  color: #5C4A38;
  line-height: 1.5;
}
.trust-copy strong {
  color: #3D2B1F;
}

/* ================================================================
   RESPONSIVE BREAKPOINTS
   ================================================================ */

/* Tiny phones */
@media (max-width: 320px) {
  .polaroid-grid  { columns: 1; }
  .mini-grid      { columns: 1; }
  .pm-grid        { columns: 1; }
  .people-grid    { grid-template-columns: repeat(2, 1fr); }
  .splash-logo    { font-size: 40px; }
  .ob-title       { font-size: 28px; }
  .tl-card-img,
  .tl-card-placeholder { width: 60px; }
}

/* Standard phones */
@media (min-width: 360px) {
  .polaroid { padding: 9px 9px 38px; }
  .rv-polaroid { width: 120px; }
}

/* Large phones */
@media (min-width: 390px) {
  .polaroid  { padding: 10px 10px 42px; }
  .mini-polaroid { width: 140px; }
  .person-card { padding: 20px 12px 16px; }
}

/* Max mobile (428px sweet spot) */
@media (min-width: 428px) {
  .polaroid-grid { column-gap: 14px; }
  .mini-grid     { column-gap: 12px; }
}

/* Tablet / wider screens — center content */
@media (min-width: 600px) {
  #app-screen,
  #onboarding-screen,
  #splash-screen {
    max-width: 480px;
    margin: 0 auto;
  }

  #bottom-nav {
    max-width: 480px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
  }

  .panel.overlay {
    max-width: 480px;
    left: 50%;
    transform: translateX(-50%) translateY(100%);
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
  }
  .panel.overlay.overlay-visible {
    transform: translateX(-50%) translateY(0);
  }
  .panel.overlay.overlay-exit {
    transform: translateX(-50%) translateY(100%);
  }

  .people-grid { grid-template-columns: repeat(4, 1fr); }
  .rv-big-num  { font-size: 72px; }
}

/* Desktop */
@media (min-width: 900px) {
  #app-screen,
  #onboarding-screen,
  #splash-screen {
    max-width: 440px;
  }
}

/* ================================================================
   UX PHASE 1 ADDITIONS
   ================================================================ */

/* ── Fix 1: Detail Action Bar ── */
.detail-actions {
  display: flex;
  justify-content: center;
  gap: 24px;
  padding: 20px 0;
  margin: 16px 0;
  border-top: 1px solid rgba(180,160,130,0.2);
  border-bottom: 1px solid rgba(180,160,130,0.2);
}
.detail-action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px 16px;
  border-radius: 12px;
  transition: background 0.2s;
  font-size: 24px;
  min-height: 44px;
  min-width: 44px;
}
.detail-action-btn:hover,
.detail-action-btn:active {
  background: rgba(180,160,130,0.15);
}
.detail-action-btn span {
  font-size: 11px;
  color: #8B7355;
  font-family: inherit;
}
.detail-delete-link {
  display: block;
  text-align: center;
  padding: 16px;
  margin-top: 32px;
  color: #cc6666;
  font-size: 13px;
  background: none;
  border: none;
  cursor: pointer;
  opacity: 0.6;
  transition: opacity 0.2s;
  width: 100%;
  min-height: 44px;
}
.detail-delete-link:hover { opacity: 1; }

/* Toast for detail screen */
.detail-toast {
  position: fixed;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: #3D2B1F;
  color: #fff;
  padding: 10px 20px;
  border-radius: 20px;
  font-size: 14px;
  opacity: 0;
  transition: opacity 0.3s, transform 0.3s;
  z-index: 99999;
  pointer-events: none;
  white-space: nowrap;
}
.detail-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── Fix 2: Active Tab Indicator ── */
#bottom-nav .nav-tab { position: relative; }
#bottom-nav .nav-tab.active {
  color: #C9A959 !important;
  font-weight: 600;
}
#bottom-nav .nav-tab.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 24px;
  height: 3px;
  border-radius: 2px;
  background: #C9A959;
}

/* ── Fix 4: Font Size Picker ── */
.font-size-picker {
  display: flex;
  gap: 8px;
  padding: 8px 16px 16px;
}
.font-size-btn {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  border: 2px solid rgba(180,160,130,0.3);
  background: var(--bg-primary, #FFF8F0);
  cursor: pointer;
  font-family: var(--font-display, 'Inter', sans-serif);
  color: var(--text-primary, #2C1810);
  transition: all 0.2s;
}
.font-size-btn:hover,
.font-size-btn.active {
  border-color: #C9A959;
  background: rgba(201,169,89,0.1);
}
.font-size-btn[data-size="small"]  { font-size: 12px; }
.font-size-btn[data-size="medium"] { font-size: 16px; }
.font-size-btn[data-size="large"]  { font-size: 20px; }
.font-size-btn[data-size="xlarge"] { font-size: 24px; }

body.font-small  { font-size: 13px; }
body.font-medium { font-size: 16px; }
body.font-large  { font-size: 19px; }
body.font-xlarge { font-size: 22px; }
body.font-large .memory-title, body.font-xlarge .memory-title { font-size: 1.3em; }
body.font-large .memory-desc,  body.font-xlarge .memory-desc  { font-size: 1.1em; }
body.font-large .polaroid-caption, body.font-xlarge .polaroid-caption { font-size: 1.15em; }

/* ── Fix 5: 44px Touch Targets ── */
button, a, .mood-tag, [role="button"] {
  min-height: 44px;
}
#bottom-nav .nav-tab { padding: 8px 12px; }
.back-btn, .close-btn {
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}
/* Capture tab: don't override its special sizing */
.nav-tab.capture-tab { min-height: unset; }

/* ── Fix 6: Trust Badge — already styled; no override needed ── */

/* ── Fix 4: Settings font size section ── */
.settings-font-section {
  background: #fff;
  margin-bottom: 8px;
}
.settings-font-section .settings-section-title {
  padding: 14px 20px 6px;
  font-size: 12px;
  font-weight: 700;
  color: #B8A898;
  letter-spacing: 0.8px;
  text-transform: uppercase;
}

/* ================================================================
   UX PHASE 2 ADDITIONS
   ================================================================ */

/* ── Onboarding: pill dot active state ── */
.ob-dot.active {
  background: var(--primary);
  width: 20px;
  border-radius: 3px;
  transform: none;
}

/* ── Ask Remember: updated disclaimer & starters ── */
.ask-disclaimer {
  padding: 10px 16px;
  margin: 8px 16px;
  border-radius: 10px;
  background: rgba(180,160,130,0.1);
  border: 1px solid rgba(180,160,130,0.2);
  font-size: 12px;
  color: var(--muted, #8B7355);
  line-height: 1.5;
}
.ask-starters {
  padding: 24px 16px;
  text-align: center;
}
.ask-starters p {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 16px;
}
.ask-starter-btn {
  display: block;
  width: 100%;
  padding: 12px 16px;
  margin-bottom: 8px;
  border-radius: 12px;
  border: 1px solid rgba(180,160,130,0.25);
  background: rgba(180,160,130,0.08);
  cursor: pointer;
  font-size: 14px;
  color: var(--text, #3B2F1E);
  text-align: left;
  font-family: inherit;
  transition: all 0.2s;
}
.ask-starter-btn:hover { background: rgba(180,160,130,0.15); }

/* ── Timeline card meta ── */
.tl-card-meta { padding: 6px 10px; }
.tl-card-snippet {
  font-size: 12px;
  color: var(--muted);
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 200px;
}
.tl-card-moods { font-size: 14px; margin-top: 4px; }

/* ── Daily Prompt card ── */
.daily-prompt {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  margin: 12px 16px;
  border-radius: 14px;
  cursor: pointer;
  background: linear-gradient(135deg, rgba(201,169,89,0.08), rgba(201,169,89,0.15));
  border: 1px solid rgba(201,169,89,0.2);
  transition: all 0.2s;
}
.daily-prompt:hover {
  background: linear-gradient(135deg, rgba(201,169,89,0.12), rgba(201,169,89,0.2));
}
.daily-prompt-icon { font-size: 28px; }
.daily-prompt-label {
  font-size: 11px;
  color: #C9A959;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.daily-prompt-question {
  font-size: 14px;
  color: var(--text, #3B2F1E);
  margin-top: 2px;
  font-style: italic;
}
.daily-prompt-text { flex: 1; }
.daily-prompt-arrow {
  font-size: 18px;
  color: #C9A959;
  margin-left: auto;
}

/* ── Skeleton Loading States ── */
.skeleton {
  background: linear-gradient(90deg,
    rgba(180,160,130,0.08) 25%,
    rgba(180,160,130,0.15) 50%,
    rgba(180,160,130,0.08) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 12px;
}
.skeleton-card {
  width: 100%;
  height: 120px;
  margin-bottom: 12px;
}
.skeleton-line {
  height: 14px;
  margin-bottom: 8px;
  width: 80%;
}
.skeleton-line.short { width: 50%; }
/* shimmer keyframe defined above in base skeleton section */
