/* =========================================================
   PiaoRr —— 个人小站（星夜暗色 + 星尘场景）
   配色：暖纸底 + 墨色 + 单一陶土色点缀
   ========================================================= */

:root {
  --bg: #12101b;
  --bg-soft: #0c0a14;
  --surface: #1b1925;
  --ink: #f0e8dc;
  --ink-2: #b9aea0;
  --ink-3: #7e7567;
  --line: #2a2633;
  --accent: #e9a55c;
  --accent-soft: rgba(233, 165, 92, 0.12);
  --glow: rgba(233, 165, 92, 0.45);
  --rose: #d98a9c;
  --ghost: rgba(233, 165, 92, 0.2);

  --font-serif: "Noto Serif SC", "Songti SC", "SimSun", serif;
  --font-sans: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;

  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --safe-top: env(safe-area-inset-top, 0px);
}

[data-theme="light"] {
  --bg: #f6f3ed;
  --bg-soft: #f0e9df;
  --surface: #fbf9f5;
  --ink: #26221e;
  --ink-2: #6f675e;
  --ink-3: #a8a096;
  --line: #e7e0d4;
  --accent: #b0552e;
  --accent-soft: rgba(176, 85, 46, 0.08);
  --glow: rgba(176, 85, 46, 0.3);
  --rose: #c06a72;
  --ghost: rgba(176, 85, 46, 0.14);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  color: var(--ink);
  background:
    radial-gradient(120% 90% at 50% 0%, rgba(233, 165, 92, 0.07) 0%, transparent 60%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-soft) 100%) fixed;
  min-height: 100vh;
  line-height: 1.8;
  font-weight: 300;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  transition: background 0.4s, color 0.4s;
}
body::after {
  content: ""; position: fixed; inset: 0; z-index: 1000; pointer-events: none;
  opacity: 0.04;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- 场景层 ---------- */
#scene { position: fixed; inset: 0; z-index: -2; pointer-events: none; }
.nebula {
  position: fixed; border-radius: 50%; filter: blur(90px);
  opacity: 0.4; z-index: -3; pointer-events: none;
  animation: nebulaFloat 26s ease-in-out infinite alternate;
  transition: opacity 0.5s;
}
[data-theme="light"] .nebula { opacity: 0.22; }
.nebula-a { width: 46vw; height: 46vw; top: -14vw; right: -12vw;
  background: radial-gradient(circle, rgba(233, 165, 92, 0.5), transparent 70%); }
.nebula-b { width: 40vw; height: 40vw; top: 40%; left: -14vw;
  background: radial-gradient(circle, rgba(217, 138, 156, 0.4), transparent 70%); animation-delay: -9s; }
.nebula-c { width: 38vw; height: 38vw; bottom: -12vw; left: 24%;
  background: radial-gradient(circle, rgba(120, 110, 180, 0.35), transparent 70%); animation-delay: -16s; }
@keyframes nebulaFloat {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(6vw, 5vh) scale(1.15); }
}
body.scene-starry .nebula { opacity: 0.55; }

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

::selection { background: var(--accent); color: #fff; }

::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 6px; border: 2px solid var(--bg); }

/* ---------- 顶部导航 ---------- */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 900;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(var(--safe-top) + 18px) clamp(20px, 5vw, 56px) 16px;
  transition: background 0.35s, border-color 0.35s, padding 0.35s;
  border-bottom: 1px solid transparent;
}
.topbar.scrolled {
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom-color: var(--line);
  padding-top: calc(var(--safe-top) + 12px);
  padding-bottom: 12px;
}
.brand {
  font-family: var(--font-serif);
  font-size: 1.3rem; font-weight: 600; letter-spacing: 0.02em;
}
.navlinks { display: flex; gap: 4px; }
.navlinks a {
  position: relative; padding: 8px 14px; font-size: 0.92rem; font-weight: 400;
  color: var(--ink-2); border-radius: 8px; transition: color 0.25s, background 0.25s;
}
.navlinks a:hover { color: var(--ink); background: var(--accent-soft); }
.navlinks a.active { color: var(--ink); }
.navlinks a.active::after {
  content: ""; position: absolute; left: 14px; right: 14px; bottom: 3px;
  height: 2px; background: var(--accent); border-radius: 2px;
}

