/*
 * Life Diary — Quiet Modern UI
 * A calm, tactile visual layer inspired by emotion-first journaling.
 * This file intentionally overrides the legacy styles without changing data logic.
 */

:root {
  /* 防止 Android/MIUI 的“强制深色模式”污染半透明卡片和渐变。 */
  color-scheme: only light;
  --app-bg: #f2f5f3;
  --surface: rgba(255, 255, 255, 0.76);
  --surface-solid: #fbfcfb;
  --surface-soft: rgba(247, 249, 248, 0.82);
  --surface-strong: rgba(255, 255, 255, 0.92);
  --ink: #28302f;
  --ink-2: #596260;
  --ink-3: #89918f;
  --line: rgba(54, 70, 67, 0.10);
  --line-strong: rgba(54, 70, 67, 0.18);
  --primary: #586f6b;
  --primary-dark: #31423f;
  --primary-soft: #dce9e6;
  --peach: #f2bc83;
  --peach-soft: #ffe4bf;
  --sky: #a8d8e5;
  --sky-soft: #dceef2;
  --rose: #dc9ca0;
  --lavender: #c9c3df;
  --danger: #b35e62;
  --radius-sm: 12px;
  --radius-md: 18px;
  --radius-lg: 26px;
  --radius-xl: 34px;
  --shadow-sm: 0 1px 2px rgba(34, 51, 48, 0.04), 0 8px 24px rgba(34, 51, 48, 0.05);
  --shadow-md: 0 18px 50px rgba(34, 51, 48, 0.10);
  --shadow-float: 0 20px 56px rgba(34, 51, 48, 0.16);

  /* Legacy token bridge */
  --bg-warm: var(--app-bg);
  --bg-card: var(--surface-strong);
  --bg-card-hover: #ffffff;
  --accent-rose: var(--primary);
  --accent-peach: var(--peach);
  --accent-gold: #c99d64;
  --accent-sage: #9db6af;
  --accent-lavender: var(--lavender);
  --text-primary: var(--ink);
  --text-secondary: var(--ink-2);
  --text-light: var(--ink-3);
  --border-soft: var(--line);
  --shadow-warm: rgba(34, 51, 48, 0.07);
  --shadow-deep: rgba(34, 51, 48, 0.14);
}

* {
  -webkit-tap-highlight-color: transparent;
}

html {
  background: var(--app-bg);
}

body {
  background: var(--app-bg) !important;
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC",
    "Microsoft YaHei", "Noto Sans CJK SC", "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  letter-spacing: -0.01em;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 6% 2%, rgba(168, 216, 229, 0.32), transparent 29%),
    radial-gradient(circle at 94% 18%, rgba(255, 216, 175, 0.34), transparent 28%),
    radial-gradient(circle at 60% 92%, rgba(201, 195, 223, 0.26), transparent 30%);
}

button,
input,
textarea,
select {
  font: inherit;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid rgba(88, 111, 107, 0.24);
  outline-offset: 2px;
}

/* Reduce purely decorative motion; keep meaningful feedback. */
#particles,
.cursor-ink,
.cover-petal,
.cover-rays,
.cover-light-sweep {
  display: none !important;
}

.atmosphere {
  opacity: 0.72;
  filter: saturate(0.78);
}

.atmosphere-dawn {
  background:
    radial-gradient(circle at 10% 8%, rgba(170, 221, 231, 0.42), transparent 36%),
    radial-gradient(circle at 90% 12%, rgba(255, 218, 175, 0.38), transparent 32%);
}

.atmosphere-noon {
  background:
    radial-gradient(circle at 88% 8%, rgba(255, 205, 150, 0.34), transparent 34%),
    radial-gradient(circle at 8% 42%, rgba(194, 226, 219, 0.34), transparent 36%);
}

.atmosphere-dusk {
  background:
    radial-gradient(circle at 88% 10%, rgba(241, 181, 149, 0.35), transparent 36%),
    radial-gradient(circle at 8% 62%, rgba(207, 196, 224, 0.34), transparent 38%);
}

.atmosphere-night {
  background:
    radial-gradient(circle at 85% 8%, rgba(184, 195, 222, 0.36), transparent 34%),
    radial-gradient(circle at 10% 65%, rgba(186, 220, 215, 0.28), transparent 38%);
}

/* Cover: a living memory core with slow, tactile motion. */
.cover-page {
  background: #d9e5e5;
}

