/* ============================================================
   愈见 · 设计系统
   基调：夜、灯、雾、留白
   时段主题：随本地时间微调色温（深夜靛蓝为基准）
   ============================================================ */

:root {
  /* 中性层级：透明度阶（玻璃感） */
  --white-100: rgba(238, 232, 216, 1);
  --white-60: rgba(238, 232, 216, 0.62);
  --white-40: rgba(238, 232, 216, 0.42);
  --white-24: rgba(238, 232, 216, 0.26);
  --white-14: rgba(238, 232, 216, 0.14);
  --white-8:  rgba(238, 232, 216, 0.08);

  --lamp: #f2b465;                 /* 灯芯暖琥珀 */
  --lamp-hi: #ffe9c4;              /* 灯芯高光 */
  --lamp-deep: #d98f3c;            /* 灯芯底色 */
  --lamp-glow: rgba(242, 180, 101, 0.42);
  --lamp-halo: rgba(242, 180, 101, 0.16);
  --lamp-wash: rgba(242, 180, 101, 0.07);

  --serif: "Songti SC", "STSong", "Noto Serif CJK SC", "Noto Serif SC", "Source Han Serif SC", "SimSun", serif;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;

  --ease-slow: cubic-bezier(0.33, 0, 0.18, 1);
  --t-slow: 0.72s;

  --nav-h: 64px;
  --radius: 22px;
  --radius-sm: 14px;

  --measure: 560px;                /* 窄栏阅读 */
}

/* 时段主题：夜(21-5) / 晨(5-11) / 午(11-16) / 暮(16-21) */
html[data-time="night"] {
  --bg0: #070a13;
  --bg1: #0c1020;
  --panel: #121830;
  --panel-2: #171f3a;
  --ink: var(--white-100);
  --ink-2: var(--white-60);
  --ink-3: var(--white-40);
  --fog-c: rgba(122, 134, 168, 0.16);
  --fog-c2: rgba(86, 98, 138, 0.12);
  --sky-glow: radial-gradient(120% 90% at 50% -20%, rgba(74, 88, 150, 0.24), transparent 60%);
}
html[data-time="morning"] {
  --bg0: #0b0c17;
  --bg1: #111324;
  --panel: #171a30;
  --panel-2: #1d2038;
  --ink: var(--white-100);
  --ink-2: var(--white-60);
  --ink-3: var(--white-40);
  --fog-c: rgba(140, 134, 172, 0.15);
  --fog-c2: rgba(104, 100, 148, 0.11);
  --sky-glow: radial-gradient(120% 90% at 50% -20%, rgba(122, 106, 168, 0.2), transparent 60%);
}
html[data-time="midday"] {
  --bg0: #090d16;
  --bg1: #0e1424;
  --panel: #141b31;
  --panel-2: #1a233d;
  --ink: var(--white-100);
  --ink-2: var(--white-60);
  --ink-3: var(--white-40);
  --fog-c: rgba(116, 138, 172, 0.15);
  --fog-c2: rgba(84, 108, 146, 0.11);
  --sky-glow: radial-gradient(120% 90% at 50% -20%, rgba(84, 116, 164, 0.2), transparent 60%);
}
html[data-time="dusk"] {
  --bg0: #0b0a14;
  --bg1: #121021;
  --panel: #191630;
  --panel-2: #201c3a;
  --ink: var(--white-100);
  --ink-2: var(--white-60);
  --ink-3: var(--white-40);
  --fog-c: rgba(150, 124, 130, 0.13);
  --fog-c2: rgba(112, 92, 118, 0.1);
  --sky-glow: radial-gradient(120% 90% at 50% -20%, rgba(150, 104, 92, 0.18), transparent 60%);
}

/* 高对比模式（F-009） */
html.contrast {
  --white-100: rgba(255, 252, 244, 1);
  --white-60: rgba(255, 252, 244, 0.78);
  --white-40: rgba(255, 252, 244, 0.6);
  --white-24: rgba(255, 252, 244, 0.42);
  --white-14: rgba(255, 252, 244, 0.24);
  --white-8:  rgba(255, 252, 244, 0.14);
  --lamp: #ffcf8a;
}
/* 大字模式（F-009）：正文 ≥18px */
html.big { font-size: 118%; }
html.big body { font-size: 18px; }

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

[hidden] { display: none !important; }

/* 键盘可达性：清晰的焦点指示 */
:focus-visible {
  outline: 2px solid rgba(242, 180, 101, 0.65);
  outline-offset: 3px;
  border-radius: 6px;
}

html { font-size: 16px; }

body {
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.85;
  color: var(--ink);
  background: var(--bg0);
  min-height: 100dvh;
  overflow-x: hidden;
  transition: background 1.2s var(--ease-slow);
}

