/* ===================================================================
   识海 · 粒子记忆库   —   样式表
   深紫星空 / 柔和光晕 / 玻璃质感面板
   =================================================================== */

:root {
  --bg-abyss: #02000a;
  --bg-deep: #06010f;
  --bg-mid: #130826;
  --bg-soft: #1d0f37;

  --violet: #8b5cff;
  --violet-dim: #5c3aa8;
  --pink: #ff7ad9;
  --cyan: #66e6ff;

  --text: #ece7ff;
  --text-sub: #b6a8dd;
  --text-dim: #7d6fa6;

  --line: rgba(150, 120, 255, 0.16);

  --panel-w: 410px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);

  --font-sans: "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
  --font-serif: "Songti SC", "STSong", "Noto Serif SC", "Source Han Serif SC", Georgia, serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg-abyss);
  color: var(--text);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
}

body {
  background:
    radial-gradient(120% 90% at 22% 8%, #2a1250 0%, rgba(19, 8, 38, 0.85) 32%, rgba(6, 1, 15, 0) 68%),
    radial-gradient(100% 80% at 82% 88%, #1b0b3a 0%, rgba(9, 2, 22, 0.9) 45%, rgba(3, 0, 10, 0) 78%),
    linear-gradient(170deg, #0a0418 0%, #06010f 55%, #02000a 100%);
  /* 整页不滚动，但 iOS 上按住球体往上撸仍会触发下拉刷新，
     那一下会把正在拖动的球打断。关掉。 */
  overscroll-behavior: none;
  /* 点光点时浏览器默认会闪一块灰，在纯黑场里特别脏 */
  -webkit-tap-highlight-color: transparent;
}

/* ---------------- 舞台 ---------------- */
#stage {
  position: fixed;
  inset: 0;
  z-index: 1;
}

#scene {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: grab;
  /* 拖动是唯一的操作，别让浏览器顺手把文字框选起来 */
  user-select: none;
  -webkit-user-select: none;
}

#scene.is-grabbing { cursor: grabbing; }
#scene.is-hover    { cursor: pointer; }

/* 大气极光层：极缓的呼吸，制造"识海"流动感 */
.aurora {
  position: absolute;
  inset: -12%;
  pointer-events: none;
  mix-blend-mode: screen;
  opacity: 0.55;
  background:
    radial-gradient(38% 30% at 26% 22%, rgba(122, 66, 255, 0.30) 0%, rgba(122, 66, 255, 0) 70%),
    radial-gradient(32% 26% at 74% 30%, rgba(255, 90, 200, 0.14) 0%, rgba(255, 90, 200, 0) 70%),
    radial-gradient(44% 34% at 55% 80%, rgba(60, 150, 255, 0.16) 0%, rgba(60, 150, 255, 0) 72%);
  animation: auroraDrift 26s ease-in-out infinite alternate;
  filter: blur(6px);
}

@keyframes auroraDrift {
  0%   { transform: translate3d(-1.4%, -1%, 0) scale(1);    opacity: 0.42; }
  50%  { transform: translate3d(1.2%, 0.8%, 0) scale(1.04); opacity: 0.62; }
  100% { transform: translate3d(1.8%, -0.6%, 0) scale(1.02); opacity: 0.5; }
}

/* 暗角 */
.vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(120% 100% at 50% 48%, rgba(0, 0, 0, 0) 42%, rgba(2, 0, 8, 0.55) 88%, rgba(2, 0, 8, 0.82) 100%);
}

/* 细腻颗粒，消掉渐变色带 */
.grain {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.035;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/></filter><rect width='160' height='160' filter='url(%23n)'/></svg>");
  background-size: 160px 160px;
}

/* ---------------- HUD ---------------- */
.hud {
  position: fixed;
  z-index: 6;
  pointer-events: none;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--text-dim);
}

.hud-top {
  top: 0;
  left: 0;
  right: 0;
  padding: 30px 34px;
  align-items: center;
  gap: 18px;
}

.brand { margin-right: auto; }

.hud-bottom {
  bottom: 0;
  left: 0;
  right: 0;
  padding: 26px 34px 28px;
}

/* 标识 */
.brand {
  display: flex;
  align-items: center;
  gap: 13px;
}

.brand-orb {
  position: relative;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #dcd0ff;
  box-shadow:
    0 0 10px 2px rgba(180, 150, 255, 0.9),
    0 0 28px 8px rgba(120, 70, 255, 0.55),
    0 0 60px 20px rgba(90, 40, 200, 0.28);
  animation: orbBreath 5.5s ease-in-out infinite;
}

@keyframes orbBreath {
  0%, 100% { transform: scale(1);    opacity: 0.9; }
  50%      { transform: scale(1.22); opacity: 1; }
}

.brand-txt { display: flex; flex-direction: column; gap: 3px; line-height: 1; }

.brand-txt b {
  font-family: var(--font-serif);
  font-size: 19px;
  font-weight: 500;
  letter-spacing: 0.32em;
  color: #efe9ff;
  text-shadow: 0 0 22px rgba(150, 110, 255, 0.55);
}

.brand-txt i {
  font-style: normal;
  font-size: 9px;
  letter-spacing: 0.34em;
  color: rgba(160, 140, 210, 0.6);
}

.brand-note {
  font-size: 11px;
  letter-spacing: 0.28em;
  color: rgba(150, 130, 200, 0.42);
}

/* 语义搜索：轻量到几乎不占视觉重量，聚焦时才浮现 */
.search-wrap {
  position: relative;
  display: flex;
  align-items: center;
  flex: 0 0 auto;
}

.search-input {
  width: 132px;
  height: 34px;
  padding: 0 26px 0 13px;
  border-radius: 17px;
  border: 1px solid rgba(150, 120, 255, 0.18);
  background: rgba(20, 10, 38, 0.42);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 11.5px;
  letter-spacing: 0.06em;
  outline: none;
  pointer-events: auto;   /* 同上：从 .hud 的 none 里接回来，否则输入框点不进去 */
  transition: width 320ms var(--ease), border-color 220ms ease,
              background 220ms ease, box-shadow 220ms ease;
}

.search-input::placeholder { color: rgba(160, 145, 210, 0.45); letter-spacing: 0.1em; }

.search-input:hover { border-color: rgba(170, 140, 255, 0.34); }

.search-input:focus {
  width: 226px;
  border-color: rgba(190, 150, 255, 0.6);
  background: rgba(38, 20, 66, 0.66);
  box-shadow: 0 0 24px rgba(130, 90, 255, 0.32);
}

.search-input::-webkit-search-cancel-button {
  -webkit-appearance: none;
  appearance: none;
  width: 11px;
  height: 11px;
  cursor: pointer;
  background: linear-gradient(45deg, transparent 44%, var(--text-dim) 44%, var(--text-dim) 56%, transparent 56%),
              linear-gradient(-45deg, transparent 44%, var(--text-dim) 44%, var(--text-dim) 56%, transparent 56%);
}


@media (max-width: 900px) {
  .search-wrap { position: static; }
  .search-input {
    width: 34px;
    padding: 0;
    color: transparent;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23c3b4f0' stroke-width='1.6' stroke-linecap='round'%3E%3Ccircle cx='10.5' cy='10.5' r='6.2'/%3E%3Cpath d='M15.2 15.2L20 20'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    cursor: text;
  }
  .search-input::placeholder { color: transparent; }
  .search-input:focus {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 40;
    width: min(210px, calc(100vw - 40px));
    padding: 0 26px 0 13px;
    color: var(--text);
    background-image: none;
    background-color: rgba(30, 16, 54, 0.94);
    backdrop-filter: blur(14px);
    /* iOS Safari 遇到小于 16px 的输入框会自作主张把整页放大，
       这一放就缩不回去，固定定位的球体当场错位。
       展开时把字号抬到 16px，它就不动了。 */
    font-size: 16px;
  }
  .search-input:focus::placeholder { color: rgba(160, 145, 210, 0.45); }
}

/* 底部 */
.hint { letter-spacing: 0.14em; color: rgba(160, 145, 205, 0.5); }

.count { display: flex; align-items: baseline; gap: 8px; }
.count b {
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 500;
  color: #d9cdff;
  letter-spacing: 0.02em;
  text-shadow: 0 0 18px rgba(140, 100, 255, 0.6);
}
.count i { font-style: normal; font-size: 11px; letter-spacing: 0.18em; color: rgba(150, 130, 200, 0.5); }

/* ---------------- 右侧面板 ---------------- */
.panel {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 12;
  width: var(--panel-w);
  height: 100%;
  display: flex;
  flex-direction: column;
  transform: translate3d(103%, 0, 0);
  transition: transform 760ms var(--ease), opacity 500ms ease;
  opacity: 0;
  will-change: transform;
  background:
    linear-gradient(168deg, rgba(32, 18, 58, 0.90) 0%, rgba(14, 7, 30, 0.94) 42%, rgba(6, 2, 16, 0.96) 100%);
  border-left: 1px solid rgba(150, 120, 255, 0.14);
  box-shadow:
    -40px 0 120px rgba(4, 0, 14, 0.75),
    inset 1px 0 0 rgba(200, 170, 255, 0.06);
  backdrop-filter: blur(22px) saturate(125%);
  -webkit-backdrop-filter: blur(22px) saturate(125%);
}