.cover-scene {
  --memory-a: #79cad7;
  --memory-b: #f0b878;
  --memory-c: #eaf5f3;
  --memory-d: #a6d8d4;
  --memory-shadow: rgba(56, 117, 121, .24);
  --orbit-color: rgba(255,255,255,.34);
  background:
    radial-gradient(ellipse at 12% 8%, rgba(177,225,231,.88), transparent 34%),
    radial-gradient(ellipse at 88% 72%, rgba(250,205,154,.68), transparent 36%),
    linear-gradient(155deg, #d9e9ea 0%, #edf3f0 50%, #ead4bd 100%) !important;
}

.cover-scene.scene-day {
  --memory-a: #69c5d7;
  --memory-b: #f2bf70;
  --memory-c: #f8fbf4;
  --memory-d: #9cd6cc;
  background:
    radial-gradient(ellipse at 12% 12%, rgba(176,225,238,.94), transparent 34%),
    radial-gradient(ellipse at 88% 78%, rgba(255,218,166,.76), transparent 38%),
    linear-gradient(155deg, #cce4ea 0%, #edf4ef 53%, #efd8b9 100%) !important;
}

.cover-scene.scene-dusk {
  --memory-a: #d29fbe;
  --memory-b: #f0a36f;
  --memory-c: #f7dfd4;
  --memory-d: #a8b5da;
  --memory-shadow: rgba(102, 72, 110, .28);
  background:
    radial-gradient(ellipse at 14% 12%, rgba(174,169,215,.70), transparent 35%),
    radial-gradient(ellipse at 88% 72%, rgba(244,158,108,.64), transparent 40%),
    linear-gradient(155deg, #7a718d 0%, #b5818d 48%, #d49d7c 100%) !important;
}

.cover-scene.scene-night {
  --memory-a: #65bdcf;
  --memory-b: #d9aa66;
  --memory-c: #d8ebeb;
  --memory-d: #758fbd;
  --memory-shadow: rgba(36, 94, 113, .44);
  --orbit-color: rgba(196,228,234,.25);
  background:
    radial-gradient(ellipse at 18% 12%, rgba(91,125,151,.48), transparent 36%),
    radial-gradient(ellipse at 82% 74%, rgba(145,112,79,.38), transparent 40%),
    linear-gradient(145deg, #152534 0%, #293d4e 48%, #4a4b4b 100%) !important;
}

.cover-sky {
  overflow: hidden;
  background:
    radial-gradient(circle at 22% 18%, rgba(255,255,255,.64), transparent 22%),
    radial-gradient(circle at 77% 63%, rgba(255,224,189,.30), transparent 28%),
    transparent !important;
}

.cover-sky::before,
.cover-sky::after {
  content: "";
  position: absolute;
  pointer-events: none;
}

.cover-sky::before {
  inset: -28%;
  background:
    radial-gradient(ellipse at 24% 38%, rgba(115,211,215,.26), transparent 34%),
    radial-gradient(ellipse at 72% 44%, rgba(222,174,221,.22), transparent 32%),
    radial-gradient(ellipse at 50% 72%, rgba(250,194,126,.20), transparent 36%);
  filter: blur(54px);
  opacity: .72;
  animation: auroraDrift 18s ease-in-out infinite alternate;
}

.cover-sky::after {
  inset: 0;
  background:
    repeating-radial-gradient(circle at 30% 30%, rgba(255,255,255,.06) 0 1px, transparent 1px 7px),
    linear-gradient(115deg, transparent 18%, rgba(255,255,255,.08) 42%, transparent 64%);
  mix-blend-mode: soft-light;
  opacity: .30;
  animation: atmosphereShimmer 12s ease-in-out infinite alternate;
}

.cover-scene.scene-night .cover-sky::before {
  background:
    radial-gradient(ellipse at 18% 34%, rgba(67,170,184,.30), transparent 34%),
    radial-gradient(ellipse at 70% 32%, rgba(109,94,174,.24), transparent 36%),
    radial-gradient(ellipse at 66% 78%, rgba(208,143,82,.18), transparent 38%);
  opacity: .78;
}

.cover-cloud,
.cover-hills {
  display: none !important;
}

.cover-sun {
  top: 41% !important;
  left: 50% !important;
  width: clamp(280px, 46vw, 440px) !important;
  height: clamp(280px, 46vw, 440px) !important;
  overflow: visible !important;
  border-radius: 50% !important;
  transform: translate(-50%, -50%) !important;
  background: transparent !important;
  box-shadow: none !important;
  filter: none !important;
  animation: memoryFloat 8s ease-in-out infinite !important;
  isolation: isolate;
}

.cover-sun::before,
.cover-sun::after {
  display: none !important;
}

.memory-orbit,
.memory-fluid,
.memory-core {
  position: absolute;
  display: block;
  pointer-events: none;
}

.memory-orbit {
  top: 50%;
  left: 50%;
  border: 1px solid var(--orbit-color);
  border-radius: 50%;
  box-shadow: inset 0 0 24px rgba(255,255,255,.04), 0 0 30px rgba(139,201,207,.05);
}

.memory-orbit::after {
  content: "";
  position: absolute;
  top: 50%;
  right: -3px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(242,250,247,.92);
  box-shadow: 0 0 12px 3px rgba(157,224,228,.46);
}

.memory-orbit-outer {
  width: 122%;
  height: 78%;
  transform: translate(-50%, -50%) rotate(-18deg);
  animation: memoryOrbitOuter 28s linear infinite;
}

.memory-orbit-inner {
  width: 94%;
  height: 112%;
  border-color: color-mix(in srgb, var(--orbit-color) 76%, transparent);
  transform: translate(-50%, -50%) rotate(28deg);
  animation: memoryOrbitInner 23s linear infinite reverse;
}

.memory-fluid {
  inset: 15%;
  z-index: 2;
  transform-origin: center;
}

.memory-fluid-back {
  inset: 11%;
  z-index: 0;
  border-radius: 43% 57% 66% 34% / 57% 36% 64% 43%;
  background: linear-gradient(145deg, color-mix(in srgb, var(--memory-a) 72%, white), color-mix(in srgb, var(--memory-b) 70%, transparent));
  filter: blur(18px);
  opacity: .52;
  animation: memoryBackMorph 11s ease-in-out infinite alternate;
}

.memory-fluid-main {
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.44);
  border-radius: 44% 56% 61% 39% / 51% 40% 60% 49%;
  background:
    radial-gradient(circle at 28% 24%, rgba(255,255,255,.96) 0 6%, rgba(255,255,255,.34) 16%, transparent 32%),
    conic-gradient(from 35deg, var(--memory-a), var(--memory-c) 28%, var(--memory-b) 54%, var(--memory-d) 78%, var(--memory-a));
  box-shadow:
    inset 26px 22px 46px rgba(255,255,255,.46),
    inset -28px -30px 52px rgba(35,89,99,.16),
    0 30px 90px var(--memory-shadow);
  animation: memoryMainMorph 10s cubic-bezier(.55,.05,.45,.95) infinite alternate;
}

.memory-fluid-main::before {
  content: "";
  position: absolute;
  inset: 16%;
  border-radius: 63% 37% 45% 55% / 38% 57% 43% 62%;
  background:
    radial-gradient(circle at 62% 66%, rgba(255,244,224,.54), transparent 42%),
    linear-gradient(145deg, rgba(255,255,255,.26), rgba(85,184,199,.20));
  mix-blend-mode: screen;
  filter: blur(6px);
  animation: memoryInnerFlow 8s ease-in-out infinite alternate;
}

.memory-fluid-main::after {
  content: "";
  position: absolute;
  top: 9%;
  left: 18%;
  width: 36%;
  height: 20%;
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(255,255,255,.52), transparent 70%);
  filter: blur(8px);
  transform: rotate(-24deg);
}

.memory-fluid-light {
  inset: 27%;
  z-index: 3;
  border-radius: 54% 46% 38% 62% / 42% 58% 42% 58%;
  background: radial-gradient(circle at 42% 38%, rgba(255,255,255,.68), rgba(170,228,228,.24) 36%, transparent 72%);
  mix-blend-mode: screen;
  filter: blur(3px);
  animation: memoryLightBreathe 6s ease-in-out infinite;
}

.memory-core {
  top: 50%;
  left: 50%;
  z-index: 4;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  background: rgba(250,255,252,.95);
  box-shadow: 0 0 18px 6px rgba(204,246,245,.72), 0 0 52px 18px rgba(120,211,216,.22);
  animation: memoryCorePulse 3.8s ease-in-out infinite;
}

@keyframes memoryFloat {
  0%, 100% { transform: translate(-50%, -50%) rotate(-2deg) translateY(0); }
  50% { transform: translate(-50%, -50%) rotate(2deg) translateY(-12px); }
}

@keyframes memoryMainMorph {
  0% { border-radius: 44% 56% 61% 39% / 51% 40% 60% 49%; transform: rotate(-7deg) scale(.98); }
  35% { border-radius: 58% 42% 47% 53% / 38% 59% 41% 62%; transform: rotate(1deg) scale(1.015); }
  68% { border-radius: 37% 63% 55% 45% / 61% 44% 56% 39%; transform: rotate(7deg) scale(.99); }
  100% { border-radius: 52% 48% 35% 65% / 46% 63% 37% 54%; transform: rotate(12deg) scale(1.02); }
}

@keyframes memoryBackMorph {
  0% { border-radius: 43% 57% 66% 34% / 57% 36% 64% 43%; transform: rotate(0deg) scale(.98); }
  100% { border-radius: 61% 39% 42% 58% / 35% 62% 38% 65%; transform: rotate(-18deg) scale(1.08); }
}

@keyframes memoryInnerFlow {
  0% { transform: translate(-10%, -7%) rotate(-8deg) scale(.92); opacity: .58; }
  100% { transform: translate(12%, 10%) rotate(16deg) scale(1.16); opacity: .94; }
}

@keyframes memoryLightBreathe {
  0%, 100% { transform: scale(.84) rotate(-10deg); opacity: .46; }
  50% { transform: scale(1.18) rotate(10deg); opacity: .84; }
}

@keyframes memoryCorePulse {
  0%, 100% { transform: translate(-50%, -50%) scale(.82); opacity: .72; }
  50% { transform: translate(-50%, -50%) scale(1.18); opacity: 1; }
}

@keyframes memoryOrbitOuter {
  from { transform: translate(-50%, -50%) rotate(-18deg); }
  to { transform: translate(-50%, -50%) rotate(342deg); }
}

@keyframes memoryOrbitInner {
  from { transform: translate(-50%, -50%) rotate(28deg); }
  to { transform: translate(-50%, -50%) rotate(388deg); }
}

@keyframes auroraDrift {
  0% { transform: translate3d(-3%, -2%, 0) rotate(-3deg) scale(1); }
  100% { transform: translate3d(4%, 3%, 0) rotate(5deg) scale(1.12); }
}

@keyframes atmosphereShimmer {
  0% { opacity: .18; transform: translateX(-2%); }
  100% { opacity: .38; transform: translateX(2%); }
}

.cover-overlay {
  background: linear-gradient(180deg, rgba(15,29,34,.01), rgba(15,29,34,.04) 54%, rgba(15,25,27,.48)) !important;
}

.cover-vignette {
  background: radial-gradient(ellipse at 50% 40%, transparent 34%, rgba(15,28,32,.10) 70%, rgba(12,22,25,.30) 100%) !important;
}

.cover-content {
  padding: 0 24px 10vh;
}

.cover-title {
  margin-bottom: 10px;
  color: #fff;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "PingFang SC", sans-serif;
  font-size: clamp(34px, 5vw, 56px);
  font-weight: 720;
  letter-spacing: 0.08em;
  text-shadow: 0 4px 30px rgba(26, 39, 40, 0.28);
}

.cover-subtitle {
  margin-bottom: 36px;
  color: rgba(255,255,255,0.82);
  font-size: 14px;
  font-weight: 450;
  letter-spacing: 0.1em;
  text-shadow: 0 2px 16px rgba(26,39,40,0.24);
}

.cover-hint {
  padding: 10px 16px;
  border: 1px solid rgba(255,255,255,0.26);
  border-radius: 999px;
  background: rgba(255,255,255,0.12);
  backdrop-filter: blur(14px);
  color: rgba(255,255,255,0.88);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-shadow: none;
}

/* App shell */
#mainApp {
  min-height: 100svh;
  padding-bottom: calc(118px + env(safe-area-inset-bottom));
}

.section {
  max-width: 1120px;
  padding: 28px 32px 54px;
}

.section-header {
  position: relative;
  min-height: 150px;
  padding: 42px 4px 32px;
  text-align: left;
}

.section-header::before {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  margin-bottom: 14px;
  padding: 5px 11px;
  border: 1px solid rgba(49, 66, 63, 0.10);
  border-radius: 999px;
  background: rgba(255,255,255,0.48);
  color: var(--ink-2);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.13em;
  backdrop-filter: blur(12px);
}

#sectionTimeline .section-header::before { content: "LIFE ARCHIVE"; }
#sectionDiary .section-header::before { content: "TODAY & EVERY DAY"; }
#sectionAnniversary .section-header::before { content: "MILESTONES"; }
#sectionStats .section-header::before { content: "YOUR PATTERNS"; }
#sectionMe .section-header::before { content: "PRIVATE SPACE"; }
#sectionBucket .section-header::before { content: "NEXT CHAPTER"; }

.section-header::after {
  content: "";
  position: absolute;
  top: 22px;
  right: 42px;
  width: 112px;
  height: 112px;
  border-radius: 52% 48% 38% 62% / 43% 38% 62% 57%;
  z-index: -1;
  background:
    radial-gradient(circle at 30% 25%, rgba(255,255,255,.92), transparent 24%),
    linear-gradient(145deg, rgba(166,220,228,.60), rgba(255,220,176,.58));
  box-shadow: inset 14px 12px 24px rgba(255,255,255,.46), 0 18px 48px rgba(73,111,111,.10);
  transform: rotate(16deg);
}

#sectionAnniversary .section-header::after {
  background: linear-gradient(145deg, rgba(244,185,172,.60), rgba(219,203,232,.66));
}

