/* ==========================================================================
   拾光小记 (SunnyDays) — Cheerful Warm Scrapbook Design System & Mobile UX
   ========================================================================== */

:root {
  --bg-paper: #FFFDF7;
  --bg-dot: #EFE4D4;
  --surface: #FFFFFF;
  --surface-soft: #FFF9EE;
  --surface-muted: #FAF3E6;

  --ink: #2D2622;
  --ink-soft: #6B5E55;
  --ink-muted: #9C8E84;

  --coral: #FF7A45;
  --coral-hover: #F2632B;
  --coral-soft: #FFF0E8;
  --coral-border: #FFD3BD;

  --butter: #FFC847;
  --butter-soft: #FFF6D6;
  --butter-ink: #8A5B00;

  --mint: #34B38A;
  --mint-soft: #E5F9F1;
  --mint-ink: #176B50;

  --berry: #F26693;
  --berry-soft: #FFEAF1;

  --sky: #4DA8DA;
  --sky-soft: #E8F5FC;

  --border: #EFE4D4;
  --border-strong: #E3D3BE;

  --radius-xl: 24px;
  --radius-lg: 18px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --radius-pill: 999px;

  --shadow-sm: 0 2px 8px rgba(74, 50, 28, 0.05);
  --shadow-card: 0 10px 28px -8px rgba(74, 50, 28, 0.08), 0 2px 6px rgba(74, 50, 28, 0.04);
  --shadow-hover: 0 16px 34px -10px rgba(74, 50, 28, 0.13), 0 4px 10px rgba(74, 50, 28, 0.05);
  --shadow-coral: 0 10px 24px -6px rgba(255, 122, 69, 0.42);

  --font-sans: 'Nunito', 'Noto Sans SC', 'PingFang SC', 'Hiragino Sans GB', -apple-system, BlinkMacSystemFont, sans-serif;
  --header-h: 70px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--ink);
  background-color: var(--bg-paper);
  background-image: radial-gradient(var(--bg-dot) 1.15px, transparent 1.15px);
  background-size: 24px 24px;
  line-height: 1.6;
  min-height: 100dvh;
  overflow-x: hidden;
}

button,
input,
textarea,
select {
  font-family: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  -webkit-tap-highlight-color: transparent;
}

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

[hidden] {
  display: none !important;
}

/* Public Visitor Read-Only Mode */
body.is-visitor-mode .editor-only,
body.is-visitor-mode #quickCaptureBar,
body.is-visitor-mode #sampleBanner,
body.is-visitor-mode .add-to-day-btn,
body.is-visitor-mode .moment-actions {
  display: none !important;
}

body.is-visitor-mode .hero-top {
  margin-bottom: 0;
}

body.is-visitor-mode .tab-fab {
  background: var(--ink);
  box-shadow: 0 8px 18px rgba(45, 38, 34, 0.28);
}

.readonly-fav-pill {
  font-size: 12px;
  font-weight: 800;
  color: var(--berry);
  background: var(--berry-soft);
  padding: 3px 10px;
  border-radius: var(--radius-pill);
}

/* Decorative Ambient Blobs */
.ambient-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  overflow: hidden;
}

.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.42;
}

.blob-sun {
  width: 380px;
  height: 380px;
  background: #FFE599;
  top: -110px;
  left: -80px;
}

.blob-peach {
  width: 340px;
  height: 340px;
  background: #FFD4C2;
  top: 18%;
  right: -100px;
}

.blob-mint {
  width: 320px;
  height: 320px;
  background: #D4F5E9;
  bottom: -90px;
  left: 20%;
}

/* ==========================================================================
   Global Drag & Drop Overlay
   ========================================================================== */
.global-drop-overlay {
  position: fixed;
  inset: 14px;
  z-index: 900;
  background: rgba(255, 253, 247, 0.92);
  backdrop-filter: blur(8px);
  border: 3px dashed var(--coral);
  border-radius: var(--radius-xl);
  display: grid;
  place-items: center;
  animation: popIn 0.2s ease-out;
}

.drop-box {
  text-align: center;
  padding: 32px;
}

.drop-emoji {
  font-size: 54px;
  margin-bottom: 8px;
  animation: floatBob 1.6s ease-in-out infinite;
}

.drop-box h3 {
  margin: 0 0 6px;
  font-size: 22px;
  color: var(--coral);
}

.drop-box p {
  margin: 0;
  color: var(--ink-soft);
}

