/* FORM — warm-white / orange / charcoal UI. System fonts only. */
:root{
  --orange:#e9692f;
  --orange-deep:#c4511e;
  --orange-soft:rgba(233,105,47,.16);
  --ink:#262724;
  --ink-2:#3a3c36;
  --muted:#55574f;
  --muted-2:#6a6c64;
  --line:rgba(44,47,39,.14);
  --line-strong:rgba(44,47,39,.22);
  --paper:rgba(253,253,248,.92);
  --paper-solid:#fbfaf6;
  --track:#e8e9e1;
  --charcoal:#2c3229;
  --cream:#efeee9;
  --shadow:0 8px 32px rgba(44,42,32,.12);
  --shadow-dock:0 6px 28px rgba(40,38,28,.12);
  --safe-top:env(safe-area-inset-top,0px);
  --safe-bottom:env(safe-area-inset-bottom,0px);
  --dock-bottom:max(16px,var(--safe-bottom));
  --bar-h:64px;
  --ease:cubic-bezier(.22,.61,.36,1);
  --dur:.28s;
  --radius-sheet:22px;
  --radius-pill:999px;
  --f-cn:Inter,"SF Pro Display",-apple-system,BlinkMacSystemFont,"PingFang SC","Microsoft YaHei",sans-serif;
  font-family:var(--f-cn);
  color:var(--ink);
  background:var(--cream);
  font-synthesis:none;
}
*,*::before,*::after{box-sizing:border-box}
html,body{margin:0;width:100%;height:100%;overflow:hidden}
body{
  background:radial-gradient(ellipse at 58% 32%,#faf9f5 0,#efeee8 70%);
  -webkit-tap-highlight-color:transparent;
}
button,input,label,summary{font:inherit}
button{cursor:pointer;border:0;background:none;color:inherit}
button,summary,label{-webkit-user-select:none;user-select:none;touch-action:manipulation}
:focus{outline:none}
:focus-visible{
  outline:2px solid var(--orange);
  outline-offset:3px;
}
button svg,svg.icon{
  width:20px;height:20px;fill:none;stroke:currentColor;
  stroke-width:1.5;stroke-linecap:round;stroke-linejoin:round;flex-shrink:0;
}
svg use{pointer-events:none}
.svg-defs{position:absolute;width:0;height:0;overflow:hidden}

/* ---------- Stage / chrome stacking ---------- */
#stage,#gl,#interface,.camera-frame{position:fixed;inset:0;width:100%;height:100%}
#stage{touch-action:none}
#gl{z-index:1;display:block;touch-action:none}
.camera-frame{border:0;z-index:0;opacity:0;pointer-events:none}
body[data-mode=ar] .camera-frame{opacity:1}
#interface{z-index:3;pointer-events:none}
[data-ui],button,input{pointer-events:auto}
#interface>[hidden],[hidden]{display:none!important}

/* ---------- Top bar ---------- */
.topbar{
  position:absolute;
  top:max(14px,var(--safe-top));
  left:max(16px,4vw);
  right:max(16px,4vw);
  display:flex;justify-content:space-between;align-items:center;
  z-index:4;
  pointer-events:none;
}
.topbar>*{pointer-events:auto}
.brand{
  display:flex;align-items:center;
  font-size:24px;font-weight:750;letter-spacing:-1.2px;
  line-height:1;
}
.brand-period{color:var(--orange)}
.brand-icon{color:var(--orange);display:flex;margin-right:8px}
.brand-icon svg{height:24px;width:24px;fill:none;stroke:currentColor;stroke-width:1.5;stroke-linejoin:round}
.brand i{height:16px;width:1px;background:#b4b6aa;margin:0 12px}
.brand small{font-size:13px;font-weight:500;letter-spacing:1.6px;color:var(--ink-2)}
.app-version{
  margin-left:8px;
  font-size:13px;font-weight:500;letter-spacing:.04em;
  color:var(--ink-2);
  line-height:1;white-space:nowrap;
}

.icon-button{
  display:flex;align-items:center;justify-content:center;
  width:44px;height:44px;
  border:1px solid var(--line);
  background:rgba(253,253,248,.78);
  border-radius:50%;
  color:var(--ink-2);
  backdrop-filter:blur(14px);
  -webkit-backdrop-filter:blur(14px);
  box-shadow:0 1px 4px rgba(40,38,28,.06);
  transition:background var(--dur) var(--ease),color var(--dur) var(--ease),border-color var(--dur) var(--ease),transform .16s var(--ease);
}
.icon-button:hover{background:#fff;border-color:var(--line-strong)}
.icon-button:active{transform:scale(.96)}
.install-button[hidden]{display:none}

/* ---------- Editorial copy (kept, tightened so the model leads) ---------- */
.intro{position:absolute;left:max(24px,6vw);top:18%;max-width:26rem;max-width:min(26rem,42vw)}
.eyebrow{
  display:flex;align-items:center;
  font-size:11px;letter-spacing:1.8px;color:var(--muted);
  font-weight:550;
}
.eyebrow>span{width:6px;height:6px;border-radius:50%;background:var(--orange);margin-right:8px;flex-shrink:0}
.intro h1{
  font-size:clamp(34px,4.2vw,58px);
  font-weight:520;letter-spacing:-1.8px;line-height:1.18;
  margin:14px 0 12px;color:var(--ink);
}
.intro h1>span{color:var(--orange)}
.intro p{font-size:14px;line-height:1.75;color:var(--muted);letter-spacing:.15px;margin:0}

.object-label{position:absolute;right:max(24px,6vw);top:48%;display:flex;gap:12px;align-items:center}
.label-line{width:28px;height:1px;background:var(--muted-2);opacity:.7;flex-shrink:0}
.object-label b{font-size:11px;letter-spacing:1.5px;font-weight:600;color:var(--ink-2)}
.object-label div>span{display:block;font-size:12px;color:var(--muted);margin-top:6px;letter-spacing:.4px}

.scene-caption{
  position:absolute;
  left:max(24px,6vw);
  bottom:calc(var(--dock-bottom) + var(--bar-h) + 12px);
  display:flex;align-items:center;gap:8px;
  font-size:11px;letter-spacing:.6px;color:var(--muted);
  font-weight:500;
}
.live-dot{width:6px;height:6px;border-radius:50%;background:#5f9a6c;box-shadow:0 0 0 0 rgba(95,154,108,.45);animation:live-pulse 2.4s ease-in-out infinite}
.caption-divider{margin:0 2px;color:#b4b6aa}

/* ---------- Mode dock ---------- */
#mode-bar{
  position:absolute;
  bottom:var(--dock-bottom);
  left:50%;
  transform:translateX(-50%);
  display:flex;align-items:center;gap:8px;
  padding:6px;
  width:min(432px,calc(100% - 24px));
  min-height:var(--bar-h);
  border:1px solid rgba(255,255,255,.85);
  border-radius:28px;
  background:rgba(252,252,248,.94);
  box-shadow:var(--shadow-dock);
  backdrop-filter:blur(24px);
  -webkit-backdrop-filter:blur(24px);
}
.mode-switch{
  display:grid;grid-template-columns:1fr 1fr;flex:1;gap:0;
  background:var(--track);border-radius:var(--radius-pill);padding:3px;
  min-width:0;
}
.mode-switch button{
  display:flex;align-items:center;justify-content:center;gap:7px;
  padding:0 10px;min-height:44px;
  border-radius:var(--radius-pill);
  font-size:13px;font-weight:650;white-space:nowrap;
  color:var(--muted);background:transparent;
  transition:background var(--dur) var(--ease),color var(--dur) var(--ease),box-shadow var(--dur) var(--ease);
}
.mode-switch button.active{
  background:var(--charcoal);color:#fff;
  box-shadow:0 1px 4px rgba(30,32,24,.28);
}
.mode-switch #ar-mode{color:var(--orange-deep)}
.mode-switch #ar-mode.active{background:var(--orange);color:#fff;box-shadow:0 1px 4px rgba(180,70,20,.32)}
.mode-arrow{display:none}
.mode-switch svg{width:18px;height:18px}
#mode-bar .icon-button{
  width:44px;height:44px;flex-shrink:0;
  background:#fff;border-color:var(--line);color:var(--ink-2);
  box-shadow:none;
}
#gesture-toggle.active{color:var(--orange);background:var(--orange-soft);border-color:rgba(233,105,47,.45)}
#toggle-controls.active{color:var(--orange);background:var(--orange-soft);border-color:rgba(233,105,47,.45)}

.touch-hint{
  position:absolute;
  left:50%;transform:translateX(-50%);
  bottom:calc(var(--dock-bottom) + var(--bar-h) + 12px);
  display:flex;gap:7px;align-items:center;
  font-size:12px;font-weight:500;color:var(--muted);
  letter-spacing:.3px;white-space:nowrap;
  padding:6px 10px;
  background:rgba(253,253,248,.55);
  border-radius:99px;
  backdrop-filter:blur(8px);
  -webkit-backdrop-filter:blur(8px);
}
.touch-hint svg{width:13px;height:13px;fill:none;stroke:currentColor;stroke-width:1.4}
/* ---------- AR status / scan ---------- */
#ar-status{
  display:none;position:absolute;left:50%;transform:translateX(-50%);
  bottom:calc(var(--dock-bottom) + var(--bar-h) + 10px);
  width:min(432px,calc(100% - 24px));
  min-height:64px;padding:12px 14px 12px 16px;
  align-items:center;gap:12px;
  border-radius:18px;
  background:rgba(22,34,28,.9);
  backdrop-filter:blur(20px);
  -webkit-backdrop-filter:blur(20px);
  color:#eef4ee;
  box-shadow:0 8px 28px rgba(0,0,0,.18);
}
#ar-status-dot{width:8px;height:8px;background:#d9b374;border-radius:50%;flex-shrink:0}
#ar-status b{font-size:13px;font-weight:600;letter-spacing:-.1px}
#ar-status p{font-size:12px;line-height:1.45;margin:3px 0 0;color:#c2cfc3}
#ar-status>div{flex:1;min-width:0}
#ar-status button{
  display:flex;align-items:center;justify-content:center;gap:5px;flex-shrink:0;
  padding:0 12px;min-height:40px;
  border:1px solid rgba(255,255,255,.28);border-radius:12px;
  background:rgba(255,255,255,.1);color:#f0f6ee;
  font-size:12px;font-weight:600;
  transition:background .16s var(--ease);
}
#ar-status button:hover{background:rgba(255,255,255,.18)}
#ar-status button svg{width:14px;height:14px}
#ar-status button:disabled{opacity:.45;cursor:not-allowed}

body[data-mode=ar]{background:transparent;color:#fff}
body[data-mode=ar] .brand{color:#fff;text-shadow:0 1px 8px #0004}
body[data-mode=ar] .brand small{color:rgba(255,255,255,.86)}
body[data-mode=ar] .brand i{background:rgba(255,255,255,.4)}
body[data-mode=ar] .app-version{color:rgba(255,255,255,.86)}
body[data-mode=ar] .topbar .icon-button{
  color:#fff;background:rgba(23,37,29,.5);border-color:rgba(255,255,255,.34);
}
body[data-mode=ar] #mode-bar .icon-button{
  color:var(--ink-2);background:#fff;border-color:var(--line);
}
body[data-mode=ar] #gesture-toggle.active{
  color:var(--orange);background:var(--orange-soft);border-color:rgba(233,105,47,.45);
}
body[data-mode=ar] .intro,
body[data-mode=ar] .object-label,
body[data-mode=ar] .scene-caption{display:none}
body[data-mode=ar] #ar-status,
body[data-preparing=true] #ar-status{display:flex}
body[data-mode=ar] .touch-hint{
  bottom:calc(var(--dock-bottom) + var(--bar-h) + 86px);
  color:#f3f7f1;text-shadow:0 1px 5px #0009;
  background:rgba(16,28,22,.28);opacity:1;
}
body[data-preparing=true] #ar-status-dot{
  background:none;border:1.5px solid #8c9c88;border-top-color:#f0dec3;
  width:13px;height:13px;animation:spin .9s linear infinite;
}