/* 夜空底 + 天光 + 雾 */
.sky {
  position: fixed; inset: 0; z-index: -3;
  background:
    var(--sky-glow),
    linear-gradient(180deg, var(--bg1) 0%, var(--bg0) 46%, var(--bg0) 100%);
  transition: background 1.2s var(--ease-slow);
}
.stars { position: fixed; inset: 0; z-index: -2; pointer-events: none; }
.stars i {
  position: absolute; width: 2px; height: 2px; border-radius: 50%;
  background: var(--white-40);
  animation: starTwinkle 5.2s ease-in-out infinite;
}
@keyframes starTwinkle {
  0%, 100% { opacity: 0.25; }
  50% { opacity: 0.7; }
}
.fog {
  position: fixed; z-index: -1; pointer-events: none;
  width: 130vmax; height: 130vmax; border-radius: 50%;
  filter: blur(60px);
  contain: layout paint;
}
.fog-a {
  left: -45vmax; top: 8vh;
  background: radial-gradient(closest-side, var(--fog-c), transparent 70%);
  animation: fogDriftA 78s linear infinite alternate;
}
.fog-b {
  right: -55vmax; top: 42vh;
  background: radial-gradient(closest-side, var(--fog-c2), transparent 70%);
  animation: fogDriftB 96s linear infinite alternate;
}
@keyframes fogDriftA {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to   { transform: translate3d(16vmax, 6vh, 0) scale(1.12); }
}
@keyframes fogDriftB {
  from { transform: translate3d(0, 0, 0) scale(1.06); }
  to   { transform: translate3d(-14vmax, -5vh, 0) scale(0.98); }
}

/* ---------- 布局骨架 ---------- */
.page {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 28px 22px calc(var(--nav-h) + 96px);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex; align-items: baseline; justify-content: space-between;
  padding: 6px 2px 0;
}
.brand {
  font-family: var(--serif);
  font-size: 1.5rem; font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--ink);
  text-decoration: none;
  display: inline-flex; align-items: center; gap: 10px;
}
.brand .brand-dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, var(--lamp-hi), var(--lamp) 62%, var(--lamp-deep));
  box-shadow: 0 0 10px 3px var(--lamp-glow), 0 0 26px 8px var(--lamp-halo);
  animation: lampPulse 4.6s ease-in-out infinite;
}
.slogan {
  font-size: 0.78rem; color: var(--ink-3); letter-spacing: 0.18em;
}
.toplink {
  font-size: 0.82rem; color: var(--ink-3); text-decoration: none;
  letter-spacing: 0.12em; padding: 6px 2px;
  transition: color var(--t-slow) var(--ease-slow);
}
.toplink:hover { color: var(--ink-2); }

.pagefoot {
  margin-top: auto;
  padding-top: 56px;
  text-align: center;
  font-size: 0.74rem;
  color: var(--ink-3);
  letter-spacing: 0.16em;
}
.pagefoot .footline {
  width: 64px; height: 1px; background: var(--white-8);
  margin: 0 auto 14px;
}

/* ---------- 灯 ---------- */
.lamp-orb {
  width: 12px; height: 12px; border-radius: 50%; flex: none;
  background: radial-gradient(circle at 35% 32%, var(--lamp-hi), var(--lamp) 58%, var(--lamp-deep));
  box-shadow: 0 0 12px 4px var(--lamp-glow), 0 0 40px 12px var(--lamp-halo);
  animation: lampPulse 4.6s ease-in-out infinite;
  contain: layout paint;
}
.lamp-orb.sm { width: 9px; height: 9px; }
.lamp-orb.lg { width: 18px; height: 18px; box-shadow: 0 0 18px 6px var(--lamp-glow), 0 0 64px 18px var(--lamp-halo); }
.lamp-orb.dim {
  background: radial-gradient(circle at 35% 32%, rgba(238,232,216,.5), rgba(238,232,216,.18) 60%, rgba(238,232,216,.06));
  box-shadow: none; animation: none;
}
@keyframes lampPulse {
  0%, 100% { transform: scale(1); filter: brightness(0.96); }
  50% { transform: scale(1.1); filter: brightness(1.08); }
}

/* ---------- 首页 ---------- */
.hero { padding: 44px 4px 8px; }
.hero-time {
  font-family: var(--serif);
  font-size: 2rem; font-weight: 700; letter-spacing: 0.1em;
  line-height: 1.5;
}
.hero-date {
  margin-top: 10px;
  font-size: 0.84rem; color: var(--ink-3); letter-spacing: 0.14em;
}
.hero-back {
  margin-top: 14px; display: none;
  font-size: 0.86rem; color: var(--lamp); letter-spacing: 0.06em;
  opacity: 0; animation: fadeUp 0.9s var(--ease-slow) 0.2s forwards;
}
.hero-back.show { display: block; }
.hero-term {
  margin-top: 10px;
  font-size: 0.84rem; letter-spacing: 0.14em;
  color: rgba(242, 180, 101, 0.72);
}