/* ==========================================================================
   Top Site Header
   ========================================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 253, 247, 0.86);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  max-width: 1180px;
  margin: 0 auto;
  height: var(--header-h);
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}

.brand-logo {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: linear-gradient(135deg, #FF9A5A, #FF6B3D);
  box-shadow: 0 6px 14px -4px rgba(255, 107, 61, 0.45);
  display: grid;
  place-items: center;
  font-size: 23px;
  flex-shrink: 0;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.brand:hover .brand-logo {
  transform: rotate(-10deg) scale(1.07);
}

.brand-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.brand-title {
  font-size: 19px;
  font-weight: 900;
  letter-spacing: -0.01em;
  line-height: 1.15;
  color: var(--ink);
}

.brand-subtitle {
  font-size: 12px;
  color: var(--ink-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.search-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  width: 265px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 0 12px;
  height: 40px;
  transition: border-color 0.2s, box-shadow 0.2s, width 0.25s;
}

.search-wrapper:focus-within {
  border-color: var(--coral);
  box-shadow: 0 0 0 3px rgba(255, 122, 69, 0.14);
  width: 300px;
}

.search-icon {
  font-size: 14px;
  margin-right: 7px;
  opacity: 0.7;
}

.search-input {
  border: none;
  outline: none;
  background: transparent;
  width: 100%;
  font-size: 14px;
}

.icon-clear-btn {
  font-size: 12px;
  color: var(--ink-muted);
  padding: 4px;
}

/* Mobile collapsible search drawer */
.mobile-search-drawer {
  padding: 8px 16px 12px;
  border-top: 1px dashed var(--border);
  background: var(--surface-soft);
}

.mobile-search-inner {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1.5px solid var(--coral-border);
  border-radius: var(--radius-pill);
  padding: 6px 14px;
}

.mobile-search-inner input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: 16px;
}

.text-btn {
  font-size: 14px;
  font-weight: 700;
  color: var(--coral);
  padding: 4px 6px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 40px;
  padding: 0 16px;
  border-radius: var(--radius-pill);
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
  transition: transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1), background-color 0.18s, box-shadow 0.18s;
}

.btn:active {
  transform: scale(0.96);
}

.btn-primary {
  background: linear-gradient(135deg, #FF8652, #FF6733);
  color: #FFFFFF;
  box-shadow: var(--shadow-coral);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #FF7940, #F25722);
  transform: translateY(-1px);
}

.btn-soft {
  background: var(--surface);
  border: 1.5px solid var(--border);
  color: var(--ink-soft);
}

.btn-soft:hover {
  border-color: var(--coral-border);
  background: var(--coral-soft);
  color: var(--coral);
}

.btn-amber-outline {
  background: #FFFFFF;
  border: 1.5px solid #F3C15A;
  color: var(--butter-ink);
  height: 36px;
  padding: 0 14px;
  font-size: 13px;
}

.btn-amber-outline:hover {
  background: var(--butter-soft);
}

.btn-sm {
  height: 34px;
  padding: 0 13px;
  font-size: 13px;
}

.btn-lg {
  height: 44px;
  padding: 0 24px;
  font-size: 15px;
}

/* ==========================================================================
   Main Two-Column Workspace
   ========================================================================== */
.main-container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 24px 20px 64px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 28px;
  align-items: start;
}

.timeline-column {
  min-width: 0;
  max-width: 100%;
}

/* Hero Card & Stats */
.hero-card {
  background: linear-gradient(155deg, #FFFFFF 0%, #FFF8EC 100%);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 22px 24px;
  box-shadow: var(--shadow-card);
  margin-bottom: 18px;
  position: relative;
  overflow: hidden;
}

.hero-card::after {
  content: '☀️';
  position: absolute;
  right: -12px;
  top: -16px;
  font-size: 82px;
  opacity: 0.08;
  pointer-events: none;
}

.hero-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.greeting-pill {
  display: inline-block;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--coral);
  background: var(--coral-soft);
  padding: 4px 11px;
  border-radius: var(--radius-pill);
  margin-bottom: 6px;
}

.greeting-title {
  margin: 0;
  font-size: 22px;
  font-weight: 900;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.stats-pills {
  display: flex;
  gap: 10px;
}

.stat-chip {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 8px 14px;
  min-width: 78px;
  text-align: center;
  box-shadow: var(--shadow-sm);
}

.stat-chip-streak {
  background: var(--butter-soft);
  border-color: #F9DF94;
}

.stat-num {
  display: block;
  font-size: 20px;
  font-weight: 900;
  line-height: 1.15;
  color: var(--ink);
}

.stat-chip-streak .stat-num {
  color: #C76700;
}

.stat-label {
  font-size: 11.5px;
  color: var(--ink-soft);
  font-weight: 600;
}

/* Quick Capture Bar */
.quick-capture-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  background: var(--surface);
  border: 2px dashed var(--coral-border);
  border-radius: var(--radius-lg);
  padding: 13px 16px;
  cursor: pointer;
  transition: border-color 0.2s, background-color 0.2s, transform 0.18s;
}