#scan-guide{
  position:absolute;top:45%;left:50%;transform:translate(-50%,-50%);
  color:#f8f3df;text-align:center;filter:drop-shadow(0 1px 4px #0006);
}
.scan-bracket{width:108px;height:108px;position:relative;margin:auto;animation:breathe 2.8s ease-in-out infinite}
.scan-bracket i{position:absolute;width:24px;height:24px;border:1.5px solid currentColor;color:#f0a35e}
.scan-bracket i:nth-child(1){left:0;top:0;border-right:0;border-bottom:0}
.scan-bracket i:nth-child(2){right:0;top:0;border-left:0;border-bottom:0}
.scan-bracket i:nth-child(3){left:0;bottom:0;border-right:0;border-top:0}
.scan-bracket i:nth-child(4){right:0;bottom:0;border-left:0;border-top:0}
.scan-bracket span{
  position:absolute;left:8px;right:8px;top:15px;height:1px;
  background:linear-gradient(90deg,transparent,#fff9,transparent);
  animation:scan 2.8s ease-in-out infinite;
}
#scan-guide p{font-size:12px;letter-spacing:.6px;margin:20px -40px 0;font-weight:500}

#surface-tip{
  position:absolute;top:calc(50% + 72px);left:50%;transform:translateX(-50%);
  display:flex;align-items:center;
  padding:8px 14px;min-height:36px;
  background:rgba(22,40,30,.55);
  border:1px solid rgba(255,255,255,.22);
  border-radius:30px;color:#fff8dc;font-size:13px;font-weight:550;
  white-space:nowrap;
  backdrop-filter:blur(10px);-webkit-backdrop-filter:blur(10px);
  text-shadow:0 1px 3px #0004;
}
#surface-tip>span{display:inline-block;width:6px;height:6px;background:#ffd58d;border-radius:50%;margin-right:8px}

/* ---------- Toast, fatal, diagnostics ---------- */
#toast{
  position:absolute;
  left:50%;transform:translateX(-50%);
  bottom:calc(var(--dock-bottom) + var(--bar-h) + 14px);
  top:auto;
  background:rgba(32,42,36,.92);color:#f4f6ef;
  padding:11px 18px;min-height:40px;
  border-radius:30px;max-width:min(90%,22rem);width:max-content;
  font-size:13px;font-weight:500;line-height:1.45;
  box-shadow:0 8px 28px rgba(0,0,0,.18);
  animation:toast-in .32s var(--ease) both;
}
body[data-mode=ar] #toast,
body[data-preparing=true] #toast,
#fatal{
  position:absolute;left:24px;right:24px;top:40%;
  text-align:center;font-size:16px;font-weight:600;color:var(--ink);
  background:var(--paper);padding:22px 20px;border-radius:18px;
  box-shadow:var(--shadow);max-width:28rem;margin:0 auto;
}
#fatal p{font-size:13px;color:var(--muted);font-weight:400;margin:8px 0 0;line-height:1.55}
#diagnostics{
  position:fixed;z-index:10;top:calc(var(--safe-top) + 72px);left:16px;
  max-height:30vh;width:min(420px,calc(100% - 32px));overflow:auto;
  background:#102019ed;color:#cfe6ce;border-radius:12px;padding:12px;font-size:10px;
}
#diagnostics pre{white-space:pre-wrap;word-break:break-all;font-size:9px}
#diagnostics button{padding:8px 12px;margin-top:8px;min-height:36px;background:#d8e5cf;color:#263426;border-radius:8px;font-weight:600}

