/* ==================================================================
   我们的小宇宙 —— 样式
   设计意图：暖、软、安静。像一本放在床头的相册。
   ================================================================== */

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

:root {
  --bg: #fdf8f6;
  --bg-warm: #fbe9e4;
  --surface: #ffffff;
  --surface-2: #fffaf8;
  --surface-3: #fbf1ed;
  --ink: #3a2e2a;
  --ink-2: #6d5b55;
  --muted: #9c8981;
  --line: #f2e3dd;
  --line-strong: #e8d3cb;
  --rose: #d1706a;
  --rose-deep: #b05852;
  --rose-soft: #fcebe7;
  --gold: #c6a15b;
  --ok: #5f9e6e;
  --danger: #c9554e;
  --danger-soft: #fdeceb;

  --shadow-sm: 0 1px 2px rgba(120, 70, 60, .05), 0 4px 14px -8px rgba(120, 70, 60, .16);
  --shadow: 0 2px 6px rgba(120, 70, 60, .05), 0 18px 40px -24px rgba(120, 70, 60, .32);
  --shadow-lg: 0 30px 70px -30px rgba(120, 70, 60, .45);

  --r-xs: 10px;
  --r-sm: 14px;
  --r: 20px;
  --r-lg: 28px;

  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);

  --font-body: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
  --font-display: Georgia, "Times New Roman", "Songti SC", "SimSun", serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #15100e;
    --bg-warm: #2a1b18;
    --surface: #201815;
    --surface-2: #241c19;
    --surface-3: #2b211d;
    --ink: #f3e8e3;
    --ink-2: #c8b4ac;
    --muted: #96807a;
    --line: #33261f;
    --line-strong: #453329;
    --rose: #e08a84;
    --rose-deep: #efa39d;
    --rose-soft: #35201e;
    --gold: #d9b878;
    --danger-soft: #3a1f1d;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 14px -8px rgba(0, 0, 0, .5);
    --shadow: 0 2px 6px rgba(0, 0, 0, .3), 0 18px 40px -24px rgba(0, 0, 0, .7);
    --shadow-lg: 0 30px 70px -30px rgba(0, 0, 0, .8);
  }
}

:root[data-theme="dark"] {
  --bg: #15100e;
  --bg-warm: #2a1b18;
  --surface: #201815;
  --surface-2: #241c19;
  --surface-3: #2b211d;
  --ink: #f3e8e3;
  --ink-2: #c8b4ac;
  --muted: #96807a;
  --line: #33261f;
  --line-strong: #453329;
  --rose: #e08a84;
  --rose-deep: #efa39d;
  --rose-soft: #35201e;
  --gold: #d9b878;
  --danger-soft: #3a1f1d;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 14px -8px rgba(0, 0, 0, .5);
  --shadow: 0 2px 6px rgba(0, 0, 0, .3), 0 18px 40px -24px rgba(0, 0, 0, .7);
  --shadow-lg: 0 30px 70px -30px rgba(0, 0, 0, .8);
}

