/* ==========================================================================
   星川纪念 · 设计系统
   ========================================================================== */

:root {
  --paper: #fbf7f1;
  --paper-2: #f4ede4;
  --paper-3: #ece3d7;
  --ink: #2e2a26;
  --ink-soft: #5d554d;
  --ink-mute: #8d8377;
  --line: rgba(46, 42, 38, 0.1);
  --line-strong: rgba(46, 42, 38, 0.18);
  --shadow-s: 0 2px 6px rgba(72, 57, 40, 0.06);
  --shadow-m: 0 12px 30px -14px rgba(72, 57, 40, 0.28);
  --shadow-l: 0 30px 70px -32px rgba(72, 57, 40, 0.42);
  --radius-s: 10px;
  --radius-m: 16px;
  --radius-l: 24px;
  --radius-xl: 34px;
  --wrap: 1120px;
  --font-serif: "Songti SC", "STSong", "Noto Serif SC", "Source Han Serif SC", "SimSun", Georgia, "Times New Roman", serif;
  --font-sans: "PingFang SC", "HarmonyOS Sans SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --accent: #c98a4b;
  --accent-deep: #a76d33;
  --accent-soft: #f0dcc4;
  --accent-wash: rgba(201, 138, 75, 0.09);
}

html[data-theme="sage"]  { --accent: #7c8c7a; --accent-deep: #5f6f5d; --accent-soft: #d9e2d5; --accent-wash: rgba(124, 140, 122, 0.1); }
html[data-theme="rose"]  { --accent: #c48a93; --accent-deep: #a46872; --accent-soft: #f0d6da; --accent-wash: rgba(196, 138, 147, 0.1); }
html[data-theme="sky"]   { --accent: #7e96b8; --accent-deep: #5f7899; --accent-soft: #d6e0ee; --accent-wash: rgba(126, 150, 184, 0.1); }
html[data-theme="violet"]{ --accent: #8b85b8; --accent-deep: #6e679d; --accent-soft: #dedbf0; --accent-wash: rgba(139, 133, 184, 0.1); }

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

body.is-locked { overflow: hidden; }

img { max-width: 100%; display: block; }

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

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

:focus-visible {
  outline: 2px solid var(--accent-deep);
  outline-offset: 3px;
  border-radius: 6px;
}

.wrap { width: min(100% - 40px, var(--wrap)); margin-inline: auto; }

/* ---------- 背景氛围 ---------- */

.ambient { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }

.ambient__glow {
  position: absolute;
  width: 62vmax;
  height: 62vmax;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.5;
  transition: background 900ms ease;
}
.ambient__glow--a { top: -28vmax; left: -16vmax; background: radial-gradient(circle, var(--accent-wash), transparent 68%); }
.ambient__glow--b { bottom: -34vmax; right: -20vmax; background: radial-gradient(circle, rgba(126, 150, 184, 0.12), transparent 68%); }

.ambient__petals { position: absolute; inset: 0; }

.petal {
  position: absolute;
  top: -6vh;
  width: 9px;
  height: 9px;
  opacity: 0;
  border-radius: 60% 10% 60% 10%;
  background: var(--accent-soft);
  animation: drift linear infinite;
}

@keyframes drift {
  0%   { opacity: 0; transform: translate3d(0, -6vh, 0) rotate(0deg) scale(0.8); }
  12%  { opacity: 0.72; }
  70%  { opacity: 0.5; }
  100% { opacity: 0; transform: translate3d(var(--drift-x, 40px), 108vh, 0) rotate(420deg) scale(1.05); }
}

/* ---------- 页头 ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(251, 247, 241, 0.86);
  background: color-mix(in srgb, var(--paper) 82%, transparent);
  backdrop-filter: blur(14px) saturate(1.1);
  border-bottom: 1px solid var(--line);
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 14px 0;
}

.brand { display: flex; align-items: center; gap: 12px; }

.brand__mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: linear-gradient(160deg, #fff, var(--paper-2));
  border: 1px solid var(--line);
  box-shadow: var(--shadow-s);
}
.brand__mark svg { fill: var(--accent); transition: fill 600ms ease; }
.brand__mark svg circle { fill: var(--accent-deep); }

.brand__text { display: flex; flex-direction: column; line-height: 1.25; }
.brand__text strong { font-family: var(--font-serif); font-size: 19px; letter-spacing: 0.06em; white-space: nowrap; }
.brand__text em { font-style: normal; font-size: 11.5px; color: var(--ink-mute); letter-spacing: 0.04em; }

.site-nav { display: flex; align-items: center; gap: 6px; }

.site-nav__link {
  position: relative;
  padding: 8px 14px;
  border: 0;
  background: transparent;
  border-radius: 999px;
  font-size: 14px;
  color: var(--ink-soft);
  cursor: pointer;
  transition: color 200ms ease, background 200ms ease;
}
.site-nav__link:hover { color: var(--ink); background: var(--accent-wash); }
.site-nav__link.is-active { color: var(--accent-deep); background: var(--accent-wash); font-weight: 600; }
.site-nav__link--btn { font-family: inherit; }

.link-btn {
  border: 0;
  background: none;
  padding: 0 0 2px;
  color: var(--ink-soft);
  font-size: 13px;
  cursor: pointer;
  border-bottom: 1px dashed var(--line-strong);
  transition: color 200ms ease, border-color 200ms ease;
}
.link-btn:hover { color: var(--accent-deep); border-color: var(--accent-deep); }

/* ---------- 主区域 ---------- */

.app { position: relative; z-index: 1; padding-bottom: 90px; }

.view { animation: viewIn 460ms cubic-bezier(0.22, 0.7, 0.3, 1) both; }
@keyframes viewIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* ---------- 首页 Hero ---------- */

.hero { padding: 76px 0 56px; text-align: center; }

.hero__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 22px;
  padding: 6px 16px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.6);
  font-size: 12.5px;
  letter-spacing: 0.12em;
  color: var(--ink-mute);
}
.hero__eyebrow::before { content: "✦"; color: var(--accent); }

.hero__title {
  margin: 0 0 22px;
  font-family: var(--font-serif);
  font-size: clamp(34px, 6vw, 62px);
  font-weight: 600;
  line-height: 1.24;
  letter-spacing: 0.02em;
}
.hero__title em { font-style: normal; color: var(--accent-deep); position: relative; white-space: nowrap; }
.hero__title em::after {
  content: "";
  position: absolute;
  left: -2%;
  right: -2%;
  bottom: 0.1em;
  height: 0.36em;
  background: var(--accent-soft);
  opacity: 0.6;
  border-radius: 4px;
  z-index: -1;
}

.hero__lead {
  max-width: 620px;
  margin: 0 auto 34px;
  color: var(--ink-soft);
  font-size: 16.5px;
  line-height: 1.95;
}

.hero__actions { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; }

.hero__note {
  margin: 30px 0 0;
  font-size: 12.5px;
  color: var(--ink-mute);
  letter-spacing: 0.04em;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 13px 28px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 15px;
  cursor: pointer;
  text-align: center;
  transition: transform 200ms cubic-bezier(0.22, 0.7, 0.3, 1), box-shadow 200ms ease, background 200ms ease, color 200ms ease, border-color 200ms ease;
}
.btn:active { transform: translateY(1px) scale(0.99); }

.btn--primary {
  background: linear-gradient(160deg, var(--accent), var(--accent-deep));
  color: #fff;
  box-shadow: 0 14px 26px -14px color-mix(in srgb, var(--accent-deep) 75%, transparent);
}
.btn--primary:hover { transform: translateY(-2px); box-shadow: 0 20px 34px -16px color-mix(in srgb, var(--accent-deep) 80%, transparent); }

.btn--ghost { background: rgba(255, 255, 255, 0.66); border-color: var(--line-strong); color: var(--ink-soft); }
.btn--ghost:hover { transform: translateY(-2px); border-color: var(--accent); color: var(--accent-deep); }

.btn--quiet { background: transparent; border-color: var(--line); color: var(--ink-mute); padding: 9px 18px; font-size: 13.5px; }
.btn--quiet:hover { color: var(--accent-deep); border-color: var(--accent); }

.btn--danger { background: transparent; border-color: rgba(178, 88, 78, 0.4); color: #b2584e; padding: 10px 20px; font-size: 13.5px; }
.btn--danger:hover { background: rgba(178, 88, 78, 0.08); }

.btn--sm { padding: 9px 18px; font-size: 13.5px; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; transform: none; }

/* ---------- 段落标题 ---------- */

.section { padding: 40px 0; }

.section__head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 26px;
  flex-wrap: wrap;
}

.section__title { margin: 0; font-family: var(--font-serif); font-size: 24px; font-weight: 600; letter-spacing: 0.04em; }
.section__title span { color: var(--ink-mute); font-size: 14px; font-family: var(--font-sans); margin-left: 10px; letter-spacing: 0; }
.section__desc { margin: 8px 0 0; color: var(--ink-mute); font-size: 14px; }

.rule {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 54px 0;
  color: var(--ink-mute);
  font-size: 12px;
  letter-spacing: 0.3em;
}
.rule::before, .rule::after { content: ""; height: 1px; flex: 1; background: linear-gradient(90deg, transparent, var(--line-strong), transparent); }

/* ---------- 工具栏 ---------- */

.toolbar { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }

.field-inline {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 16px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
  transition: border-color 200ms ease, box-shadow 200ms ease;
}
.field-inline:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-wash); }
.field-inline svg { flex: none; opacity: 0.5; }
.field-inline input, .field-inline select {
  border: 0;
  background: transparent;
  outline: none;
  font-size: 14px;
  min-width: 120px;
}
.field-inline select { cursor: pointer; padding-right: 4px; }