.quick-capture-bar:hover {
  border-color: var(--coral);
  background: #FFFDFB;
  transform: translateY(-1px);
}

.quick-capture-left {
  display: flex;
  align-items: center;
  gap: 13px;
  min-width: 0;
}

.camera-bubble {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: var(--coral-soft);
  display: grid;
  place-items: center;
  font-size: 22px;
  flex-shrink: 0;
}

.quick-capture-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.quick-capture-copy strong {
  font-size: 15px;
  color: var(--ink);
}

.quick-capture-copy span {
  font-size: 12.5px;
  color: var(--ink-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.quick-capture-cta {
  background: var(--coral);
  color: #FFFFFF;
  font-size: 13.5px;
  font-weight: 800;
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  flex-shrink: 0;
}

/* Sample Banner */
.sample-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--butter-soft);
  border: 1.5px solid #F7DA88;
  border-radius: var(--radius-lg);
  padding: 11px 16px;
  margin-bottom: 18px;
  font-size: 13.5px;
  color: var(--butter-ink);
}

.sample-banner-text {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.sample-badge {
  background: #FFE597;
  padding: 2px 9px;
  border-radius: var(--radius-pill);
  font-weight: 800;
  font-size: 12px;
}

/* ==========================================================================
   Filter Chips & Sort Controls
   ========================================================================== */
.controls-bar {
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.mood-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 2px 2px 6px;
}

.filter-chip {
  flex-shrink: 0;
  height: 36px;
  padding: 0 14px;
  border-radius: var(--radius-pill);
  background: var(--surface);
  border: 1.5px solid var(--border);
  font-size: 13.5px;
  font-weight: 700;
  color: var(--ink-soft);
  transition: all 0.18s ease;
}

.filter-chip:hover {
  border-color: var(--coral-border);
  color: var(--ink);
}

.filter-chip.active {
  background: var(--ink);
  border-color: var(--ink);
  color: #FFFFFF;
  box-shadow: 0 4px 12px rgba(45, 38, 34, 0.18);
}

.sort-and-active-filters {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.active-filter-badges {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.active-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--coral-soft);
  border: 1.5px solid var(--coral-border);
  color: var(--coral);
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 700;
}

.active-badge button {
  color: var(--coral);
  font-weight: 900;
  padding: 0 2px;
}

.sort-toggle {
  margin-left: auto;
  display: inline-flex;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 3px;
}

.sort-btn {
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink-soft);
  transition: all 0.18s;
}

.sort-btn.active {
  background: var(--coral-soft);
  color: var(--coral);
}

/* ==========================================================================
   Daily Grouped Timeline & Moment Cards
   ========================================================================== */
.timeline-feed {
  display: flex;
  flex-direction: column;
  gap: 30px;
  position: relative;
}

.day-group {
  position: relative;
  padding-left: 26px;
}

/* Warm dashed vertical timeline spine */
.day-group::before {
  content: '';
  position: absolute;
  left: 9px;
  top: 28px;
  bottom: -24px;
  width: 2.5px;
  background-image: linear-gradient(to bottom, #F4C095 55%, transparent 45%);
  background-size: 2.5px 12px;
}

.day-group:last-child::before {
  bottom: 12px;
}

/* Timeline dot marker */
.day-group::after {
  content: '';
  position: absolute;
  left: 2px;
  top: 18px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--coral);
  border: 3.5px solid var(--bg-paper);
  box-shadow: 0 0 0 2px var(--coral-border);
}

.day-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.day-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.day-stamp {
  background: var(--surface);
  border: 2px solid var(--border-strong);
  border-radius: 16px;
  padding: 6px 12px;
  min-width: 58px;
  text-align: center;
  box-shadow: var(--shadow-sm);
  line-height: 1.05;
}

.day-stamp-today {
  background: linear-gradient(145deg, #FF844F, #FF6530);
  border-color: #FF6530;
  color: #FFFFFF;
}

.day-stamp-num {
  display: block;
  font-size: 23px;
  font-weight: 900;
}

.day-stamp-month {
  display: block;
  font-size: 11px;
  font-weight: 700;
  opacity: 0.86;
  margin-top: 2px;
}

.day-title-meta {
  display: flex;
  flex-direction: column;
}

.day-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.day-weekday {
  font-size: 17px;
  font-weight: 900;
  color: var(--ink);
}

.day-rel-badge {
  font-size: 12px;
  font-weight: 800;
  padding: 2px 9px;
  border-radius: var(--radius-pill);
  background: var(--butter-soft);
  color: var(--butter-ink);
  white-space: nowrap;
  flex-shrink: 0;
}

.day-rel-badge.is-today {
  background: var(--coral-soft);
  color: var(--coral);
}

.day-summary-sub {
  font-size: 12.5px;
  color: var(--ink-muted);
}

.add-to-day-btn {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--coral);
  background: var(--surface);
  border: 1.5px dashed var(--coral-border);
  border-radius: var(--radius-pill);
  padding: 5px 12px;
  transition: all 0.18s;
}