#sectionStats .section-header::after {
  background: linear-gradient(145deg, rgba(176,212,199,.64), rgba(198,202,232,.64));
}

#sectionBucket .section-header::after {
  background: linear-gradient(145deg, rgba(255,211,150,.64), rgba(182,221,215,.60));
}

.section-header h2,
.stage-label h2,
.calendar-nav h3,
.diary-entry-date,
.modal h3,
.profile-name,
.anniversary-card-title,
.anniversary-summary-label,
.bucket-progress-label,
.chart-card h3,
.profile-section h4 {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "PingFang SC",
    "Microsoft YaHei", sans-serif !important;
}

.section-header h2 {
  max-width: 76%;
  margin: 0 0 8px;
  color: var(--ink);
  font-size: clamp(32px, 5vw, 48px);
  font-weight: 760;
  letter-spacing: -0.055em;
  line-height: 1.08;
}

.section-header p {
  max-width: 68%;
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 450;
  letter-spacing: 0;
}

.header-search {
  top: 44px;
  right: 4px;
  width: 46px;
  height: 46px;
  border: 1px solid rgba(255,255,255,0.72);
  background: rgba(255,255,255,0.58);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(16px);
}

/* Bottom navigation */
.nav-dial {
  left: 50%;
  bottom: calc(16px + env(safe-area-inset-bottom));
  width: min(680px, calc(100vw - 24px));
  gap: 3px;
  padding: 7px;
  border: 1px solid rgba(255,255,255,0.74);
  border-radius: 27px;
  background: rgba(248,250,249,0.74);
  box-shadow: 0 18px 52px rgba(32,49,46,0.16), inset 0 1px rgba(255,255,255,0.9);
  backdrop-filter: blur(24px) saturate(1.3);
}

.nav-knob {
  display: none;
}

.nav-item {
  flex: 1 1 0;
  min-width: 0;
  min-height: 58px;
  gap: 3px;
  padding: 7px 4px;
  border-radius: 20px;
  color: var(--ink-3);
  font-family: inherit;
}

.nav-item .nav-icon {
  width: 22px;
  height: 22px;
  font-size: 20px;
}

.nav-item .nav-icon svg {
  width: 21px;
  height: 21px;
  stroke-width: 1.9;
}

.nav-item .nav-label,
.nav-item:hover .nav-label {
  opacity: 1;
  font-size: 10px;
  font-weight: 620;
  letter-spacing: 0;
}

.nav-item.active {
  background: var(--primary-dark);
  color: #fff;
  box-shadow: 0 8px 22px rgba(49,66,63,0.22);
}

.nav-item.active .nav-icon {
  transform: none;
}

.fab {
  right: max(22px, calc((100vw - 1120px) / 2 + 24px));
  bottom: calc(94px + env(safe-area-inset-bottom));
  width: 56px;
  height: 56px;
  border: 1px solid rgba(255,255,255,.24);
  background: var(--primary-dark);
  box-shadow: var(--shadow-float);
  font-size: 24px;
}