/* ---------- 纪念页卡片 ---------- */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(272px, 1fr));
  gap: 26px;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-xl);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0.66));
  border: 1px solid var(--line);
  box-shadow: var(--shadow-s);
  overflow: hidden;
  transition: transform 320ms cubic-bezier(0.22, 0.7, 0.3, 1), box-shadow 320ms ease, border-color 320ms ease;
}
.card:hover { transform: translateY(-6px); box-shadow: var(--shadow-l); border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); }

.card__cover {
  position: relative;
  aspect-ratio: 4 / 3;
  background: linear-gradient(150deg, var(--paper-2), var(--paper-3));
  overflow: hidden;
}
.card__cover img { width: 100%; height: 100%; object-fit: cover; transition: transform 700ms cubic-bezier(0.22, 0.7, 0.3, 1); }
.card:hover .card__cover img { transform: scale(1.05); }

.card__badge {
  position: absolute;
  top: 14px;
  left: 14px;
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(6px);
  font-size: 11.5px;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
}

.card__body { padding: 20px 22px 22px; display: flex; flex-direction: column; gap: 10px; flex: 1; }

.card__name {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: 0.03em;
  display: flex;
  align-items: baseline;
  gap: 9px;
}
.card__name small { font-family: var(--font-sans); font-size: 12px; color: var(--ink-mute); font-weight: 400; letter-spacing: 0.06em; }