.topbar-right { display: flex; align-items: center; gap: 10px; }
.theme-toggle {
  width: 36px; height: 36px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 1.05rem; color: var(--ink-2);
  transition: background 0.25s, color 0.25s;
}
.theme-toggle:hover { background: var(--accent-soft); color: var(--ink); }

.menu-toggle { display: none; flex-direction: column; gap: 5px; width: 36px; height: 36px; align-items: center; justify-content: center; border-radius: 8px; }
.menu-toggle span { width: 20px; height: 1.5px; background: var(--ink); transition: 0.3s; }
.menu-toggle.open span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
.menu-toggle.open span:nth-child(2) { transform: translateY(-6.5px) rotate(-45deg); }

/* 移动端菜单 */
.mobile-menu {
  position: fixed; top: 0; left: 0; right: 0; z-index: 890;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  padding: calc(var(--safe-top) + 78px) 24px 20px;
  display: flex; flex-direction: column;
  transform: translateY(-100%); transition: transform 0.35s var(--ease);
}
.mobile-menu.open { transform: none; }
.mobile-menu a { padding: 14px 4px; font-size: 1.15rem; font-family: var(--font-serif); border-bottom: 1px solid var(--line); }
.mobile-menu a:last-child { border-bottom: none; }

/* ---------- 页面 / 路由 ---------- */
.page { display: none; padding: calc(var(--safe-top) + 120px) clamp(20px, 6vw, 64px) 96px; min-height: 100vh; max-width: 1180px; margin: 0 auto; }
.page.active { display: block; animation: pageIn 0.5s var(--ease) both; }
@keyframes pageIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* ---------- 首页 ---------- */
.home { max-width: 940px; }
.home-intro { margin-bottom: 72px; }
.eyebrow {
  font-size: 0.72rem; letter-spacing: 0.28em; text-transform: uppercase;
  color: var(--accent); font-weight: 500; margin-bottom: 26px;
}
.hero-name {
  font-family: var(--font-serif); font-weight: 600;
  font-size: clamp(3.2rem, 10vw, 6.5rem); line-height: 1.05; letter-spacing: 0.03em;
  position: relative; padding-bottom: 26px;
  text-shadow: 0 0 42px var(--glow);
}
.hero-name::after {
  content: ""; position: absolute; left: 0; bottom: 0;
  width: 64px; height: 3px; background: var(--accent);
}
.hero-line {
  font-family: var(--font-serif); font-size: clamp(1.2rem, 3vw, 1.7rem);
  color: var(--ink); margin-top: 26px;
}
.hero-desc {
  max-width: 30em; margin-top: 22px; color: var(--ink-2); font-size: 1rem;
}
.hero-recent { margin-top: 28px; font-size: 0.92rem; color: var(--ink-3); }
.recent-label {
  display: inline-block; padding: 2px 10px; margin-right: 10px;
  font-size: 0.72rem; letter-spacing: 0.1em; color: #fff; background: var(--accent); border-radius: 2px;
}
.hero-recent a { color: var(--ink-2); border-bottom: 1px solid var(--line); transition: color 0.25s, border-color 0.25s; }
.hero-recent a:hover { color: var(--accent); border-color: var(--accent); }

.statement {
  max-width: 30em; margin: 0 0 64px;
  padding: 12px 0 12px 28px;
  border-left: 3px solid var(--accent);
  background: linear-gradient(90deg, var(--accent-soft), transparent 70%);
  font-family: var(--font-serif); font-size: clamp(1.4rem, 3.2vw, 1.9rem);
  font-weight: 600; line-height: 1.6; color: var(--ink);
  text-shadow: 0 0 30px var(--glow);
}
.index-list { display: flex; flex-direction: column; }
.index-list a {
  display: grid; grid-template-columns: 56px 1fr auto;
  align-items: baseline; gap: 16px;
  padding: 20px 4px; border-bottom: 1px solid var(--line);
  transition: background 0.25s, padding 0.25s;
}
.index-list a:first-child { border-top: 1px solid var(--line); }
.index-list a:hover { background: var(--accent-soft); padding-left: 12px; }
.idx-num { font-family: var(--font-serif); font-size: 0.9rem; color: var(--accent); }
.idx-name { font-family: var(--font-serif); font-size: 1.5rem; font-weight: 500; }
.idx-en { font-size: 0.8rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-3); }

