*{box-sizing:border-box}html,body{margin:0;height:100%;background:var(--bg);color:var(--text);font:15px var(--font,system-ui)}body{height:100dvh;display:flex;flex-direction:column;overflow:hidden}button,select,textarea{font:inherit;color:inherit}button,select{min-height:44px;border:1px solid var(--line);border-radius:24px;padding:8px 14px;background:var(--surface-2);cursor:pointer}button:active{scale:.96}button:disabled{opacity:.4;cursor:default}header{display:flex;align-items:center;gap:12px;padding:max(10px,env(safe-area-inset-top)) 12px 10px;flex-shrink:0}header strong{font-size:18px}nav{display:flex;gap:4px}nav button{background:none;border-color:transparent;padding:8px 12px}nav button[aria-pressed=true]{color:var(--accent);border-color:var(--accent)}select{margin-left:auto;max-width:120px}#stage{flex:1;min-height:0;position:relative;overflow:hidden;margin:0 10px;border-radius:18px;background:var(--surface)}#live-video,#tracking-canvas{position:absolute;inset:0;width:100%;height:100%;object-fit:contain}#tracking-canvas{touch-action:none}body:not([data-mode=camera]) #live-video{display:none}#hud{position:absolute;z-index:2;pointer-events:none;top:12px;left:12px;right:12px;display:flex;justify-content:space-between;gap:8px;font-size:12px;color:var(--text)}#hud span{background:color-mix(in srgb,var(--bg) 80%,transparent);padding:5px 8px;border-radius:12px}#hud span:last-child{white-space:nowrap}#hud b{font-weight:500;margin-left:4px}footer{display:flex;flex-direction:column;gap:8px;padding:0 12px max(10px,env(safe-area-inset-bottom));flex-shrink:0}.btn.primary{background:var(--accent);color:var(--on-accent);border-color:var(--accent);height:48px}.actions{display:flex;gap:8px}.actions .btn{flex:1;min-width:0;white-space:normal;line-height:1.2;font-size:13px;padding:8px 10px}#notice{min-height:16px;font-size:12px;color:var(--muted);text-align:center}dialog{background:var(--surface);color:var(--text);border:1px solid var(--line);border-radius:18px;width:min(94vw,640px)}dialog::backdrop{background:var(--overlay)}textarea{width:100%;height:50dvh;resize:none;background:var(--bg);border:1px solid var(--line);font:11px monospace;padding:10px;margin-bottom:10px}@media(min-width:761px){body{max-width:1100px;margin:auto}footer{flex-direction:row;flex-wrap:wrap;align-items:center}#camera-toggle{min-width:180px}.actions{flex:1}#notice{width:100%;min-height:16px}}

body{max-width:none;margin:0}#stage{position:fixed;inset:0;margin:0;border-radius:0;width:100%;height:100dvh}#live-video{object-fit:cover;background:#000}#tools-toggle{position:fixed;z-index:10;top:max(12px,env(safe-area-inset-top));right:max(12px,env(safe-area-inset-right));background:color-mix(in srgb,var(--bg) 80%,transparent);font-size:13px}header{position:fixed;z-index:5;top:0;left:0;right:0;padding:12px 82px 12px 12px;background:color-mix(in srgb,var(--bg) 90%,transparent)}header strong{display:none}header nav button{padding:8px 10px;font-size:13px}header select{font-size:13px;min-width:0;max-width:115px}footer{position:fixed;z-index:5;bottom:0;left:0;right:0;flex-direction:column;padding:12px 12px max(12px,env(safe-area-inset-bottom));background:color-mix(in srgb,var(--bg) 90%,transparent)}#hud{top:max(78px,calc(env(safe-area-inset-top) + 66px));left:12px;right:12px}body[data-tools=closed] header,body[data-tools=closed] footer .actions,body[data-tools=closed] #notice{display:none}body[data-tools=closed] footer{display:contents}body[data-tools=closed] #camera-toggle{position:fixed;z-index:4;bottom:max(24px,env(safe-area-inset-bottom));left:50%;transform:translateX(-50%);width:min(300px,calc(100% - 48px))}body[data-tools=closed] #camera-toggle:active{scale:.96}body[data-tools=closed][data-running=true] #camera-toggle{display:none}body[data-tools=closed] #hud{top:auto;bottom:84px;justify-content:center}body[data-tools=closed] #hud span:last-child{display:none}body[data-tools=closed][data-running=true][data-located=true] #hud{display:none}dialog{z-index:20}#notice{width:100%}