.card__dates { margin: 0; font-size: 12.5px; color: var(--ink-mute); letter-spacing: 0.05em; }

.card__epitaph {
  margin: 4px 0 0;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.85;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card__foot {
  margin-top: auto;
  padding-top: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--ink-mute);
}

.card__stats { display: flex; gap: 14px; }
.card__stat { display: inline-flex; align-items: center; gap: 5px; }

/* ---------- 空状态 ---------- */

.empty {
  padding: 78px 24px;
  text-align: center;
  border-radius: var(--radius-xl);
  border: 1px dashed var(--line-strong);
  background: rgba(255, 255, 255, 0.5);
}
.empty__mark { font-size: 34px; color: var(--accent); margin-bottom: 14px; }
.empty__title { margin: 0 0 10px; font-family: var(--font-serif); font-size: 21px; }
.empty__text { margin: 0 auto 26px; max-width: 420px; color: var(--ink-mute); font-size: 14.5px; }

/* ---------- 纪念页详情 ---------- */

.memorial { position: relative; }

.memorial__cover {
  position: relative;
  height: clamp(240px, 38vh, 380px);
  border-radius: 0 0 var(--radius-xl) var(--radius-xl);
  overflow: hidden;
  background: linear-gradient(150deg, var(--accent-soft), var(--paper-3));
}
.memorial__cover img { width: 100%; height: 100%; object-fit: cover; }
.memorial__cover::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(46, 42, 38, 0.06), rgba(46, 42, 38, 0.42));
}

.memorial__head {
  position: relative;
  margin-top: -96px;
  padding: 0 0 8px;
  display: flex;
  align-items: flex-end;
  gap: 26px;
  flex-wrap: wrap;
}

.memorial__portrait {
  width: 176px;
  height: 176px;
  flex: none;
  border-radius: 50%;
  overflow: hidden;
  border: 5px solid var(--paper);
  background: linear-gradient(150deg, var(--paper-2), var(--paper-3));
  box-shadow: var(--shadow-m);
  display: grid;
  place-items: center;
}
.memorial__portrait img { width: 100%; height: 100%; object-fit: cover; }