.add-to-day-btn:hover {
  background: var(--coral-soft);
  border-style: solid;
}

/* Moments stack inside one day */
.day-moments-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.moment-card {
  position: relative;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 18px 20px;
  box-shadow: var(--shadow-card);
  transition: transform 0.22s ease, box-shadow 0.22s ease;
  animation: fadeSlideUp 0.3s ease backwards;
}

.moment-card:hover {
  box-shadow: var(--shadow-hover);
}

/* Cute decorative tape on starred moments */
.moment-card.is-favorite::before {
  content: '';
  position: absolute;
  top: -8px;
  right: 28px;
  width: 68px;
  height: 18px;
  background: rgba(255, 209, 102, 0.65);
  border-left: 2px dotted rgba(255, 255, 255, 0.8);
  border-right: 2px dotted rgba(255, 255, 255, 0.8);
  transform: rotate(3deg);
  pointer-events: none;
}

.moment-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.moment-badges {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.time-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  font-weight: 800;
  color: var(--ink);
  background: var(--surface-muted);
  padding: 4px 11px;
  border-radius: var(--radius-pill);
}

.mood-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12.5px;
  font-weight: 700;
  padding: 4px 11px;
  border-radius: var(--radius-pill);
}

.mood-yummy { background: #FFF0E5; color: #D95B16; }
.mood-healing { background: #FFEBF1; color: #D64072; }
.mood-happy { background: #FFF6D6; color: #B87500; }
.mood-chill { background: #E5F9F1; color: #1B7F5C; }
.mood-party { background: #F2EBFF; color: #6E42C1; }
.mood-productive { background: #E8F4FD; color: #1F73B7; }

.weather-pill {
  font-size: 12.5px;
  color: var(--ink-soft);
  background: var(--bg-paper);
  border: 1px solid var(--border);
  padding: 3px 9px;
  border-radius: var(--radius-pill);
}

/* Adaptive Photo Collage Grid */
.moment-photos {
  display: grid;
  gap: 8px;
  margin-bottom: 13px;
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.photo-tile {
  position: relative;
  overflow: hidden;
  border-radius: 14px;
  background: var(--surface-muted);
  cursor: zoom-in;
}

.photo-tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.photo-tile:hover img {
  transform: scale(1.035);
}

/* 1 Photo: Showcase natural framing */
.moment-photos.count-1 {
  grid-template-columns: 1fr;
}

.moment-photos.count-1 .photo-tile {
  max-height: 430px;
}

.moment-photos.count-1 .photo-tile img {
  max-height: 430px;
  object-fit: cover;
}

/* 2 Photos: Side-by-side */
.moment-photos.count-2 {
  grid-template-columns: repeat(2, 1fr);
}

.moment-photos.count-2 .photo-tile {
  aspect-ratio: 4 / 3;
}

/* 3 Photos: 1 Featured Left + 2 Stacked Right */
.moment-photos.count-3 {
  grid-template-columns: 1.35fr 1fr;
  grid-template-rows: repeat(2, 148px);
}

.moment-photos.count-3 .photo-tile:first-child {
  grid-row: span 2;
}

/* 4 Photos: Clean 2x2 */
.moment-photos.count-4 {
  grid-template-columns: repeat(2, 1fr);
  max-width: 540px;
}

.moment-photos.count-4 .photo-tile {
  aspect-ratio: 1 / 1;
}

/* 5+ Photos: 3-column collage */
.moment-photos.count-many {
  grid-template-columns: repeat(3, 1fr);
}

.moment-photos.count-many .photo-tile {
  aspect-ratio: 1 / 1;
}

/* Caption, Tags & Location */
.moment-caption {
  margin: 0 0 11px;
  font-size: 15.5px;
  line-height: 1.72;
  color: var(--ink);
  white-space: pre-wrap;
  word-break: break-word;
}

.moment-meta-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.tag-chip {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--mint-ink);
  background: var(--mint-soft);
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  transition: opacity 0.15s;
}

.tag-chip:hover {
  opacity: 0.82;
}

.location-chip {
  font-size: 12.5px;
  color: var(--ink-soft);
  background: var(--surface-soft);
  border: 1px solid var(--border);
  padding: 2px 10px;
  border-radius: var(--radius-pill);
}

/* Card Bottom Action Bar */
.moment-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
}

.fav-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-muted);
  padding: 5px 10px;
  border-radius: var(--radius-pill);
  transition: all 0.18s;
}

.fav-toggle-btn:hover {
  background: var(--berry-soft);
  color: var(--berry);
}

.fav-toggle-btn.active {
  color: var(--berry);
  background: var(--berry-soft);
}

.fav-toggle-btn.pop {
  animation: heartPop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.card-right-btns {
  display: flex;
  align-items: center;
  gap: 4px;
}

.card-action-btn {
  font-size: 12.5px;
  color: var(--ink-muted);
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  transition: background-color 0.15s, color 0.15s;
}

.card-action-btn:hover {
  background: var(--surface-muted);
  color: var(--ink);
}

.card-action-btn.danger:hover {
  background: #FFEAEA;
  color: #D93838;
}

/* Empty State */
.empty-state {
  background: var(--surface);
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-xl);
  padding: 52px 24px;
  text-align: center;
}

.empty-illustration {
  font-size: 54px;
  margin-bottom: 10px;
}

.empty-state h3 {
  margin: 0 0 8px;
  font-size: 19px;
}

.empty-state p {
  margin: 0 0 20px;
  color: var(--ink-muted);
  font-size: 14px;
}

/* ==========================================================================
   Right Sidebar: Footprint Calendar & Memory Polaroid
   ========================================================================== */
.sidebar-column {
  position: sticky;
  top: calc(var(--header-h) + 20px);
}

.sidebar-inner {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.sheet-mobile-header,
.sidebar-sheet-backdrop {
  display: none;
}

.side-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 18px;
  box-shadow: var(--shadow-card);
}

.side-card h3 {
  margin: 0;
  font-size: 15.5px;
  font-weight: 800;
}

.calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.cal-title-wrap {
  text-align: center;
}

.cal-today-link {
  font-size: 11.5px;
  color: var(--coral);
  font-weight: 700;
}

.cal-nav-btn {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  font-size: 18px;
  font-weight: 800;
  display: grid;
  place-items: center;
}

.cal-nav-btn:hover {
  background: var(--coral-soft);
  color: var(--coral);
}

.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-muted);
  margin-bottom: 6px;
}

.calendar-weekdays .wknd {
  color: var(--coral);
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.cal-day {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: 11px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  transition: all 0.16s;
}

.cal-day.is-outside {
  opacity: 0.25;
  pointer-events: none;
}

.cal-day:hover {
  background: var(--surface-soft);
}

.cal-day.is-today {
  border: 1.5px solid var(--coral);
  color: var(--coral);
}

.cal-day.has-record {
  background: var(--butter-soft);
  color: var(--ink);
}

.cal-day.has-record::after {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--coral);
  margin-top: 2px;
}

.cal-day.is-selected {
  background: var(--coral) !important;
  color: #FFFFFF !important;
}

.cal-day.is-selected::after {
  background: #FFFFFF;
}

.calendar-hint {
  margin: 12px 0 0;
  font-size: 11.5px;
  color: var(--ink-muted);
  line-height: 1.45;
}

/* Random Memory Polaroid */
.side-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.mini-pill-btn {
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  background: var(--surface-soft);
  border: 1px solid var(--border);
  color: var(--ink-soft);
}

.mini-pill-btn:hover {
  background: var(--coral-soft);
  color: var(--coral);
}

.memory-polaroid {
  background: #FFFDF9;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 10px 10px 13px;
  box-shadow: 0 6px 16px rgba(74, 50, 28, 0.07);
  cursor: pointer;
  transition: transform 0.22s ease;
}

.memory-polaroid:hover {
  transform: rotate(-1.2deg) translateY(-2px);
}

.memory-polaroid img {
  width: 100%;
  height: 165px;
  object-fit: cover;
  border-radius: 9px;
  display: block;
  margin-bottom: 9px;
}

.memory-polaroid-date {
  font-size: 11.5px;
  font-weight: 800;
  color: var(--coral);
}

.memory-polaroid-text {
  margin: 3px 0 0;
  font-size: 13px;
  color: var(--ink-soft);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.utility-desc {
  margin: 8px 0 12px;
  font-size: 12.5px;
  color: var(--ink-muted);
}

.utility-desc code {
  background: var(--surface-soft);
  padding: 1px 5px;
  border-radius: 5px;
  font-size: 12px;
}

.utility-btns {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ==========================================================================
   Composer Modal / Bottom Sheet
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: grid;
  place-items: center;
  padding: 16px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(38, 28, 22, 0.46);
  backdrop-filter: blur(4px);
  animation: fadeIn 0.2s ease;
}

.composer-sheet,
.info-dialog {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 620px;
  max-height: 90dvh;
  background: var(--bg-paper);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: 0 24px 60px rgba(32, 20, 12, 0.24);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: popIn 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}

.info-dialog {
  max-width: 460px;
}

.sheet-drag-handle {
  display: none;
}

.composer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 22px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.composer-header h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 900;
}

.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--surface-muted);
  color: var(--ink-soft);
  font-size: 15px;
  display: grid;
  place-items: center;
}

