/* ═══════════════════════════════════════════════════════
   我以为，窗外就是全部 · 共创图景人物篇 D
   18 液态透镜 / 超现实城市窗口：轻明玻璃、切割窗口、
   错位透镜层与观看关系。一个机制三态：窗前 → 幕后 → 放进一笔。
   状态：body[data-view]（front/behind）+ body[data-placed]（none/lamp/pine/arch）
   显隐与放置为瞬时；视图切换有 0.45s 过渡（验收取终态）。
   ═══════════════════════════════════════════════════════ */

:root {
  --porcelain: #eef4f3;    /* 瓷白底 */
  --paper: #f3efe3;        /* 画纸暖白 */
  --ink-g: #31403c;        /* 墨绿灰（窗框/文字） */
  --ink-soft: #5a6b66;
  --glaze: #9db8b2;        /* 瓷青 */
  --terra: #c98d6b;        /* 陶暖 */
  --amber: #f2b04a;        /* 窑火 */
  --card: #fbfaf6;
  --hand: "Kaiti SC", "STKaiti", "KaiTi", serif;
  --sans: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", -apple-system, sans-serif;
  --serif: "Songti SC", "Noto Serif SC", "Source Han Serif SC", "STSong", serif;
}

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

body {
  font-family: var(--sans);
  font-size: 16px; line-height: 1.85;
  color: var(--ink-g);
  background:
    radial-gradient(1200px 560px at 88% -6%, rgba(157, 184, 178, .22), transparent 60%),
    radial-gradient(900px 500px at -6% 24%, rgba(243, 239, 227, .9), transparent 62%),
    var(--porcelain);
  overflow-x: hidden;
}