.panel.is-open {
  transform: translate3d(0, 0, 0);
  opacity: 1;
}

/* 面板左缘流光 */
.panel::before {
  content: "";
  position: absolute;
  left: -1px;
  top: 0;
  bottom: 0;
  width: 1px;
  background: linear-gradient(180deg,
    rgba(140, 100, 255, 0) 0%,
    rgba(160, 120, 255, 0.55) 30%,
    rgba(255, 130, 220, 0.35) 62%,
    rgba(120, 90, 255, 0) 100%);
  opacity: 0.9;
}

.panel-close {
  position: absolute;
  top: 22px;
  right: 22px;
  z-index: 3;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid rgba(160, 130, 255, 0.22);
  background: rgba(20, 10, 38, 0.6);
  color: rgba(200, 185, 245, 0.75);
  cursor: pointer;
  transition: all 260ms ease;
  backdrop-filter: blur(6px);
}

.panel-close:hover {
  color: #fff;
  border-color: rgba(200, 160, 255, 0.55);
  background: rgba(70, 40, 130, 0.55);
  box-shadow: 0 0 22px rgba(140, 100, 255, 0.45);
  transform: rotate(90deg);
}

.panel-scroll {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 58px 38px 46px;
}

.panel-scroll::-webkit-scrollbar { width: 5px; }
.panel-scroll::-webkit-scrollbar-track { background: transparent; }
.panel-scroll::-webkit-scrollbar-thumb {
  background: rgba(140, 110, 220, 0.24);
  border-radius: 4px;
}
.panel-scroll::-webkit-scrollbar-thumb:hover { background: rgba(160, 130, 240, 0.45); }

/* 元信息行 */
.panel-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  opacity: 0;
  transform: translateY(10px);
}

.panel.is-open .panel-meta { animation: riseIn 700ms 120ms var(--ease) forwards; }

.meta-index {
  font-family: var(--font-serif);
  font-size: 12px;
  letter-spacing: 0.22em;
  color: rgba(190, 165, 255, 0.85);
}

.meta-line {
  width: 34px;
  height: 1px;
  background: linear-gradient(90deg, rgba(160, 120, 255, 0.7), rgba(160, 120, 255, 0));
}

.meta-date {
  font-size: 11px;
  letter-spacing: 0.2em;
  color: rgba(150, 130, 200, 0.55);
}

/* 标题 */
.panel-title {
  margin: 0 0 26px;
  font-family: var(--font-serif);
  font-size: 27px;
  font-weight: 500;
  line-height: 1.45;
  letter-spacing: 0.05em;
  color: #f2ecff;
  text-shadow: 0 0 34px rgba(150, 110, 255, 0.35);
  opacity: 0;
  transform: translateY(14px);
}

.panel.is-open .panel-title { animation: riseIn 800ms 190ms var(--ease) forwards; }

/* 图片 */
.panel-figure {
  position: relative;
  margin: 0 0 28px;
  border-radius: 16px;
  overflow: hidden;
  aspect-ratio: var(--fig-ratio, 4 / 3);
  transition: aspect-ratio 520ms var(--ease);
  background: linear-gradient(150deg, #241240 0%, #120726 60%, #080214 100%);
  box-shadow:
    0 22px 60px rgba(0, 0, 0, 0.55),
    inset 0 0 0 1px rgba(170, 140, 255, 0.14);
  opacity: 0;
  transform: translateY(18px) scale(0.985);
}

.panel.is-open .panel-figure { animation: figureIn 900ms 250ms var(--ease) forwards; }

.panel-figure img {
  position: relative;
  z-index: 2;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 32%;
  opacity: 0;
  transition: opacity 700ms ease;
  filter: saturate(1.02) contrast(1.02);
}

.panel-figure img.is-loaded { opacity: 1; }

/* 图片顶部/底部融进面板的柔光 */
.panel-figure::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(26, 14, 48, 0.35) 0%, rgba(26, 14, 48, 0) 26%, rgba(8, 3, 20, 0) 62%, rgba(8, 3, 20, 0.55) 100%),
    radial-gradient(80% 60% at 50% 110%, rgba(120, 70, 255, 0.18), rgba(120, 70, 255, 0) 70%);
}

.figure-glow {
  position: absolute;
  z-index: 1;
  inset: 22% 18% -8% 18%;
  filter: blur(38px);
  background: radial-gradient(50% 50% at 50% 50%, rgba(130, 85, 255, 0.55), rgba(130, 85, 255, 0) 72%);
  opacity: 0.8;
}

/* 图片缺失时的柔和占位 */
.figure-fallback {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: none;
  place-items: center;
  background:
    radial-gradient(60% 60% at 30% 28%, rgba(140, 90, 255, 0.55), rgba(140, 90, 255, 0) 70%),
    radial-gradient(55% 55% at 74% 76%, rgba(255, 120, 210, 0.35), rgba(255, 120, 210, 0) 70%),
    linear-gradient(150deg, #22113f, #0b0419);
}

.figure-fallback span {
  font-family: var(--font-serif);
  font-size: 62px;
  color: rgba(240, 232, 255, 0.28);
  letter-spacing: 0.1em;
  text-shadow: 0 0 40px rgba(180, 140, 255, 0.5);
}

.panel-figure.is-missing .figure-fallback { display: grid; }

/* 正文 */
.panel-text {
  margin: 0;
  font-size: 14.5px;
  line-height: 2.15;
  letter-spacing: 0.045em;
  color: rgba(222, 212, 250, 0.86);
  text-align: justify;
  white-space: pre-line;
  opacity: 0;
  transform: translateY(14px);
}

.panel.is-open .panel-text { animation: riseIn 900ms 340ms var(--ease) forwards; }

.panel-foot {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 38px;
  padding-top: 20px;
  border-top: 1px solid rgba(150, 120, 255, 0.1);
  font-size: 11px;
  letter-spacing: 0.14em;
  color: rgba(140, 120, 190, 0.45);
  opacity: 0;
}

.panel.is-open .panel-foot { animation: riseIn 900ms 460ms var(--ease) forwards; }

.foot-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: rgba(170, 130, 255, 0.8);
  box-shadow: 0 0 10px 2px rgba(150, 100, 255, 0.7);
}