.footer {
  margin-top: 80px; padding-top: 28px; border-top: 1px solid var(--line);
  color: var(--ink-3); font-size: 0.82rem;
}

/* ---------- 页面头部 ---------- */
.page-head { position: relative; margin-bottom: 56px; max-width: 720px; }
.page-head::before {
  content: attr(data-ghost);
  position: absolute; top: -36px; left: -8px; z-index: 0;
  font-family: var(--font-serif); font-size: clamp(4.5rem, 13vw, 10rem);
  font-weight: 700; line-height: 1; letter-spacing: 0.02em; white-space: nowrap;
  color: transparent; -webkit-text-stroke: 1px var(--ghost);
  pointer-events: none; user-select: none;
}
.page-head > * { position: relative; z-index: 1; }
.eyebrow + .page-title { margin-top: 0; }
.page-title {
  font-family: var(--font-serif); font-weight: 600;
  font-size: clamp(2rem, 5vw, 3rem); line-height: 1.2;
}
.page-desc { margin-top: 14px; color: var(--ink-2); max-width: 34em; }

/* ---------- 标签筛选 ---------- */
.filter-bar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 40px; }
.filter-btn {
  padding: 5px 15px; border-radius: 999px; font-size: 0.82rem; color: var(--ink-2);
  border: 1px solid var(--line); transition: 0.25s; background: transparent;
}
.filter-btn:hover { color: var(--ink); border-color: var(--ink-3); }
.filter-btn.active { color: #fff; background: var(--accent); border-color: var(--accent); }

/* ---------- 岁月（目录） ---------- */
.year-index { max-width: 820px; display: flex; flex-direction: column; }
.year-link {
  display: grid; grid-template-columns: 96px 1fr auto; gap: 24px; align-items: center;
  padding: 28px 4px; border-bottom: 1px solid var(--line);
}
.year-link:first-child { border-top: 1px solid var(--line); }
.year-link:hover .year-title { color: var(--accent); }
.year-link:hover .year-arrow { transform: translateX(4px); color: var(--accent); }
.year-num { font-family: var(--font-serif); font-size: 1.7rem; font-weight: 600; color: var(--accent); line-height: 1; }
.year-info { display: flex; flex-direction: column; gap: 6px; }
.year-title { font-family: var(--font-serif); font-size: 1.25rem; font-weight: 600; color: var(--ink); transition: color 0.25s; }
.year-excerpt { color: var(--ink-2); font-size: 0.92rem; }
.year-arrow { color: var(--ink-3); font-size: 1.3rem; transition: transform 0.25s, color 0.25s; }

/* ---------- 故事（目录） ---------- */
.story-index { max-width: 820px; display: flex; flex-direction: column; }
.story-link {
  display: grid; grid-template-columns: auto 1fr auto auto; gap: 18px; align-items: center;
  padding: 26px 4px; border-bottom: 1px solid var(--line);
}
.story-link:first-child { border-top: 1px solid var(--line); }
.story-link:hover .story-title { color: var(--accent); }
.story-link:hover .year-arrow { transform: translateX(4px); color: var(--accent); }
.story-cat {
  font-size: 0.72rem; padding: 3px 12px; border-radius: 999px;
  color: var(--accent); border: 1px solid var(--accent); white-space: nowrap;
}
.story-info { display: flex; flex-direction: column; gap: 6px; }
.story-title { font-family: var(--font-serif); font-size: 1.25rem; font-weight: 600; color: var(--ink); transition: color 0.25s; }
.story-excerpt { color: var(--ink-2); font-size: 0.92rem; }
.story-link time { color: var(--ink-3); font-size: 0.82rem; white-space: nowrap; }

/* ---------- 返回链接 ---------- */
.back-link { display: inline-block; margin-bottom: 32px; font-size: 0.9rem; color: var(--ink-2); transition: color 0.25s; }
.back-link:hover { color: var(--accent); }

/* ---------- 文章详情 ---------- */
.article-body { display: none; max-width: 720px; margin: 0 auto; }
.article-body.active { display: block; animation: pageIn 0.45s var(--ease) both; }
.article-head { margin-bottom: 40px; }
.article-title { font-family: var(--font-serif); font-size: clamp(1.8rem, 4.4vw, 2.6rem); font-weight: 600; line-height: 1.25; }
.article-meta { margin-top: 14px; color: var(--ink-3); font-size: 0.85rem; }

/* 长文正文排版 */
.prose { font-size: 1.02rem; }
.prose p { line-height: 1.95; margin: 1.5em 0; }
.prose > p:first-of-type::first-letter {
  font-family: var(--font-serif); font-size: 3.1em; line-height: 0.85;
  float: left; padding-right: 0.14em; color: var(--accent); font-weight: 600;
}
.prose h2 { font-family: var(--font-serif); font-size: 1.45rem; font-weight: 600; margin: 2.4em 0 0.9em; }
.prose h3 { font-family: var(--font-serif); font-size: 1.2rem; font-weight: 600; margin: 2em 0 0.8em; }
.prose blockquote {
  margin: 1.8em 0; padding: 0.2em 0 0.2em 1.2em;
  border-left: 2px solid var(--accent); color: var(--ink-2); font-family: var(--font-serif); font-size: 1.05rem;
}
.prose > blockquote:first-child {
  text-align: center; border: none; padding: 1.6em 0; margin: 0.4em 0 2em;
  font-size: clamp(1.3rem, 3vw, 1.8rem); font-weight: 600; color: var(--ink);
  text-shadow: 0 0 30px var(--glow);
}
.prose ul, .prose ol { margin: 1.4em 0; padding-left: 1.5em; }
.prose li { margin: 0.5em 0; }
.prose img { width: 100%; border-radius: 6px; margin: 2em 0; }
.prose a { color: var(--accent); border-bottom: 1px solid var(--accent); }
.prose strong { font-weight: 500; }
.prose hr { border: none; border-top: 1px solid var(--line); margin: 2.4em 0; }

/* ---------- 随记 ---------- */
.note-list { max-width: 720px; }
.note { padding: 34px 0; border-bottom: 1px solid var(--line); }
.note:first-child { border-top: 1px solid var(--line); }
.note p { font-family: var(--font-serif); font-size: clamp(1.1rem, 2.4vw, 1.4rem); font-weight: 500; line-height: 1.7; }
.note footer { margin-top: 16px; font-size: 0.82rem; color: var(--ink-3); display: flex; gap: 16px; }
.note footer span:first-child { color: var(--accent); }

/* ---------- 热爱 ---------- */
.love-section { margin-bottom: 56px; }
.love-heading {
  font-family: var(--font-serif); font-size: 1.25rem; font-weight: 600;
  margin-bottom: 18px; padding-bottom: 10px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 10px;
}
.love-heading::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex-shrink: 0; }