.memorial__intro { flex: 1; min-width: 260px; padding-bottom: 8px; }

.memorial__name {
  margin: 0 0 8px;
  font-family: var(--font-serif);
  font-size: clamp(30px, 4.6vw, 44px);
  font-weight: 600;
  letter-spacing: 0.04em;
  display: flex;
  align-items: baseline;
  gap: 14px;
  flex-wrap: wrap;
}
.memorial__name .zh-name { }
.memorial__name .sub { font-family: var(--font-sans); font-size: 14px; color: var(--ink-mute); letter-spacing: 0.1em; font-weight: 400; }

.memorial__dates { margin: 0 0 12px; color: var(--ink-soft); font-size: 14.5px; letter-spacing: 0.05em; }
.memorial__dates .dot { color: var(--accent); margin: 0 8px; }

.memorial__age {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 15px;
  border-radius: 999px;
  background: var(--accent-wash);
  color: var(--accent-deep);
  font-size: 13px;
  letter-spacing: 0.04em;
}

.memorial__epitaph {
  margin: 22px 0 0;
  padding: 22px 26px;
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius-m) var(--radius-m) 0;
  background: rgba(255, 255, 255, 0.6);
  font-family: var(--font-serif);
  font-size: 18px;
  line-height: 2;
  color: var(--ink-soft);
}

.chip-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 20px; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--line);
  font-size: 13px;
  color: var(--ink-soft);
}
.chip b { font-weight: 600; color: var(--ink); }
.chip--accent { background: var(--accent-wash); border-color: transparent; color: var(--accent-deep); }

.memorial__actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
  padding: 26px 0 0;
}

.memorial__body { padding-top: 18px; }

.prose {
  max-width: 740px;
  font-size: 16.5px;
  line-height: 2.15;
  color: var(--ink-soft);
  white-space: pre-wrap;
  word-break: break-word;
}
.prose p { margin: 0 0 1.2em; }

/* ---------- 相册 ---------- */

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 16px;
}

.gallery__item {
  position: relative;
  border: 0;
  padding: 0;
  margin: 0;
  aspect-ratio: 1;
  border-radius: var(--radius-m);
  overflow: hidden;
  background: var(--paper-2);
  cursor: zoom-in;
  box-shadow: var(--shadow-s);
  display: block;
  width: 100%;
  transition: transform 320ms cubic-bezier(0.22, 0.7, 0.3, 1), box-shadow 320ms ease;
}
.gallery__item:hover { transform: translateY(-4px) scale(1.012); box-shadow: var(--shadow-l); }
.gallery__item img { width: 100%; height: 100%; object-fit: cover; }
.gallery__item figcaption {
  position: absolute;
  inset: auto 0 0 0;
  padding: 26px 14px 12px;
  background: linear-gradient(180deg, transparent, rgba(30, 26, 22, 0.72));
  color: #fff;
  font-size: 12.5px;
  text-align: left;
  line-height: 1.5;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 300ms ease, transform 300ms ease;
}
.gallery__item:hover figcaption, .gallery__item:focus-visible figcaption { opacity: 1; transform: none; }

/* ---------- 回忆墙 ---------- */

.memories { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; }

.memory {
  position: relative;
  padding: 22px 24px;
  border-radius: var(--radius-l);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(255, 255, 255, 0.7));
  border: 1px solid var(--line);
  box-shadow: var(--shadow-s);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.memory__text { margin: 0; font-size: 15px; line-height: 1.95; color: var(--ink-soft); white-space: pre-wrap; word-break: break-word; }
.memory__photo { border-radius: var(--radius-m); overflow: hidden; background: var(--paper-2); cursor: zoom-in; border: 0; padding: 0; }
.memory__photo img { width: 100%; max-height: 260px; object-fit: cover; }

.memory__foot {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 12.5px;
  color: var(--ink-mute);
  border-top: 1px solid var(--line);
  padding-top: 12px;
}
.memory__author { display: inline-flex; align-items: center; gap: 8px; color: var(--ink-soft); font-weight: 600; }
.memory__author::before { content: "❝"; color: var(--accent); font-size: 15px; }

.memory__del { border: 0; background: none; color: var(--ink-mute); cursor: pointer; font-size: 12px; opacity: 0; transition: opacity 200ms ease, color 200ms ease; }
.memory:hover .memory__del, .memory__del:focus-visible { opacity: 1; }
.memory__del:hover { color: #b2584e; }

/* ---------- 表单 ---------- */

.form-shell { max-width: 860px; margin: 0 auto; padding: 46px 0 20px; }

.form-card {
  padding: 34px;
  border-radius: var(--radius-xl);
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-m);
}