a { color: #48645e; }
:focus-visible { outline: 2px dashed #48645e; outline-offset: 3px; border-radius: 4px; }
.skip { position: absolute; left: 12px; top: -52px; background: var(--ink-g); color: #fff; padding: 8px 16px; border-radius: 6px; z-index: 99; }
.skip:focus { top: 12px; color: #fff; }
.sr-status { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.svg-hand { font-family: var(--hand); }

/* ---------- 站点入口 ---------- */
.portal-back {
  display: flex; gap: 10px; align-items: center;
  padding: 10px max(calc((100vw - 1060px) / 2), 18px);
  background: rgba(251, 250, 246, .8);
  border-bottom: 1px solid rgba(157, 184, 178, .4);
  font-size: 14px;
}
.portal-back a {
  color: var(--ink-g); text-decoration: none;
  border: 1.5px solid var(--glaze); border-radius: 999px;
  padding: 4px 15px; background: rgba(255, 255, 255, .6);
}
.portal-back a:hover { background: var(--glaze); color: #fff; }

/* ---------- 页头（单列紧凑，舞台紧随） ---------- */
.glass-head { max-width: 1060px; margin: 0 auto; padding: clamp(22px, 3.6vw, 42px) 22px 2px; }
.kicker { font-size: 14px; letter-spacing: .2em; color: var(--ink-soft); margin-bottom: 10px; }
h1 { font-family: var(--serif); font-weight: 700; font-size: clamp(30px, 4.6vw, 46px); line-height: 1.34; margin-bottom: 12px; }
.intro { max-width: 38em; font-size: 16.5px; }
.intro strong { color: #48645e; }
.fiction-note {
  display: inline-block; margin-left: 10px;
  font-size: 14px; color: var(--ink-soft);
  border-bottom: 1.5px dashed var(--glaze);
}

/* ---------- 主舞台 ---------- */
main { max-width: 1060px; margin: 0 auto; padding: 0 22px; }
.stage-section { padding-top: clamp(16px, 2.4vw, 26px); }
.stage-title {
  font-family: var(--serif); font-size: clamp(20px, 2.5vw, 26px);
  margin-bottom: 12px; display: flex; align-items: center; gap: 12px;
}

.stage {
  position: relative;
  min-height: clamp(440px, 52vw, 490px);
  border-radius: 18px;
  background:
    linear-gradient(160deg, rgba(255,255,255,.55), rgba(255,255,255,.12) 46%, rgba(157,184,178,.16));
  border: 1.5px solid rgba(157, 184, 178, .45);
  box-shadow: 0 18px 44px rgba(49, 64, 60, .08);
  overflow: hidden;
}

/* 前景窗 */
.window-wrap {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px; padding: 18px;
  transform: scale(1); transform-origin: 50% 42%;
  opacity: 1;
  transition: transform .45s cubic-bezier(.3,.7,.3,1), opacity .45s ease;
}
.window { width: min(54vh, 92%, 424px); height: auto; }
.window-label { font-size: 14.5px; color: var(--ink-soft); }
.window-label strong { color: var(--ink-g); }

/* 幕后 */
.behind {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; padding: 18px;
  opacity: 0; transform: scale(1.08); transform-origin: 50% 55%;
  pointer-events: none;
  transition: transform .45s cubic-bezier(.3,.7,.3,1), opacity .45s ease;
  background:
    linear-gradient(180deg, rgba(251,250,246,.0) 0%, rgba(251,250,246,.75) 78%, rgba(251,250,246,.95) 100%);
}
.easel { width: min(62vh, 96%, 620px); height: auto; }
.behind-label { font-size: 15px; color: var(--ink-soft); text-align: center; max-width: 34em; }

/* 视图切换：窗前 ⇄ 幕后（前后景相对展开） */
body[data-view="behind"] .window-wrap { transform: scale(.6) translateY(-34%); opacity: .92; }
body[data-view="behind"] .behind { opacity: 1; transform: scale(1); pointer-events: auto; }
body[data-view="behind"] .window-label { visibility: hidden; }

/* 液态透镜：窗前态悬浮；幕后态退场 */
.lens {
  position: absolute; right: 5%; top: 9%;
  width: clamp(96px, 15vw, 168px);
  filter: drop-shadow(0 10px 22px rgba(49, 64, 60, .18));
  opacity: 1;
  transition: opacity .3s ease;
  will-change: transform;
}
body[data-view="behind"] .lens { opacity: 0; }

/* 可放置元素：瞬时显隐（放置即达） */
.pl { opacity: 0; }
body[data-placed="lamp"] .pl-lamp,
body[data-placed="pine"] .pl-pine,
body[data-placed="arch"] .pl-arch { opacity: 1; }

/* ---------- 操作条 ---------- */
.ops { margin: 16px 0 6px; display: grid; gap: 12px; }
.ops-phase { font-family: var(--hand); font-size: 18px; color: #48645e; }
.ops-group { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.ops-group[hidden] { display: none; }
.ops-tip { font-size: 14px; color: var(--ink-soft); }
.op-btn {
  font-family: var(--hand); font-size: 16.5px;
  padding: 10px 20px; border-radius: 12px;
  border: 2px solid var(--ink-g); background: var(--card); color: var(--ink-g);
  cursor: pointer;
  box-shadow: 3px 3px 0 rgba(49, 64, 60, .55);
  transition: transform .12s ease, box-shadow .12s ease, background-color .15s ease;
}
.op-btn:hover { background: #fff; }
.op-btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 rgba(49, 64, 60, .55); }
.op-open { border-color: #48645e; color: #fff; background: #48645e; box-shadow: 3px 3px 0 rgba(49,64,60,.4); }
.op-open:hover { background: #31403c; }
.op-view { border-color: var(--amber); color: #8a6a1f; box-shadow: 3px 3px 0 rgba(242, 176, 74, .5); }
.op-again { border-style: dashed; }

/* 旁白卡 */
.voice {
  margin: 10px 0 8px; max-width: 46em;
  background: var(--card);
  border: 1.5px solid rgba(157, 184, 178, .5);
  border-radius: 4px 16px 16px 16px;
  padding: 13px 18px;
  box-shadow: 0 8px 20px rgba(49, 64, 60, .07);
}
.voice p { font-size: 15.5px; }

/* ---------- 章节 ---------- */
.chapter { padding: clamp(28px, 4vw, 46px) 0 4px; }
.chapter h2 {
  font-family: var(--serif); font-size: clamp(21px, 2.8vw, 28px);
  display: flex; align-items: center; gap: 14px; margin-bottom: 14px;
}
.no {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 50%;
  border: 2.5px solid var(--glaze); color: #48645e;
  font-size: 19px; flex-shrink: 0;
}
.chapter p { max-width: 38em; margin-bottom: 14px; }
.chapter strong { color: #48645e; }

/* ---------- 无 JS 图版 ---------- */
.nojs { display: none; }
html:not(.has-js) .nojs { display: block; }
html:not(.has-js) .hasjs { display: none; }
.board-static { padding: clamp(28px, 4vw, 46px) 0 4px; }
.board-static h2 { font-family: var(--serif); font-size: 24px; margin-bottom: 10px; }
.board-static > p { max-width: 40em; margin-bottom: 8px; }
.static-frames { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-top: 16px; }
.static-frames figure { background: var(--card); border: 1.5px solid rgba(157,184,178,.45); padding: 12px; }
.static-frames figcaption { font-size: 14px; color: var(--ink-soft); margin-top: 8px; line-height: 1.7; }
.static-frames svg text { font-family: var(--hand); }

/* ---------- 页脚 ---------- */
.page-foot {
  margin: 52px 0 0; padding: 26px 0 40px;
  border-top: 1px solid rgba(157, 184, 178, .5);
  font-size: 14px; color: var(--ink-soft);
}
.foot-fiction { max-width: 46em; margin-bottom: 10px; }
.foot-fiction strong { color: #48645e; }
.page-foot p { margin-bottom: 6px; }

/* ---------- reduce：过渡全禁，操作与结果保留 ---------- */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
  html { scroll-behavior: auto; }
}

/* ---------- 响应式 ---------- */
@media (max-width: 760px) {
  .stage { min-height: clamp(400px, 92vw, 480px); }
  .window { width: min(80vw, 360px); }
  .easel { width: min(94vw, 540px); }
  .lens { width: clamp(84px, 22vw, 120px); right: 4%; top: 6%; }
  .static-frames { grid-template-columns: 1fr; }
  body[data-view="behind"] .window-wrap { transform: scale(.5) translateY(-40%); }
}
@media (max-width: 430px) {
  h1 { font-size: 31px; }
  .intro { font-size: 16px; }
  .chapter p, .voice p { font-size: 16px; }
  .op-btn { font-size: 16px; padding: 9px 15px; }
}