.plain-list { list-style: none; display: flex; flex-direction: column; }
.plain-list li {
  display: grid; grid-template-columns: minmax(130px, 200px) 1fr; gap: 20px;
  padding: 16px 4px; border-bottom: 1px dashed var(--line);
}
.plain-list li strong { font-weight: 500; }
.plain-list li span { color: var(--ink-2); }

.hobby-list { list-style: none; max-width: 640px; }
.hobby { padding: 16px 0; }
.hobby-head { display: flex; justify-content: space-between; margin-bottom: 10px; font-size: 0.95rem; }
.hobby-level { color: var(--ink-3); font-size: 0.82rem; }
.hobby-bar { height: 3px; background: var(--line); border-radius: 2px; overflow: hidden; }
.hobby-fill {
  display: block; height: 100%; width: var(--w); background: var(--accent);
  transform: scaleX(0); transform-origin: left; transition: transform 1s var(--ease);
}
.hobby.visible .hobby-fill { transform: scaleX(1); }

/* ---------- 光影 ---------- */
.gallery-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 18px; }
.gallery-item {
  position: relative; overflow: hidden; cursor: zoom-in;
  aspect-ratio: 4 / 3; background: var(--surface);
}
.gallery-item img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.6s var(--ease), filter 0.6s; }
.gallery-item:hover img { transform: scale(1.05); }
.gallery-item figcaption {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 26px 16px 14px;
  font-size: 0.85rem; color: #fff;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.6));
  opacity: 0; transform: translateY(8px); transition: 0.35s;
}
.gallery-item:hover figcaption { opacity: 1; transform: none; }