.fab:hover {
  transform: translateY(-3px);
  box-shadow: 0 24px 60px rgba(32,49,46,0.24);
}

/* Shared surfaces */
.experience-card,
.diary-entry,
.anniversary-card,
.anniversary-add-card,
.chart-card,
.capsule-card,
.observer-card,
.profile-card,
.profile-section,
.bucket-wish-card,
.bucket-progress-card,
.onthisday-card,
.search-panel,
.modal,
.modal-box {
  border: 1px solid rgba(255,255,255,0.80) !important;
  background: var(--surface) !important;
  box-shadow: var(--shadow-sm) !important;
  backdrop-filter: blur(22px) saturate(1.12);
}

.btn {
  min-height: 44px;
  padding: 10px 18px;
  border-radius: 14px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 650;
  letter-spacing: 0;
}

.btn-save {
  background: var(--primary-dark);
  box-shadow: 0 8px 20px rgba(49,66,63,0.16);
}

.btn-save:hover {
  transform: translateY(-1px);
  box-shadow: 0 11px 28px rgba(49,66,63,0.22);
}

.btn-cancel {
  border-color: var(--line);
  background: rgba(255,255,255,0.46);
  color: var(--ink-2);
}

.btn-danger {
  background: var(--danger);
  box-shadow: none;
}

/* Timeline */
.timeline {
  max-width: 860px;
  margin: 0 auto;
  padding-top: 6px;
}

.timeline::before {
  left: 20px;
  top: 36px;
  width: 1px;
  background: linear-gradient(180deg, var(--primary), rgba(88,111,107,0.05));
  opacity: 0.34;
}

.life-stage {
  margin-bottom: 56px;
}

.stage-label {
  padding-left: 62px;
  text-align: left;
  margin-bottom: 22px;
}

.stage-label .dot {
  position: absolute;
  top: 7px;
  left: 13px;
  width: 15px;
  height: 15px;
  margin: 0;
  border: 4px solid var(--app-bg);
  background: var(--primary-dark);
  box-shadow: 0 0 0 1px rgba(49,66,63,0.24);
}

.stage-label h2 {
  color: var(--ink);
  font-size: 24px;
  font-weight: 720;
  letter-spacing: -0.035em;
}

.experience-card,
.experience-card:nth-child(odd),
.experience-card:nth-child(even) {
  width: calc(100% - 64px);
  margin: 0 0 14px 64px;
  padding: 24px;
  border-radius: var(--radius-lg);
  transition: transform .22s ease, box-shadow .22s ease, background .22s ease;
}

.experience-card:hover {
  transform: translateY(-2px);
  background: rgba(255,255,255,0.90) !important;
  box-shadow: var(--shadow-md) !important;
}

.experience-card::before {
  left: -44px !important;
  right: auto !important;
  width: 44px;
  height: 1px;
  background: rgba(49,66,63,0.14);
}

.card-date {
  margin-bottom: 12px;
  padding: 5px 10px;
  background: rgba(88,111,107,0.09);
  color: var(--primary-dark);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: .02em;
}

.card-title {
  color: var(--ink);
  font-family: inherit;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.025em;
}

.card-text {
  color: var(--ink-2);
  font-size: 14px;
  line-height: 1.75;
}

.card-actions,
.bucket-item-actions {
  opacity: 1;
}

.card-action-btn,
.bucket-item-actions button {
  min-width: 36px;
  min-height: 36px;
  border-radius: 11px;
  background: rgba(49,66,63,0.06);
}

.stage-tabs {
  position: sticky;
  top: calc(10px + env(safe-area-inset-top));
  z-index: 12;
  display: grid;
  grid-template-columns: minmax(170px, .72fr) minmax(0, 2fr);
  align-items: center;
  width: calc(100% - 64px);
  max-width: none;
  gap: 18px;
  margin: 0 0 22px 64px;
  padding: 10px 12px 10px 18px;
  border: 1px solid rgba(255,255,255,0.82);
  border-radius: 22px;
  background:
    linear-gradient(110deg, rgba(255,255,255,.78), rgba(244,248,247,.66));
  box-shadow:
    0 16px 42px rgba(49,66,63,0.09),
    inset 0 1px 0 rgba(255,255,255,0.82);
  backdrop-filter: blur(22px) saturate(1.18);
  -webkit-backdrop-filter: blur(22px) saturate(1.18);
}

.stage-tabs::before {
  content: "";
  position: absolute;
  top: 50%;
  left: -52px;
  width: 10px;
  height: 10px;
  border: 3px solid var(--app-bg);
  border-radius: 50%;
  background: var(--primary-dark);
  box-shadow: 0 0 0 1px rgba(49,66,63,.22);
  transform: translateY(-50%);
}

.stage-tab-list {
  display: flex;
  flex-wrap: wrap;
  min-width: 0;
  gap: 4px;
  padding: 4px;
  border-radius: 18px;
  background: rgba(49,66,63,.05);
  overflow: visible;
}

.stage-tab {
  flex: 0 0 auto;
  max-width: 100%;
  min-height: 36px;
  padding: 7px 13px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-2);
  font-family: inherit;
  font-weight: 600;
  overflow: hidden;
  box-shadow: none;
  backdrop-filter: none;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: background-color .2s ease, color .2s ease, box-shadow .2s ease, transform .2s ease;
}

.stage-tab:hover {
  background: rgba(49,66,63,0.07);
  color: var(--ink);
}

.stage-tab.active {
  background: var(--primary-dark);
  color: white;
  box-shadow: 0 8px 20px rgba(49,66,63,0.18);
}

.stage-tab.active:hover {
  background: var(--primary-dark);
  color: white;
}

/* Chronicle hierarchy: life stage → year → month on each memory card */
.chronicle-intro {
  display: grid;
  min-width: 0;
  gap: 1px;
  max-width: none;
  margin: 0;
  padding: 0;
  color: var(--ink-3);
}

.chronicle-intro span {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--primary-dark);
  font-size: 17px;
  font-weight: 760;
  line-height: 1.3;
  letter-spacing: .02em;
}