.checkin { padding: 34px 4px 0; }
.checkin-q {
  font-family: var(--serif);
  font-size: 1.12rem; letter-spacing: 0.12em; color: var(--ink-2);
  margin-bottom: 18px;
}
.levels { display: flex; gap: 12px; }
.level-btn {
  flex: 1;
  appearance: none; border: 1px solid var(--white-8);
  background: var(--white-8);
  color: var(--ink-2);
  border-radius: var(--radius-sm);
  padding: 18px 6px;
  font-family: var(--serif); font-size: 1.06rem; letter-spacing: 0.2em;
  cursor: pointer;
  transition: background var(--t-slow) var(--ease-slow),
              color var(--t-slow) var(--ease-slow),
              border-color var(--t-slow) var(--ease-slow),
              transform var(--t-slow) var(--ease-slow);
}
.level-btn:hover { background: var(--white-14); color: var(--ink); }
.level-btn.on {
  background: var(--lamp-wash);
  border-color: rgba(242, 180, 101, 0.4);
  color: var(--lamp);
}
.level-btn:active { transform: scale(0.97); }

/* 卡片 */
.card-wrap { padding: 30px 4px 0; }
.card {
  border: 1px solid var(--white-8);
  background: linear-gradient(165deg, var(--panel) 0%, var(--panel-2) 100%);
  border-radius: var(--radius);
  padding: 40px 30px 34px;
  position: relative; overflow: hidden;
  opacity: 0; transform: translateY(14px);
  animation: cardIn 0.9s var(--ease-slow) forwards;
  contain: layout paint;
}
.card::before {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(90% 60% at 50% -18%, var(--lamp-wash), transparent 70%);
  pointer-events: none;
}
@keyframes cardIn { to { opacity: 1; transform: translateY(0); } }
.card.redeal { animation: none; opacity: 1; transform: none; }

.card-tag {
  display: flex; align-items: center; gap: 8px;
  font-size: 0.74rem; color: var(--ink-3); letter-spacing: 0.22em;
  margin-bottom: 22px;
}
.card-tag .tagline { flex: 1; height: 1px; background: var(--white-8); }
.card-action {
  font-family: var(--serif);
  font-size: 1.66rem; font-weight: 700; letter-spacing: 0.06em;
  line-height: 1.7;
}
.card-copy {
  margin-top: 16px;
  font-family: var(--serif);
  font-size: 1.02rem; color: var(--ink-2); letter-spacing: 0.08em;
}
.card-empty {
  border: 1px dashed var(--white-14);
  border-radius: var(--radius);
  padding: 44px 30px;
  text-align: center;
}
.card-empty .orbhold { display: flex; justify-content: center; margin-bottom: 20px; }
.card-empty p {
  font-family: var(--serif); color: var(--ink-3);
  font-size: 0.98rem; letter-spacing: 0.14em;
}

/* 遇见了 */
.met { margin-top: 26px; display: flex; flex-direction: column; gap: 14px; }
.met-btn {
  appearance: none; border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 12px;
  padding: 19px 20px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(242,180,101,.22), rgba(242,180,101,.12));
  border: 1px solid rgba(242, 180, 101, 0.42);
  color: var(--lamp);
  font-family: var(--serif); font-size: 1.12rem; letter-spacing: 0.3em;
  transition: transform var(--t-slow) var(--ease-slow), box-shadow var(--t-slow) var(--ease-slow),
              background var(--t-slow) var(--ease-slow);
  box-shadow: 0 0 0 0 rgba(242,180,101,0);
}
.met-btn:hover { box-shadow: 0 0 34px 2px var(--lamp-halo); }
.met-btn:active { transform: scale(0.98); }
.met-btn.done {
  background: var(--white-8); border-color: var(--white-14);
  color: var(--ink-3); letter-spacing: 0.18em; font-size: 0.98rem;
  cursor: default; box-shadow: none;
}
.share-btn {
  appearance: none; cursor: pointer;
  align-self: center;
  background: none; border: none;
  color: var(--ink-3); font-size: 0.86rem; letter-spacing: 0.18em;
  padding: 10px 14px; font-family: var(--sans);
  border-bottom: 1px solid var(--white-14);
  transition: color var(--t-slow) var(--ease-slow), border-color var(--t-slow) var(--ease-slow);
}
.share-btn:hover { color: var(--ink-2); border-color: var(--white-24); }