@keyframes riseIn {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes figureIn {
  from { opacity: 0; transform: translateY(18px) scale(0.985); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ---------------- 启动遮罩 ---------------- */
.boot {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  gap: 0;
  align-content: center;
  background: radial-gradient(60% 60% at 50% 48%, #100626 0%, #04010d 70%, #02000a 100%);
  transition: opacity 900ms ease, visibility 900ms ease;
}

.boot.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.boot p {
  margin: 26px 0 0;
  font-size: 11px;
  letter-spacing: 0.4em;
  color: rgba(165, 145, 215, 0.55);
  text-indent: 0.4em;
}

.boot-ring {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 1px solid rgba(150, 110, 255, 0.18);
  border-top-color: rgba(190, 155, 255, 0.9);
  box-shadow: 0 0 30px rgba(130, 85, 255, 0.35), inset 0 0 20px rgba(130, 85, 255, 0.18);
  animation: spin 1.5s linear infinite;
}

.boot.is-error .boot-ring { animation: none; border-color: rgba(255, 110, 150, 0.5); }
.boot.is-error p { letter-spacing: 0.12em; color: #ff9bb6; max-width: 80vw; text-align: center; line-height: 1.9; }

@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------- 面板打开时让 HUD 退让 ---------------- */
body.panel-open .hud-bottom,
body.panel-open .brand-note {
  opacity: 0;
  transition: opacity 400ms ease;
}

.hud { transition: opacity 500ms ease; }

/* ---------------- 响应式 ---------------- */
@media (max-width: 720px) {
  :root { --panel-w: 100%; }

  /* 安全区：iPhone 的刘海会让顶部标题被挖掉一截，
     底部那条手势横条会压住提示文字。inset 在桌面浏览器里是 0，不影响。 */
  .hud-top {
    padding: calc(20px + env(safe-area-inset-top)) calc(20px + env(safe-area-inset-right))
             20px calc(20px + env(safe-area-inset-left));
  }
  .hud-bottom {
    padding: 18px calc(20px + env(safe-area-inset-right))
             calc(22px + env(safe-area-inset-bottom)) calc(20px + env(safe-area-inset-left));
    flex-direction: column; align-items: flex-start; gap: 8px;
  }
  .brand-note { display: none; }
  .panel-scroll { padding: 62px 24px 40px; }
  .panel-title { font-size: 23px; }
  .hint { font-size: 10.5px; letter-spacing: 0.08em; }
}

@media (prefers-reduced-motion: reduce) {
  .aurora { animation: none; }
  .brand-orb { animation: none; }
  .panel, .panel * { transition-duration: 1ms !important; animation-duration: 1ms !important; }
}

/* ---------------- 声音开关 ---------------- */
.sound-btn {
  position: relative;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  padding: 0;
  border-radius: 50%;
  border: 1px solid rgba(150, 120, 255, 0.2);
  background: rgba(20, 10, 38, 0.45);
  color: rgba(195, 180, 240, 0.7);
  cursor: pointer;
  pointer-events: auto;
  transition: all 280ms ease;
  backdrop-filter: blur(6px);
}

.sound-btn:hover {
  color: #fff;
  border-color: rgba(190, 150, 255, 0.55);
  background: rgba(70, 40, 130, 0.5);
  box-shadow: 0 0 22px rgba(130, 90, 255, 0.4);
}

.sound-btn svg { position: absolute; transition: opacity 220ms ease; }
.sound-btn .i-off { opacity: 0; }
.sound-btn.is-muted .i-on { opacity: 0; }
.sound-btn.is-muted .i-off { opacity: 1; }
.sound-btn.is-muted { color: rgba(160, 145, 200, 0.42); }

/* ---------------- 面板：星座标签 ---------------- */
.meta-tag {
  font-size: 11px;
  letter-spacing: 0.18em;
  color: rgba(190, 170, 255, 0.75);
  padding: 1px 8px;
  border: 1px solid rgba(150, 120, 255, 0.22);
  border-radius: 999px;
  white-space: nowrap;
}

.meta-tag:empty { display: none; }

/* ---------------- 面板打开时：让世界安静下来 ---------------- */
body.panel-open .vignette {
  opacity: 1;
  background: radial-gradient(120% 100% at 50% 48%, rgba(0, 0, 0, 0.12) 30%, rgba(2, 0, 8, 0.68) 82%, rgba(2, 0, 8, 0.9) 100%);
}

.vignette { transition: background 700ms ease, opacity 700ms ease; }

/* 移动端：音量按钮贴右边 */
@media (max-width: 720px) {
  .sound-btn { width: 32px; height: 32px; }
  .hud-top { gap: 12px; }
}

/* ===================================================================
   星座索引 / 低语 / 悬停提示
   =================================================================== */

.cluster-nav {
  position: fixed;
  left: 34px;
  bottom: 92px;
  z-index: 6;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: auto;
  transition: opacity 500ms var(--ease);
}

body.panel-open .cluster-nav { opacity: 0; pointer-events: none; }

.cluster-item {
  display: flex;
  align-items: baseline;
  gap: 9px;
  font-size: 11px;
  letter-spacing: 0.14em;
  color: var(--text-dim);
  opacity: 0.62;
  cursor: pointer;
  /* 它现在是真按钮了：点得动、Tab 得到、读屏念得出来 */
  padding: 2px 4px;
  margin: -2px -4px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  font-family: inherit;
  text-align: left;
  transition: opacity 340ms ease, color 340ms ease, transform 480ms var(--ease), background 220ms ease;
  will-change: opacity, transform;
}

.cluster-item[aria-pressed="true"] {
  opacity: 1;
  color: var(--text);
  background: rgba(70, 40, 130, 0.38);
}

.cluster-item .c-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--c, currentColor);
  box-shadow: 0 0 9px var(--c, currentColor), 0 0 2px var(--c, currentColor);
  transform: translateY(-2px);
  flex: none;
}

.cluster-item .c-name { white-space: nowrap; }

.cluster-item .c-num {
  font-size: 10px;
  letter-spacing: 0.06em;
  opacity: 0.5;
  font-variant-numeric: tabular-nums;
}

.cluster-item.is-hot {
  opacity: 1;
  color: var(--text);
  transform: translateX(4px);
}

.cluster-item.is-hot .c-num { opacity: 0.8; }

/* 低语：远处浮起的一行小字 */
.whisper {
  position: fixed;
  left: -999px;
  top: -999px;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 7px;
  transform: translate(-50%, -50%);
  font-size: 11px;
  letter-spacing: 0.12em;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  color: rgba(230, 220, 255, 0.7);
  text-shadow: 0 0 14px rgba(150, 110, 255, 0.85), 0 0 3px rgba(255, 255, 255, 0.35);
  transition: opacity 1100ms ease;
}

.whisper.is-on { opacity: 1; }

.whisper-dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 10px currentColor;
  flex: none;
}

/* 悬停光点时的标题提示 */
.tip {
  position: fixed;
  left: -999px;
  top: -999px;
  z-index: 7;
  pointer-events: none;
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 11px;
  letter-spacing: 0.08em;
  white-space: nowrap;
  color: rgba(236, 231, 255, 0.92);
  background: rgba(20, 9, 40, 0.62);
  border: 1px solid rgba(150, 120, 255, 0.2);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
  opacity: 0;
  transform: translate(-50%, -150%);
  transition: opacity 200ms ease;
}

.tip.is-on { opacity: 1; }

@media (max-width: 900px) {
  .cluster-nav { display: none; }
  .tip { display: none; }
}


/* ===================================================================
   隐私：门锁 / 设置
   =================================================================== */

.icon-btn {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  padding: 0;
  border-radius: 50%;
  border: 1px solid rgba(150, 120, 255, 0.2);
  background: rgba(20, 10, 38, 0.45);
  color: rgba(195, 180, 240, 0.7);
  cursor: pointer;
  /* .hud 整体是 pointer-events:none，好让鼠标穿透 HUD 去拖星云。
     交互元素必须逐个把它接回来，否则鼠标在按钮上什么都点不到
     （这行曾经漏过：整排按钮只有声音键能点）。 */
  pointer-events: auto;
  transition: color 220ms ease, border-color 220ms ease, background 220ms ease, box-shadow 220ms ease;
}

.icon-btn:hover {
  color: #fff;
  border-color: rgba(190, 150, 255, 0.55);
  background: rgba(70, 40, 130, 0.5);
  box-shadow: 0 0 22px rgba(130, 90, 255, 0.4);
}

/* 语义布局开启时，按钮保持"亮着"的状态 */
.icon-btn.is-on {
  color: #fff;
  border-color: rgba(190, 150, 255, 0.62);
  background: rgba(78, 44, 145, 0.62);
  box-shadow: 0 0 20px rgba(140, 95, 255, 0.45), inset 0 0 12px rgba(150, 110, 255, 0.25);
}


/* ---------------- 门锁 ---------------- */
.lock-screen {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  opacity: 1;
  visibility: visible;
  transition: opacity 620ms var(--ease), visibility 620ms var(--ease);
}

.lock-screen.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.lock-screen.is-leaving { opacity: 0; }

.lock-veil {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(70% 58% at 50% 40%, #1a0b34 0%, #0a0418 55%, #02000a 100%);
}

.lock-card {
  position: relative;
  width: min(392px, 88vw);
  padding: 42px 38px 30px;
  text-align: center;
  border: 1px solid rgba(150, 120, 255, 0.14);
  border-radius: 20px;
  background: rgba(14, 6, 28, 0.66);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.lock-card.is-shake { animation: lockShake 420ms cubic-bezier(0.36, 0.07, 0.19, 0.97); }

@keyframes lockShake {
  10%, 90% { transform: translateX(-2px); }
  20%, 80% { transform: translateX(3px); }
  30%, 50%, 70% { transform: translateX(-5px); }
  40%, 60% { transform: translateX(5px); }
}

.lock-orb {
  width: 54px;
  height: 54px;
  margin: 0 auto 20px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  border: 1px solid rgba(160, 120, 255, 0.28);
  box-shadow: 0 0 40px rgba(130, 80, 255, 0.32), inset 0 0 24px rgba(130, 80, 255, 0.22);
  animation: lockBreath 4.6s ease-in-out infinite;
}

.lock-orb-core {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #cbb6ff;
  box-shadow: 0 0 14px #9b7bff;
}

@keyframes lockBreath {
  0%, 100% { transform: scale(1); opacity: 0.88; }
  50% { transform: scale(1.07); opacity: 1; }
}

.lock-kicker {
  margin: 0 0 14px;
  font-size: 10px;
  letter-spacing: 0.62em;
  text-indent: 0.62em;
  color: rgba(160, 140, 220, 0.5);
}

.lock-title {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 23px;
  font-weight: 400;
  letter-spacing: 0.07em;
  color: #f0eaff;
}

.lock-sub {
  margin: 12px 0 0;
  font-size: 12px;
  line-height: 1.8;
  letter-spacing: 0.08em;
  color: rgba(160, 145, 205, 0.72);
}

.lock-input {
  display: block;
  width: 100%;
  margin-top: 20px;
  padding: 13px 16px;
  border-radius: 10px;
  border: 1px solid rgba(150, 120, 255, 0.18);
  background: rgba(255, 255, 255, 0.028);
  color: #efe9ff;
  font-family: inherit;
  font-size: 13.5px;
  letter-spacing: 0.14em;
  text-align: center;
  outline: none;
  transition: border-color 220ms ease, box-shadow 220ms ease, background 220ms ease;
}

.lock-input::placeholder { color: rgba(140, 125, 185, 0.55); letter-spacing: 0.06em; }

.lock-input:focus {
  border-color: rgba(170, 135, 255, 0.55);
  box-shadow: 0 0 0 3px rgba(120, 80, 255, 0.12), 0 0 26px rgba(120, 80, 255, 0.18);
  background: rgba(255, 255, 255, 0.045);
}

.lock-input.is-hidden { display: none; }

.lock-submit {
  width: 100%;
  margin-top: 16px;
  padding: 13px;
  border-radius: 999px;
  border: 1px solid rgba(170, 135, 255, 0.45);
  background: rgba(110, 70, 235, 0.2);
  color: #f2ecff;
  font-family: inherit;
  font-size: 12px;
  letter-spacing: 0.3em;
  text-indent: 0.3em;
  cursor: pointer;
  transition: background 220ms ease, border-color 220ms ease, box-shadow 220ms ease;
}

.lock-submit:hover {
  background: rgba(130, 85, 255, 0.34);
  border-color: rgba(195, 160, 255, 0.7);
  box-shadow: 0 0 30px rgba(120, 80, 255, 0.35);
}

.lock-submit.is-busy { opacity: 0.55; cursor: wait; }

.lock-msg {
  min-height: 17px;
  margin: 14px 0 0;
  font-size: 11.5px;
  letter-spacing: 0.06em;
  color: #ff9bb6;
}

.lock-msg.is-ok { color: #8fe3c4; }

.lock-hint {
  display: none;
  margin: 8px 0 0;
  font-size: 11px;
  letter-spacing: 0.06em;
  color: rgba(175, 158, 225, 0.55);
}

.lock-hint.is-on { display: block; }

.lock-foot {
  margin: 26px 0 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 14px;
}

.link-btn {
  display: none;
  padding: 0;
  border: none;
  background: none;
  font-family: inherit;
  font-size: 11px;
  letter-spacing: 0.08em;
  color: rgba(165, 145, 225, 0.6);
  cursor: pointer;
  transition: color 200ms ease;
}

.link-btn.is-on { display: inline; }
.link-btn:hover { color: #e6dcff; }

.lock-note {
  width: 100%;
  margin-top: 6px;
  font-size: 10px;
  letter-spacing: 0.1em;
  color: rgba(128, 112, 172, 0.42);
}

/* ---------------- 隐私设置面板 ---------------- */
.privacy {
  position: fixed;
  inset: 0;
  z-index: 55;
  display: grid;
  place-items: center;
  opacity: 0;
  visibility: hidden;
  background: rgba(2, 0, 10, 0.5);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: opacity 280ms ease, visibility 280ms ease;
}

.privacy.is-open { opacity: 1; visibility: visible; }

.privacy-card {
  width: min(430px, 90vw);
  padding: 22px 22px 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(16, 8, 32, 0.94);
  box-shadow: 0 34px 90px rgba(0, 0, 0, 0.62);
}

.privacy-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.privacy-head h2 {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 14px;
  font-weight: 400;
  letter-spacing: 0.34em;
  color: var(--text);
}

.privacy-close {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: none;
  color: var(--text-sub);
  cursor: pointer;
}

.privacy-close:hover { color: #fff; border-color: rgba(190, 150, 255, 0.5); }

.set-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  border-top: 1px solid rgba(150, 120, 255, 0.08);
}

.set-row:first-child { border-top: none; }

.set-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
}

.set-label {
  font-size: 12.5px;
  line-height: 1.5;
  letter-spacing: 0.04em;
  color: rgba(226, 218, 255, 0.9);
}

.set-label i {
  display: block;
  margin-top: 4px;
  font-style: normal;
  font-size: 11px;
  line-height: 1.6;
  color: var(--text-dim);
}

.seg-group { display: flex; flex: 0 0 auto; gap: 6px; }

.seg {
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(150, 120, 255, 0.18);
  background: none;
  color: rgba(180, 165, 225, 0.7);
  font-family: inherit;
  font-size: 11px;
  white-space: nowrap;
  cursor: pointer;
  transition: color 200ms ease, background 200ms ease, border-color 200ms ease;
}

.seg:hover { color: #fff; border-color: rgba(180, 145, 255, 0.5); }

.seg.is-on {
  color: #fff;
  background: rgba(120, 80, 255, 0.28);
  border-color: rgba(170, 135, 255, 0.6);
}

.sw {
  position: relative;
  width: 40px;
  height: 22px;
  flex: 0 0 auto;
  padding: 0;
  border-radius: 999px;
  border: 1px solid rgba(150, 120, 255, 0.22);
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
  transition: background 220ms ease, border-color 220ms ease;
}

.sw span {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: rgba(200, 185, 245, 0.5);
  transition: left 240ms var(--ease), background 220ms ease, box-shadow 220ms ease;
}

.sw.is-on { background: rgba(120, 80, 255, 0.4); border-color: rgba(170, 135, 255, 0.6); }
.sw.is-on span { left: 21px; background: #fff; box-shadow: 0 0 10px rgba(160, 120, 255, 0.9); }

.ghost-btn {
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid rgba(150, 120, 255, 0.25);
  background: none;
  color: rgba(210, 198, 250, 0.85);
  font-family: inherit;
  font-size: 11.5px;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: color 200ms ease, border-color 200ms ease, background 200ms ease;
}

.ghost-btn:hover { color: #fff; border-color: rgba(190, 150, 255, 0.6); }
.ghost-btn.is-strong { background: rgba(120, 80, 255, 0.22); border-color: rgba(170, 135, 255, 0.5); }

.set-note {
  margin: 16px 0 0;
  font-size: 11px;
  line-height: 1.9;
  color: rgba(150, 135, 195, 0.55);
}

.privacy-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid rgba(150, 120, 255, 0.08);
}

.privacy-tip {
  font-size: 10.5px;
  letter-spacing: 0.05em;
  color: rgba(140, 125, 185, 0.5);
  text-align: right;
}

body.is-locked .hud,
body.is-locked #stage { opacity: 0; }

@media (max-width: 520px) {
  .lock-card { padding: 34px 24px 26px; }
  .set-row { flex-wrap: wrap; }
  .seg-group { flex-wrap: wrap; }
}

/* ===================================================================
   一条记忆里的多张照片
   =================================================================== */
.fig-nav {
  position: absolute;
  top: 50%;
  z-index: 4;
  width: 38px;
  height: 38px;
  margin-top: -19px;
  display: grid;
  place-items: center;
  padding: 0 0 3px;
  border: 1px solid rgba(180, 150, 255, 0.18);
  border-radius: 50%;
  background: rgba(12, 5, 26, 0.52);
  color: rgba(230, 220, 255, 0.8);
  font: 400 22px/1 var(--font-sans);
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 260ms ease, background 260ms ease, border-color 260ms ease;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.fig-prev { left: 12px; }
.fig-next { right: 12px; }

.panel-figure.has-many .fig-nav { opacity: 1; pointer-events: auto; }
.panel-figure .fig-nav:hover {
  background: rgba(70, 40, 130, 0.62);
  border-color: rgba(200, 165, 255, 0.55);
  color: #fff;
}

.fig-dots {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 12px;
  z-index: 4;
  display: flex;
  justify-content: center;
  gap: 6px;
}

.fig-dots[hidden] { display: none; }

.fig-dots i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: rgba(220, 205, 255, 0.34);
  transition: background 260ms ease, transform 260ms ease;
}

.fig-dots i.is-on {
  background: rgba(236, 226, 255, 0.95);
  transform: scale(1.35);
  box-shadow: 0 0 10px rgba(180, 140, 255, 0.8);
}

/* 面板里那行"第几次打开" */
.panel-visit {
  display: none;
  margin: -18px 0 22px;
  font-size: 11px;
  letter-spacing: 0.12em;
  color: rgba(150, 130, 205, 0.5);
  opacity: 0;
  transform: translateY(8px);
}

.panel-visit.is-on { display: block; }
.panel.is-open .panel-visit { animation: riseIn 800ms 240ms var(--ease) forwards; }

/* ===================================================================
   手机：面板改成从下面抽出来的抽屉
   =================================================================== */
@media (max-width: 760px) {
  .panel {
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    /* dvh：手机地址栏收起/展开时 66vh 会把面板顶出屏幕，dvh 跟着可视高度走。
       老浏览器不认 dvh，先给 vh 兜底。 */
    height: min(66vh, 620px);
    height: min(66dvh, 620px);
    transform: translate3d(0, 106%, 0);
    border-left: 0;
    border-top: 1px solid rgba(160, 130, 255, 0.18);
    border-radius: 22px 22px 0 0;
    box-shadow: 0 -30px 90px rgba(4, 0, 14, 0.82);
  }

  .panel.is-open { transform: translate3d(0, 0, 0); }

  /* 顶上的小把手 */
  .panel::before {
    left: 50%;
    top: 9px;
    bottom: auto;
    width: 40px;
    height: 3px;
    margin-left: -20px;
    border-radius: 3px;
    background: rgba(196, 176, 255, 0.3);
  }

  /* 底部让开手势横条，否则最后一行字永远读不全 */
  .panel-scroll {
    padding: 30px 22px calc(26px + env(safe-area-inset-bottom));
  }
  /* 30px 是鼠标的尺寸，不是手指的。手指落点误差就有 10px 左右 */
  .panel-close {
    top: 14px;
    right: 12px;
    width: 40px;
    height: 40px;
    font-size: 19px;
  }
  .panel-title { font-size: 21px; margin-bottom: 16px; }
  .panel-visit { margin: -8px 0 16px; }
  .panel-figure { margin-bottom: 18px; border-radius: 14px; }
  .panel-text { font-size: 14px; line-height: 1.95; }
  .panel-meta { margin-bottom: 14px; }

  .fig-nav { width: 34px; height: 34px; margin-top: -17px; }

  body.panel-open .hud-bottom,
  body.panel-open .cluster-nav { opacity: 0; pointer-events: none; }

  .cluster-nav {
    left: 16px;
    bottom: calc(86px + env(safe-area-inset-bottom));
    gap: 8px;
  }
  .whisper { bottom: calc(30px + env(safe-area-inset-bottom)); }
}


/* ===================================================================
   无障碍：屏幕阅读器可见文本 / 焦点环 / 记忆索引抽屉
   =================================================================== */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* 只在键盘操作时出现，鼠标点击不留框 */
:focus-visible {
  outline: 2px solid rgba(186, 150, 255, 0.85);
  outline-offset: 3px;
}

.search-input:focus-visible,
.lock-input:focus-visible { outline-offset: 1px; }

/* ---------------- 记忆索引 ---------------- */
.mem-drawer {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 13;
  width: 320px;
  height: 100%;
  display: flex;
  flex-direction: column;
  transform: translate3d(-102%, 0, 0);
  opacity: 0;
  transition: transform 620ms var(--ease), opacity 380ms ease;
  will-change: transform;
  background:
    linear-gradient(192deg, rgba(32, 18, 58, 0.92) 0%, rgba(14, 7, 30, 0.95) 44%, rgba(6, 2, 16, 0.97) 100%);
  border-right: 1px solid rgba(150, 120, 255, 0.14);
  box-shadow:
    40px 0 120px rgba(4, 0, 14, 0.72),
    inset -1px 0 0 rgba(200, 170, 255, 0.06);
  backdrop-filter: blur(22px) saturate(125%);
  -webkit-backdrop-filter: blur(22px) saturate(125%);
}

.mem-drawer.is-open {
  transform: translate3d(0, 0, 0);
  opacity: 1;
}

.mem-drawer-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 24px 20px 12px;
  flex: 0 0 auto;
}

.mem-drawer-head h2 {
  margin: 0;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.26em;
  color: var(--text);
}

.mem-drawer-meta {
  margin-left: auto;
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  opacity: 0.7;
  font-variant-numeric: tabular-nums;
}

.mem-drawer-close {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  padding: 0;
  border-radius: 50%;
  border: 1px solid rgba(150, 120, 255, 0.2);
  background: rgba(20, 10, 38, 0.4);
  color: rgba(200, 185, 240, 0.72);
  cursor: pointer;
  transition: color 200ms ease, border-color 200ms ease, background 200ms ease;
}

.mem-drawer-close:hover {
  color: #fff;
  border-color: rgba(200, 160, 255, 0.5);
  background: rgba(70, 40, 130, 0.5);
}

.mem-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  list-style: none;
  margin: 0;
  padding: 2px 12px 12px;
  scrollbar-width: thin;
}

.mem-list::-webkit-scrollbar { width: 5px; }
.mem-list::-webkit-scrollbar-track { background: transparent; }
.mem-list::-webkit-scrollbar-thumb {
  background: rgba(140, 110, 220, 0.24);
  border-radius: 4px;
}

.mem-item {
  width: 100%;
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 8px 10px;
  margin-bottom: 2px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  font-family: inherit;
  text-align: left;
  color: var(--text-sub);
  cursor: pointer;
  transition: background 200ms ease, color 200ms ease, opacity 200ms ease;
}

.mem-item:hover,
.mem-item:focus-visible {
  background: rgba(70, 40, 130, 0.42);
  color: var(--text);
}

.mem-item.is-active {
  background: rgba(86, 54, 156, 0.52);
  color: #fff;
}

.mem-item.is-dim { opacity: 0.32; }

.mem-num {
  flex: 0 0 auto;
  min-width: 16px;
  font-size: 10px;
  letter-spacing: 0.06em;
  opacity: 0.55;
  font-variant-numeric: tabular-nums;
}

.mem-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.mem-title {
  font-size: 12.5px;
  letter-spacing: 0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mem-item.is-hit .mem-title { color: #fff; }

.mem-sub {
  font-size: 10px;
  letter-spacing: 0.08em;
  opacity: 0.55;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mem-drawer-foot {
  flex: 0 0 auto;
  margin: 0;
  padding: 10px 20px calc(18px + env(safe-area-inset-bottom));
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  opacity: 0.5;
}

/* 手指不需要认键位：抽屉里每一行本身就是按钮 */
.foot-touch { display: none; }
@media (pointer: coarse) {
  .foot-key { display: none; }
  .foot-touch { display: inline; }
}

@media (max-width: 760px) {
  .mem-drawer { width: 86vw; max-width: 340px; }
  .mem-drawer-head { padding: 20px 16px 10px; }
  .mem-list { padding: 2px 8px 10px; }
}

@media (prefers-reduced-motion: reduce) {
  .mem-drawer,
  .mem-drawer *,
  .mem-item,
  .cluster-item { transition-duration: 1ms !important; animation-duration: 1ms !important; }
  .grain,
  .vignette,
  .whisper-dot { animation: none !important; }
}

/* 抽屉盖住左下角，提示语被切一半很难看，直接让位 */
.hint { transition: opacity 320ms ease; }

body.drawer-open .hint { opacity: 0; }

/* ===================================================================
   第一次来访的提示条
   只在第一次打开时出现八秒。它底下压着脑区索引和底部 HUD，
   所以整条不吃鼠标事件、只有关闭按钮接回来——不能让它变成
   又一处"看得见点不到"。
   =================================================================== */

.coach {
  position: fixed;
  left: 50%;
  bottom: 56px;
  z-index: 7;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: calc(100vw - 32px);
  padding: 9px 10px 9px 16px;
  border: 1px solid rgba(150, 120, 255, 0.24);
  border-radius: 999px;
  background: rgba(16, 8, 30, 0.78);
  box-shadow: 0 14px 44px rgba(0, 0, 0, 0.42), inset 0 1px 0 rgba(180, 150, 255, 0.08);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  font-size: 12.5px;
  letter-spacing: 0.06em;
  color: rgba(224, 214, 255, 0.86);
  white-space: nowrap;
  opacity: 0;
  transform: translateX(-50%) translateY(8px);
  pointer-events: none;
  transition: opacity 420ms ease, transform 420ms var(--ease);
}

.coach[hidden] { display: none; }   /* display:flex 会盖过 [hidden] 的默认 display:none */

.coach.is-on {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.coach-item { display: inline-flex; align-items: center; gap: 7px; }

.coach kbd {
  display: inline-block;
  min-width: 18px;
  padding: 2px 5px;
  border: 1px solid rgba(170, 145, 255, 0.34);
  border-bottom-width: 2px;
  border-radius: 5px;
  background: rgba(120, 90, 220, 0.16);
  color: #e6dcff;
  font-family: inherit;
  font-size: 11px;
  line-height: 1.2;
  text-align: center;
  letter-spacing: 0;
}

.coach-dot { color: rgba(150, 130, 200, 0.4); }

.coach-close {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  margin-left: 2px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: rgba(190, 175, 235, 0.6);
  cursor: pointer;
  pointer-events: auto;          /* 整条唯一接鼠标的东西 */
  transition: background 200ms ease, color 200ms ease;
}

.coach-close:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
.coach-close:focus-visible { outline: 1px solid rgba(180, 150, 255, 0.8); outline-offset: 2px; }

/* 跟面板、索引、时间轴抢位置时一律让位（跟它们之间也是这个规矩） */
body.panel-open .coach,
body.drawer-open .coach,
body.tl-open .coach { opacity: 0; pointer-events: none; }

@media (max-width: 560px) {
  .coach {
    bottom: calc(52px + env(safe-area-inset-bottom));
    gap: 8px;
    padding: 8px 8px 8px 12px;
    border-radius: 16px;
    font-size: 11.5px;
    white-space: normal;
    flex-wrap: wrap;
    justify-content: center;
  }
  .coach-dot { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .coach { transition: none; transform: translateX(-50%); }
}

/* ===================================================================
   记忆互连：面板里的「连一条」与已连列表
   =================================================================== */

.panel-links {
  margin-top: 32px;
  padding-top: 18px;
  border-top: 1px solid rgba(150, 120, 255, 0.1);
  opacity: 0;
}

.panel.is-open .panel-links { animation: riseIn 900ms 380ms var(--ease) forwards; }

.panel-links-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 0 0 12px;
  font-size: 11px;
  letter-spacing: 0.16em;
  color: rgba(150, 128, 205, 0.62);
}

.panel-links-head em {
  font-style: normal;
  font-size: 10px;
  letter-spacing: 0.1em;
  color: rgba(170, 140, 240, 0.5);
}

.panel-links-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.panel-link-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel-link-go {
  flex: 1;
  min-width: 0;
  padding: 7px 11px;
  border: 1px solid rgba(150, 120, 255, 0.14);
  border-radius: 3px;
  background: rgba(120, 90, 210, 0.07);
  color: rgba(224, 214, 255, 0.8);
  font: inherit;
  font-size: 12.5px;
  letter-spacing: 0.02em;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  transition: background 200ms, border-color 200ms, color 200ms;
}

.panel-link-go:hover,
.panel-link-go:focus-visible {
  background: rgba(140, 105, 240, 0.16);
  border-color: rgba(170, 140, 255, 0.42);
  color: #fff;
}

.panel-link-x {
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 1px solid rgba(150, 120, 255, 0.14);
  border-radius: 3px;
  background: transparent;
  color: rgba(160, 140, 205, 0.55);
  font: inherit;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  transition: background 200ms, border-color 200ms, color 200ms;
}

.panel-link-x:hover,
.panel-link-x:focus-visible {
  color: #ffb3d2;
  border-color: rgba(255, 140, 190, 0.5);
  background: rgba(180, 60, 120, 0.18);
}

/* 常驻在面板底部：不管正文滚到哪儿，「连一条」都点得到 */
.panel-linkbar {
  flex: 0 0 auto;
  padding: 12px 38px 18px;
  border-top: 1px solid rgba(150, 120, 255, 0.1);
  background: linear-gradient(to top, rgba(6, 2, 16, 0.72), rgba(6, 2, 16, 0));
  opacity: 0;
}

.panel.is-open .panel-linkbar { animation: riseIn 900ms 430ms var(--ease) forwards; }

.panel-linkbtn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border: 1px solid rgba(150, 120, 255, 0.28);
  border-radius: 999px;
  background: rgba(120, 90, 210, 0.1);
  color: rgba(228, 218, 255, 0.85);
  font: inherit;
  font-size: 12px;
  letter-spacing: 0.12em;
  cursor: pointer;
  transition: background 220ms, border-color 220ms, color 220ms, box-shadow 220ms;
}

.panel-linkbtn:hover,
.panel-linkbtn:focus-visible {
  border-color: rgba(170, 140, 255, 0.55);
  background: rgba(140, 105, 240, 0.2);
  color: #fff;
  box-shadow: 0 0 22px rgba(140, 100, 255, 0.22);
}

.panel-linkbtn.is-on {
  border-color: rgba(102, 230, 255, 0.6);
  background: rgba(50, 130, 180, 0.2);
  color: #c8f4ff;
  box-shadow: 0 0 24px rgba(80, 200, 255, 0.26);
}

.panel-linkhint {
  margin: 10px 0 0;
  font-size: 11px;
  letter-spacing: 0.06em;
  color: rgba(120, 220, 255, 0.55);
}

/* 连线态：光标变成十字，让人知道"现在点谁就连谁" */
#scene.is-linking { cursor: crosshair; }

@media (prefers-reduced-motion: reduce) {
  .panel-links,
  .panel-linkbar { animation-duration: 1ms !important; }
}

/* 连线数超过渲染上限时的说明：宁可承认少画了，也不假装画全了 */
.panel-links-warn {
  margin: 0 0 10px;
  font-size: 11px;
  line-height: 1.5;
  letter-spacing: 0.04em;
  color: rgba(255, 180, 120, 0.72);
}

.panel-links-warn[hidden] { display: none; }

/* 面板容器本身带 tabindex="-1"，只为接住程序性焦点（回车打开时）。
   它不会出现在 Tab 序列里，也不该画出焦点框。 */
.panel:focus,
.panel:focus-visible { outline: none; }

/* 声音按钮在"没有任何可播放的声音"时会带 hidden，
   但 .sound-btn 自己的 display:grid 会盖过 [hidden]，这里显式让位。 */
.sound-btn[hidden] { display: none; }

/* 面板占据右侧 410px，右上角那排按钮会被压在底下。
   以前是"看得见、点不到"——最差的一种状态。既然点不到，
   就跟着底部 HUD 一起退让，关掉面板再出现。 */
body.panel-open .hud-top .icon-btn,
body.panel-open .hud-top .search-wrap {
  opacity: 0;
  pointer-events: none;
  transition: opacity 320ms ease;
}

/* ===================================================================
   时间轴回放：把「时间衰减」从静态参数变成可以推的一段
   =================================================================== */

.timeline {
  position: fixed;
  left: 50%;
  bottom: 108px;
  transform: translateX(-50%);
  z-index: 7;
  width: min(560px, calc(100vw - 64px));
  padding: 14px 18px 16px;
  border: 1px solid rgba(150, 120, 255, 0.22);
  border-radius: 10px;
  background: rgba(16, 8, 30, 0.72);
  backdrop-filter: blur(14px);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(180, 150, 255, 0.08);
  animation: tlIn 320ms var(--ease);
}

.timeline[hidden] { display: none; }

@keyframes tlIn {
  from { opacity: 0; transform: translateX(-50%) translateY(10px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.tl-row {
  display: flex;
  align-items: center;
  gap: 14px;
}

.tl-year {
  flex: 0 0 auto;
  min-width: 58px;
  font-size: 21px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: rgba(232, 224, 255, 0.95);
  font-variant-numeric: tabular-nums;
}

.tl-play,
.tl-close {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid rgba(150, 120, 255, 0.24);
  border-radius: 50%;
  background: rgba(120, 90, 210, 0.14);
  color: rgba(210, 198, 250, 0.9);
  cursor: pointer;
  transition: background 200ms, border-color 200ms, color 200ms;
}

.tl-play:hover,
.tl-play:focus-visible,
.tl-close:hover,
.tl-close:focus-visible {
  border-color: rgba(180, 150, 255, 0.6);
  background: rgba(140, 105, 240, 0.26);
  color: #fff;
}

.tl-close { width: 26px; height: 26px; opacity: 0.7; }
.tl-close:hover { opacity: 1; }

/* 播放/暂停两个图标按状态切换 */
.tl-i-pause { display: block; }
.tl-i-play  { display: none; }
.tl-play.is-paused .tl-i-pause { display: none; }
.tl-play.is-paused .tl-i-play  { display: block; }

.tl-range {
  flex: 1 1 auto;
  min-width: 80px;
  height: 22px;
  margin: 0;
  background: transparent;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}

/* 轨道要能看出"播到哪了"：已播放的一段填满渐变，剩下的一段压成一条暗线。
 * 早先整条轨道是一条从头贯到尾的渐变，滑块挪到哪里颜色都一样，
 * 远远看过去只剩一个小圆点在飘——分不清进度。 */
.tl-range::-webkit-slider-runnable-track {
  height: 3px;
  border-radius: 2px;
  background-color: rgba(255, 255, 255, 0.13);
  background-image: linear-gradient(90deg, rgba(178, 148, 255, 0.95), rgba(130, 214, 255, 0.85));
  background-repeat: no-repeat;
  background-size: var(--tl-fill, 0%) 100%;
}

.tl-range::-moz-range-track {
  height: 3px;
  border-radius: 2px;
  background-color: rgba(255, 255, 255, 0.13);
  background-image: linear-gradient(90deg, rgba(178, 148, 255, 0.95), rgba(130, 214, 255, 0.85));
  background-repeat: no-repeat;
  background-size: var(--tl-fill, 0%) 100%;
}

.tl-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 13px;
  height: 13px;
  margin-top: -5px;
  border: 0;
  border-radius: 50%;
  background: #f0e9ff;
  box-shadow: 0 0 12px rgba(170, 140, 255, 0.85);
}

.tl-range::-moz-range-thumb {
  width: 13px;
  height: 13px;
  border: 0;
  border-radius: 50%;
  background: #f0e9ff;
  box-shadow: 0 0 12px rgba(170, 140, 255, 0.85);
}

.tl-range:focus-visible { outline: 1px solid rgba(180, 150, 255, 0.7); outline-offset: 4px; }

.tl-count {
  flex: 0 0 auto;
  min-width: 42px;
  text-align: right;
  font-size: 11px;
  letter-spacing: 0.08em;
  color: rgba(186, 172, 232, 0.85);
  font-variant-numeric: tabular-nums;
}

/* 时间轴开着的时候，底部那行提示让位（年份数字比它重要） */
body.tl-open .hud-bottom { opacity: 0; }

/* 面板从右边盖过来（410px）、记忆索引从左边盖过来（320px），
   时间轴贴在底部中间——屏幕一窄就叠上，而且它的 z-index 比这两个都低，
   结果就是"看得见、点不到"。跟右上角那排按钮一个处理：让位。
   关掉浮层它就回来，游标和播放状态都还在。 */
body.panel-open .timeline,
body.drawer-open .timeline {
  opacity: 0;
  pointer-events: none;
  transition: opacity 260ms ease;
}

@media (max-width: 760px) {
  .timeline {
    bottom: calc(84px + env(safe-area-inset-bottom));
    width: calc(100vw - 32px);
    padding: 12px 14px 14px;
  }
  .tl-year { font-size: 18px; min-width: 50px; }

  /* 滑条要按得住：手机上 13px 的滑块手指根本捏不准。
     只放大滑块和命中区域，轨道那根细线保持原样，不改视觉重量。 */
  .tl-range { height: 30px; }
  .tl-range::-webkit-slider-thumb { width: 20px; height: 20px; margin-top: -8.5px; }
  .tl-range::-moz-range-thumb { width: 20px; height: 20px; }
  .tl-play, .tl-close { width: 40px; height: 40px; }
}

/* 计数器只在真正放不下的时候才收起来（760 宽的平板还放得下） */
@media (max-width: 460px) {
  .tl-count { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .timeline { animation: none; }
}

/* ===================================================================
   触摸设备：几处只有手指会踩到的坑
   =================================================================== */

@media (pointer: coarse) {
  /* iOS Safari 只要聚焦到 16px 以下的输入框，就会把整页放大一档，
     而且不会自己缩回来 —— 固定定位的球体当场错位。
     锁屏那几个输入框是 13.5px，必须抬上去。 */
  .lock-input { font-size: 16px; }

  /* 触摸没有 hover，抬手的瞬间高亮会"闪"一下再消失。
     桌面上这是反馈，手机上只是噪点。 */
  .icon-btn:hover,
  .sound-btn:hover,
  .panel-close:hover,
  .cluster-item:hover {
    background: revert;
    border-color: revert;
    box-shadow: revert;
    transform: none;
  }

  /* 手指按下去要立刻有回应，760ms 的缓动在触摸上像卡住了。
     （只在触摸设备上压缩，桌面保持原来那种"慢慢浮起来"的味道） */
  .panel { transition-duration: 420ms, 300ms; }
  .panel-close:active { transform: scale(0.92); }
  .icon-btn:active, .sound-btn:active { transform: scale(0.94); }
}

/* 窄屏工具栏：品牌名 + 搜索 + 四个按钮，390 宽放不下（实测溢出到 446）。
   收紧字号和间距，而不是砍掉入口 —— 手机上这些按钮是唯一的路径。 */
@media (max-width: 460px) {
  .hud-top { gap: 9px; }
  .brand { gap: 8px; }
  .brand-txt b { font-size: 16px; letter-spacing: 0.18em; }
  .brand-txt i { display: none; }
  .icon-btn,
  .sound-btn { width: 32px; height: 32px; }
  .search-input { width: 32px; height: 32px; }
}

/* ============================================================
 *  录入层：写一条 / 改一条
 *
 *  以前加记忆要另开 录入.html、导出到文件夹、再刷新。
 *  这里把它收回主页面：写完存下就生效，照片存在浏览器里。
 *
 *  为什么不塞进右侧面板：那个面板宽 410，装不下「标题 + 日期 + 分区 +
 *  正文 + 多张照片」，手机上更是变成一条缝。写东西值得一整块地方。
 * ============================================================ */

/* 抽屉头部的「写一条」——索引是入口，写也应该从这儿进 */
.mem-add {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-left: auto;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(139, 92, 255, 0.10);
  color: var(--text-sub);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.mem-add:hover { color: var(--text); border-color: rgba(150, 120, 255, 0.40); background: rgba(139, 92, 255, 0.18); }
.mem-add:focus-visible { outline: 2px solid var(--violet); outline-offset: 2px; }
.mem-add svg { flex: none; }

.composer {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(2, 0, 10, 0.74);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.28s var(--ease);
}
.composer.is-open { opacity: 1; pointer-events: auto; }

.composer-card {
  width: min(660px, 100%);
  max-height: min(86dvh, 780px);
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(150, 120, 255, 0.22);
  border-radius: 20px;
  background:
    radial-gradient(120% 80% at 50% 0%, rgba(139, 92, 255, 0.14), transparent 62%),
    linear-gradient(180deg, rgba(19, 8, 38, 0.97), rgba(6, 1, 15, 0.98));
  box-shadow: 0 32px 90px rgba(0, 0, 0, 0.62);
  transform: translateY(14px) scale(0.985);
  transition: transform 0.32s var(--ease);
  overflow: hidden;
}
.composer.is-open .composer-card { transform: none; }

.composer-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--line);
  flex: none;
}
.composer-head h2 {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 19px;
  font-weight: 400;
  letter-spacing: 0.08em;
  color: var(--text);
}
.composer-sub {
  font-size: 12px;
  color: var(--text-dim);
  letter-spacing: 0.04em;
}
.composer-close {
  margin-left: auto;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
}
.composer-close:hover { color: var(--text); background: rgba(255, 255, 255, 0.06); }

.composer-body {
  padding: 18px 22px 6px;
  overflow-y: auto;
  overscroll-behavior: contain;
  flex: 1 1 auto;
  -webkit-overflow-scrolling: touch;
}

.cmp-field { display: block; margin-bottom: 14px; }
.cmp-field > span {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  letter-spacing: 0.10em;
  color: var(--text-dim);
}
.cmp-field > em {
  display: block;
  margin-top: 5px;
  font-size: 11px;
  font-style: normal;
  color: var(--text-dim);
  opacity: 0.85;
}
.cmp-field input,
.cmp-field textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid rgba(150, 120, 255, 0.20);
  border-radius: 10px;
  background: rgba(4, 1, 12, 0.62);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  line-height: 1.6;
  transition: border-color 0.2s, background 0.2s;
}
.cmp-field textarea { resize: vertical; min-height: 120px; font-family: var(--font-sans); }
.cmp-field input:focus,
.cmp-field textarea:focus {
  outline: none;
  border-color: rgba(139, 92, 255, 0.62);
  background: rgba(8, 2, 20, 0.82);
}
.cmp-field input::placeholder,
.cmp-field textarea::placeholder { color: rgba(125, 111, 166, 0.66); }

.cmp-row { display: flex; gap: 12px; }
.cmp-row .cmp-field { flex: 1 1 0; min-width: 0; }

/* 照片条 */
.cmp-photos { margin: 4px 0 16px; }
.cmp-photos-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 12px;
  letter-spacing: 0.10em;
  color: var(--text-dim);
}
.cmp-photos-head em { font-style: normal; font-size: 11px; opacity: 0.8; }
.cmp-shots {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  gap: 10px;
}
.cmp-shot {
  position: relative;
  aspect-ratio: 4 / 3;
  border: 1px solid rgba(150, 120, 255, 0.18);
  border-radius: 10px;
  overflow: hidden;
  background: #0a0418;
}
.cmp-shot img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cmp-shot-del {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 999px;
  background: rgba(2, 0, 10, 0.72);
  color: var(--text);
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}
.cmp-shot-del:hover { background: rgba(255, 90, 120, 0.72); }
.cmp-shot.is-busy { display: grid; place-items: center; }
.cmp-shot.is-busy::after {
  content: "压…";
  font-size: 11px;
  color: var(--text-dim);
}
.cmp-add {
  display: grid;
  place-items: center;
  gap: 2px;
  aspect-ratio: 4 / 3;
  border: 1px dashed rgba(150, 120, 255, 0.32);
  border-radius: 10px;
  background: rgba(139, 92, 255, 0.05);
  color: var(--text-dim);
  font: inherit;
  font-size: 20px;
  cursor: pointer;
}
.cmp-add:hover { color: var(--text); border-color: rgba(150, 120, 255, 0.55); }
.cmp-add i { font-size: 10px; font-style: normal; letter-spacing: 0.08em; }

.composer-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 22px 18px;
  border-top: 1px solid var(--line);
  flex: none;
}
.cmp-spacer { flex: 1 1 auto; }
.composer-foot button {
  padding: 9px 18px;
  border-radius: 999px;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s, opacity 0.2s;
}
.cmp-primary {
  border: 0;
  background: linear-gradient(135deg, #8b5cff, #ff7ad9);
  color: #0a0418;
  font-weight: 600;
}
.cmp-primary:hover { filter: brightness(1.08); }
.cmp-primary:disabled { opacity: 0.45; cursor: default; filter: none; }
.cmp-ghost {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text-sub);
}
.cmp-ghost:hover { color: var(--text); border-color: rgba(150, 120, 255, 0.40); }
.cmp-danger {
  border: 1px solid rgba(255, 90, 120, 0.34);
  background: transparent;
  color: rgba(255, 130, 155, 0.9);
}
.cmp-danger:hover { background: rgba(255, 90, 120, 0.14); }

/* 手机上写东西就该全屏：键盘一弹，卡片式的边距全在浪费 */
@media (max-width: 760px) {
  .composer { padding: 0; place-items: stretch; }
  .composer-card {
    width: 100%;
    max-height: none;
    height: 100dvh;
    border: 0;
    border-radius: 0;
    transform: none;
  }
  .composer-head { padding: calc(14px + env(safe-area-inset-top)) 18px 12px; }
  .composer-body { padding: 14px 18px 4px; }
  .composer-foot {
    padding: 12px 18px calc(14px + env(safe-area-inset-bottom));
  }
  .cmp-row { flex-direction: column; gap: 0; }
  .cmp-shots { grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); }
  .mem-add span { display: none; }
  /* 只剩图标就得靠尺寸撑住命中区：25px 的圆点手指按不准 */
  .mem-add { width: 32px; height: 32px; padding: 0; justify-content: center; }
  /* iOS 上小于 16px 的输入框会在聚焦时把整页放大 */
  .cmp-field input,
  .cmp-field textarea { font-size: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  .composer,
  .composer-card { transition-duration: 1ms; }
}

/* 面板底部的「改这条」：不起眼，但要找得到 —— 读完才想起有个错字是常事 */
.panel-edit {
  margin-left: auto;
  padding: 4px 10px;
  border: 1px solid rgba(150, 120, 255, 0.20);
  border-radius: 999px;
  background: transparent;
  color: var(--text-dim);
  font: inherit;
  font-size: 11px;
  letter-spacing: 0.10em;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}
.panel-edit:hover { color: var(--text); border-color: rgba(150, 120, 255, 0.45); }
.panel-edit:focus-visible { outline: 2px solid var(--violet); outline-offset: 2px; }

/* 标题空着不许存：输入框自己抖一下，胜过弹一个框 */
@keyframes cmpShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-5px); }
  45% { transform: translateX(4px); }
  70% { transform: translateX(-2px); }
}
.cmp-field input.is-shake {
  animation: cmpShake 420ms ease;
  border-color: rgba(255, 90, 120, 0.6);
}

/* 隐私面板里的「数据与备份」区块。卡片宽度只有 430，别做什么双栏。 */
.privacy-block {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid rgba(150, 120, 255, 0.12);
}
.privacy-block h3 {
  margin: 0 0 8px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.22em;
  color: var(--text-sub);
}
.privacy-note {
  margin: 0 0 10px;
  font-size: 11.5px;
  line-height: 1.72;
  color: rgba(150, 135, 195, 0.72);
}
.privacy-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.privacy-actions .ghost-btn { flex: none; }
.privacy-actions .privacy-tip { text-align: left; flex: 1 1 auto; }

/* ============================================================
 *  照片全屏
 *
 *  面板里的照片是裁切过的封面（object-fit: cover，焦点偏上），
 *  竖图会被切掉上下两截。翻到一张很久以前的照片，想看清那天的
 *  天色、墙上的字、人穿的鞋，只有放大一途。
 *
 *  全屏这层不做花哨事：黑底、照片居中、能放大、能拖动、能翻页，
 *  Esc 一按回到原来的位置。看完照片的人应该回到他离开的地方。
 * ============================================================ */

/* 面板照片右上角的放大键。平板/手机常显 —— 那儿没有 hover */
.fig-zoom {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 4;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(180, 150, 255, 0.18);
  border-radius: 9px;
  background: rgba(12, 5, 26, 0.52);
  color: rgba(230, 220, 255, 0.78);
  cursor: pointer;
  /* 不全藏起来：0.45 是「这里有东西可以点」的最低音量。
   * 藏到 0 就等于默认没人会知道照片能放大。 */
  opacity: 0.45;
  transition: opacity 220ms ease, background 220ms ease, border-color 220ms ease, color 220ms ease;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}
.panel-figure:hover .fig-zoom,
.fig-zoom:focus-visible { opacity: 1; }
/* 鼠标移到照片上是「可以戳」的样子，和放大键说的是同一件事 */
.panel-figure:not(.is-missing) { cursor: zoom-in; }
.panel-figure:not(.is-missing) img { cursor: zoom-in; }
.fig-zoom:hover {
  background: rgba(70, 40, 130, 0.62);
  border-color: rgba(200, 165, 255, 0.55);
  color: #fff;
}
.fig-zoom:focus-visible { outline: 2px solid var(--violet, #8b5cff); outline-offset: 2px; }
.panel-figure.is-missing .fig-zoom { display: none; }

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 45;
  display: grid;
  grid-template-rows: 1fr auto;
  background:
    radial-gradient(90% 70% at 50% 40%, rgba(38, 18, 76, 0.55), rgba(3, 0, 10, 0.97) 70%),
    rgba(3, 0, 10, 0.96);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 240ms var(--ease), visibility 0s linear 240ms;
}
.lightbox.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: opacity 260ms var(--ease), visibility 0s;
}

.lb-stage {
  position: relative;
  min-height: 0;
  display: grid;
  /* 这一行必须写成显式轨道。留自动行的话，照片上的 max-height:100%
   * 没有确定高度可参照，浏览器按 auto 处理 —— 结果照片按原始像素铺开、
   * 被 overflow 裁掉上下两头，人看到的是照片正中间一块，不是整张。
   * minmax(0,1fr) 把行高钉成舞台的内容高度，百分比这才算得出。 */
  grid-template-rows: minmax(0, 1fr);
  place-items: center;
  padding: 52px 68px 6px;
  overflow: hidden;
  touch-action: none;          /* 手势自己接，别让浏览器抢去滚动页面 */
  cursor: zoom-in;
}
.lb-stage.is-zoomed { cursor: grab; }
.lb-stage.is-dragging { cursor: grabbing; }
.lb-stage.is-dragging img { transition: none; }

.lb-stage img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  border-radius: 4px;
  box-shadow: 0 34px 110px rgba(0, 0, 0, 0.72);
  transform-origin: center center;
  will-change: transform;
  user-select: none;
  -webkit-user-drag: none;
  opacity: 0;
  transition: opacity 320ms ease;
}
.lb-stage img.is-loaded { opacity: 1; }
.lb-stage img.is-easing { transition: transform 240ms var(--ease), opacity 320ms ease; }

.lb-close,
.lb-nav {
  position: absolute;
  z-index: 2;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(180, 150, 255, 0.16);
  border-radius: 50%;
  background: rgba(14, 6, 30, 0.6);
  color: rgba(235, 225, 255, 0.82);
  cursor: pointer;
  transition: background 200ms ease, border-color 200ms ease, color 200ms ease, opacity 200ms ease;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}
.lb-close:hover,
.lb-nav:hover {
  background: rgba(70, 40, 130, 0.6);
  border-color: rgba(200, 165, 255, 0.5);
  color: #fff;
}
.lb-close:focus-visible,
.lb-nav:focus-visible { outline: 2px solid var(--violet, #8b5cff); outline-offset: 3px; }

.lb-close {
  top: max(16px, env(safe-area-inset-top));
  right: max(16px, env(safe-area-inset-right));
  width: 40px;
  height: 40px;
  padding-bottom: 3px;
  font: 300 24px/1 var(--font-sans);
}
.lb-nav {
  top: 50%;
  width: 44px;
  height: 44px;
  margin-top: -22px;
  padding-bottom: 4px;
  font: 400 26px/1 var(--font-sans);
}
.lb-prev { left: max(10px, env(safe-area-inset-left)); }
.lb-next { right: max(10px, env(safe-area-inset-right)); }
.lb-nav[hidden] { display: none; }

.lb-foot {
  display: flex;
  align-items: baseline;
  gap: 14px;
  padding: 4px 24px calc(18px + env(safe-area-inset-bottom));
  min-height: 44px;
}
.lb-caption {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 13.5px;
  letter-spacing: 0.06em;
  color: rgba(226, 215, 250, 0.82);
}
.lb-hint {
  margin: 0;
  margin-left: auto;
  font-size: 11px;
  letter-spacing: 0.08em;
  color: rgba(140, 124, 180, 0.62);
}
.lb-count {
  font-size: 11px;
  letter-spacing: 0.14em;
  color: rgba(140, 124, 180, 0.62);
  font-variant-numeric: tabular-nums;
}

@media (max-width: 760px) {
  .lb-stage { padding: 46px 8px 4px; }
  .lb-foot { flex-wrap: wrap; gap: 4px 12px; padding: 2px 18px calc(14px + env(safe-area-inset-bottom)); }
  .lb-hint { margin-left: 0; width: 100%; order: 3; }
  /* 手机上左右两侧的箭头多半压着照片，手势滑动就够了 */
  .lb-nav { display: none; }
  .fig-zoom { width: 34px; height: 34px; opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .lightbox,
  .lb-stage img,
  .lb-stage img.is-easing { transition-duration: 1ms; }
}