html, body { margin: 0; padding: 0; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior-y: none;
  line-height: 1.6;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(58% 42% at 8% -6%, var(--bg-warm) 0%, transparent 62%),
    radial-gradient(46% 34% at 98% 4%, #f6e5ea 0%, transparent 60%);
  opacity: .9;
  z-index: 0;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) body::before {
    background:
      radial-gradient(58% 42% at 8% -6%, #2a1b18 0%, transparent 62%),
      radial-gradient(46% 34% at 98% 4%, #241820 0%, transparent 60%);
  }
}

img { max-width: 100%; display: block; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }

::selection { background: var(--rose-soft); color: var(--rose-deep); }

/* ==================== 全屏背景照片 ==================== */

.bg-photo {
  position: fixed;
  inset: 0;
  z-index: 0;
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
  opacity: 0;
  pointer-events: none;
  transform: scale(1.05);
  transition: opacity .7s ease;
}
.bg-photo.on { opacity: 1; }
.bg-photo .bg-veil {
  position: absolute;
  inset: 0;
  background: var(--bg);
  opacity: .72;
  transition: opacity .25s;
}

body.has-bg::before { opacity: 0; }
body.has-bg .hero {
  background: color-mix(in srgb, var(--surface) 66%, transparent);
  backdrop-filter: blur(18px) saturate(1.15);
  -webkit-backdrop-filter: blur(18px) saturate(1.15);
  border-color: color-mix(in srgb, var(--line) 55%, transparent);
}
body.has-bg .mcard,
body.has-bg .stat,
body.has-bg .panel {
  background: color-mix(in srgb, var(--surface) 86%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
body.has-bg .bottomnav,
body.has-bg .sidebar,
body.has-bg .mobile-top {
  background: color-mix(in srgb, var(--surface) 62%, transparent);
}

/* 滑块 */
.range-row { display: flex; align-items: center; gap: 14px; margin-top: 4px; }
.range-row .range-label { font-size: 12.5px; color: var(--muted); width: 62px; flex: none; }
.range-row .range-val { font-size: 12px; color: var(--ink-2); width: 40px; text-align: right; flex: none; font-variant-numeric: tabular-nums; }
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  height: 4px;
  border-radius: 4px;
  background: var(--line-strong);
  outline: none;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--rose);
  border: 2px solid var(--surface);
  box-shadow: 0 2px 8px rgba(150, 80, 70, .3);
  cursor: pointer;
}
input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--rose);
  border: 2px solid var(--surface);
  cursor: pointer;
}

.bg-preview {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 7;
  border-radius: var(--r-sm);
  overflow: hidden;
  background: var(--surface-3);
  border: 1px solid var(--line);
  margin-bottom: 12px;
}
.bg-preview img { width: 100%; height: 100%; object-fit: cover; }
.bg-preview .none {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 13px;
  color: var(--muted);
}

/* 细滚动条 */
* { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 8px; }
*::-webkit-scrollbar-track { background: transparent; }

/* ==================== 启动 ==================== */

.boot {
  position: fixed;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 18px;
  justify-items: center;
  z-index: 90;
  background: var(--bg);
}
.boot-heart {
  font-size: 42px;
  color: var(--rose);
  animation: beat 1.6s ease-in-out infinite;
}
.boot p { margin: 0; color: var(--muted); font-size: 14px; letter-spacing: .04em; }
@keyframes beat {
  0%, 100% { transform: scale(1); opacity: .75; }
  18% { transform: scale(1.18); opacity: 1; }
  36% { transform: scale(1); }
  54% { transform: scale(1.12); opacity: .95; }
}

/* ==================== 登录 ==================== */