.icon-btn:hover {
  background: var(--coral-soft);
  color: var(--coral);
}

.composer-body {
  padding: 18px 22px 22px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.section-label {
  display: block;
  font-size: 13.5px;
  font-weight: 800;
  color: var(--ink);
  margin-bottom: 7px;
}

.muted-count,
.optional-tag {
  font-weight: 500;
  font-size: 12px;
  color: var(--ink-muted);
}

/* Uploader Grid inside Composer */
.uploader-label-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.uploader-tip {
  font-size: 12px;
  color: var(--ink-muted);
}

.photo-time-hint {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: var(--butter-soft);
  border: 1px solid #F5D57A;
  border-radius: var(--radius-sm);
  padding: 7px 12px;
  margin-bottom: 10px;
  font-size: 12.5px;
  color: var(--butter-ink);
}

.hint-apply-btn {
  background: var(--butter);
  color: #4A3200;
  font-weight: 800;
  font-size: 12px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  flex-shrink: 0;
}

.photo-preview-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.preview-item {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: 14px;
  overflow: hidden;
  border: 1.5px solid var(--border);
  background: var(--surface);
}

.preview-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.preview-remove-btn {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(32, 24, 20, 0.72);
  color: #FFFFFF;
  font-size: 12px;
  display: grid;
  place-items: center;
}

.preview-order-btns {
  position: absolute;
  bottom: 5px;
  left: 5px;
  display: flex;
  gap: 4px;
}

.preview-move-btn {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.86);
  color: var(--ink);
  font-size: 11px;
  font-weight: 900;
  display: grid;
  place-items: center;
}

