:root {
  color-scheme: light;
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  color: #152326;
  background: #13282a;
  --edge: clamp(15px, 6.667vw, 38px);
  --bottom: max(var(--edge), env(safe-area-inset-bottom));
  --top: max(clamp(22px, 6.75dvh, 54px), env(safe-area-inset-top));
  --control: clamp(42px, 10.667vw, 56px);
  --teal: #067475;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
button, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .54; }
button:focus-visible, select:focus-visible { outline: 3px solid #2e9da4; outline-offset: 3px; }
h1, h2, p { margin: 0; }
main { position: fixed; inset: 0; overflow: hidden; isolation: isolate; background: radial-gradient(ellipse at 45% 40%, #3c5555, #13282a 78%); }
video, #ar, .shade { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
video { object-fit: cover; }
.shade { background: linear-gradient(#121f254d, transparent 31%, transparent 63%, #11222962); }
main[data-state=scan] .shade { background: linear-gradient(transparent 51%, #102c2d69 69%, #10242885); }
#scan { position: absolute; inset: 0; color: #fff; text-align: center; }
.scan-band {
  position: absolute; top: 45.9%; transform: translateY(-50%); width: 100%; height: clamp(78px, 27.6vw, 145px);
  background: var(--art-scan) center/100% 100% no-repeat;
}
.scan-band::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(transparent 42%, #caeeee46 49%, transparent 56%);
  animation: scan-sweep 2.55s ease-in-out infinite alternate;
}
@keyframes scan-sweep { from { transform: translateY(-42%); } to { transform: translateY(42%); } }
.scan-message { position: absolute; top: 60.5%; inset-inline: max(22px, var(--edge)); text-shadow: 0 2px 11px #0e292c; }
.scan-message h1 { font-size: clamp(23px, 5.5vw, 33px); font-weight: 650; }
.scan-message p { max-width: 33ch; margin: 12px auto 0; font-size: clamp(15px, 4.25vw, 21px); line-height: 1.6; }
.scan-message .solid-button { margin-top: 13px; }
.scan-location { position: absolute; bottom: var(--bottom); left: 50%; transform: translateX(-50%); padding: 7px 12px; 
  border: 1px solid #e6ffff7a; border-radius: 50px; color: white; background: #15323ab5; font-size: 12px; white-space: nowrap; }
.guide {
  position: absolute; top: var(--top); left: var(--edge); right: 0; display: flex; align-items: center; gap: 11px;
  min-height: clamp(48px, 10.67vw, 62px); padding: 7px max(16px, var(--edge)) 7px 8px; border-radius: 11px 0 0 11px;
  color: white; background: linear-gradient(95deg, #0b7679ed 4%, #164e59bf 63%, #1c404848); text-shadow: 0 1px 4px #1433337a;
}
.guide[data-kind=arrive], .guide[data-kind=confirmed] { background: linear-gradient(95deg, #168c36ef, #225d39d4 64%, #234b393d); }
.guide-icon { width: 35px; height: 35px; flex: none; border-radius: 8px; background: var(--art-straight) center/contain no-repeat; }
.guide[data-kind=left] .guide-icon { transform: rotate(-90deg); }
.guide[data-kind=right] .guide-icon { transform: rotate(90deg); }
.guide[data-kind=back] .guide-icon { transform: rotate(180deg); }
.guide[data-kind=floor] .guide-icon { background-image: var(--art-stairs); }
.guide[data-kind=arrive] .guide-icon, .guide[data-kind=confirmed] .guide-icon { background-image: var(--art-arrived); }
#direction { font-size: clamp(15px, 4.2vw, 23px); line-height: 1.35; font-weight: 620; overflow-wrap: anywhere; }
.mini {
  position: absolute; top: max(16px, env(safe-area-inset-top)); right: var(--edge); width: clamp(94px, 27vw, 142px);
  padding: 0; overflow: hidden; border: 1px solid #fff; border-radius: 10px; background: #f5fbfa; color: #23484b; box-shadow: 0 4px 18px #0d21283d;
}
main[data-state=navigate] .mini, main[data-state=planning] .mini { top: calc(var(--top) + 72px); }
.mini svg, #largeMap { display: block; width: 100%; background: #edf6f5; }
.mini svg { aspect-ratio: 1.60; }
.mini span { display: block; padding: 4px 7px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 10px; line-height: 1.45; }
.card { position: absolute; bottom: var(--bottom); left: max(var(--edge), env(safe-area-inset-left)); right: max(var(--edge), env(safe-area-inset-right));
  max-width: 465px; margin-inline: auto; max-height: 67dvh; overflow: auto; padding: 15px; border-radius: 13px; background: #fff; box-shadow: 0 5px 26px #1028314d; }
.card h2, dialog h2 { font-size: clamp(18px, 4.8vw, 22px); line-height: 1.25; font-weight: 690; }
.card-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.card-heading > div { min-width: 0; }
.current-location { color: #286769; font-size: 12px; margin-bottom: 5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.destination-fields { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr); gap: 9px; margin-top: 13px; }
label { display: grid; gap: 5px; min-width: 0; color: #526363; font-size: 12px; }
select { width: 100%; padding: 7px; min-height: 41px; border: 1px solid #d3e2e1; border-radius: 8px; background: #f4f9f9; color: #17363a; font-size: 14px; }
.solid-button { min-height: 41px; padding: 8px 16px; border: 0; border-radius: 8px; background: var(--teal); color: white; font-weight: 650; }
.card .solid-button { width: 100%; margin-top: 13px; }
.compass-dock { position: absolute; bottom: calc(var(--bottom) + var(--control) + 12px); left: 50%; transform: translateX(-50%);
  display: grid; justify-items: center; gap: 3px; }
.compass-disc { position: relative; width: clamp(77px, 22vw, 112px); aspect-ratio: 1; border-radius: 50%;
  background: #102d35ba; box-shadow: 0 3px 18px #10262b73; }
.compass-disc canvas { display: block; width: 100%; height: 100%; }
#compassFallback { position: absolute; inset: 0; display: grid; place-items: center; color: #bafaffa0; font-size: 38px; }
.compass-motion { padding: 4px 8px; border: 1px solid #d0f0ed88; border-radius: 12px; background: #173740eb; color: #fff; font-size: 11px; white-space: nowrap; }
.nav-controls { position: absolute; bottom: var(--bottom); inset-inline: var(--edge); display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 9px; max-width: 485px; margin-inline: auto; }
.art-button { width: var(--control); height: var(--control); flex: none; padding: 0; border: 0; border-radius: 8px; background: #fff center/contain no-repeat; box-shadow: 0 2px 9px #132d2f32; }
.art-stop { background-image: var(--art-stop); }
.art-locate { background-image: var(--art-locate); }
.card .art-button { width: 37px; height: 37px; box-shadow: none; border: 1px solid #d7e7e6; }
.nav-distance { display: grid; align-content: center; min-height: var(--control); gap: 2px; padding: 4px 6px; border-radius: 8px;
  background: #fff; text-align: center; box-shadow: 0 2px 9px #132d2f32; }
.nav-distance strong { font-size: clamp(13px, 4vw, 18px); }
.nav-distance span, .card > p, .map-detail { color: #5b6b6d; font-size: 12px; line-height: 1.5; }
.nav-distance span:empty { display: none; }
.floor-warning { position: absolute; top: 34.8%; left: 50%; transform: translateX(-50%); width: clamp(125px, 44vw, 215px); aspect-ratio: 330/215; background: var(--art-warning) center/contain no-repeat; }
.floor-confirmation p, .arrival-card p { margin-top: 8px; }
.slide-track { --thumb: clamp(37px, 10.667vw, 52px); position: relative; display: grid; place-items: center; margin-top: 13px; height: calc(var(--thumb) + 10px);
  border-radius: 8px; background: #5b6263; color: #fff; font-size: clamp(14px, 4vw, 18px); }
.slide-check, #slideHandle { position: absolute; top: 5px; width: var(--thumb); height: var(--thumb); border: 0; border-radius: 6px; background: center/cover no-repeat; }
.slide-check { right: 5px; background-image: var(--art-check); }
#slideHandle { left: 5px; padding: 0; background-image: var(--art-walk); transform: translateX(var(--slide, 0px)); touch-action: none; }
.text-button { display: block; margin: 8px auto 0; border: 0; padding: 3px 8px; background: transparent; color: #3e686b; font-size: 12px; }
dialog { width: min(calc(100vw - 32px), 465px); max-height: 88dvh; border: 1px solid #d8e6e6; border-radius: 15px; padding: 16px; color: #173234; background: #fff; box-shadow: 0 10px 42px #10262863; }
dialog::backdrop { background: #102628a0; }
.dialog-close { width: 36px; height: 36px; padding: 0; border: 1px solid #d6e6e5; border-radius: 8px; color: #243c44; background: #f3f9f9; font-size: 24px; }
#largeMap { margin-top: 12px; max-height: 35dvh; border-radius: 8px; }
#locationPanel .map-detail { margin: 5px 0 12px; }
#locationPanel .solid-button { width: 100%; margin-top: 11px; }
@media (max-height: 510px) {
  :root { --bottom: max(12px, env(safe-area-inset-bottom)); --top: max(10px, env(safe-area-inset-top)); }
  .scan-band { height: 73px; top: 35%; }
  .scan-message { top: 49%; }
  .scan-message p { margin-top: 4px; }
  .scan-location { left: auto; right: var(--edge); transform: none; }
  .floor-warning { top: 22%; left: 25%; width: 122px; }
  .floor-confirmation { left: auto; width: min(57vw, 420px); }
  .guide { right: max(0px, calc(100% - 460px)); }
}
@media (prefers-reduced-motion: reduce) { .scan-band::after { animation: none; } }