.auth {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px 20px calc(24px + var(--safe-b));
  z-index: 10;
}
.auth-sky {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(52% 40% at 22% 10%, #fbe4de 0%, transparent 65%),
    radial-gradient(48% 42% at 82% 22%, #f6e3ec 0%, transparent 62%),
    radial-gradient(70% 50% at 50% 100%, #fdeee6 0%, transparent 70%);
  opacity: .95;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .auth-sky {
    background:
      radial-gradient(52% 40% at 22% 10%, #2b1b18 0%, transparent 65%),
      radial-gradient(48% 42% at 82% 22%, #251a21 0%, transparent 62%),
      radial-gradient(70% 50% at 50% 100%, #1d1512 0%, transparent 70%);
  }
}
.auth-card {
  position: relative;
  width: min(420px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 38px 30px 32px;
  box-shadow: var(--shadow-lg);
  animation: rise .5s cubic-bezier(.2, .8, .3, 1) both;
}
.auth-mark {
  width: 58px; height: 58px;
  margin: 0 auto 18px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--rose), #e59a8f);
  color: #fff;
  font-size: 26px;
  box-shadow: 0 12px 26px -12px rgba(200, 90, 80, .8);
}
.auth-title {
  margin: 0 0 6px;
  font-size: 23px;
  font-weight: 600;
  letter-spacing: .02em;
  text-align: center;
}
.auth-sub { margin: 0 0 26px; text-align: center; color: var(--muted); font-size: 13.5px; }
.auth-form { display: grid; gap: 10px; }
.auth-error {
  margin: 4px 0 0;
  padding: 10px 12px;
  font-size: 13px;
  color: var(--danger);
  background: var(--danger-soft);
  border-radius: var(--r-xs);
}
.auth-tip { margin: 10px 0 0; font-size: 12px; color: var(--muted); text-align: center; }
.auth-foot {
  position: relative;
  margin: 26px 0 0;
  font-size: 12px;
  color: var(--muted);
  letter-spacing: .05em;
}
.setup-hint { margin: 0 0 8px; font-size: 13px; color: var(--ink-2); }

@keyframes rise {
  from { opacity: 0; transform: translateY(14px) scale(.985); }
  to { opacity: 1; transform: none; }
}

/* ==================== 表单基础 ==================== */

.field-label {
  font-size: 12.5px;
  color: var(--muted);
  letter-spacing: .04em;
  margin-top: 6px;
}
.input, .textarea, .select {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 12px 14px;
  font-size: 15px;
  color: var(--ink);
  transition: border-color .18s, background .18s, box-shadow .18s;
  outline: none;
}
.input::placeholder, .textarea::placeholder { color: var(--muted); opacity: .8; }
.input:focus, .textarea:focus, .select:focus {
  border-color: var(--rose);
  background: var(--surface);
  box-shadow: 0 0 0 4px var(--rose-soft);
}
.textarea { resize: vertical; min-height: 110px; line-height: 1.7; }
.select { appearance: none; -webkit-appearance: none; }

/* ==================== 按钮 ==================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 18px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: var(--surface-3);
  color: var(--ink);
  font-size: 14.5px;
  font-weight: 500;
  transition: transform .12s, box-shadow .18s, background .18s, opacity .18s;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(.975); }
.btn:disabled { opacity: .55; cursor: default; }
.btn-primary {
  background: linear-gradient(140deg, var(--rose), #e08d84);
  color: #fff;
  box-shadow: 0 10px 24px -12px rgba(200, 90, 80, .9);
}
.btn-primary:hover { box-shadow: 0 14px 28px -12px rgba(200, 90, 80, 1); }
.btn-block { width: 100%; margin-top: 8px; }
.btn-line {
  background: transparent;
  border-color: var(--line-strong);
  color: var(--ink-2);
}
.btn-danger { background: var(--danger-soft); color: var(--danger); }
.btn-ghost {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 13px;
  padding: 10px;
  width: 100%;
}
.btn-ghost:hover { color: var(--ink-2); }
.btn-sm { padding: 7px 13px; font-size: 13px; }

.icon-btn {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 50%;
  color: var(--ink-2);
  transition: background .18s, color .18s, transform .12s;
}
.icon-btn:active { transform: scale(.94); }
.icon-btn svg { width: 19px; height: 19px; fill: currentColor; }

/* ==================== 布局 ==================== */

.layout {
  position: relative;
  z-index: 5;
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  min-height: 100vh;
  min-height: 100dvh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 30px 18px 22px;
  border-right: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 62%, transparent);
  backdrop-filter: blur(14px);
}
.brand { display: flex; align-items: center; gap: 11px; padding: 0 8px; }
.brand-mark {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: 12px;
  background: linear-gradient(145deg, var(--rose), #e79a8e);
  color: #fff;
  font-size: 17px;
  box-shadow: 0 8px 18px -10px rgba(200, 90, 80, .9);
  flex: none;
}
.brand-title { font-size: 15px; font-weight: 600; letter-spacing: .02em; }
.brand-sub { font-size: 11.5px; color: var(--muted); letter-spacing: .08em; }

.sidenav { display: flex; flex-direction: column; gap: 3px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border-radius: 12px;
  color: var(--ink-2);
  font-size: 14.5px;
  transition: background .18s, color .18s;
}
.nav-item svg { width: 19px; height: 19px; fill: currentColor; opacity: .8; flex: none; }
.nav-item:hover { background: var(--surface-3); color: var(--ink); }
.nav-item.active {
  background: var(--rose-soft);
  color: var(--rose-deep);
  font-weight: 600;
}
.nav-item.active svg { opacity: 1; }

.sidebar-foot { margin-top: auto; display: grid; gap: 6px; }

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

.mobile-top {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px calc(10px);
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid transparent;
}
.mobile-top.scrolled { border-bottom-color: var(--line); }
.mobile-brand { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 600; }
.mobile-mark { color: var(--rose); font-size: 15px; }

.view {
  width: 100%;
  max-width: 1040px;
  margin: 0 auto;
  padding: 32px 34px 80px;
  animation: fadeUp .34s ease both;
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

.bottomnav { display: none; }

/* ==================== 首页 ==================== */

.hero {
  position: relative;
  overflow: hidden;
  border-radius: var(--r-lg);
  padding: 40px 34px 34px;
  background: linear-gradient(155deg, #fff 0%, #fdf1ec 42%, #f8e3e2 100%);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .hero {
    background: linear-gradient(155deg, #241b18 0%, #2a1c1a 45%, #2b1a1e 100%);
  }
}
.hero::after {
  content: "♥";
  position: absolute;
  right: -18px;
  bottom: -46px;
  font-size: 190px;
  line-height: 1;
  color: var(--rose);
  opacity: .07;
  transform: rotate(-8deg);
  pointer-events: none;
}
.hero-eyebrow {
  margin: 0 0 4px;
  font-size: 13px;
  letter-spacing: .18em;
  color: var(--rose-deep);
  font-weight: 500;
}
.hero-days {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 0;
  line-height: 1;
}
.hero-days .num {
  font-family: var(--font-display);
  font-size: clamp(58px, 11vw, 92px);
  letter-spacing: -.02em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.hero-days .unit { font-size: 20px; color: var(--ink-2); }
.hero-since { margin: 10px 0 0; font-size: 13.5px; color: var(--ink-2); }
.hero-since b { color: var(--ink); font-weight: 600; }
.hero-quote {
  margin: 20px 0 0;
  padding-top: 18px;
  border-top: 1px dashed var(--line-strong);
  font-size: 14px;
  color: var(--ink-2);
  max-width: 46ch;
}
.hero-badges { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
.hero-badge {
  font-size: 12px;
  padding: 6px 12px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 74%, transparent);
  border: 1px solid var(--line);
  color: var(--ink-2);
  backdrop-filter: blur(6px);
}
.hero-badge b { color: var(--rose-deep); font-weight: 600; }

.stat-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 16px 0 30px;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 18px 18px 16px;
  box-shadow: var(--shadow-sm);
  transition: transform .18s, box-shadow .18s;
}
.stat:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.stat-num {
  font-family: var(--font-display);
  font-size: 30px;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.stat-label { font-size: 12.5px; color: var(--muted); margin-top: 3px; letter-spacing: .04em; }

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 34px 0 14px;
}
.section-title { margin: 0; font-size: 16.5px; font-weight: 600; letter-spacing: .02em; }
.section-more { font-size: 13px; color: var(--muted); }
.section-more:hover { color: var(--rose); }

/* ==================== 回忆卡片 ==================== */

.cards { display: grid; gap: 14px; }

.mcard {
  position: relative;
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 18px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow-sm);
  transition: transform .2s cubic-bezier(.2,.8,.3,1), box-shadow .2s, border-color .2s;
  cursor: pointer;
}
.mcard:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: var(--line-strong);
}
.mcard.no-photo { grid-template-columns: minmax(0, 1fr); }

.mcard-thumb {
  position: relative;
  border-radius: var(--r-sm);
  overflow: hidden;
  background: var(--surface-3);
  aspect-ratio: 1 / 1;
  align-self: start;
}
.mcard-thumb img { width: 100%; height: 100%; object-fit: cover; }
.mcard-thumb .count {
  position: absolute;
  right: 7px; bottom: 7px;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(20, 12, 10, .58);
  color: #fff;
  backdrop-filter: blur(4px);
}
.mcard-body { min-width: 0; display: flex; flex-direction: column; gap: 7px; padding: 4px 4px 4px 0; }
.mcard-date {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--rose-deep);
  letter-spacing: .06em;
  font-variant-numeric: tabular-nums;
}
.mcard-date .dot { width: 4px; height: 4px; border-radius: 50%; background: var(--line-strong); }
.mcard-title {
  margin: 0;
  font-size: 16.5px;
  font-weight: 600;
  letter-spacing: .01em;
  word-break: break-word;
}
.mcard-story {
  margin: 0;
  font-size: 13.5px;
  color: var(--ink-2);
  line-height: 1.65;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.mcard-foot { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; padding-top: 4px; }
.tag-pill {
  font-size: 11.5px;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--ink-2);
  border: 1px solid var(--line);
}
.tag-pill.place { background: var(--rose-soft); color: var(--rose-deep); border-color: transparent; }

/* ==================== 时间轴 ==================== */

.year-block { margin-bottom: 34px; }
.year-label {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 16px;
  font-family: var(--font-display);
  font-size: 26px;
  color: var(--ink);
  font-weight: 400;
  letter-spacing: .02em;
}
.year-label::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.year-label .year-count { font-family: var(--font-body); font-size: 12px; color: var(--muted); }

.tl { position: relative; padding-left: 26px; }
.tl::before {
  content: "";
  position: absolute;
  left: 5px; top: 8px; bottom: 8px;
  width: 2px;
  background: linear-gradient(to bottom, var(--line-strong), transparent);
}
.tl-item { position: relative; margin-bottom: 16px; }
.tl-item::before {
  content: "";
  position: absolute;
  left: -25px;
  top: 26px;
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--rose);
  box-shadow: 0 0 0 4px var(--bg);
}

/* ==================== 相册 ==================== */

.gallery-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}
.filter-chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip {
  font-size: 13px;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
  transition: all .18s;
}
.chip:hover { border-color: var(--line-strong); }
.chip.active {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--bg);
  font-weight: 500;
}

.gallery {
  columns: 4;
  column-gap: 10px;
}
@media (max-width: 1100px) { .gallery { columns: 3; } }
.gitem {
  position: relative;
  break-inside: avoid;
  margin-bottom: 10px;
  border-radius: var(--r-sm);
  overflow: hidden;
  background: var(--surface-3);
  cursor: zoom-in;
  transition: transform .2s, box-shadow .2s;
}
.gitem img { width: 100%; height: auto; display: block; transition: transform .35s ease, opacity .3s; }
.gitem:hover { box-shadow: var(--shadow); }
.gitem:hover img { transform: scale(1.03); }
.gitem .g-play {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 30px;
  text-shadow: 0 2px 12px rgba(0, 0, 0, .6);
  background: rgba(0, 0, 0, .18);
}
.gitem .g-cap {
  position: absolute;
  inset: auto 0 0 0;
  padding: 26px 10px 8px;
  font-size: 11.5px;
  color: #fff;
  background: linear-gradient(to top, rgba(20, 12, 10, .7), transparent);
  opacity: 0;
  transition: opacity .2s;
}
.gitem:hover .g-cap { opacity: 1; }

/* ==================== 灯箱 ==================== */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(14, 9, 8, .96);
  display: grid;
  grid-template-rows: auto 1fr auto;
  animation: lbIn .22s ease both;
}
@keyframes lbIn { from { opacity: 0; } to { opacity: 1; } }
.lb-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(12px + var(--safe-t)) 16px 12px;
  color: rgba(255, 255, 255, .82);
  font-size: 13px;
}
.lb-meta { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-actions { display: flex; gap: 8px; flex: none; }
.lightbox .icon-btn {
  background: rgba(255, 255, 255, .1);
  border-color: rgba(255, 255, 255, .16);
  color: #fff;
}
.lightbox .icon-btn:hover { background: rgba(255, 255, 255, .2); }
.lb-stage {
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
  padding: 0 12px;
}
.lb-stage img, .lb-stage video {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 8px;
  animation: lbImg .26s ease both;
}
@keyframes lbImg { from { opacity: 0; transform: scale(.985); } to { opacity: 1; transform: none; } }
.lb-nav {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  width: 46px; height: 46px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, .1);
  color: #fff;
  font-size: 26px;
  line-height: 1;
  display: grid;
  place-items: center;
  transition: background .18s;
  backdrop-filter: blur(6px);
}
.lb-nav:hover { background: rgba(255, 255, 255, .22); }
.lb-prev { left: 12px; }
.lb-next { right: 12px; }
.lb-counter {
  text-align: center;
  padding: 12px 16px calc(16px + var(--safe-b));
  color: rgba(255, 255, 255, .5);
  font-size: 12.5px;
  letter-spacing: .1em;
  font-variant-numeric: tabular-nums;
}