.add-photo-tile {
  aspect-ratio: 1 / 1;
  border-radius: 14px;
  border: 2px dashed var(--coral-border);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: var(--coral);
  font-size: 12.5px;
  font-weight: 800;
  transition: background-color 0.18s, border-color 0.18s;
}

.add-photo-tile:hover {
  background: var(--coral-soft);
  border-color: var(--coral);
}

.add-photo-tile .plus-icon {
  font-size: 24px;
  line-height: 1;
}

.upload-progress-wrap {
  margin-top: 10px;
}

.upload-progress-bar {
  height: 7px;
  border-radius: var(--radius-pill);
  background: var(--border);
  overflow: hidden;
}

.upload-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--butter), var(--coral));
  transition: width 0.18s ease;
}

.upload-progress-text {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  color: var(--ink-soft);
}

/* Form Controls */
.datetime-row,
.meta-inputs-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-input,
.form-textarea {
  width: 100%;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 13px;
  font-size: 15px;
  outline: none;
  transition: border-color 0.18s, box-shadow 0.18s;
}

.form-input:focus,
.form-textarea:focus {
  border-color: var(--coral);
  box-shadow: 0 0 0 3px rgba(255, 122, 69, 0.14);
}

.form-textarea {
  resize: vertical;
  min-height: 82px;
}

.choice-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.choice-pill {
  padding: 7px 13px;
  border-radius: var(--radius-pill);
  background: var(--surface);
  border: 1.5px solid var(--border);
  font-size: 13.5px;
  font-weight: 700;
  color: var(--ink-soft);
  transition: all 0.16s;
}

.choice-pill.selected {
  background: var(--coral-soft);
  border-color: var(--coral);
  color: var(--coral);
  transform: translateY(-1px);
}

.quick-tags-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: -6px;
}

.quick-tag-prefix {
  font-size: 12px;
  color: var(--ink-muted);
}

.quick-tag-btn {
  font-size: 12px;
  font-weight: 700;
  color: var(--mint-ink);
  background: var(--mint-soft);
  padding: 3px 9px;
  border-radius: var(--radius-pill);
}

.composer-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

.fav-checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.fav-checkbox-label input {
  width: 18px;
  height: 18px;
  accent-color: var(--coral);
}

.composer-submit-btns {
  display: flex;
  gap: 10px;
  margin-left: auto;
}