#camera-device{width:100%;max-width:none;margin:0}body[data-tools=closed] #camera-device{display:none}

body[data-tools=closed] #motion-mode{display:none}

body[data-tools=open] footer{max-height:calc(100dvh - 90px);overflow:auto}

#live-video{pointer-events:none}#live-preview,#route-overlay,#route-svg{position:absolute;inset:0;width:100%;height:100%;pointer-events:none}#route-overlay,#route-svg{z-index:1;stroke:none}body:not([data-mode=camera]) #live-preview{display:none}

html[data-auto="1"] body:not([data-running=true]) #camera-toggle{visibility:hidden}
html[data-auto="1"] body[data-tools=closed]:not([data-error=true]) #hud{display:none}
html[data-auto="1"] #wall-select,html[data-auto="1"] #route-bar{display:none}
#wall-select{position:fixed;z-index:10;top:max(12px,env(safe-area-inset-top));left:max(12px,env(safe-area-inset-left));margin:0;max-width:calc(100vw - 108px);padding-right:32px;-webkit-appearance:none;appearance:none;background:rgba(14,14,15,.72) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23f2f2f0' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 11px center;font-size:13px;font-weight:600;text-overflow:ellipsis}body[data-tools=open] #wall-select,body[data-tools=open] #route-bar{display:none}
#route-bar{position:fixed;z-index:4;left:12px;right:12px;bottom:calc(max(24px,env(safe-area-inset-bottom)) + 58px);display:flex;align-items:center;gap:6px;overflow-x:auto;scrollbar-width:none;-webkit-overflow-scrolling:touch}
#route-bar::-webkit-scrollbar{display:none}
body[data-tools=closed][data-running=true] #route-bar{bottom:max(18px,env(safe-area-inset-bottom))}
html:not([data-auto="1"]) body[data-tools=closed] #hud{bottom:calc(max(24px,env(safe-area-inset-bottom)) + 104px)}
html:not([data-auto="1"]) body[data-tools=closed][data-running=true] #hud{bottom:calc(max(18px,env(safe-area-inset-bottom)) + 52px)}
.wall-chip{min-height:36px;padding:6px 12px;border-radius:999px;background:rgba(14,14,15,.78);border:1px solid var(--line-strong);color:var(--muted);font-size:12px;font-weight:600;display:inline-flex;align-items:center;gap:6px;white-space:nowrap;flex-shrink:0}
.wall-chip::before{content:"";width:7px;height:7px;border-radius:50%;background:var(--muted);flex-shrink:0}
body[data-located=true] .wall-chip{color:var(--text)}
body[data-located=true] .wall-chip::before{background:var(--accent)}
.route-pill{min-height:36px;padding:6px 12px;border-radius:999px;background:rgba(14,14,15,.72);border:1.5px solid var(--line-strong);color:var(--text);font-size:13px;font-weight:600;display:inline-flex;align-items:center;gap:6px;white-space:nowrap;flex-shrink:0}
.route-pill b{font-family:var(--display,inherit);font-weight:700;color:var(--muted)}
.route-pill[aria-selected=true]{border-color:var(--accent);color:var(--accent);background:rgba(14,14,15,.85)}
.route-pill[aria-selected=true] b{color:var(--accent)}
/* 岩點貓的相機看線（auto=1，data-embed 由 boot.js 設、出錯也不拿掉）：使用者看的畫面不放開發工具；工具只在直接打開追蹤頁時用 */
html[data-embed="1"] #tools-toggle,html[data-embed="1"] header,html[data-embed="1"] footer .actions,html[data-embed="1"] #notice,html[data-embed="1"] #motion-mode,html[data-embed="1"] #camera-device{display:none}