.river-chip {
  margin-top: 30px;
  display: flex; align-items: center; gap: 10px;
  padding: 16px 20px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--white-8);
  background: var(--white-8);
  color: var(--ink-2); text-decoration: none;
  font-size: 0.9rem; letter-spacing: 0.1em;
  transition: background var(--t-slow) var(--ease-slow);
}
.river-chip:hover { background: var(--white-14); }
.river-chip.lit { border-color: rgba(242, 180, 101, 0.32); background: var(--lamp-wash); }
.river-chip .n { color: var(--lamp); font-family: var(--serif); }
.river-chip .arrow { margin-left: auto; color: var(--ink-3); }

/* ---------- 灯河 ---------- */
.river-head { padding: 40px 4px 6px; }
.river-title { font-family: var(--serif); font-size: 1.9rem; font-weight: 700; letter-spacing: 0.16em; }
.river-sub { margin-top: 8px; font-size: 0.84rem; color: var(--ink-3); letter-spacing: 0.16em; }
.river-sub .n { color: var(--lamp); font-family: var(--serif); font-size: 1rem; }
.river-back { display: none; margin-top: 14px; font-size: 0.86rem; color: var(--lamp); letter-spacing: 0.06em; }
.river-back.show { display: block; }

.river-stage { position: relative; margin: 26px 0 10px; }
.river-flow {
  position: absolute; top: -20px; bottom: -20px; left: 50%;
  width: 120px; transform: translateX(-50%);
  background: linear-gradient(180deg, transparent, var(--fog-c) 18%, var(--fog-c) 82%, transparent);
  filter: blur(26px);
  border-radius: 50%;
  pointer-events: none;
}
.rlamp {
  position: absolute; transform: translate(-50%, -50%);
  display: flex; align-items: center; gap: 10px;
  opacity: 0; animation: fadeUp 1s var(--ease-slow) forwards;
  cursor: pointer;
  padding: 10px 12px;
  border-radius: 999px;
  transition: background var(--t-slow) var(--ease-slow);
}
.rlamp:hover { background: var(--white-8); }
.rlamp .rd {
  font-size: 0.72rem; color: var(--ink-3); letter-spacing: 0.1em;
  font-variant-numeric: tabular-nums;
}
.rlamp:nth-child(even) { flex-direction: row-reverse; }
@keyframes fadeUp {
  from { opacity: 0; transform: translate(-50%, calc(-50% + 12px)); }
  to   { opacity: 1; transform: translate(-50%, -50%); }
}
.river-empty {
  margin-top: 40px; text-align: center; padding: 60px 20px;
  border: 1px dashed var(--white-14); border-radius: var(--radius);
}
.river-empty p { font-family: var(--serif); color: var(--ink-3); letter-spacing: 0.14em; }
.river-end {
  text-align: center; padding: 30px 0 6px;
  font-size: 0.78rem; color: var(--ink-3); letter-spacing: 0.2em;
}
.river-actions { display: flex; justify-content: center; padding-top: 18px; }

/* ---------- 呼吸亭 ---------- */
.breath-stage {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  min-height: 62vh; position: relative;
}
.breath-moon-wrap { position: relative; width: 300px; height: 300px; display: grid; place-items: center; }
.breath-fog {
  position: absolute; inset: -70px; border-radius: 50%;
  background: radial-gradient(closest-side, var(--fog-c), transparent 72%);
  filter: blur(24px);
  transition: transform 1s var(--ease-slow), opacity 1s var(--ease-slow);
  contain: layout paint;
  pointer-events: none;
}
.breath-moon {
  width: 220px; height: 220px; border-radius: 50%;
  background:
    radial-gradient(circle at 38% 34%, rgba(255, 233, 196, 0.95), rgba(242, 180, 101, 0.55) 42%, rgba(242, 180, 101, 0.14) 68%, rgba(242, 180, 101, 0.05) 100%);
  box-shadow: 0 0 60px 18px var(--lamp-halo), 0 0 140px 50px rgba(242, 180, 101, 0.06);
  will-change: transform;
  contain: layout paint;
  cursor: pointer;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
.breath-halo {
  position: absolute; width: 220px; height: 220px; border-radius: 50%;
  border: 1px solid var(--white-14);
  will-change: transform, opacity;
  pointer-events: none;
}
.holdring {
  position: absolute; inset: -16px; transform: rotate(-90deg);
  pointer-events: none;
  transition: opacity 0.6s var(--ease-slow);
}
.holdring circle { fill: none; stroke-width: 2; }
.holdring .track { stroke: var(--white-8); }
.holdring .prog { stroke: var(--lamp); stroke-linecap: round; stroke-dasharray: 100; stroke-dashoffset: 100; }
.breath-phase {
  margin-top: 46px; min-height: 2.2em;
  font-family: var(--serif); font-size: 1.2rem; letter-spacing: 0.3em;
  color: var(--ink-2); text-align: center;
  transition: opacity 0.6s var(--ease-slow);
}
.breath-sub {
  margin-top: 10px; min-height: 1.6em;
  font-size: 0.8rem; color: var(--ink-3); letter-spacing: 0.2em; text-align: center;
}
.breath-rounds { margin-top: 26px; display: flex; gap: 14px; }
.breath-rounds i {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--white-14);
  transition: background 0.8s var(--ease-slow), box-shadow 0.8s var(--ease-slow);
}
.breath-rounds i.on {
  background: var(--lamp);
  box-shadow: 0 0 10px 2px var(--lamp-glow);
}
.breath-ctl { margin-top: 34px; display: flex; gap: 22px; align-items: center; }
.ghost-btn {
  appearance: none; background: none; cursor: pointer;
  border: 1px solid var(--white-14); color: var(--ink-3);
  border-radius: 999px; padding: 12px 26px;
  font-size: 0.86rem; letter-spacing: 0.2em; font-family: var(--sans);
  transition: color var(--t-slow) var(--ease-slow), border-color var(--t-slow) var(--ease-slow);
}
.ghost-btn:hover { color: var(--ink-2); border-color: var(--white-24); }
.breath-done-note {
  margin-top: 18px; font-family: var(--serif); color: var(--ink-2);
  letter-spacing: 0.12em; text-align: center; line-height: 2;
  opacity: 0; transition: opacity 1.2s var(--ease-slow);
}
.breath-done-note.show { opacity: 1; }