/* ---------- FPS ---------- */
#fps-hud{
  position:absolute;
  right:max(16px,4vw);
  top:max(14px,var(--safe-top));
  height:24px;
  display:flex;align-items:center;gap:6px;
  padding:0 9px 0 8px;
  border-radius:999px;
  background:rgba(23,37,29,.38);
  border:1px solid rgba(255,255,255,.22);
  backdrop-filter:blur(12px);-webkit-backdrop-filter:blur(12px);
  color:#f4f2e9;pointer-events:none;
  font-variant-numeric:tabular-nums;letter-spacing:.4px;
  transition:background .3s ease;
}
#fps-hud i{
  width:6px;height:6px;border-radius:50%;
  background:#8fd08f;box-shadow:0 0 6px #8fd08f99;
  transition:background .3s ease;
}
#fps-hud b{font-size:11px;font-weight:650;min-width:16px;text-align:right;line-height:1}
#fps-hud small{font-size:8px;letter-spacing:.9px;opacity:.7;line-height:1;font-weight:600}
#fps-hud[data-level=mid] i{background:#e8bd7a;box-shadow:0 0 6px #e8bd7a99}
#fps-hud[data-level=low] i{background:#f08a63;box-shadow:0 0 6px #f08a6399}
body[data-mode=ar] #fps-hud{background:rgba(11,20,15,.55)}