.chronicle-intro p {
  overflow: hidden;
  font-size: 11px;
  line-height: 1.45;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.life-stage.is-collapsed {
  margin-bottom: 14px;
}

.life-stage.is-collapsed .stage-label {
  margin-bottom: 0;
}

.stage-label {
  min-height: 66px;
  padding-left: 62px;
}

.stage-label .dot {
  top: 25px;
}

.stage-toggle {
  display: grid;
  grid-template-columns: minmax(150px, auto) minmax(0, 1fr) 30px;
  align-items: center;
  gap: 16px;
  width: 100%;
  min-height: 62px;
  padding: 10px 14px 10px 16px;
  border: 1px solid rgba(255,255,255,.76);
  border-radius: 20px;
  background: rgba(255,255,255,.52);
  color: var(--ink);
  box-shadow: 0 5px 20px rgba(34,51,48,.04);
  text-align: left;
  cursor: pointer;
  backdrop-filter: blur(16px);
  transition: background .2s ease, transform .2s ease, box-shadow .2s ease;
}

.stage-toggle:hover {
  transform: translateY(-1px);
  background: rgba(255,255,255,.76);
  box-shadow: var(--shadow-sm);
}

.life-stage.is-open .stage-toggle {
  border-color: rgba(49,66,63,.13);
  background: rgba(255,255,255,.78);
}

.stage-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

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

.stage-title {
  overflow: hidden;
  color: var(--ink);
  font-size: 19px;
  font-weight: 740;
  letter-spacing: -.025em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stage-summary {
  overflow: hidden;
  color: var(--ink-3);
  font-size: 12px;
  font-weight: 560;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chronicle-chevron {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(49,66,63,.055);
  color: var(--ink-2);
  font-size: 18px;
  line-height: 1;
  transition: transform .24s ease, background .2s ease;
}

.life-stage.is-open > .stage-label .chronicle-chevron,
.chronicle-year.is-open > .chronicle-year-toggle .chronicle-chevron {
  transform: rotate(180deg);
  background: rgba(88,111,107,.11);
}

.chronicle-years {
  display: grid;
  gap: 14px;
  margin-left: 64px;
}

.chronicle-year {
  position: relative;
  scroll-margin-top: 136px;
}

.chronicle-year::before {
  content: "";
  position: absolute;
  top: 28px;
  left: -44px;
  width: 44px;
  height: 1px;
  background: rgba(49,66,63,.13);
}

.chronicle-year-toggle {
  display: grid;
  grid-template-columns: minmax(118px, auto) minmax(0, 1fr) 30px;
  align-items: center;
  gap: 16px;
  width: 100%;
  min-height: 58px;
  padding: 9px 12px 9px 18px;
  border: 1px solid rgba(255,255,255,.76);
  border-radius: 18px;
  background: rgba(246,249,248,.62);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  backdrop-filter: blur(14px);
  transition: background .2s ease, border-color .2s ease;
}

.chronicle-year-toggle:hover,
.chronicle-year.is-open > .chronicle-year-toggle {
  border-color: rgba(49,66,63,.13);
  background: rgba(255,255,255,.82);
}

.chronicle-year.is-open > .chronicle-year-toggle {
  position: sticky;
  top: calc(var(--chronicle-sticky-offset, 78px) + env(safe-area-inset-top));
  z-index: 8;
  background: rgba(249,251,250,.90);
  box-shadow: 0 10px 30px rgba(34,51,48,.10), inset 0 1px rgba(255,255,255,.88);
  backdrop-filter: blur(22px) saturate(1.18);
}

.chronicle-year-number {
  color: var(--ink);
  font-size: 22px;
  font-weight: 760;
  letter-spacing: -.04em;
}

.chronicle-year-number small {
  margin-left: 3px;
  color: var(--ink-3);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0;
}

.chronicle-year-meta {
  color: var(--ink-3);
  font-size: 12px;
  font-weight: 560;
  text-align: right;
}

.chronicle-year-content {
  display: grid;
  gap: 12px;
  padding-top: 12px;
}

.chronicle-year-content .experience-card,
.chronicle-year-content .experience-card:nth-child(odd),
.chronicle-year-content .experience-card:nth-child(even) {
  width: 100%;
  margin: 0;
}

.chronicle-card-date {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  margin-bottom: 12px;
}

.chronicle-card-date .card-date {
  flex: 0 0 auto;
  margin-bottom: 0;
}

.chronicle-original-date {
  overflow: hidden;
  color: var(--ink-3);
  font-size: 12px;
  font-weight: 560;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Diary — the most emotion-forward page */
#sectionDiary.active {
  display: grid;
  grid-template-columns: minmax(330px, .82fr) minmax(0, 1.18fr);
  column-gap: 24px;
  align-items: start;
}

#sectionDiary .section-header {
  grid-column: 1 / -1;
}

.diary-calendar {
  position: sticky;
  top: 16px;
  margin: 0;
  padding: 22px;
  border: 1px solid rgba(255,255,255,.80);
  border-radius: var(--radius-lg);
  background: rgba(255,255,255,.58);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(22px);
}

.calendar-nav {
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 16px;
}

.calendar-nav h3 {
  color: var(--ink);
  font-size: 17px;
  font-weight: 720;
  letter-spacing: -0.02em;
}

.calendar-nav button {
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.62);
  color: var(--ink);
  box-shadow: none;
}

.calendar-grid {
  gap: 5px;
}

.calendar-weekday {
  color: var(--ink-3);
  font-size: 10px;
  font-weight: 680;
  letter-spacing: .04em;
}

.calendar-day {
  border-width: 1px;
  border-radius: 50%;
  color: var(--ink-2);
  font-size: 13px;
}

.calendar-day.has-diary {
  background: rgba(255,255,255,.80);
  box-shadow: inset 0 0 0 1px rgba(49,66,63,.06);
}

.calendar-day.today {
  border-color: var(--primary);
  color: var(--primary-dark);
}

.calendar-day.selected {
  border-color: var(--primary-dark);
  background: var(--primary-dark);
  color: white;
  box-shadow: 0 8px 16px rgba(49,66,63,.18);
}

.diary-entry {
  min-height: 430px;
  padding: 28px;
  border-radius: var(--radius-xl);
  overflow: hidden;
}

.diary-edit {
  background:
    radial-gradient(circle at 90% 8%, rgba(168,216,229,.42), transparent 30%),
    radial-gradient(circle at 4% 92%, rgba(255,218,175,.34), transparent 34%),
    rgba(255,255,255,.74) !important;
}

.diary-edit::before {
  content: "";
  position: absolute;
  top: -52px;
  right: -34px;
  width: 170px;
  height: 170px;
  border-radius: 45% 55% 62% 38% / 48% 40% 60% 52%;
  background:
    radial-gradient(circle at 30% 24%, rgba(255,255,255,.92), transparent 22%),
    conic-gradient(from 25deg, rgba(127,202,216,.72), rgba(255,255,255,.80), rgba(244,188,126,.62), rgba(127,202,216,.72));
  box-shadow: inset 16px 14px 26px rgba(255,255,255,.58), 0 18px 54px rgba(81,133,138,.16);
  opacity: .72;
  transform: rotate(18deg);
}

.diary-entry > * {
  position: relative;
  z-index: 1;
}

.diary-entry-header {
  margin-bottom: 22px;
}

.diary-entry-date {
  color: var(--ink);
  font-size: 20px;
  font-weight: 720;
  letter-spacing: -0.03em;
}

.diary-entry-mood {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 1px solid rgba(255,255,255,.76);
  border-radius: 50%;
  background: rgba(255,255,255,.58);
  box-shadow: 0 10px 28px rgba(49,66,63,.10);
  font-size: 23px;
  backdrop-filter: blur(12px);
}

.diary-edit .mood-selector {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 22px;
  padding: 13px;
  border: 1px solid rgba(255,255,255,.72);
  border-radius: 24px;
  background: rgba(238,244,243,.52);
  backdrop-filter: blur(18px);
}

.diary-edit .mood-option {
  width: 100%;
  height: 54px;
  border: 1px solid rgba(255,255,255,.72);
  border-radius: 18px;
  background: rgba(255,255,255,.52);
  box-shadow: inset 0 1px rgba(255,255,255,.72);
  font-size: 23px;
}

.diary-edit .mood-option:hover {
  border-color: rgba(88,111,107,.18);
  transform: translateY(-2px);
}

.diary-edit .mood-option.selected {
  border-color: rgba(49,66,63,.16);
  background:
    radial-gradient(circle at 50% 44%, rgba(255,255,255,.96), rgba(174,222,225,.72) 58%, rgba(244,194,137,.54));
  box-shadow: 0 12px 28px rgba(62,108,109,.16), inset 0 1px rgba(255,255,255,.88);
  animation: moodBreathe 2.8s ease-in-out infinite;
}

.diary-textarea {
  min-height: 190px;
  padding: 18px;
  border: 1px solid rgba(49,66,63,.10);
  border-radius: 20px;
  background: rgba(255,255,255,.60);
  color: var(--ink);
  font-family: inherit;
  font-size: 15px;
  line-height: 1.8;
  outline: none;
  resize: vertical;
}

.diary-textarea:focus {
  border-color: rgba(88,111,107,.34);
  box-shadow: 0 0 0 4px rgba(88,111,107,.08);
}

.diary-view-text {
  color: var(--ink-2);
  font-family: inherit;
  font-size: 15px;
  line-height: 1.9;
}

.photo-wake-btn {
  min-height: 42px;
  padding: 9px 14px;
  border: 1px dashed rgba(49,66,63,.18);
  border-radius: 13px;
  background: rgba(255,255,255,.46);
  color: var(--ink-2);
  font-family: inherit;
  font-weight: 600;
}

.diary-actions {
  gap: 10px;
  margin-top: 22px;
}

/* Tags and inputs */
.tag-input-row,
.form-group input,
.form-group textarea,
.form-group select,
.anniversary-form input,
.anniversary-form select,
.bucket-add-row input {
  border: 1px solid rgba(49,66,63,.11) !important;
  border-radius: 15px !important;
  background: rgba(255,255,255,.68) !important;
  color: var(--ink) !important;
  font-family: inherit !important;
  box-shadow: inset 0 1px 1px rgba(49,66,63,.02);
}

.tag-input-row:focus-within,
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus,
.anniversary-form input:focus,
.anniversary-form select:focus {
  border-color: rgba(88,111,107,.38) !important;
  box-shadow: 0 0 0 4px rgba(88,111,107,.08) !important;
}

.tag-pill {
  border-radius: 999px;
  font-family: inherit;
  font-size: 11px;
  font-weight: 650;
}

/* Anniversary */
#anniversaryContent {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.anniversary-summary,
.anniversary-add-card,
.anniversary-empty {
  grid-column: 1 / -1;
}

.anniversary-summary {
  position: relative;
  overflow: hidden;
  margin: 0;
  padding: 24px;
  border: 1px solid rgba(255,255,255,.76);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(circle at 90% 10%, rgba(244,185,172,.42), transparent 35%),
    linear-gradient(135deg, rgba(255,255,255,.68), rgba(226,219,238,.58));
}

.anniversary-summary-label {
  color: var(--ink);
  font-size: 17px;
  font-weight: 720;
}

.anniversary-add-card,
.anniversary-card {
  margin: 0;
  border-radius: var(--radius-lg);
}

.anniversary-add-card {
  padding: 14px;
}

.anniversary-add-trigger {
  min-height: 58px;
  display: grid;
  place-items: center;
  border-color: rgba(49,66,63,.14);
  border-radius: 18px;
  color: var(--ink-2);
  font-weight: 620;
}

.anniversary-card {
  padding: 20px;
}

.anniversary-card-title {
  color: var(--ink);
  font-size: 17px;
  font-weight: 720;
  letter-spacing: -0.025em;
}

.anniversary-card-icon {
  background: linear-gradient(145deg, rgba(255,255,255,.78), rgba(240,209,207,.58));
  box-shadow: inset 0 1px rgba(255,255,255,.8);
}

.anniversary-card-status {
  background: rgba(243, 188, 131, .16);
  color: #895e32;
  font-weight: 650;
}

.anniversary-card-actions button {
  min-height: 38px;
  padding: 8px 12px;
  border-radius: 12px;
  background: rgba(49,66,63,.06);
  color: var(--primary-dark);
  font-family: inherit;
  font-weight: 600;
}

/* Statistics */
#statsContent {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.stats-grid {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}

.stat-card {
  min-height: 154px;
  padding: 20px 16px;
  border: 1px solid rgba(255,255,255,.78);
  border-radius: 24px;
  background: rgba(255,255,255,.58);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(18px);
}

.stat-card:nth-child(1) { background: linear-gradient(145deg, rgba(207,233,237,.76), rgba(255,255,255,.62)); }
.stat-card:nth-child(2) { background: linear-gradient(145deg, rgba(255,225,190,.76), rgba(255,255,255,.62)); }
.stat-card:nth-child(3) { background: linear-gradient(145deg, rgba(226,219,238,.78), rgba(255,255,255,.62)); }
.stat-card:nth-child(4) { background: linear-gradient(145deg, rgba(212,232,225,.78), rgba(255,255,255,.62)); }
.stat-card:nth-child(5) { background: linear-gradient(145deg, rgba(245,214,211,.76), rgba(255,255,255,.62)); }

.stat-icon {
  margin-bottom: 14px;
  font-size: 23px;
}

.stat-value {
  color: var(--ink);
  font-family: inherit;
  font-size: 30px;
  font-weight: 760;
  letter-spacing: -0.04em;
}

.stat-label {
  color: var(--ink-2);
  font-size: 11px;
  font-weight: 650;
}

.chart-card,
.capsule-card,
.observer-card {
  margin: 0;
  padding: 24px;
  border-radius: var(--radius-lg);
}

.chart-card h3 {
  color: var(--ink);
  font-size: 17px;
  font-weight: 720;
  letter-spacing: -0.02em;
}

.observer-card {
  background:
    radial-gradient(circle at 92% 8%, rgba(167,215,226,.38), transparent 34%),
    radial-gradient(circle at 6% 94%, rgba(255,211,159,.32), transparent 36%),
    rgba(255,255,255,.70) !important;
}

.observer-settings {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255,255,255,.64);
}