/* ---------- 信件 ---------- */
.letter-head { padding: 40px 4px 6px; }
.letter-title { font-family: var(--serif); font-size: 1.9rem; font-weight: 700; letter-spacing: 0.16em; }
.letter-sub { margin-top: 8px; font-size: 0.84rem; color: var(--ink-3); letter-spacing: 0.14em; }
.letter-lock {
  margin-top: 44px; text-align: center; padding: 70px 26px;
  border: 1px dashed var(--white-14); border-radius: var(--radius);
}
.letter-lock .orbhold { display: flex; justify-content: center; margin-bottom: 24px; }
.letter-lock .t { font-family: var(--serif); font-size: 1.2rem; letter-spacing: 0.24em; color: var(--ink-2); }
.letter-lock .d { margin-top: 12px; font-size: 0.84rem; color: var(--ink-3); letter-spacing: 0.14em; }
.letter-paper {
  margin-top: 34px;
  background: linear-gradient(172deg, var(--panel) 0%, var(--panel-2) 100%);
  border: 1px solid var(--white-8);
  border-radius: var(--radius);
  padding: 44px 32px 38px;
  position: relative; overflow: hidden;
  opacity: 0; transform: translateY(14px);
  animation: cardIn 1s var(--ease-slow) forwards;
}
.letter-paper::before {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(90% 50% at 50% -16%, var(--lamp-wash), transparent 72%);
  pointer-events: none;
}
.letter-body {
  font-family: var(--serif);
  font-size: 1.06rem; line-height: 2.15; letter-spacing: 0.06em;
  color: var(--ink);
}
.letter-sign {
  margin-top: 30px; text-align: right;
  font-family: var(--serif); font-size: 0.94rem; color: var(--ink-2);
  letter-spacing: 0.08em;
}
.letter-help {
  margin-top: 24px; display: flex; flex-direction: column; gap: 12px; align-items: flex-start;
  padding: 20px 22px; border-radius: var(--radius-sm);
  background: var(--lamp-wash); border: 1px solid rgba(242, 180, 101, 0.3);
}
.letter-help p { font-size: 0.92rem; color: var(--ink-2); letter-spacing: 0.06em; }