/* ---------- Install sheet ---------- */
#install-sheet{
  position:fixed;inset:0;z-index:60;
  display:flex;align-items:flex-end;justify-content:center;
  background:rgba(13,23,17,.42);
  backdrop-filter:blur(6px);-webkit-backdrop-filter:blur(6px);
  padding:16px 12px calc(16px + var(--safe-bottom));
  animation:sheet-dim .28s var(--ease) both;
}
#install-sheet[hidden]{display:none}
.install-panel{
  width:min(440px,100%);
  padding:10px 22px 20px;
  background:var(--paper-solid);color:var(--ink);
  border-radius:22px;
  box-shadow:0 24px 60px rgba(13,23,17,.22);
  animation:sheet-up .36s var(--ease) both;
}
.install-panel::before{
  content:"";display:block;width:36px;height:4px;border-radius:4px;
  background:#d4d5cc;margin:4px auto 16px;
}
.install-panel b{font-size:17px;font-weight:650;letter-spacing:-.3px;display:block}
.install-panel p{margin:10px 0 20px;font-size:14px;line-height:1.7;color:var(--muted)}
.install-actions{display:flex;justify-content:stretch;gap:8px}
.install-actions button{
  border:0;border-radius:var(--radius-pill);
  padding:0 18px;min-height:44px;flex:1;
  font-family:inherit;font-size:14px;font-weight:600;
}
.install-actions .primary{display:none;background:var(--orange);color:#fff}
.install-actions .ghost{background:var(--track);color:var(--ink-2)}
.install-actions .ghost:hover{background:#e0e1d9}

/* ---------- AR loader (dasharray must stay 2π·52 = 326.73) ---------- */
#ar-loader{
  position:absolute;pointer-events:none;
  left:50%;top:44%;transform:translate(-50%,-50%);
  width:132px;height:132px;border-radius:50%;
  display:flex;align-items:center;justify-content:center;
  color:#f6f3e7;
  background:radial-gradient(circle at 50% 38%,#1e2c22d9,#0d1711c4);
  backdrop-filter:blur(14px);-webkit-backdrop-filter:blur(14px);
  box-shadow:0 10px 34px #0000004d,inset 0 1px 0 #ffffff24;
  animation:loader-in .34s var(--ease) both;
}
#ar-loader svg{position:absolute;inset:0;width:100%;height:100%;transform:rotate(-90deg);overflow:visible}
#ar-loader circle{fill:none;stroke-linecap:round}
.loader-track{stroke:#ffffff26;stroke-width:2}
.loader-ring{
  stroke:#f0a35e;stroke-width:2.6;
  stroke-dasharray:326.73;stroke-dashoffset:326.73;
  transition:stroke-dashoffset .42s cubic-bezier(.25,.7,.35,1);
  filter:drop-shadow(0 0 6px #f09a4da8);
}
.loader-copy{position:relative;text-align:center;line-height:1.1;padding:0 16px}
.loader-copy b{display:block;font-size:23px;font-weight:620;letter-spacing:-.6px;font-variant-numeric:tabular-nums}
.loader-copy span{display:block;margin-top:8px;font-size:10px;line-height:1.35;letter-spacing:.3px;color:#d6dcc7;opacity:.9}


/* ---------- AI 纹样生成进度圈（不复用 #ar-loader） ---------- */
#relief-gen-loader{
  position:absolute;pointer-events:none;
  left:50%;top:42%;transform:translate(-50%,-50%);
  width:132px;height:132px;border-radius:50%;
  display:flex;align-items:center;justify-content:center;
  z-index:5;
  color:var(--ink);
  background:radial-gradient(circle at 50% 38%,#f7f4ead9,#efe8d6c8);
  backdrop-filter:blur(14px);-webkit-backdrop-filter:blur(14px);
  box-shadow:0 10px 34px #00000024,inset 0 1px 0 #ffffffcc;
  animation:loader-in .34s var(--ease) both;
}
#relief-gen-loader svg{position:absolute;inset:0;width:100%;height:100%;transform:rotate(-90deg);overflow:visible}
#relief-gen-loader circle{fill:none;stroke-linecap:round}
#relief-gen-loader .loader-track{stroke:#1c1a1228;stroke-width:2}
#relief-gen-loader .loader-ring{
  stroke:var(--orange);stroke-width:2.6;
  stroke-dasharray:326.73;stroke-dashoffset:326.73;
  transition:stroke-dashoffset .42s cubic-bezier(.25,.7,.35,1);
  filter:drop-shadow(0 0 6px #f09a4d88);
}
#relief-gen-loader .loader-copy{position:relative;text-align:center;line-height:1.1;padding:0 16px}
#relief-gen-loader .loader-copy b{display:block;font-size:23px;font-weight:620;letter-spacing:-.6px;font-variant-numeric:tabular-nums;color:var(--ink)}
#relief-gen-loader .loader-copy span{display:block;margin-top:8px;font-size:10px;line-height:1.35;letter-spacing:.3px;color:var(--ink-2);opacity:.92}
body[data-mode=ar] #relief-gen-loader{
  color:#f6f3e7;
  background:radial-gradient(circle at 50% 38%,#1e2c22d9,#0d1711c4);
  box-shadow:0 10px 34px #0000004d,inset 0 1px 0 #ffffff24;
}
body[data-mode=ar] #relief-gen-loader .loader-track{stroke:#ffffff26}
body[data-mode=ar] #relief-gen-loader .loader-copy b{color:#f6f3e7}
body[data-mode=ar] #relief-gen-loader .loader-copy span{color:#d6dcc7}
#relief-submit.is-loading{opacity:.72}

/* ---------- Gesture HUD (functional layout preserved) ---------- */
.gesture-video{position:fixed;left:1px;top:1px;width:2px;height:2px;opacity:.001;pointer-events:none}
.ghud{
  --hud-color:#9d8046;
  position:fixed;z-index:65;
  top:calc(68px + var(--safe-top));
  left:50%;transform:translateX(-50%);
  width:184px;text-align:center;color:var(--hud-color);
  font-family:var(--f-cn);pointer-events:none;
}
.gh-stage{position:relative;width:80px;height:80px;margin:0 auto 5px;isolation:isolate;background:none;border:0;box-shadow:none}
.gh-stage::before{
  content:"";position:absolute;z-index:-1;
  left:8px;right:8px;top:9px;bottom:5px;border-radius:11px;
  background:rgba(46,54,50,.24);border:1px solid rgba(250,247,235,.12);
  box-sizing:border-box;box-shadow:0 2px 12px rgba(0,0,0,.025);
}
.gh-guide,.gh-art{position:absolute;left:0;top:0;width:100%;height:100%}
.gh-guide{overflow:hidden;border-radius:13px}
.gh-art{
  display:block;
  background-image:url('../assets/gesture-guide/focus-c.webp');
  background-size:400% 400%;background-position:0 0;background-repeat:no-repeat;
  filter:url('#gesture-ink');mix-blend-mode:normal;
}
.gh-status{font-size:13px;line-height:1.5;letter-spacing:.08em;margin:0;text-shadow:0 1px 3px rgba(255,255,255,.65);overflow-wrap:break-word;color:#394d43;font-weight:600}
.gh-detail{display:none}
.gh-close{
  position:absolute;right:0;top:-7px;width:44px;height:44px;
  display:flex;align-items:center;justify-content:center;
  pointer-events:auto;border:0;background:transparent;color:#344b40;opacity:.7;
}
.gh-close svg{width:13px;height:13px;fill:none;stroke:currentColor;stroke-width:1.3}
#gesture-sensitivity{display:none}
.ghud.is-ready,.ghud.is-closing,.ghud.is-hit.is-jade{--hud-color:#4a927b}
.ghud.is-error{--hud-color:#a65e45}
.ghud.is-loading .gh-guide{animation:gh-breathe 1.8s ease-in-out infinite}
.ghud.is-loading .gh-stage{opacity:.65}
.gh-fallback{display:none}
.gh-guide.is-fallback .gh-art{display:none}
.gh-guide.is-fallback .gh-fallback{display:block;position:absolute;left:0;right:0;top:31px;font-size:11px}
.gh-corner{display:block;position:absolute;width:13.3%;height:11.7%;border:0 solid currentColor;color:#8d7038;opacity:.9}
.gh-tl{left:20.3%;top:21.9%;border-width:1px 0 0 1px;border-radius:3px 0 0}
.gh-tr{right:20.3%;top:21.9%;border-width:1px 1px 0 0;border-radius:0 3px 0 0}
.gh-bl{left:20.3%;bottom:16.4%;border-width:0 0 1px 1px;border-radius:0 0 0 3px}
.gh-br{right:20.3%;bottom:16.4%;border-width:0 1px 1px 0;border-radius:0 0 3px 0}
.ghud.is-on:not(.is-detected):not(.is-error) .gh-corner{animation:gh-corner-breathe 2.4s ease-in-out infinite}
.ghud.is-detected .gh-corner{color:#3f9c78;opacity:1}
.ghud.is-detected .gh-art{filter:url('#gesture-ink-green')}
.ghud button:focus{outline:1px solid currentColor;outline-offset:-5px;border-radius:50%}
.ghud button:focus-visible{outline:2px solid var(--orange);outline-offset:2px}
.ui-filter-defs{position:absolute;left:0;top:0;pointer-events:none;overflow:hidden}
body[data-mode=ar] .ghud{display:none!important}

/* Gesture-on: copy leaves so the guide can sit in the title area */
.intro,.object-label,.scene-caption,.touch-hint{transition:opacity .35s var(--ease)}
body.gesture-on .intro,
body.gesture-on .object-label,
body.gesture-on .scene-caption,
body.gesture-on .touch-hint{opacity:0;pointer-events:none}
body.gesture-on #toast{top:calc(196px + var(--safe-top));bottom:auto}

/* ---------- Keyframes ---------- */
@keyframes spin{to{transform:rotate(360deg)}}
@keyframes breathe{0%,100%{opacity:.5;transform:scale(.94)}50%{opacity:1;transform:scale(1.02)}}
@keyframes scan{0%,100%{top:16px;opacity:0}50%{top:82px;opacity:.6}}
@keyframes loader-in{from{opacity:0;transform:translate(-50%,-50%) scale(.92)}to{opacity:1;transform:translate(-50%,-50%) scale(1)}}
@keyframes live-pulse{0%,100%{box-shadow:0 0 0 0 rgba(95,154,108,.4)}50%{box-shadow:0 0 0 5px rgba(95,154,108,0)}}
@keyframes toast-in{from{opacity:0;transform:translateX(-50%) translateY(8px)}to{opacity:1;transform:translateX(-50%) translateY(0)}}
@keyframes sheet-dim{from{opacity:0}to{opacity:1}}
@keyframes sheet-up{from{opacity:0;transform:translateY(16px)}to{opacity:1;transform:translateY(0)}}
@keyframes gh-corner-breathe{0%,100%{opacity:.52}50%{opacity:1}}
@keyframes gh-breathe{50%{opacity:.55}}

/* ---------- Responsive: phone ---------- */
@media(max-width:700px){
  .topbar{left:16px;right:16px}
  .brand{font-size:22px}
  .brand small{font-size:12px;letter-spacing:1.2px}
  .brand i{margin:0 10px}
  .intro{left:20px;right:20px;top:96px;max-width:none}
  .intro h1{font-size:30px;letter-spacing:-1.3px;line-height:1.18;margin:10px 0 8px}
  .intro p{font-size:13px;line-height:1.65}
  .eyebrow{font-size:10px;letter-spacing:1.5px}
  .object-label{display:none}
  .scene-caption{left:20px;font-size:11px}
  #mode-bar{bottom:var(--dock-bottom)}
  #fps-hud{right:16px}
}

/* Short phone: shrink chrome so the model keeps the stage */
@media(max-height:720px) and (max-width:700px){
  .intro{top:84px}
  .intro h1{font-size:26px;margin:8px 0 0}
  .intro p{display:none}
  .eyebrow{margin-bottom:0}
}

@media(max-height:620px) and (max-width:700px){
  .intro{top:76px}
  .intro h1{font-size:24px;line-height:1.15;margin-top:6px}
  .intro .eyebrow{display:none}
}

/* Very short / landscape: hide decorative copy, dock compact, sheet to the side */
@media(max-height:520px){
  .intro,.object-label,.scene-caption,.touch-hint{display:none}
  .topbar{top:max(8px,var(--safe-top))}
  #mode-bar{bottom:max(8px,var(--safe-bottom));width:min(360px,calc(100% - 20px));min-height:56px}
  #ar-status{bottom:calc(var(--dock-bottom) + 58px);width:min(360px,calc(100% - 20px));min-height:48px;padding:8px 12px}
  #surface-tip{top:calc(50% + 35px)}
  .scan-bracket{width:70px;height:70px}
  #scan-guide p{margin-top:12px}
  #fps-hud{top:max(8px,var(--safe-top))}
}

/* Desktop: editorial left, tools right, model holds the center */
@media(min-width:1000px){
  .intro{left:5vw;top:22%;max-width:26rem}
  .object-label{top:48%;right:9vw}
  .topbar{left:5vw;right:5vw}
  #fps-hud{right:5vw}
  .scene-caption{left:5vw;bottom:36px}
  #mode-bar,#ar-status{
    left:auto;right:5vw;transform:none;width:360px;
  }
  .touch-hint{bottom:calc(var(--dock-bottom) + 16px);left:50%}
  body[data-mode=ar] .touch-hint{left:50%;transform:translateX(-50%);bottom:calc(var(--dock-bottom) + var(--bar-h) + 86px)}
  body[data-mode=ar] #ar-status{left:auto;right:5vw;transform:none}
}

@media(max-height:720px){
  #ar-loader,#relief-gen-loader{top:40%;width:116px;height:116px}
  .loader-copy b{font-size:20px}
}
@media(max-width:380px){
  .ghud{top:62px}
  .mode-switch button{font-size:12px;gap:5px;padding:0 6px}
  .brand{font-size:20px}
  .brand small,.brand i{display:none}
  .app-version{font-size:12px;margin-left:6px}
}

/* ---------- Reduced motion ---------- */
@media(prefers-reduced-motion:reduce){
  html{scroll-behavior:auto}
  *,*::before,*::after{
    animation-duration:.01ms!important;
    animation-iteration-count:1!important;
    transition-duration:.01ms!important;
  }
  .icon-button:active{transform:none}
  .scan-bracket,.scan-bracket span,
  body[data-preparing=true] #ar-status-dot,
  #ar-loader,.loader-ring,.live-dot,.ghud *{
    animation:none!important;
    transition:none!important;
  }
  #toast,.install-panel,#install-sheet{animation:none}
}


/* ---------- 徽州砖雕浮雕面板（手机键盘换纹样 / 深度与结构） ---------- */
#relief-panel{
  position:absolute;
  left:16px;
  bottom:calc(var(--dock-bottom) + var(--bar-h) + 12px);
  width:min(340px,calc(100% - 32px));
  z-index:4;
  pointer-events:auto;
  padding:10px 12px 10px;
  border-radius:16px;
  background:rgba(252,252,248,.94);
  border:1px solid rgba(255,255,255,.85);
  box-shadow:var(--shadow-dock);
  backdrop-filter:blur(22px);
  -webkit-backdrop-filter:blur(22px);
  color:var(--ink);
}
#relief-panel .relief-row{
  display:flex;align-items:baseline;justify-content:space-between;
  margin:0 0 2px;
}
#relief-panel label,#relief-panel .relief-field-label{
  font-size:11px;font-weight:650;letter-spacing:.08em;color:var(--muted);
}
#relief-panel output{
  font-size:11px;font-variant-numeric:tabular-nums;color:var(--ink-2);
}
#relief-panel input[type=range]{
  -webkit-appearance:none;appearance:none;
  width:100%;height:22px;margin:0 0 8px;background:transparent;
}
#relief-panel input[type=range]::-webkit-slider-runnable-track{
  height:2px;border-radius:2px;background:linear-gradient(90deg,rgba(233,105,47,.18),var(--orange));
}
#relief-panel input[type=range]::-webkit-slider-thumb{
  -webkit-appearance:none;width:16px;height:16px;margin-top:-7px;border-radius:50%;
  background:var(--orange);border:1px solid rgba(0,0,0,.12);
}
#relief-panel input[type=range]::-moz-range-track{
  height:2px;border-radius:2px;background:var(--orange);
}
#relief-panel input[type=range]::-moz-range-thumb{
  width:16px;height:16px;border:0;border-radius:50%;background:var(--orange);
}
#relief-panel .relief-field-label{display:block;margin:2px 0 6px}
#relief-panel .relief-entry{display:flex;gap:6px;align-items:stretch}
#relief-panel,#relief-form,#relief-input,#relief-submit{touch-action:manipulation}
#relief-input{
  flex:1;min-width:0;min-height:40px;padding:0 10px;
  border:1px solid var(--line);border-radius:12px;
  background:#fff;color:var(--ink);font:inherit;font-size:13px;
  -webkit-user-select:text;user-select:text;
}
#relief-submit{
  flex-shrink:0;min-height:40px;padding:0 12px;border-radius:12px;
  border:0;background:var(--charcoal);color:#fff;font:inherit;font-size:13px;font-weight:650;
}
#relief-panel .relief-presets{
  display:grid;grid-template-columns:repeat(4,minmax(0,1fr));
  gap:6px;margin:0 0 10px;
}
#relief-panel .relief-presets button{
  display:flex;flex-direction:column;align-items:center;justify-content:flex-start;
  gap:5px;padding:2px 2px 3px;min-width:0;min-height:0;
  font:inherit;font-size:10px;font-weight:650;letter-spacing:.04em;line-height:1.2;
  color:var(--ink-2);background:transparent;
  border:1px solid transparent;border-radius:12px;
}
#relief-panel .relief-presets button img{
  display:block;width:100%;aspect-ratio:1/1;height:auto;
  object-fit:cover;border-radius:10px;pointer-events:none;background:#f3ead8;
  box-shadow:0 0 0 1px rgba(44,47,39,.10);
}
#relief-panel .relief-presets button span{white-space:nowrap;text-align:center}
#relief-panel .relief-presets button[aria-pressed=true],
#relief-panel .relief-presets button.selected{
  color:var(--ink);background:transparent;
  border-color:transparent;
}
#relief-panel .relief-presets button[aria-pressed=true] img,
#relief-panel .relief-presets button.selected img{
  box-shadow:0 0 0 2px #e0a57c,0 0 0 3px rgba(233,105,47,.18);
}