/* Bucket list */
#bucketContent {
  max-width: 820px;
  margin: 0 auto;
}

.bucket-progress-card {
  position: relative;
  overflow: hidden;
  margin-bottom: 16px;
  padding: 24px;
  border-radius: var(--radius-lg);
  background:
    radial-gradient(circle at 88% 10%, rgba(255,211,151,.48), transparent 38%),
    linear-gradient(145deg, rgba(255,255,255,.72), rgba(207,232,226,.56)) !important;
}

.bucket-progress-label {
  color: var(--ink);
  font-size: 18px;
  font-weight: 720;
}

.bucket-progress {
  height: 9px;
  background: rgba(49,66,63,.08);
}

.bucket-progress-bar {
  background: linear-gradient(90deg, var(--primary), #8ab8ae, var(--peach));
}

.bucket-wish-card {
  padding: 14px;
  border-radius: var(--radius-lg);
}

.bucket-wish-trigger {
  min-height: 62px;
  display: grid;
  place-items: center;
  border-color: rgba(49,66,63,.14);
  border-radius: 18px;
  color: var(--ink-2);
  font-weight: 650;
}

.bucket-item {
  margin-bottom: 8px;
  padding: 16px;
  border: 1px solid rgba(255,255,255,.74);
  border-radius: 20px;
  background: rgba(255,255,255,.54);
  box-shadow: 0 4px 18px rgba(34,51,48,.035);
  backdrop-filter: blur(16px);
}

.bucket-check {
  width: 28px;
  height: 28px;
  border-color: rgba(49,66,63,.18);
}

.bucket-item.done .bucket-check {
  border-color: var(--primary-dark);
  background: var(--primary-dark);
}

/* Profile */
#meContent {
  max-width: 760px;
  margin: 0 auto;
}