/* ---------- 说明页 ---------- */
.about-sec { padding: 34px 4px 0; }
.about-sec h2 {
  font-family: var(--serif); font-size: 1.2rem; letter-spacing: 0.18em;
  color: var(--ink); margin-bottom: 16px;
  display: flex; align-items: center; gap: 10px;
}
.about-sec h2::after { content: ""; flex: 1; height: 1px; background: var(--white-8); }
.about-sec p, .about-sec li { font-size: 0.95rem; color: var(--ink-2); letter-spacing: 0.04em; }
.about-sec ul { list-style: none; display: flex; flex-direction: column; gap: 12px; }
.about-sec li { padding-left: 18px; position: relative; }
.about-sec li::before {
  content: ""; position: absolute; left: 0; top: 0.72em;
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--lamp); box-shadow: 0 0 8px 2px var(--lamp-halo);
}
.about-note {
  margin-top: 16px; padding: 20px 22px;
  border-radius: var(--radius-sm);
  background: var(--lamp-wash); border: 1px solid rgba(242, 180, 101, 0.3);
  font-size: 0.92rem; color: var(--ink-2); letter-spacing: 0.04em;
}
.about-note b { color: var(--lamp); font-weight: 600; }
.setrow {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 4px; border-bottom: 1px solid var(--white-8);
}
.setrow .lb { font-size: 0.98rem; color: var(--ink); letter-spacing: 0.06em; }
.setrow .ds { font-size: 0.8rem; color: var(--ink-3); margin-top: 4px; letter-spacing: 0.04em; }
.switch {
  appearance: none; width: 52px; height: 30px; flex: none;
  border-radius: 999px; border: 1px solid var(--white-14);
  background: var(--white-8); cursor: pointer; position: relative;
  transition: background var(--t-slow) var(--ease-slow);
}
.switch::after {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--white-60);
  transition: transform var(--t-slow) var(--ease-slow), background var(--t-slow) var(--ease-slow);
}
.switch.on { background: rgba(242, 180, 101, 0.3); border-color: rgba(242, 180, 101, 0.5); }
.switch.on::after { transform: translateX(22px); background: var(--lamp); }
.danger-btn {
  appearance: none; cursor: pointer; width: 100%;
  margin-top: 20px; padding: 17px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(214, 106, 96, 0.4);
  background: rgba(214, 106, 96, 0.08);
  color: #d9897e;
  font-size: 0.95rem; letter-spacing: 0.16em; font-family: var(--sans);
  transition: background var(--t-slow) var(--ease-slow);
}
.danger-btn:hover { background: rgba(214, 106, 96, 0.16); }