#relief-panel .control-head{
  display:flex;align-items:center;justify-content:space-between;gap:8px;
  margin:0 0 8px;flex-wrap:wrap;
}
#relief-panel .control-title{
  margin:0;font-size:13px;font-weight:650;color:var(--ink);letter-spacing:.04em;
}
#relief-panel .control-tabs{
  display:inline-flex;gap:2px;padding:3px;
  background:var(--track);border-radius:var(--radius-pill);
}
#relief-panel .control-tabs button{
  background:transparent;color:var(--muted);
  font:inherit;font-size:12px;font-weight:650;
  padding:6px 8px;min-height:32px;min-width:40px;
  border:0;border-radius:var(--radius-pill);
}
#relief-panel .control-tabs [aria-selected=true]{
  color:var(--ink);background:#fff;
  box-shadow:0 1px 3px rgba(40,38,28,.12);
}
#relief-panel .material-options{display:flex;gap:8px}
#relief-panel .material-options button{
  flex:1;display:flex;align-items:center;gap:8px;
  padding:10px 8px;min-height:48px;min-width:0;
  border-radius:14px;background:#f1f1ea;border:1px solid transparent;
  font:inherit;font-size:13px;font-weight:650;color:var(--ink-2);text-align:left;
}
#relief-panel .material-options button.selected,
#relief-panel .material-options button[aria-pressed=true]{
  border-color:#e0a57c;background:#f8eee4;
  box-shadow:0 0 0 1px rgba(233,105,47,.18);color:var(--ink);
}
#relief-panel .material-swatch{
  width:22px;height:22px;border-radius:50%;flex-shrink:0;
  box-shadow:inset -2px -2px 4px #00000022,0 1px 2px #00000014;
}
#relief-panel .material-swatch.carve-brick{background:radial-gradient(circle at 32% 25%,#c5d0d6 0,#7e8f99 48%,#4f5e66 100%)}
#relief-panel .material-swatch.carve-wood{background:radial-gradient(circle at 32% 25%,#d7b48a 0,#8a5a32 48%,#4a2f1c 100%)}
#relief-panel .material-swatch.carve-stone{background:radial-gradient(circle at 32% 25%,#f2f4f6 0,#c8ced4 48%,#8d959c 100%)}
#relief-panel .structure-ends{
  display:flex;justify-content:space-between;
  margin:-4px 0 2px;font-size:11px;color:var(--muted);
}
body[data-mode=ar] #relief-panel .control-title{color:#f3f7f1}
body[data-mode=ar] #relief-panel .control-tabs{background:rgba(255,255,255,.12)}
body[data-mode=ar] #relief-panel .control-tabs button{color:#c2cfc3}
body[data-mode=ar] #relief-panel .control-tabs [aria-selected=true]{color:var(--ink);background:#fff}
body[data-mode=ar] #relief-panel .material-options button{
  background:rgba(255,255,255,.08);color:#e8f0e8;border-color:rgba(255,255,255,.22);
}
body[data-mode=ar] #relief-panel .material-options button.selected,
body[data-mode=ar] #relief-panel .material-options button[aria-pressed=true]{
  background:rgba(233,105,47,.28);color:#fff;border-color:var(--orange);
}


