:root {
  /* 画面色调：整体提亮一点、压低对比和饱和，偏小清新。
     场景、飞行中的物品、盒子和暂存区里的物品、菜单缩略图都用它，物品换位置时颜色不跳 */
  --tone: brightness(1.07) contrast(.85) saturate(.9);
  --ink: #4a3526;
  --muted: #a08670;
  --accent: #e8894a;
  --green: #6cbf6a;
  --cream: #fffaf3;
}

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

html, body {
  margin: 0; height: 100%; overflow: hidden;
  /* 浅色底：iOS 状态栏下的渐变和任何露出的边都跟着变浅，不会出现黑条 */
  background: #e9dfd0;
  color: #2b2f36;
  font-family: -apple-system, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  user-select: none; -webkit-user-select: none;
  touch-action: pan-x pan-y;          /* 禁止整页双指缩放，画面缩放由游戏自己处理 */
  overscroll-behavior: none;
}
button { font-family: inherit; }

/* ================================================================
   分层
   #backdrop  房间背景的模糊放大版，铺满屏幕
   #board     房间（关卡坐标 1440×1560），平移 + 缩放由 view.js 控制
   #ui        局内界面（设计单位，整体缩放 --us）
   #fx        飞行动画（屏幕像素）
   #overlay   主界面与弹窗（设计单位，整体缩放 --us）
   ================================================================ */
/* 用 absolute 而不是 fixed：iPhone 主屏幕模式下 fixed 的层会被裁在「扣掉状态栏」的高度里，底部露出一条 */
#app { position: absolute; left: 0; top: 0; width: 100%; height: 100%; overflow: hidden; overflow: clip; background: #e9dfd0; }

#backdrop {
  position: absolute; inset: -60px;
  width: calc(100% + 120px); height: calc(100% + 120px);
  object-fit: cover;
  filter: blur(28px) var(--tone) brightness(.97);
  touch-action: none;
}
#backdrop:not([src]), #backdrop[src=""] { visibility: hidden; }

#board {
  position: absolute; left: 0; top: 0;
  width: var(--room-width); height: var(--room-height);
  transform-origin: 0 0;
  touch-action: none;
  will-change: transform;
  filter: var(--tone);
}
#bg {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  /* 四边羽化，和模糊背景自然衔接 */
  -webkit-mask-image: linear-gradient(to right, transparent, #000 5%, #000 95%, transparent), linear-gradient(to bottom, transparent, #000 4%, #000 96%, transparent);
  -webkit-mask-composite: source-in;
  mask-image: linear-gradient(to right, transparent, #000 5%, #000 95%, transparent), linear-gradient(to bottom, transparent, #000 4%, #000 96%, transparent);
  mask-composite: intersect;
}
#bg[src=""] { visibility: hidden; }

.layer {
  position: absolute; left: 0; top: 0;
  transform-origin: 0 0;
  pointer-events: none;
  /* 安全区（刘海、灵动岛、圆角、底部横条）换算成设计单位；像素值由 view.js 写入 */
  --sat: calc(var(--sa-t, env(safe-area-inset-top, 0px)) / var(--us, 1));
  --sab: calc(var(--sa-b, env(safe-area-inset-bottom, 0px)) / var(--us, 1));
  --sal: calc(var(--sa-l, env(safe-area-inset-left, 0px)) / var(--us, 1));
  --sar: calc(var(--sa-r, env(safe-area-inset-right, 0px)) / var(--us, 1));
}
#ui { z-index: 10; }
#fx { position: absolute; inset: 0; z-index: 20; pointer-events: none; }
#overlay { z-index: 30; }

/* ---------- 顶部（悬浮小胶囊） ---------- */
#hud {
  position: absolute; z-index: 40;
  top: calc(18px + var(--sat)); left: calc(20px + var(--sal)); right: calc(20px + var(--sar)); height: 60px;
  display: flex; align-items: center; gap: 10px;
  pointer-events: none;
}
#hud > * { pointer-events: auto; }
.hud-spacer { flex: 1; pointer-events: none !important; }

.hud-btn, .level-pill, .progress-pill, #zoomReset {
  background: rgba(255, 250, 242, .86);
  -webkit-backdrop-filter: blur(14px) saturate(1.3);
  backdrop-filter: blur(14px) saturate(1.3);
  box-shadow: 0 8px 22px rgba(70, 45, 20, .16), inset 0 0 0 1px rgba(255, 255, 255, .7);
}

.hud-btn {
  width: 52px; height: 52px; flex: none;
  border: 0; border-radius: 50%;
  display: grid; place-items: center;
  cursor: pointer; color: #6b5442;
  transition: transform .15s ease;
}
.hud-btn svg, #zoomReset svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.hud-btn:active { transform: scale(.92); }

.level-pill {
  height: 52px; min-width: 0; max-width: 340px;
  padding: 0 16px 0 8px; border: 0;
  border-radius: 999px;
  display: flex; align-items: center; gap: 10px;
  color: var(--ink); cursor: pointer;
}
.level-pill:active { transform: scale(.97); }
.lv-no {
  min-width: 38px; height: 38px; padding: 0 8px;
  border-radius: 999px;
  display: grid; place-items: center;
  background: var(--accent); color: #fff;
  font: 800 20px/1 ui-rounded, -apple-system, "PingFang SC", sans-serif;
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .12);
}
.level-name { font-size: 24px; font-weight: 800; letter-spacing: .5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.caret { width: 20px; height: 20px; flex: none; fill: none; stroke: var(--muted); stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }

.assist-controls { display: flex; flex: none; gap: 12px; }
.assist-btn {
  min-width: 62px; height: 52px; padding: 0 12px; border: 0; border-radius: 14px;
  background: rgba(255, 250, 242, .93); color: var(--ink);
  box-shadow: 0 4px 12px rgba(70, 45, 20, .17);
  cursor: pointer; white-space: nowrap; font-size: 20px; font-weight: 800;
}
.assist-btn:active { transform: scale(.94); }
.assist-btn:disabled { opacity: .68; cursor: default; }
.assist-btn:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
#autoTidy { min-width: 104px; }

.progress-pill {
  height: 52px; padding: 0 18px 0 8px; flex: none;
  border-radius: 999px;
  display: flex; align-items: center; gap: 6px;
  color: var(--ink);
  font: 800 24px/1 ui-rounded, -apple-system, "PingFang SC", sans-serif;
  font-variant-numeric: tabular-nums;
}
.progress-pill span { font-size: 18px; color: var(--muted); font-weight: 700; }
.ring { width: 38px; height: 38px; transform: rotate(-90deg); margin-right: 4px; }
.ring circle { fill: none; stroke-width: 5; }
.ring-bg { stroke: rgba(160, 134, 112, .22); }
.ring-fg { stroke: var(--green); stroke-linecap: round; stroke-dasharray: 100; stroke-dashoffset: 100; transition: stroke-dashoffset .4s cubic-bezier(.3, .8, .3, 1); }

/* 放大后出现的「还原」 */
#zoomReset {
  position: absolute; z-index: 40;
  right: calc(24px + var(--sar)); bottom: calc(28px + var(--sab));
  height: 56px; padding: 0 22px 0 16px; border: 0; border-radius: 999px;
  display: flex; align-items: center; gap: 8px;
  color: var(--ink); font-size: 20px; font-weight: 800; cursor: pointer;
  opacity: 0; transform: translateY(12px) scale(.9);
  transition: opacity .22s ease, transform .3s cubic-bezier(.3, 1.4, .5, 1);
  pointer-events: none;
}
#zoomReset.show { opacity: 1; transform: none; pointer-events: auto; }
#zoomReset:active { transform: scale(.94); }