/* ==================== 详情弹层 ==================== */

.detail-hero {
  margin: -4px -2px 0;
  border-radius: var(--r-sm);
  overflow: hidden;
  background: var(--surface-3);
}
.detail-title { margin: 16px 0 6px; font-size: 21px; font-weight: 600; letter-spacing: .01em; }
.detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 12.5px;
  color: var(--muted);
  margin-bottom: 14px;
  font-variant-numeric: tabular-nums;
}
.detail-story {
  font-size: 15px;
  line-height: 1.85;
  color: var(--ink);
  white-space: pre-wrap;
  word-break: break-word;
}
.detail-photos {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 7px;
  margin-top: 16px;
}
.detail-photos img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 10px;
  cursor: zoom-in;
}
.detail-actions {
  display: flex;
  gap: 8px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

/* ==================== 弹层 / 抽屉 ==================== */

.sheet-host { position: fixed; inset: 0; z-index: 70; display: grid; align-items: end; }
.sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(30, 18, 15, .42);
  backdrop-filter: blur(3px);
  animation: fadeIn .2s ease both;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.sheet {
  position: relative;
  width: min(660px, 100%);
  margin: 0 auto;
  max-height: 92vh;
  max-height: 92dvh;
  background: var(--surface);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  animation: sheetUp .3s cubic-bezier(.2, .85, .3, 1) both;
}
@media (min-width: 720px) {
  .sheet-host { align-items: center; }
  .sheet { border-radius: var(--r-lg); max-height: 88vh; }
}
@keyframes sheetUp {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: none; }
}
.sheet-handle {
  width: 40px; height: 4px;
  border-radius: 4px;
  background: var(--line-strong);
  margin: 10px auto 0;
  flex: none;
}
@media (min-width: 720px) { .sheet-handle { display: none; } }
.sheet-body {
  padding: 18px 22px calc(24px + var(--safe-b));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.sheet-head h2 { margin: 0; font-size: 17px; font-weight: 600; }

/* ==================== 添加页 ==================== */

.picker {
  position: relative;
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--r);
  background: var(--surface-2);
  padding: 34px 20px;
  text-align: center;
  transition: border-color .2s, background .2s;
  cursor: pointer;
}
.picker:hover, .picker.drag {
  border-color: var(--rose);
  background: var(--rose-soft);
}
.picker-icon { font-size: 28px; color: var(--rose); margin-bottom: 6px; }
.picker-title { font-size: 14.5px; font-weight: 500; }
.picker-sub { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.picker input[type="file"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.thumbs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(86px, 1fr));
  gap: 8px;
  margin-top: 14px;
}
.thumb {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--r-xs);
  overflow: hidden;
  background: var(--surface-3);
}
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb .rm {
  position: absolute;
  top: 4px; right: 4px;
  width: 22px; height: 22px;
  border-radius: 50%;
  border: none;
  background: rgba(20, 12, 10, .6);
  color: #fff;
  font-size: 13px;
  line-height: 1;
  display: grid;
  place-items: center;
  backdrop-filter: blur(4px);
}
.thumb .bar {
  position: absolute;
  inset: auto 0 0 0;
  height: 3px;
  background: rgba(0, 0, 0, .18);
}
.thumb .bar i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--rose);
  transition: width .2s;
}
.thumb.done .bar { background: rgba(95, 158, 110, .3); }
.thumb.done .bar i { width: 100% !important; background: var(--ok); }
.thumb .badge {
  position: absolute;
  left: 4px; bottom: 8px;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 6px;
  background: rgba(20, 12, 10, .55);
  color: #fff;
}