/* ---------- 足迹 ---------- */
.map-wrap { max-width: 900px; margin: 0 auto 48px; }
.map-card { border: 1px solid var(--line); padding: 8px; background: var(--surface); box-shadow: 0 18px 50px -30px rgba(0, 0, 0, 0.7); }
.map-card svg { width: 100%; height: auto; display: block; }
.map-hint { margin-top: 12px; text-align: center; color: var(--ink-3); font-size: 0.8rem; }

.map-grid line { stroke: var(--line); stroke-width: 1; }
.map-tick { fill: var(--ink-3); font-family: var(--font-sans); font-size: 11px; }
.map-ref circle { fill: var(--ink-3); opacity: 0.6; }
.map-ref text { fill: var(--ink-3); font-size: 11px; }
.map-link { fill: none; stroke: var(--accent); stroke-width: 1.5; stroke-dasharray: 5 5; opacity: 0.5; }
.map-node { fill: var(--accent); }
.map-label { fill: var(--ink-2); font-size: 12px; font-weight: 400; text-anchor: middle; }
.map-you { fill: none; stroke: var(--accent); stroke-width: 1.5; }
.map-compass { fill: var(--ink-3); font-size: 12px; }

.place-list { max-width: 680px; margin: 0 auto; display: flex; flex-direction: column; }
.place {
  display: flex; align-items: baseline; gap: 20px;
  padding: 18px 4px; border-bottom: 1px solid var(--line);
}
.place-info h3 { font-family: var(--font-serif); font-weight: 600; font-size: 1.05rem; }
.place-info p { color: var(--ink-2); font-size: 0.9rem; }
.place time { margin-left: auto; color: var(--ink-3); font-size: 0.85rem; white-space: nowrap; }

/* ---------- 关于 ---------- */
.about { display: flex; gap: clamp(28px, 5vw, 56px); align-items: flex-start; flex-wrap: wrap; margin-bottom: 64px; }
.about-avatar { width: clamp(140px, 22vw, 220px); flex-shrink: 0; }
.about-avatar img { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; border-radius: 4px; }
.about-text { flex: 1; min-width: 260px; max-width: 520px; }
.about-text > p:first-child { color: var(--ink-2); }
.stats { display: flex; gap: 44px; margin: 28px 0; }
.stat { display: flex; flex-direction: column; }
.stat-num { font-family: var(--font-serif); font-size: 2rem; font-weight: 600; color: var(--accent); }
.stat-label { font-size: 0.8rem; color: var(--ink-3); }
.about-sign { color: var(--ink-2); font-style: italic; }

/* ---------- 留言 ---------- */
.guestbook { max-width: 680px; }
.guestbook-form { display: flex; flex-direction: column; gap: 14px; margin: 18px 0 40px; }
.guestbook-form input[type="text"], .guestbook-form textarea {
  width: 100%; padding: 12px 16px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font-size: 0.95rem; outline: none; transition: border-color 0.25s, box-shadow 0.25s;
}
.guestbook-form input:focus, .guestbook-form textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.guestbook-form textarea { resize: vertical; }
.guest-note { font-size: 0.75rem; color: var(--ink-3); }