body[data-mode=ar] #relief-panel{
  top:calc(var(--safe-top) + 64px);
  bottom:auto;
  left:12px;
  width:min(250px,calc(46vw - 8px));
  background:rgba(22,34,28,.88);
  border-color:rgba(255,255,255,.28);
  color:#eef4ee;
}
body[data-mode=ar] #relief-panel label,
body[data-mode=ar] #relief-panel .relief-field-label{color:#c2cfc3}
body[data-mode=ar] #relief-panel output{color:#f3f7f1}
body[data-mode=ar] #relief-input{
  background:rgba(255,255,255,.1);color:#f3f7f1;border-color:rgba(255,255,255,.28);
}
body[data-mode=ar] #relief-submit{background:#fff;color:var(--ink)}
body[data-mode=ar] #relief-panel .relief-presets button{
  background:transparent;color:#e8f0e8;border-color:transparent;
}
body[data-mode=ar] #relief-panel .relief-presets button img{background:#f3ead8}
body[data-mode=ar] #relief-panel .relief-presets button[aria-pressed=true],
body[data-mode=ar] #relief-panel .relief-presets button.selected{
  background:transparent;color:#fff;border-color:transparent;
}
body[data-mode=ar] #relief-panel .relief-presets button[aria-pressed=true] img,
body[data-mode=ar] #relief-panel .relief-presets button.selected img{
  box-shadow:0 0 0 2px var(--orange),0 0 0 3px rgba(233,105,47,.35);
}
@media(max-width:700px){
  #relief-panel{left:12px;width:min(340px,calc(100% - 24px))}
}
@media(max-height:720px) and (max-width:700px){
  #relief-panel{padding:8px 10px}
  #relief-panel .relief-presets{display:grid;grid-template-columns:repeat(4,minmax(0,1fr))}
}