.profile-card {
  position: relative;
  overflow: hidden;
  padding: 38px 28px;
  border-radius: var(--radius-xl);
  background:
    radial-gradient(circle at 86% 12%, rgba(202,196,224,.52), transparent 32%),
    radial-gradient(circle at 8% 92%, rgba(169,217,226,.40), transparent 35%),
    rgba(255,255,255,.70) !important;
}

.profile-avatar {
  display: grid;
  place-items: center;
  width: 82px;
  height: 82px;
  margin: 0 auto 14px;
  border: 1px solid rgba(255,255,255,.80);
  border-radius: 28px;
  background: rgba(255,255,255,.62);
  box-shadow: 0 18px 40px rgba(49,66,63,.10), inset 0 1px rgba(255,255,255,.9);
}

.profile-name {
  color: var(--ink);
  font-size: 24px;
  font-weight: 740;
  letter-spacing: -0.035em;
}

.profile-section {
  margin-top: 16px;
  padding: 12px;
  border-radius: var(--radius-lg);
}

.profile-section h4 {
  padding: 8px 10px 10px;
  color: var(--ink-3);
  font-size: 11px;
  font-weight: 720;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.profile-btn {
  min-height: 56px;
  margin: 2px 0;
  border-radius: 16px;
  background: transparent;
  color: var(--ink);
  font-family: inherit;
  font-weight: 600;
}

.profile-btn:hover {
  background: rgba(49,66,63,.055);
}

/* Modal and search */
.modal-overlay {
  padding: 20px;
  background: rgba(34,46,44,.38);
  backdrop-filter: blur(14px);
}

.modal,
.modal-box {
  padding: 30px;
  border-radius: 30px;
  background: rgba(250,252,251,.90) !important;
  box-shadow: var(--shadow-float) !important;
}

.modal h3 {
  margin-bottom: 24px;
  color: var(--ink);
  font-size: 23px;
  font-weight: 740;
  letter-spacing: -0.035em;
}

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

.form-group label {
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 680;
  letter-spacing: .01em;
}

.form-group input,
.form-group textarea,
.form-group select {
  min-height: 48px;
  padding: 12px 14px;
}

.search-panel {
  border-radius: 28px;
  background: rgba(250,252,251,.90) !important;
}

.search-bar {
  min-height: 64px;
  border-color: var(--line);
}

.search-bar input {
  color: var(--ink);
  font-family: inherit;
}

.search-result {
  border-radius: 16px;
  background: rgba(49,66,63,.045);
}

.empty-state {
  padding: 64px 24px;
}

.empty-state .empty-icon {
  display: grid;
  place-items: center;
  width: 76px;
  height: 76px;
  margin: 0 auto 18px;
  border-radius: 26px;
  background: linear-gradient(145deg, rgba(255,255,255,.78), rgba(196,226,226,.60));
  box-shadow: var(--shadow-sm);
  opacity: 1;
  font-size: 30px;
}

.empty-state h3 {
  color: var(--ink);
  font-family: inherit;
  font-weight: 700;
}

.save-toast {
  bottom: calc(100px + env(safe-area-inset-bottom));
  border: 1px solid rgba(255,255,255,.16);
  background: rgba(38,49,47,.90);
  box-shadow: var(--shadow-float);
  backdrop-filter: blur(16px);
}

/* PWA 安装/更新是需要用户明确确认的操作，不能沿用保存提示的自动淡出动画。 */
.pwa-action-toast {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
  animation: none !important;
  width: min(520px, calc(100vw - 32px));
  padding: 12px 14px;
  letter-spacing: 0;
}

.pwa-action-toast > span {
  flex: 1 1 auto;
  min-width: 0;
}

.pwa-action-confirm,
.pwa-action-dismiss {
  flex: 0 0 auto;
  border: 0;
  border-radius: 999px;
  padding: 7px 10px;
  font: inherit;
  font-size: 13px;
  white-space: nowrap;
  cursor: pointer;
}

.pwa-action-confirm {
  background: #fff;
  color: #34514d;
  font-weight: 700;
}

.pwa-action-dismiss {
  background: transparent;
  color: rgba(255,255,255,.76);
}

/* Android PWA 允许 label 原生触发文件选择；避免隐藏 input 的脚本 click() 被系统拦截。 */
.native-photo-input {
  position: fixed;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.native-photo-label {
  display: block;
  cursor: pointer;
}

/* Every online AI request requires a fresh, explicit disclosure. */
.ai-consent-dialog {
  max-width: 500px;
}

.ai-consent-heading {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
}

.ai-consent-icon {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 50px;
  height: 50px;
  border: 1px solid rgba(255,255,255,.82);
  border-radius: 17px;
  background: linear-gradient(145deg, rgba(190,225,229,.80), rgba(255,218,175,.72));
  box-shadow: var(--shadow-sm);
  font-size: 22px;
}

.ai-consent-badge {
  display: inline-flex;
  margin-bottom: 4px;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(88,111,107,.09);
  color: var(--primary-dark);
  font-size: 10px;
  font-weight: 720;
  letter-spacing: .06em;
}

.ai-consent-dialog #aiConsentTitle {
  margin: 0;
  color: var(--ink);
  font-size: 21px;
  text-align: left;
}

.ai-consent-summary {
  margin-bottom: 14px;
  color: var(--ink-2);
  font-size: 13px;
  line-height: 1.7;
}

.ai-data-panel {
  padding: 16px;
  border: 1px solid rgba(49,66,63,.09);
  border-radius: 18px;
  background: rgba(239,244,243,.64);
}

.ai-data-title {
  margin-bottom: 9px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 720;
}

.ai-data-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.ai-data-list li {
  position: relative;
  padding-left: 18px;
  color: var(--ink-2);
  font-size: 12px;
  line-height: 1.55;
}

.ai-data-list li::before {
  content: "✓";
  position: absolute;
  top: 0;
  left: 0;
  color: var(--primary);
  font-weight: 800;
}

.ai-privacy-note {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 15px;
  background: rgba(255,226,190,.36);
  color: var(--ink-2);
  font-size: 11px;
  line-height: 1.6;
}

.ai-consent-provider {
  margin-top: 11px;
  color: var(--ink-3);
  font-size: 10px;
  line-height: 1.55;
}

.ai-consent-actions {
  margin-top: 20px;
}

.ai-permission-check {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  margin-top: 14px;
  padding: 13px 14px;
  border: 1px solid rgba(49,66,63,.10);
  border-radius: 15px;
  background: rgba(255,255,255,.54);
  color: var(--ink-2);
  font-size: 12px;
  line-height: 1.55;
  cursor: pointer;
}

.ai-permission-check input,
.ai-online-toggle input {
  flex: 0 0 auto;
  width: 19px;
  height: 19px;
  margin-top: 1px;
  accent-color: var(--primary-dark);
  cursor: pointer;
}

#aiPermissionConfirmBtn:disabled {
  opacity: .42;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.ai-permission-setting {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  min-height: 72px;
  padding: 12px 14px;
  border-radius: 17px;
  background: rgba(49,66,63,.035);
}

.ai-permission-setting + .profile-btn {
  margin-top: 4px;
}

.ai-permission-copy {
  min-width: 0;
}

.ai-permission-title-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 680;
}

