/* ═══════════════════════════════════════════════════════════════
   念宠 · 官网
   结构：严格沿用 nianchong_ritual_preview.html 的 .layout / .intro / .phone
   手机外壳与右栏组件：沿用 官网参考（Ritual preview visual system 终态）
   数值一律照抄，不新造。
   ═══════════════════════════════════════════════════════════════ */

:root{
  --ink:#363c35;
  --cream:#f0ebe1;
  --teal:#93c1c1;
  --line:#49483e;          /* 手机壳与面板描边 */
  --line-hard:#25291e;     /* 按钮描边 + 硬阴影 */
  --ground:#eae5db;        /* 页面底 */
  --blob:#dcded2;

  /* 壳宽：屏比例锁死 850/1850
     壳左右共占 2×9(padding) + 2×2(border) = 22 ⇒ 屏宽 = 壳宽 − 22
     屏高 = (壳宽 − 22) × 2.17647，壳高 = 屏高 + 22
     约束壳高不超过 86svh，反解出壳宽上限 */
  --shell-w:min(392px, 38vw, calc((86svh - 22px) / 2.17647 + 22px));
}

*{box-sizing:border-box}

body{
  margin:0;
  min-height:100svh;
  position:relative;
  background:var(--ground);
  color:var(--ink);
  font-family:system-ui,-apple-system,'PingFang SC','Microsoft YaHei',sans-serif;
}

button,a{touch-action:manipulation;-webkit-tap-highlight-color:transparent}
button{font:inherit;color:inherit;cursor:pointer;border:0;background:none}
a{color:inherit;text-decoration:none}
button:focus-visible,a:focus-visible,summary:focus-visible,textarea:focus-visible{
  outline:3px solid #488587;outline-offset:5px
}

