/* ==========================================================================
   字體系統 / Typography system
   --------------------------------------------------------------------------
   三種語言各自需要不同的字形，否則日文漢字會借用中文字形（直/画/骨 等
   字形不同），或落到豆腐字。正式包內附 OFL 字體，避免 iOS 缺少系統字形。

   --font-display  主角字體：有性格的襯線／明體，只給大標與記憶引言。
   --font-ui       功能字體：無襯線，給所有介面、按鈕、數字。
   --font-mono     編號字體：封印代碼、進度數字，等寬避免跳動。
   ========================================================================== */
@font-face { font-family: "HomeLost Sans TC"; src: url("./assets/fonts/home-lost-sans-tc.woff2") format("woff2"); font-style: normal; font-weight: 400; font-display: swap; }
@font-face { font-family: "HomeLost Sans JP"; src: url("./assets/fonts/home-lost-sans-jp.woff2") format("woff2"); font-style: normal; font-weight: 400; font-display: swap; }
@font-face { font-family: "HomeLost Serif TC"; src: url("./assets/fonts/home-lost-serif-tc.woff2") format("woff2"); font-style: normal; font-weight: 400; font-display: swap; }
@font-face { font-family: "HomeLost Serif JP"; src: url("./assets/fonts/home-lost-serif-jp.woff2") format("woff2"); font-style: normal; font-weight: 400; font-display: swap; }
:root {
  /* 預設（繁體中文）：蘋方 / 思源黑體；標題用宋體明體。 */
  --font-ui:
    "HomeLost Sans TC", "HomeLost Sans JP",
    -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui,
    "PingFang TC", "Heiti TC", "Noto Sans TC", "Source Han Sans TC",
    "Microsoft JhengHei", "Hiragino Sans CNS", sans-serif;
  --font-display:
    "HomeLost Serif TC", "HomeLost Serif JP",
    "Iowan Old Style", "Palatino Linotype", Palatino, Georgia,
    "Songti TC", "Songti SC", "Noto Serif TC", "Source Han Serif TC",
    "PMingLiU", ui-serif, serif;
  --font-mono:
    "HomeLost Sans TC", "HomeLost Sans JP",
    ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
    "PingFang TC", "Noto Sans TC", monospace;

  --ink: #f4f0e8;
  --muted: #a8a39b;
  --dim: #706b64;
  --panel: rgba(18, 18, 20, 0.82);
  --panel-strong: rgba(13, 13, 15, 0.94);
  --line: rgba(255, 255, 255, 0.11);
  --soft-line: rgba(255, 255, 255, 0.06);
  --accent: #d6b17b;
  --accent-2: #8c7866;
  --good: #9fd5ad;
  --danger: #d88d84;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.38);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
/* 日文：先挑日文字形，避免漢字被中文字形取代。
   同時吃 :root[data-lang] 與任何一層的 lang=""，這樣同一頁混排三語時
   （例如開發用的字形煙霧測試頁）每一塊都能拿到自己的字體。 */
:root[data-lang="ja"],
[lang|="ja"] {
  --font-ui:
    "HomeLost Sans JP", "HomeLost Sans TC",
    -apple-system, BlinkMacSystemFont, system-ui,
    "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic Medium", "Yu Gothic",
    "Noto Sans JP", "Source Han Sans JP", Meiryo, sans-serif;
  --font-display:
    "HomeLost Serif JP", "HomeLost Serif TC",
    "Iowan Old Style", "Palatino Linotype", Palatino, Georgia,
    "Hiragino Mincho ProN", "Yu Mincho", "YuMincho",
    "Noto Serif JP", "Source Han Serif JP", ui-serif, serif;
  --font-mono:
    "HomeLost Sans JP", "HomeLost Sans TC",
    ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
    "Hiragino Sans", "Noto Sans JP", monospace;
}

/* 英文：拉丁字形先行，但仍保留 CJK fallback，避免引用到中日文時破字。 */
:root[data-lang="en"],
[lang|="en"] {
  --font-ui:
    "HomeLost Sans TC", "HomeLost Sans JP",
    -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, Roboto,
    "Helvetica Neue", Arial,
    "PingFang TC", "Hiragino Sans", "Noto Sans TC", "Noto Sans JP", sans-serif;
  --font-display:
    "HomeLost Serif TC", "HomeLost Serif JP",
    "Iowan Old Style", "Palatino Linotype", Palatino, Georgia,
    "Times New Roman",
    "Songti TC", "Hiragino Mincho ProN", "Noto Serif TC", ui-serif, serif;
}

/* 繁體中文：也要能在 ja/en 祖先底下把字體搶回來。 */
:root[data-lang="zh-Hant"],
[lang|="zh"] {
  --font-ui:
    "HomeLost Sans TC", "HomeLost Sans JP",
    -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui,
    "PingFang TC", "Heiti TC", "Noto Sans TC", "Source Han Sans TC",
    "Microsoft JhengHei", "Hiragino Sans CNS", sans-serif;
  --font-display:
    "HomeLost Serif TC", "HomeLost Serif JP",
    "Iowan Old Style", "Palatino Linotype", Palatino, Georgia,
    "Songti TC", "Songti SC", "Noto Serif TC", "Source Han Serif TC",
    "PMingLiU", ui-serif, serif;
}

body {
  font-family: var(--font-ui);
  color: var(--ink);
  background: #111113;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* 四層文字階級：
   1 display  大標 / 記憶引言    2 title  卡片與面板標題
   3 body     線索與說明          4 meta   眉標、編號、單位 */
.type-display { font-family: var(--font-display); font-weight: 500; letter-spacing: -.01em; }
.type-meta { font-family: var(--font-mono); letter-spacing: .16em; text-transform: uppercase; font-size: 11px; }

/* 中日文不做 uppercase / 大字距：全形字會被拉散、也沒有大小寫。 */
:root[data-lang="zh-Hant"] .type-meta,
:root[data-lang="ja"] .type-meta,
[lang|="zh"] .type-meta,
[lang|="ja"] .type-meta { text-transform: none; letter-spacing: .1em; }

/* 中日文沒有詞間空白，換行只能靠標點換行規則；長句要能安全斷開。 */
:root[data-lang="zh-Hant"] body,
:root[data-lang="ja"] body,
[lang|="zh"],
[lang|="ja"] { line-break: strict; overflow-wrap: break-word; word-break: normal; }
:root[data-lang="en"] body { overflow-wrap: break-word; hyphens: auto; }
button, a { font: inherit; }
button { color: inherit; }
/* WKWebView 連點按鈕會 double-tap zoom；manipulation 讓兩次點擊進遊戲、不縮放整頁。 */
button { touch-action: manipulation; }
a { color: inherit; }

/* ---------- Home ---------- */
.home-page {
  min-height: 100vh;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 75% 14%, rgba(173, 129, 88, 0.17), transparent 32rem),
    radial-gradient(circle at 18% 52%, rgba(88, 106, 110, 0.13), transparent 36rem),
    linear-gradient(145deg, #0b0b0d 0%, #151416 48%, #101214 100%);
}
.home-page::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.2;
  background-image:
    linear-gradient(rgba(255,255,255,.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.018) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: linear-gradient(to bottom, black, transparent 88%);
}
.home-shell { width: min(1220px, calc(100% - 40px)); margin: 0 auto;transition:opacity 100ms ease; }
html.memory-return-pending,
html.memory-return-pending body.home-page { background:#050608; }
html.memory-return-pending .home-shell { opacity:0; }
.home-nav {
  height: 84px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--soft-line);
  position: relative;
  z-index: 2;
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.brand-mark {
  width: 34px; height: 34px; border: 1px solid rgba(255,255,255,.18); border-radius: 12px;
  display: grid; place-items: center; position: relative; background: rgba(255,255,255,.035);
}
.brand-mark::before, .brand-mark::after { content: ""; position: absolute; background: var(--accent); }
.brand-mark::before { width: 14px; height: 1px; }
.brand-mark::after { width: 1px; height: 14px; }
.brand-copy strong { display: block; letter-spacing: .08em; font-size: 13px; }
.brand-copy span { display: block; color: var(--muted); font-size: 11px; margin-top: 2px; }
.nav-note { color: var(--muted); font-size: 12px; letter-spacing: .06em; }

.hero {
  min-height: 610px;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(390px, .95fr);
  align-items: center;
  gap: 58px;
  padding: 72px 0 56px;
  position: relative;
}
.kicker { color: var(--accent); letter-spacing: .2em; font-size: 12px; font-weight: 700; margin-bottom: 22px; }
.hero h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(46px, 6.4vw, 84px);
  line-height: 1.04;
  letter-spacing: -.02em;
  font-weight: 600;
}
.hero h1 .thin { color: #8d8983; font-weight: 340; }
/* 拉丁文字可以收得更緊；中日文一收就會黏在一起。 */
:root[data-lang="en"] .hero h1 { letter-spacing: -.035em; line-height: .98; }
:root[data-lang="zh-Hant"] .hero h1,
:root[data-lang="ja"] .hero h1 { letter-spacing: -.005em; }
.hero-copy { max-width: 560px; color: #bbb5ad; font-size: 18px; line-height: 1.85; margin: 30px 0 34px; }
.hero-actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.reset-progress-btn[hidden] { display:none; }
.primary-btn, .ghost-btn {
  min-height: 52px; padding: 0 24px; border-radius: 999px; text-decoration: none; display: inline-flex;
  align-items: center; justify-content: center; gap: 10px; transition: .22s ease; cursor: pointer;
}
.primary-btn { background: var(--ink); color: #191716; font-weight: 720; box-shadow: 0 14px 35px rgba(255,255,255,.1); }
.primary-btn:hover { transform: translateY(-2px); box-shadow: 0 18px 45px rgba(255,255,255,.16); }
.ghost-btn { border: 1px solid var(--line); color: #c8c2bb; background: rgba(255,255,255,.025); }
.ghost-btn:hover { border-color: rgba(255,255,255,.25); background: rgba(255,255,255,.055); }

.chapter-meter { width:min(300px,34vw);flex:0 0 auto;text-align:right; }
.chapter-meter strong { display:block;margin-bottom:10px;font-size:23px;letter-spacing:-.03em; }
.chapter-track { height:5px;border-radius:99px;background:rgba(255,255,255,.07);overflow:hidden; }
.chapter-track span { display:block;width:0;height:100%;border-radius:inherit;background:linear-gradient(90deg,#8d6e4b,var(--accent),#f0d7ab);box-shadow:0 0 18px rgba(214,177,123,.35);transition:width .5s ease; }
.memory-shelf { display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:10px;margin-top:24px; }
.memory-card {
  --memory-window-x:0%;
  --memory-window-y:0%;
  --memory-window-accent:#d9b071;
  --memory-window-base-brightness:.58;
  --memory-light-rgb:225 175 104;
  --memory-light-x:88%;
  --memory-light-y:30%;
  --memory-mid-mask-x:52%;
  --memory-mid-mask-y:68%;
  --memory-depth-scale:1.025;
  --memory-back-x:0px;
  --memory-back-y:0px;
  --memory-mid-x:0px;
  --memory-mid-y:0px;
  --memory-front-x:0px;
  --memory-front-y:0px;
  --memory-light-shift-x:0px;
  --memory-light-shift-y:0px;
  --memory-life-animation:memory-life-leaf;
  --memory-life-duration:2.8s;
  --memory-life-opacity:.5;
  --memory-return-breath-animation:memory-return-breath-leaf;
  --memory-return-breath-opacity:.72;
  min-height:250px;
  padding:10px;
  position:relative;
  isolation:isolate;
  overflow:hidden;
  display:grid;
  grid-template-rows:auto minmax(0,1fr);
  text-decoration:none;
  border:1px solid rgba(255,255,255,.065);
  border-radius:18px;
  background:linear-gradient(155deg,rgba(255,255,255,.032),rgba(255,255,255,.012));
  transition:transform .2s ease,border-color .2s ease,background .2s ease,box-shadow .2s ease;
}
.memory-card[data-memory-room="living"] {
  --memory-window-x:0%;--memory-window-y:0%;--memory-window-accent:#e1af68;--memory-window-base-brightness:.58;
  --memory-light-rgb:234 175 91;--memory-light-x:91%;--memory-light-y:30%;--memory-mid-mask-x:50%;--memory-mid-mask-y:66%;
  --memory-life-animation:memory-life-leaf;--memory-life-duration:2.8s;--memory-life-opacity:.58;
  --memory-return-breath-animation:memory-return-breath-leaf;--memory-return-breath-opacity:.78;
}
.memory-card[data-memory-room="bedroom"] {
  --memory-window-x:100%;--memory-window-y:0%;--memory-window-accent:#9abed7;--memory-window-base-brightness:.57;
  --memory-light-rgb:166 210 239;--memory-light-x:79%;--memory-light-y:22%;--memory-mid-mask-x:59%;--memory-mid-mask-y:69%;
  --memory-life-animation:memory-life-curtain;--memory-life-duration:3.8s;--memory-life-opacity:.34;
  --memory-return-breath-animation:memory-return-breath-curtain;--memory-return-breath-opacity:.55;
}
.memory-card[data-memory-room="kitchen"] {
  --memory-window-x:0%;--memory-window-y:100%;--memory-window-accent:#d7a05e;--memory-window-base-brightness:.66;
  --memory-light-rgb:231 166 78;--memory-light-x:42%;--memory-light-y:30%;--memory-mid-mask-x:55%;--memory-mid-mask-y:68%;
  --memory-life-animation:memory-life-steam;--memory-life-duration:2.4s;--memory-life-opacity:.62;
  --memory-return-breath-animation:memory-return-breath-steam;--memory-return-breath-opacity:.82;
}
.memory-card[data-memory-room="bathroom"] {
  --memory-window-x:100%;--memory-window-y:100%;--memory-window-accent:#91cbd0;--memory-window-base-brightness:.6;
  --memory-light-rgb:151 214 228;--memory-light-x:76%;--memory-light-y:24%;--memory-mid-mask-x:58%;--memory-mid-mask-y:66%;
  --memory-life-animation:memory-life-mist;--memory-life-duration:4.4s;--memory-life-opacity:.36;
  --memory-return-breath-animation:memory-return-breath-mist;--memory-return-breath-opacity:.62;
}
.memory-card > * { position:relative;z-index:1; }
.memory-card::before {
  content:"";position:absolute;inset:-1px;z-index:0;pointer-events:none;opacity:0;
  background:radial-gradient(circle at 18% 50%,rgba(228,183,116,.32),transparent 42%);
}
.memory-card::after {
  content:"";position:absolute;z-index:2;left:15px;top:15px;width:7px;height:7px;border-radius:50%;
  opacity:0;transform:scale(.3);background:#e2b879;box-shadow:0 0 0 6px rgba(226,184,121,.09),0 0 24px #e2b879;
}
.memory-card:hover { transform:translateY(-2px);border-color:rgba(255,255,255,.15);background:rgba(255,255,255,.045); }
.memory-card:focus-visible { outline:2px solid rgba(198,233,226,.82);outline-offset:3px;border-color:rgba(198,233,226,.44); }
.memory-window {
  position:relative;
  display:block;
  width:100%;
  aspect-ratio:902 / 365;
  overflow:hidden;
  border:1px solid rgba(255,255,255,.075);
  border-radius:11px;
  background:#0b0d0f;
  box-shadow:inset 0 0 0 1px rgba(0,0,0,.24),0 8px 22px rgba(0,0,0,.16);
}
.memory-depth-stage {
  position:absolute;inset:0;z-index:0;display:block;pointer-events:none;
  filter:grayscale(.26) saturate(.7) brightness(var(--memory-window-base-brightness)) contrast(1.1);
  opacity:.8;
  transition:filter .32s ease,opacity .32s ease;
}
.memory-window-scene,
.memory-depth-layer {
  position:absolute;inset:0;display:block;pointer-events:none;
  background-image:url("assets/generated/whole-house-rooms-2x2-v10.png");
  background-repeat:no-repeat;
  background-size:200% 200%;
  background-position:var(--memory-window-x) var(--memory-window-y);
  transform-origin:center;
  transition:transform .55s cubic-bezier(.2,.75,.2,1);
}
.memory-window-scene {
  z-index:0;
  transform:translate3d(var(--memory-back-x),var(--memory-back-y),0) scale(var(--memory-depth-scale));
}
.memory-depth-mid {
  z-index:1;
  transform:translate3d(var(--memory-mid-x),var(--memory-mid-y),0) scale(var(--memory-depth-scale));
  -webkit-mask-image:radial-gradient(ellipse 72% 65% at var(--memory-mid-mask-x) var(--memory-mid-mask-y),#000 24%,rgba(0,0,0,.92) 58%,transparent 84%);
  mask-image:radial-gradient(ellipse 72% 65% at var(--memory-mid-mask-x) var(--memory-mid-mask-y),#000 24%,rgba(0,0,0,.92) 58%,transparent 84%);
}
.memory-depth-front {
  z-index:2;
  transform:translate3d(var(--memory-front-x),var(--memory-front-y),0) scale(var(--memory-depth-scale));
  -webkit-mask-image:linear-gradient(180deg,transparent 42%,rgba(0,0,0,.12) 56%,#000 84%);
  mask-image:linear-gradient(180deg,transparent 42%,rgba(0,0,0,.12) 56%,#000 84%);
}
.memory-window-light {
  position:absolute;z-index:3;left:var(--memory-light-x);top:var(--memory-light-y);
  width:58%;aspect-ratio:1;display:block;pointer-events:none;border-radius:50%;
  background:radial-gradient(circle,rgba(var(--memory-light-rgb) / .72) 0%,rgba(var(--memory-light-rgb) / .22) 24%,transparent 68%);
  mix-blend-mode:screen;filter:blur(7px);opacity:.08;
  transform:translate3d(calc(-50% + var(--memory-light-shift-x)),calc(-50% + var(--memory-light-shift-y)),0) scale(.72);
  transition:opacity .35s ease,transform .55s cubic-bezier(.2,.75,.2,1);
}
.memory-window-light::after {
  content:"";position:absolute;inset:39%;border-radius:50%;
  background:rgba(var(--memory-light-rgb) / .55);
  box-shadow:0 0 15px rgba(var(--memory-light-rgb) / .4);
}
.memory-life-detail {
  position:absolute;z-index:3;display:block;pointer-events:none;opacity:0;
  transition:opacity .28s ease;will-change:transform,opacity;
}
.memory-life-detail::before,
.memory-life-detail::after { content:"";position:absolute;display:block;pointer-events:none; }
.memory-card[data-memory-room="living"] .memory-life-detail {
  left:72.8%;top:27%;width:7%;height:35%;transform-origin:52% 93%;
}
.memory-card[data-memory-room="living"] .memory-life-detail::before {
  left:48%;bottom:1%;width:1px;height:79%;border-radius:999px;
  background:linear-gradient(180deg,rgba(154,164,104,.08),rgba(119,108,69,.54));
  box-shadow:0 0 3px rgba(170,154,96,.16);
}
.memory-card[data-memory-room="living"] .memory-life-detail::after {
  left:42%;top:13%;width:32%;height:10%;border-radius:90% 10% 90% 10%;
  background:rgba(151,158,99,.48);
  box-shadow:
    -3px 4px 0 rgba(132,142,87,.42),
    2px 7px 0 rgba(154,157,91,.4),
    -2px 11px 0 rgba(123,133,81,.34),
    3px 14px 0 rgba(143,139,79,.3);
  filter:drop-shadow(0 1px 1px rgba(16,15,11,.45));
}
.memory-card[data-memory-room="bedroom"] .memory-life-detail {
  left:84.5%;top:4%;width:10%;height:83%;transform-origin:50% 0;
  border-radius:0 0 50% 24%;
  background:
    linear-gradient(90deg,transparent,rgba(164,191,210,.09) 22%,rgba(203,222,232,.16) 50%,rgba(114,146,169,.05) 76%,transparent),
    linear-gradient(180deg,rgba(183,208,224,.1),rgba(77,104,126,.04) 74%,transparent);
  filter:blur(.35px);
}
.memory-card[data-memory-room="bedroom"] .memory-life-detail::before {
  inset:0 34% 0 42%;border-radius:50%;
  background:linear-gradient(180deg,rgba(211,227,236,.12),rgba(115,146,168,.03));
}
.memory-card[data-memory-room="bedroom"] .memory-life-detail::after {
  right:5%;top:0;width:1px;height:90%;background:linear-gradient(180deg,rgba(205,224,237,.2),transparent);
}
.memory-card[data-memory-room="kitchen"] .memory-life-detail {
  left:49.7%;top:27%;width:6%;height:27%;transform-origin:50% 100%;
  background:
    radial-gradient(ellipse 28% 18% at 35% 67%,rgba(238,227,204,.34),transparent 76%),
    radial-gradient(ellipse 32% 20% at 66% 43%,rgba(238,227,204,.26),transparent 78%);
  filter:blur(.65px);
}
.memory-card[data-memory-room="kitchen"] .memory-life-detail::before {
  left:23%;bottom:1%;width:31%;height:82%;border-left:1px solid rgba(241,225,197,.28);
  border-radius:58% 0 0 46%;transform:rotate(-7deg);
}
.memory-card[data-memory-room="kitchen"] .memory-life-detail::after {
  right:20%;bottom:2%;width:26%;height:64%;border-right:1px solid rgba(241,225,197,.23);
  border-radius:0 64% 44% 0;transform:rotate(8deg);
}
.memory-card[data-memory-room="bathroom"] .memory-life-detail {
  left:65.2%;top:7%;width:29%;height:38%;border-radius:8%;
  background:
    radial-gradient(ellipse 34% 28% at 28% 54%,rgba(199,231,237,.24),transparent 76%),
    radial-gradient(ellipse 42% 31% at 68% 35%,rgba(176,218,228,.18),transparent 78%),
    linear-gradient(118deg,transparent 18%,rgba(205,236,240,.1) 47%,transparent 76%);
  mix-blend-mode:screen;filter:blur(2px);transform-origin:62% 46%;
}
.memory-card[data-memory-room="bathroom"] .memory-life-detail::before {
  inset:13% 11%;border-radius:50%;
  background:radial-gradient(ellipse,rgba(210,239,242,.12),transparent 69%);
}
.memory-card[data-memory-room="bathroom"] .memory-life-detail::after {
  left:17%;right:14%;bottom:10%;height:1px;
  background:linear-gradient(90deg,transparent,rgba(213,239,242,.22),transparent);
}
.memory-card.unlocked:hover .memory-life-detail,
.memory-card.unlocked:focus-visible .memory-life-detail,
.memory-card.unlocked.memory-depth-active .memory-life-detail,
.memory-card.chapter-pulse-warm .memory-life-detail,
.memory-card.chapter-pulse-cool .memory-life-detail,
.memory-card.chapter-pulse-resolve .memory-life-detail {
  opacity:var(--memory-life-opacity);
  animation:var(--memory-life-animation) var(--memory-life-duration) ease-in-out infinite;
}
.memory-card.chapter-pulse-warm .memory-life-detail,
.memory-card.chapter-pulse-cool .memory-life-detail { animation-duration:.8s;animation-iteration-count:1; }
.memory-card.chapter-pulse-resolve .memory-life-detail { animation-duration:.82s;animation-iteration-count:1; }
.memory-card:not(.unlocked) .memory-life-detail { opacity:0!important;animation:none!important; }
.memory-window::before {
  content:"";position:absolute;inset:0;z-index:4;pointer-events:none;
  background:
    linear-gradient(180deg,rgba(6,8,10,.02) 0%,rgba(6,8,10,.1) 48%,rgba(6,8,10,.7) 100%),
    linear-gradient(90deg,rgba(5,7,9,.24),transparent 28%,transparent 72%,rgba(5,7,9,.18));
  transition:opacity .3s ease;
}
.memory-window::after {
  content:"";position:absolute;inset:0;z-index:5;pointer-events:none;
  border-radius:inherit;
  box-shadow:inset 0 0 28px rgba(3,5,7,.4),inset 0 1px rgba(255,255,255,.055);
}
.memory-window-scan {
  position:absolute;z-index:6;left:-8%;top:-24%;width:116%;height:22%;display:block;pointer-events:none;opacity:0;
  background:linear-gradient(180deg,transparent,rgba(226,241,236,.2),transparent);
  transform:skewY(-2deg);
}
.memory-window-label,
.memory-window-index {
  position:absolute;z-index:7;bottom:9px;color:rgba(239,233,224,.7);
  font:700 7px/1 var(--font-mono);
  letter-spacing:.1em;white-space:nowrap;text-shadow:0 1px 5px rgba(0,0,0,.8);
}
.memory-window-label { left:10px;max-width:calc(100% - 72px);overflow:hidden;text-overflow:ellipsis; }
.memory-window-index { right:9px;color:var(--memory-window-accent); }
.memory-card-copy { min-width:0;padding:10px 7px 6px;display:flex;flex-direction:column; }
.memory-card-room { color:#77716a;font-size:9px;letter-spacing:.13em; }
.memory-card strong { margin-top:7px;color:#817b74;font-size:14px; }
/* 卡片摘要：外層 <p> 是 flex item（會被壓縮，負責裁掉多餘高度），
   真正的行數裁切放在內層 span——Chrome 會把 flex item 上的 -webkit-box
   轉成 flow-root，line-clamp 就會失效，所以一定要多包一層。 */
.memory-card p {
  margin:7px 0 0;color:#6e6963;font-family:var(--font-display);font-size:11px;line-height:1.55;
  display:block;min-height:0;overflow:hidden;
}
.memory-card p > span {
  display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:3;overflow:hidden;
}
.memory-card.unlocked { border-color:rgba(214,177,123,.15);background:linear-gradient(145deg,rgba(214,177,123,.075),rgba(255,255,255,.02)); }
.memory-card.unlocked .memory-card-room { color:#a68760; }
.memory-card.unlocked strong { color:#e4c79e; }
.memory-card.unlocked p { color:#bbb0a3; }
.memory-card.unlocked:hover,
.memory-card.unlocked:focus-visible,
.memory-card.unlocked.memory-depth-active { --memory-depth-scale:1.045; }
.memory-card.unlocked:hover .memory-depth-stage,
.memory-card.unlocked:focus-visible .memory-depth-stage,
.memory-card.unlocked.memory-depth-active .memory-depth-stage {
  filter:grayscale(.06) saturate(.9) brightness(.8) contrast(1.06);
  opacity:.94;
}
.memory-card.unlocked:hover .memory-window::before,
.memory-card.unlocked:focus-visible .memory-window::before,
.memory-card.unlocked.memory-depth-active .memory-window::before { opacity:.72; }
.memory-card.unlocked:hover .memory-window-light,
.memory-card.unlocked:focus-visible .memory-window-light,
.memory-card.memory-depth-active .memory-window-light { opacity:.2;transform:translate3d(calc(-50% + var(--memory-light-shift-x)),calc(-50% + var(--memory-light-shift-y)),0) scale(.9); }
.memory-card:not(.unlocked) .memory-depth-stage { filter:grayscale(1) saturate(.15) brightness(.29) blur(1.3px);opacity:.42; }
.home-page .memory-card:not(.unlocked) .memory-depth-stage { filter:grayscale(.88) saturate(.28) brightness(.4) blur(1.05px);opacity:.54; }
.memory-card:not(.unlocked) .memory-window-light { opacity:0; }
.memory-card em { margin-top:auto;padding-top:8px;color:#8f887f;font-size:10px;font-style:normal;letter-spacing:.04em; }
.memory-card.unlocked em { color:#c5a979; }
.memory-card.anomaly-complete { border-color:rgba(168,210,179,.28);background:linear-gradient(145deg,rgba(168,210,179,.09),rgba(214,177,123,.045)); }
.memory-card.anomaly-complete em { color:#a8d2b3; }
.memory-card.chapter-pulse-warm {
  border-color:rgba(232,193,132,.62);box-shadow:0 0 0 1px rgba(232,193,132,.1),0 12px 42px rgba(202,151,78,.18);
  animation:chapter-card-warm .82s cubic-bezier(.2,.8,.2,1) both;
}
.memory-card.chapter-pulse-cool {
  border-color:rgba(160,222,213,.62);box-shadow:0 0 0 1px rgba(160,222,213,.1),0 12px 42px rgba(91,174,165,.17);
  animation:chapter-card-cool .82s cubic-bezier(.2,.8,.2,1) both;
}
.memory-card.chapter-pulse-warm::before,
.memory-card.chapter-pulse-cool::before { opacity:1;animation:chapter-card-wash .9s ease both; }
.memory-card.chapter-pulse-cool::before {
  background:radial-gradient(circle at 82% 50%,rgba(142,218,207,.29),transparent 44%);
}
.memory-card.chapter-pulse-warm::after,
.memory-card.chapter-pulse-cool::after { opacity:1;transform:scale(1);transition:.45s cubic-bezier(.2,.8,.2,1); }
.memory-card.chapter-pulse-cool::after {
  left:auto;right:15px;background:#9ed8d0;box-shadow:0 0 0 6px rgba(158,216,208,.09),0 0 24px #9ed8d0;
}
.memory-card.chapter-pulse-warm .memory-depth-stage { animation:memory-window-reveal-warm .8s cubic-bezier(.2,.78,.2,1) both; }
.memory-card.chapter-pulse-cool .memory-depth-stage { animation:memory-window-reveal-cool .8s cubic-bezier(.2,.78,.2,1) both; }
.memory-card.chapter-pulse-warm .memory-depth-back,
.memory-card.chapter-pulse-cool .memory-depth-back { animation:memory-depth-awaken-back .8s cubic-bezier(.2,.78,.2,1) both; }
.memory-card.chapter-pulse-warm .memory-depth-mid,
.memory-card.chapter-pulse-cool .memory-depth-mid { animation:memory-depth-awaken-mid .8s cubic-bezier(.2,.78,.2,1) both; }
.memory-card.chapter-pulse-warm .memory-depth-front,
.memory-card.chapter-pulse-cool .memory-depth-front { animation:memory-depth-awaken-front .8s cubic-bezier(.2,.78,.2,1) both; }
.memory-card.chapter-pulse-warm .memory-window-light { animation:memory-light-awaken-warm .8s cubic-bezier(.2,.78,.2,1) both; }
.memory-card.chapter-pulse-cool .memory-window-light { animation:memory-light-awaken-cool .8s cubic-bezier(.2,.78,.2,1) both; }
.memory-card.chapter-pulse-warm .memory-window-scan,
.memory-card.chapter-pulse-cool .memory-window-scan { animation:memory-window-scan .8s ease-out both; }
.memory-card.chapter-pulse-warm .memory-window-label { color:#f2d39e; }
.memory-card.chapter-pulse-cool .memory-window-label { color:#bde9e2; }
.memory-card.chapter-pulse-resolve {
  border-color:rgba(205,229,220,.5);
  animation:chapter-card-resolve .82s ease both;
}
.memory-card.chapter-pulse-resolve .memory-depth-stage { animation:memory-window-archive .82s ease both; }
.memory-card.chapter-pulse-resolve .memory-depth-back,
.memory-card.chapter-pulse-resolve .memory-depth-mid,
.memory-card.chapter-pulse-resolve .memory-depth-front { animation:memory-depth-archive .82s ease both; }
.memory-card.chapter-pulse-resolve .memory-window-light { animation:memory-light-archive .82s ease both; }

.chapter-pulse-layer {
  position:fixed;inset:0;z-index:70;pointer-events:none;opacity:0;
  transition:opacity .28s ease;filter:drop-shadow(0 0 8px rgba(189,229,219,.25));
}
.chapter-pulse-layer[hidden] { display:none; }
.chapter-pulse-layer.is-visible { opacity:1; }
.chapter-pulse-layer.is-returning { opacity:0;transition-duration:.4s; }
.chapter-pulse-map { width:100%;height:100%;overflow:visible; }
.chapter-pulse-path {
  fill:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;
  stroke-dasharray:var(--chapter-pulse-length);stroke-dashoffset:var(--chapter-pulse-length);opacity:0;
  vector-effect:non-scaling-stroke;
}
.chapter-pulse-path.warm { stroke:rgba(232,190,125,.8); }
.chapter-pulse-path.cool { stroke:rgba(153,220,211,.76); }
.chapter-pulse-layer.draw-warm .chapter-pulse-path.warm {
  opacity:1;stroke-dashoffset:0;transition:stroke-dashoffset 1.65s cubic-bezier(.2,.72,.2,1),opacity .2s ease;
}
.chapter-pulse-layer.draw-cool .chapter-pulse-path.cool {
  opacity:1;stroke-dashoffset:0;transition:stroke-dashoffset 1.65s cubic-bezier(.2,.72,.2,1),opacity .2s ease;
}
.chapter-pulse-node {
  fill:#101416;stroke:rgba(210,237,230,.48);stroke-width:1.5;opacity:0;
  vector-effect:non-scaling-stroke;
}
.chapter-pulse-layer.is-visible .chapter-pulse-node { opacity:.8;transition:opacity .3s ease .15s; }
.chapter-pulse-layer.is-resolved .chapter-pulse-node {
  fill:#d9f0ea;stroke:#fff7e8;opacity:1;animation:chapter-node-resolve .78s ease both;
}

/* ---------- V3.4 memory-window room entry ---------- */
body.memory-entry-active { overflow:hidden;touch-action:none; }
.memory-entry-transition {
  --memory-window-x:0%;
  --memory-window-y:0%;
  --memory-window-accent:#d9b071;
  --memory-light-rgb:225 175 104;
  --memory-light-x:82%;
  --memory-light-y:26%;
  position:fixed;inset:0;z-index:140;overflow:hidden;pointer-events:auto;touch-action:none;
}
.memory-entry-transition[hidden] { display:none!important; }
.memory-entry-transition::before {
  content:"";position:absolute;inset:0;background:#050608;opacity:0;
  transition:opacity 260ms ease;
}
.memory-entry-transition.is-expanding::before { opacity:1; }
.memory-entry-frame {
  position:fixed;
  left:var(--memory-entry-left);
  top:var(--memory-entry-top);
  width:var(--memory-entry-width);
  height:var(--memory-entry-height);
  overflow:hidden;
  border:1px solid rgba(255,255,255,.12);
  border-radius:11px;
  background:#090b0d;
  box-shadow:0 12px 32px rgba(0,0,0,.34),inset 0 0 0 1px rgba(255,255,255,.025);
  transform:translateZ(0);
  transition:
    left 420ms cubic-bezier(.2,.78,.18,1),
    top 420ms cubic-bezier(.2,.78,.18,1),
    width 420ms cubic-bezier(.2,.78,.18,1),
    height 420ms cubic-bezier(.2,.78,.18,1),
    border-radius 420ms cubic-bezier(.2,.78,.18,1),
    box-shadow 300ms ease;
  will-change:left,top,width,height,border-radius;
}
.memory-entry-transition.is-expanding .memory-entry-frame {
  left:0;top:0;width:100vw;height:100vh;height:100dvh;border-radius:0;
  box-shadow:none;
}
.memory-entry-scene,
.memory-entry-light,
.memory-entry-shade { position:absolute;inset:0;display:block;pointer-events:none; }
.memory-entry-scene {
  z-index:0;
  background-image:url("assets/generated/whole-house-rooms-2x2-v10.png");
  background-repeat:no-repeat;
  background-size:200% 200%;
  background-position:var(--memory-window-x) var(--memory-window-y);
  filter:grayscale(.15) saturate(.82) brightness(.72) contrast(1.08);
  transform:scale(1.025);
  transform-origin:center;
  transition:filter 420ms ease,transform 420ms cubic-bezier(.2,.78,.18,1);
}
.memory-entry-transition.is-expanding .memory-entry-scene {
  filter:grayscale(0) saturate(.96) brightness(.82) contrast(1.04);
  transform:scale(1);
}
.memory-entry-light {
  z-index:1;left:var(--memory-light-x);top:var(--memory-light-y);inset:auto;
  width:58%;aspect-ratio:1;border-radius:50%;
  background:radial-gradient(circle,rgba(var(--memory-light-rgb) / .56),rgba(var(--memory-light-rgb) / .15) 28%,transparent 68%);
  mix-blend-mode:screen;filter:blur(12px);opacity:.18;
  transform:translate(-50%,-50%) scale(.75);
  transition:opacity 420ms ease,transform 420ms cubic-bezier(.2,.78,.18,1);
}
.memory-entry-transition.is-expanding .memory-entry-light { opacity:.32;transform:translate(-50%,-50%) scale(1.08); }
.memory-entry-shade {
  z-index:2;
  background:
    linear-gradient(180deg,rgba(4,6,8,.02) 30%,rgba(4,6,8,.68) 100%),
    radial-gradient(ellipse at 50% 46%,transparent 34%,rgba(3,5,7,.42) 100%);
  opacity:.55;
  transition:opacity 420ms ease;
}
.memory-entry-transition.is-expanding .memory-entry-shade { opacity:1; }
.memory-entry-frame::after {
  content:"";position:absolute;inset:0;z-index:5;pointer-events:none;border-radius:inherit;
  box-shadow:inset 0 0 60px rgba(3,5,7,.36),inset 0 1px rgba(255,255,255,.08);
}
.memory-entry-copy {
  position:absolute;z-index:6;
  left:max(24px,env(safe-area-inset-left));
  bottom:max(22px,env(safe-area-inset-bottom));
  display:grid;gap:5px;opacity:0;transform:translateY(12px);
  text-shadow:0 2px 18px rgba(0,0,0,.8);
  transition:opacity 190ms ease,transform 260ms cubic-bezier(.2,.78,.18,1);
}
.memory-entry-transition.is-expanding .memory-entry-copy {
  opacity:1;transform:translateY(0);transition-delay:150ms;
}
.memory-entry-copy small {
  color:var(--memory-window-accent);
  font:720 8px/1.2 var(--font-mono);
  letter-spacing:.18em;
}
.memory-entry-copy strong {
  color:#f2ece4;font:520 clamp(25px,4vw,48px)/1.05 var(--font-display);
  letter-spacing:-.04em;
}
.memory-entry-copy em {
  color:rgba(232,238,237,.58);
  font:650 7px/1.2 var(--font-mono);
  letter-spacing:.15em;font-style:normal;
}

/* ---------- V3.5 room return + memory-window archive ---------- */
.memory-entry-transition.is-returning::before { opacity:1; }
.memory-entry-transition.is-returning .memory-entry-frame {
  left:0;top:0;width:100vw;height:100vh;height:100dvh;border-radius:0;box-shadow:none;
}
.memory-entry-transition.is-returning .memory-entry-scene {
  filter:grayscale(0) saturate(.96) brightness(.82) contrast(1.04);
  transform:scale(1);
}
.memory-entry-transition.is-returning .memory-entry-light {
  opacity:.32;transform:translate(-50%,-50%) scale(1.08);
}
.memory-entry-transition.is-returning .memory-entry-shade { opacity:1; }
.memory-entry-transition.is-returning .memory-entry-copy {
  opacity:1;transform:translateY(0);
}
.memory-entry-transition.is-returning.is-collapsing::before { opacity:0; }
.memory-entry-transition.is-returning.is-collapsing .memory-entry-frame {
  left:var(--memory-entry-left);
  top:var(--memory-entry-top);
  width:var(--memory-entry-width);
  height:var(--memory-entry-height);
  border-radius:11px;
  box-shadow:0 12px 32px rgba(0,0,0,.34),inset 0 0 0 1px rgba(255,255,255,.025);
}
.memory-entry-transition.is-returning.is-collapsing .memory-entry-scene {
  filter:grayscale(.15) saturate(.82) brightness(.72) contrast(1.08);
  transform:scale(1.025);
}
.memory-entry-transition.is-returning.is-collapsing .memory-entry-light {
  opacity:.18;transform:translate(-50%,-50%) scale(.75);
}
.memory-entry-transition.is-returning.is-collapsing .memory-entry-shade { opacity:.55; }
.memory-entry-transition.is-returning.is-collapsing .memory-entry-copy {
  opacity:0;transform:translateY(12px);transition-delay:0ms;
}

/* ---------- V4.5 reverse dust returns to its memory window ---------- */
.memory-return-dust-canvas {
  position:absolute;
  inset:0;
  z-index:4;
  width:100%;
  height:100%;
  display:block;
  pointer-events:none;
  opacity:0;
  mix-blend-mode:screen;
  filter:drop-shadow(0 0 8px rgba(var(--memory-light-rgb) / .48));
  transform:scale(1.006);
  transform-origin:center;
  transition:
    opacity 180ms ease,
    transform 420ms cubic-bezier(.2,.78,.18,1);
}
.memory-entry-transition.is-returning.has-return-dust .memory-return-dust-canvas {
  opacity:.98;
}
.memory-entry-transition.is-returning.is-collapsing.has-return-dust .memory-return-dust-canvas {
  opacity:.62;
  transform:scale(.988);
}

/* ---------- V4.6 five-beat doorplate imprint ---------- */
.memory-doorplate-sigil,
.memory-doorplate-sigil * { pointer-events:none; }
.memory-doorplate-sigil[hidden] { display:none!important; }
.memory-doorplate-sigil {
  --memory-doorplate-length:1px;
  --memory-doorplate-duration:1200ms;
  position:absolute;
  z-index:8;
  top:7px;
  right:7px;
  display:block;
  width:min(49%,116px);
  height:44px;
  overflow:hidden;
  border:1px solid rgba(var(--memory-light-rgb) / .38);
  border-radius:7px;
  background:
    radial-gradient(circle at 6px 6px,rgba(249,235,207,.54) 0 1px,rgba(2,4,6,.72) 1.35px 2.2px,transparent 2.5px),
    radial-gradient(circle at calc(100% - 6px) 6px,rgba(249,235,207,.42) 0 1px,rgba(2,4,6,.72) 1.35px 2.2px,transparent 2.5px),
    linear-gradient(112deg,rgba(var(--memory-light-rgb) / .14),transparent 36%,rgba(222,237,234,.045) 66%,transparent),
    rgba(8,11,13,.84);
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,.035),
    inset 0 -10px 22px rgba(0,0,0,.22),
    0 7px 18px rgba(0,0,0,.34),
    0 0 15px rgba(var(--memory-light-rgb) / .08);
  backdrop-filter:blur(5px) saturate(.86);
  -webkit-backdrop-filter:blur(5px) saturate(.86);
  opacity:0;
  transform:translate3d(0,-3px,0) scale(.92);
  transform-origin:top right;
  contain:layout paint style;
  isolation:isolate;
}
.memory-doorplate-sigil::before {
  content:"";
  position:absolute;
  z-index:0;
  inset:3px;
  border:1px solid rgba(236,230,218,.09);
  border-radius:4px;
  opacity:0;
}
.memory-doorplate-sigil::after {
  content:"";
  position:absolute;
  z-index:3;
  top:-35%;
  bottom:-35%;
  left:-42%;
  width:28%;
  opacity:0;
  transform:skewX(-16deg);
  background:linear-gradient(90deg,transparent,rgba(250,242,226,.18),transparent);
  mix-blend-mode:screen;
}
.memory-doorplate-map {
  position:absolute;
  z-index:1;
  inset:2px 3px 8px;
  width:calc(100% - 6px);
  height:34px;
  overflow:visible;
}
.memory-doorplate-keyline,
.memory-doorplate-route-shadow,
.memory-doorplate-route {
  fill:none;
  vector-effect:non-scaling-stroke;
}
.memory-doorplate-keyline {
  stroke:rgba(235,230,218,.16);
  stroke-width:.55;
  stroke-dasharray:1 4;
  stroke-linecap:round;
  opacity:0;
}
.memory-doorplate-route-shadow {
  stroke:rgba(1,3,4,.86);
  stroke-width:4.1;
  stroke-linecap:round;
  stroke-linejoin:round;
  opacity:0;
}
.memory-doorplate-route {
  stroke:rgba(var(--memory-light-rgb) / .96);
  stroke-width:1.35;
  stroke-linecap:round;
  stroke-linejoin:round;
  stroke-dasharray:var(--memory-doorplate-length);
  stroke-dashoffset:var(--memory-doorplate-length);
  opacity:0;
  filter:drop-shadow(0 0 2.5px rgba(var(--memory-light-rgb) / .58));
}
.memory-doorplate-nodes circle {
  fill:rgba(8,11,13,.96);
  stroke:rgba(var(--memory-light-rgb) / .94);
  stroke-width:1.05;
  vector-effect:non-scaling-stroke;
  opacity:0;
  transform-box:fill-box;
  transform-origin:center;
  transform:scale(.2);
}
.memory-doorplate-beats line {
  stroke:rgba(232,226,214,.42);
  stroke-width:.75;
  stroke-linecap:round;
  vector-effect:non-scaling-stroke;
  opacity:0;
  transform-box:fill-box;
  transform-origin:center bottom;
  transform:scaleY(.15);
}
.memory-doorplate-sigil small {
  position:absolute;
  z-index:2;
  right:5px;
  bottom:2px;
  color:rgba(239,232,218,.58);
  font:720 5.5px/1 var(--font-mono);
  letter-spacing:.12em;
  text-shadow:0 1px 4px rgba(0,0,0,.88);
  opacity:0;
}
.memory-doorplate-sigil.is-imprinting {
  will-change:opacity,transform,filter;
  animation:memory-doorplate-imprint var(--memory-doorplate-duration) cubic-bezier(.2,.76,.2,1) both;
}
.memory-doorplate-sigil.is-imprinting::before {
  animation:memory-doorplate-frame .66s ease-out .08s both;
}
.memory-doorplate-sigil.is-imprinting::after {
  animation:memory-doorplate-sheen .72s cubic-bezier(.2,.72,.2,1) .22s both;
}
.memory-doorplate-sigil.is-imprinting .memory-doorplate-keyline {
  animation:memory-doorplate-keyline .48s ease-out .08s both;
}
.memory-doorplate-sigil.is-imprinting .memory-doorplate-route-shadow {
  animation:memory-doorplate-shadow .72s ease-out .12s both;
}
.memory-doorplate-sigil.is-imprinting .memory-doorplate-route {
  animation:memory-doorplate-route-draw .72s cubic-bezier(.2,.72,.16,1) .12s both;
}
.memory-doorplate-sigil.is-imprinting .memory-doorplate-nodes circle {
  animation:memory-doorplate-node-stamp .34s cubic-bezier(.18,.8,.22,1.35) both;
}
.memory-doorplate-sigil.is-imprinting .memory-doorplate-beats line {
  animation:memory-doorplate-beat-stamp .28s ease-out both;
}
.memory-doorplate-sigil.is-imprinting .memory-doorplate-nodes circle:nth-child(1) { animation-delay:.19s; }
.memory-doorplate-sigil.is-imprinting .memory-doorplate-nodes circle:nth-child(2) { animation-delay:.262s; }
.memory-doorplate-sigil.is-imprinting .memory-doorplate-nodes circle:nth-child(3) { animation-delay:.334s; }
.memory-doorplate-sigil.is-imprinting .memory-doorplate-nodes circle:nth-child(4) { animation-delay:.406s; }
.memory-doorplate-sigil.is-imprinting .memory-doorplate-nodes circle:nth-child(5) { animation-delay:.478s; }
.memory-doorplate-sigil.is-imprinting .memory-doorplate-beats line:nth-child(1) { animation-delay:.29s; }
.memory-doorplate-sigil.is-imprinting .memory-doorplate-beats line:nth-child(2) { animation-delay:.362s; }
.memory-doorplate-sigil.is-imprinting .memory-doorplate-beats line:nth-child(3) { animation-delay:.434s; }
.memory-doorplate-sigil.is-imprinting .memory-doorplate-beats line:nth-child(4) { animation-delay:.506s; }
.memory-doorplate-sigil.is-imprinting .memory-doorplate-beats line:nth-child(5) { animation-delay:.578s; }
.memory-doorplate-sigil.is-imprinting small {
  animation:memory-doorplate-code-in .34s ease-out .56s both;
}
.memory-doorplate-sigil.is-reduced {
  opacity:.82;
  transform:none;
  animation:none!important;
}
.memory-doorplate-sigil.is-reduced::before,
.memory-doorplate-sigil.is-reduced .memory-doorplate-keyline,
.memory-doorplate-sigil.is-reduced .memory-doorplate-route-shadow,
.memory-doorplate-sigil.is-reduced .memory-doorplate-route,
.memory-doorplate-sigil.is-reduced .memory-doorplate-nodes circle,
.memory-doorplate-sigil.is-reduced .memory-doorplate-beats line,
.memory-doorplate-sigil.is-reduced small {
  animation:none!important;
  transition:none!important;
}
.memory-doorplate-sigil.is-reduced::before { opacity:.72; }
.memory-doorplate-sigil.is-reduced .memory-doorplate-keyline { opacity:.42; }
.memory-doorplate-sigil.is-reduced .memory-doorplate-route-shadow { opacity:.58; }
.memory-doorplate-sigil.is-reduced .memory-doorplate-route { opacity:.9;stroke-dashoffset:0; }
.memory-doorplate-sigil.is-reduced .memory-doorplate-nodes circle { opacity:.92;transform:none; }
.memory-doorplate-sigil.is-reduced .memory-doorplate-beats line { opacity:.62;transform:none; }
.memory-doorplate-sigil.is-reduced small { opacity:.68; }

/* ---------- V3.6 returned-memory afterglow ---------- */
.memory-card.memory-return-afterglow {
  z-index:3;
  border-color:rgba(var(--memory-light-rgb) / .68);
  animation:memory-return-card-afterglow 1.2s cubic-bezier(.2,.76,.2,1) both;
}
.memory-card.memory-return-afterglow-reduced { transition:none; }
.memory-card.memory-return-afterglow::before {
  opacity:1;
  background:
    radial-gradient(circle at var(--memory-light-x) var(--memory-light-y),rgba(var(--memory-light-rgb) / .38),transparent 36%),
    linear-gradient(110deg,transparent 18%,rgba(var(--memory-light-rgb) / .16) 48%,transparent 76%);
  animation:memory-return-wash-afterglow 1.2s ease-out both;
}
.memory-card.memory-return-afterglow .memory-depth-stage {
  animation:memory-return-window-afterglow 1.2s cubic-bezier(.2,.76,.2,1) both;
}
.memory-card.memory-return-afterglow .memory-window-light {
  animation:memory-return-light-afterglow 1.2s cubic-bezier(.2,.76,.2,1) both;
}
.memory-card.memory-return-afterglow .memory-window-scan {
  animation:memory-window-scan 1.05s ease-out both;
}
.memory-card.memory-return-guide-target:not(.memory-return-afterglow) {
  z-index:2;
  animation:memory-return-target-afterglow 1.2s ease-out both;
}
.memory-card.memory-return-guide-target::after {
  opacity:1;
  transform:scale(1);
  background:var(--memory-window-accent);
  box-shadow:
    0 0 0 6px color-mix(in srgb,var(--memory-window-accent) 12%,transparent),
    0 0 24px var(--memory-window-accent);
  animation:memory-return-target-node 1.2s ease-out both;
}
.memory-return-guide {
  --memory-return-guide-rgb:205 229 220;
  --memory-return-guide-length:1px;
  position:fixed;inset:0;z-index:74;overflow:hidden;pointer-events:none;opacity:1;
  filter:drop-shadow(0 0 7px rgba(var(--memory-return-guide-rgb) / .36));
}
.memory-return-guide[hidden] { display:none!important; }
.memory-return-guide-map { width:100%;height:100%;overflow:hidden; }
.memory-return-guide-path {
  fill:none;
  stroke:rgba(var(--memory-return-guide-rgb) / .82);
  stroke-width:1.65;
  stroke-linecap:round;
  stroke-linejoin:round;
  stroke-dasharray:var(--memory-return-guide-length);
  stroke-dashoffset:var(--memory-return-guide-length);
  opacity:0;
  vector-effect:non-scaling-stroke;
  transition:
    stroke-dashoffset .72s cubic-bezier(.2,.76,.2,1) .08s,
    opacity .16s ease .04s;
}
.memory-return-guide-node {
  fill:rgba(8,11,13,.92);
  stroke:rgba(var(--memory-return-guide-rgb) / .88);
  stroke-width:1.5;
  opacity:0;
  vector-effect:non-scaling-stroke;
  transform-box:fill-box;
  transform-origin:center;
}
.memory-return-guide.is-visible .memory-return-guide-path {
  stroke-dashoffset:0;
  opacity:.9;
}
.memory-return-guide.is-visible .memory-return-guide-node.source {
  opacity:.86;
  animation:memory-return-guide-source .72s ease-out both;
}
.memory-return-guide.is-visible .memory-return-guide-node.target {
  opacity:1;
  animation:memory-return-guide-target .86s ease-out .34s both;
}
.memory-return-guide[data-target-visible="false"] .memory-return-guide-node.target {
  fill:rgba(var(--memory-return-guide-rgb) / .28);
  stroke-width:2;
}

/* ---------- V3.7 the house breathes once ---------- */
.memory-card.memory-return-breath-target .memory-life-detail,
.memory-card.memory-return-breath-target.memory-return-guide-target .memory-life-detail {
  pointer-events:none;
  opacity:var(--memory-return-breath-opacity);
  animation:var(--memory-return-breath-animation) .8s cubic-bezier(.2,.76,.2,1) 1 both;
}
.memory-card.memory-return-breath-target .memory-window-light,
.memory-card.memory-return-breath-target.memory-return-guide-target .memory-window-light {
  animation:memory-return-breath-light .8s cubic-bezier(.2,.76,.2,1) 1 both;
}
.memory-card.memory-return-breath-target[data-memory-room="bathroom"] .memory-life-detail::after {
  left:34%;right:auto;top:30%;bottom:auto;width:28%;height:40%;
  border:1px solid rgba(220,243,245,.42);
  border-left-color:transparent;
  border-bottom-color:rgba(220,243,245,.18);
  border-radius:52% 48% 46% 54%;
  background:
    repeating-radial-gradient(ellipse at 50% 54%,transparent 0 2px,rgba(220,243,245,.28) 2.5px 3px,transparent 3.5px 5px);
  filter:drop-shadow(0 0 3px rgba(169,225,234,.28));
  animation:memory-return-breath-fingerprint .8s ease-out 1 both;
}
.memory-card.memory-return-breath-reduced .memory-window-light {
  pointer-events:none;
}

/* ---------- V3.8 catch the echo ---------- */
.memory-entry-catch,
.memory-entry-catch::before,
.memory-entry-catch::after,
.memory-entry-catch-detail {
  position:absolute;display:block;pointer-events:none;
}
.memory-entry-catch {
  inset:0;z-index:3;overflow:hidden;opacity:0;isolation:isolate;
}
.memory-entry-transition.is-catching-breath.is-expanding .memory-entry-catch { opacity:1; }
.memory-entry-catch::before,
.memory-entry-catch::after { content:""; }
.memory-entry-catch-detail { z-index:2; }

.memory-entry-transition[data-memory-catch-room="living"] .memory-entry-catch::before {
  z-index:1;inset:-22%;
  background:
    radial-gradient(ellipse 12% 28% at 22% 53%,rgba(8,25,16,.68) 0 48%,transparent 54%),
    radial-gradient(ellipse 13% 30% at 37% 42%,rgba(10,31,20,.62) 0 48%,transparent 54%),
    radial-gradient(ellipse 12% 27% at 51% 56%,rgba(8,26,17,.58) 0 48%,transparent 54%),
    radial-gradient(ellipse 10% 24% at 64% 43%,rgba(11,31,20,.5) 0 48%,transparent 54%);
  filter:blur(4px);mix-blend-mode:multiply;
  transform-origin:16% 86%;
}
.memory-entry-transition[data-memory-catch-room="living"] .memory-entry-catch::after {
  z-index:0;inset:-12%;
  background:linear-gradient(112deg,transparent 18%,rgba(236,186,104,.19) 47%,transparent 72%);
  mix-blend-mode:screen;
}
.memory-entry-transition[data-memory-catch-room="living"] .memory-entry-catch-detail {
  left:-8%;bottom:2%;width:72%;height:2px;
  background:linear-gradient(90deg,transparent,rgba(13,31,21,.55) 28% 86%,transparent);
  filter:blur(1.5px);transform-origin:left center;
}
.memory-entry-transition.is-catching-breath.is-expanding[data-memory-catch-room="living"] .memory-entry-catch::before {
  animation:memory-entry-catch-leaf-shadow 420ms cubic-bezier(.18,.7,.18,1) both;
}
.memory-entry-transition.is-catching-breath.is-expanding[data-memory-catch-room="living"] .memory-entry-catch::after {
  animation:memory-entry-catch-leaf-light 420ms ease-out both;
}
.memory-entry-transition.is-catching-breath.is-expanding[data-memory-catch-room="living"] .memory-entry-catch-detail {
  animation:memory-entry-catch-leaf-stem 420ms cubic-bezier(.18,.7,.18,1) both;
}

.memory-entry-transition[data-memory-catch-room="bedroom"] .memory-entry-catch::before {
  z-index:1;inset:-8% -12% -8% 34%;
  background:
    repeating-linear-gradient(92deg,rgba(129,166,196,.05) 0 9%,rgba(198,220,232,.22) 13%,rgba(92,126,159,.1) 20%),
    linear-gradient(90deg,transparent,rgba(173,205,226,.28));
  box-shadow:-28px 0 58px rgba(150,199,230,.17);
  filter:blur(2px);
}
.memory-entry-transition[data-memory-catch-room="bedroom"] .memory-entry-catch::after {
  z-index:2;right:8%;top:8%;width:clamp(70px,13vw,150px);aspect-ratio:1;border-radius:50%;
  background:radial-gradient(circle,rgba(232,239,224,.78),rgba(180,211,228,.28) 44%,transparent 72%);
  filter:blur(1px);mix-blend-mode:screen;
}
.memory-entry-transition[data-memory-catch-room="bedroom"] .memory-entry-catch-detail {
  z-index:0;inset:-12%;
  background:linear-gradient(104deg,transparent 24%,rgba(165,210,238,.22) 51%,transparent 75%);
  mix-blend-mode:screen;
}
.memory-entry-transition.is-catching-breath.is-expanding[data-memory-catch-room="bedroom"] .memory-entry-catch::before {
  animation:memory-entry-catch-curtain 420ms cubic-bezier(.18,.72,.16,1) both;
}
.memory-entry-transition.is-catching-breath.is-expanding[data-memory-catch-room="bedroom"] .memory-entry-catch::after {
  animation:memory-entry-catch-moon 420ms ease-out both;
}
.memory-entry-transition.is-catching-breath.is-expanding[data-memory-catch-room="bedroom"] .memory-entry-catch-detail {
  animation:memory-entry-catch-moonlight 420ms ease-out both;
}

.memory-entry-transition[data-memory-catch-room="kitchen"] .memory-entry-catch::before,
.memory-entry-transition[data-memory-catch-room="kitchen"] .memory-entry-catch::after,
.memory-entry-transition[data-memory-catch-room="kitchen"] .memory-entry-catch-detail {
  z-index:1;left:20%;bottom:-34%;width:32%;height:102%;
  border:clamp(8px,1.4vw,18px) solid transparent;
  border-left-color:rgba(239,227,202,.3);
  border-top-color:rgba(239,227,202,.16);
  border-radius:52% 48% 46% 54%;
  filter:blur(5px);mix-blend-mode:screen;
}
.memory-entry-transition[data-memory-catch-room="kitchen"] .memory-entry-catch::after {
  left:43%;bottom:-42%;width:26%;height:108%;border-width:clamp(7px,1.1vw,14px);
}
.memory-entry-transition[data-memory-catch-room="kitchen"] .memory-entry-catch-detail {
  left:62%;bottom:-50%;width:20%;height:112%;border-width:clamp(6px,.9vw,12px);
}
.memory-entry-transition.is-catching-breath.is-expanding[data-memory-catch-room="kitchen"] .memory-entry-catch::before {
  animation:memory-entry-catch-steam-a 420ms cubic-bezier(.16,.68,.14,1) both;
}
.memory-entry-transition.is-catching-breath.is-expanding[data-memory-catch-room="kitchen"] .memory-entry-catch::after {
  animation:memory-entry-catch-steam-b 420ms cubic-bezier(.16,.68,.14,1) 35ms both;
}
.memory-entry-transition.is-catching-breath.is-expanding[data-memory-catch-room="kitchen"] .memory-entry-catch-detail {
  animation:memory-entry-catch-steam-c 420ms cubic-bezier(.16,.68,.14,1) 65ms both;
}

.memory-entry-transition[data-memory-catch-room="bathroom"] .memory-entry-catch::before {
  z-index:0;inset:-10%;
  background:
    radial-gradient(ellipse at 24% 45%,rgba(201,231,233,.36),transparent 42%),
    radial-gradient(ellipse at 72% 42%,rgba(177,216,222,.3),transparent 48%),
    linear-gradient(110deg,rgba(192,225,228,.19),rgba(78,114,122,.08));
  filter:blur(14px);mix-blend-mode:screen;
}
.memory-entry-transition[data-memory-catch-room="bathroom"] .memory-entry-catch::after {
  z-index:2;left:38%;top:18%;width:clamp(105px,20vw,230px);height:clamp(145px,31vw,330px);
  border:2px solid rgba(221,243,244,.4);border-left-color:transparent;border-bottom-color:rgba(221,243,244,.16);
  border-radius:53% 47% 45% 55%;
  background:repeating-radial-gradient(ellipse at 50% 54%,transparent 0 6px,rgba(221,243,244,.22) 7px 8px,transparent 9px 13px);
  filter:drop-shadow(0 0 9px rgba(172,225,231,.24));transform-origin:center;
}
.memory-entry-transition[data-memory-catch-room="bathroom"] .memory-entry-catch-detail {
  z-index:1;inset:-12%;
  background:linear-gradient(98deg,transparent 32%,rgba(226,245,245,.24) 48%,rgba(226,245,245,.06) 58%,transparent 72%);
  mix-blend-mode:screen;
}
.memory-entry-transition.is-catching-breath.is-expanding[data-memory-catch-room="bathroom"] .memory-entry-catch::before {
  animation:memory-entry-catch-mist 420ms ease-out both;
}
.memory-entry-transition.is-catching-breath.is-expanding[data-memory-catch-room="bathroom"] .memory-entry-catch::after {
  animation:memory-entry-catch-fingerprint 420ms cubic-bezier(.18,.72,.16,1) both;
}
.memory-entry-transition.is-catching-breath.is-expanding[data-memory-catch-room="bathroom"] .memory-entry-catch-detail {
  animation:memory-entry-catch-mist-wipe 420ms ease-out both;
}

body.memory-return-active { overflow:hidden;touch-action:none; }
.memory-return-departure {
  --memory-window-x:0%;
  --memory-window-y:0%;
  --memory-window-accent:#d9b071;
  --memory-light-rgb:225 175 104;
  --memory-light-x:82%;
  --memory-light-y:26%;
  position:fixed;inset:0;z-index:145;overflow:hidden;pointer-events:auto;touch-action:none;
  background:#050608;opacity:0;
  transition:opacity 260ms ease;
}
.memory-return-departure[hidden] { display:none!important; }
.memory-return-departure.is-visible { opacity:1; }
.memory-return-departure[data-memory-room="living"] {
  --memory-window-x:0%;--memory-window-y:0%;--memory-window-accent:#e1af68;
  --memory-light-rgb:234 175 91;--memory-light-x:91%;--memory-light-y:30%;
}
.memory-return-departure[data-memory-room="bedroom"] {
  --memory-window-x:100%;--memory-window-y:0%;--memory-window-accent:#9abed7;
  --memory-light-rgb:166 210 239;--memory-light-x:79%;--memory-light-y:22%;
}
.memory-return-departure[data-memory-room="kitchen"] {
  --memory-window-x:0%;--memory-window-y:100%;--memory-window-accent:#d7a05e;
  --memory-light-rgb:231 166 78;--memory-light-x:42%;--memory-light-y:30%;
}
.memory-return-departure[data-memory-room="bathroom"] {
  --memory-window-x:100%;--memory-window-y:100%;--memory-window-accent:#91cbd0;
  --memory-light-rgb:151 214 228;--memory-light-x:76%;--memory-light-y:24%;
}
.memory-return-departure-scene,
.memory-return-departure-light,
.memory-return-departure-shade { position:absolute;inset:0;display:block;pointer-events:none; }
.memory-return-departure-scene {
  z-index:0;
  background:url("assets/generated/whole-house-rooms-2x2-v10.png") var(--memory-window-x) var(--memory-window-y)/200% 200% no-repeat;
  filter:grayscale(0) saturate(.96) brightness(.82) contrast(1.04);
  transform:scale(1.008);
  transition:transform 260ms cubic-bezier(.2,.78,.18,1);
}
.memory-return-departure.is-visible .memory-return-departure-scene { transform:scale(1); }
.memory-return-departure-light {
  z-index:1;left:var(--memory-light-x);top:var(--memory-light-y);inset:auto;
  width:58%;aspect-ratio:1;border-radius:50%;
  background:radial-gradient(circle,rgba(var(--memory-light-rgb) / .5),rgba(var(--memory-light-rgb) / .14) 30%,transparent 68%);
  mix-blend-mode:screen;filter:blur(13px);opacity:.3;transform:translate(-50%,-50%);
}
.memory-return-departure-shade {
  z-index:2;
  background:linear-gradient(180deg,rgba(4,6,8,.04) 28%,rgba(4,6,8,.72) 100%),
    radial-gradient(ellipse at 50% 46%,transparent 34%,rgba(3,5,7,.38) 100%);
}
.memory-return-departure-copy {
  position:absolute;z-index:3;left:max(24px,env(safe-area-inset-left));bottom:max(22px,env(safe-area-inset-bottom));
  display:grid;gap:5px;color:#f2ece4;text-shadow:0 2px 18px rgba(0,0,0,.8);
  opacity:0;transform:translateY(10px);transition:opacity 180ms ease 70ms,transform 220ms cubic-bezier(.2,.78,.18,1) 70ms;
}
.memory-return-departure.is-visible .memory-return-departure-copy { opacity:1;transform:translateY(0); }
.memory-return-departure-copy small {
  color:var(--memory-window-accent);font:720 8px/1.2 var(--font-mono);letter-spacing:.18em;
}
.memory-return-departure-copy strong {
  font:520 clamp(25px,4vw,48px)/1.05 var(--font-display);letter-spacing:-.04em;
}
.memory-return-departure-copy em {
  color:rgba(232,238,237,.58);font:650 7px/1.2 var(--font-mono);
  letter-spacing:.15em;font-style:normal;
}

.anomaly-archive {
  margin-top:18px;padding:20px 22px;border:1px solid rgba(214,177,123,.18);border-radius:20px;
  display:flex;align-items:center;justify-content:space-between;gap:24px;
  background:linear-gradient(120deg,rgba(214,177,123,.075),rgba(255,255,255,.018));
}
.anomaly-archive[hidden] { display:none; }
.anomaly-archive > div:first-child { display:grid;gap:6px; }
.anomaly-archive span { color:#9a7e5d;font-size:9px;letter-spacing:.14em; }
.anomaly-archive strong { color:#e6d8c4;font-size:18px; }
.anomaly-archive p { margin:0;color:#8e8881;font-size:12px;line-height:1.6; }
.anomaly-archive-meter { min-width:180px;display:grid;grid-template-columns:1fr auto;align-items:center;gap:10px; }
.anomaly-archive-meter > strong { grid-column:2;font-size:13px;color:#d9c5a6; }
.anomaly-archive-meter > span { grid-column:1;grid-row:1;width:100%;height:5px;border-radius:999px;background:rgba(255,255,255,.07);overflow:hidden; }
.anomaly-archive-meter i { display:block;width:0;height:100%;border-radius:inherit;background:linear-gradient(90deg,#9f7c51,#e6c58f,#a8d2b3);transition:width .6s ease; }
.chapter-ending.anomaly-ending { border-color:rgba(168,210,179,.2);background:radial-gradient(circle at 80% 10%,rgba(168,210,179,.1),transparent 45%),rgba(255,255,255,.02); }
.chapter-ending {
  margin-top:18px;
  padding:24px;
  border-left:2px solid var(--accent);
  background:linear-gradient(90deg,rgba(214,177,123,.09),transparent);
}
.chapter-ending[hidden] { display:none; }
.chapter-ending span { color:var(--accent);font-size:9px;font-weight:700;letter-spacing:.17em; }
.chapter-ending h3 { margin:9px 0 7px;font-size:22px;letter-spacing:-.03em; }
.chapter-ending p { margin:0;color:#aaa39b;line-height:1.75;font-family:var(--font-display);font-size:14px; }
.restoration-entry {
  margin-top:17px;padding:10px 15px;border:1px solid rgba(168,210,179,.24);border-radius:999px;
  background:rgba(168,210,179,.075);color:#bfe1c8;font-size:11px;letter-spacing:.035em;cursor:pointer;transition:.2s ease;
}
.restoration-entry:hover { transform:translateY(-1px);border-color:rgba(168,210,179,.44);background:rgba(168,210,179,.12); }

/* ---------- V2.8 personalized double-echo chapter seal ---------- */
.echo-signature-cover {
  width:min(520px,100%);margin-top:18px;padding:12px;
  display:grid;grid-template-columns:minmax(150px,190px) minmax(0,1fr);align-items:center;gap:16px;
  border:1px solid rgba(186,224,216,.2);border-radius:18px;
  background:
    radial-gradient(circle at 24% 42%,rgba(218,180,124,.1),transparent 38%),
    linear-gradient(130deg,rgba(22,26,27,.92),rgba(10,12,14,.72));
  box-shadow:0 16px 42px rgba(0,0,0,.2),inset 0 1px rgba(255,255,255,.025);
}
.echo-signature-cover[hidden] { display:none; }
.sr-only {
  position:absolute!important;width:1px!important;height:1px!important;padding:0!important;margin:-1px!important;
  overflow:hidden!important;clip:rect(0,0,0,0)!important;white-space:nowrap!important;border:0!important;
}
#echo-signature-cover {
  appearance:none;position:relative;isolation:isolate;color:inherit;font:inherit;text-align:left;cursor:pointer;
  transition:border-color .25s ease,background .25s ease,box-shadow .25s ease,transform .25s ease;
}
#echo-signature-cover:not(:disabled):hover {
  transform:translateY(-2px);border-color:rgba(186,224,216,.38);
  box-shadow:0 20px 50px rgba(0,0,0,.26),0 0 30px rgba(151,211,201,.07),inset 0 1px rgba(255,255,255,.04);
}
#echo-signature-cover:focus-visible {
  outline:2px solid #c6e9e2;outline-offset:4px;border-color:rgba(198,233,226,.52);
}
#echo-signature-cover:disabled { cursor:default; }
#echo-signature-cover.has-replayed .echo-signature-mark { animation:none; }
.echo-signature-art {
  position:relative;display:block;width:100%;height:88px;overflow:hidden;
  border:1px solid rgba(190,224,219,.14);border-radius:13px;
  background:
    linear-gradient(rgba(183,220,213,.035) 1px,transparent 1px),
    linear-gradient(90deg,rgba(183,220,213,.035) 1px,transparent 1px),
    radial-gradient(ellipse at 50% 50%,rgba(118,172,163,.12),rgba(9,12,14,.88) 69%);
  background-size:18px 18px,18px 18px,100% 100%;
}
.echo-signature-art::before {
  content:"";position:absolute;z-index:0;left:-45%;top:0;width:32%;height:100%;
  background:linear-gradient(90deg,transparent,rgba(208,241,234,.1),transparent);
  transform:skewX(-15deg);animation:echo-signature-scan 3.8s 1s ease-in-out infinite;
}
.echo-signature-art::after {
  content:"MIRROR / 0.5s";position:absolute;right:7px;bottom:5px;color:rgba(183,219,211,.4);
  font:700 6px/1 var(--font-mono);letter-spacing:.13em;
}
.echo-signature-link {
  position:absolute;z-index:1;height:1px;transform-origin:0 50%;
  background:linear-gradient(90deg,rgba(223,183,123,.78),rgba(177,213,207,.22) 52%,rgba(154,214,207,.8));
  box-shadow:0 0 8px rgba(187,225,215,.22);
}
.echo-signature-mark {
  position:absolute;z-index:2;width:25px;height:25px;border-radius:50%;transform:translate(-50%,-50%);
  border:1px solid currentColor;box-shadow:0 0 14px currentColor,inset 0 0 8px currentColor;
  animation:echo-signature-mark-in .7s cubic-bezier(.2,.8,.2,1) both;
}
.echo-signature-mark::before {
  content:"";position:absolute;inset:-10px;border:1px solid currentColor;border-radius:50%;opacity:.22;
  box-shadow:0 0 0 6px rgba(184,222,214,.07),0 0 0 13px rgba(184,222,214,.035);
}
.echo-signature-mark::after {
  content:"";position:absolute;inset:8px;border-radius:50%;background:currentColor;box-shadow:0 0 7px currentColor;
}
.echo-signature-mark.warm { color:#e2b879;animation-delay:.08s; }
.echo-signature-mark.cool { color:#9ed8d0;animation-delay:.28s; }
.echo-signature-copy { min-width:0;display:grid;gap:4px;text-align:left; }
.echo-signature-copy small {
  color:#7fa59e;font:720 7px/1.4 var(--font-mono);letter-spacing:.13em;
}
.echo-signature-copy strong { color:#e9e1d5;font:560 16px/1.35 var(--font-display);letter-spacing:.01em; }
.echo-signature-copy em {
  width:max-content;margin-top:2px;padding:4px 7px;border:1px solid rgba(185,222,215,.16);border-radius:999px;
  color:#a7d3cb;background:rgba(154,202,194,.06);font:700 9px/1 var(--font-mono);
  letter-spacing:.15em;font-style:normal;
}
.echo-signature-copy .echo-signature-action {
  margin-top:4px;color:#c9ad82;font:650 8px/1.45 var(--font-ui);letter-spacing:.045em;
  transition:color .25s ease,opacity .25s ease,transform .25s ease;
}
.echo-signature-cover.is-legacy .echo-signature-art,
.echo-signature-cover.is-legacy .echo-signature-copy { opacity:.64; }
#echo-signature-cover.is-legacy .echo-signature-action { color:#98938c; }
#echo-signature-cover.is-replaying {
  border-color:rgba(199,232,225,.4);
  background:
    radial-gradient(circle at 24% 42%,rgba(225,181,116,.16),transparent 41%),
    radial-gradient(circle at 76% 58%,rgba(142,218,207,.11),transparent 43%),
    linear-gradient(130deg,rgba(22,26,27,.96),rgba(10,12,14,.78));
  box-shadow:0 22px 62px rgba(0,0,0,.33),0 0 34px rgba(155,213,203,.1),inset 0 1px rgba(255,255,255,.05);
}
#echo-signature-cover.is-replaying .echo-signature-art::before {
  animation:echo-seal-sweep 2.7s .2s cubic-bezier(.2,.7,.2,1) both;
}
#echo-signature-cover.is-replaying .echo-signature-mark {
  opacity:0;filter:blur(7px);transform:translate(-50%,-50%) scale(.35);animation:none;
  transition:opacity .48s ease,filter .48s ease,transform .62s cubic-bezier(.2,.85,.2,1);
}
#echo-signature-cover.is-replaying.replay-warm .echo-signature-mark.warm,
#echo-signature-cover.is-replaying.replay-cool .echo-signature-mark.cool {
  opacity:1;filter:blur(0);transform:translate(-50%,-50%) scale(1);
}
#echo-signature-cover.is-replaying .echo-signature-link {
  opacity:.1;clip-path:inset(0 100% 0 0);
  transition:clip-path .82s cubic-bezier(.2,.75,.2,1),opacity .5s ease,filter .4s ease;
}
#echo-signature-cover.is-replaying.replay-linked .echo-signature-link {
  opacity:1;clip-path:inset(0 0 0 0);filter:brightness(1.35);
}
#echo-signature-cover.is-replaying .echo-signature-copy em { opacity:.36;filter:blur(2px);transition:.45s ease; }
#echo-signature-cover.is-replaying.replay-complete { animation:echo-seal-complete .92s ease both; }
#echo-signature-cover.is-replaying.replay-complete .echo-signature-copy em {
  opacity:1;filter:blur(0);color:#d5f2eb;border-color:rgba(201,239,232,.48);
  background:rgba(154,222,211,.14);box-shadow:0 0 22px rgba(157,222,212,.22);
  animation:echo-seal-code .92s ease both;
}
#echo-signature-cover.is-replaying.replay-complete .echo-signature-action { color:#d9c39d;transform:translateX(2px); }

/* ---------- V4.9 four-doorplate miniature house + finite window lookback ---------- */
.chapter-doorplate-house,
.chapter-doorplate-house * { pointer-events:none!important; }
.chapter-doorplate-house[hidden] { display:none!important; }
.chapter-doorplate-house {
  position:absolute;inset:0;z-index:4;display:block;overflow:hidden;opacity:0;
  border-radius:12px;background:
    radial-gradient(ellipse at 50% 42%,rgba(180,218,209,.12),transparent 63%),
    linear-gradient(130deg,rgba(10,12,14,.96),rgba(18,20,21,.9));
  box-shadow:inset 0 0 0 1px rgba(207,235,229,.08),inset 0 0 24px rgba(0,0,0,.32);
}
.chapter-doorplate-house::before {
  content:"";position:absolute;z-index:2;inset:-30% -22%;opacity:0;transform:translateX(-28%) rotate(-8deg);
  background:linear-gradient(90deg,transparent 34%,rgba(225,244,238,.1) 49%,rgba(230,190,129,.07) 54%,transparent 69%);
}
.chapter-doorplate-house-map { position:absolute;inset:0;width:100%;height:100%;overflow:visible; }
.chapter-doorplate-house-shell-shadow,
.chapter-doorplate-house-shell,
.chapter-doorplate-house-ridge {
  fill:none;vector-effect:non-scaling-stroke;stroke-linecap:round;stroke-linejoin:round;
}
.chapter-doorplate-house-shell-shadow {
  stroke:rgba(112,211,196,.2);stroke-width:3.8;opacity:0;filter:blur(2px);
}
.chapter-doorplate-house-shell {
  stroke:url(#chapter-house-shell-light);stroke-width:1;opacity:0;
  stroke-dasharray:390;stroke-dashoffset:390;
}
.chapter-doorplate-house-ridge {
  stroke:rgba(211,229,223,.2);stroke-width:.55;stroke-dasharray:2.2 3.4;opacity:0;
}
.chapter-doorplate-room { --chapter-house-window-rgb:222,193,150;color:#dec196;opacity:0; }
.chapter-doorplate-room.cool { color:#9fd8d0; }
.chapter-doorplate-room.living { --chapter-house-window-rgb:239,192,119; }
.chapter-doorplate-room.bedroom { --chapter-house-window-rgb:211,232,239; }
.chapter-doorplate-room.kitchen { --chapter-house-window-rgb:236,157,83; }
.chapter-doorplate-room.bathroom { --chapter-house-window-rgb:137,218,209; }
.chapter-house-window-pane {
  fill:rgba(var(--chapter-house-window-rgb),1);fill-opacity:.018;stroke:currentColor;stroke-width:.42;stroke-opacity:.25;opacity:.52;
  vector-effect:non-scaling-stroke;
}
.chapter-house-window-mullions {
  fill:none;stroke:rgba(var(--chapter-house-window-rgb),.42);stroke-width:.34;stroke-dasharray:1.2 3.2;
  vector-effect:non-scaling-stroke;opacity:.08;
}
.chapter-house-window-shadow { color:#d8c39a;visibility:hidden; }
.chapter-house-window-shadow[data-shadow-ready="true"] { visibility:visible; }
.chapter-house-window-shadow[data-shadow-room="bedroom"],
.chapter-house-window-shadow[data-shadow-room="bathroom"] { color:#a7ddd7; }
.chapter-house-window-shadow-curtain {
  fill:none;stroke:currentColor;stroke-width:.46;stroke-linecap:round;vector-effect:non-scaling-stroke;opacity:0;
}
.chapter-house-window-shadow-figure {
  opacity:0;transform-box:fill-box;transform-origin:center bottom;will-change:transform,opacity;
  filter:drop-shadow(0 0 1.6px rgba(218,234,228,.36));
}
.chapter-house-window-shadow-body {
  fill:rgba(5,7,8,.94);stroke:currentColor;stroke-width:.35;stroke-opacity:.48;vector-effect:non-scaling-stroke;
}
.chapter-house-window-shadow-shoulder {
  fill:none;stroke:rgba(224,231,220,.2);stroke-width:.35;stroke-linecap:round;vector-effect:non-scaling-stroke;
}
.chapter-house-window-shadow-head { transform-box:fill-box;transform-origin:center; }
.chapter-house-window-shadow-head ellipse {
  fill:rgba(4,6,7,.96);stroke:currentColor;stroke-width:.34;stroke-opacity:.5;vector-effect:non-scaling-stroke;
}
.chapter-house-window-shadow-profile {
  fill:none;stroke:currentColor;stroke-width:.42;stroke-linecap:round;stroke-opacity:.56;vector-effect:non-scaling-stroke;
}
.chapter-doorplate-room-shadow,
.chapter-doorplate-room-route {
  fill:none;stroke:currentColor;stroke-linecap:round;stroke-linejoin:round;vector-effect:non-scaling-stroke;
  stroke-dasharray:var(--chapter-house-route-length);stroke-dashoffset:var(--chapter-house-route-length);
}
.chapter-doorplate-room-shadow { stroke-width:2.4;opacity:0;filter:blur(1.5px); }
.chapter-doorplate-room-route { stroke-width:.8;opacity:0; }
.chapter-doorplate-room-nodes circle {
  fill:#101416;stroke:currentColor;stroke-width:.55;vector-effect:non-scaling-stroke;opacity:0;
}
.chapter-doorplate-room-beats line {
  stroke:currentColor;stroke-width:.55;stroke-linecap:round;vector-effect:non-scaling-stroke;opacity:0;
}
.chapter-doorplate-room text {
  fill:currentColor;opacity:.5;font:700 3.2px/1 var(--font-mono);letter-spacing:.14em;
}
.chapter-doorplate-house-key { color:#d9dfd7;opacity:0; }
.chapter-doorplate-house-key path {
  fill:rgba(9,12,14,.86);stroke:currentColor;stroke-width:.7;vector-effect:non-scaling-stroke;
}
.chapter-doorplate-house-key circle { fill:#ddb97f;filter:drop-shadow(0 0 2px rgba(222,184,122,.7)); }
.chapter-house-hearth { color:#dcebe6;opacity:0; }
.chapter-house-door-beam { fill:url(#chapter-house-hearth-light);opacity:0; }
.chapter-house-trace-line,
.chapter-house-door-slit {
  fill:none;stroke:url(#chapter-house-shell-light);stroke-linecap:round;vector-effect:non-scaling-stroke;
}
.chapter-house-trace-line {
  stroke-width:.72;stroke-dasharray:var(--chapter-house-trace-length);stroke-dashoffset:var(--chapter-house-trace-length);opacity:0;
  filter:drop-shadow(0 0 1.6px rgba(192,231,222,.7));
}
.chapter-house-trace-node {
  fill:#0d1112;stroke:currentColor;stroke-width:.55;vector-effect:non-scaling-stroke;opacity:0;
  filter:drop-shadow(0 0 1.5px rgba(229,193,137,.6));
}
.chapter-house-door-slit { stroke-width:1.15;opacity:0;filter:drop-shadow(0 0 2px rgba(239,196,132,.72)); }
.chapter-doorplate-house > small {
  position:absolute;z-index:3;left:6px;right:6px;bottom:2px;display:flex;align-items:center;justify-content:space-between;gap:0;opacity:0;
  color:rgba(218,235,230,.62);font:700 3.8px/1 var(--font-mono);letter-spacing:.06em;white-space:nowrap;
}
.chapter-doorplate-house > small span { color:#d8c39e; }
.chapter-doorplate-house > small i { color:#79aaa2;font-style:normal;font-size:3.5px; }
#echo-signature-cover.is-replaying.replay-house .echo-signature-mark.warm,
#echo-signature-cover.is-replaying.replay-house .echo-signature-mark.cool,
#echo-signature-cover.is-replaying.replay-house .echo-signature-link { opacity:.07;filter:blur(5px); }
#echo-signature-cover.replay-house .echo-signature-art::after { opacity:.08; }
.chapter-doorplate-house.is-building {
  animation:chapter-house-layer-in 1.2s cubic-bezier(.2,.72,.18,1) both;
}
.chapter-doorplate-house.is-building::before { animation:chapter-house-glass-sweep .72s ease-out .25s both; }
.chapter-doorplate-house.is-building .chapter-doorplate-house-shell-shadow { animation:chapter-house-shell-glow .72s ease-out .08s both; }
.chapter-doorplate-house.is-building .chapter-doorplate-house-shell { animation:chapter-house-shell-draw .62s cubic-bezier(.2,.74,.18,1) .04s both; }
.chapter-doorplate-house.is-building .chapter-doorplate-house-ridge { animation:chapter-house-ridge-in .42s ease-out .24s both; }
.chapter-doorplate-house.is-building .chapter-doorplate-room { animation:chapter-house-room-in .32s ease-out var(--chapter-house-room-delay) both; }
.chapter-doorplate-house.is-building .chapter-doorplate-room-shadow { animation:chapter-house-route-shadow .42s ease-out calc(var(--chapter-house-room-delay) + .1s) both; }
.chapter-doorplate-house.is-building .chapter-doorplate-room-route { animation:chapter-house-route-draw .44s cubic-bezier(.18,.76,.14,1) calc(var(--chapter-house-room-delay) + .1s) both; }
.chapter-doorplate-house.is-building .chapter-doorplate-room-nodes circle,
.chapter-doorplate-house.is-building .chapter-doorplate-room-beats line { animation:chapter-house-beat-in .18s ease-out both; }
.chapter-doorplate-house.is-building .chapter-doorplate-room-nodes circle:nth-child(1),
.chapter-doorplate-house.is-building .chapter-doorplate-room-beats line:nth-child(1) { animation-delay:calc(var(--chapter-house-room-delay) + .19s); }
.chapter-doorplate-house.is-building .chapter-doorplate-room-nodes circle:nth-child(2),
.chapter-doorplate-house.is-building .chapter-doorplate-room-beats line:nth-child(2) { animation-delay:calc(var(--chapter-house-room-delay) + .23s); }
.chapter-doorplate-house.is-building .chapter-doorplate-room-nodes circle:nth-child(3),
.chapter-doorplate-house.is-building .chapter-doorplate-room-beats line:nth-child(3) { animation-delay:calc(var(--chapter-house-room-delay) + .27s); }
.chapter-doorplate-house.is-building .chapter-doorplate-room-nodes circle:nth-child(4),
.chapter-doorplate-house.is-building .chapter-doorplate-room-beats line:nth-child(4) { animation-delay:calc(var(--chapter-house-room-delay) + .31s); }
.chapter-doorplate-house.is-building .chapter-doorplate-room-nodes circle:nth-child(5),
.chapter-doorplate-house.is-building .chapter-doorplate-room-beats line:nth-child(5) { animation-delay:calc(var(--chapter-house-room-delay) + .35s); }
.chapter-doorplate-house.is-building .chapter-house-window-pane {
  animation:chapter-house-window-warmth .28s cubic-bezier(.16,.78,.18,1) var(--chapter-house-window-delay) both;
}
.chapter-doorplate-house.is-building .chapter-house-window-mullions {
  animation:chapter-house-window-grid .24s ease-out calc(var(--chapter-house-window-delay) + .03s) both;
}
.chapter-doorplate-house.is-building .chapter-house-window-shadow[data-shadow-direction="left-to-right"] .chapter-house-window-shadow-figure {
  animation:chapter-house-window-shadow-cross-left .42s cubic-bezier(.18,.7,.16,1) .76s both;
}
.chapter-doorplate-house.is-building .chapter-house-window-shadow[data-shadow-direction="right-to-left"] .chapter-house-window-shadow-figure {
  animation:chapter-house-window-shadow-cross-right .42s cubic-bezier(.18,.7,.16,1) .76s both;
}
.chapter-doorplate-house.is-building .chapter-house-window-shadow[data-shadow-ready="true"] .chapter-house-window-shadow-curtain {
  animation:chapter-house-window-shadow-curtain .42s ease-out .76s both;
}
.chapter-doorplate-house.is-building .chapter-house-window-shadow[data-shadow-facing="toward-right"] .chapter-house-window-shadow-head {
  animation:chapter-house-window-shadow-look-right .18s cubic-bezier(.2,.72,.2,1) .98s both;
}
.chapter-doorplate-house.is-building .chapter-house-window-shadow[data-shadow-facing="toward-left"] .chapter-house-window-shadow-head {
  animation:chapter-house-window-shadow-look-left .18s cubic-bezier(.2,.72,.2,1) .98s both;
}
.chapter-doorplate-house.is-building .chapter-house-hearth { animation:chapter-house-hearth-in .2s ease-out .96s both; }
.chapter-doorplate-house.is-building .chapter-house-door-beam { animation:chapter-house-door-beam .2s ease-out .96s both; }
.chapter-doorplate-house.is-building .chapter-house-door-slit { animation:chapter-house-door-slit .18s ease-out .94s both; }
.chapter-doorplate-house.is-building .chapter-house-trace-line { animation:chapter-house-trace-draw .17s ease-out .99s both; }
.chapter-doorplate-house.is-building .chapter-house-trace-node:first-of-type { animation:chapter-house-trace-node .12s ease-out 1.04s both; }
.chapter-doorplate-house.is-building .chapter-house-trace-node:nth-of-type(2) { animation:chapter-house-trace-node .12s ease-out 1.09s both; }
.chapter-doorplate-house.is-building .chapter-doorplate-house-key { animation:chapter-house-key-in .3s cubic-bezier(.18,.8,.2,1.3) .76s both; }
.chapter-doorplate-house.is-building > small { animation:chapter-house-code-in .28s ease-out .8s both; }
.chapter-doorplate-house.is-reduced { opacity:1; }
.chapter-doorplate-house.is-reduced .chapter-doorplate-house-shell-shadow { opacity:.34; }
.chapter-doorplate-house.is-reduced .chapter-doorplate-house-shell { opacity:.92;stroke-dashoffset:0; }
.chapter-doorplate-house.is-reduced .chapter-doorplate-house-ridge { opacity:.5; }
.chapter-doorplate-house.is-reduced .chapter-doorplate-room { opacity:1; }
.chapter-doorplate-house.is-reduced .chapter-doorplate-room-shadow { opacity:.26;stroke-dashoffset:0; }
.chapter-doorplate-house.is-reduced .chapter-doorplate-room-route { opacity:.88;stroke-dashoffset:0; }
.chapter-doorplate-house.is-reduced .chapter-doorplate-room-nodes circle { opacity:.9; }
.chapter-doorplate-house.is-reduced .chapter-doorplate-room-beats line { opacity:.58; }
.chapter-doorplate-house.is-reduced .chapter-house-window-pane { opacity:.94;fill-opacity:.23;filter:drop-shadow(0 0 2px currentColor); }
.chapter-doorplate-house.is-reduced .chapter-house-window-mullions { opacity:.25; }
.chapter-doorplate-house.is-reduced .chapter-house-window-shadow[data-shadow-ready="true"] .chapter-house-window-shadow-figure { opacity:.68;transform:translateX(0);animation:none; }
.chapter-doorplate-house.is-reduced .chapter-house-window-shadow[data-shadow-ready="true"] .chapter-house-window-shadow-curtain { opacity:.14;animation:none; }
.chapter-doorplate-house.is-reduced .chapter-house-window-shadow[data-shadow-facing="toward-right"] .chapter-house-window-shadow-head { transform:translateX(.45px) rotate(11deg);animation:none; }
.chapter-doorplate-house.is-reduced .chapter-house-window-shadow[data-shadow-facing="toward-left"] .chapter-house-window-shadow-head { transform:translateX(-.45px) rotate(-11deg);animation:none; }
.chapter-doorplate-house.is-reduced .chapter-house-hearth { opacity:1; }
.chapter-doorplate-house.is-reduced .chapter-house-door-beam { opacity:.48; }
.chapter-doorplate-house.is-reduced .chapter-house-door-slit { opacity:.96; }
.chapter-doorplate-house.is-reduced .chapter-house-trace-line { opacity:.92;stroke-dashoffset:0; }
.chapter-doorplate-house.is-reduced .chapter-house-trace-node { opacity:.9; }
.chapter-doorplate-house.is-reduced .chapter-doorplate-house-key { opacity:.9; }
.chapter-doorplate-house.is-reduced > small { opacity:.72; }

@keyframes chapter-house-layer-in {
  0% { opacity:0;transform:scale(.965); }
  12%,100% { opacity:1;transform:scale(1); }
}
@keyframes chapter-house-glass-sweep {
  0% { opacity:0;transform:translateX(-28%) rotate(-8deg); }
  35% { opacity:.95; }
  100% { opacity:0;transform:translateX(34%) rotate(-8deg); }
}
@keyframes chapter-house-shell-glow {
  0% { opacity:0; }
  45% { opacity:.7; }
  100% { opacity:.3; }
}
@keyframes chapter-house-shell-draw {
  0% { opacity:0;stroke-dashoffset:390; }
  100% { opacity:.95;stroke-dashoffset:0; }
}
@keyframes chapter-house-ridge-in { from { opacity:0; } to { opacity:.58; } }
@keyframes chapter-house-room-in {
  0% { opacity:0;filter:blur(2px); }
  100% { opacity:1;filter:blur(0); }
}
@keyframes chapter-house-route-shadow {
  from { opacity:0;stroke-dashoffset:var(--chapter-house-route-length); }
  to { opacity:.28;stroke-dashoffset:0; }
}
@keyframes chapter-house-route-draw {
  from { opacity:.18;stroke-dashoffset:var(--chapter-house-route-length); }
  to { opacity:.9;stroke-dashoffset:0; }
}
@keyframes chapter-house-beat-in {
  from { opacity:0; }
  to { opacity:.82; }
}
@keyframes chapter-house-window-warmth {
  0% { opacity:.46;fill-opacity:.018;filter:none; }
  48% { opacity:1;fill-opacity:.36;filter:drop-shadow(0 0 3.2px currentColor); }
  100% { opacity:.94;fill-opacity:.23;filter:drop-shadow(0 0 1.8px currentColor); }
}
@keyframes chapter-house-window-grid {
  from { opacity:.08; }
  to { opacity:.28; }
}
@keyframes chapter-house-window-shadow-cross-left {
  0% { opacity:0;transform:translateX(-68%) scaleX(.98); }
  24% { opacity:.28; }
  62% { opacity:.82;transform:translateX(-2%) scaleX(1); }
  100% { opacity:.7;transform:translateX(6%) scaleX(1); }
}
@keyframes chapter-house-window-shadow-cross-right {
  0% { opacity:0;transform:translateX(68%) scaleX(.98); }
  24% { opacity:.28; }
  62% { opacity:.82;transform:translateX(2%) scaleX(1); }
  100% { opacity:.7;transform:translateX(-6%) scaleX(1); }
}
@keyframes chapter-house-window-shadow-curtain {
  0% { opacity:0; }
  58% { opacity:.07; }
  100% { opacity:.14; }
}
@keyframes chapter-house-window-shadow-look-right {
  from { transform:translateX(0) rotate(0); }
  to { transform:translateX(.45px) rotate(11deg); }
}
@keyframes chapter-house-window-shadow-look-left {
  from { transform:translateX(0) rotate(0); }
  to { transform:translateX(-.45px) rotate(-11deg); }
}
@keyframes chapter-house-hearth-in {
  from { opacity:0; }
  to { opacity:1; }
}
@keyframes chapter-house-door-beam {
  from { opacity:0;transform:scaleY(.2);transform-origin:50% 75%; }
  to { opacity:.68;transform:scaleY(1);transform-origin:50% 75%; }
}
@keyframes chapter-house-door-slit {
  from { opacity:0;stroke-width:.3; }
  to { opacity:.98;stroke-width:1.15; }
}
@keyframes chapter-house-trace-draw {
  from { opacity:.08;stroke-dashoffset:var(--chapter-house-trace-length); }
  to { opacity:.98;stroke-dashoffset:0; }
}
@keyframes chapter-house-trace-node {
  from { opacity:0; }
  to { opacity:.92; }
}
@keyframes chapter-house-key-in {
  from { opacity:0;transform:translateY(3px); }
  to { opacity:.92;transform:translateY(0); }
}
@keyframes chapter-house-code-in {
  from { opacity:0;filter:blur(2px); }
  to { opacity:.72;filter:blur(0); }
}
.result-signature { margin:0 auto 22px;width:min(480px,100%); }
.result-signature .echo-signature-copy strong { font-size:14px; }

/* ---------- Illustrated whole-house restoration + mirror echo ---------- */
body.restoration-open { overflow:hidden; }
.restoration-replay[hidden] { display:none; }
.restoration-replay {
  --restore-glow:#d8bc8e;
  position:fixed;inset:0;z-index:100;display:grid;grid-template-rows:auto minmax(0,1fr) auto;
  gap:16px;padding:max(18px,env(safe-area-inset-top)) max(22px,env(safe-area-inset-right))
    max(18px,env(safe-area-inset-bottom)) max(22px,env(safe-area-inset-left));
  overflow:clip;background:
    radial-gradient(circle at 18% 20%,rgba(133,105,75,.2),transparent 30rem),
    radial-gradient(circle at 82% 74%,rgba(102,139,136,.15),transparent 34rem),
    linear-gradient(145deg,#09090b,#121215 48%,#080a0c);
  isolation:isolate;
}
.restoration-replay::before {
  content:"";position:absolute;inset:0;z-index:-1;pointer-events:none;
  background:linear-gradient(rgba(255,255,255,.02) 1px,transparent 1px),linear-gradient(90deg,rgba(255,255,255,.02) 1px,transparent 1px);
  background-size:52px 52px;mask-image:radial-gradient(circle at center,black,transparent 82%);
}
.restoration-grain {
  position:absolute;inset:-40%;z-index:8;pointer-events:none;opacity:.1;mix-blend-mode:soft-light;
  background-image:repeating-radial-gradient(circle at 30% 45%,rgba(255,255,255,.45) 0 1px,transparent 1px 5px);
  transform:rotate(11deg);animation:restoration-grain 8s steps(5) infinite;
}
.restoration-head,.restoration-status { position:relative;z-index:10;display:flex;align-items:center;justify-content:space-between;gap:24px; }
.restoration-head { min-height:54px;border-bottom:1px solid rgba(255,255,255,.08);padding-bottom:13px; }
.restoration-head span,.restoration-status-copy span {
  display:block;color:#b89368;font-size:9px;font-weight:750;letter-spacing:.19em;
}
.restoration-head strong { display:block;margin-top:5px;font-size:20px;letter-spacing:-.03em; }
.restoration-close {
  width:40px;height:40px;flex:0 0 auto;border:1px solid rgba(255,255,255,.11);border-radius:50%;
  background:rgba(255,255,255,.035);color:#bbb4ac;font-size:22px;cursor:pointer;transition:.2s ease;
}
.restoration-close:hover,.restoration-close:focus-visible { background:rgba(255,255,255,.1);color:#fff;transform:rotate(5deg);outline:none; }
.restoration-house {
  position:relative;z-index:2;width:min(1080px,100%);max-height:100%;aspect-ratio:1804/730;min-height:0;
  margin:auto;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));grid-template-rows:repeat(2,minmax(0,1fr));gap:11px;
}
.restoration-room {
  min-height:0;position:relative;overflow:hidden;border:1px solid rgba(255,255,255,.09);border-radius:21px;
  background-color:#151519;background-image:url("assets/generated/whole-house-rooms-2x2-v10.png");
  background-repeat:no-repeat;background-size:200% 200%;box-shadow:0 24px 56px rgba(0,0,0,.28);isolation:isolate;
  transform:scale(.988);transition:transform .8s ease,border-color .8s ease,box-shadow .8s ease;
}
.restoration-living { background-position:left top; }
.restoration-bedroom { background-position:right top; }
.restoration-kitchen { background-position:left bottom; }
.restoration-bathroom { background-position:right bottom; }
.restoration-room::before {
  content:"";position:absolute;inset:0;z-index:3;pointer-events:none;background:rgba(8,9,12,.57);
  backdrop-filter:saturate(.48) brightness(.76);transition:background .8s ease,backdrop-filter .8s ease;
}
.restoration-room::after {
  content:"";position:absolute;inset:0;z-index:4;pointer-events:none;opacity:0;
  background:linear-gradient(105deg,transparent 35%,rgba(255,237,207,.24) 50%,transparent 65%);transform:translateX(-120%);
}
.restoration-room.is-restoring { transform:scale(1);border-color:rgba(216,188,142,.34); }
.restoration-room.is-restoring::before { background:rgba(9,10,12,.12);backdrop-filter:saturate(.9) brightness(.98); }
.restoration-room.is-restoring::after { opacity:1;animation:restoration-scan .95s cubic-bezier(.2,.8,.2,1) both; }
.restoration-room.is-restored { transform:scale(1);border-color:rgba(168,210,179,.2); }
.restoration-room.is-restored::before { background:rgba(7,9,11,.08);backdrop-filter:saturate(.96) brightness(.98); }
.restoration-room.is-final {
  border-color:rgba(182,220,213,.48);box-shadow:0 24px 60px rgba(0,0,0,.34),0 0 52px rgba(126,190,188,.12);
}
.restoration-room.is-final::before { background:rgba(7,11,13,.03);backdrop-filter:saturate(1.05) brightness(1.04); }
.restoration-room-art { position:absolute;inset:0;z-index:4;overflow:hidden;perspective:700px; }
.restoration-room-art > i:not(.restore-orbit) { display:none; }
.restoration-room-art i { position:absolute;transition:transform .9s cubic-bezier(.2,.75,.2,1),opacity .7s ease,filter .7s ease,box-shadow .7s ease; }
.restoration-room-label {
  position:absolute;left:17px;right:17px;bottom:13px;z-index:6;display:grid;grid-template-columns:auto 1fr auto;align-items:center;gap:9px;
  text-shadow:0 2px 12px rgba(0,0,0,.82);
}
.restoration-room-label span {
  width:25px;height:25px;display:grid;place-items:center;border:1px solid rgba(255,255,255,.18);border-radius:50%;
  background:rgba(8,10,12,.23);color:#e1caab;font-size:8px;backdrop-filter:blur(4px);
}
.restoration-room-label strong { color:#f1ece6;font-size:14px;letter-spacing:.02em; }
.restoration-room-label small { color:#c8c0b7;font-size:9px;letter-spacing:.08em; }
.restore-orbit {
  display:block;z-index:4;left:50%;top:45%;width:110px;height:110px;border:1px solid rgba(255,226,184,.42);border-radius:50%;
  opacity:0;transform:translate(-50%,-50%) scale(.4);box-shadow:0 0 28px rgba(255,213,156,.12) inset;
}
.is-restoring .restore-orbit { opacity:.86;transform:translate(-50%,-50%) scale(1.28) rotate(145deg); }
.is-restored .restore-orbit { opacity:0;transform:translate(-50%,-50%) scale(1.65) rotate(220deg); }

.restoration-final-target {
  position:absolute;right:6%;top:7%;width:41%;height:57%;z-index:7;border:1px solid transparent;border-radius:12px;
  padding:0;background:transparent;opacity:0;pointer-events:none;cursor:pointer;touch-action:none;
  transition:opacity .35s ease,border-color .35s ease,background .35s ease,box-shadow .35s ease;
}
.restoration-final-target::before {
  content:"";position:absolute;inset:-4px;border:1px solid rgba(187,232,227,.34);border-radius:15px;opacity:.65;
  box-shadow:inset 0 0 32px rgba(165,226,219,.1),0 0 30px rgba(116,195,188,.12);animation:mirror-wait 1.45s ease-in-out infinite alternate;
}
.mirror-echo-prompt {
  position:absolute;left:50%;bottom:-5px;z-index:4;transform:translate(-50%,100%);min-width:max-content;padding:7px 10px;
  border:1px solid rgba(183,230,225,.3);border-radius:999px;background:rgba(12,18,19,.86);color:#d1f0ec;
  font-size:9px;letter-spacing:.08em;box-shadow:0 12px 28px rgba(0,0,0,.35);transition:opacity .25s ease,transform .25s ease;
}
.mirror-echo-stage {
  position:absolute;inset:5%;z-index:3;display:block;overflow:hidden;border-radius:10px;opacity:0;transform:scale(.94);
  background:
    radial-gradient(circle at 50% 50%,rgba(185,227,222,.11),transparent 58%),
    linear-gradient(rgba(190,227,223,.08),rgba(16,25,27,.22));
  box-shadow:inset 0 0 26px rgba(206,246,241,.12);transition:opacity .28s ease,transform .28s ease;
}
.mirror-echo-stage::before {
  content:"";position:absolute;left:10%;right:10%;top:50%;height:1px;
  background:linear-gradient(90deg,transparent,rgba(204,237,233,.28),transparent);
}
.mirror-echo-stage b {
  position:absolute;display:block;width:16px;height:16px;border-radius:50%;transform:translate(-50%,-50%);
  pointer-events:none;transition:left .11s linear,top .11s linear,box-shadow .2s ease,background .2s ease;
}
.mirror-echo-user {
  z-index:3;background:#f4c889;box-shadow:0 0 0 4px rgba(244,200,137,.15),0 0 22px rgba(250,190,103,.8);
}
.mirror-echo-reflection {
  z-index:2;border:1px solid rgba(199,244,240,.92);background:rgba(134,218,210,.42);
  box-shadow:0 0 0 5px rgba(130,218,210,.11),0 0 24px rgba(124,229,219,.78);
}
.mirror-echo-stage em {
  position:absolute;right:7px;bottom:6px;color:rgba(220,244,241,.76);font:700 8px/1 var(--font-ui);letter-spacing:.14em;
}
.restoration-room.is-final .restoration-final-target { opacity:1;pointer-events:auto; }
.restoration-final-target:focus-visible { outline:2px solid #b9e0db;outline-offset:3px; }
.restoration-final-target.mirror-echo-active {
  border-color:rgba(188,236,231,.34);background:rgba(36,70,72,.08);box-shadow:0 0 38px rgba(116,213,203,.22);
}
.restoration-final-target.mirror-echo-active::before { opacity:.95; }
.restoration-final-target.mirror-echo-active .mirror-echo-stage { opacity:1;transform:scale(1); }
.restoration-final-target.mirror-echo-active .mirror-echo-prompt { opacity:.84;transform:translate(-50%,94%); }
.restoration-final-target.mirror-echo-captured .mirror-echo-stage { animation:mirror-echo-capture .24s ease both; }
.restoration-final-target.is-echo-complete .mirror-echo-stage {
  opacity:1;transform:scale(1);background:radial-gradient(circle,rgba(207,245,238,.34),rgba(58,105,104,.12) 48%,transparent 72%);
}
.restoration-replay.is-sealed .restoration-final-target::before { animation:none;opacity:.18;box-shadow:none; }

.restoration-status {
  min-height:64px;width:min(1080px,100%);margin:auto;padding-top:13px;border-top:1px solid rgba(255,255,255,.08);
}
.restoration-status-copy strong { display:block;margin-top:5px;color:#d4cec6;font-size:13px;font-weight:520; }
.restoration-meter { width:min(300px,35vw);display:grid;grid-template-columns:1fr auto;align-items:center;gap:12px; }
.restoration-meter > span { height:4px;border-radius:999px;background:rgba(255,255,255,.07);overflow:hidden; }
.restoration-meter i { display:block;width:0;height:100%;border-radius:inherit;background:linear-gradient(90deg,#9d7950,#e1c395,#a8d2b3);box-shadow:0 0 16px rgba(213,190,149,.35);transition:width .65s ease; }
.restoration-meter strong { color:#c9b797;font-size:11px;font-variant-numeric:tabular-nums; }
.restoration-toast {
  position:absolute;left:50%;bottom:92px;z-index:25;max-width:min(430px,calc(100vw - 40px));padding:10px 15px;
  border:1px solid rgba(255,255,255,.12);border-radius:999px;background:rgba(13,14,16,.92);color:#d9d2c9;font-size:11px;
  text-align:center;opacity:0;transform:translate(-50%,10px);pointer-events:none;transition:.24s ease;box-shadow:0 18px 42px rgba(0,0,0,.32);
}
.restoration-toast.show { opacity:1;transform:translate(-50%,0); }
.restoration-result {
  position:absolute;inset:0;z-index:20;display:grid;place-items:center;padding:24px;
  background:radial-gradient(circle at 50% 50%,rgba(105,143,139,.18),transparent 32rem),rgba(6,7,9,.74);
  backdrop-filter:blur(13px);animation:restoration-result-in .7s ease both;
}
.restoration-result[hidden] { display:none; }
.restoration-result-card {
  width:min(640px,100%);padding:42px;border:1px solid rgba(183,222,214,.22);border-radius:30px;
  background:linear-gradient(145deg,rgba(25,29,29,.93),rgba(12,13,15,.96));box-shadow:0 44px 120px rgba(0,0,0,.58);
  text-align:center;overflow:hidden;position:relative;
}
.restoration-result-card::before { content:"";position:absolute;left:10%;right:10%;top:0;height:1px;background:linear-gradient(90deg,transparent,#b9e0d9,transparent); }
.restoration-result-card > span { color:#9ec8bf;font-size:9px;font-weight:750;letter-spacing:.19em; }
.restoration-result-card h2 { margin:17px 0 14px;font:500 clamp(28px,4vw,44px)/1.24 var(--font-display);letter-spacing:-.045em; }
.restoration-result-card p { margin:0 auto 25px;max-width:480px;color:#aaa8a3;font:400 14px/1.9 var(--font-display); }
.restoration-result-card .primary-btn { border:0; }
@keyframes restoration-scan { to { transform:translateX(120%); } }
@keyframes restoration-grain { 0%,100% { transform:translate(-1%,0) rotate(11deg); } 35% { transform:translate(1%,-1%) rotate(11deg); } 70% { transform:translate(0,1%) rotate(11deg); } }
@keyframes mirror-wait { from { filter:brightness(1.02); } to { filter:brightness(1.32); } }
@keyframes mirror-echo-capture { 50% { filter:brightness(1.7);box-shadow:inset 0 0 36px rgba(220,252,247,.42); } }
@keyframes restoration-result-in { from { opacity:0; } to { opacity:1; } }
@keyframes echo-signature-scan { 0%,48% { transform:translateX(0) skewX(-15deg);opacity:0; } 58% { opacity:1; } 82%,100% { transform:translateX(480%) skewX(-15deg);opacity:0; } }
@keyframes echo-signature-mark-in { from { opacity:0;filter:blur(7px);transform:translate(-50%,-50%) scale(.35); } to { opacity:1;filter:blur(0);transform:translate(-50%,-50%) scale(1); } }
@keyframes echo-seal-sweep {
  0% { transform:translateX(0) skewX(-15deg);opacity:0; }
  22% { opacity:1; }
  78%,100% { transform:translateX(480%) skewX(-15deg);opacity:0; }
}
@keyframes echo-seal-complete {
  0%,100% { transform:translateY(0) scale(1); }
  38% { transform:translateY(-2px) scale(1.008);box-shadow:0 24px 70px rgba(0,0,0,.35),0 0 48px rgba(164,225,214,.2),inset 0 0 24px rgba(224,188,133,.07); }
}
@keyframes echo-seal-code {
  0% { letter-spacing:.15em; }
  42% { letter-spacing:.22em; }
  100% { letter-spacing:.15em; }
}
@keyframes chapter-card-warm {
  0% { transform:translateY(0);filter:brightness(1); }
  45% { transform:translateY(-4px);filter:brightness(1.18); }
  100% { transform:translateY(-2px);filter:brightness(1.07); }
}
@keyframes chapter-card-cool {
  0% { transform:translateY(0);filter:brightness(1); }
  45% { transform:translateY(-4px);filter:brightness(1.16); }
  100% { transform:translateY(-2px);filter:brightness(1.06); }
}
@keyframes chapter-card-wash {
  from { opacity:0;transform:translateX(-16%); }
  48% { opacity:1; }
  to { opacity:.72;transform:translateX(0); }
}
@keyframes chapter-card-resolve {
  0%,100% { transform:translateY(-2px) scale(1); }
  44% { transform:translateY(-3px) scale(1.012);box-shadow:0 0 34px rgba(184,224,215,.22); }
}
@keyframes chapter-node-resolve {
  0%,100% { stroke-width:1.5;filter:brightness(1); }
  45% { stroke-width:5;filter:brightness(1.8); }
}
@keyframes memory-window-reveal-warm {
  0% { filter:grayscale(.26) saturate(.7) brightness(var(--memory-window-base-brightness)) contrast(1.1);opacity:.8; }
  38%,68% { filter:grayscale(0) saturate(1.06) brightness(.96) contrast(1.06) sepia(.08);opacity:1; }
  100% { filter:grayscale(.18) saturate(.76) brightness(.62) contrast(1.08);opacity:.84; }
}
@keyframes memory-window-reveal-cool {
  0% { filter:grayscale(.26) saturate(.7) brightness(var(--memory-window-base-brightness)) contrast(1.1);opacity:.8; }
  38%,68% { filter:grayscale(0) saturate(.94) brightness(.92) contrast(1.08) hue-rotate(5deg);opacity:1; }
  100% { filter:grayscale(.18) saturate(.75) brightness(.61) contrast(1.08);opacity:.84; }
}
@keyframes memory-depth-awaken-back {
  0%,100% { transform:translate3d(0,0,0) scale(1.025); }
  48%,68% { transform:translate3d(-1.2px,-.7px,0) scale(1.055); }
}
@keyframes memory-depth-awaken-mid {
  0%,100% { transform:translate3d(0,0,0) scale(1.025); }
  48%,68% { transform:translate3d(2.3px,-1px,0) scale(1.065); }
}
@keyframes memory-depth-awaken-front {
  0%,100% { transform:translate3d(0,0,0) scale(1.025); }
  48%,68% { transform:translate3d(4.2px,1.5px,0) scale(1.075); }
}
@keyframes memory-light-awaken-warm {
  0%,100% { opacity:.08;transform:translate3d(-50%,-50%,0) scale(.72); }
  38%,68% { opacity:.82;transform:translate3d(-50%,-50%,0) scale(1.16); }
}
@keyframes memory-light-awaken-cool {
  0%,100% { opacity:.07;transform:translate3d(-50%,-50%,0) scale(.72); }
  38%,68% { opacity:.7;transform:translate3d(-50%,-50%,0) scale(1.08); }
}
@keyframes memory-window-scan {
  0% { top:-24%;opacity:0; }
  16% { opacity:.8; }
  72% { opacity:.38; }
  100% { top:108%;opacity:0; }
}
@keyframes memory-window-archive {
  0%,100% { filter:grayscale(.18) saturate(.72) brightness(.55) contrast(1.1);opacity:.78; }
  44% { filter:grayscale(0) saturate(1.02) brightness(.9) contrast(1.05);opacity:1; }
}
@keyframes memory-depth-archive {
  0%,100% { transform:translate3d(0,0,0) scale(1.025); }
  44% { transform:translate3d(0,-1.4px,0) scale(1.06); }
}
@keyframes memory-light-archive {
  0%,100% { opacity:.08;transform:translate3d(-50%,-50%,0) scale(.72); }
  44% { opacity:.68;transform:translate3d(-50%,-50%,0) scale(1.06); }
}
@keyframes memory-life-leaf {
  0%,100% { transform:translate3d(0,0,0) rotate(-.55deg); }
  48% { transform:translate3d(1.25px,-.35px,0) rotate(1.25deg); }
  72% { transform:translate3d(.45px,.15px,0) rotate(.2deg); }
}
@keyframes memory-life-curtain {
  0%,100% { transform:translate3d(0,0,0) skewX(-.3deg); }
  52% { transform:translate3d(-1.55px,.2px,0) skewX(1deg); }
  76% { transform:translate3d(-.55px,0,0) skewX(.2deg); }
}
@keyframes memory-life-steam {
  0% { transform:translate3d(0,1.2px,0) scale(.96);filter:blur(.75px); }
  48% { transform:translate3d(1.15px,-1px,0) scale(1.025);filter:blur(.55px); }
  100% { transform:translate3d(-.45px,-2px,0) scale(1.04);filter:blur(.9px); }
}
@keyframes memory-life-mist {
  0%,100% { transform:translate3d(-.45px,.2px,0) scale(.99);filter:blur(2.2px); }
  48% { transform:translate3d(1.35px,-.35px,0) scale(1.015);filter:blur(2.7px); }
  74% { transform:translate3d(.35px,.2px,0) scale(1.005);filter:blur(2.35px); }
}
@keyframes memory-doorplate-imprint {
  0% { opacity:0;transform:translate3d(0,-3px,0) scale(.92);filter:brightness(.76); }
  10% { opacity:.96;transform:translate3d(0,0,0) scale(1);filter:brightness(1.08); }
  68% { opacity:.92;transform:translate3d(0,0,0) scale(1);filter:brightness(1); }
  84% { opacity:.66;transform:translate3d(0,0,0) scale(.995);filter:brightness(.94); }
  100% { opacity:0;transform:translate3d(0,1px,0) scale(.985);filter:brightness(.78); }
}
@keyframes memory-doorplate-frame {
  from { opacity:0;clip-path:inset(0 50% 0 50%); }
  to { opacity:.72;clip-path:inset(0 0 0 0); }
}
@keyframes memory-doorplate-sheen {
  0% { opacity:0;transform:translateX(0) skewX(-16deg); }
  24% { opacity:.78; }
  100% { opacity:0;transform:translateX(520%) skewX(-16deg); }
}
@keyframes memory-doorplate-keyline {
  from { opacity:0; }
  to { opacity:.42; }
}
@keyframes memory-doorplate-shadow {
  0% { opacity:0; }
  30%,100% { opacity:.58; }
}
@keyframes memory-doorplate-route-draw {
  0% { opacity:0;stroke-dashoffset:var(--memory-doorplate-length); }
  15% { opacity:.98; }
  100% { opacity:.94;stroke-dashoffset:0; }
}
@keyframes memory-doorplate-node-stamp {
  0% { opacity:0;transform:scale(.2); }
  62% { opacity:1;transform:scale(1.48); }
  100% { opacity:.92;transform:scale(1); }
}
@keyframes memory-doorplate-beat-stamp {
  from { opacity:0;transform:scaleY(.15); }
  to { opacity:.62;transform:scaleY(1); }
}
@keyframes memory-doorplate-code-in {
  from { opacity:0;letter-spacing:.22em;filter:blur(2px); }
  to { opacity:.68;letter-spacing:.12em;filter:blur(0); }
}
@keyframes memory-return-card-afterglow {
  0% {
    transform:translateY(-1px) scale(1.006);
    border-color:rgba(var(--memory-light-rgb) / .86);
    box-shadow:0 0 0 1px rgba(var(--memory-light-rgb) / .18),0 14px 46px rgba(var(--memory-light-rgb) / .24);
  }
  46% {
    transform:translateY(-2px) scale(1.003);
    border-color:rgba(var(--memory-light-rgb) / .64);
    box-shadow:0 0 0 1px rgba(var(--memory-light-rgb) / .11),0 12px 36px rgba(var(--memory-light-rgb) / .16);
  }
  100% {
    transform:translateY(0) scale(1);
    border-color:rgba(214,177,123,.15);
    box-shadow:none;
  }
}
@keyframes memory-return-wash-afterglow {
  0% { opacity:1;transform:translateX(-7%); }
  52% { opacity:.58; }
  100% { opacity:0;transform:translateX(6%); }
}
@keyframes memory-return-window-afterglow {
  0% { filter:grayscale(0) saturate(1.05) brightness(.94) contrast(1.05);opacity:1; }
  52% { filter:grayscale(.08) saturate(.91) brightness(.78) contrast(1.07);opacity:.94; }
  100% { filter:grayscale(.26) saturate(.7) brightness(var(--memory-window-base-brightness)) contrast(1.1);opacity:.8; }
}
@keyframes memory-return-light-afterglow {
  0% { opacity:.76;transform:translate3d(-50%,-50%,0) scale(1.1); }
  52% { opacity:.32;transform:translate3d(-50%,-50%,0) scale(.92); }
  100% { opacity:.08;transform:translate3d(-50%,-50%,0) scale(.72); }
}
@keyframes memory-return-target-afterglow {
  0%,26% {
    border-color:rgba(var(--memory-light-rgb) / .16);
    box-shadow:none;
  }
  48% {
    border-color:rgba(var(--memory-light-rgb) / .52);
    box-shadow:0 0 0 1px rgba(var(--memory-light-rgb) / .09),0 9px 28px rgba(var(--memory-light-rgb) / .11);
  }
  100% { box-shadow:none; }
}
@keyframes memory-return-target-node {
  0%,30% { opacity:0;transform:scale(.25); }
  54% { opacity:1;transform:scale(1.18); }
  100% { opacity:0;transform:scale(.72); }
}
@keyframes memory-return-guide-source {
  0% { opacity:0;transform:scale(.4); }
  38% { opacity:1;transform:scale(1.15); }
  100% { opacity:.62;transform:scale(.82); }
}
@keyframes memory-return-guide-target {
  0% { opacity:0;transform:scale(.25); }
  55% { opacity:1;transform:scale(1.35); }
  100% { opacity:.74;transform:scale(.9); }
}
@keyframes memory-return-breath-leaf {
  0% { opacity:0;transform:translate3d(0,0,0) rotate(-.4deg); }
  26% { opacity:.7;transform:translate3d(-.35px,-.2px,0) rotate(-2.1deg); }
  52% { opacity:1;transform:translate3d(1.55px,-.7px,0) rotate(2.7deg); }
  74% { opacity:.82;transform:translate3d(.25px,.1px,0) rotate(-.8deg); }
  100% { opacity:0;transform:translate3d(0,0,0) rotate(0); }
}
@keyframes memory-return-breath-curtain {
  0% { opacity:0;transform:translate3d(0,0,0) skewX(-.2deg);filter:blur(.45px) brightness(.82); }
  34% { opacity:.42;transform:translate3d(-.7px,.1px,0) skewX(.45deg);filter:blur(.3px) brightness(1.08); }
  62% { opacity:.72;transform:translate3d(-2.15px,.2px,0) skewX(1.35deg);filter:blur(.2px) brightness(1.34); }
  100% { opacity:0;transform:translate3d(-.35px,0,0) skewX(0);filter:blur(.45px) brightness(.9); }
}
@keyframes memory-return-breath-steam {
  0% { opacity:0;transform:translate3d(-.8px,1.8px,0) scale(.92);filter:blur(.9px); }
  32% { opacity:.64;transform:translate3d(.3px,.2px,0) scale(.98);filter:blur(.55px); }
  66% { opacity:.92;transform:translate3d(2.4px,-2.1px,0) scale(1.08,.98);filter:blur(.42px); }
  100% { opacity:0;transform:translate3d(3.2px,-3.4px,0) scale(1.12,.94);filter:blur(1px); }
}
@keyframes memory-return-breath-mist {
  0% { opacity:0;transform:translate3d(-.6px,.3px,0) scale(.985);filter:blur(2.8px); }
  38% { opacity:.46;transform:translate3d(.3px,0,0) scale(1);filter:blur(2.2px); }
  66% { opacity:.72;transform:translate3d(1.1px,-.25px,0) scale(1.018);filter:blur(1.5px); }
  100% { opacity:0;transform:translate3d(1.6px,-.4px,0) scale(1.025);filter:blur(2.7px); }
}
@keyframes memory-return-breath-light {
  0% { opacity:.08;transform:translate3d(-50%,-50%,0) scale(.72); }
  46% { opacity:.62;transform:translate3d(-50%,-50%,0) scale(1.08); }
  72% { opacity:.38;transform:translate3d(-50%,-50%,0) scale(.94); }
  100% { opacity:.08;transform:translate3d(-50%,-50%,0) scale(.72); }
}
@keyframes memory-return-breath-fingerprint {
  0%,20% { opacity:0;transform:scale(.72) rotate(-7deg); }
  54% { opacity:.9;transform:scale(1.04) rotate(-2deg); }
  76% { opacity:.58;transform:scale(1) rotate(-1deg); }
  100% { opacity:0;transform:scale(.96) rotate(0); }
}
@keyframes memory-entry-catch-leaf-shadow {
  0% { opacity:.82;transform:translate3d(32%,12%,0) rotate(-17deg) scale(1.16); }
  58% { opacity:.62;transform:translate3d(4%,-1%,0) rotate(-7deg) scale(1.04); }
  100% { opacity:0;transform:translate3d(-18%,-8%,0) rotate(2deg) scale(.98); }
}
@keyframes memory-entry-catch-leaf-light {
  0% { opacity:0;transform:translateX(24%); }
  42% { opacity:.86; }
  100% { opacity:0;transform:translateX(-14%); }
}
@keyframes memory-entry-catch-leaf-stem {
  0% { opacity:.7;transform:translate3d(34%,8%,0) rotate(-19deg) scaleX(.7); }
  100% { opacity:0;transform:translate3d(-12%,-7%,0) rotate(-8deg) scaleX(1.18); }
}
@keyframes memory-entry-catch-curtain {
  0% { opacity:.76;transform:translate3d(72%,0,0) skewX(-7deg); }
  64% { opacity:.64;transform:translate3d(4%,0,0) skewX(1.5deg); }
  100% { opacity:0;transform:translate3d(-18%,0,0) skewX(0); }
}
@keyframes memory-entry-catch-moon {
  0% { opacity:0;transform:scale(.68); }
  42% { opacity:.82;transform:scale(1.08); }
  100% { opacity:0;transform:scale(1.34); }
}
@keyframes memory-entry-catch-moonlight {
  0% { opacity:0;transform:translateX(30%) rotate(3deg); }
  48% { opacity:.9; }
  100% { opacity:0;transform:translateX(-17%) rotate(-2deg); }
}
@keyframes memory-entry-catch-steam-a {
  0% { opacity:.68;transform:translate3d(-6%,18%,0) rotate(-8deg) scale(.72,.8); }
  60% { opacity:.5; }
  100% { opacity:0;transform:translate3d(8%,-28%,0) rotate(7deg) scale(1.18,1.08); }
}
@keyframes memory-entry-catch-steam-b {
  0% { opacity:.54;transform:translate3d(-4%,22%,0) rotate(7deg) scale(.68,.76); }
  100% { opacity:0;transform:translate3d(7%,-24%,0) rotate(-8deg) scale(1.14,1.06); }
}
@keyframes memory-entry-catch-steam-c {
  0% { opacity:.46;transform:translate3d(-3%,26%,0) rotate(-4deg) scale(.64,.72); }
  100% { opacity:0;transform:translate3d(5%,-20%,0) rotate(10deg) scale(1.1,1.04); }
}
@keyframes memory-entry-catch-mist {
  0% { opacity:.76;transform:translate3d(12%,1%,0) scale(1.08);filter:blur(17px); }
  56% { opacity:.48; }
  100% { opacity:0;transform:translate3d(-9%,-2%,0) scale(.96);filter:blur(8px); }
}
@keyframes memory-entry-catch-fingerprint {
  0% { opacity:.82;transform:translate3d(20%,5%,0) scale(.72) rotate(-9deg); }
  56% { opacity:.62;transform:translate3d(0,0,0) scale(1.05) rotate(-2deg); }
  100% { opacity:0;transform:translate3d(-12%,-3%,0) scale(1.22) rotate(2deg); }
}
@keyframes memory-entry-catch-mist-wipe {
  0% { opacity:0;transform:translateX(32%); }
  38% { opacity:.8; }
  100% { opacity:0;transform:translateX(-22%); }
}

@media (max-width:760px) {
  .restoration-replay { gap:10px;padding-left:12px;padding-right:12px; }
  .restoration-house { gap:7px; }
  .restoration-room { border-radius:15px; }
  .restoration-room-label { left:10px;right:10px;bottom:9px;gap:6px; }
  .restoration-room-label small { display:none; }
  .restoration-head strong { font-size:16px; }
  .restoration-status { gap:12px; }
  .restoration-status-copy strong { max-width:54vw;font-size:11px; }
  .restoration-meter { width:35vw; }
  .restoration-final-target { right:4%;width:44%; }
  .mirror-echo-stage b { width:13px;height:13px; }
  .echo-signature-cover { grid-template-columns:minmax(130px,42%) minmax(0,1fr);gap:11px; }
}
@media (max-height:520px) and (orientation:landscape) {
  .restoration-replay { grid-template-rows:42px minmax(0,1fr) 48px;gap:7px;padding-top:max(7px,env(safe-area-inset-top));padding-bottom:max(7px,env(safe-area-inset-bottom)); }
  .restoration-head { min-height:42px;padding-bottom:6px; }
  .restoration-head span { font-size:7px; }
  .restoration-head strong { margin-top:2px;font-size:13px; }
  .restoration-close { width:32px;height:32px;font-size:18px; }
  .restoration-house { width:100%;height:100%;aspect-ratio:auto;grid-template-columns:repeat(2,minmax(0,1fr));grid-template-rows:repeat(2,minmax(0,1fr));gap:7px; }
  .restoration-room { border-radius:13px; }
  .restoration-room-label { left:8px;right:8px;bottom:6px; }
  .restoration-room-label span { width:20px;height:20px;font-size:7px; }
  .restoration-room-label strong { font-size:11px; }
  .restoration-status { min-height:48px;padding-top:6px; }
  .restoration-status-copy span { font-size:7px; }
  .restoration-status-copy strong { margin-top:2px;font-size:10px; }
  .restoration-toast { bottom:58px; }
  .restoration-result-card { width:min(620px,100%);padding:24px; }
  .restoration-result-card h2 { margin:9px 0 7px;font-size:25px; }
  .restoration-result-card p { margin-bottom:8px;font-size:11px;line-height:1.55; }
  .result-signature { grid-template-columns:132px minmax(0,1fr);gap:9px;margin:0 auto 10px;padding:7px; }
  .result-signature .echo-signature-art { height:54px;border-radius:9px; }
  .result-signature .echo-signature-copy { gap:2px; }
  .result-signature .echo-signature-copy small { font-size:6px; }
  .result-signature .echo-signature-copy strong { font-size:10px; }
  .result-signature .echo-signature-copy em { padding:3px 5px;font-size:7px; }
  .result-signature .echo-signature-mark { width:17px;height:17px; }
  .result-signature .echo-signature-mark::before { inset:-6px; }
  .result-signature .echo-signature-mark::after { inset:5px; }
  .restoration-result-card .primary-btn { min-height:42px; }
  .restoration-final-target { right:4%;top:5%;width:44%;height:64%; }
  .mirror-echo-prompt { bottom:4px;transform:translate(-50%,0);padding:4px 6px;font-size:7px; }
  .restoration-final-target.mirror-echo-active .mirror-echo-prompt { transform:translate(-50%,0); }
  .mirror-echo-stage em { right:4px;bottom:4px;font-size:6px; }
}
@media (prefers-reduced-motion:reduce) {
  .restoration-grain,.restoration-room.is-restoring::after,.restoration-final-target::before,.restoration-final-target.mirror-echo-captured .mirror-echo-stage,.echo-signature-art::before,.echo-signature-mark,#echo-signature-cover.is-replaying,#echo-signature-cover.is-replaying .echo-signature-art::before,#echo-signature-cover.is-replaying.replay-complete .echo-signature-copy em,.memory-card.chapter-pulse-warm,.memory-card.chapter-pulse-cool,.memory-card.chapter-pulse-resolve,.memory-card.chapter-pulse-warm::before,.memory-card.chapter-pulse-cool::before,.memory-card.chapter-pulse-warm .memory-depth-stage,.memory-card.chapter-pulse-cool .memory-depth-stage,.memory-card.chapter-pulse-resolve .memory-depth-stage,.memory-card.chapter-pulse-warm .memory-depth-back,.memory-card.chapter-pulse-warm .memory-depth-mid,.memory-card.chapter-pulse-warm .memory-depth-front,.memory-card.chapter-pulse-cool .memory-depth-back,.memory-card.chapter-pulse-cool .memory-depth-mid,.memory-card.chapter-pulse-cool .memory-depth-front,.memory-card.chapter-pulse-resolve .memory-depth-back,.memory-card.chapter-pulse-resolve .memory-depth-mid,.memory-card.chapter-pulse-resolve .memory-depth-front,.memory-card.chapter-pulse-warm .memory-window-light,.memory-card.chapter-pulse-cool .memory-window-light,.memory-card.chapter-pulse-resolve .memory-window-light,.memory-life-detail,.memory-window-scan,.chapter-pulse-layer.is-resolved .chapter-pulse-node,.memory-card.memory-return-afterglow,.memory-card.memory-return-afterglow::before,.memory-card.memory-return-afterglow .memory-depth-stage,.memory-card.memory-return-afterglow .memory-window-light,.memory-card.memory-return-guide-target,.memory-card.memory-return-guide-target::after,.memory-card.memory-return-breath-target .memory-life-detail,.memory-card.memory-return-breath-target .memory-window-light,.memory-card.memory-return-breath-target[data-memory-room="bathroom"] .memory-life-detail::after { animation:none!important; }
  .restoration-room,.restoration-room::before,.restoration-room-art i,.restoration-meter i,.mirror-echo-stage,.mirror-echo-stage b { transition-duration:.12s; }
  #echo-signature-cover,#echo-signature-cover.is-replaying .echo-signature-mark,#echo-signature-cover.is-replaying .echo-signature-link,#echo-signature-cover.is-replaying .echo-signature-copy em { transition-duration:.08s; }
  .memory-depth-stage,.memory-window-scene,.memory-depth-layer,.memory-window-light,.memory-life-detail { transition-duration:.08s; }
  .memory-window-scene,.memory-depth-mid,.memory-depth-front { transform:scale(1.025)!important; }
  .memory-window-light { transform:translate3d(-50%,-50%,0) scale(.72)!important; }
  .memory-life-detail { opacity:0!important;animation:none!important;transform:none!important; }
  .chapter-pulse-layer { display:none!important; }
  .memory-entry-transition { display:none!important; }
  .memory-return-departure { display:none!important; }
  .memory-return-dust-canvas { display:none!important; }
  .memory-return-guide { display:none!important; }
  .memory-doorplate-sigil,
  .memory-doorplate-sigil::before,
  .memory-doorplate-sigil::after,
  .memory-doorplate-sigil *,
  .memory-doorplate-sigil.is-imprinting,
  .memory-doorplate-sigil.is-imprinting * {
    animation:none!important;
    transition:none!important;
  }
  .memory-card.memory-return-afterglow,
  .memory-card.memory-return-guide-target {
    transform:none!important;
    border-color:rgba(var(--memory-light-rgb) / .62)!important;
    box-shadow:0 0 0 2px rgba(var(--memory-light-rgb) / .14)!important;
  }
  .memory-card.memory-return-afterglow::before { opacity:.28!important;transform:none!important; }
  .memory-card.memory-return-guide-target::after { opacity:.72!important;transform:scale(.82)!important; }
  .memory-card.memory-return-breath-reduced .memory-window-light {
    opacity:.26!important;
    animation:none!important;
  }
  .memory-entry-catch,
  .memory-entry-catch::before,
  .memory-entry-catch::after,
  .memory-entry-catch-detail {
    display:none!important;
    animation:none!important;
  }
}

/* ---------- Game ---------- */
.game-page { overflow:hidden; background:#151515; }
#canvas-container { position:fixed; inset:0; }
#canvas-container canvas { display:block; width:100%; height:100%; outline:none; }
.game-page::after { content:"";position:fixed;inset:0;pointer-events:none;background:linear-gradient(90deg,rgba(0,0,0,.17),transparent 20%,transparent 74%,rgba(0,0,0,.15)),linear-gradient(0deg,rgba(0,0,0,.24),transparent 28%);z-index:2; }

/* ---------- V3.9 caught echo landing ----------
   A caught shelf-breath resolves once inside the real room. This layer sits
   above the WebGL canvas but below every HUD control and never receives input. */
.memory-echo-landing {
  position:fixed;
  inset:0;
  z-index:3;
  overflow:hidden;
  pointer-events:none;
  opacity:0;
  isolation:isolate;
}
.memory-echo-landing[hidden] { display:none!important; }
.memory-echo-landing,
.memory-echo-landing * {
  pointer-events:none!important;
}
.memory-echo-landing.is-visible { opacity:1; }
.memory-echo-landing-atmosphere,
.memory-echo-landing-detail,
.memory-echo-landing-detail i {
  position:absolute;
  display:block;
  opacity:0;
}

.memory-echo-landing.is-visible[data-memory-room="living"] .memory-echo-landing-atmosphere {
  inset:0;
  background:
    radial-gradient(ellipse at 31% 33%,rgba(226,185,117,.13),transparent 26%),
    linear-gradient(96deg,rgba(200,150,84,.06),transparent 44%);
  mix-blend-mode:screen;
  animation:memory-echo-landing-ambient .6s ease-out both;
}
.memory-echo-landing.is-visible[data-memory-room="living"] .memory-echo-landing-detail {
  left:7%;
  top:3%;
  width:51%;
  height:67%;
  transform-origin:8% 92%;
  filter:blur(.7px);
  background:
    linear-gradient(67deg,transparent 0 28%,rgba(9,13,8,.29) 29% 30.2%,transparent 31%),
    linear-gradient(74deg,transparent 0 45%,rgba(10,14,9,.24) 46% 47%,transparent 48%);
  mix-blend-mode:multiply;
  animation:memory-echo-landing-leaf-shadow .6s cubic-bezier(.2,.7,.18,1) both;
}
.memory-echo-landing[data-memory-room="living"] .memory-echo-landing-detail i {
  width:17%;
  height:12%;
  border-radius:80% 18% 74% 24%;
  background:rgba(7,12,7,.34);
  box-shadow:
    8vw 4vh 0 -1.5vh rgba(8,13,8,.25),
    15vw -2vh 0 -2vh rgba(9,14,9,.22),
    22vw 7vh 0 -1vh rgba(7,12,7,.18);
}
.memory-echo-landing[data-memory-room="living"] .memory-echo-landing-detail i:nth-child(1) {
  left:18%;top:41%;transform:rotate(22deg);
}
.memory-echo-landing[data-memory-room="living"] .memory-echo-landing-detail i:nth-child(2) {
  left:34%;top:24%;transform:rotate(-17deg) scale(.82);
}
.memory-echo-landing[data-memory-room="living"] .memory-echo-landing-detail i:nth-child(3) {
  left:48%;top:49%;transform:rotate(38deg) scale(.65);
}
.memory-echo-landing.is-visible[data-memory-room="living"] .memory-echo-landing-detail i {
  opacity:1;
}

.memory-echo-landing.is-visible[data-memory-room="bedroom"] .memory-echo-landing-atmosphere {
  right:6%;
  top:6%;
  width:27%;
  height:47%;
  border-radius:50%;
  background:radial-gradient(circle,rgba(212,228,233,.13),rgba(164,190,203,.035) 45%,transparent 70%);
  mix-blend-mode:screen;
  animation:memory-echo-landing-ambient .6s ease-out both;
}
.memory-echo-landing.is-visible[data-memory-room="bedroom"] .memory-echo-landing-detail {
  left:-13%;
  right:-10%;
  bottom:-22%;
  height:72%;
  clip-path:polygon(17% 18%,82% 9%,100% 76%,0 100%);
  background:
    linear-gradient(103deg,transparent 4%,rgba(192,218,228,.025) 21%,rgba(218,234,238,.22) 49%,rgba(161,193,208,.05) 67%,transparent 83%);
  filter:blur(2px);
  mix-blend-mode:screen;
  transform-origin:50% 100%;
  animation:memory-echo-landing-moon-band .6s cubic-bezier(.22,.7,.2,1) both;
}

.memory-echo-landing.is-visible[data-memory-room="kitchen"] .memory-echo-landing-atmosphere {
  inset:0;
  background:
    radial-gradient(ellipse at 61% 58%,rgba(230,175,111,.14),transparent 19%),
    radial-gradient(ellipse at 65% 46%,rgba(239,223,202,.07),transparent 23%);
  mix-blend-mode:screen;
  animation:memory-echo-landing-ambient .6s ease-out both;
}
.memory-echo-landing.is-visible[data-memory-room="kitchen"] .memory-echo-landing-detail {
  left:48%;
  top:15%;
  width:34%;
  height:62%;
  animation:memory-echo-landing-steam-group .6s ease-out both;
}
.memory-echo-landing[data-memory-room="kitchen"] .memory-echo-landing-detail i {
  bottom:4%;
  width:17%;
  height:73%;
  border-left:clamp(5px,1vw,12px) solid rgba(235,229,219,.2);
  border-radius:58% 42% 62% 38%;
  filter:blur(3px);
  transform-origin:50% 100%;
}
.memory-echo-landing.is-visible[data-memory-room="kitchen"] .memory-echo-landing-detail i:nth-child(1) {
  left:14%;
  animation:memory-echo-landing-steam-wisp .6s cubic-bezier(.16,.7,.23,1) both;
}
.memory-echo-landing.is-visible[data-memory-room="kitchen"] .memory-echo-landing-detail i:nth-child(2) {
  left:43%;
  height:88%;
  animation:memory-echo-landing-steam-wisp .6s .05s cubic-bezier(.16,.7,.23,1) both;
}
.memory-echo-landing.is-visible[data-memory-room="kitchen"] .memory-echo-landing-detail i:nth-child(3) {
  left:70%;
  height:64%;
  animation:memory-echo-landing-steam-wisp .6s .09s cubic-bezier(.16,.7,.23,1) both;
}

.memory-echo-landing.is-visible[data-memory-room="bathroom"] .memory-echo-landing-atmosphere {
  left:43%;
  top:10%;
  width:39%;
  height:58%;
  border-radius:3% 3% 8% 8%;
  background:
    linear-gradient(102deg,rgba(219,235,234,.02),rgba(202,227,226,.18) 48%,rgba(224,239,237,.035) 70%),
    radial-gradient(ellipse at 70% 45%,rgba(224,239,237,.13),transparent 52%);
  filter:blur(2px);
  mix-blend-mode:screen;
  animation:memory-echo-landing-mirror-mist .6s ease-out both;
}
.memory-echo-landing.is-visible[data-memory-room="bathroom"] .memory-echo-landing-detail {
  left:43%;
  top:10%;
  width:39%;
  height:58%;
  border-radius:3% 3% 8% 8%;
  background:
    radial-gradient(ellipse at 69% 43%,transparent 0 7%,rgba(126,163,160,.19) 7.8% 8.8%,transparent 9.6% 12%,rgba(126,163,160,.14) 12.8% 13.7%,transparent 14.5% 17%,rgba(126,163,160,.1) 17.8% 18.7%,transparent 19.5%),
    linear-gradient(91deg,transparent,rgba(230,242,240,.19) 45%,rgba(246,250,248,.25) 50%,transparent 57%);
  filter:blur(.4px);
  mix-blend-mode:screen;
  animation:memory-echo-landing-mirror-wipe .6s cubic-bezier(.18,.72,.2,1) both;
}

@keyframes memory-echo-landing-ambient {
  0% { opacity:0; }
  25% { opacity:.78; }
  72% { opacity:.55; }
  100% { opacity:0; }
}
@keyframes memory-echo-landing-leaf-shadow {
  0% { opacity:0;transform:translate3d(-7%,5%,0) rotate(-5deg) scale(.93); }
  24% { opacity:.78; }
  70% { opacity:.42; }
  100% { opacity:0;transform:translate3d(13%,-3%,0) rotate(4deg) scale(1.04); }
}
@keyframes memory-echo-landing-moon-band {
  0% { opacity:0;transform:translate3d(-14%,7%,0) rotate(-2deg) scaleX(.84); }
  27% { opacity:.85; }
  70% { opacity:.52; }
  100% { opacity:0;transform:translate3d(12%,-2%,0) rotate(1deg) scaleX(1.08); }
}
@keyframes memory-echo-landing-steam-group {
  0%,100% { opacity:0; }
  19%,72% { opacity:1; }
}
@keyframes memory-echo-landing-steam-wisp {
  0% { opacity:0;transform:translate3d(0,11%,0) rotate(-3deg) scaleY(.64); }
  30% { opacity:.76; }
  70% { opacity:.34; }
  100% { opacity:0;transform:translate3d(16%,-18%,0) rotate(9deg) scaleY(1.06); }
}
@keyframes memory-echo-landing-mirror-mist {
  0% { opacity:.62;transform:scale(1.015); }
  40% { opacity:.48; }
  100% { opacity:0;transform:scale(.99); }
}
@keyframes memory-echo-landing-mirror-wipe {
  0% { opacity:0;clip-path:inset(0 100% 0 0); }
  30% { opacity:.9; }
  68% { opacity:.58;clip-path:inset(0 0 0 0); }
  100% { opacity:0;clip-path:inset(0 0 0 100%); }
}

@media (prefers-reduced-motion:reduce) {
  .memory-echo-landing {
    display:none!important;
    animation:none!important;
  }
  .memory-echo-landing * {
    animation:none!important;
  }
}

.ui-layer { position:fixed; inset:0; pointer-events:none; z-index:5; }
.ui-layer button, .ui-layer a, .ui-layer .interactive { pointer-events:auto; }
.topbar { position:absolute;left:22px;right:22px;top:18px;display:flex;align-items:center;justify-content:space-between;gap:18px; }
.room-id { display:flex;align-items:center;gap:12px;background:rgba(16,16,18,.68);border:1px solid rgba(255,255,255,.1);border-radius:999px;padding:8px 13px 8px 9px;backdrop-filter:blur(18px);box-shadow:0 12px 40px rgba(0,0,0,.2); }
.home-link { width:34px;height:34px;border-radius:50%;display:grid;place-items:center;text-decoration:none;background:rgba(255,255,255,.07);color:#ddd;border:1px solid rgba(255,255,255,.08);transition:.2s; }
.home-link:hover { background:rgba(255,255,255,.14); }
.room-id-copy span { display:block;color:#928d86;font-size:10px;letter-spacing:.13em; }
.room-id-copy strong { display:block;font-size:13px;margin-top:2px;letter-spacing:.02em; }
.progress-pill { display:flex;align-items:center;gap:12px;background:rgba(16,16,18,.72);border:1px solid rgba(255,255,255,.1);border-radius:999px;padding:7px 8px 7px 14px;backdrop-filter:blur(18px); }
.progress-copy { font-size:11px;color:#a9a39c; }
.progress-copy strong { color:#eee;font-size:13px;margin-left:5px; }
.journal-btn { width:36px;height:36px;border:0;border-radius:50%;background:#e8e1d8;color:#1b1918;cursor:pointer;font-weight:800;transition:.2s; }
.journal-btn:hover { transform:scale(1.05); }

#audio-toggle {
  position:fixed;right:22px;top:72px;z-index:40;width:36px;height:36px;border:1px solid rgba(255,255,255,.14);
  border-radius:50%;background:rgba(16,16,18,.72);backdrop-filter:blur(18px);color:#ead9bc;cursor:pointer;
  font-size:16px;line-height:1;box-shadow:0 12px 32px rgba(0,0,0,.24);transition:.2s;
}
#audio-toggle:hover { transform:translateY(-1px) scale(1.04);background:rgba(255,255,255,.12); }
#audio-toggle.muted { color:#8d8982;opacity:.82; }
.home-page #audio-toggle { top:auto;bottom:18px; }

.audio-settings-panel {
  position:fixed;
  right:22px;
  top:116px;
  z-index:45;
  width:min(330px,calc(100vw - 24px));
  max-height:calc(100dvh - 132px);
  overflow:auto;
  border:1px solid rgba(255,255,255,.13);
  border-radius:20px;
  background:linear-gradient(145deg,rgba(25,22,20,.96),rgba(12,12,14,.97));
  box-shadow:0 28px 80px rgba(0,0,0,.48),0 1px 0 rgba(255,255,255,.035) inset;
  backdrop-filter:blur(22px);
  opacity:0;
  visibility:hidden;
  transform:translateY(-8px) scale(.98);
  transform-origin:top right;
  transition:opacity .18s ease,transform .18s ease,visibility .18s ease;
}
.audio-settings-panel.open { opacity:1;visibility:visible;transform:none; }
.home-page .audio-settings-panel { top:auto;bottom:64px;right:18px;max-height:calc(100dvh - 82px);transform-origin:bottom right; }
.audio-settings-head { display:flex;align-items:center;justify-content:space-between;gap:12px;padding:16px 17px 13px;border-bottom:1px solid rgba(255,255,255,.07); }
.audio-settings-head span { display:block;color:#8f8880;font-size:8px;letter-spacing:.16em; }
.audio-settings-head strong { display:block;margin-top:4px;font-size:17px; }
.audio-settings-close { width:30px;height:30px;border:0;border-radius:50%;background:rgba(255,255,255,.06);color:#c4bdb5;cursor:pointer; }
.audio-settings-body { padding:11px; }
.settings-switch {
  width:100%;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:15px;
  padding:12px;
  border:1px solid transparent;
  border-radius:13px;
  background:transparent;
  text-align:left;
  cursor:pointer;
}
.settings-switch[hidden] { display:none; }
.settings-switch:hover { background:rgba(255,255,255,.045); }
.settings-switch > span:first-child { min-width:0; }
.settings-switch strong { display:block;font-size:13px; }
.settings-switch small { display:block;margin-top:3px;color:#817b74;font-size:10px;line-height:1.35; }
.settings-switch-state { min-width:48px;padding:5px 8px;border-radius:999px;background:rgba(255,255,255,.055);color:#817b74;font-size:10px;text-align:center; }
.settings-switch[aria-pressed="true"] .settings-switch-state { background:rgba(159,213,173,.11);color:#a9d5b4;box-shadow:0 0 0 1px rgba(159,213,173,.12) inset; }
.settings-help { margin:8px 4px;padding:13px;border-top:1px solid rgba(255,255,255,.065);border-bottom:1px solid rgba(255,255,255,.065); }
.settings-help[hidden] { display:none; }
.settings-help strong { font-size:12px; }
.settings-help p { margin:5px 0 0;color:#8f8982;font-size:10px;line-height:1.6; }
.settings-action { width:100%;min-height:38px;margin-top:5px;display:flex;align-items:center;justify-content:center;border:1px solid rgba(255,255,255,.08);border-radius:12px;background:rgba(255,255,255,.035);color:#c5beb6;text-decoration:none;font-size:11px;cursor:pointer; }
.settings-action[hidden] { display:none; }
.settings-action:hover { border-color:rgba(255,255,255,.16);background:rgba(255,255,255,.065); }

.clue-card { position:absolute;left:24px;bottom:24px;width:min(430px,calc(100vw - 48px));padding:18px 19px;border:1px solid rgba(255,255,255,.1);border-radius:20px;background:rgba(16,16,18,.72);backdrop-filter:blur(18px);box-shadow:0 18px 55px rgba(0,0,0,.22); }
.clue-eyebrow { display:flex;align-items:center;justify-content:space-between;gap:14px;color:#aaa49d;font-size:10px;letter-spacing:.12em;text-transform:uppercase; }
.clue-stage { color:var(--accent); }
#clue-text { margin:10px 0 0;font-size:15px;line-height:1.65;color:#eee9e2; }
.clue-actions { display:flex;gap:8px;margin-top:13px; }
.mini-btn { border:1px solid rgba(255,255,255,.1);border-radius:999px;background:rgba(255,255,255,.045);padding:8px 12px;color:#bbb5ae;font-size:11px;cursor:pointer;transition:.18s; }
.mini-btn:hover { background:rgba(255,255,255,.1);color:#fff; }
.mini-btn.accent { border-color:rgba(214,177,123,.3);color:#e4c79e;background:rgba(214,177,123,.08); }

.journal {
  position:absolute;right:18px;top:74px;bottom:18px;width:330px;border:1px solid rgba(255,255,255,.11);border-radius:24px;background:rgba(15,15,17,.9);backdrop-filter:blur(24px);box-shadow:var(--shadow);
  /* closed 要多平移 right 的安全區，否則橫向瀏海 right=59px 時面板會露出約 31px */
  transform:translateX(calc(100% + max(18px, env(safe-area-inset-right)) + 28px));transition:transform .32s cubic-bezier(.2,.8,.2,1);overflow:hidden;display:flex;flex-direction:column;
}
.journal.open { transform:translateX(0); }
.journal-head { padding:22px 22px 18px;border-bottom:1px solid var(--soft-line);display:flex;align-items:flex-start;justify-content:space-between;gap:14px; }
.journal-head span { color:#817c75;font-size:10px;letter-spacing:.14em; }
.journal-head h2 { margin:5px 0 0;font-size:21px;letter-spacing:-.03em; }
.journal-close { border:0;background:rgba(255,255,255,.06);width:30px;height:30px;border-radius:50%;cursor:pointer;color:#bbb; }
.journal-body { overflow:auto;padding:18px 22px 24px; }
.phase-title { display:flex;align-items:center;gap:10px;color:#9c958d;font-size:11px;letter-spacing:.1em;text-transform:uppercase;margin:4px 0 10px; }
.phase-title::after { content:"";height:1px;flex:1;background:var(--soft-line); }
.task-row { display:grid;grid-template-columns:20px 1fr;gap:10px;padding:9px 0;color:#c5beb6;font-size:13px;line-height:1.45; }
.task-mark { width:18px;height:18px;border-radius:50%;border:1px solid #66615c;display:grid;place-items:center;color:#131313;font-size:11px;margin-top:1px; }
.task-row.done { color:#8caa93; }
.task-row.done .task-mark { background:#a8d2b3;border-color:#a8d2b3; }
.task-row.locked { color:#66615c; }
.inventory-title { margin-top:24px;color:#9c958d;font-size:11px;letter-spacing:.1em;text-transform:uppercase; }
.inventory-list { display:flex;flex-wrap:wrap;gap:7px;margin-top:10px; }
.inventory-chip { border:1px solid rgba(214,177,123,.18);background:rgba(214,177,123,.07);color:#cfb58f;padding:6px 9px;border-radius:999px;font-size:11px; }
.empty-inventory { color:#69645f;font-size:12px;line-height:1.6; }

#tooltip { position:fixed;display:none;z-index:12;pointer-events:none;transform:translate(14px,14px);padding:8px 11px;border-radius:10px;background:rgba(13,13,15,.88);border:1px solid rgba(255,255,255,.1);box-shadow:0 8px 25px rgba(0,0,0,.25);font-size:11px;color:#d5cec6;backdrop-filter:blur(12px); }
#toast { position:fixed;left:50%;bottom:34px;z-index:30;transform:translate(-50%,22px);opacity:0;pointer-events:none;border:1px solid rgba(255,255,255,.13);border-radius:999px;background:rgba(18,18,20,.9);backdrop-filter:blur(18px);padding:12px 18px;color:#eee8e1;font-size:13px;box-shadow:0 18px 48px rgba(0,0,0,.3);transition:.28s ease; }
#toast.show { opacity:1;transform:translate(-50%,0); }
#toast.bad { color:#f0b5ae;border-color:rgba(216,141,132,.25); }

.overlay { position:fixed;inset:0;z-index:20;display:flex;align-items:center;justify-content:center;padding:22px;background:linear-gradient(90deg,rgba(7,7,8,.74),rgba(7,7,8,.45));backdrop-filter:blur(8px);transition:opacity .38s ease,visibility .38s ease; }
.overlay.hidden { opacity:0;visibility:hidden;pointer-events:none; }
.overlay-card { width:min(530px,100%);border:1px solid rgba(255,255,255,.13);border-radius:30px;background:rgba(15,15,17,.84);box-shadow:0 45px 120px rgba(0,0,0,.5);padding:36px;position:relative;overflow:hidden; }
.overlay-card::before { content:"";position:absolute;left:0;top:0;width:100%;height:1px;background:linear-gradient(90deg,transparent,var(--accent),transparent);opacity:.65; }
.overlay-step { color:var(--accent);font-size:11px;letter-spacing:.17em;font-weight:700; }
.overlay-card h1, .overlay-card h2 { margin:16px 0 14px;letter-spacing:-.045em;line-height:1.1; }
.overlay-card h1 { font-size:42px; }.overlay-card h2 { font-size:32px; }
.overlay-card p { margin:0;color:#aaa39b;line-height:1.8;font-size:15px; }
.quick-guide { display:flex;flex-wrap:wrap;gap:8px;margin-top:17px; }
.quick-guide span { display:inline-flex;align-items:center;gap:7px;padding:7px 10px;border:1px solid rgba(255,255,255,.09);border-radius:999px;background:rgba(255,255,255,.035);color:#aaa39b;font-size:11px; }
.quick-guide b { width:18px;height:18px;display:grid;place-items:center;border-radius:50%;background:rgba(214,177,123,.12);color:#dfbe8f;font-size:10px; }
.overlay-actions { display:flex;gap:10px;flex-wrap:wrap;margin-top:26px; }
.overlay .primary-btn { border:0; }
.overlay .ghost-btn { min-height:48px; }
.memory-quote { margin-top:20px;padding:18px 20px;border-left:1px solid var(--accent);background:rgba(255,255,255,.025);color:#d8d1c8;font-family:var(--font-display);line-height:1.9;font-size:16px; }
.anomaly-entry-btn { border-color:color-mix(in srgb,var(--accent) 45%,transparent);color:#ead6b7; }
.anomaly-entry-btn::before { content:"◌";margin-right:7px;color:var(--accent); }
.anomaly-mode .clue-card { border-color:color-mix(in srgb,var(--accent) 34%,rgba(255,255,255,.08));box-shadow:0 18px 55px rgba(0,0,0,.28),0 0 34px color-mix(in srgb,var(--accent) 10%,transparent); }
.anomaly-mode .clue-stage { color:#f0d5ac;background:color-mix(in srgb,var(--accent) 17%,rgba(255,255,255,.025)); }
.anomaly-mode .progress-copy strong { color:#f0d5ac; }
.anomaly-journal-progress { margin-top:10px;padding:13px;border:1px solid rgba(255,255,255,.07);border-radius:13px;color:#d9c7aa;font-size:20px;font-variant-numeric:tabular-nums;background:rgba(255,255,255,.025); }
.inventory-chip.anomaly-chip { border-color:rgba(214,177,123,.2);background:rgba(214,177,123,.07);color:#d7c2a2; }
.anomaly-result-card { background:radial-gradient(circle at 82% 10%,color-mix(in srgb,var(--accent) 15%,transparent),transparent 42%),rgba(15,15,17,.9); }
.anomaly-result-card::after { content:"";position:absolute;inset:0;pointer-events:none;background:linear-gradient(115deg,transparent 35%,rgba(255,255,255,.025) 50%,transparent 65%);transform:translateX(-100%);animation:anomaly-card-scan 1.4s ease .1s both; }
.anomaly-room-meter { margin-top:18px;display:flex;align-items:center;gap:12px; }
.anomaly-room-meter > span { flex:1;height:5px;border-radius:999px;background:rgba(255,255,255,.07);overflow:hidden; }
.anomaly-room-meter i { display:block;width:0;height:100%;border-radius:inherit;background:linear-gradient(90deg,var(--accent),#f1ddbd);transition:width .5s ease; }
.anomaly-room-meter strong { color:#d8c5a8;font-size:12px;font-variant-numeric:tabular-nums; }
.anomaly-found #canvas-container { animation:anomaly-found-bloom .9s ease both; }
@keyframes anomaly-found-bloom {
  0%,100% { filter:none; }
  38% { filter:brightness(1.11) saturate(1.08); }
}
@keyframes anomaly-card-scan {
  to { transform:translateX(100%); }
}

.memory-replay-layer {
  --memory-replay-progress:0;
  position:fixed;
  inset:0;
  z-index:36;
  opacity:0;
  visibility:hidden;
  pointer-events:none;
  transition:opacity .34s ease,visibility .34s ease;
}
.memory-replay .memory-replay-layer { opacity:1;visibility:visible; }
.memory-replay-wash {
  position:absolute;
  inset:0;
  opacity:.82;
  background:
    radial-gradient(circle at 52% 48%,rgba(255,231,194,.055),transparent 28%),
    linear-gradient(90deg,rgba(4,5,7,.3),transparent 24%,transparent 75%,rgba(4,5,7,.36));
  box-shadow:inset 0 0 110px rgba(2,3,5,.5);
}
.memory-replay-route-label {
  position:absolute;
  left:50%;
  bottom:max(40px,calc(env(safe-area-inset-bottom) + 32px));
  display:grid;
  justify-items:center;
  gap:2px;
  min-width:190px;
  padding:8px 18px 9px;
  transform:translate(-50%,8px);
  border-top:1px solid color-mix(in srgb,var(--accent) 35%,transparent);
  color:rgba(255,244,226,.88);
  text-align:center;
  text-shadow:0 2px 16px rgba(0,0,0,.72);
  opacity:0;
  animation:memory-route-label-in .72s cubic-bezier(.2,.75,.25,1) .18s both;
}
.memory-replay-route-label small {
  color:color-mix(in srgb,var(--accent) 80%,white);
  font:600 8px/1.3 var(--font-mono);
  letter-spacing:.18em;
}
.memory-replay-route-label strong {
  font:600 clamp(15px,1.7vw,20px)/1.25 var(--font-display);
  letter-spacing:.16em;
}
.memory-replay-route-label span {
  color:rgba(239,229,213,.54);
  font:500 9px/1.4 var(--font-ui);
  letter-spacing:.09em;
}
.memory-replay-progress {
  position:absolute;
  left:50%;
  bottom:max(18px,env(safe-area-inset-bottom));
  width:min(260px,32vw);
  height:2px;
  overflow:hidden;
  transform:translateX(-50%);
  border-radius:999px;
  background:rgba(255,255,255,.08);
}
.memory-replay-progress i {
  display:block;
  width:calc(var(--memory-replay-progress) * 100%);
  height:100%;
  border-radius:inherit;
  background:linear-gradient(90deg,rgba(214,177,123,.22),var(--accent),rgba(255,239,212,.9));
  box-shadow:0 0 14px rgba(255,224,181,.42);
}
.memory-replay-skip {
  position:absolute;
  right:max(18px,env(safe-area-inset-right));
  top:max(18px,env(safe-area-inset-top));
  width:42px;
  height:42px;
  border:1px solid rgba(255,255,255,.12);
  border-radius:50%;
  background:rgba(10,11,13,.46);
  color:rgba(255,244,226,.78);
  font:500 23px/1 var(--font-ui);
  letter-spacing:-.14em;
  padding:0 5px 2px 0;
  cursor:pointer;
  pointer-events:auto;
  backdrop-filter:blur(12px);
  box-shadow:0 12px 35px rgba(0,0,0,.24);
  transition:transform .18s ease,background .18s ease,color .18s ease;
}
.memory-replay-skip:hover,
.memory-replay-skip:focus-visible { transform:scale(1.06);background:rgba(255,255,255,.11);color:#fff4df;outline:none; }
.memory-replay .ui-layer,
.memory-replay #audio-toggle,
.memory-replay .audio-settings-panel,
.memory-replay #toast,
.memory-replay #tooltip,
.memory-replay .overlay {
  opacity:0 !important;
  visibility:hidden !important;
  pointer-events:none !important;
}
@keyframes memory-route-label-in {
  to { opacity:1;transform:translate(-50%,0); }
}
@media (prefers-reduced-motion:reduce) {
  .memory-replay-route-label { animation:none;opacity:1;transform:translate(-50%,0); }
  .memory-replay-layer { transition-duration:.12s; }
  .anomaly-result-card::after,
  .anomaly-found #canvas-container { animation:none; }
}

.poster-mode .ui-layer, .poster-mode .overlay, .poster-mode #toast, .poster-mode #tooltip { display:none !important; }
.poster-mode::after { display:none; }

@media (max-width: 880px) {
  .hero { grid-template-columns:1fr; padding-top:52px; }
  .nav-note { display:none; }
  .memory-shelf { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .anomaly-archive { align-items:flex-start; }
}
@media (max-width:880px) and (min-width:621px) and (max-height:600px) and (orientation:landscape) {
  .memory-shelf { grid-template-columns:repeat(4,minmax(0,1fr));gap:8px; }
  .memory-card { min-height:218px;padding:8px; }
  .memory-card-copy { padding:8px 5px 5px; }
  .memory-window-label { left:7px;bottom:6px;font-size:6px; }
  .memory-window-index { right:7px;bottom:6px;font-size:6px; }
  .memory-card p { -webkit-line-clamp:2;font-size:10px;line-height:1.45; }
  .memory-card em { font-size:8px; }
}
@media (max-width: 620px) {
  .home-shell { width:min(100% - 24px,1220px); }
  .home-nav { height:70px; }
  .hero { gap:18px;min-height:auto;padding:50px 0 42px; }
  .hero-copy { font-size:16px; }
  .chapter-meter { width:100%;text-align:left; }
  .memory-shelf { grid-template-columns:1fr; }
  .memory-card { min-height:238px; }
  .anomaly-archive { flex-direction:column; }
  .anomaly-archive-meter { width:100%;min-width:0; }
  .topbar { left:12px;right:12px;top:10px; }
  #audio-toggle { right:12px;top:56px; }
  .audio-settings-panel { right:10px;top:96px;width:min(320px,calc(100vw - 20px));max-height:calc(100dvh - 106px); }
  .home-page .audio-settings-panel { right:10px;top:auto;bottom:58px;max-height:calc(100dvh - 72px); }
  .home-page #audio-toggle { top:auto;bottom:14px; }
  .room-id-copy span { display:none; }
  .progress-copy { display:none; }
  .clue-card { left:12px;bottom:12px;width:calc(100vw - 24px);padding:14px 15px; }
  #clue-text { font-size:13px; }
  .journal { right:10px;top:62px;bottom:10px;width:calc(100vw - 20px); }
  .overlay-card { padding:26px 22px;border-radius:24px; }
  .overlay-card h1 { font-size:34px; }.overlay-card h2 { font-size:28px; }
}

@media (max-height: 480px) and (orientation: landscape) {
  .overlay { padding:12px; }
  .overlay-card { width:min(590px,100%);max-height:calc(100dvh - 24px);overflow:auto;padding:18px 22px;border-radius:20px; }
  .overlay-card h1, .overlay-card h2 { margin:9px 0 8px; }
  .overlay-card h1 { font-size:30px; }
  .overlay-card h2 { font-size:25px; }
  .overlay-card p { font-size:12px;line-height:1.55; }
  .quick-guide { margin-top:10px; }
  .quick-guide span { padding:5px 8px; }
  .overlay-actions { margin-top:13px; }
  .overlay .primary-btn, .overlay .ghost-btn { min-height:42px;padding:0 18px; }
}


/* V2.1 boot-state feedback */
.primary-btn:disabled {
  opacity: .58;
  cursor: wait;
  filter: saturate(.55);
  box-shadow: none;
}
.overlay-card.boot-error {
  border-color: rgba(226, 145, 112, .42);
  box-shadow: 0 30px 90px rgba(0, 0, 0, .58), 0 0 0 1px rgba(226, 145, 112, .08) inset;
}
.overlay-card.boot-error .overlay-step {
  color: #e7a783;
}

/* ---------- V2.2 clarity + visual polish ---------- */
.game-page::after {
  background:
    radial-gradient(circle at 48% 35%, transparent 0 44%, rgba(8,7,7,.09) 78%, rgba(6,5,5,.22) 100%),
    linear-gradient(90deg,rgba(0,0,0,.12),transparent 20%,transparent 76%,rgba(0,0,0,.12)),
    linear-gradient(0deg,rgba(0,0,0,.18),transparent 30%);
}

.room-id,
.progress-pill,
.clue-card,
.journal {
  border-color: rgba(255,255,255,.13);
  box-shadow: 0 18px 55px rgba(0,0,0,.2), 0 1px 0 rgba(255,255,255,.035) inset;
}

.clue-card {
  overflow: hidden;
  background: linear-gradient(145deg,rgba(29,25,22,.82),rgba(14,14,16,.77));
}
.clue-card::before {
  content:"";
  position:absolute;
  left:19px;
  right:19px;
  top:0;
  height:1px;
  background:linear-gradient(90deg,transparent,var(--accent),transparent);
  opacity:.58;
}
.clue-stage::before {
  content:"";
  display:inline-block;
  width:5px;
  height:5px;
  border-radius:50%;
  margin-right:7px;
  background:var(--accent);
  box-shadow:0 0 10px var(--accent);
  vertical-align:1px;
}

.task-row {
  position:relative;
  align-items:start;
  transition:background .2s ease,color .2s ease,transform .2s ease;
}
.task-name {
  min-width:0;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
}
.task-row.current {
  margin:2px -9px;
  padding:10px 9px;
  border-radius:13px;
  color:#f2e9de;
  background:linear-gradient(90deg,rgba(214,177,123,.14),rgba(214,177,123,.035));
  box-shadow:0 0 0 1px rgba(214,177,123,.11) inset;
}
.task-row.current .task-mark {
  border-color:var(--accent);
  box-shadow:0 0 0 4px rgba(214,177,123,.08),0 0 14px rgba(214,177,123,.18);
}
.task-now {
  flex:0 0 auto;
  padding:3px 7px;
  border-radius:999px;
  color:#e6c696;
  background:rgba(214,177,123,.1);
  border:1px solid rgba(214,177,123,.18);
  font-size:9px;
  line-height:1.2;
  letter-spacing:.08em;
}
.task-row.done .task-now { display:none; }

.mini-btn.accent {
  box-shadow:0 0 0 1px rgba(214,177,123,.04) inset;
}
.mini-btn.accent:hover {
  background:rgba(214,177,123,.14);
  border-color:rgba(214,177,123,.46);
  transform:translateY(-1px);
}

.journal-body::-webkit-scrollbar { width:8px; }
.journal-body::-webkit-scrollbar-track { background:transparent; }
.journal-body::-webkit-scrollbar-thumb { background:rgba(255,255,255,.09);border-radius:99px;border:2px solid transparent;background-clip:padding-box; }

@media (max-width: 620px) {
  .task-now { display:none; }
  .clue-card::before { left:15px;right:15px; }
}

/* ---------- Gameplay HUD footprint contract ----------
   The default clue HUD is a compact, single-glance chip. Full clue copy and
   text actions remain available through the disclosure button instead of
   covering the room during normal play. */
.clue-card {
  left: max(12px, env(safe-area-inset-left));
  bottom: max(12px, env(safe-area-inset-bottom));
  width: min(292px, 72vw, calc(100vw - 24px));
  min-height: 46px;
  height: clamp(46px, 6.2vh, 52px);
  padding: 7px 7px 7px 12px;
  display: flex;
  align-items: center;
  gap: 7px;
  border-radius: 16px;
  transition: width .22s ease, height .22s ease, padding .22s ease, border-radius .22s ease;
}
.clue-copy { min-width: 0; flex: 1 1 auto; }
.clue-eyebrow { gap: 8px; font-size: 8px; letter-spacing: .1em; white-space: nowrap; }
.clue-stage { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#clue-text {
  margin: 3px 0 0;
  font-size: 11px;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.clue-actions { flex: 0 0 auto; align-items: center; gap: 4px; margin: 0; }
.clue-toggle,
.clue-card:not(.expanded) .mini-btn {
  width: 28px;
  height: 28px;
  padding: 0;
  display: grid;
  place-items: center;
  border-radius: 50%;
}
.clue-toggle {
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.055);
  color: #d8d0c7;
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  transition: transform .22s ease, background .18s ease;
}
.clue-toggle:hover { background: rgba(255,255,255,.12); }
.clue-card:not(.expanded) .mini-btn { font-size: 0; }
.clue-card:not(.expanded) #hint-btn::before { content: "?"; font-size: 15px; line-height: 1; }
.clue-card:not(.expanded) #reset-view-btn::before { content: "↺"; font-size: 15px; line-height: 1; }
.clue-card.expanded {
  width: min(380px, calc(100vw - 24px));
  height: auto;
  min-height: 0;
  padding: 15px;
  display: block;
  border-radius: 18px;
}
.clue-card.expanded #clue-text { margin-top: 8px; font-size: 13px; line-height: 1.5; white-space: normal; }
.clue-card.expanded .clue-actions { margin-top: 11px; display: flex; flex-wrap: wrap; }
.clue-card.expanded .mini-btn { width: auto; height: auto; padding: 8px 12px; display: inline-flex; font-size: 11px; }
.clue-card.expanded .mini-btn::before { content: none !important; }
.clue-card.expanded .clue-toggle { margin-left: auto; transform: rotate(180deg); }

@media (max-width: 620px) {
  .clue-card { left: max(10px, env(safe-area-inset-left)); bottom: max(10px, env(safe-area-inset-bottom)); }
  .clue-card.expanded { width: min(380px, calc(100vw - 20px)); }
}

/* ---------- Compact HUD family ----------
   Keep the room tag, progress chip, and clue chip in one visual language:
   small safe-area-aware surfaces with one-glance information by default. */
.game-page {
  --hud-top: max(10px, env(safe-area-inset-top));
  --hud-left: max(10px, env(safe-area-inset-left));
  --hud-right: max(10px, env(safe-area-inset-right));
  --hud-surface: linear-gradient(145deg, rgba(29,25,22,.84), rgba(14,14,16,.78));
  --hud-border: rgba(255,255,255,.13);
  --hud-shadow: 0 14px 42px rgba(0,0,0,.2), 0 1px 0 rgba(255,255,255,.035) inset;
}

.topbar {
  top: var(--hud-top);
  left: var(--hud-left);
  right: var(--hud-right);
  gap: 8px;
}

.room-id.hud-chip,
.progress-pill.hud-chip,
.clue-card.hud-chip {
  border-color: var(--hud-border);
  background: var(--hud-surface);
  box-shadow: var(--hud-shadow);
}

.room-id.hud-chip,
.progress-pill.hud-chip {
  box-sizing: border-box;
  height: clamp(40px, 5.6vh, 44px);
  min-height: 40px;
  border-radius: 16px;
}

.room-id.hud-chip {
  gap: 8px;
  padding: 5px 10px 5px 6px;
}

.room-id.hud-chip .home-link {
  width: 30px;
  height: 30px;
}

.room-id.hud-chip .room-id-copy span {
  font-size: 8px;
  letter-spacing: .12em;
}

.room-id.hud-chip .room-id-copy strong {
  margin-top: 1px;
  font-size: 12px;
  line-height: 1.1;
}

.progress-pill.hud-chip {
  gap: 8px;
  padding: 5px 6px 5px 10px;
}

.progress-pill.hud-chip .progress-copy {
  font-size: 10px;
  line-height: 1;
}

.progress-pill.hud-chip .progress-copy strong {
  margin-left: 3px;
  font-size: 12px;
}

.progress-pill.hud-chip .journal-btn {
  width: 30px;
  height: 30px;
  font-size: 14px;
}

.game-page #audio-toggle {
  top: calc(var(--hud-top) + 48px);
  right: var(--hud-right);
  width: 34px;
  height: 34px;
  font-size: 15px;
}

@media (max-width: 620px) {
  .topbar { gap: 6px; }
  .room-id.hud-chip { max-width: 46vw; height: 40px; min-height: 40px; }
  .room-id.hud-chip .home-link { width: 28px; height: 28px; }
  .room-id.hud-chip .room-id-copy span { display: block; font-size: 7px; }
  .room-id.hud-chip .room-id-copy strong { font-size: 11px; }
  .progress-pill.hud-chip { padding-left: 8px; height: 40px; min-height: 40px; }
  .progress-pill.hud-chip .progress-copy { display: block; font-size: 0; }
  .progress-pill.hud-chip .progress-copy strong { margin-left: 0; font-size: 11px; }
  .progress-pill.hud-chip .journal-btn { width: 28px; height: 28px; }
  .clue-card:not(.expanded) { width: min(248px, 67vw, calc(100vw - 20px)); height: 44px; min-height: 44px; }
  .game-page #audio-toggle { top: calc(var(--hud-top) + 46px); width: 32px; height: 32px; }
}

/* ==========================================================
   V5.0 首頁單畫面：不捲動、四房收斂為一張記憶牆
   （放在檔案最後，覆寫前面的舊首頁排版）
   ========================================================== */
body.home-page {
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  overscroll-behavior: none;
}
.home-page .home-shell {
  width: 100%;
  max-width: 1360px;
  height: 100%;
  margin: 0 auto;
  min-height: 0;
  padding:
    max(10px, env(safe-area-inset-top))
    max(20px, env(safe-area-inset-right))
    max(12px, env(safe-area-inset-bottom))
    max(20px, env(safe-area-inset-left));
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: clamp(8px, 1.6vh, 20px);
}

/* --- 導覽列：品牌 + 流程 + 重新開始（音樂鍵也收進同一列） --- */
.home-page .home-nav {
  height: auto;
  gap: 18px;
  padding: 0 clamp(42px, 5vw, 54px) clamp(8px, 1.3vh, 14px) 0;
}
.home-page .brand-mark { width: clamp(26px, 3.4vh, 34px); height: clamp(26px, 3.4vh, 34px); border-radius: 10px; }
.home-page .brand-copy strong { font-size: clamp(11px, 1.05vw, 13px); }
.home-page .brand-copy span { font-size: clamp(9px, .9vw, 11px); }
.home-page .nav-side { display: flex; align-items: center; gap: 14px; min-width: 0; }
.home-page .nav-note { margin: 0; font-size: clamp(9px, .85vw, 12px); white-space: nowrap; }
.home-page .nav-side .ghost-btn {
  min-height: clamp(30px, 4.4vh, 38px);
  padding: 0 clamp(12px, 1.2vw, 18px);
  font-size: clamp(10px, .9vw, 13px);
}
.home-page #audio-toggle {
  top: max(12px, env(safe-area-inset-top));
  bottom: auto;
  right: max(18px, env(safe-area-inset-right));
  width: clamp(30px, 4.6vh, 36px);
  height: clamp(30px, 4.6vh, 36px);
  font-size: clamp(13px, 2vh, 16px);
}
.home-page .audio-settings-panel {
  top: clamp(50px, 8vh, 66px);
  bottom: auto;
  right: max(14px, env(safe-area-inset-right));
  max-height: calc(100dvh - clamp(62px, 10vh, 82px));
}

/* --- 主區：上方文案、下方四房 --- */
.home-page .home-main {
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: clamp(10px, 2.4vh, 28px);
}
.home-page .hero {
  min-height: 0;
  padding: 0;
  position: static;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, auto);
  align-items: end;
  gap: clamp(16px, 3vw, 44px);
}
.home-page .hero-lede { min-width: 0; }
.home-page .kicker { margin-bottom: clamp(6px, 1.1vh, 14px); font-size: clamp(9px, .95vw, 12px); }
.home-page .hero h1 {
  font-size: clamp(23px, min(4.5vw, 8vh), 58px);
  line-height: 1.04;
  letter-spacing: -.055em;
}
.home-page .hero-copy {
  max-width: 60ch;
  margin: clamp(8px, 1.5vh, 18px) 0 0;
  font-size: clamp(11px, 1.05vw, 16px);
  line-height: 1.75;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
}
.home-page .hero-next {
  margin: clamp(7px, 1.3vh, 14px) 0 0;
  color: #6f6a63;
  font-size: clamp(9px, .85vw, 12px);
  letter-spacing: .05em;
}

/* --- 右側：主要行動 + 進度尺 + 封印 --- */
.home-page .hero-side {
  min-width: 0;
  display: grid;
  gap: clamp(8px, 1.5vh, 16px);
  align-content: end;
}
.home-page .primary-btn {
  min-height: clamp(38px, 6vh, 52px);
  padding: 0 clamp(16px, 1.6vw, 24px);
  font-size: clamp(12px, 1vw, 15px);
}
.home-page .hero-rail { display: grid; gap: clamp(6px, 1vh, 10px); }
.home-page .chapter-meter,
.home-page .anomaly-archive {
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  box-shadow: none;
  text-align: left;
  display: grid;
  grid-template-columns: auto minmax(56px, 1fr) auto;
  align-items: center;
  gap: 10px;
}
.home-page .rail-label { color: #7d776f; font-size: clamp(9px, .8vw, 11px); letter-spacing: .14em; }
.home-page .chapter-meter strong,
.home-page .anomaly-archive strong {
  display: block;
  margin: 0;
  font-size: clamp(11px, .95vw, 13px);
  letter-spacing: .01em;
  color: #d9c5a6;
  font-variant-numeric: tabular-nums;
}
.home-page .chapter-track { height: 4px; }
.home-page .anomaly-archive-meter {
  display: block;
  min-width: 0;
  grid-column: 2;
}
.home-page .anomaly-archive-meter > span {
  display: block;
  width: 100%;
  height: 4px;
  border-radius: 999px;
  background: rgba(255,255,255,.07);
  overflow: hidden;
}
.home-page .anomaly-archive[hidden],
.home-page .chapter-ending[hidden],
.home-page .echo-signature-cover[hidden],
.home-page .reset-progress-btn[hidden] { display: none; }
.home-page #anomaly-archive-copy {
  grid-column: 1 / -1;
  margin: 0;
  color: #837d76;
  font-size: clamp(9px, .78vw, 11px);
  line-height: 1.55;
}

/* --- 章節結語與封印 --- */
.home-page .chapter-ending {
  margin: clamp(8px, 1.4vh, 16px) 0 0;
  padding: clamp(9px, 1.3vh, 16px) clamp(12px, 1.2vw, 18px);
  border-radius: 16px;
}
.home-page .chapter-ending span { font-size: clamp(8px, .72vw, 10px); }
.home-page .chapter-ending h3 { margin: 6px 0 5px; font-size: clamp(13px, 1.35vw, 21px); }
.home-page .chapter-ending p {
  font-size: clamp(10px, .85vw, 13px);
  line-height: 1.62;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}
.home-page.chapter-sealed #chapter-ending { display: none; }
.home-page .echo-signature-cover {
  width: 100%;
  margin: 0;
  padding: clamp(8px, .9vw, 12px);
  gap: clamp(9px, .8vw, 14px);
  grid-template-columns: minmax(92px, 148px) minmax(0, 1fr);
}
.home-page .echo-signature-art { height: clamp(52px, 9vh, 88px); }
.home-page .echo-signature-copy strong { font-size: clamp(12px, 1vw, 16px); }
.home-page .echo-signature-copy small { font-size: clamp(8px, .72vw, 10px); }

/* 封印完成後：文案 / 封印 / 行動三欄並排，讓四房牆保有高度 */
.home-page.chapter-restored .hero {
  grid-template-columns: minmax(0, 1fr) minmax(200px, min(370px, 33vw)) minmax(190px, auto);
  grid-template-rows: auto;
  column-gap: clamp(14px, 2vw, 34px);
}
.home-page.chapter-restored .hero-lede { grid-area: 1 / 1; }
.home-page.chapter-restored #echo-signature-cover { grid-area: 1 / 2; }
.home-page.chapter-restored .hero-side { grid-area: 1 / 3; }

/* 章節結算：只顯示既有存檔算得出來的數字 */
.chapter-tally {
  display: flex;
  flex-wrap: wrap;
  gap: clamp(6px, .8vw, 12px);
  margin: clamp(8px, 1.3vh, 14px) 0 0;
}
.chapter-tally[hidden] { display: none; }
.chapter-tally span {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  padding: clamp(3px, .5vh, 6px) clamp(8px, .8vw, 11px);
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 999px;
  background: rgba(255, 255, 255, .028);
  color: #8f8981;
  font-size: clamp(9px, .78vw, 11px);
  letter-spacing: .04em;
}
.chapter-tally b {
  color: #e0c49b;
  font-size: clamp(11px, .95vw, 14px);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.restoration-result .chapter-tally { justify-content: center; margin-top: 14px; }
.restoration-result .chapter-tally span { border-color: rgba(186, 224, 216, .18); }

/* --- 四房記憶牆：唯一的房間入口 --- */
.home-page .room-deck { min-height: 0; display: grid; }
.home-page .memory-shelf {
  margin: 0;
  min-height: 0;
  height: 100%;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(8px, .9vw, 16px);
}
.home-page .memory-card {
  min-height: 0;
  padding: clamp(6px, .65vw, 10px);
  border-radius: clamp(12px, 1.2vw, 18px);
  grid-template-rows: auto minmax(0, 1fr);
}
.home-page .memory-card-copy { padding: clamp(6px, .9vh, 11px) 6px 3px; }
.home-page .memory-card-room { font-size: clamp(8px, .72vw, 10px); }
.home-page .memory-card strong {
  margin-top: clamp(3px, .6vh, 8px);
  font-size: clamp(11px, 1vw, 15px);
}
.home-page .memory-card p {
  margin-top: clamp(3px, .6vh, 8px);
  font-size: clamp(9.5px, .8vw, 12px);
  line-height: 1.5;
}
.home-page .memory-card p > span { -webkit-line-clamp: 2; }
.home-page .memory-card em {
  padding-top: clamp(4px, .8vh, 9px);
  font-size: clamp(8.5px, .72vw, 11px);
}
.home-page .memory-window-label,
.home-page .memory-window-index { font-size: clamp(6px, .6vw, 9px); }

/* --- 高畫面（桌機／平板）：四房牆貼齊底部，留白給主標 --- */
@media (min-height: 680px) {
  .home-page .home-main { grid-template-rows: minmax(0, 1fr) minmax(0, max-content); }
  .home-page .hero { align-content: center; }
  .home-page .memory-card p > span { -webkit-line-clamp: 3; }
  .home-page .memory-card-copy { padding-bottom: 4px; }
}

/* --- 矮畫面（手機橫向）再收一次 --- */
@media (max-height: 560px) {
  .home-page .hero-copy { -webkit-line-clamp: 2; }
  .home-page #anomaly-archive-copy { display: none; }
  .home-page .memory-card p > span { -webkit-line-clamp: 2; }
  .home-page.chapter-complete .hero h1 { display: none; }
  .home-page.chapter-complete .hero-next { display: none; }
  .home-page.chapter-complete .hero-copy { -webkit-line-clamp: 2; }
  .home-page.chapter-sealed .hero-copy { display: none; }
  .home-page.chapter-complete .chapter-ending { margin-top: clamp(6px, 1vh, 10px); padding: 8px 12px; }
  .home-page.chapter-complete .chapter-ending h3 { margin: 4px 0 0; }
  .home-page.chapter-complete .chapter-ending p { display: none; }
  /* 矮畫面只留三格核心數字，封存日期仍在復原術結果卡上 */
  .home-page .chapter-tally span:nth-child(4) { display: none; }
  .home-page .chapter-tally { gap: 6px; margin-top: 8px; }
  .home-page .chapter-tally span { padding: 3px 8px; }
  .home-page .echo-signature-art { height: 46px; }
  .home-page .echo-signature-copy { gap: 2px; }
  .home-page .echo-signature-copy em { margin-top: 1px; padding: 3px 6px; }
  .home-page .echo-signature-copy .echo-signature-action { margin-top: 2px; }
}

/* --- 更小的橫向機型（如 iPhone SE 橫放）：只留關鍵字句 --- */
@media (max-height: 440px) and (max-width: 780px) {
  .home-page .memory-card p > span { -webkit-line-clamp: 1; }
  .home-page .memory-window-label { display: none; }
  .home-page .hero-next { display: none; }
  .home-page .hero-copy { -webkit-line-clamp: 2; }
}

/* --- 直向（平板／手機直立）：文案在上，四房 2×2 --- */
@media (orientation: portrait) {
  .home-page .home-main { grid-template-rows: auto minmax(0, 1fr); }
  .home-page .hero { align-content: start; }
  .home-page .hero,
  .home-page.chapter-restored .hero {
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
    gap: clamp(12px, 2vh, 22px);
  }
  .home-page.chapter-restored .hero-lede,
  .home-page.chapter-restored #echo-signature-cover,
  .home-page.chapter-restored .hero-side { grid-area: auto; }
  .home-page .hero h1 { font-size: clamp(26px, min(7.4vw, 6vh), 52px); }
  .home-page .hero-copy { font-size: clamp(12px, 3vw, 16px); max-width: none; }
  .home-page .hero-side { align-content: start; }
  .home-page .hero-next,
  .home-page .nav-note { display: none; }
  .home-page .rail-label,
  .home-page #anomaly-archive-copy { font-size: 10px; }
  .home-page .chapter-meter strong,
  .home-page .anomaly-archive strong { font-size: 12px; }
  .home-page .memory-shelf {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-rows: minmax(0, 1fr);
  }
  .home-page .memory-card-room { font-size: 9px; }
  .home-page .memory-card strong { font-size: 13px; }
  .home-page .memory-card p { font-size: 11px; }
  .home-page .memory-card em { font-size: 10px; }
  .home-page .echo-signature-cover { grid-template-columns: minmax(96px, 130px) minmax(0, 1fr); }
}

.settings-version {
  margin: 2px 0 0;
  color: #6c6862;
  font-size: 10px;
  letter-spacing: .06em;
  text-align: center;
}

/* 矮畫面（手機橫向）：設定面板不必內捲 */
@media (max-height: 560px) {
  .audio-settings-head { padding: 11px 14px 9px; }
  .audio-settings-head strong { margin-top: 2px; font-size: 15px; }
  .audio-settings-body { padding: 8px; }
  .settings-switch { padding: 6px 10px; }
  .settings-switch small { margin-top: 2px; line-height: 1.3; }
  .settings-help { margin: 4px 4px; padding: 6px 4px; }
  .settings-help p { margin-top: 3px; line-height: 1.5; }
  .settings-version { font-size: 9px; }
}

/* ==========================================================================
   V1.0 介面圖示：改用程式化畫的線條圖示，取代 ⌂ ≡ ⌄ ♫ 等字元。
   字元圖示在不同語言／字體 fallback 下大小和基線都會跳動，換成 CSS 之後
   三種語言看起來完全一致。
   ========================================================================== */
.home-link-mark,
.journal-btn-mark,
.clue-toggle-mark { display:block;position:relative;pointer-events:none; }

/* 屋頂 + 門：回首頁 */
.home-link-mark { width:15px;height:13px; }
.home-link-mark::before {
  content:"";position:absolute;left:0;top:0;width:11px;height:11px;
  border-left:1.5px solid currentColor;border-top:1.5px solid currentColor;
  transform:rotate(45deg);transform-origin:top left;left:7.5px;
}
.home-link-mark::after {
  content:"";position:absolute;left:2px;bottom:0;width:11px;height:7px;
  border:1.5px solid currentColor;border-top:0;border-radius:0 0 1px 1px;
}

/* 三條線：打開失物簿 */
.journal-btn-mark { width:15px;height:11px; }
.journal-btn-mark::before,
.journal-btn-mark::after {
  content:"";position:absolute;left:0;width:100%;height:1.6px;background:currentColor;border-radius:2px;
}
.journal-btn-mark::before { top:0;box-shadow:0 4.7px 0 currentColor; }
.journal-btn-mark::after { bottom:0; }

/* 向下人字：展開線索 */
.clue-toggle-mark { width:11px;height:11px; }
.clue-toggle-mark::before {
  content:"";position:absolute;left:1px;top:1px;width:7px;height:7px;
  border-right:1.5px solid currentColor;border-bottom:1.5px solid currentColor;
  transform:rotate(45deg);
}

/* ==========================================================================
   V1.0 設定面板新增：語言、音量滑桿、降低動態
   ========================================================================== */
.audio-toggle-mark { display:block;width:15px;height:15px;position:relative; }
.audio-toggle-mark::before {
  content:"";position:absolute;left:1px;top:1px;width:11px;height:11px;border-radius:50%;
  border:1.5px solid currentColor;
}
.audio-toggle-mark::after {
  content:"";position:absolute;left:5.2px;top:5.2px;width:2.6px;height:2.6px;border-radius:50%;
  background:currentColor;
  box-shadow:0 0 0 3.2px rgba(0,0,0,0), 6px -4px 0 -.6px currentColor, -6px 4px 0 -.6px currentColor;
}
#audio-toggle { display:grid;place-items:center; }

.settings-lang { margin:2px 4px 10px;padding:11px 12px 12px;border:1px solid rgba(255,255,255,.07);border-radius:14px;background:rgba(255,255,255,.02); }
.settings-lang-head strong { display:block;font-size:12px; }
.settings-lang-head small { display:block;margin-top:3px;color:#817b74;font-size:10px;line-height:1.4; }
.settings-lang-options { margin-top:9px;display:grid;grid-template-columns:repeat(3, minmax(0, 1fr));gap:6px; }
.settings-lang-option {
  min-height:44px;padding:6px 4px;border:1px solid rgba(255,255,255,.08);border-radius:11px;
  background:rgba(255,255,255,.03);color:#a8a39b;cursor:pointer;transition:.16s;
  display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px;
}
.settings-lang-option strong { font-size:12px;font-weight:600;line-height:1.1; }
.settings-lang-option small { font-size:9px;color:#6f6a64;line-height:1.1; }
.settings-lang-option:hover { border-color:rgba(255,255,255,.16);background:rgba(255,255,255,.06); }
.settings-lang-option[aria-pressed="true"] {
  border-color:rgba(214,177,123,.4);background:rgba(214,177,123,.12);color:var(--accent);
}
.settings-lang-option[aria-pressed="true"] small { color:rgba(214,177,123,.75); }

.settings-volume { display:flex;align-items:center;gap:9px;margin:0 4px 6px;padding:2px 12px 8px; }
.settings-volume-label { flex:0 0 auto;color:#817b74;font-size:10px;min-width:52px; }
.settings-volume-value { flex:0 0 34px;text-align:right;color:#817b74;font-size:10px;font-variant-numeric:tabular-nums; }
.settings-volume input[type="range"] {
  flex:1 1 auto;min-width:0;height:22px;-webkit-appearance:none;appearance:none;background:transparent;cursor:pointer;
}
.settings-volume input[type="range"]::-webkit-slider-runnable-track {
  height:3px;border-radius:3px;background:rgba(255,255,255,.12);
}
.settings-volume input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance:none;appearance:none;width:14px;height:14px;margin-top:-5.5px;border-radius:50%;
  background:var(--accent);box-shadow:0 1px 5px rgba(0,0,0,.45);
}
.settings-volume input[type="range"]::-moz-range-track { height:3px;border-radius:3px;background:rgba(255,255,255,.12); }
.settings-volume input[type="range"]::-moz-range-thumb { width:14px;height:14px;border:0;border-radius:50%;background:var(--accent); }
.settings-volume input[type="range"]:disabled { opacity:.32;cursor:default; }
.settings-volume input[type="range"]:focus-visible { outline:2px solid var(--accent);outline-offset:3px;border-radius:4px; }
.settings-version { margin:12px 4px 2px;color:#605b56;text-align:center; }

/* ==========================================================================
   V1.0 首次遊玩教學
   ========================================================================== */
.onboarding .overlay-card { max-width:min(560px, calc(100vw - 36px)); }
.onboarding-goal { margin:14px 0 0;color:#bbb5ad;font-size:15px;line-height:1.8; }
.onboarding-steps {
  margin:22px 0 6px;padding:0;list-style:none;
  display:grid;grid-template-columns:repeat(3, minmax(0, 1fr));gap:12px;
}
.onboarding-steps li {
  padding:15px 14px 16px;border:1px solid var(--soft-line);border-radius:14px;
  background:rgba(255,255,255,.025);
}
.onboarding-steps strong { display:block;margin-top:11px;font-size:13px;letter-spacing:.01em; }
.onboarding-steps small { display:block;margin-top:6px;color:#8f8982;font-size:11px;line-height:1.65; }
.onboarding-note { margin:16px 0 0;color:#6e6963;font-size:11px; }

/* 三個教學圖示都用 CSS 畫，不依賴字體或圖片。 */
.onboarding-mark { display:block;width:30px;height:22px;position:relative;color:var(--accent); }
.onboarding-mark::before,
.onboarding-mark::after { content:"";position:absolute; }
/* 拖曳：一條水平軌跡加兩個端點 */
.onboarding-mark-drag::before {
  left:1px;top:10px;width:26px;height:1.5px;background:currentColor;border-radius:2px;opacity:.55;
}
.onboarding-mark-drag::after {
  left:0;top:6px;width:9px;height:9px;border-radius:50%;border:1.5px solid currentColor;
  box-shadow:17px 0 0 -1px currentColor;
}
/* 點擊：一個圓點加外擴的漣漪 */
.onboarding-mark-tap::before {
  left:8px;top:6px;width:9px;height:9px;border-radius:50%;background:currentColor;
}
.onboarding-mark-tap::after {
  left:2px;top:0;width:21px;height:21px;border-radius:50%;border:1.5px solid currentColor;opacity:.4;
}
/* 提示：一盞燈的光錐 */
.onboarding-mark-hint::before {
  left:6px;top:1px;width:12px;height:12px;border-radius:50%;
  background:radial-gradient(circle at 50% 42%, currentColor 0 32%, rgba(0,0,0,0) 33%);
  box-shadow:0 0 0 1.5px currentColor inset;
}
.onboarding-mark-hint::after {
  left:8px;top:15px;width:8px;height:1.5px;background:currentColor;border-radius:2px;
  box-shadow:0 4px 0 -.5px currentColor;
}
body.onboarding-open { overflow:hidden; }

@media (max-width: 640px) {
  .onboarding-steps { grid-template-columns:1fr;gap:9px; }
  .onboarding-steps li { display:grid;grid-template-columns:30px 1fr;column-gap:13px;align-items:start;padding:12px 13px; }
  .onboarding-mark { grid-row:span 2; }
  .onboarding-steps strong { margin-top:1px; }
  .settings-lang-options { grid-template-columns:1fr; }
  .settings-lang-option { flex-direction:row;gap:8px;min-height:44px; }
}

/* ==========================================================================
   V1.0 降低動態：設定面板的開關與系統偏好走同一個 class
   ========================================================================== */
html.reduced-motion *,
html.reduced-motion *::before,
html.reduced-motion *::after {
  animation-duration: .001ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: .001ms !important;
  scroll-behavior: auto !important;
}

/* 手機直向的四格記憶牆只有約 150px 高，塞不下摘要又要保住「進入房間 →」
   這個實際入口；與其露出半行被切斷的字，不如整段拿掉。平板直向的卡片
   夠高，摘要照常顯示。 */
@media (orientation: portrait) and (max-width: 560px) {
  .home-page .memory-card p { display: none; }
}

/* ==========================================================================
   V1.0 觸控尺寸：手指操作時所有可點的東西至少 44×44。
   桌機滑鼠維持原本較精緻的尺寸，不被這組規則影響。
   ========================================================================== */
@media (pointer: coarse) {
  #audio-toggle { width: 44px; height: 44px; }
  .audio-settings-close,
  .journal-close,
  .restoration-close { width: 44px; height: 44px; }
  .home-page .reset-progress-btn { min-height: 44px; padding-block: 0; }
  .settings-action { min-height: 44px; }
  .settings-switch { min-height: 52px; }
  .brand { min-height: 44px; }
  /* 滑桿的軌道很細，但可按範圍要夠大：把 input 本身撐高，thumb 一起放大。 */
  .settings-volume { padding-bottom: 4px; }
  .settings-volume input[type="range"] { height: 44px; }
  .settings-volume input[type="range"]::-webkit-slider-thumb { width: 20px; height: 20px; margin-top: -8.5px; }
  .settings-volume input[type="range"]::-moz-range-thumb { width: 20px; height: 20px; }
  .clue-toggle,
  .journal-btn,
  .home-link { min-width: 44px; min-height: 44px; }
  .mini-btn { min-height: 44px; }
}

/* 鍵盤操作：每個可聚焦元素都要看得到焦點框，三種語言都一樣。 */
:where(a, button, input, [tabindex]):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 8px;
}

/* 最小的直向機型（iPhone SE 一代、320×568）：卡片只有約 108px，
   放不下「ROOM 01 / リビング」這行眉標。窗景上本來就印著 ROOM 01，
   所以拿掉重複的那一行，把高度讓給狀態與「部屋に入る →」入口。 */
@media (orientation: portrait) and (max-width: 400px) and (max-height: 640px) {
  .home-page .memory-card-room { display: none; }
  .home-page .memory-card { grid-template-rows: minmax(0, 1.05fr) minmax(0, 1fr); }
  .home-page .memory-card-copy { padding-top: 4px; }
  .home-page .memory-card strong { margin-top: 2px; }
  .home-page .memory-card em { padding-top: 3px; }
}

/* 手機橫向（高度 < 460px）：卡片只有約 120px。摘要與眉標一起收掉，
   確保「探索を続ける →」這個入口一定完整可見。 */
@media (max-height: 460px) {
  .home-page .memory-card p { display: none; }
  .home-page .memory-card-room { display: none; }
  .home-page .memory-card-copy { padding-top: 4px; }
  .home-page .memory-card strong { margin-top: 0; }
  .home-page .memory-card em { padding-top: 3px; }
  /* 英文主標在 iPhone 15 Pro Max 橫向（約 932×430）會被 34px 斷成
     remem-/bers 三行，進度狀態下 hero 又被 grid 壓到跟四房入口重疊。
     只縮英文、不讓 hero 被壓扁；中文／日文維持原尺寸。 */
  :root[data-lang="en"] .home-page .hero h1 { font-size: clamp(22px, 6.2vh, 28px); hyphens: none; }
  :root[data-lang="en"] .home-page .hero { min-height: min-content; }
}

/* 3D 核心載入失敗時，操作三步驟沒有意義（沒有房間可以拖曳），收起來
   讓玩家只看到錯誤說明與「重新載入」。 */
.overlay-card.boot-error .quick-guide { display: none; }

/* ==========================================================================
   V5.1 實機回饋修正（iPhone 15 Pro Max 橫向實測）
   六個問題都只有在真的用手指玩才會現形，桌機滑鼠測不出來。
   ========================================================================== */

/* --- 1. ROOM LOG 面板捲不動 ---------------------------------------------
   .ui-layer 是 pointer-events:none，只有 button / a / .interactive 才 opt-in
   回來。<aside class="journal"> 三者都不是，所以整片面板收不到觸控：手指
   拖在上面等於拖在 3D 畫布上，鏡頭轉了、清單卻一動也不動。面板本來就有
   overflow:auto，缺的是「讓它自己接管指標事件」。 */
.journal.open { pointer-events: auto; }
.journal-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}
/* 線索卡是不透明面板，手指壓在上面不該把房間轉走。 */
.clue-card { pointer-events: auto; }

/* --- 2. HUD 小圓鈕被觸控尺寸撐爆 -----------------------------------------
   前面那組 `min-width/min-height:44px` 改的是「畫出來的大小」，於是 28~30px
   的圓鈕在只有 40~46px 高的膠囊裡整顆凸出來（實機上白色選單鈕看起來像貼歪
   的貼紙）。畫面維持小圓點，改用偽元素把可按範圍撐到 44px 高。 */
@media (pointer: coarse) {
  .clue-toggle,
  .journal-btn,
  .home-link,
  .clue-card:not(.expanded) .mini-btn {
    min-width: 0;
    min-height: 0;
    position: relative;
  }
  .clue-toggle::after,
  .journal-btn::after,
  .home-link::after,
  .clue-card:not(.expanded) .mini-btn::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: calc(100% + 8px);
    height: 44px;
    transform: translate(-50%, -50%);
  }
  /* 展開後的線索卡按鈕是一般文字鈕，維持原本的 44px 高度。 */
}

/* --- 3. 選單鈕跟旁邊不搭 -------------------------------------------------
   奶油白實心圓在深色膠囊上太跳，而且它和左邊的「回首頁」是同一階的圖示鈕，
   卻長得完全不一樣。改成跟 .home-link 同一套半透明處理，左右兩顆成對。 */
.progress-pill.hud-chip .journal-btn {
  border: 1px solid rgba(255,255,255,.1);
  background: rgba(255,255,255,.07);
  color: #e3dbd1;
}
.progress-pill.hud-chip .journal-btn:hover { background: rgba(255,255,255,.14); }

/* --- 4. 左下線索被截成一行 -----------------------------------------------
   圓鈕恢復原尺寸後卡片省下約 40px，再把卡片加寬並允許兩行，三種語言的線索
   幾乎都能整句讀完。浴室那句「關掉鏡前燈，霧氣還在的時候…」正是被截斷，
   才害人對著亮著的鏡子找很久。 */
.clue-card:not(.expanded) {
  width: min(440px, 52vw, calc(100vw - 24px));
  height: auto;
  min-height: 46px;
  padding: 8px 8px 8px 12px;
}
.clue-card:not(.expanded) .clue-actions { gap: 8px; }
.clue-card:not(.expanded) #clue-text {
  white-space: normal;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
  line-height: 1.35;
}

/* --- 5. 長按會反白選字 ---------------------------------------------------
   這是遊戲畫面，不是可讀文件：長按跳出放大鏡與「拷貝／查詢」會直接打斷
   拖曳轉視角。整個介面鎖住不給選取，只留輸入類元件（音量滑桿、語言選單）。 */
body {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}
input, textarea, select, [contenteditable="true"] {
  -webkit-user-select: auto;
  user-select: auto;
}

/* --- 6. 開了 viewport-fit=cover 之後才會露出的邊緣 -----------------------
   HTML 的 viewport 補上 viewport-fit=cover，env(safe-area-inset-*) 才會回傳
   真正的數字（沒有 cover 時它一律是 0，等於全檔的 max(24px, env(...)) 都在
   吃那個 24px 的保底值）。首頁的 .home-shell、房間的 topbar／線索卡／音量鍵
   本來就都吃了 env()，這裡補上兩個漏網的貼邊面板：橫向持機時感光元件那側
   會有 59px 的安全區，它們原本用固定的 18px／22px，會整片滑進瀏海底下。
   非瀏海裝置 env() 是 0，max() 取回原本的數值，畫面完全不變。 */
.game-page .journal {
  right: max(18px, env(safe-area-inset-right));
  bottom: max(18px, env(safe-area-inset-bottom));
  top: max(74px, calc(env(safe-area-inset-top) + 64px));
  max-width: calc(100vw - max(18px, env(safe-area-inset-left)) - max(18px, env(safe-area-inset-right)));
}
.game-page .audio-settings-panel {
  right: max(22px, env(safe-area-inset-right));
  top: max(116px, calc(env(safe-area-inset-top) + 106px));
  max-height: calc(100dvh - max(132px, calc(env(safe-area-inset-top) + 122px)) - env(safe-area-inset-bottom));
}

/* ==========================================================================
   V6 直式手機版 ＋ 找到東西的手感 ＋ 今日重排
   - 房間不再要求橫放：直式用較大的垂直視角看房間的一個切面，左右滑動看完整間。
   - HUD 改成「上方資訊、下方操作」：拇指搆得到的底部線索面板，提示氣泡移到上方，
     失物簿改成底部抽屜。
   - 找到東西時「+1」飛進右上進度，進度鈕外圈是房間完成度。
   ========================================================================== */

/* --- 進度環：失物簿按鈕外圈就是這個房間的完成度 --- */
.progress-pill.hud-chip .journal-btn { position: relative; }
.progress-pill.hud-chip .journal-btn::before {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  pointer-events: none;
  background: conic-gradient(var(--accent) calc(var(--hud-progress, 0) * 1turn), rgba(255,255,255,.08) 0);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 2.5px), #000 calc(100% - 2px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 2.5px), #000 calc(100% - 2px));
  transition: background .4s ease;
}
.progress-pill.hud-chip.is-bumped { animation: hud-progress-bump .52s cubic-bezier(.3,.7,.2,1); }
@keyframes hud-progress-bump {
  0% { transform: scale(1); }
  35% { transform: scale(1.09); box-shadow: 0 0 0 1px rgba(214,177,123,.4), 0 0 28px rgba(214,177,123,.35); }
  100% { transform: scale(1); }
}

/* --- 「+1」飛入 --- */
.find-chip {
  position: fixed;
  z-index: 31;
  pointer-events: none;
  transform: translate(-50%, -50%);
  padding: 6px 13px 6px 12px;
  border-radius: 999px;
  background: linear-gradient(145deg, #f3dcb4, #d6b17b);
  color: #22190f;
  font-weight: 800;
  font-size: 15px;
  line-height: 1;
  letter-spacing: .02em;
  font-variant-numeric: tabular-nums;
  box-shadow: 0 10px 28px rgba(0,0,0,.35), 0 0 26px rgba(214,177,123,.5);
  will-change: transform, opacity;
}
.find-chip.is-static { animation: find-chip-fade .9s ease forwards; }
@keyframes find-chip-fade {
  0% { opacity: 0; }
  20% { opacity: 1; }
  100% { opacity: 0; }
}

/* --- 直式提示：左右滑動 --- */
.swipe-coach {
  position: fixed;
  left: 50%;
  top: 44%;
  z-index: 6;
  display: grid;
  justify-items: center;
  gap: 7px;
  min-width: 210px;
  padding: 15px 20px 14px;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 22px;
  background: rgba(16,14,13,.7);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  box-shadow: 0 22px 60px rgba(0,0,0,.4);
  text-align: center;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -50%) scale(.94);
  transition: opacity .35s ease, transform .35s ease;
}
.swipe-coach.is-visible { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.swipe-coach strong { font-size: 15px; line-height: 1.35; color: #f3eadf; }
.swipe-coach small { font-size: 11px; color: #a9a196; }
.swipe-coach-track { position: relative; width: 128px; height: 26px; }
.swipe-coach-track::before {
  content: "";
  position: absolute;
  left: 4px;
  right: 4px;
  top: 12px;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, transparent, rgba(214,177,123,.7) 18%, rgba(214,177,123,.7) 82%, transparent);
}
.swipe-coach-track::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 7px;
  height: 12px;
  background:
    linear-gradient(-45deg, transparent 45%, var(--accent) 46% 56%, transparent 57%) left 2px top 0 / 9px 6px no-repeat,
    linear-gradient(45deg, transparent 45%, var(--accent) 46% 56%, transparent 57%) left 2px bottom 0 / 9px 6px no-repeat,
    linear-gradient(45deg, transparent 45%, var(--accent) 46% 56%, transparent 57%) right 2px top 0 / 9px 6px no-repeat,
    linear-gradient(-45deg, transparent 45%, var(--accent) 46% 56%, transparent 57%) right 2px bottom 0 / 9px 6px no-repeat;
}
.swipe-coach-track i {
  position: absolute;
  left: 50%;
  top: 4px;
  width: 18px;
  height: 18px;
  margin-left: -9px;
  border-radius: 50%;
  background: rgba(243,234,223,.92);
  box-shadow: 0 0 0 5px rgba(243,234,223,.16), 0 4px 14px rgba(0,0,0,.35);
  animation: swipe-coach-finger 1.7s ease-in-out infinite;
}
@keyframes swipe-coach-finger {
  0%, 100% { transform: translateX(-40px); }
  50% { transform: translateX(40px); }
}

/* --- 今日重排：計時器、入口、結算卡 --- */
.daily-mark {
  position: relative;
  display: inline-block;
  flex: 0 0 auto;
  width: 13px;
  height: 13px;
  margin-top: 2px;
  border: 1.6px solid currentColor;
  border-radius: 50%;
}
.daily-mark::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -5px;
  width: 5px;
  height: 2.5px;
  margin-left: -2.5px;
  border-radius: 1px;
  background: currentColor;
}
.daily-mark::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 2px;
  width: 1.6px;
  height: 4px;
  margin-left: -.8px;
  border-radius: 1px;
  background: currentColor;
  transform-origin: 50% 100%;
}
.daily-entry-link { display: inline-flex; align-items: center; gap: 8px; }
.daily-entry-link .daily-mark { color: var(--accent); }

.daily-timer.hud-chip {
  position: relative;
  box-sizing: border-box;
  height: clamp(40px, 5.6vh, 44px);
  min-height: 40px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 13px 0 11px;
  border: 1px solid var(--hud-border);
  border-radius: 16px;
  background: var(--hud-surface);
  box-shadow: var(--hud-shadow);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  color: #f2e8db;
  pointer-events: none;
}
.daily-timer .daily-mark { color: var(--accent); }
.daily-timer strong { min-width: 3.1em; font-size: 15px; letter-spacing: .02em; font-variant-numeric: tabular-nums; }
.daily-penalty {
  position: absolute;
  left: 50%;
  top: 100%;
  margin-top: 6px;
  transform: translateX(-50%);
  opacity: 0;
  color: #f0b5ae;
  font-size: 12px;
  font-style: normal;
  font-weight: 700;
  white-space: nowrap;
  text-shadow: 0 2px 10px rgba(0,0,0,.6);
}
.daily-timer.is-penalized .daily-penalty { animation: daily-penalty-rise 1.2s ease forwards; }
.daily-timer.is-penalized strong { animation: daily-penalty-shake .42s ease; color: #f4c3bb; }
.daily-timer.is-finished { border-color: rgba(214,177,123,.5); box-shadow: var(--hud-shadow), 0 0 22px rgba(214,177,123,.22); }
@keyframes daily-penalty-rise {
  0% { opacity: 0; transform: translate(-50%, -6px); }
  18% { opacity: 1; transform: translate(-50%, 0); }
  75% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, 6px); }
}
@keyframes daily-penalty-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-3px); }
  60% { transform: translateX(3px); }
}

.daily-result-card { text-align: left; }
.daily-result-score { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px 16px; margin: 4px 0 14px; }
.daily-result-score strong {
  font-family: var(--font-display);
  font-size: clamp(40px, 11vw, 54px);
  line-height: 1;
  letter-spacing: -.03em;
  color: #f7ecde;
  font-variant-numeric: tabular-nums;
}
.daily-stars { font-size: 24px; letter-spacing: .14em; color: var(--accent); text-shadow: 0 0 18px rgba(214,177,123,.45); }
.daily-result-card p + p { margin-top: 6px; }
.daily-result-card .daily-result-best { color: #d9c5a6; }
.daily-result-card .daily-result-best.is-new { color: var(--accent); font-weight: 700; }

/* --- 直式手機（房間頁）--- */
@media (orientation: portrait) and (max-width: 760px) {
  .game-page::after {
    background:
      linear-gradient(180deg, rgba(6,5,5,.42), transparent 15%, transparent 72%, rgba(6,5,5,.5)),
      radial-gradient(circle at 50% 46%, transparent 0 52%, rgba(6,5,5,.2) 100%);
  }

  .game-page .topbar { gap: 6px; }
  .game-page .room-id.hud-chip,
  .game-page .progress-pill.hud-chip,
  .game-page .daily-timer.hud-chip { height: 44px; min-height: 44px; }
  .game-page .room-id.hud-chip { max-width: 48vw; padding-right: 12px; }
  .game-page .room-id.hud-chip .room-id-copy span { font-size: 8px; }
  .game-page .room-id.hud-chip .room-id-copy strong { font-size: 13px; }
  .game-page .progress-pill.hud-chip { padding-left: 11px; gap: 9px; }
  .game-page .progress-pill.hud-chip .progress-copy strong { font-size: 14px; font-variant-numeric: tabular-nums; }
  .game-page .progress-pill.hud-chip .journal-btn { width: 32px; height: 32px; }
  .game-page #audio-toggle { top: calc(var(--hud-top) + 54px); }

  /* 線索：底部整條面板，兩行線索＋拇指可及的大提示鈕 */
  .game-page .clue-card,
  .game-page .clue-card:not(.expanded),
  .game-page .clue-card.expanded {
    left: max(10px, env(safe-area-inset-left));
    right: max(10px, env(safe-area-inset-right));
    bottom: max(10px, env(safe-area-inset-bottom));
    width: auto;
    height: auto;
    min-height: 0;
    padding: 13px 12px 11px 15px;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
    border-radius: 22px;
  }
  .game-page .clue-eyebrow { font-size: 9px; }
  .game-page .clue-card:not(.expanded) #clue-text,
  .game-page .clue-card.expanded #clue-text {
    margin: 5px 0 0;
    font-size: 14px;
    line-height: 1.45;
    color: #efe7dc;
  }
  .game-page .clue-card:not(.expanded) #clue-text { -webkit-line-clamp: 2; line-clamp: 2; }
  .game-page .clue-card .clue-actions,
  .game-page .clue-card.expanded .clue-actions {
    margin: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 44px 44px;
    gap: 8px;
    align-items: center;
  }
  .game-page .clue-card #hint-btn,
  .game-page .clue-card:not(.expanded) #hint-btn,
  .game-page .clue-card.expanded #hint-btn {
    width: auto;
    height: 44px;
    min-height: 44px;
    padding: 0 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    font-size: 13px;
    font-weight: 700;
    color: #20180f;
    background: linear-gradient(145deg, #efd6ad, #d6b17b);
    border-color: transparent;
    box-shadow: 0 8px 22px rgba(214,177,123,.22);
  }
  .game-page .clue-card #hint-btn::before,
  .game-page .clue-card:not(.expanded) #hint-btn::before { content: none !important; }
  .game-page .clue-card #reset-view-btn,
  .game-page .clue-card:not(.expanded) #reset-view-btn,
  .game-page .clue-card.expanded #reset-view-btn {
    width: 44px;
    height: 44px;
    min-height: 44px;
    padding: 0;
    display: grid;
    place-items: center;
    border-radius: 14px;
    font-size: 0;
  }
  .game-page .clue-card #reset-view-btn::before,
  .game-page .clue-card.expanded #reset-view-btn::before { content: "↺" !important; font-size: 18px; line-height: 1; }
  .game-page .clue-card .clue-toggle,
  .game-page .clue-card.expanded .clue-toggle {
    width: 44px;
    height: 44px;
    margin: 0;
    border-radius: 14px;
  }

  /* 提示氣泡：移到上方，不壓住底部面板與拇指 */
  .game-page #toast {
    top: calc(var(--hud-top) + 56px);
    bottom: auto;
    max-width: calc(100vw - 120px);
    padding: 10px 15px;
    border-radius: 16px;
    font-size: 13px;
    line-height: 1.45;
    text-align: center;
    white-space: normal;
    transform: translate(-50%, -14px);
  }
  .game-page #toast.show { transform: translate(-50%, 0); }

  /* 失物簿：底部抽屜 */
  .game-page .journal {
    top: auto;
    left: max(6px, env(safe-area-inset-left));
    right: max(6px, env(safe-area-inset-right));
    bottom: 0;
    width: auto;
    max-width: none;
    max-height: min(74dvh, 620px);
    border-radius: 26px 26px 0 0;
    padding-bottom: env(safe-area-inset-bottom);
    transform: translateY(calc(100% + 24px));
  }
  .game-page .journal.open { transform: translateY(0); }
  .game-page .journal-head { padding: 18px 18px 14px; }
  .game-page .journal-head::before {
    content: "";
    position: absolute;
    left: 50%;
    top: 7px;
    width: 38px;
    height: 4px;
    margin-left: -19px;
    border-radius: 4px;
    background: rgba(255,255,255,.18);
  }
  .game-page .journal-body { padding: 14px 18px 22px; }
  .game-page .task-row { font-size: 14px; padding: 10px 0; }

  /* 開場／痕跡／完成／巡查等覆蓋卡：貼底的大卡，主要按鈕整條 */
  .game-page .overlay {
    align-items: flex-end;
    padding: 12px max(10px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
    background: linear-gradient(180deg, rgba(7,7,8,.2), rgba(7,7,8,.78) 62%);
  }
  .game-page .overlay-card {
    width: 100%;
    max-height: calc(100dvh - 24px);
    overflow-y: auto;
    padding: 26px 22px 20px;
    border-radius: 28px;
  }
  .game-page .overlay-card h1 { margin: 12px 0 10px; font-size: 34px; }
  .game-page .overlay-card h2 { margin: 12px 0 10px; font-size: 27px; }
  .game-page .overlay-card p { font-size: 14px; line-height: 1.7; }
  .game-page .overlay-actions { margin-top: 20px; gap: 8px; }
  .game-page .overlay-actions > .primary-btn {
    flex: 1 1 100%;
    min-height: 54px;
    justify-content: center;
    font-size: 15px;
  }
  .game-page .overlay-actions > .ghost-btn { flex: 1 1 calc(50% - 4px); min-height: 48px; justify-content: center; order: 3; }
  /* 兩個「再玩一種」的入口字比較長，直式各佔一整排，排在主按鈕正下方 */
  .game-page .overlay-actions > .daily-entry-link { flex-basis: 100%; order: 1; }
  .game-page .overlay-actions > .anomaly-entry-btn { flex-basis: 100%; order: 2; }
  .game-page .quick-guide { flex-wrap: wrap; }
  .game-page .memory-quote { margin-top: 14px; padding: 14px 16px; font-size: 15px; line-height: 1.75; }

  .game-page .daily-timer.hud-chip { padding: 0 11px 0 10px; }
  .game-page .daily-timer strong { font-size: 15px; }
}

/* 很窄的直式機（320 寬）：房名只留房間名稱 */
@media (orientation: portrait) and (max-width: 360px) {
  .game-page .room-id.hud-chip .room-id-copy span { display: none; }
  .game-page.daily-mode .progress-pill.hud-chip .progress-copy { display: none; }
  .game-page .clue-card #hint-btn { padding: 0 10px; font-size: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  .swipe-coach-track i,
  .progress-pill.hud-chip.is-bumped,
  .daily-timer.is-penalized strong { animation: none !important; }
}

/* --- 首頁：今日重排看板 --- */
.home-page .daily-board[hidden] { display: none; }
.home-page .daily-board {
  display: grid;
  gap: 7px;
  margin-top: clamp(2px, .6vh, 6px);
}
.home-page .daily-board-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.home-page .daily-board-head .rail-label { display: inline-flex; align-items: center; gap: 7px; }
.home-page .daily-board-head .daily-mark { width: 11px; height: 11px; color: var(--accent); }
.home-page .daily-board-head .daily-mark::before { top: -4px; width: 4px; height: 2px; margin-left: -2px; }
.home-page .daily-board-head strong { color: #8f897f; font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums; }
.home-page .daily-board-rooms { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.home-page .daily-chip {
  min-width: 0;
  min-height: 44px;
  display: grid;
  align-content: center;
  gap: 2px;
  padding: 6px 9px;
  border: 1px solid rgba(214,177,123,.22);
  border-radius: 12px;
  background: linear-gradient(145deg, rgba(214,177,123,.1), rgba(255,255,255,.02));
  color: #efe4d4;
  text-decoration: none;
  transition: transform .18s ease, border-color .18s ease, background .18s ease;
}
.home-page a.daily-chip:hover { transform: translateY(-1px); border-color: rgba(214,177,123,.48); background: rgba(214,177,123,.14); }
.home-page .daily-chip > span { font-size: 12px; font-weight: 650; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.home-page .daily-chip > b { color: #b7a688; font-size: 10px; font-weight: 500; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.home-page .daily-chip-score i { margin-right: 5px; color: var(--accent); font-style: normal; letter-spacing: .04em; }
.home-page .daily-chip.is-played { border-color: rgba(214,177,123,.4); }
.home-page .daily-chip.is-locked { border-style: dashed; border-color: rgba(255,255,255,.09); background: transparent; color: #6f6a64; }
.home-page .daily-chip.is-locked > b { color: #5d5853; }

/* 沒進過的房間縮圖原本幾乎全黑，首頁第一眼很沉；改成看得出房間、但仍是未解鎖的褪色。 */
.home-page .memory-card:not(.unlocked) .memory-depth-stage {
  filter: grayscale(.62) saturate(.5) brightness(.6) blur(.55px);
  opacity: .74;
}
.home-page .memory-card:not(.unlocked):hover .memory-depth-stage { filter: grayscale(.35) saturate(.7) brightness(.72) blur(0); opacity: .88; }

/* 矮畫面（手機橫向）：看板只留房間鈕 */
@media (max-height: 560px) {
  .home-page .daily-board { gap: 4px; }
  .home-page .daily-chip { min-height: 38px; padding: 4px 8px; }
}
@media (max-height: 460px) {
  .home-page .daily-board { display: none; }
}

/* --- 直式手機首頁：可以上下捲，四房改成一列一間，縮圖放大 --- */
@media (orientation: portrait) and (max-width: 560px) {
  body.home-page {
    height: auto;
    min-height: 100dvh;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior-y: contain;
  }
  .home-page .home-shell {
    height: auto;
    min-height: 100dvh;
    padding-left: max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
    padding-bottom: max(20px, env(safe-area-inset-bottom));
  }
  .home-page .home-main { grid-template-rows: auto auto; gap: 18px; }
  .home-page .hero h1 { font-size: clamp(30px, 9vw, 40px); }
  .home-page .hero-copy { font-size: 14px; -webkit-line-clamp: 4; }
  .home-page .hero-actions .primary-btn { width: 100%; justify-content: center; min-height: 54px; font-size: 16px; }
  /* 首頁彈窗（教學、重置確認）：主按鈕原本跟著 1vw 縮到 12px，比旁邊的按鈕小一號 */
  .home-page .overlay-actions > .primary-btn,
  .home-page .overlay-actions > .ghost-btn { flex: 1 1 100%; justify-content: center; font-size: 15px; padding: 0 14px; }
  .home-page .daily-board-rooms { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .home-page .daily-chip { min-height: 50px; padding: 7px 12px; }
  .home-page .daily-chip > span { font-size: 13px; }
  .home-page .daily-chip > b { font-size: 11px; }

  .home-page .room-deck { display: block; }
  .home-page .memory-shelf {
    height: auto;
    grid-template-columns: minmax(0, 1fr);
    grid-auto-rows: auto;
    gap: 10px;
  }
  .home-page .memory-card {
    grid-template-columns: minmax(0, 46%) minmax(0, 1fr);
    grid-template-rows: auto;
    align-items: center;
    column-gap: 12px;
    padding: 8px;
    border-radius: 16px;
  }
  .home-page .memory-window { align-self: stretch; height: auto; min-height: 76px; aspect-ratio: 902 / 365; }
  .home-page .memory-card-copy { padding: 2px 4px 2px 0; }
  .home-page .memory-card-room { display: block; font-size: 9px; }
  .home-page .memory-card strong { margin-top: 3px; font-size: 14px; }
  .home-page .memory-card p { display: block; margin-top: 3px; font-size: 11px; line-height: 1.45; }
  .home-page .memory-card p > span { -webkit-line-clamp: 2; }
  .home-page .memory-card em { padding-top: 5px; font-size: 11px; }
  .home-page .memory-window-label { display: none; }
}
@media (orientation: portrait) and (max-width: 360px) {
  .home-page .memory-card { grid-template-columns: minmax(0, 42%) minmax(0, 1fr); }
  .home-page .memory-card p { display: none; }
}