.form-grid { display: grid; gap: 12px; }
.form-row { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }
@media (max-width: 520px) { .form-row { grid-template-columns: 1fr; } }
.form-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}
.form-actions .btn-primary { flex: 1; }

.mood-row { display: flex; flex-wrap: wrap; gap: 7px; }

/* ==================== 设置 ==================== */

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 20px 22px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 14px;
}
.panel-title { margin: 0 0 4px; font-size: 15px; font-weight: 600; }
.panel-sub { margin: 0 0 16px; font-size: 12.5px; color: var(--muted); }

.kv { display: grid; gap: 10px; }
.kv-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  font-size: 13.5px;
  padding: 7px 0;
  border-bottom: 1px dashed var(--line);
}
.kv-row:last-child { border-bottom: none; }
.kv-row .k { color: var(--muted); flex: none; }
.kv-row .v { color: var(--ink); text-align: right; word-break: break-all; font-variant-numeric: tabular-nums; }

.url-line {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  background: var(--surface-3);
  font-size: 13px;
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  word-break: break-all;
}
.url-line .copy {
  flex: none;
  border: none;
  background: transparent;
  color: var(--rose-deep);
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 8px;
}
.url-line .copy:hover { background: var(--surface); }

.bar-track {
  height: 7px;
  border-radius: 7px;
  background: var(--surface-3);
  overflow: hidden;
  margin-top: 8px;
}
.bar-track i {
  display: block;
  height: 100%;
  border-radius: 7px;
  background: linear-gradient(90deg, var(--rose), var(--gold));
  transition: width .4s ease;
}