.guestbook-wall { display: flex; flex-direction: column; }
.guest-card { padding: 20px 0; border-bottom: 1px solid var(--line); animation: pageIn 0.4s var(--ease) both; }
.guest-card:first-child { border-top: 1px solid var(--line); }
.guest-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
.guest-name { font-weight: 500; color: var(--accent); }
.guest-date { font-size: 0.75rem; color: var(--ink-3); }
.guest-msg { color: var(--ink-2); }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 12px 28px; border-radius: 999px; align-self: flex-start;
  font-size: 0.9rem; font-weight: 500; color: #fff; background: var(--accent);
  box-shadow: 0 6px 24px -8px var(--glow);
  transition: opacity 0.25s, transform 0.25s, box-shadow 0.25s;
}
.btn:hover { box-shadow: 0 10px 32px -6px var(--glow); }
.btn:hover { opacity: 0.88; transform: translateY(-1px); }

/* ---------- 灯箱 ---------- */
.lightbox {
  position: fixed; inset: 0; z-index: 1100;
  background: rgba(15, 12, 10, 0.94);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity 0.3s;
}
.lightbox.open { opacity: 1; pointer-events: auto; }
.lightbox-img { max-width: 88vw; max-height: 84vh; border-radius: 4px; transform: scale(0.96); transition: transform 0.3s var(--ease); }
.lightbox.open .lightbox-img { transform: scale(1); }
.lightbox-close, .lightbox-prev, .lightbox-next {
  position: absolute; font-size: 1.6rem; color: #fff;
  width: 48px; height: 48px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  display: flex; align-items: center; justify-content: center; transition: background 0.25s;
}
.lightbox-close:hover, .lightbox-prev:hover, .lightbox-next:hover { background: rgba(255, 255, 255, 0.2); }
.lightbox-close { top: calc(var(--safe-top) + 20px); right: 20px; font-size: 1.2rem; }
.lightbox-prev { left: 16px; top: 50%; transform: translateY(-50%); }
.lightbox-next { right: 16px; top: 50%; transform: translateY(-50%); }
.lightbox-caption { position: absolute; bottom: 28px; left: 50%; transform: translateX(-50%); color: #ddd5ca; font-size: 0.9rem; }

/* ---------- 入场动画 ---------- */
.reveal {
  opacity: 0; transform: translateY(18px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
  transition-delay: var(--delay, 0s);
}
.reveal.visible { opacity: 1; transform: none; }

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

/* ---------- 打卡 ---------- */
.checkin-wrap { max-width: 520px; margin: 0 auto; }
.checkin-card {
  border: 1px solid var(--line); background: var(--surface);
  border-radius: 18px; padding: 26px; box-shadow: 0 18px 50px -30px rgba(0, 0, 0, 0.7);
}
.checkin-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.checkin-date { font-family: var(--font-serif); font-size: 1.15rem; color: var(--ink-2); }
.checkin-streak { display: flex; align-items: baseline; gap: 8px; }
.checkin-streak strong { font-family: var(--font-serif); font-size: 2.4rem; font-weight: 600; color: var(--accent); }
.checkin-streak span { font-size: 0.8rem; color: var(--ink-3); }
.checkin-status { display: flex; gap: 10px; margin-bottom: 16px; }
.checkin-status button {
  flex: 1; padding: 12px 0; border-radius: 10px;
  border: 1px solid var(--line); background: transparent; color: var(--ink-2);
  font-size: 0.95rem; transition: 0.25s;
}
.checkin-status button.active { color: #fff; background: var(--accent); border-color: var(--accent); box-shadow: 0 6px 20px -8px var(--glow); }
.checkin-card textarea {
  width: 100%; padding: 12px 14px; border-radius: 10px; resize: vertical;
  border: 1px solid var(--line); background: transparent; color: var(--ink);
  font-size: 0.92rem; outline: none; margin-bottom: 16px; transition: border-color 0.25s;
}
.checkin-card textarea:focus { border-color: var(--accent); }
.checkin-card .btn { width: 100%; }
.checkin-msg { margin-top: 12px; text-align: center; font-size: 0.85rem; color: var(--ink-3); min-height: 1.2em; }
.checkin-week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; margin-top: 16px; }
.week-cell {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 10px 0; border-radius: 10px; border: 1px solid var(--line); color: var(--ink-3);
}
.week-cell span { font-size: 0.7rem; }
.week-cell i { font-style: normal; font-size: 0.85rem; height: 1em; }
.week-cell.done { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.week-cell.today { outline: 1px solid var(--accent); outline-offset: 2px; }

/* ---------- 同行 ---------- */
.friends-gate { max-width: 760px; margin: 0 auto; display: grid; grid-template-columns: 1fr auto 1fr; gap: 20px; align-items: stretch; }
.gate-card {
  border: 1px solid var(--line); background: var(--surface); border-radius: 18px;
  padding: 24px; display: flex; flex-direction: column; gap: 12px;
  box-shadow: 0 18px 50px -30px rgba(0, 0, 0, 0.7);
}
.gate-divider { align-self: center; color: var(--ink-3); font-size: 0.9rem; }
.gate-card input, .goal-add input, .goal-update input {
  padding: 11px 14px; border-radius: 10px; border: 1px solid var(--line);
  background: transparent; color: var(--ink); font-size: 0.92rem; outline: none; transition: border-color 0.25s;
}
.gate-card input:focus, .goal-add input:focus, .goal-update input:focus { border-color: var(--accent); }
.gate-card .btn { align-self: flex-start; }
.friends-note { grid-column: 1 / -1; text-align: center; font-size: 0.85rem; color: var(--ink-3); }

.friends-room { max-width: 760px; margin: 0 auto; }
.room-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 24px; }
.room-code { display: flex; align-items: center; gap: 10px; }
.room-code span { font-size: 0.8rem; color: var(--ink-3); }
.room-code strong { font-family: var(--font-serif); font-size: 1.4rem; letter-spacing: 0.15em; color: var(--accent); }
.copy-btn { padding: 5px 12px; border-radius: 999px; border: 1px solid var(--line); color: var(--ink-2); font-size: 0.78rem; transition: 0.25s; }
.copy-btn:hover { border-color: var(--accent); color: var(--accent); }
.room-actions { display: flex; gap: 8px; }
.btn-ghost { color: var(--ink); background: transparent; border: 1px solid var(--line); box-shadow: none; }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

.room-members { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; margin-bottom: 32px; }
.member-card {
  border: 1px solid var(--line); background: var(--surface); border-radius: 14px;
  padding: 16px; display: flex; flex-direction: column; gap: 6px;
}
.member-card strong { font-size: 1rem; }
.member-status { font-size: 0.85rem; color: var(--ink-2); }
.member-streak { font-size: 0.8rem; color: var(--accent); }
.member-card.done { border-color: var(--accent); }

.goal-add { display: flex; gap: 10px; margin-bottom: 20px; flex-wrap: wrap; }
.goal-add input { flex: 1; min-width: 140px; }
.goal-list { display: flex; flex-direction: column; gap: 16px; }
.goal-card { border: 1px solid var(--line); background: var(--surface); border-radius: 16px; padding: 20px; }
.goal-head { margin-bottom: 12px; }
.goal-head strong { font-family: var(--font-serif); font-size: 1.05rem; }
.goal-progress { list-style: none; display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.goal-progress li { display: flex; justify-content: space-between; font-size: 0.9rem; color: var(--ink-2); }
.goal-progress b { color: var(--ink); font-weight: 500; }
.goal-update { display: flex; gap: 10px; }
.goal-update input { flex: 1; }

@media (max-width: 720px) {
  .friends-gate { grid-template-columns: 1fr; }
  .gate-divider { display: none; }
}

/* ---------- 响应式 ---------- */
@media (max-width: 720px) {
  .navlinks { display: none; }
  .menu-toggle { display: flex; }
  .page { padding-top: calc(var(--safe-top) + 92px); }
  .home-intro { margin-bottom: 48px; }
  .year-link { grid-template-columns: 1fr auto; gap: 10px; padding: 22px 4px; }
  .year-num { font-size: 1.3rem; }
  .year-arrow { display: none; }
  .story-link { grid-template-columns: auto 1fr; gap: 12px; padding: 20px 4px; }
  .story-link time { display: none; }
  .plain-list li { grid-template-columns: 1fr; gap: 4px; }
  .index-list a { grid-template-columns: 44px 1fr auto; }
  .idx-name { font-size: 1.25rem; }
  .stats { gap: 28px; }
}