/* 自动向下压缩：面板始终底部停靠，用更紧的间距/缩略图给三维主体留出上方空间。 */
#relief-panel[data-compact="1"]{
  padding:6px 8px 7px;
}
#relief-panel[data-compact="1"] .control-head{margin:0 0 4px}
#relief-panel[data-compact="1"] .control-title{font-size:12px}
#relief-panel[data-compact="1"] .control-tabs button{padding:4px 6px;min-height:28px;font-size:11px}
#relief-panel[data-compact="1"] .relief-field-label{margin:1px 0 4px;font-size:10px}
#relief-panel[data-compact="1"] .relief-presets{gap:4px;margin:0 0 6px}
#relief-panel[data-compact="1"] .relief-presets button{gap:2px;padding:1px 1px 2px;font-size:9px}
#relief-panel[data-compact="1"] .relief-presets button img{border-radius:7px}
#relief-panel[data-compact="1"] .relief-entry input,
#relief-panel[data-compact="1"] #relief-submit{min-height:34px}
#relief-panel[data-compact="1"] input[type=range]{margin:2px 0 6px}

#relief-panel[data-compact="2"]{
  padding:3px 8px 4px;
}
#relief-panel[data-compact="2"] .control-head{margin:0 0 1px}
#relief-panel[data-compact="2"] .control-title{font-size:11px}
#relief-panel[data-compact="2"] .control-tabs button{padding:2px 5px;min-height:22px;font-size:11px}
#relief-panel[data-compact="2"] .relief-field-label{display:none}
#relief-panel[data-compact="2"] .relief-presets{gap:2px;margin:0 0 3px}
#relief-panel[data-compact="2"] .relief-presets button{gap:0;padding:0;font-size:8px}
#relief-panel[data-compact="2"] .relief-presets button span{display:none}
#relief-panel[data-compact="2"] .relief-presets button img{
  width:36px;height:36px;margin:0 auto;border-radius:6px;
}
#relief-panel[data-compact="2"] .relief-row{margin:0}
#relief-panel[data-compact="2"] .relief-entry input,
#relief-panel[data-compact="2"] #relief-submit{min-height:26px}
#relief-panel[data-compact="2"] input[type=range]{margin:0 0 2px}
#relief-panel[data-compact="2"] .structure-ends{display:none}

#relief-panel[data-compact="3"]{
  padding:2px 6px 3px;
}
#relief-panel[data-compact="3"] .control-title{display:none}
#relief-panel[data-compact="3"] .control-head{margin:0 0 1px}
#relief-panel[data-compact="3"] .control-tabs button{padding:1px 4px;min-height:20px;font-size:10px}
#relief-panel[data-compact="3"] .relief-field-label{display:none}
#relief-panel[data-compact="3"] .relief-presets{gap:2px;margin:0 0 2px}
#relief-panel[data-compact="3"] .relief-presets button{gap:0;padding:0;font-size:8px}
#relief-panel[data-compact="3"] .relief-presets button span{display:none}
#relief-panel[data-compact="3"] .relief-presets button img{
  width:32px;height:32px;margin:0 auto;border-radius:5px;
}
#relief-panel[data-compact="3"] .relief-row{margin:0}
#relief-panel[data-compact="3"] .relief-entry input,
#relief-panel[data-compact="3"] #relief-submit{min-height:24px}
#relief-panel[data-compact="3"] input[type=range]{margin:0 0 1px}
#relief-panel[data-compact="3"] .structure-ends{display:none}

.brand-name{letter-spacing:.06em}