/* ==================== 空状态 / 骨架 ==================== */

.empty {
  text-align: center;
  padding: 56px 20px;
  color: var(--muted);
}
.empty-icon { font-size: 40px; opacity: .5; margin-bottom: 10px; }
.empty-title { font-size: 15px; color: var(--ink-2); margin-bottom: 6px; }
.empty-sub { font-size: 13px; max-width: 34ch; margin: 0 auto 18px; line-height: 1.7; }

.skeleton {
  border-radius: var(--r);
  background: linear-gradient(100deg, var(--surface-3) 30%, var(--surface-2) 50%, var(--surface-3) 70%);
  background-size: 220% 100%;
  animation: shimmer 1.4s linear infinite;
}
@keyframes shimmer { from { background-position: 140% 0; } to { background-position: -40% 0; } }

/* ==================== 轻提示 ==================== */

.toast-host {
  position: fixed;
  left: 50%;
  bottom: calc(28px + var(--safe-b));
  transform: translateX(-50%);
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  width: max-content;
  max-width: min(92vw, 420px);
}
.toast {
  padding: 11px 18px;
  border-radius: 999px;
  background: rgba(38, 24, 21, .93);
  color: #fff;
  font-size: 13.5px;
  box-shadow: var(--shadow);
  animation: toastIn .26s cubic-bezier(.2, .8, .3, 1) both;
  backdrop-filter: blur(8px);
  text-align: center;
}
.toast.err { background: rgba(180, 60, 52, .95); }
.toast.ok { background: rgba(58, 122, 80, .95); }
@keyframes toastIn {
  from { opacity: 0; transform: translateY(10px) scale(.96); }
  to { opacity: 1; transform: none; }
}
.toast.out { animation: toastOut .22s ease both; }
@keyframes toastOut { to { opacity: 0; transform: translateY(6px); } }