.form-card + .form-card { margin-top: 22px; }

.form-card__title { margin: 0 0 6px; font-family: var(--font-serif); font-size: 20px; font-weight: 600; letter-spacing: 0.04em; }
.form-card__hint { margin: 0 0 24px; color: var(--ink-mute); font-size: 13.5px; }

.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 20px; }
.form-grid--full { grid-template-columns: 1fr; }

.field { display: flex; flex-direction: column; gap: 9px; }
.field--full { grid-column: 1 / -1; }

.field__label { font-size: 13.5px; font-weight: 600; color: var(--ink-soft); letter-spacing: 0.03em; display: flex; align-items: center; gap: 8px; }
.field__label .opt { font-weight: 400; color: var(--ink-mute); font-size: 12px; }

.input, .textarea, .select {
  width: 100%;
  padding: 12px 16px;
  border-radius: var(--radius-m);
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.9);
  outline: none;
  transition: border-color 200ms ease, box-shadow 200ms ease, background 200ms ease;
}
.input:focus, .textarea:focus, .select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-wash);
  background: #fff;
}
.textarea { min-height: 150px; resize: vertical; line-height: 1.9; }
.textarea--tall { min-height: 220px; }
.select { cursor: pointer; appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--ink-mute) 50%), linear-gradient(135deg, var(--ink-mute) 50%, transparent 50%); background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%; background-size: 6px 6px, 6px 6px; background-repeat: no-repeat; }

.field__help { font-size: 12px; color: var(--ink-mute); }

/* 上传区 */

.drop {
  position: relative;
  display: grid;
  place-items: center;
  gap: 8px;
  padding: 26px;
  border-radius: var(--radius-l);
  border: 1.5px dashed var(--line-strong);
  background: rgba(255, 255, 255, 0.55);
  text-align: center;
  cursor: pointer;
  transition: border-color 200ms ease, background 200ms ease, transform 200ms ease;
}
.drop:hover, .drop.is-over { border-color: var(--accent); background: var(--accent-wash); }
.drop.is-over { transform: scale(1.006); }
.drop__icon { color: var(--accent); }
.drop__title { font-size: 14.5px; font-weight: 600; }
.drop__text { font-size: 12.5px; color: var(--ink-mute); }
.drop--portrait { aspect-ratio: 1; padding: 0; overflow: hidden; border-radius: 50%; max-width: 220px; }
.drop--cover { aspect-ratio: 16 / 7; padding: 0; overflow: hidden; }
.drop--portrait img, .drop--cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.drop--portrait .drop__scroll, .drop--cover .drop__scroll { position: relative; z-index: 2; display: grid; place-items: center; gap: 8px; }
.drop--portrait.has-media .drop__scroll, .drop--cover.has-media .drop__scroll { background: rgba(30, 26, 22, 0.45); color: #fff; border-radius: 999px; padding: 12px 20px; }
.drop--portrait.has-media .drop__title, .drop--cover.has-media .drop__title { color: #fff; }
.drop--portrait.has-media .drop__text, .drop--cover.has-media .drop__text { color: rgba(255,255,255,0.82); }

.thumb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: 14px; }

.thumb {
  position: relative;
  border-radius: var(--radius-m);
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--paper-2);
  box-shadow: var(--shadow-s);
}
.thumb img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; }
.thumb__cap {
  width: 100%;
  border: 0;
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
  padding: 9px 12px;
  font-size: 12.5px;
  outline: none;
}
.thumb__cap::placeholder { color: var(--ink-mute); }
.thumb__del {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 0;
  background: rgba(30, 26, 22, 0.62);
  color: #fff;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  opacity: 0;
  transition: opacity 200ms ease, background 200ms ease;
}
.thumb:hover .thumb__del, .thumb__del:focus-visible { opacity: 1; }
.thumb__del:hover { background: rgba(178, 88, 78, 0.9); }

/* 主题选择 */

.swatches { display: flex; gap: 14px; flex-wrap: wrap; }