/* ---------- 收纳盒 ---------- */
#boxes { position: absolute; z-index: 30; top: calc(112px + var(--sat)); left: 0; right: 0; height: 196px; pointer-events: none; }
#orders {
  height: 100%;
  display: flex; justify-content: center; align-items: center; gap: var(--box-gap, 14px);
  padding: 0 calc(42px + var(--sar)) 0 calc(42px + var(--sal));
}

/* 盒子按数量整体缩放（--k），内部仍用 212×196 的设计尺寸 */
.box {
  position: relative; flex: none; pointer-events: auto;
  width: calc(212px * var(--k, 1)); height: calc(196px * var(--k, 1));
  transform-origin: 0 0;
}
.box-scale { position: absolute; left: 0; top: 0; width: 212px; height: 196px; transform: scale(var(--k, 1)); transform-origin: 0 0; }

/* ---------- 新增收纳盒：像「调度中心」添加桌面那样，从屏幕边缘探出来 ---------- */
#addBox {
  position: absolute; z-index: 2;
  right: var(--sar); top: 50%;
  width: 176px; height: 178px;
  margin-top: -89px;
  border: 0; padding: 0; cursor: pointer;
  border-radius: 26px 0 0 26px;
  background: rgba(255, 250, 242, .55);
  -webkit-backdrop-filter: blur(16px) saturate(1.4); backdrop-filter: blur(16px) saturate(1.4);
  box-shadow: 0 10px 30px rgba(70, 45, 20, .18), inset 0 0 0 1.5px rgba(255, 255, 255, .7);
  color: var(--ink);
  pointer-events: auto;
  transform: translateX(calc(100% - 30px));
  transition: transform .5s cubic-bezier(.2, .9, .25, 1), background-color .3s ease, box-shadow .3s ease, opacity .3s ease;
}
#addBox.peek {
  transform: translateX(-12px);
  background: rgba(255, 250, 242, .82);
  box-shadow: 0 16px 40px rgba(70, 45, 20, .24), inset 0 0 0 1.5px rgba(255, 255, 255, .85);
  border-radius: 26px;
}
#addBox.gone { transform: translateX(calc(100% + 20px)); opacity: 0; pointer-events: none; }
/* 收起时边缘那一条上的「+」 */
.ab-tab {
  position: absolute; left: 0; top: 0; bottom: 0; width: 30px;
  display: grid; place-items: center;
  transition: opacity .25s ease;
}
.ab-tab svg { width: 20px; height: 20px; fill: none; stroke: #8a705a; stroke-width: 2.6; stroke-linecap: round; }
#addBox.peek .ab-tab { opacity: 0; }
/* 探出来以后：虚线的空盒子 + 加号 */
.ab-ghost {
  position: absolute; left: 14px; right: 14px; top: 12px; bottom: 34px;
  opacity: 0; transform: translateX(26px) scale(.9);
  transition: opacity .3s ease .05s, transform .5s cubic-bezier(.2, .9, .25, 1);
}
#addBox.peek .ab-ghost { opacity: 1; transform: none; }
.ab-ghost svg.ab-box { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.ab-box path { fill: rgba(255, 255, 255, .35); stroke: #b89a7e; stroke-width: 3; stroke-dasharray: 9 7; stroke-linejoin: round; }
.ab-plus {
  position: absolute; left: 50%; top: 58%;
  width: 46px; height: 46px; margin: -23px 0 0 -23px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: var(--accent); color: #fff;
  box-shadow: 0 6px 14px rgba(224, 127, 63, .4), inset 0 -2px 0 rgba(0, 0, 0, .12);
  transition: transform .3s cubic-bezier(.3, 1.6, .5, 1);
}
.ab-plus svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; }
#addBox:active .ab-plus { transform: scale(.88); }
.ab-text {
  position: absolute; left: 0; right: 0; bottom: 10px;
  text-align: center; font-size: 16px; font-weight: 800; color: #8a705a; letter-spacing: 1px;
  opacity: 0; transition: opacity .3s ease .08s;
}
#addBox.peek .ab-text { opacity: 1; }
/* 点下去时，空盒子先「被拿走」 */
#addBox.taking .ab-ghost { opacity: 0; transform: scale(1.06); transition: opacity .2s ease, transform .2s ease; }
.box-shell {
  position: absolute; inset: 0;
  transform-origin: 50% 100%;
  filter: drop-shadow(0 14px 16px rgba(60, 38, 18, .28)) drop-shadow(0 2px 3px rgba(60, 38, 18, .18));
}
.box svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }

/* 配色：每个盒子一套 */
.box { --bx: #e2b47c; --bx-in: #a87a4e; --bx-rim: #f2d3a4; --bx-line: #7a5434; }
.box.c-sage   { --bx: #a9c9a0; --bx-in: #6f9468; --bx-rim: #d2e6cb; --bx-line: #4e6a49; }
.box.c-sky    { --bx: #a7c3de; --bx-in: #6d8fb2; --bx-rim: #d3e3f2; --bx-line: #4b6580; }
.box.c-blush  { --bx: #ebb3a6; --bx-in: #b87666; --bx-rim: #f7d6cd; --bx-line: #845045; }
.box.c-butter { --bx: #efd27f; --bx-in: #b9933f; --bx-rim: #f9e8b6; --bx-line: #87692a; }
.box.c-lilac  { --bx: #c5b6de; --bx-in: #8c7ab3; --bx-rim: #e4dcf2; --bx-line: #5f5280; }
.box.locked   { --bx: #7d8794; --bx-in: #4d5560; --bx-rim: #a3acb7; --bx-line: #3a414b; }

.bx-open  { fill: var(--bx-in); }
.bx-wall  { fill: #000; fill-opacity: .16; }
.bx-depth { fill: #000; fill-opacity: .22; }
.bx-backrim { fill: none; stroke: var(--bx-rim); stroke-width: 5; stroke-linecap: round; }
.bx-face  { fill: var(--bx); }
.bx-face-shade { fill: #000; fill-opacity: .07; }
.bx-rimband { fill: var(--bx-rim); }
.bx-gloss { fill: #fff; fill-opacity: .35; }
.bx-line { fill: none; stroke: var(--bx-line); stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; }
.bx-lid-top { fill: var(--bx-rim); }
.bx-lid-lip { fill: var(--bx); }

/* 盒内：只裁掉盒底以下，上方敞口可以露出物品 */
.box-inside {
  position: absolute; inset: 0;
  clip-path: inset(-260px -80px 8px -80px);
  pointer-events: none;
}
.pile-item { position: absolute; left: 0; top: 0; transform-origin: 50% 50%; will-change: transform; }
.pile-item img { display: block; width: 100%; height: 100%; filter: var(--tone); }

/* 标签 */
.bx-label {
  position: absolute; left: 34px; right: 34px; top: 80px; height: 98px;
  border-radius: 16px;
  background: #fffaf1;
  box-shadow: 0 2px 0 rgba(0, 0, 0, .08), inset 0 0 0 2px rgba(122, 84, 52, .12);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px;
}
.bx-icon { width: 46px; height: 46px; object-fit: contain; filter: var(--tone) drop-shadow(0 2px 2px rgba(0, 0, 0, .12)); }
.bx-name { font-size: 18px; font-weight: 800; color: var(--ink); line-height: 1.1; white-space: nowrap; max-width: 132px; overflow: hidden; text-overflow: ellipsis; }
.bx-pips { display: flex; gap: 5px; margin-top: 3px; }
.bx-pips i { width: 10px; height: 10px; border-radius: 50%; background: rgba(122, 84, 52, .16); transition: background-color .2s ease; }
.bx-pips i.on { background: var(--green); animation: pip-on .36s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes pip-on { 0% { transform: scale(.3); } 60% { transform: scale(1.35); } 100% { transform: scale(1); } }

.bx-done-mark {
  position: absolute; inset: 0; border-radius: inherit;
  display: grid; place-items: center;
  background: rgba(255, 250, 241, .9);
  opacity: 0; transform: scale(.6);
  transition: opacity .2s ease, transform .35s cubic-bezier(.3, 1.6, .5, 1);
}
.box .bx-done-mark svg { position: static; width: 56px; height: 56px; }
.bx-done-mark circle { fill: var(--green); }
.bx-done-mark path { fill: none; stroke: #fff; stroke-width: 7; stroke-linecap: round; stroke-linejoin: round; }
.box.complete .bx-done-mark { opacity: 1; transform: none; }

/* 锁住的盒子 */
.box.locked { cursor: pointer; }
.box.locked .bx-label { background: rgba(255, 255, 255, .14); box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .18); color: #fff; }
.bx-lock .lk-body { fill: #ffd27a; stroke: #8a6420; stroke-width: 2.5; }
.bx-lock .lk-shackle { fill: none; stroke: #e9edf2; stroke-width: 5; stroke-linecap: round; }
.bx-lock .lk-hole { fill: #8a6420; }
.box .bx-lock { position: static; width: 40px; height: 40px; }
.box.locked .bx-lock-text { font-size: 19px; font-weight: 800; color: #fff; }
.box.locked .bx-lock-sub { font-size: 14px; color: rgba(255, 255, 255, .65); }
.box.locked:active .box-shell { transform: scale(.97); }

/* 全部收完的空位 */
.box.done .box-shell { filter: none; opacity: .5; }
.box.done .bx-face, .box.done .bx-rimband, .box.done .bx-open { fill: rgba(255, 250, 241, .55); }
.box.done .bx-line { stroke: rgba(255, 250, 241, .95); stroke-dasharray: 8 7; }
.box.done .bx-wall, .box.done .bx-depth, .box.done .bx-face-shade, .box.done .bx-gloss, .box.done .bx-backrim { display: none; }
.box.done .bx-label { background: transparent; box-shadow: none; font-size: 19px; font-weight: 800; color: #fff; text-shadow: 0 1px 3px rgba(0, 0, 0, .35); }

/* ---------- 暂存区 ---------- */
#bufferRow {
  position: absolute; z-index: 30;
  top: calc(330px + var(--sat)); left: 0; right: 0;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  pointer-events: none;
}
.buffer-label {
  writing-mode: vertical-rl;
  padding: 10px 6px;
  border-radius: 12px;
  font-size: 15px; font-weight: 800; letter-spacing: 3px;
  color: #8a705a;
  background: rgba(255, 250, 242, .78);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  box-shadow: 0 6px 16px rgba(70, 45, 20, .12);
  pointer-events: auto;
}
#buffer { display: flex; align-items: center; gap: var(--slot-gap, 9px); pointer-events: auto; }

.slot {
  position: relative; flex: none;
  width: var(--slot, 70px); height: var(--slot, 70px);
  border-radius: 18px;
  background: rgba(255, 250, 242, .62);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  box-shadow: 0 6px 16px rgba(70, 45, 20, .14), inset 0 0 0 1.5px rgba(255, 255, 255, .75);
  display: grid; place-items: center;
  transition: transform .15s ease, background-color .2s ease;
}
.slot::before { content: ""; position: absolute; inset: 13%; border-radius: 12px; border: 2px dashed rgba(160, 134, 112, .32); }
.slot img { position: relative; width: 80%; height: 80%; object-fit: contain; filter: var(--tone) drop-shadow(0 3px 3px rgba(0, 0, 0, .18)); }
.slot.filled { background: rgba(255, 252, 246, .92); cursor: pointer; }
.slot.filled::before { display: none; }
.slot.filled:active { transform: scale(.93); }
.slot img.land { animation: slot-land .34s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes slot-land { 0% { transform: scale(.55); } 60% { transform: scale(1.12); } 100% { transform: scale(1); } }

.slot.locked {
  background: linear-gradient(180deg, #8d97a4, #6f7986);
  box-shadow: 0 6px 16px rgba(40, 45, 55, .22), inset 0 0 0 2.5px #3a414b, inset 0 3px 0 2.5px rgba(255, 255, 255, .18);
  color: #fff; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
}
.slot.locked::before { display: none; }
.slot.locked .bx-lock { width: 40%; height: 40%; }
.slot-lock-text { font-size: 13px; font-weight: 800; letter-spacing: 1px; text-shadow: 0 1px 1px rgba(0, 0, 0, .25); }
.slot.locked:active { transform: scale(.94); }
.slot.shake { animation: item-shake .34s cubic-bezier(.36, .07, .19, .97) both; }

/* 暂存区末尾的「+」 */
.slot-add {
  position: relative; flex: none;
  width: var(--slot, 70px); height: var(--slot, 70px);
  border: 0; padding: 0; cursor: pointer;
  border-radius: 18px;
  display: grid; place-items: center;
  background: rgba(255, 250, 242, .38);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .7);
  color: #8a705a;
  transition: transform .25s cubic-bezier(.3, 1.5, .5, 1), background-color .25s ease, box-shadow .25s ease;
}
.slot-add::before {
  content: ""; position: absolute; inset: 7px; border-radius: 13px;
  border: 2px dashed rgba(138, 112, 90, .45);
  transition: border-color .25s ease, inset .25s ease;
}
.slot-add svg { position: relative; width: 42%; height: 42%; fill: none; stroke: currentColor; stroke-width: 2.8; stroke-linecap: round; transition: transform .35s cubic-bezier(.3, 1.5, .5, 1); }
.slot-add:hover { background: rgba(255, 250, 242, .75); box-shadow: 0 8px 18px rgba(70, 45, 20, .16), inset 0 0 0 2px rgba(255, 255, 255, .9); transform: translateY(-2px); }
.slot-add:hover::before { border-color: var(--accent); inset: 5px; }
.slot-add:hover svg { transform: rotate(90deg); color: var(--accent); }
.slot-add:active { transform: scale(.9); }
.slot-add.gone { pointer-events: none; }

/* ---------- 横屏 / 电脑：盒子在左，暂存区在右 ---------- */
/* 设置里没打开「增加收纳盒和暂存位」时：两个「+」都藏起来，盒子不用给边缘留位置 */
#app:not(.can-expand) #orders { padding: 0 calc(16px + var(--sar)) 0 calc(16px + var(--sal)); }
#app:not(.can-expand) #addBox { transform: translateX(calc(100% + 20px)); opacity: 0; pointer-events: none; }
#app:not(.can-expand) .slot-add { display: none; }

.landscape #boxes { top: calc(96px + var(--sat)); bottom: var(--sab); height: auto; left: var(--sal); right: auto; width: 330px; }
.landscape #orders { flex-direction: column; justify-content: flex-start; align-items: center; padding: 8px 0 50px; }
/* 横屏时，加号面板从左栏底部探出来 */
.landscape #addBox {
  right: auto; top: auto; left: 50%; bottom: 0;
  margin: 0 0 0 -88px;
  border-radius: 26px 26px 0 0;
  transform: translateY(calc(100% - 30px));
}
.landscape #addBox.peek { transform: translateY(-14px); border-radius: 26px; }
.landscape #addBox.gone, #app.landscape:not(.can-expand) #addBox { transform: translateY(calc(100% + 20px)); }
.landscape .ab-tab { right: 0; bottom: auto; width: auto; height: 30px; }
.landscape .ab-ghost { transform: translateY(26px) scale(.9); }
.landscape #bufferRow {
  top: calc(104px + var(--sat)); right: var(--sar); left: auto; width: 330px;
  flex-direction: column; gap: 14px;
}
.landscape .buffer-label { writing-mode: horizontal-tb; padding: 8px 20px; letter-spacing: 6px; border-radius: 999px; }
.landscape #buffer { display: grid; grid-template-columns: repeat(3, var(--slot, 70px)); gap: 12px; }

/* ---------- 飞行动画 ---------- */
.flyer {
  position: absolute; left: 0; top: 0;
  transform-origin: 50% 50%;
  will-change: transform;
  filter: drop-shadow(0 14px 14px rgba(30, 25, 20, .28));
}
.flyer img { display: block; width: 100%; height: 100%; filter: var(--tone); }

/* Face ID 式的确认动画：小号磨砂圆片 + 四段弧收拢成环 + 对勾（尺寸跟界面一起缩放） */
.check-badge {
  position: absolute; left: 0; top: 0;
  width: calc(60px * var(--us, 1)); height: calc(60px * var(--us, 1));
  margin: calc(-30px * var(--us, 1)) 0 0 calc(-30px * var(--us, 1));
  border-radius: 50%;
  background: radial-gradient(circle at 50% 28%, rgba(255, 255, 255, .95), rgba(255, 255, 255, .78) 70%);
  -webkit-backdrop-filter: blur(10px) saturate(1.6); backdrop-filter: blur(10px) saturate(1.6);
  box-shadow: 0 0 0 .75px rgba(255, 255, 255, .9), 0 6px 16px rgba(20, 45, 28, .22), 0 1px 3px rgba(20, 45, 28, .18);
  animation: cb-life .82s cubic-bezier(.3, .7, .3, 1) both;
}
.check-badge svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.cb-glow { fill: #30c15b; opacity: 0; animation: cb-glow .5s ease-out .3s both; }
.cb-ring, .cb-tick { fill: none; stroke: #2fbf5a; stroke-linecap: round; stroke-linejoin: round; }
.cb-ring { stroke-width: 2.6; transform-box: fill-box; transform-origin: center; animation: cb-ring .34s cubic-bezier(.5, 0, .2, 1) both; }
.cb-tick { stroke-width: 3.6; stroke-dasharray: 100; stroke-dashoffset: 100; animation: cb-tick .22s cubic-bezier(.4, 0, .2, 1) .26s both; }
.fast .check-badge { animation-duration: .5s; }
.fast .cb-ring { animation-duration: .2s; }
.fast .cb-tick { animation-duration: .14s; animation-delay: .16s; }
.fast .cb-glow { animation-delay: .18s; }
@keyframes cb-life {
  0%   { opacity: 0; transform: scale(.7); }
  16%  { opacity: 1; transform: scale(1.03); }
  28%  { transform: scale(1); }
  68%  { transform: scale(1); }
  78%  { opacity: 1; transform: scale(1.04); }
  100% { opacity: 0; transform: scale(1.1); }
}
@keyframes cb-ring {
  0%   { stroke-dasharray: 14 11; transform: rotate(-180deg) scale(.86); stroke-opacity: .5; }
  100% { stroke-dasharray: 25 0; transform: rotate(0) scale(1); stroke-opacity: 1; }
}
@keyframes cb-tick { 0% { stroke-dashoffset: 100; opacity: 0; } 8% { opacity: 1; } 100% { stroke-dashoffset: 0; opacity: 1; } }
@keyframes cb-glow { 0% { opacity: 0; } 40% { opacity: .14; } 100% { opacity: .08; } }

/* ---------- 房间物品 ---------- */
#items { position: absolute; inset: 0; }
.item {
  position: absolute;
  pointer-events: none;
  filter: drop-shadow(0 10px 14px rgba(30, 40, 50, .22));
  will-change: transform;
}
.item img { display: block; width: 100%; height: 100%; pointer-events: none; -webkit-user-drag: none; }
.item img.appear { animation: pop-in .3s cubic-bezier(.22, 1.4, .36, 1) both; }
@keyframes pop-in { from { opacity: 0; scale: .55; } to { opacity: 1; scale: 1; } }

.item.assist-target img, .slot.assist-target img {
  filter: drop-shadow(0 0 2px #fff) drop-shadow(0 0 4px #ffe875) drop-shadow(0 0 9px #ffad31);
}
.slot.assist-target img { filter: var(--tone) drop-shadow(0 0 2px #fff) drop-shadow(0 0 4px #ffe875) drop-shadow(0 0 9px #ffad31); }

.item.shake { animation: item-shake .5s cubic-bezier(.36, .07, .19, .97) both; }
@keyframes item-shake {
  0%, 100% { translate: 0 0; }
  9%  { translate: -4px 0; }
  18% { translate: 4px 0; }
  27% { translate: -3.2px 0; }
  36% { translate: 3.2px 0; }
  45% { translate: -2.4px 0; }
  54% { translate: 2.4px 0; }
  63% { translate: -1.2px 0; }
  72% { translate: 0 0; }
}

#hintBubble {
  position: absolute; z-index: 50;
  transform: translate(-50%, -100%);
  padding: 12px 20px;
  border-radius: 14px;
  background: rgba(32, 36, 42, .92);
  color: #fff; font-size: 20px; white-space: nowrap;
  opacity: 0; pointer-events: none;
  transition: opacity .2s ease;
}
#hintBubble.show { opacity: 1; }

/* ---------- 提示 / 弹窗 / 结算 ---------- */
#toast {
  position: absolute; z-index: 95;
  left: 50%; bottom: calc(120px + var(--sab));
  transform: translateX(-50%) translateY(10px);
  padding: 14px 26px; border-radius: 999px;
  background: rgba(30, 34, 40, .88);
  color: #fff; font-size: 22px; white-space: nowrap;
  opacity: 0; pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

#dialog, #win {
  position: absolute; inset: 0; z-index: 90;
  display: grid; place-items: center;
  background: rgba(20, 24, 30, .45);
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
  transition: opacity .2s ease;
  pointer-events: auto;
}
#win { z-index: 92; }
#dialog.hidden, #win.hidden { opacity: 0; pointer-events: none; }

.dialog-card, .win-card {
  width: 480px; max-width: calc(100% - 40px); padding: 40px 34px 32px;
  border-radius: 30px; background: #fff; text-align: center;
  box-shadow: 0 30px 60px rgba(0, 0, 0, .3);
  animation: card-in .26s cubic-bezier(.22, 1.3, .36, 1) both;
}
@keyframes card-in { from { opacity: 0; transform: translateY(18px) scale(.96); } to { opacity: 1; transform: none; } }

.dialog-card h3 { margin: 0 0 12px; font-size: 34px; color: #2b2f36; }
.dialog-card p { margin: 0 0 28px; font-size: 22px; color: #6b7280; line-height: 1.5; }

.dialog-actions { display: flex; gap: 14px; }
.dialog-actions button, .win-actions button {
  flex: 1; padding: 20px; border: 0; border-radius: 18px;
  font-size: 27px; font-weight: 700; cursor: pointer;
  background: var(--accent); color: #fff;
  box-shadow: 0 10px 20px rgba(232, 137, 74, .3);
}
.dialog-actions button.ghost, .win-actions button.ghost { background: #eef1f4; color: #4a5058; box-shadow: none; }
.dialog-actions button:active, .win-actions button:active { transform: translateY(1px); }

.win-art { display: block; width: 150px; height: 120px; margin: -8px auto 0; overflow: visible; }
.win-art .wa-shadow { fill: rgba(90, 60, 30, .12); }
.win-art .wa-open { fill: #a87a4e; }
.win-art .wa-depth { fill: #000; fill-opacity: .2; }
.win-art .wa-face { fill: #e2b47c; }
.win-art .wa-rim { fill: #f2d3a4; }
.win-art .wa-line { fill: none; stroke: #7a5434; stroke-width: 2.6; stroke-linejoin: round; }
.win-art .wa-label { fill: #fffaf1; stroke: rgba(122, 84, 52, .25); stroke-width: 1.5; }
.win-art .wa-tick { fill: none; stroke: var(--green); stroke-width: 3.2; stroke-linecap: round; stroke-linejoin: round; }
.win-art .wa-star { fill: #ffd27a; stroke: #c8902e; stroke-width: 2; stroke-linejoin: round; transform-box: fill-box; transform-origin: center; animation: twinkle 1.8s ease-in-out infinite; }
.win-art .wa-star.s2 { animation-delay: .4s; }
.win-art .wa-star.s3 { animation-delay: .8s; }
.win-art .wa-dot { fill: #f3b45b; transform-box: fill-box; transform-origin: center; animation: twinkle 1.6s ease-in-out infinite; }
.win-art .wa-dot.d2 { animation-delay: .5s; }
.win-art .wa-dot.d3 { animation-delay: 1s; }
@keyframes twinkle { 0%, 100% { transform: scale(1) rotate(0); opacity: 1; } 50% { transform: scale(.72) rotate(12deg); opacity: .75; } }
.win-card h2 { margin: 10px 0 6px; font-size: 42px; color: #2b2f36; }
.win-card p { margin: 0; font-size: 24px; color: #6b7280; }
.win-best { margin: 8px 0 26px; font-size: 19px; color: var(--muted); font-weight: 700; }
.win-best.best { color: #3f9a3d; }
.win-actions { display: flex; gap: 14px; }
.win-home {
  margin-top: 18px; border: 0; background: none; cursor: pointer;
  font-size: 21px; font-weight: 700; color: var(--muted);
  padding: 8px 16px;
}

#loading {
  position: absolute; inset: 0; z-index: 98;
  display: grid; place-items: center;
  background: rgba(20, 24, 30, .35);
  -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
  transition: opacity .2s ease;
  pointer-events: auto;
}
#loading.hidden { opacity: 0; pointer-events: none; }
.spinner {
  width: 54px; height: 54px; border-radius: 50%;
  border: 5px solid rgba(255, 255, 255, .3); border-top-color: #fff;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ================================================================
   主界面
   ================================================================ */
#menu {
  position: absolute; inset: 0; z-index: 70;
  pointer-events: auto;
  transition: opacity .28s ease;
  color: var(--ink);
}
#menu.hidden { opacity: 0; pointer-events: none; }
#menu .hidden { display: none !important; }

.ico { width: 28px; height: 28px; flex: none; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.ico .fill { fill: currentColor; stroke: none; }

.view {
  position: absolute; inset: 0;
  opacity: 0; visibility: hidden; transform: translateY(18px);
  transition: opacity .3s ease, transform .35s cubic-bezier(.2, .9, .3, 1), visibility 0s linear .35s;
}
.view.on { opacity: 1; visibility: visible; transform: none; transition: opacity .3s ease, transform .35s cubic-bezier(.2, .9, .3, 1); }

/* 按钮 */
.btn-primary {
  border: 0; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 16px;
  height: 92px; padding: 0 32px;
  border-radius: 30px;
  background: linear-gradient(180deg, #f39d5f, #e07f3f);
  color: #fff;
  box-shadow: 0 12px 26px rgba(224, 127, 63, .35), inset 0 -4px 0 rgba(0, 0, 0, .1), inset 0 2px 0 rgba(255, 255, 255, .3);
  transition: transform .15s ease;
}
.btn-primary:active { transform: translateY(2px) scale(.99); }
.bp-ico { width: 58px; height: 58px; flex: none; border-radius: 50%; display: grid; place-items: center; background: rgba(255, 255, 255, .95); color: #e07f3f; }
.bp-ico .ico { width: 30px; height: 30px; margin-left: 3px; }
.bp-txt { display: flex; flex-direction: column; align-items: flex-start; min-width: 0; }
.bp-main { font-size: 32px; font-weight: 900; letter-spacing: 2px; line-height: 1.15; }
.bp-sub { font-size: 19px; font-weight: 600; opacity: .92; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }

.btn-glass {
  border: 0; cursor: pointer;
  height: 92px; border-radius: 28px;
  display: flex; align-items: center; justify-content: center; gap: 12px;
  font-size: 25px; font-weight: 800; color: var(--ink);
  background: rgba(255, 252, 246, .8);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  box-shadow: 0 10px 24px rgba(70, 45, 20, .14), inset 0 0 0 1.5px rgba(255, 255, 255, .8);
  transition: transform .15s ease;
}
.btn-glass .ico { width: 32px; height: 32px; color: var(--accent); }
.btn-glass:active { transform: scale(.97); }

.round-btn {
  width: 56px; height: 56px; flex: none;
  border: 0; border-radius: 50%; cursor: pointer;
  display: grid; place-items: center;
  background: #fff; color: #6b5442;
  box-shadow: 0 6px 16px rgba(70, 45, 20, .12);
  transition: transform .15s ease, opacity .2s ease;
}
.round-btn:active { transform: scale(.92); }
.round-btn:disabled { opacity: .35; pointer-events: none; }

.seg { display: inline-flex; padding: 5px; border-radius: 999px; background: rgba(160, 134, 112, .14); }
.seg button {
  border: 0; background: transparent; cursor: pointer;
  padding: 10px 22px; border-radius: 999px;
  font-size: 19px; font-weight: 800; color: #8a705a;
  transition: background-color .2s ease, color .2s ease, box-shadow .2s ease;
}
.seg button.on { background: #fff; color: var(--ink); box-shadow: 0 3px 10px rgba(70, 45, 20, .12); }

/* ---------- 首页 ---------- */
.view-home {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 40px;
  padding: calc(40px + var(--sat)) calc(36px + var(--sar)) calc(40px + var(--sab)) calc(36px + var(--sal));
  overflow: hidden;
  background: #f3e7d6;
}
.home-bg { position: absolute; inset: 0; overflow: hidden; }
.home-bg img { position: absolute; inset: -60px; width: calc(100% + 120px); height: calc(100% + 120px); object-fit: cover; filter: blur(22px) var(--tone); opacity: .8; }
.home-bg::after { content: ""; position: absolute; inset: 0; background: radial-gradient(ellipse at 50% 42%, rgba(255, 248, 236, .5), rgba(255, 244, 228, .9) 72%); }

.home-float { position: absolute; inset: 0; pointer-events: none; }
.home-float img {
  position: absolute; object-fit: contain;
  rotate: var(--r);
  filter: drop-shadow(0 10px 12px rgba(70, 45, 20, .2));
  animation: float-bob 5s ease-in-out infinite;
  opacity: .92;
}
@keyframes float-bob { 0%, 100% { translate: 0 0; } 50% { translate: 0 -16px; } }

.home-hero { position: relative; display: flex; flex-direction: column; align-items: center; }
.home-side { position: relative; width: min(560px, 100%); display: flex; flex-direction: column; gap: 34px; }

.logo { position: relative; width: 300px; height: 277px; }
.logo svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.logo-back, .logo-front { filter: drop-shadow(0 16px 18px rgba(70, 45, 20, .22)); }
.logo-back { filter: none; }
.logo-inside { position: absolute; inset: 0; clip-path: inset(-220px -80px 6px -80px); }
.logo-inside img { position: absolute; object-fit: contain; rotate: var(--r); filter: var(--tone) drop-shadow(0 4px 4px rgba(0, 0, 0, .15)); animation: peek 3.4s ease-in-out infinite; }
@keyframes peek { 0%, 100% { translate: 0 0; } 50% { translate: 0 -9px; } }
.lg-open { fill: #a87a4e; }
.lg-wall { fill: #000; fill-opacity: .16; }
.lg-depth { fill: #000; fill-opacity: .22; }
.lg-backrim { fill: none; stroke: #f2d3a4; stroke-width: 5; stroke-linecap: round; }
.lg-face { fill: #e2b47c; }
.lg-shade { fill: #000; fill-opacity: .07; }
.lg-rim { fill: #f2d3a4; }
.lg-gloss { fill: #fff; fill-opacity: .35; }
.lg-line { fill: none; stroke: #7a5434; stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; }
.lg-line.thin { stroke-width: 2; opacity: .55; }
.lg-label { fill: #fffaf1; stroke: rgba(122, 84, 52, .2); stroke-width: 2; }
.lg-roof, .lg-house { fill: none; stroke: var(--accent); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; }
.logo-spark { position: absolute; left: 0; top: -84px; width: 100% !important; height: 170px !important; inset: auto !important; }
.logo .sp { fill: #ffd27a; stroke: #c8902e; stroke-width: 2.2; stroke-linejoin: round; transform-box: fill-box; transform-origin: center; animation: twinkle 2s ease-in-out infinite; }
.logo .sp.s2 { animation-delay: .6s; }
.logo .sp.s3 { animation-delay: 1.1s; }
.logo .sp-dot { fill: #f3b45b; transform-box: fill-box; transform-origin: center; animation: twinkle 1.7s ease-in-out infinite .3s; }

.title {
  margin: 22px 0 0;
  font-size: 92px; font-weight: 900; letter-spacing: 8px; line-height: 1.05;
  color: #5a3a22;
  text-shadow: 0 4px 0 #fff, 0 -2px 0 #fff, 3px 0 0 #fff, -3px 0 0 #fff, 0 14px 28px rgba(90, 58, 34, .25);
}
.tagline { margin: 12px 0 0; font-size: 25px; color: #8a6a50; font-weight: 600; letter-spacing: 3px; }

.home-progress { display: flex; flex-direction: column; gap: 12px; align-items: center; }
.hp-text { font-size: 22px; color: #8a6a50; font-weight: 600; }
.hp-text b { color: var(--ink); font-size: 26px; font-variant-numeric: tabular-nums; }
.hp-bar { width: 100%; max-width: 420px; height: 12px; border-radius: 12px; background: rgba(160, 134, 112, .2); overflow: hidden; }
.hp-bar i { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, #8fd08b, #5fb65c); transition: width .5s ease; }

.home-actions { display: flex; flex-direction: column; gap: 18px; }
.btn-primary.big { height: 120px; border-radius: 38px; justify-content: flex-start; padding: 0 30px; gap: 22px; }
.btn-primary.big .bp-ico { width: 72px; height: 72px; }
.btn-primary.big .bp-ico .ico { width: 36px; height: 36px; }
.btn-primary.big .bp-main { font-size: 38px; }
.home-row { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }

.landscape .view-home { flex-direction: row; gap: 90px; }
.landscape .home-side { width: 520px; }

/* ---------- 选关 ---------- */
.view-levels { display: flex; flex-direction: column; background: #f6efe4; }
.lv-top { display: flex; align-items: center; gap: 18px; padding: calc(22px + var(--sat)) calc(28px + var(--sar)) 6px calc(28px + var(--sal)); }
.lv-top h2 { margin: 0; font-size: 36px; font-weight: 900; letter-spacing: 2px; }
.lv-count { margin-left: auto; padding: 10px 18px; border-radius: 999px; background: #fff; font-size: 19px; color: var(--muted); font-weight: 700; box-shadow: 0 4px 12px rgba(70, 45, 20, .08); }
.lv-count b { color: var(--ink); font-size: 22px; }
.lv-tools { padding: 12px calc(28px + var(--sar)) 4px calc(28px + var(--sal)); }
.lv-ranges {
  display: flex; gap: 10px; overflow-x: auto;
  padding: 10px calc(28px + var(--sar)) 14px calc(28px + var(--sal));
  scrollbar-width: none; touch-action: pan-x;
}
.lv-ranges::-webkit-scrollbar { display: none; }
.lv-ranges button {
  flex: none; border: 0; cursor: pointer;
  padding: 9px 18px; border-radius: 999px;
  background: rgba(255, 255, 255, .7); color: #8a705a;
  font-size: 17px; font-weight: 800; font-variant-numeric: tabular-nums;
  transition: background-color .2s ease, color .2s ease;
}
.lv-ranges button.on { background: var(--ink); color: #fff; }

.lv-scroll {
  flex: 1; min-height: 0; overflow-y: auto;
  padding: 6px calc(28px + var(--sar)) calc(40px + var(--sab)) calc(28px + var(--sal));
  touch-action: pan-y; -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
}
.lv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(196px, 1fr)); gap: 24px 16px; max-width: 1500px; margin: 0 auto; }
.lv-card { border: 0; padding: 0; background: none; text-align: left; cursor: pointer; color: var(--ink); min-width: 0; }
.lv-card.hide { display: none; }
.lv-thumb {
  position: relative; aspect-ratio: 4 / 5;
  border-radius: 22px; overflow: hidden;
  background: #e6dccd;
  box-shadow: 0 8px 18px rgba(70, 45, 20, .14);
  transition: transform .18s ease;
}
.lv-card:active .lv-thumb { transform: scale(.97); }
.lv-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; filter: var(--tone); }
.lv-thumb::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to bottom, rgba(0, 0, 0, .18), transparent 30%); }
.lv-card .lv-no { position: absolute; z-index: 1; left: 10px; top: 10px; height: 36px; min-width: 36px; font-size: 18px; }
.lv-badge {
  position: absolute; z-index: 1; right: 10px; top: 10px;
  width: 36px; height: 36px; border-radius: 50%;
  display: none; place-items: center;
  background: var(--green); color: #fff;
  box-shadow: 0 3px 8px rgba(40, 90, 40, .3), inset 0 0 0 2.5px #fff;
}
.lv-badge .ico { width: 22px; height: 22px; stroke-width: 3; }
.lv-card.done .lv-badge { display: grid; }
.lv-card.current .lv-thumb { box-shadow: 0 0 0 4px #fff, 0 0 0 8px var(--accent), 0 8px 18px rgba(70, 45, 20, .18); }
.lv-name { margin-top: 10px; font-size: 21px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lv-meta { display: flex; gap: 10px; margin-top: 2px; font-size: 16px; color: var(--muted); font-weight: 600; font-variant-numeric: tabular-nums; }
.lv-best:not(:empty) { color: #3f9a3d; }
.lv-empty { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 120px 0; color: var(--muted); font-size: 22px; }
.lv-empty .ico { width: 64px; height: 64px; stroke-width: 1.6; }

/* ---------- 底部弹层（预览 / 设置） ---------- */
.sheet-wrap { position: absolute; inset: 0; z-index: 5; pointer-events: none; }
.sheet-wrap.on { pointer-events: auto; }
.scrim { position: absolute; inset: 0; background: rgba(40, 28, 18, .45); opacity: 0; transition: opacity .3s ease; }
.sheet-wrap.on .scrim { opacity: 1; }
.sheet {
  position: absolute; left: 50%; bottom: 0;
  width: min(100%, 760px);
  max-height: calc(100% - 30px - var(--sat));
  display: flex; flex-direction: column;
  padding: 12px calc(30px + var(--sar)) calc(30px + var(--sab)) calc(30px + var(--sal));
  border-radius: 40px 40px 0 0;
  background: var(--cream);
  box-shadow: 0 -20px 60px rgba(40, 28, 18, .25);
  transform: translate(-50%, 105%);
  transition: transform .4s cubic-bezier(.2, .9, .3, 1);
}
.sheet-wrap.on .sheet { transform: translate(-50%, 0); }
.sheet-grab { width: 64px; height: 6px; border-radius: 6px; background: rgba(160, 134, 112, .3); margin: 0 auto 14px; flex: none; }

.landscape .sheet {
  bottom: auto; top: 50%;
  border-radius: 40px;
  padding-bottom: 30px;
  max-height: calc(100% - 40px);
  opacity: 0;
  transform: translate(-50%, -46%) scale(.97);
  transition: transform .35s cubic-bezier(.2, .9, .3, 1), opacity .25s ease;
}
.landscape .sheet-wrap.on .sheet { opacity: 1; transform: translate(-50%, -50%); }
.landscape .pv-sheet { width: min(100% - 60px, 900px); }

/* 预览 */
.pv-head { display: flex; align-items: center; gap: 16px; flex: none; }
.pv-no { width: 60px; height: 60px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--accent); color: #fff; font: 900 26px/1 ui-rounded, -apple-system, "PingFang SC", sans-serif; box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .12); }
.pv-title { min-width: 0; flex: 1; }
.pv-title h3 { margin: 0; font-size: 34px; font-weight: 900; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pv-sub { font-size: 18px; color: var(--muted); font-weight: 700; margin-top: 2px; }

.pv-body { display: flex; gap: 26px; margin-top: 20px; min-height: 0; flex: 1; }
.pv-frame {
  position: relative; flex: none;
  width: var(--pvw, 300px); height: var(--pvh, 650px);
  border-radius: 26px; overflow: hidden;
  background: #e6dccd;
  box-shadow: 0 12px 28px rgba(70, 45, 20, .2), inset 0 0 0 1px rgba(255, 255, 255, .5);
}
.pv-stage { filter: var(--tone); position: absolute; left: 0; top: 0; width: var(--room-width); height: var(--room-height); transform-origin: 0 0; transform: scale(var(--pvs, .2083)); }
.pv-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.pv-items { position: absolute; inset: 0; }
.pv-item { position: absolute; opacity: 0; }
.pv-item.in { animation: pv-in .35s cubic-bezier(.22, 1.4, .36, 1) both; }
@keyframes pv-in { from { opacity: 0; scale: .6; } to { opacity: 1; scale: 1; } }
.pv-done-tag {
  position: absolute; left: 12px; top: 12px; z-index: 2;
  display: none; align-items: center; gap: 4px;
  padding: 6px 14px 6px 8px; border-radius: 999px;
  background: var(--green); color: #fff; font-size: 17px; font-weight: 800;
  box-shadow: 0 4px 10px rgba(40, 90, 40, .3);
}
.pv-done-tag .ico { width: 22px; height: 22px; stroke-width: 3; }
.pv-frame.done .pv-done-tag { display: flex; }

.pv-side { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.pv-stats { display: grid; gap: 10px; }
.pv-stat {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 18px; border-radius: 18px; background: #fff;
  font-size: 19px; color: var(--muted); font-weight: 700;
  box-shadow: 0 3px 10px rgba(70, 45, 20, .06);
}
.pv-stat .ico { color: var(--accent); }
.pv-stat b { margin-left: auto; color: var(--ink); font-size: 23px; font-weight: 900; font-variant-numeric: tabular-nums; }
.pv-label { margin-top: 6px; font-size: 20px; font-weight: 900; }
.pv-types {
  flex: 1; min-height: 0; overflow-y: auto;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 10px; align-content: start;
  touch-action: pan-y; overscroll-behavior: contain;
}
.pv-type { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 6px 8px; border-radius: 16px; background: #fff; min-width: 0; }
.pv-type img { width: 48px; height: 48px; object-fit: contain; filter: var(--tone); }
.pv-type span { font-size: 15px; font-weight: 700; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pv-type em { font-style: normal; font-size: 14px; color: var(--muted); font-weight: 700; }

.pv-foot { display: flex; align-items: center; gap: 16px; margin-top: 22px; flex: none; }
.pv-foot .btn-primary { flex: 1; }
.pv-foot .round-btn { width: 72px; height: 72px; }

/* 设置 */
.set-sheet { overflow-y: auto; }
.set-head { display: flex; align-items: center; justify-content: space-between; flex: none; }
.set-head h3 { margin: 0; font-size: 36px; font-weight: 900; letter-spacing: 2px; }
.set-group { margin-top: 18px; padding: 2px 22px; border-radius: 24px; background: #fff; box-shadow: 0 3px 10px rgba(70, 45, 20, .05); flex: none; }
.set-row { display: flex; align-items: center; gap: 16px; padding: 18px 0; border-top: 1.5px solid rgba(160, 134, 112, .14); transition: opacity .2s ease; }
.set-row:first-child { border-top: 0; }
.set-row.off { opacity: .4; pointer-events: none; }
.set-ico { width: 48px; height: 48px; flex: none; border-radius: 15px; display: grid; place-items: center; background: #fbefe2; color: var(--accent); }
.set-ico .ico { width: 27px; height: 27px; }
.set-row.danger .set-ico { background: #fde8e4; color: #c4513e; }
.set-txt { flex: 1; min-width: 0; }
.set-txt b { display: block; font-size: 23px; font-weight: 800; }
.set-txt small { display: block; margin-top: 3px; font-size: 16px; color: var(--muted); font-weight: 600; }

.switch { position: relative; width: 74px; height: 44px; flex: none; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch i { position: absolute; inset: 0; border-radius: 999px; background: #e3dcd3; transition: background-color .25s ease; }
.switch i::after {
  content: ""; position: absolute; left: 4px; top: 4px;
  width: 36px; height: 36px; border-radius: 50%; background: #fff;
  box-shadow: 0 3px 8px rgba(0, 0, 0, .18);
  transition: transform .28s cubic-bezier(.3, 1.4, .5, 1);
}
.switch input:checked + i { background: var(--green); }
.switch input:checked + i::after { transform: translateX(30px); }

.range {
  -webkit-appearance: none; appearance: none;
  width: 230px; height: 10px; border-radius: 10px; flex: none;
  background: linear-gradient(to right, var(--accent) var(--p, 55%), #eadfd2 var(--p, 55%));
  outline: none; cursor: pointer;
}
.range::-webkit-slider-thumb { -webkit-appearance: none; width: 34px; height: 34px; border-radius: 50%; background: #fff; box-shadow: 0 3px 8px rgba(0, 0, 0, .2), inset 0 0 0 2px rgba(232, 137, 74, .4); }
.range::-moz-range-thumb { width: 34px; height: 34px; border: 0; border-radius: 50%; background: #fff; box-shadow: 0 3px 8px rgba(0, 0, 0, .2); }
.vol-val { width: 46px; text-align: right; font-size: 20px; font-weight: 800; color: var(--ink); font-variant-numeric: tabular-nums; }

.btn-soft { flex: none; border: 0; cursor: pointer; padding: 12px 24px; border-radius: 14px; background: #fbefe2; color: #c8692c; font-size: 20px; font-weight: 800; }
.btn-soft:active { transform: scale(.96); }
.btn-danger { flex: none; border: 0; cursor: pointer; padding: 12px 24px; border-radius: 14px; background: #fde8e4; color: #c4513e; font-size: 20px; font-weight: 800; }
.btn-danger:active { transform: scale(.96); }
.set-done { margin-top: 24px; height: 84px; flex: none; }
.set-done .bp-main { font-size: 28px; }