/* ---------- 底栏（常驻导航 + 12356） ---------- */
.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  background: color-mix(in srgb, var(--bg1) 78%, transparent);
  -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
  border-top: 1px solid var(--white-8);
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.nav-in {
  max-width: var(--measure); margin: 0 auto;
  display: flex; align-items: stretch; height: var(--nav-h);
}
.nav a, .nav button {
  flex: 1; appearance: none; background: none; border: none; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  color: var(--ink-3); text-decoration: none;
  font-size: 0.66rem; letter-spacing: 0.08em; font-family: var(--sans);
  transition: color var(--t-slow) var(--ease-slow);
  position: relative; min-width: 0; padding: 0 2px;
}
.nav a.on { color: var(--lamp); }
.nav a.on::before {
  content: ""; position: absolute; top: 0; width: 22px; height: 2px;
  background: var(--lamp); border-radius: 2px;
  box-shadow: 0 0 10px 2px var(--lamp-glow);
}
.nav svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.nav .nav-help { color: #e8a6a0; }
.nav .nav-help svg { stroke: #e8a6a0; }

/* 求助面板（底部浮层） */
.sheet-mask {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(4, 6, 12, 0.6);
  opacity: 0; pointer-events: none;
  transition: opacity 0.6s var(--ease-slow);
}
.sheet-mask.open { opacity: 1; pointer-events: auto; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 51;
  transform: translateY(105%);
  transition: transform 0.6s var(--ease-slow);
  background: var(--panel);
  border-top: 1px solid var(--white-14);
  border-radius: 26px 26px 0 0;
  padding: 14px 22px calc(30px + env(safe-area-inset-bottom, 0));
}
.sheet.open { transform: translateY(0); }
.sheet-in { max-width: var(--measure); margin: 0 auto; }
.sheet-grip { width: 42px; height: 4px; border-radius: 4px; background: var(--white-14); margin: 4px auto 20px; }
.sheet h3 { font-family: var(--serif); font-size: 1.16rem; letter-spacing: 0.16em; margin-bottom: 8px; }
.sheet .sd { font-size: 0.86rem; color: var(--ink-2); letter-spacing: 0.04em; margin-bottom: 20px; }
.call-btn {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  width: 100%; padding: 18px; border-radius: 999px; text-decoration: none;
  background: linear-gradient(180deg, rgba(242,180,101,.24), rgba(242,180,101,.12));
  border: 1px solid rgba(242, 180, 101, 0.45);
  color: var(--lamp);
  font-family: var(--serif); font-size: 1.2rem; letter-spacing: 0.2em;
}
.call-btn svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.sheet-row { display: flex; gap: 12px; margin-top: 12px; }
.sheet-row .ghost-btn { flex: 1; padding: 14px; text-align: center; }
.sheet-fine { margin-top: 18px; font-size: 0.78rem; color: var(--ink-3); letter-spacing: 0.06em; line-height: 1.9; }

/* 灯河回忆卡 */
.mem-card {
  border: 1px solid var(--white-8);
  background: var(--white-8);
  border-radius: var(--radius-sm);
  padding: 26px 24px;
  margin-bottom: 16px;
}
.mem-action { font-family: var(--serif); font-size: 1.3rem; font-weight: 700; letter-spacing: 0.06em; line-height: 1.7; }
.mem-copy { margin-top: 10px; font-family: var(--serif); font-size: 0.94rem; color: var(--ink-2); letter-spacing: 0.08em; }

/* 温和求助条（连续3天"很糟"触发，非弹窗） */
.care-bar {
  position: fixed; left: 12px; right: 12px; z-index: 45;
  bottom: calc(var(--nav-h) + 12px + env(safe-area-inset-bottom, 0));
  max-width: calc(var(--measure) - 24px); margin: 0 auto;
  background: var(--panel);
  border: 1px solid rgba(242, 180, 101, 0.32);
  border-radius: var(--radius-sm);
  padding: 16px 18px;
  display: none;
  gap: 12px; align-items: flex-start;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
  animation: fadeUp2 0.9s var(--ease-slow);
}
.care-bar.show { display: flex; }
@keyframes fadeUp2 { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.care-bar p { flex: 1; font-size: 0.86rem; color: var(--ink-2); letter-spacing: 0.03em; line-height: 1.9; }
.care-bar p b { color: var(--lamp); font-weight: 600; }
.care-bar .cb-x {
  appearance: none; background: none; border: none; cursor: pointer;
  color: var(--ink-3); font-size: 1.1rem; padding: 2px 6px; line-height: 1;
}
.care-bar .cb-a { color: var(--lamp); text-decoration: none; border-bottom: 1px solid rgba(242,180,101,.4); }

/* 轻提示 */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--nav-h) + 30px + env(safe-area-inset-bottom, 0));
  transform: translate(-50%, 12px);
  z-index: 60;
  background: var(--panel-2);
  border: 1px solid var(--white-14);
  color: var(--ink); font-size: 0.86rem; letter-spacing: 0.1em;
  padding: 12px 22px; border-radius: 999px;
  opacity: 0; pointer-events: none;
  transition: opacity 0.6s var(--ease-slow), transform 0.6s var(--ease-slow);
  max-width: 86vw;
  text-align: center;
  line-height: 1.7;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* 进入淡入 */
.fade-in { animation: fadeUp3 0.9s var(--ease-slow) both; }
@keyframes fadeUp3 { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ---------- 减弱动效：全站降级为静态 ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .fog-a, .fog-b, .stars i, .lamp-orb, .brand .brand-dot { animation: none !important; }
}

/* ---------- 柔光模式（手动）：少动、少光 ---------- */
html.soft *, html.soft *::before, html.soft *::after {
  animation-duration: 0.01ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.01ms !important;
}
html.soft .fog { opacity: 0.5; }
html.soft .lamp-orb, html.soft .brand .brand-dot {
  box-shadow: 0 0 8px 2px var(--lamp-halo);
}
html.soft .stars { opacity: 0.5; }

/* 触屏双击缩放抑制（操作更跟手） */
a, button { touch-action: manipulation; }

/* 桌面端：可用但保持窄栏 */
@media (min-width: 720px) {
  :root { --measure: 600px; }
  .page { padding-top: 40px; }
}

/* ---------- 写写（F-010 每日小记） ---------- */
.hero-moon {
  margin-top: 10px;
  font-size: 0.84rem; letter-spacing: 0.14em;
  color: var(--ink-3);
}
.hero-moon b { color: rgba(242, 180, 101, 0.72); font-weight: 500; }

.write-prompt {
  margin-top: 16px; padding: 14px 18px;
  border-left: 2px solid rgba(242, 180, 101, 0.4);
  font-family: var(--serif); font-size: 0.94rem; letter-spacing: 0.06em;
  color: var(--ink-2); line-height: 1.9;
}
.write-prompt .wp-tag {
  display: block; margin-bottom: 4px;
  font-size: 0.72rem; color: var(--ink-3); letter-spacing: 0.2em;
  font-family: var(--sans);
}

.write-box {
  margin-top: 22px;
  border: 1px solid var(--white-8);
  background: var(--white-8);
  border-radius: var(--radius-sm);
  padding: 6px;
  transition: opacity 1.2s var(--ease-slow), filter 1.2s var(--ease-slow), transform 1.2s var(--ease-slow);
}
.write-box:focus-within { border-color: rgba(242, 180, 101, 0.32); }
.write-hero { padding: 22px 4px 4px; }

.write-box textarea {
  display: block; width: 100%; min-height: 29vh;
  appearance: none; border: none; outline: none; resize: vertical;
  background: transparent; color: var(--ink);
  font-family: var(--serif); font-size: 1.04rem; line-height: 2.05;
  letter-spacing: 0.04em; padding: 18px 16px;
}
.write-box textarea::placeholder { color: var(--ink-3); opacity: 0.75; }
/* 随雾散：字化成雾，向上散开 */
.write-box.releasing {
  opacity: 0; filter: blur(10px); transform: translateY(-14px);
  pointer-events: none;
}

.write-meta {
  margin-top: 14px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: 40px;
  scroll-margin-bottom: calc(var(--nav-h) + 20px);
}
.write-state { font-size: 0.78rem; color: var(--ink-3); letter-spacing: 0.1em; }
.write-release {
  appearance: none; background: none; cursor: pointer;
  border: 1px solid var(--white-14); border-radius: 999px;
  color: var(--ink-3); font-size: 0.8rem; letter-spacing: 0.12em;
  font-family: var(--sans); padding: 10px 18px;
  transition: color var(--t-slow) var(--ease-slow), border-color var(--t-slow) var(--ease-slow);
}
.write-release:hover { color: var(--ink-2); border-color: var(--white-24, rgba(255,255,255,.24)); }

/* 在看旧日子时的提示条 */
.write-viewing {
  display: none;
  margin-top: 14px; padding: 10px 16px;
  border: 1px solid rgba(242, 180, 101, 0.3); border-radius: 999px;
  font-size: 0.8rem; color: var(--lamp); letter-spacing: 0.1em;
  background: rgba(242, 180, 101, 0.07);
  align-items: center; justify-content: space-between; gap: 10px;
}
.write-viewing.show { display: flex; }
.write-viewing button {
  appearance: none; background: none; border: none; cursor: pointer;
  color: var(--lamp); font-size: 0.8rem; letter-spacing: 0.1em;
  border-bottom: 1px solid rgba(242, 180, 101, 0.4); padding: 0 0 2px;
}

/* 写写安全网：危机词提示，温和、可关闭、每天至多一次；
   固定在底栏上方，打字时也能被看见 */
.write-care {
  position: fixed; left: 12px; right: 12px; z-index: 45;
  bottom: calc(var(--nav-h) + 12px + env(safe-area-inset-bottom, 0));
  max-width: calc(var(--measure) - 24px); margin: 0 auto;
  padding: 16px 18px;
  border: 1px solid rgba(242, 180, 101, 0.32);
  background: var(--panel); border-radius: var(--radius-sm);
  display: flex; gap: 12px; align-items: flex-start;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
  animation: fadeUp2 0.9s var(--ease-slow);
}
.write-care p { flex: 1; font-size: 0.84rem; color: var(--ink-2); line-height: 1.9; letter-spacing: 0.03em; }
.write-care a { color: var(--lamp); text-decoration: none; border-bottom: 1px solid rgba(242,180,101,.4); }
.write-care .cb-x {
  appearance: none; background: none; border: none; cursor: pointer;
  color: var(--ink-3); font-size: 1.1rem; padding: 2px 6px; line-height: 1;
}

/* 以前写下的 */
.write-past { margin-top: 40px; }
.write-past .wp-title {
  font-family: var(--serif); font-size: 1rem; letter-spacing: 0.14em;
  color: var(--ink-2); margin-bottom: 6px;
}
.write-past .wp-hint { font-size: 0.78rem; color: var(--ink-3); letter-spacing: 0.08em; margin-bottom: 14px; }
.wp-item {
  display: flex; align-items: baseline; gap: 14px;
  width: 100%; text-align: left;
  appearance: none; background: none; border: none; cursor: pointer;
  border-bottom: 1px solid var(--white-8);
  padding: 15px 4px;
  transition: background var(--t-slow) var(--ease-slow);
}
.wp-item:hover { background: var(--white-8); }
.wp-item .wp-date {
  flex: none; font-size: 0.82rem; color: var(--lamp); letter-spacing: 0.08em;
  font-family: var(--serif);
}
.wp-item .wp-preview {
  flex: 1; min-width: 0;
  font-size: 0.86rem; color: var(--ink-3); letter-spacing: 0.04em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.wp-item .wp-n { flex: none; font-size: 0.72rem; color: var(--ink-3); opacity: 0.7; }

/* 呼吸亭 · 雨声开关 */
.rain-btn {
  appearance: none; background: none; cursor: pointer;
  border: 1px solid var(--white-14); border-radius: 999px;
  color: var(--ink-3); font-size: 0.78rem; letter-spacing: 0.14em;
  font-family: var(--sans); padding: 10px 18px;
  display: inline-flex; align-items: center; gap: 8px;
  transition: color var(--t-slow) var(--ease-slow), border-color var(--t-slow) var(--ease-slow);
}
.rain-btn svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.rain-btn.on { color: var(--lamp); border-color: rgba(242, 180, 101, 0.45); }