/* ==================== 搜索框 ==================== */

.search {
  position: relative;
  flex: 1;
  min-width: 180px;
  max-width: 340px;
}
.search input { padding-left: 38px; }
.search svg {
  position: absolute;
  left: 13px; top: 50%;
  transform: translateY(-50%);
  width: 16px; height: 16px;
  fill: none;
  stroke: var(--muted);
  stroke-width: 2;
  pointer-events: none;
}

/* ==================== 响应式 ==================== */

@media (max-width: 900px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .sidebar { display: none; }
  .mobile-top { display: flex; }
  .view { padding: 18px 16px calc(96px + var(--safe-b)); }
  .hero { padding: 30px 22px 26px; border-radius: var(--r); }
  .stat-row { gap: 9px; margin-bottom: 24px; }
  .stat { padding: 14px 13px; border-radius: var(--r-sm); }
  .stat-num { font-size: 24px; }
  .stat-label { font-size: 11.5px; }
  .mcard { grid-template-columns: 104px minmax(0, 1fr); gap: 13px; padding: 12px; }
  .mcard-title { font-size: 15.5px; }
  .mcard-story { -webkit-line-clamp: 2; line-clamp: 2; font-size: 13px; }
  .gallery { columns: 3; column-gap: 7px; }
  .gitem { margin-bottom: 7px; }
  .tl { padding-left: 20px; }
  .tl-item::before { left: -19px; top: 22px; }

  .bottomnav {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    position: fixed;
    inset: auto 0 0 0;
    z-index: 40;
    padding: 6px 6px calc(6px + var(--safe-b));
    background: color-mix(in srgb, var(--surface) 88%, transparent);
    backdrop-filter: blur(18px) saturate(1.4);
    border-top: 1px solid var(--line);
  }
  .tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 7px 2px;
    font-size: 10.5px;
    color: var(--muted);
    border-radius: 12px;
    transition: color .18s;
  }
  .tab svg { width: 22px; height: 22px; fill: currentColor; }
  .tab.active { color: var(--rose-deep); }
  .tab-add { color: var(--rose-deep); }
  .tab-add-inner {
    width: 40px; height: 40px;
    display: grid; place-items: center;
    border-radius: 50%;
    background: linear-gradient(145deg, var(--rose), #e39084);
    color: #fff;
    font-size: 22px;
    line-height: 1;
    box-shadow: 0 8px 18px -8px rgba(200, 90, 80, .95);
    margin-top: -6px;
  }
  .tab-add-label { color: var(--rose-deep); }
  .toast-host { bottom: calc(88px + var(--safe-b)); }
  .lb-nav { width: 40px; height: 40px; font-size: 22px; }
}