/* Info Dialog */
.info-dialog-body {
  padding: 20px 22px 24px;
  font-size: 14.5px;
}

.lan-url-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 14px 0;
}

.lan-url-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--surface);
  border: 1.5px solid var(--coral-border);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  font-weight: 800;
  color: var(--coral);
}

.info-tips {
  background: var(--butter-soft);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  font-size: 13px;
  color: var(--butter-ink);
}

.info-tips p {
  margin: 0;
}

/* ==========================================================================
   Fullscreen Photo Lightbox
   ========================================================================== */
.lightbox-overlay {
  position: fixed;
  inset: 0;
  z-index: 800;
  background: rgba(20, 16, 14, 0.94);
  backdrop-filter: blur(10px);
  color: #FFFFFF;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: env(safe-area-inset-top, 12px) 16px env(safe-area-inset-bottom, 16px);
  touch-action: pan-y;
}

.lightbox-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 4px;
}

.lightbox-counter {
  font-size: 14px;
  font-weight: 800;
  background: rgba(255, 255, 255, 0.14);
  padding: 5px 13px;
  border-radius: var(--radius-pill);
}

.lightbox-top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.lightbox-icon-btn {
  background: rgba(255, 255, 255, 0.15);
  color: #FFFFFF;
  height: 38px;
  padding: 0 14px;
  border-radius: var(--radius-pill);
  font-size: 13.5px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
}