.swatch {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  position: relative;
  box-shadow: inset 0 0 0 3px var(--paper);
  transition: transform 200ms ease, box-shadow 200ms ease;
}
.swatch:hover { transform: scale(1.08); }
.swatch.is-active { box-shadow: inset 0 0 0 3px var(--paper), 0 0 0 2px currentColor; }
.swatch[data-swatch="amber"]  { background: #c98a4b; color: #c98a4b; }
.swatch[data-swatch="sage"]   { background: #7c8c7a; color: #7c8c7a; }
.swatch[data-swatch="rose"]   { background: #c48a93; color: #c48a93; }
.swatch[data-swatch="sky"]    { background: #7e96b8; color: #7e96b8; }
.swatch[data-swatch="violet"] { background: #8b85b8; color: #8b85b8; }

.form-actions {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  padding: 26px 0 0;
}

/* ---------- 留言表单 ---------- */

.memory-form {
  padding: 26px;
  border-radius: var(--radius-l);
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
  display: grid;
  gap: 16px;
  margin-bottom: 28px;
}
.memory-form__row { display: flex; gap: 14px; flex-wrap: wrap; align-items: flex-start; }
.memory-form__row > * { flex: 1 1 240px; }

/* ---------- 蜡烛 ---------- */

.candle-bar {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  padding: 20px 26px;
  border-radius: var(--radius-l);
  background: linear-gradient(135deg, var(--accent-wash), rgba(255, 255, 255, 0.7));
  border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent);
}

.candle-flame {
  position: relative;
  width: 34px;
  height: 40px;
  flex: none;
  display: grid;
  place-items: center;
}
.candle-flame::before {
  content: "";
  width: 15px;
  height: 26px;
  border-radius: 50% 50% 45% 45%;
  background: radial-gradient(circle at 50% 74%, #fff6d8, #f7b95a 58%, #e08a34);
  box-shadow: 0 0 22px rgba(232, 154, 66, 0.55);
  animation: flicker 2.6s ease-in-out infinite;
}
.candle-flame::after {
  content: "";
  position: absolute;
  bottom: 2px;
  width: 20px;
  height: 5px;
  border-radius: 3px;
  background: #d8cdbd;
}
@keyframes flicker {
  0%, 100% { transform: scale(1) rotate(-1deg); opacity: 0.94; }
  35% { transform: scale(1.07, 1.03) rotate(1.5deg); opacity: 1; }
  62% { transform: scale(0.96, 1.05) rotate(-0.5deg); opacity: 0.9; }
}

.candle-bar__text { flex: 1; min-width: 200px; font-size: 14px; color: var(--ink-soft); }
.candle-bar__text b { font-family: var(--font-serif); font-size: 19px; color: var(--accent-deep); margin: 0 4px; }

/* ---------- 灯箱 ---------- */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(24, 20, 17, 0.9);
  backdrop-filter: blur(8px);
  display: grid;
  grid-template-columns: 70px 1fr 70px;
  align-items: center;
  animation: fadeIn 240ms ease both;
}
.lightbox[hidden] { display: none; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.lightbox__figure { margin: 0; display: grid; gap: 14px; justify-items: center; max-height: 92vh; }
.lightbox__img { max-height: 78vh; max-width: 100%; border-radius: var(--radius-m); box-shadow: 0 40px 80px -30px rgba(0, 0, 0, 0.7); object-fit: contain; }
.lightbox__caption { color: rgba(255, 255, 255, 0.82); font-size: 14px; text-align: center; max-width: 640px; }

.lightbox__close, .lightbox__nav {
  border: 0;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  cursor: pointer;
  border-radius: 50%;
  width: 46px;
  height: 46px;
  font-size: 22px;
  display: grid;
  place-items: center;
  transition: background 200ms ease, transform 200ms ease;
}
.lightbox__close { position: absolute; top: 22px; right: 24px; }
.lightbox__nav--prev { justify-self: center; }
.lightbox__nav--next { justify-self: center; }
.lightbox__close:hover, .lightbox__nav:hover { background: rgba(255, 255, 255, 0.22); transform: scale(1.06); }

/* ---------- 弹窗 ---------- */

.modal-root:empty { display: none; }

.modal {
  position: fixed;
  inset: 0;
  z-index: 95;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(24, 20, 17, 0.5);
  backdrop-filter: blur(6px);
  animation: fadeIn 200ms ease both;
}

.modal__panel {
  width: min(100%, 560px);
  max-height: 86vh;
  overflow: auto;
  padding: 32px;
  border-radius: var(--radius-xl);
  background: var(--paper);
  box-shadow: var(--shadow-l);
  animation: popIn 300ms cubic-bezier(0.22, 0.7, 0.3, 1) both;
}
@keyframes popIn { from { opacity: 0; transform: translateY(16px) scale(0.98); } to { opacity: 1; transform: none; } }

.modal__title { margin: 0 0 12px; font-family: var(--font-serif); font-size: 22px; }
.modal__text { margin: 0 0 24px; color: var(--ink-soft); font-size: 14.5px; line-height: 1.9; }
.modal__actions { display: flex; gap: 12px; justify-content: flex-end; flex-wrap: wrap; }
.modal__text code { background: var(--accent-wash); padding: 1px 6px; border-radius: 6px; font-size: 13px; }
.modal__list { margin: 0 0 24px; padding-left: 20px; color: var(--ink-soft); font-size: 14px; line-height: 2; }

/* ---------- Toast ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 34px;
  z-index: 120;
  transform: translate(-50%, 24px);
  padding: 12px 24px;
  border-radius: 999px;
  background: rgba(38, 33, 28, 0.92);
  color: #fff;
  font-size: 13.5px;
  box-shadow: var(--shadow-l);
  opacity: 0;
  pointer-events: none;
  transition: opacity 280ms ease, transform 280ms ease;
}
.toast.is-show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- 页脚 ---------- */

.site-footer {
  position: relative;
  z-index: 1;
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.45);
  padding: 42px 0;
}

.site-footer__inner { display: flex; gap: 40px; justify-content: space-between; flex-wrap: wrap; }
.site-footer__col { max-width: 460px; }
.site-footer__col--right { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 14px; }
.site-footer__title { margin: 0 0 10px; font-family: var(--font-serif); font-size: 18px; letter-spacing: 0.08em; }
.site-footer__text { margin: 0; color: var(--ink-mute); font-size: 13px; line-height: 2; }
.site-footer__text--tiny { font-family: var(--font-serif); font-size: 14px; color: var(--ink-soft); }
.site-footer__text a { color: inherit; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line-strong); }
.site-footer__text a:hover { color: var(--accent-deep); text-decoration-color: var(--accent-deep); }
.site-footer__actions { display: flex; gap: 18px; flex-wrap: wrap; }

/* ---------- 打印 / 纪念卡 ---------- */

/* ---------- 解锁 / 收款 / 后台 ---------- */

.btn--unlock {
  background: linear-gradient(150deg, #e0b072, #b8802f);
  color: #fff;
  box-shadow: 0 12px 24px -14px rgba(160, 108, 30, 0.75);
}
.btn--unlock:hover { transform: translateY(-2px); box-shadow: 0 18px 30px -16px rgba(160, 108, 30, 0.85); }
.btn--unlock.is-done { background: var(--accent-wash); color: var(--accent-deep); box-shadow: none; }

.chip--pro {
  background: linear-gradient(150deg, #f6e2c2, #efd0a3);
  border-color: transparent;
  color: #8a5d1c;
  font-weight: 600;
}

.notice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin: 22px 0 0;
  padding: 16px 20px;
  border-radius: var(--radius-m);
  border: 1px solid color-mix(in srgb, var(--accent) 32%, transparent);
  background: linear-gradient(135deg, var(--accent-wash), rgba(255, 255, 255, 0.72));
}
.notice__text { flex: 1; min-width: 220px; font-size: 14px; color: var(--ink-soft); line-height: 1.8; }

.pay-amounts { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 6px; }

.pay-amount {
  padding: 9px 20px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.8);
  cursor: pointer;
  font-size: 14px;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease, color 180ms ease;
}
.pay-amount:hover { transform: translateY(-1px); border-color: var(--accent); color: var(--accent-deep); }
.pay-amount.is-active { background: var(--accent); border-color: var(--accent); color: #fff; }

.pay-qrs {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  justify-content: center;
  margin: 8px 0 16px;
}

.pay-qr {
  margin: 0;
  text-align: center;
  display: grid;
  gap: 8px;
  justify-items: center;
}
.pay-qr img {
  width: 190px;
  height: 190px;
  object-fit: contain;
  border-radius: var(--radius-m);
  border: 1px solid var(--line);
  background: #fff;
  padding: 6px;
}
.pay-qr figcaption { font-size: 12.5px; color: var(--ink-mute); }

.pay-waiting {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 8px 0 20px;
  font-size: 13.5px;
  color: var(--ink-mute);
}
.pay-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulseDot 1.6s ease-in-out infinite;
}
@keyframes pulseDot {
  0%, 100% { opacity: 0.35; transform: scale(0.85); }
  50% { opacity: 1; transform: scale(1.15); }
}

.input--code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 17px;
  text-align: center;
}

.swatch.is-locked { opacity: 0.45; cursor: pointer; }
.swatch.is-locked::after {
  content: "🔒";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 15px;
}

.modal__panel code,
.form-card code {
  background: var(--accent-wash);
  padding: 1px 6px;
  border-radius: 6px;
  font-size: 12.5px;
  word-break: break-all;
}

.admin-token {
  display: flex;
  align-items: flex-end;
  gap: 14px;
  flex-wrap: wrap;
  margin: 20px 0 10px;
  padding: 20px;
  border-radius: var(--radius-l);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.7);
}
.admin-token .field { flex: 1; min-width: 200px; }

.admin-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin: 22px 0 6px;
}