@media (max-width: 480px) {
  .gallery { columns: 2; }
  .hero-days .num { font-size: 62px; }
  .detail-photos { grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); }
}

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

/* 打印：导出时清晰 */
@media print {
  .sidebar, .bottomnav, .mobile-top, .toast-host { display: none !important; }
  body::before { display: none; }
}

/* 缩略图占位（还没处理完 / 视频没有封面时） */
.thumb-ph {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 2px;
  color: var(--muted);
  font-size: 10.5px;
  background: var(--surface-3);
}
.thumb-ph b {
  font-size: 18px;
  line-height: 1;
  color: var(--rose);
  font-weight: 400;
}

/* ==================== 相关链接 ==================== */

.link-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr) auto;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}
.link-row .link-del {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  font-size: 16px;
  line-height: 1;
  flex: none;
}
@media (max-width: 560px) {
  .link-row { grid-template-columns: minmax(0, 1fr) auto; }
  .link-row [data-link-title] { grid-column: 1 / -1; }
}

.detail-links {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 18px;
}
.link-btn {
  display: block;
  padding: 11px 14px;
  border-radius: var(--r-sm);
  background: var(--rose-soft);
  color: var(--rose-deep);
  font-size: 13.5px;
  text-decoration: none;
  border: 1px solid transparent;
  word-break: break-all;
  transition: border-color .18s, background .18s;
}
.link-btn:hover { border-color: var(--rose); }
.tag-pill.link {
  background: var(--rose-soft);
  color: var(--rose-deep);
  border-color: transparent;
}