/* ── 页面底纹（ritual preview visual system） ── */
body::before{
  content:'';position:fixed;width:530px;height:530px;left:7%;top:20%;
  background:var(--blob);border-radius:50%;z-index:-2
}
body::after{
  content:'';position:fixed;inset:0;pointer-events:none;
  background-image:radial-gradient(#727b6710 .7px,transparent .7px);
  background-size:7px 7px;z-index:-1
}

/* ═══ 版面 ═══ */
.layout{
  min-height:100svh;
  display:flex;align-items:center;justify-content:center;
  gap:64px;
  padding:24px 24px 64px;
}

/* ═══ 左栏 ═══ */
.intro{width:384px;flex:none}

/* 品牌图标：与「念宠」两个字同高同顶对齐。
   两个数都是用 canvas 实测出来的，「念宠」的墨迹高度 = 0.939em、墨迹顶端离行盒顶端 0.128–0.145em，
   写成 em 后 64 / 47 / 38px 三档字号自动跟着变，不需要再按断点写死像素。
   box-sizing:border-box 是为了让 1.5px 描边算在 0.94em 里面，否则会比汉字高 3px。 */
.brand-logo{
  flex:none;box-sizing:border-box;
  width:.94em;height:.94em;margin-top:.14em;
  object-fit:cover;border:1.5px solid var(--line);border-radius:24%
}
.brand-name{display:block}

.eyebrow{
  font-size:12px;letter-spacing:3px;color:#78867b;margin:0 0 18px
}

h1{
  font-size:64px;line-height:1.2;font-weight:650;letter-spacing:5px;
  margin:0 0 20px;
}
h1.brand{display:flex;align-items:flex-start;gap:14px}
h1 span{position:relative}
/* 品牌英文名，紧贴中文名下方 */
h1 small{
  display:block;font-size:12px;font-weight:400;
  letter-spacing:5px;text-transform:none;
  color:#98a18b;margin-top:7px
}

h2{
  font-size:30px;line-height:1.6;font-weight:500;letter-spacing:0;
  margin:0 0 18px
}

.description{
  font-size:14px;line-height:1.95;letter-spacing:0;color:#76786e;margin:0 0 25px
}

/* ── 下载面板 ── */
.download-panel{
  padding:24px;background:var(--cream);
  border:1.6px solid var(--line);border-radius:27px
}
.download-panel>p{font-size:13px;color:#85847b;margin:0 0 14px}

.downloads{display:flex;gap:12px}
.download{
  display:flex;align-items:center;justify-content:center;gap:10px;
  flex:1;min-width:0;padding:11px 12px;
  background:#e4eacb;color:#24291f;
  border:1.5px solid var(--line-hard);border-radius:40px;
  box-shadow:0 5px 0 var(--line-hard);
  font:600 16px system-ui,-apple-system,'PingFang SC',sans-serif;
  white-space:nowrap;
  transition:transform .2s;
  /* 左边是 <a>（跳 App Store），右边是 <button>（只弹提示）—— 两枚必须长得一模一样。
     下面两行就是抹掉 button 的 UA 外观差异。 */
  -webkit-appearance:none;appearance:none;cursor:pointer
}
.download.android{background:#f8f2e6}
.download:hover{transform:translateY(-2px)}
.download:active{transform:translateY(3px);box-shadow:0 2px 0 var(--line-hard)}
.download small{display:block;font-size:10px;margin-bottom:3px;letter-spacing:1px}
.download svg{width:22px;height:28px;fill:currentColor;flex:none}
/* 安卓机器人：与左边的水果图标同排，正方形源图 ⇒ 按高给 24，光学重量才接近 */
.dl-icon{width:24px;height:26px;object-fit:contain;flex:none}

.download-panel nav{
  display:flex;justify-content:center;gap:15px;align-items:center;margin-top:23px
}
.download-panel nav button{font-size:12px;color:#60786a;padding:0}
.download-panel nav button:hover{text-decoration:underline;text-underline-offset:5px}
.download-panel nav span{color:#98a18b;font-size:12px}

/* ── 两枚仪式卡 ── */
.ritual-links{
  display:grid;grid-template-columns:1fr 1fr;gap:12px;margin-top:17px
}
.ritual-links button{
  display:flex;align-items:center;gap:12px;text-align:left;
  padding:12px;background:#f5f1e8;
  border:1px solid #b8bdb0;border-radius:17px;
  transition:background .2s,border-color .2s
}
.ritual-links img{width:48px;height:48px;object-fit:contain;flex:none}
.ritual-links b{display:block;font-weight:500;font-size:14px}
.ritual-links small{display:block;color:#81887b;font-size:10px;margin-top:5px}
.ritual-links button:hover{background:#e4eacb;border-color:#7c9c8c}
.ritual-links button[aria-pressed="true"]{background:#e4eacb;border-color:#7c9c8c}

/* ═══ 右栏：手机（带壳） ═══ */
/* DOM 里文案块在前、手机块在后：宽屏 row 自然是「文案左 / 手机右」，
   窄屏 column 自然是「文案上 / 手机下」。两边都不需要 order。 */
.phone-wrap{
  flex:none;
  width:var(--shell-w)
}

.phone{
  position:relative;
  padding:9px;
  background:var(--cream);
  border:2px solid var(--line);
  border-radius:44px;
  box-shadow:0 9px 0 #34382f, 0 25px 60px #5e614020
}

/* 三枚侧键 */
.side-key{
  position:absolute;left:-5px;width:4px;
  background:var(--cream);
  border:1.5px solid var(--line);border-radius:4px
}
.key-one{top:80px;height:22px}
.key-two{top:120px;height:42px}
.key-three{left:auto;right:-5px;top:125px;height:57px}

.phone-screen{
  position:relative;
  border:1.5px solid var(--line);
  border-radius:32px;
  overflow:hidden;
  background:#eac39a;
  container-type:inline-size;
  isolation:isolate;
  aspect-ratio:850 / 1850
}

/* ═══ 主题层 ═══
   真实 App 素材：四套装修主题各一张（薄荷庭院 / 云庭 / 梨园晚风 是动态 webp，云梯是静态 jpg）。
   铺法与 iOS `stageBackground(size:)` 逐字一致：`scaledToFill` + `clipped` ⇒ CSS 的 object-fit:cover。
   ⚠️ 源图都是 2000×2000 方图，cover 到 850:1850 的竖屏 ⇒ **横向两侧各裁掉约 23%**，
      这不是 bug，是 iOS 端一模一样的行为（换景前我按这个裁切逐套看过构图）。
   动效不是自己加的 —— 帧本身就是主题自带的动画，⛔ 别再叠 CSS 光效。 */
.theme{
  position:absolute;inset:0;width:100%;height:100%;
  object-fit:cover;z-index:0;pointer-events:none
}

/* ═══ 家具层 ═══
   花毯 + 花灯（`rug_20261110_fykr` / `lamp_20261110_cxdr`，都是 440×804 整层注册画布）。
   铺法照抄 iOS `decoLayer(size:)`：按舞台满高、宽 = 高 × 440/804、画布中心对屏中心、
   再整体上移 furnitureLift（2%H）。⚠️ 画布比屏宽 ⇒ 横向两侧会被 overflow:hidden 裁掉，那是预期。 */
.deco{
  position:absolute;left:50%;top:-2%;height:100%;
  aspect-ratio:440 / 804;
  translate:-50% 0;
  z-index:1;pointer-events:none
}

/* ═══ 宠物层 ═══
   包内形象 `scene_pet/buou_mask.png`（布偶猫 = 八戒，1152×1536 出图画布，已抠透明）。
   三个比例是按 room.png 那张截图反推的，落位与它一致：
     画布高 42.3%H ⇒ 猫的墨迹落在屏 y 58.1%–75.0%、x 21%–79%（截图里是 59%–76% / 21%–78%）。
   `translate` 与 `scale` 是两个**独立属性**，所以呼吸不用跟定位抢 transform。
   呼吸支点取 50% 78%（猫的脚线），蜷睡时看起来是背在起伏。 */
.pet{
  position:absolute;left:50%;top:42%;height:42.3%;
  aspect-ratio:1152 / 1536;
  translate:-50% 0;
  transform-origin:50% 78%;
  z-index:3;pointer-events:none;
  animation:breathe 5.5s ease-in-out infinite
}
@keyframes breathe{50%{scale:1 1.012}}

/* 地面光 / 接触阴影 / 暖光 veil
   坐标按新主题（薄荷庭院）重算：猫的墨迹落在屏 y 68.1%–75.0%、x 28%–69%，
   所以影子贴着 75% 那条线、横向跟着猫身。 */
.ground-light{
  position:absolute;left:14%;top:52%;width:62%;height:20%;border-radius:50%;
  background:radial-gradient(ellipse,#fff5b9a8,#ffe6a445 42%,transparent 74%);
  z-index:2;opacity:0;pointer-events:none
}
.contact-shadow{
  position:absolute;left:30%;top:74.3%;width:40%;height:2%;border-radius:50%;
  background:#96562f;filter:blur(5px);opacity:0;z-index:2;pointer-events:none
}
.warm-veil{
  position:absolute;inset:0;
  background:radial-gradient(ellipse at 50% 62%,#fff3d5,#f8e8c8);
  opacity:0;z-index:4;pointer-events:none
}

/* 礼物 */
.offering{
  position:absolute;left:4.8%;top:73.7%;width:29%;z-index:3;
  opacity:0;transform-origin:65% 90%;
  filter:drop-shadow(0 3px 2px #72552c24);
  pointer-events:none
}
.offering img{width:100%;display:block}
.offering.flower{left:5%;top:73.6%;width:30%}

/* 烛火 */
.flame{
  position:absolute;width:5%;height:10%;left:49.6%;top:-1.5%;
  background:radial-gradient(ellipse at 50% 73%,#fffbe5 0 25%,#ffdf7e 50%,#eebd57 75%,transparent 80%);
  border-radius:70% 30% 60% 40%;
  transform-origin:50% 100%;
  filter:drop-shadow(0 0 6px #ffd571);
  opacity:0;animation:flicker 1.8s ease-in-out infinite
}
.flame::after{
  content:'';position:absolute;inset:-130%;border-radius:50%;
  background:radial-gradient(#ffdf7a55,transparent 65%);z-index:-1
}
@keyframes flicker{50%{transform:scale(.90,1.07) rotate(3deg)}}

.candle-aura{
  position:absolute;left:13%;top:72%;width:14%;height:7%;border-radius:50%;
  background:radial-gradient(ellipse,#ffe6a966,transparent 70%);
  pointer-events:none;z-index:2;opacity:0
}

/* 颗粒：烛光金点（生日）/ 花瓣（忌日） */
.particles{position:absolute;inset:0;pointer-events:none;z-index:4}
.mote{position:absolute;opacity:0;will-change:transform,opacity}
.mote.gold{
  width:.65%;height:.3%;background:#fff6c6;border-radius:50%;
  box-shadow:0 0 7px #ffefab
}
.mote.petal{
  width:1.5%;height:.8%;border-radius:80% 20% 70% 30%;
  background:linear-gradient(130deg,#fff7dc,#e7c58f);
  box-shadow:inset 1px 0 2px #fff9e7aa
}

/* 仪式文案 */
.ritual-caption{
  position:absolute;top:86%;left:8%;right:8%;text-align:center;
  font-size:4.7cqw;line-height:1.7;color:#5e644b;
  opacity:0;letter-spacing:.08em;text-shadow:0 1px 8px #fff3cd;
  pointer-events:none
}
.ritual-caption small{
  display:block;font-size:3.2cqw;letter-spacing:.06em;margin-top:1cqw;color:#77765f
}

/* 状态卡 —— 手机壳展示的是**陪伴态**，对应原型 `html[data-sit="1"]`：
   顶栏整组退场、卡片收缩成一枚**裸胶囊**、只剩「回到小家」。
   🔴 卡体自己不画背景与描边：原型里这两条被抹成 transparent，用户 2026-11-06 **连说两次**
      「回到小家按钮不要外层那个卡片」⇒ 屏上只有一枚胶囊浮在房间上，⛔ 别给卡加回米底或描边。
   几何按原型换算（原型卡 168×74 在 393×852 屏上）：
     卡宽 = 168/393 = 42.75% 屏宽 → 42.75cqw；
     卡底距屏底 = 35/852 = 4.1%；
     出口钮 = 134×48 → 撑满卡内宽；高度按原型 48/852 = 12.2cqw，但用户 2026-11-18 要求
     「刷新按钮加高一点」⇒ 现在 **14.2cqw**（@390 屏 45.2px，比原型高 6.7px）。 */
.phone-card{
  position:absolute;left:50%;bottom:4.1%;
  width:42.75cqw;
  translate:-50% 0;
  background:none;border:0;
  z-index:5;transition:none
}
/* 标题与副文由 JS 的 render() / applyIdle() 写入 —— ⛔ 不能删元素（会 null 抛错），只能隐藏。 */
.phone-card b{
  font-size:4.65cqw;font-weight:600;line-height:1.45;margin:0;
  letter-spacing:-.04em;display:block
}
.phone-card>p{
  font-size:3.3cqw;color:#85847b;margin:0;line-height:1.4
}
/* 🔴 出口钮 = 原型的 `.state-card .sc-btn--ghost`（design/index.html:1975-1977）**逐条照搬**：
     `background: transparent` —— 只描边、不填底。
   用户 2026-11-18：「按钮应该是透明的啊」⇒ 底色必须是 `transparent`，
   ⛔ 别给回 `#f8f2e6` 之类的米底，也别用 `rgba(248,242,230,.9)` 这种「半透明」蒙混。
   保留的两件都是原型也有的、且**不构成不透明**：
     · `1.5px solid var(--line-hard)` 描边（原型 `1.5px solid var(--ink)`）；
     · 唇边 `box-shadow: 0 .8cqw 0 var(--line-hard)`（原型 `0 4px 0 0 var(--ink)`）——
       它是键抬起来的那层底，本身是**实心深色**，但它画在按钮**盒子外面**，
       按钮内部仍是全透明的，房间画面直接透出来。
   字色保持深墨：底下的薄荷庭院地面是浅陶土色（约 #E8B49A），
   #24291f 在其上对比 ≈ 9:1，透明底不影响可读性。
   ⚠️ 2026-11-18 起这枚钮是「换个场景」：钮里多了一枚图标，所以 display 从 block 改 flex
      （`gap` 管图文间距）。高度 12.2 → **14.2cqw**（用户「加高一点」），
      字号 3.9 → **4.6cqw**（用户「换个场景字体放大」，@390 屏 12.4 → 14.6px）。
   图标**不能**走 CSS mask：第一版用 `span` + `background:currentColor` + `mask:url(switch.png)`
   做的，实测那个 `switch.png` 一次都没被请求（`performance` 里 0 条），mask 图加载不出来时
   元素按「整块透明」渲染 ⇒ 屏上什么都没有，用户原话「icon 没加」。改成真实 `<img>` 才稳。
   图片本身已经染成 `#24291f`（与字色同一个值），所以不需要 filter / mask 再调色。 */
.phone-card button{
  display:flex;align-items:center;justify-content:center;gap:1.8cqw;
  width:100%;height:14.2cqw;padding:0;
  background:transparent;color:#24291f;
  border:1.5px solid var(--line-hard);border-radius:30cqw;
  box-shadow:0 .8cqw 0 var(--line-hard);
  font-size:4.6cqw;font-weight:600;letter-spacing:.02em;white-space:nowrap
}
/* 图标 = `tubiao-reload.png`（用户 2026-11-18 提供：手指 + 回转箭头），已裁到墨迹边界、染成字色、存 160²。
   6.2cqw ≈ 19.7px @390 屏。⚠️ 这颗图笔画细，逐档渲染看过：12px 是一团糊、15px 只像个钩子、
   18px 勉强、**20px 起才一眼认得出「手 + 回转箭头」** ⇒ 别为省空间往下压。 */
.phone-card .btn-ico{
  flex:none;width:6.2cqw;height:6.2cqw;object-fit:contain;
  display:block;pointer-events:none
}
.phone-card button:active{transform:translateY(.5cqw);box-shadow:0 .4cqw 0 var(--line-hard)}
/* 屏读专用，不占流 */
.phone-card #sceneStatus{
  position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);
  margin:0
}

/* 屏里只留按钮：标题 / 副文隐掉（:not(#sceneStatus) 保住那条屏读专用文本） */
.phone-card b,.phone-card>p:not(#sceneStatus){display:none}

/* ═══ 换场景的交叉淡出层 ═══
   点「换个场景」时，JS 把**旧的那一组 theme/rug/lamp 克隆一份**塞进这个层，铺在新场景上方淡到 0。
   为什么不直接给 `.theme` 做 opacity 过渡：毯和灯是两张独立的图，只淡背景会留下「旧毯闪一下」。
   也不做「先淡出再换 src」——中间会露 200ms 的空屏。
   `isolation:isolate` 必须留着：层内 `.theme` 的 z-index:0 与 `.deco` 的 z-index:1 要被包在这里面，
   否则会跟外面那组打架（同 z-index 靠 DOM 顺序取胜，一乱就是毯子盖住背景）。
   z-index 取 1：在装修层之上、宠物层（3）之下 ⇒ 换场景时猫不动，只有房间在换。 */
.scene-ghost{
  position:absolute;inset:0;z-index:1;pointer-events:none;
  isolation:isolate
}

.phone-caption{
  text-align:center;font-size:12px;color:#76786e;
  margin-top:26px;letter-spacing:1px;text-wrap:balance
}

/* ═══ 页脚 ═══ */
footer{
  position:absolute;bottom:18px;left:4.5%;right:4.5%;
  display:flex;justify-content:center;align-items:center;
  font-size:11px;letter-spacing:2px;color:#81887b
}
footer small{font:10px system-ui,sans-serif;letter-spacing:1px}
/* 「关于念宠」从下载面板挪到版权旁：做成可点感，但不抢主视觉 */
footer small .dot{color:#c6cbbd;margin:0 1px}
footer small button{
  padding:0;color:inherit;
  text-decoration:underline;text-underline-offset:4px;text-decoration-color:#c6cbbd
}
footer small button:hover{color:#60786a;text-decoration-color:#60786a}
/* 备案号：与「关于念宠」同族（可点、细下划线），⛔ 不要做成醒目链接 —— 它是合规信息不是入口。
   跳 https://beian.miit.gov.cn/ 是工信部的规矩：网站底部备案号要能点回备案系统。 */
footer small .icp{
  color:inherit;
  text-decoration:underline;text-underline-offset:4px;text-decoration-color:#c6cbbd
}
footer small .icp:hover{color:#60786a;text-decoration-color:#60786a}

/* 语言切换：与上面两条（「关于念宠」「备案号」）**同一族** —— 继承色、细下划线、
   hover 变 #60786a。⛔ 不要做成醒目按钮/胶囊：它跟备案号一样是页脚附属信息，
   不是主入口，做成按钮会把「换语言」抬到和「了解这个产品」同等重量。 */
footer small .lang{
  color:inherit;
  text-decoration:underline;text-underline-offset:4px;text-decoration-color:#c6cbbd
}
footer small .lang:hover{color:#60786a;text-decoration-color:#60786a}

/* ═══ 轻提示 ═══
   Android 按钮点了用它回一句话。位置固定底部居中（避开页脚那条 absolute 行），
   纸色底 + 深墨字 + 与按钮同一套描边/硬投影 —— 别改成纯黑半透明那种通用 toast，跟整站不搭。
   `translate` 与 `opacity` 一起过渡，出场时往上挪 6px。 */
.site-toast{
  position:fixed;left:50%;bottom:56px;translate:-50% 0;
  /* ⛔ `width:max-content` 不能省：fixed + left:50% 时，可用宽度只算右半屏（390 屏 = 195px），
     不加这行文字会被压成三行、盒子瘦成半屏。max-content 让它按文字自然宽度撑开，
     再由 max-width 兜住小屏。 */
  width:max-content;max-width:min(86vw,380px);
  padding:12px 20px;
  background:var(--cream);color:#24291f;
  border:1.5px solid var(--line-hard);border-radius:20px;
  box-shadow:0 5px 0 var(--line-hard);
  font-size:13px;line-height:1.5;text-align:center;
  opacity:0;pointer-events:none;z-index:60;
  transition:opacity .22s ease-out,translate .22s ease-out
}
.site-toast.is-on{opacity:1;translate:-50% -6px}

/* ═══ 对话框 ═══ */
dialog{
  border:1.6px solid var(--line);border-radius:26px;
  background:var(--cream);color:var(--ink);
  padding:24px 32px 30px;
  width:min(620px,calc(100% - 32px));max-height:88svh;overflow:auto;
  box-shadow:0 24px 100px #23352840
}
dialog::backdrop{background:#35423965;backdrop-filter:blur(7px)}
.dialog-head{
  display:flex;justify-content:space-between;align-items:center;
  font-size:14px;padding-bottom:20px;letter-spacing:1px
}
.dialog-head button{
  border:1px solid var(--line);background:#f8f2e6;
  border-radius:50%;width:32px;height:32px;font:24px Arial;line-height:1
}
dialog h2{font-size:28px;font-weight:600;margin:6px 0 0}
dialog h3{font-size:27px;line-height:1.5;font-weight:500;margin:14px 0 20px}
dialog p{line-height:1.9;font-size:14px;color:#76786e;margin:0 0 12px}
dialog .eyebrow{font-size:11px;letter-spacing:2px;margin:4px 0 0}

details{padding:17px 0;border-top:1px solid #d5d9c9}
summary{cursor:pointer;font-size:15px;list-style:none}
summary::-webkit-details-marker{display:none}
/* ⚠️ 这里必须是 `.plus` 而不是宽松的 `summary span`：问题文字为了支持多语言被包进了
   一个 `<span class="q">`，若规则仍写成 `summary span`，那层文字也会被 float:right。 */
summary .plus{float:right;color:#8e9488}
details p{margin:10px 0 0;color:#76786e;font-size:14px}

.moment-options{display:grid;grid-template-columns:1fr 1fr;gap:12px;margin-top:6px}
.moment-options button{
  padding:10px 12px 20px;text-align:left;
  border:1px solid #b8bdb0;border-radius:17px;background:#e4eacb
}
.moment-options button:nth-child(2){background:#f8f2e6}
.moment-options button:hover{border-color:#7c9c8c}
.moment-options img{width:100%;height:180px;object-fit:contain}
.moment-options b{display:block;font-size:20px;font-weight:500}
.moment-options span{display:block;font-size:12px;margin-top:10px;color:#81887b}

textarea{
  display:block;width:100%;min-height:250px;resize:vertical;
  padding:20px;font-size:17px;line-height:2;color:var(--ink);font-family:inherit;
  background:#fffaf0;border:1px solid #dedbcc;border-radius:12px;
  outline-color:var(--teal)
}
.letter-controls{
  display:flex;justify-content:space-between;align-items:center;gap:10px;margin-top:20px
}
.letter-controls small{font-size:11px;color:#858775}
.letter-controls button{
  padding:13px 18px;border-radius:30px;
  border:1.5px solid var(--line-hard);background:#e4eacb;
  box-shadow:0 4px 0 var(--line-hard);font-weight:600
}
.letter-controls button:active{transform:translateY(2px);box-shadow:0 2px 0 var(--line-hard)}
#letterStatus{font-size:13px;margin:14px 0 0;color:#60786a}

/* ═══ 窄屏：单列，**文案在上、手机在下**（与 DOM 顺序一致） ═══ */
@media(max-width:900px){
  .layout{
    flex-direction:column;gap:18px;
    padding:24px 16px 24px;min-height:auto
  }
  /* 矮屏上让壳跟着视口高退让，保证能看全整台手机 + caption。
     90svh 用的是「地址栏展开时」的最小视口，最保守。 */
  .phone-wrap{
    width:min(100%, 340px, calc((90svh - 22px) / 2.17647 + 22px))
  }
  .intro{width:min(100%,420px);margin:0 auto}
  /* 手机端：下载面板里那行文字导航（写一封信 · 特别的日子）整行不要 */
  .download-panel nav{display:none}
  /* 「不用打卡…」挪到手机框上方：改成纵向 flex，靠 order 提到前面，DOM 不动 */
  .phone-wrap{display:flex;flex-direction:column}
  .phone-caption{order:-1;margin:0 0 12px}
  /* 手机端 logo + 念宠整块居中（.intro 在重排段是 display:contents，
     h1 盒子已被 margin:auto 居中，这里管的是盒子内部的 flex 排布） */
  h1.brand{gap:11px;justify-content:center}
  /* 墨迹顶端的偏移随字号微变（64px 时 .14em、47px 时 .128em），逐档校到 0.1px 内 */
  .brand-logo{margin-top:.128em}
  .intro h1{font-size:47px;letter-spacing:4px;margin-bottom:15px}
  .intro h2{font-size:24px}
  /* 手机端两块正文居中：.intro 是 display:contents，盒子本身已被 margin:auto 居中，
     这里管的是盒子里的行内文字（h2 里那个 <br> 断出的两行各自居中）。 */
  .intro h2,.description{text-align:center}
  .eyebrow{font-size:11px;letter-spacing:2px}
  .description{font-size:13px}
  .download-panel{padding:19px 14px 20px;border-radius:24px}
  .download{font-size:15px;padding:10px 9px;gap:8px}
  .download small{font-size:11px}
  .ritual-links{gap:10px}
  .ritual-links button{padding:10px;gap:8px}
  .ritual-links img{width:38px;height:38px}
  .ritual-links b{font-size:12px}
  .ritual-links small{font-size:11px}
  body::before{width:350px;height:350px;top:150px;left:calc(50% - 175px)}
  footer{position:static;margin-top:18px;padding:0 6px 24px;font-size:11px}
  footer small{font-size:11px}
  /* 弹窗：375 屏上 32px 边距只剩 273 内容宽，收到 20 */
  dialog{padding:20px 20px 24px}
  /* 「特别的日子」两枚大卡：180px 高的图会把弹窗顶到 98svh */
  .moment-options img{height:130px}
  .moment-options b{font-size:17px}
  textarea{min-height:200px;padding:16px;font-size:16px;line-height:1.9}
}

/* ═══ 手机端重排：文案 → 手机 → 两枚仪式卡（与手机框同宽）→ 尾注 ═══
   做法：拆掉 .intro 盒子（display:contents），让它的子元素直接成为 .layout 的
   flex 子项，再用 order 把仪式卡排到手机之后。纯 CSS，不搬 DOM、不依赖 JS。
   条件限定「非横屏」，横屏那条 row 布局不受影响。 */
@media(max-width:900px) and (min-height:501px){
  .layout{
    /* 手机上「手机框宽」只算一次：手机和仪式卡共用这个值 */
    --shell-w:min(100%, 340px, calc((90svh - 22px) / 2.17647 + 22px))
  }
  .intro{display:contents}
  .intro > *{
    flex:none;
    width:min(100%, 420px);
    margin-left:auto;margin-right:auto
  }
  .intro > h1{order:1}
  .intro > h2{order:3}
  .description{order:4}
  .download-panel{order:5}
  .phone-wrap{order:6;width:var(--shell-w)}
  /* 左右并排。宽度 = 手机框 + 40（两侧各出 20），比屏略宽一圈，
     这样图标与内距可以回到原始值，不用挤。
     窄屏上「手机框 + 40」大过内容宽时，允许再往 .layout 的 16px 内距里吃 8px
     —— 用负 margin 而不是加宽后靠 auto 居中，否则溢出那侧会变成 0 边距、左右不对称。 */
  .ritual-links{
    order:7;
    width:min(calc(100% + 16px), calc(var(--shell-w) + 40px));
    margin-left:-8px;margin-right:-8px;
    grid-template-columns:1fr 1fr
  }
}

/* ═══ 极窄屏（≤359px，iPhone SE 1 / 分屏 / 折叠屏外屏） ═══ */
@media(max-width:359px){
  .download{font-size:14px;padding:9px 7px;gap:6px}
  .download svg{width:18px;height:23px}
  .dl-icon{width:19px;height:21px}
  /* 320 屏：手机框只有 246.8，卡区 286.8（两侧各出 20），两枚各 140.4 */
  .ritual-links{gap:8px}
  .ritual-links button{padding:8px;gap:8px}
  .ritual-links img{width:30px;height:30px}
}

/* ═══ 手机横屏（视口矮于 500）：横屏宽够，改回双列，别把手机压成一条 ═══ */
@media(max-width:900px) and (max-height:500px){
  .layout{
    flex-direction:row;align-items:flex-start;gap:36px;
    padding:20px;min-height:auto
  }
  .phone-wrap{width:calc((88svh - 22px) / 2.17647 + 22px)}
  /* 横屏垂直空间已被 88svh 吃满（390 高时手机壳本身就贴到视口底），
     caption 再往上插 46px 会把壳的下圆角切掉。这里放回壳下方，等于不参与这次上移。 */
  .phone-caption{order:0;margin:26px 0 0}
  .intro{width:340px;margin:0}
  .intro h1{font-size:38px;margin-bottom:12px}
  h1.brand{gap:10px;justify-content:center}
  .brand-logo{margin-top:.145em}
  .intro h2{font-size:20px;margin-bottom:12px}
}

@media(prefers-reduced-motion:reduce){
  /* 主题的动态 webp 换静态图这件事 CSS 管不了（换不了 src），由 app.js 按 SCENES[i].still 换，
     首屏换薄荷庭院的 still、换场景时也换 —— 四套里有动效的三套（薄荷庭院 / 云庭 / 梨园晚风）
     各备了一条 still；云梯本来就是静态图，still 与 theme 同一条。
     ⚠️ 宠物呼吸是 CSS 动画，必须在这里点名关掉 —— 漏了它「尊重系统设置」就是假的。 */
  .flame,.pet{animation:none}
  *{transition:none!important}
}

/* ═══ 英文排版（html[lang="en"]） ═══
   ⚠️ 这一段**只对英文页生效**，中文页的读数逐项比对过、完全没变（中文版式是已验收的成品）。
      每条都写清「因为哪条英文文案、实测多少」，⛔ 不要凭感觉往这里加。
      测量口径：无头 Chromium 真视口（窄屏用精确宽度的 iframe，因为 headless 的
      `--window-size` 会被夹到最小 500px，直接量 390 会得到假数据），
      `Range.getClientRects()` 取行的真实宽度，`scrollWidth > clientWidth+1` 判溢出。

   ① 英文页脚在 390 起就换行。
      `footer small` 的 letter-spacing:1px 是给中文（字少）调的；英文那句
      `© 2026 Pettopia · About Pettopia · 京ICP备… · 中文` 一个字多一个 px，
      390 实测 h32（两行、第二行只剩「· 中文」）⇒ 收到 0 后 h16（一行）。
   ② 备案号本身是中文，夹在英文里还会在 375 被断成 [124.6, 26.4]（`…8940号-` + `4`）、
      320 被断成 [45, 106]；nowrap 后两种宽度都是完整的一个 [133]。合规信息不能在中间断行。
   ③ `.description` 的 line-height:1.95 是中文行距习惯（CJK 需要更大行距才有呼吸）。
      英文实测每行 305.8 / 317（容器 384），行高 1.95 = 27.3px 显得松；
      改 1.7 = 23.8px，块高 1440 档 54.6 → 47.6、320 档 76 → 66.3。
   ④ 以下**实测过但决定不改**，留档免得下次又被当成漏掉：
      · 仪式卡 label 早先折两行（第二行只剩一个「↗」）时加过 `text-wrap:balance`；
        文案换成 `Birthday ↗` / `Flowers ↗` 后，1440/900/390/375/359/320 六档**全部一行**
        （1440 档 70 / 65.3 对可用宽 83 / 100；390 档 61.3 / 57.2 对 91 / 111；
        320 档 61.3 / 57.2 对 83 / 83），该规则已**删除**——
        A/B 实测带它不带它，六档行数与每行宽度逐项完全一致，只有 `text-wrap` 的计算值不同。
      · `.download` 的 white-space:nowrap + 「Download on / App Store」「Get it on / Android」：
        320/375/390/1440 四档 scrollWidth 全部等于 clientWidth，**没有溢出**。
      · `h2` 的 `A lamp that stays lit<br>for the one you miss`：两行 258.6 / 264.5（容器 384），
        390 档 206.8 / 211.8（容器 358），都吃得下，**不需要改**。
      · `dialog h3` 的 `Remembering<br>is also a way of staying.`：1440/390 都是 2 行；
        320 档第二行 278.2 > 容器 240 ⇒ 折成 3 行，断点落在 `is also a way of` / `staying.`，读起来正常。
      · `.phone-caption` 已经带 text-wrap:balance，英文 2 行（320 档 3 行）且断点均衡，不动。 */
html[lang="en"] footer small{
  letter-spacing:0                       /* ① 见上 */
}
html[lang="en"] footer small .icp{
  white-space:nowrap                     /* ② 备案号不许在中间断行 */
}
html[lang="en"] .description{
  line-height:1.7                        /* ③ 见上 */
}

/* ⑤ 「Change scene」在 320 档的保险。
   `.phone-card button` 的 letter-spacing 是 .02em（从中文版式继承的），320 档实测
   卡宽 93px、内容 92.8px（图标 13.8 + 间距 4.0 + 文字 75）⇒ 余量只剩 **0.24px**。
   0.24px 在 Android 默认字体（Roboto 略宽于 system-ui）下就会顶出去。
   归零字距后文字 75 → 72.5、余量 0.24 → **2.71px**。
   ⛔ 只放在 ≤359px 里：360–900 的移动档与桌面档现在看着是对的（余量 5.5–7.4px），别动。 */
@media(max-width:359px){
  html[lang="en"] .phone-card button{letter-spacing:0}
}