.lightbox-stage {
  flex: 1;
  min-height: 0;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-figure {
  margin: 0;
  max-width: 100%;
  max-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-figure img {
  max-width: 92vw;
  max-height: 74dvh;
  object-fit: contain;
  border-radius: 12px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
  user-select: none;
}

.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
  color: #FFFFFF;
  font-size: 28px;
  display: grid;
  place-items: center;
  transition: background-color 0.18s;
}

.lightbox-nav:hover {
  background: rgba(255, 255, 255, 0.3);
}

.lightbox-prev { left: 8px; }
.lightbox-next { right: 8px; }

.lightbox-caption-bar {
  max-width: 720px;
  margin: 0 auto;
  width: 100%;
  text-align: center;
  padding: 10px 8px 6px;
}

.lightbox-meta {
  font-size: 12.5px;
  color: #FFD166;
  font-weight: 700;
  margin-bottom: 4px;
}

.lightbox-caption {
  margin: 0;
  font-size: 14.5px;
  color: rgba(255, 255, 255, 0.9);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ==========================================================================
   Toast Notifications
   ========================================================================== */
.toast-container {
  position: fixed;
  top: 84px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: var(--ink);
  color: #FFFFFF;
  padding: 10px 18px;
  border-radius: var(--radius-pill);
  font-size: 14px;
  font-weight: 700;
  box-shadow: 0 10px 26px rgba(32, 20, 12, 0.25);
  animation: popIn 0.22s ease;
}

/* Mobile Tabbar hidden on desktop */
.mobile-tabbar {
  display: none;
}

/* ==========================================================================
   Animations
   ========================================================================== */
@keyframes popIn {
  from { opacity: 0; transform: scale(0.95) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

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

@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes heartPop {
  0% { transform: scale(1); }
  45% { transform: scale(1.26); }
  100% { transform: scale(1); }
}

@keyframes floatBob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

/* ==========================================================================
   Tablet & Mobile Adaptation (<= 900px & <= 560px)
   ========================================================================== */
@media (max-width: 900px) {
  body {
    padding-bottom: calc(82px + env(safe-area-inset-bottom, 0px));
  }

  .hide-sm,
  #desktopSearchWrapper,
  #openComposerTopBtn {
    display: none;
  }

  .header-inner {
    height: 60px;
    padding: 0 16px;
  }

  .main-container {
    grid-template-columns: minmax(0, 1fr);
    padding: 16px 14px 32px;
    gap: 20px;
  }

  .mood-filters {
    flex-wrap: nowrap;
    overflow-x: auto;
    max-width: 100%;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }

  .mood-filters::-webkit-scrollbar {
    display: none;
  }

  /* Transform Sidebar into Slide-Up Mobile Sheet */
  .sidebar-column {
    position: fixed;
    inset: 0;
    top: 0;
    z-index: 450;
    pointer-events: none;
    visibility: hidden;
  }

  .sidebar-column.sheet-open {
    pointer-events: auto;
    visibility: visible;
  }

  .sidebar-sheet-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(38, 28, 22, 0.45);
    opacity: 0;
    transition: opacity 0.25s ease;
  }

  .sidebar-column.sheet-open .sidebar-sheet-backdrop {
    opacity: 1;
  }

  .sidebar-inner {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    max-height: 84dvh;
    overflow-y: auto;
    background: var(--bg-paper);
    border-radius: 26px 26px 0 0;
    padding: 16px 16px calc(24px + env(safe-area-inset-bottom, 12px));
    box-shadow: 0 -14px 40px rgba(32, 20, 12, 0.2);
    transform: translateY(104%);
    transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
  }

  .sidebar-column.sheet-open .sidebar-inner {
    transform: translateY(0);
  }

  .sheet-mobile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 6px;
  }

  .sheet-mobile-header h3 {
    margin: 0;
    font-size: 17px;
    font-weight: 900;
  }

  /* Mobile Sticky Bottom Tab Bar */
  .mobile-tabbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 350;
    background: rgba(255, 253, 247, 0.94);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid var(--border);
    padding: 6px 10px calc(6px + env(safe-area-inset-bottom, 0px));
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    align-items: center;
    box-shadow: 0 -6px 24px rgba(74, 50, 28, 0.06);
  }

  .tab-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 4px 0;
    color: var(--ink-muted);
    font-size: 11px;
    font-weight: 700;
  }

  .tab-item.active {
    color: var(--coral);
  }

  .tab-icon {
    font-size: 19px;
    line-height: 1.15;
  }

  .tab-fab {
    justify-self: center;
    margin-top: -22px;
    background: linear-gradient(135deg, #FF8652, #FF622E);
    color: #FFFFFF;
    height: 50px;
    padding: 0 15px;
    border-radius: var(--radius-pill);
    box-shadow: 0 10px 22px -4px rgba(255, 102, 51, 0.5);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    line-height: 1.1;
  }

  .fab-plus {
    font-size: 18px;
  }

  .fab-text {
    font-size: 10.5px;
    font-weight: 800;
  }

  /* Composer Modal becomes Mobile Bottom Sheet */
  .modal-overlay {
    padding: 0;
    align-items: end;
  }

  .composer-sheet,
  .info-dialog {
    max-width: 100%;
    max-height: 92dvh;
    border-radius: 26px 26px 0 0;
    border-bottom: none;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

  .sheet-drag-handle {
    display: block;
    width: 42px;
    height: 5px;
    border-radius: var(--radius-pill);
    background: var(--border-strong);
    margin: 10px auto 2px;
    flex-shrink: 0;
  }

  .composer-header {
    padding: 10px 18px 12px;
  }

  .composer-body {
    padding: 14px 16px 20px;
  }

  /* Prevent iOS Safari zoom on input focus */
  .form-input,
  .form-textarea {
    font-size: 16px;
  }
}

@media (max-width: 560px) {
  .hero-card {
    padding: 16px;
    border-radius: 20px;
  }

  .greeting-title {
    font-size: 18.5px;
  }

  .stats-pills {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }

  .stat-chip {
    min-width: 0;
    padding: 7px 8px;
  }

  .stat-num {
    font-size: 18px;
  }

  .quick-capture-bar {
    padding: 11px 12px;
  }

  .quick-capture-copy span {
    font-size: 12px;
  }

  .quick-capture-cta {
    padding: 7px 12px;
    font-size: 12.5px;
  }

  .sample-banner {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .sample-banner .btn-amber-outline {
    width: 100%;
  }

  .day-header {
    gap: 8px;
  }

  .day-header-left {
    min-width: 0;
    flex: 1;
  }

  .day-weekday {
    font-size: 15px;
  }

  .add-to-day-btn {
    padding: 4px 10px;
    font-size: 12px;
  }

  .datetime-row > .field-group {
    min-width: 0;
  }

  .day-group {
    padding-left: 18px;
  }

  .day-group::before {
    left: 5px;
  }

  .day-group::after {
    left: -1px;
    width: 14px;
    height: 14px;
  }

  .day-stamp {
    min-width: 50px;
    padding: 5px 9px;
    border-radius: 13px;
  }

  .day-stamp-num {
    font-size: 20px;
  }

  .moment-card {
    padding: 14px 14px 12px;
    border-radius: 18px;
  }

  .moment-photos.count-3 {
    grid-template-rows: repeat(2, 112px);
  }

  .moment-photos.count-1 .photo-tile,
  .moment-photos.count-1 .photo-tile img {
    max-height: 340px;
  }

  .photo-preview-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .choice-pills {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: none;
  }

  .choice-pills::-webkit-scrollbar {
    display: none;
  }

  .choice-pill {
    flex-shrink: 0;
  }

  .meta-inputs-row {
    grid-template-columns: 1fr;
  }

  .lightbox-nav {
    width: 38px;
    height: 38px;
    font-size: 22px;
  }
}