.ai-permission-status {
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(49,66,63,.07);
  color: var(--ink-3);
  font-size: 9px;
  font-weight: 720;
}

.ai-permission-status.is-enabled {
  background: rgba(91,151,125,.13);
  color: #46745f;
}

.ai-permission-desc {
  margin-top: 3px;
  color: var(--ink-3);
  font-size: 11px;
  line-height: 1.45;
}

.ai-online-toggle {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(255,255,255,.72);
  border-radius: 14px;
  background: rgba(255,255,255,.58);
  cursor: pointer;
}

@media (max-width: 900px) {
  #sectionDiary.active {
    display: block;
  }

  .diary-calendar {
    position: static;
    margin-bottom: 18px;
  }

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

@media (max-width: 720px) {
  .section {
    padding: 18px 16px 40px;
  }

  .stage-tabs {
    position: relative;
    top: auto;
    grid-template-columns: 1fr;
    width: calc(100% - 42px);
    max-width: none;
    gap: 7px;
    margin: 0 0 16px 42px;
    padding: 11px;
    border-radius: 18px;
  }

  .stage-tabs::before {
    left: -36px;
  }

  .chronicle-intro {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin: 0;
  }

  .chronicle-intro span {
    padding-left: 7px;
    font-size: 14px;
    white-space: nowrap;
  }

  .chronicle-intro p {
    display: block;
    min-width: 0;
    font-size: 10px;
  }

  .stage-tab-list {
    border-radius: 15px;
  }

  .stage-tab {
    min-height: 34px;
    padding: 6px 10px;
    font-size: 12px;
  }

  .section-header {
    min-height: 134px;
    padding: 30px 2px 24px;
  }

  .section-header::before {
    margin-bottom: 11px;
  }

  .section-header::after {
    top: 16px;
    right: 20px;
    width: 88px;
    height: 88px;
  }

  .section-header h2 {
    max-width: 76%;
    font-size: 34px;
  }

  .section-header p {
    max-width: 74%;
    font-size: 13px;
  }

  .header-search {
    top: 28px;
    right: 0;
    width: 42px;
    height: 42px;
  }

  .nav-dial {
    width: calc(100vw - 16px);
    bottom: calc(8px + env(safe-area-inset-bottom));
    padding: 6px 4px;
    border-radius: 24px;
  }

  .nav-item {
    min-height: 54px;
    padding: 6px 1px;
    border-radius: 18px;
  }

  .nav-item .nav-icon svg {
    width: 19px;
    height: 19px;
  }

  .nav-item .nav-label {
    font-size: 9px;
  }

  .fab {
    right: 18px;
    bottom: calc(82px + env(safe-area-inset-bottom));
    width: 52px;
    height: 52px;
  }

  .experience-card,
  .experience-card:nth-child(odd),
  .experience-card:nth-child(even) {
    width: calc(100% - 42px);
    margin-left: 42px;
    padding: 20px;
    border-radius: 22px;
  }

  .experience-card::before {
    left: -27px !important;
    width: 27px;
  }

  .timeline::before {
    left: 14px;
  }

  .stage-label {
    padding-left: 42px;
  }

  .stage-label .dot {
    top: 24px;
    left: 7px;
  }

  .stage-toggle {
    grid-template-columns: minmax(0, 1fr) 30px;
    gap: 8px;
    padding-left: 14px;
  }

  .stage-summary {
    grid-column: 1;
    grid-row: 2;
    text-align: left;
  }

  .stage-toggle > .chronicle-chevron {
    grid-column: 2;
    grid-row: 1 / span 2;
  }

  .chronicle-years {
    /* iPhone PWA 的可视区域会随安全区变化；同时限定宽度，避免仅靠左边距时右侧贴边。 */
    width: calc(100% - 52px);
    margin-left: 52px;
    min-width: 0;
  }

  .chronicle-year::before {
    left: -27px;
    width: 27px;
  }

  .chronicle-year-toggle {
    grid-template-columns: minmax(90px, auto) minmax(0, 1fr) 30px;
    gap: 8px;
    padding-left: 14px;
  }

  .chronicle-year,
  .chronicle-year-content,
  .chronicle-year-content .experience-card {
    width: 100%;
    min-width: 0;
    max-width: 100%;
  }

  .chronicle-year.is-open > .chronicle-year-toggle {
    top: calc(8px + env(safe-area-inset-top));
  }

  .chronicle-year-number {
    font-size: 19px;
  }

  .chronicle-year-meta {
    font-size: 11px;
  }

  .diary-calendar,
  .diary-entry {
    padding: 18px;
    border-radius: 24px;
  }

  .calendar-grid {
    gap: 2px;
  }

  .calendar-day {
    font-size: 12px;
  }

  .diary-edit .mood-selector {
    gap: 7px;
    padding: 10px;
  }

  .diary-edit .mood-option {
    height: 48px;
    border-radius: 15px;
    font-size: 21px;
  }

  #anniversaryContent,
  #statsContent {
    grid-template-columns: 1fr;
  }

  .anniversary-summary,
  .anniversary-add-card,
  .anniversary-empty,
  .stats-grid {
    grid-column: 1;
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stat-card {
    min-height: 132px;
  }

  .anniversary-card-top {
    gap: 8px;
  }

  .anniversary-photo-area,
  .anniversary-photo-area-seamless,
  .anniversary-photo-area-stamp {
    width: 82px;
  }

  .modal-overlay {
    align-items: flex-end;
    padding: 8px;
  }

  .modal,
  .modal-box {
    max-height: 91svh;
    margin: 0;
    padding: 24px 20px calc(22px + env(safe-area-inset-bottom));
    border-radius: 28px 28px 20px 20px;
  }

  .modal-buttons {
    position: sticky;
    bottom: -1px;
    padding-top: 12px;
    background: linear-gradient(180deg, transparent, rgba(250,252,251,.96) 28%);
  }

  .cover-content {
    padding-bottom: 9vh;
  }

  .cover-title {
    font-size: 34px;
    letter-spacing: .06em;
  }

  .cover-subtitle {
    font-size: 12px;
    letter-spacing: .06em;
    text-align: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

@media print {
  body::before,
  .section-header::after {
    display: none !important;
  }
}