.admin-stat {
  padding: 18px 20px;
  border-radius: var(--radius-l);
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid var(--line);
  display: grid;
  gap: 4px;
}
.admin-stat span { font-size: 12.5px; color: var(--ink-mute); letter-spacing: 0.04em; }
.admin-stat b { font-family: var(--font-serif); font-size: 24px; font-weight: 600; color: var(--accent-deep); }

.admin-table-wrap { overflow-x: auto; margin-top: 6px; }

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
  min-width: 720px;
}
.admin-table th {
  text-align: left;
  font-weight: 600;
  color: var(--ink-mute);
  font-size: 12.5px;
  letter-spacing: 0.05em;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line-strong);
  white-space: nowrap;
}
.admin-table td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  color: var(--ink-soft);
}
.admin-table tr:hover td { background: rgba(255, 255, 255, 0.6); }
.order-code { font-size: 12px; letter-spacing: 0.04em; white-space: nowrap; }

.tag {
  display: inline-block;
  padding: 3px 11px;
  border-radius: 999px;
  font-size: 12px;
  white-space: nowrap;
}
.tag--pending { background: rgba(201, 138, 75, 0.16); color: #a76d33; }
.tag--paid { background: rgba(124, 140, 122, 0.18); color: #5f6f5d; }
.tag--used { background: rgba(126, 150, 184, 0.18); color: #5f7899; }
.tag--ready { background: rgba(124, 140, 122, 0.18); color: #5f6f5d; }

@media print {
  .notice, .btn--unlock, .chip--pro { display: none !important; }
}

@media print {
  .site-header, .site-footer, .ambient, .memorial__actions, .memory-form,
  .section--interactive, .toast, .lightbox, .modal-root { display: none !important; }
  body { background: #fff; }
  .memorial__cover { height: 220px; border-radius: 0; box-shadow: none; }
  .card, .memory, .form-card { box-shadow: none; border-color: #ddd; break-inside: avoid; }
  .app { padding: 0; }
  .gallery__item figcaption { opacity: 1; transform: none; position: static; background: none; color: #444; padding: 6px 0 0; }
}

/* ---------- 响应式 ---------- */

@media (max-width: 860px) {
  .site-header__inner { padding: 10px 0; }
  .brand__text em { display: none; }
  .hero { padding: 54px 0 40px; }
  .memorial__head { margin-top: -70px; gap: 18px; }
  .memorial__portrait { width: 128px; height: 128px; border-width: 4px; }
  .site-footer__col--right { text-align: left; align-items: flex-start; }
  .form-card { padding: 24px 20px; }
}

@media (max-width: 560px) {
  .wrap { width: min(100% - 28px, var(--wrap)); }
  .brand__mark { width: 36px; height: 36px; border-radius: 12px; }
  .brand__mark svg { width: 25px; height: 25px; }
  .brand__text strong { font-size: 17px; }
  .site-nav { gap: 2px; }
  .site-nav__link { padding: 7px 10px; font-size: 13px; }
  .site-nav__link[data-action="open-data"] { display: none; }
  .site-nav__link[data-nav="new"] { background: var(--accent-wash); color: var(--accent-deep); }
  .grid { grid-template-columns: 1fr; gap: 20px; }
  .gallery { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
  .memorial__intro { min-width: 100%; }
  .memorial__name { font-size: 30px; }
  .memorial__epitaph { padding: 18px 20px; font-size: 16.5px; }
  .lightbox { grid-template-columns: 46px 1fr 46px; }
  .lightbox__nav { width: 38px; height: 38px; }
  .form-actions { justify-content: stretch; }
  .form-actions .btn { flex: 1; }
  .section__head { align-items: stretch; }
}

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