/* Hotspots AR — dark glass over a camera feed. System type, translucent materials, 44 px targets. */
:root {
  color-scheme: light dark;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", system-ui, Inter, "Segoe UI", Roboto, sans-serif;
  /* Light is the default (also with no preference). Dark under prefers-color-scheme: dark, see the block after :root. */
  --bg: #f3f5f8;
  --bg-glow: #dce8f8;
  --fg: #12161c;
  --fg2: rgba(22, 28, 38, .76);
  --fg3: rgba(22, 28, 38, .62);
  --hair: rgba(18, 22, 30, .14);
  --fill: rgba(60, 70, 90, .09);
  --fill2: rgba(60, 70, 90, .17);
  --tint: rgba(18, 22, 30, .04);
  --tint2: rgba(18, 22, 30, .06);
  --glass: rgba(255, 255, 255, .78);
  --glass-strong: rgba(255, 255, 255, .94);
  --inset: rgba(18, 22, 30, .1);
  --solid-bg: #12161c; --solid-fg: #fff;
  --seg-on-bg: #fff; --seg-on-fg: #12161c;
  --ink: #12161c;
  --opt-bg: #fff;
  --panel: #fff;
  --scrim: rgba(12, 16, 24, .45);
  --blur: blur(20px) saturate(180%);
  --shadow: 0 8px 28px rgba(24, 36, 60, .14), 0 1px 2px rgba(24, 36, 60, .12);
  --accent: #0060c7;
  --red: #c8102e;
  --orange: #a84b00;
  --yellow: #7a5c00;
  --green: #187a35;
  --cyan: #006a9b;
  --purple: #8e2fc7;
  --accent-fill: #0060c7;
  --r-s: 12px; --r-m: 16px; --r-l: 22px;
  --spring: cubic-bezier(.32, .72, 0, 1);
  --ease: cubic-bezier(.25, .1, .25, 1);
  --st: env(safe-area-inset-top, 0px);
  --sb: env(safe-area-inset-bottom, 0px);
  --sl: env(safe-area-inset-left, 0px);
  --sr: env(safe-area-inset-right, 0px);
  --err: var(--red);
  --muted: var(--fg2);
}
/* Dark system theme. */
@media (prefers-color-scheme: dark) {
  :root { --bg: #0b0d10; --bg-glow: #142033; --fg: #fff; --fg2: rgba(235, 235, 245, .62); --fg3: rgba(235, 235, 245, .38); --hair: rgba(255, 255, 255, .12);
    --fill: rgba(118, 118, 128, .24); --fill2: rgba(118, 118, 128, .36); --tint: rgba(255, 255, 255, .04); --tint2: rgba(255, 255, 255, .06);
    --glass: rgba(30, 30, 34, .52); --glass-strong: rgba(24, 24, 28, .78); --inset: rgba(255, 255, 255, .14);
    --solid-bg: #fff; --solid-fg: #000; --seg-on-bg: #636366; --seg-on-fg: #fff; --ink: #fff; --opt-bg: #1c1c1e; --panel: #121418; --scrim: rgba(0, 0, 0, .55);
    --shadow: 0 8px 28px rgba(0, 0, 0, .28), 0 1px 2px rgba(0, 0, 0, .25);
    --accent: #0a84ff; --accent-fill: #0a6fe0; --red: #ff453a; --orange: #ff9f0a; --yellow: #ffd60a; --green: #30d158; --cyan: #64d2ff; --purple: #bf5af2; }
}
/* Surfaces drawn over a camera image, a 3D scene or a map keep the dark glass in both themes: contrast there depends on
   the picture, not on the page, and dark glass with white text holds over bright and busy backgrounds alike. */
.app, .dark-surface, .desk-map, .admin-map, .dig-stage {
  color-scheme: dark;
  --fg: #fff; --fg2: rgba(235, 235, 245, .74); --fg3: rgba(235, 235, 245, .52); --hair: rgba(255, 255, 255, .12);
  --fill: rgba(118, 118, 128, .24); --fill2: rgba(118, 118, 128, .36); --tint: rgba(255, 255, 255, .04); --tint2: rgba(255, 255, 255, .06);
  --glass: rgba(22, 24, 30, .72); --glass-strong: rgba(18, 20, 26, .88); --inset: rgba(255, 255, 255, .14);
  --solid-bg: #fff; --solid-fg: #000; --seg-on-bg: #636366; --seg-on-fg: #fff; --ink: #fff; --opt-bg: #1c1c1e; --panel: #121418; --scrim: rgba(0, 0, 0, .55);
  --shadow: 0 8px 28px rgba(0, 0, 0, .28), 0 1px 2px rgba(0, 0, 0, .25);
  --accent: #0a84ff; --red: #ff453a; --orange: #ff9f0a; --yellow: #ffd60a; --green: #30d158; --cyan: #64d2ff; --purple: #bf5af2;
  color: var(--fg);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--fg); font: 16px/1.4 var(--font); -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .45; cursor: default; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.fab:focus-visible, .pill:focus-visible { outline-color: rgba(255, 255, 255, .85); }
small { color: var(--fg2); }
.msg { min-height: 1.3em; color: var(--fg2); font-size: 14px; }
.msg.err { color: var(--red); }
.muted { color: var(--fg2); font-size: 14px; }
.ico { width: 22px; height: 22px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

/* Glass material */
.glass, .pill, .round-btn, .notice, .popover, .sheet, .calib-banner, .calib-toast, .calib-lost, .hs-card, .hint, .hud-panel, .hud-status, .hud-guide, .start-toast {
  background: var(--glass);
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  box-shadow: var(--shadow), inset 0 0 0 .5px var(--inset);
  color: var(--fg);
}

/* Controls */
.btn, .chip-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 16px; border: 0; border-radius: var(--r-s);
  background: var(--fill); color: var(--fg); font-size: 15px; font-weight: 600;
  transition: transform .18s var(--ease), background .2s var(--ease);
}
.btn:active, .chip-btn:active { transform: scale(.97); background: var(--fill2); }
.btn .ico, .chip-btn .ico { width: 18px; height: 18px; }
.btn-primary { background: var(--accent-fill, var(--accent)); color: #fff; }
.btn-primary:active { background: #0070e0; }
.btn-danger { color: var(--red); }
.btn-quiet { background: transparent; color: var(--fg2); font-weight: 500; }
.btn.armed, .chip-btn.armed, .calib-sheet button.armed { background: var(--red); color: #fff; }
.chip-btn { min-height: 40px; border-radius: 20px; padding: 0 14px; font-size: 14px; background: var(--fill2); }
.chip-primary { background: var(--solid-bg); color: var(--solid-fg); }
.chip-cancel { background: transparent; color: var(--fg2); }
.calib-pin .ico { color: var(--cyan); }
.round-btn {
  position: relative; display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%;
  transition: transform .2s var(--spring), background .2s;
}
.round-btn:active { transform: scale(.92); }
.round-btn.on { background: var(--solid-bg); color: var(--solid-fg); }
.icon-btn { display: grid; place-items: center; width: 44px; height: 44px; margin: -6px -10px -6px 0; border: 0; background: none; color: var(--red); }
.icon-btn .ico { width: 20px; height: 20px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.btn-row > .btn { flex: 1 1 auto; }

/* Long-press ring: a sweep along the element's outline (--hold 0..1 set by glass.js pressable). */
.has-ring { position: relative; }
.hold-ring {
  position: absolute; inset: -4px; border-radius: inherit; padding: 3px; pointer-events: none; opacity: 0;
  background: conic-gradient(from 0deg, #fff calc(var(--hold, 0) * 360deg), transparent 0);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  transition: opacity .15s;
}
/* --hold is animated by a CSS transition (no JS frames: window rAF may not run in an immersive session). */
@property --hold { syntax: '<number>'; inherits: false; initial-value: 0; }
.pressing.armed .hold-ring { opacity: 1; --hold: 1; transition: opacity .15s, --hold var(--hold-ms, 450ms) linear; }
.pill .hold-ring { background: conic-gradient(from 0deg, var(--orange) calc(var(--hold, 0) * 360deg), transparent 0); }
.pressing { scale: .97; transition: scale .2s var(--spring); }
.held { animation: held .26s var(--spring); }
@keyframes held { 50% { scale: 1.05; } }

/* Switch (iOS style) */
.switch-row { display: flex; align-items: center; gap: 12px; min-height: 50px; padding: 4px 14px; cursor: pointer; }
.switch-row + .switch-row { border-top: .5px solid var(--hair); }
.switch-text { flex: 1; font-size: 16px; display: flex; flex-direction: column; line-height: 1.25; }
.switch-text small { font-size: 12.5px; color: var(--fg3); }
.switch { appearance: none; -webkit-appearance: none; position: relative; flex: none; width: 51px; height: 31px; margin: 0; border-radius: 16px; background: var(--fill2); cursor: pointer; transition: background .25s var(--ease); }
.switch::after { content: ''; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 3px 8px rgba(0, 0, 0, .18), 0 1px 1px rgba(0, 0, 0, .16); transition: transform .3s var(--spring); }
.switch:checked { background: var(--green); }
.switch:checked::after { transform: translateX(20px); }
.swatch { width: 12px; height: 12px; border-radius: 4px; }

.slider { -webkit-appearance: none; appearance: none; width: 100%; height: 28px; background: transparent; margin: 0; }
.slider::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: linear-gradient(to right, var(--ink) var(--fill, 80%), var(--fill2) var(--fill, 80%)); }
.slider::-webkit-slider-thumb { -webkit-appearance: none; width: 26px; height: 26px; margin-top: -11px; border-radius: 50%; background: #fff; box-shadow: 0 2px 8px rgba(0, 0, 0, .3); }
.slider::-moz-range-track { height: 4px; border-radius: 2px; background: var(--fill2); }
.slider::-moz-range-progress { height: 4px; border-radius: 2px; background: #fff; }
.slider::-moz-range-thumb { width: 26px; height: 26px; border: 0; border-radius: 50%; background: #fff; }

input[type=text], input[type=password], input[type=number], select {
  width: 100%; min-height: 44px; padding: 0 14px; border: 0; border-radius: var(--r-s);
  background: var(--fill); color: var(--fg); font-size: 16px; outline: none;
}
input:focus-visible, select:focus-visible { box-shadow: 0 0 0 2px var(--accent); outline: none; }
select { appearance: none; -webkit-appearance: none; padding-right: 36px;
  background: var(--fill) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23161c26' stroke-opacity='.6' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m7 10 5 5 5-5'/%3E%3C/svg%3E") right 10px center/20px no-repeat; }
select option { background: var(--opt-bg); color: var(--fg); }
.row { display: flex; gap: 8px; align-items: center; }
.row > input { flex: 1; min-width: 0; }

/* ---- Start screen ---- */
.start {
  min-height: 100%; max-width: 440px; margin: 0 auto;
  padding: calc(var(--st) + 9vh) calc(20px + var(--sr)) calc(var(--sb) + 32px) calc(20px + var(--sl));
  display: flex; flex-direction: column; gap: 28px;
}
body:has(#start:not([hidden])) { background: radial-gradient(120% 60% at 50% 0%, var(--bg-glow) 0%, var(--bg) 60%) fixed; }
.hero { text-align: center; animation: rise .6s var(--spring) both; }
.app-mark { width: 84px; height: 84px; margin-bottom: 18px; overflow: visible; }
.app-mark circle { fill: none; stroke: var(--orange); }
.app-mark .m-ring3 { stroke-opacity: .22; stroke-width: 1.5; animation: pulse 3.2s var(--ease) infinite; transform-origin: center; }
.app-mark .m-ring2 { stroke-opacity: .45; stroke-width: 2; }
.app-mark .m-ring1 { stroke-opacity: .8; stroke-width: 2.5; }
.app-mark .m-core { fill: var(--orange); stroke: none; filter: drop-shadow(0 0 6px var(--orange)); }
@keyframes pulse { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.06); opacity: .6; } }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } }
h1 { margin: 0; font-size: 34px; line-height: 1.1; font-weight: 700; letter-spacing: -.02em; }
.tagline { margin: 8px auto 0; max-width: 18em; color: var(--fg2); font-size: 17px; line-height: 1.35; }
.cta { display: flex; flex-direction: column; align-items: stretch; gap: 10px; animation: rise .6s .08s var(--spring) both; }
button.primary {
  min-height: 56px; border: 0; border-radius: var(--r-m); background: var(--solid-bg); color: var(--solid-fg);
  font-size: 17px; font-weight: 600; letter-spacing: -.01em;
  box-shadow: 0 10px 30px rgba(10, 132, 255, .18);
  transition: transform .2s var(--spring), opacity .2s;
}
button.primary:active { transform: scale(.97); }
.cta .msg { text-align: center; }
.ar-mode { margin: 0; text-align: center; color: var(--fg3); font-size: 13px; }
.app-version:empty { display: none; }
.app-version.has-update { color: var(--fg); display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; }
.exit-box { display: flex; align-items: center; gap: 8px; }
.exit-float { position: absolute; top: calc(var(--st, 0px) + 12px); right: calc(12px + var(--sr, 0px)); z-index: 30; }
.exit-btn .ico { width: 22px; height: 22px; }
.exit-btn.armed { background: var(--red); color: #fff; }
.exit-btn.has-update::after { content: ''; position: absolute; top: 3px; right: 3px; width: 10px; height: 10px; border-radius: 50%; background: var(--yellow); box-shadow: 0 0 0 2px rgba(0, 0, 0, .5); }
.exit-tip { padding: 8px 12px; border-radius: 14px; font-size: 13px; max-width: 220px; }
.exit-tip[hidden] { display: none; }
.disclosure { border-radius: var(--r-m); background: var(--tint2); box-shadow: inset 0 0 0 .5px var(--hair); animation: rise .6s .14s var(--spring) both; }
.disclosure > summary {
  display: flex; align-items: center; gap: 8px; min-height: 52px; padding: 0 16px; list-style: none; cursor: pointer;
  font-size: 16px; font-weight: 500;
}
.disclosure > summary::-webkit-details-marker { display: none; }
.disclosure > summary::after {
  content: ''; width: 8px; height: 8px; margin-left: 4px; border-right: 2px solid var(--fg3); border-bottom: 2px solid var(--fg3);
  transform: rotate(-45deg); transition: transform .25s var(--spring);
}
.disclosure[open] > summary::after { transform: rotate(45deg); }
.disclosure > summary .sum-val { margin-left: auto; color: var(--fg2); font-weight: 400; font-size: 15px; }
.disclosure .group { padding: 4px 16px 14px; display: flex; flex-direction: column; gap: 8px; }
.disclosure.inner { margin: 0 8px 8px; background: var(--tint); animation: none; }
.disclosure.inner > summary { min-height: 46px; color: var(--fg2); font-size: 15px; }
.disclosure.inner > summary::after { margin-left: auto; margin-right: 4px; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--fg2); }
.field.inline { flex: 0 0 7.5rem; }
.seg { display: flex; padding: 2px; border-radius: 10px; background: var(--fill); }
.seg label { flex: 1; position: relative; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: grid; place-items: center; min-height: 36px; padding: 0 8px; border-radius: 8px; font-size: 14px; font-weight: 500; cursor: pointer; transition: background .2s var(--ease), color .2s; color: var(--fg2); }
.seg input:checked + span { background: var(--seg-on-bg); color: var(--seg-on-fg); box-shadow: 0 3px 8px rgba(0, 0, 0, .2); }
.seg input:focus-visible + span { outline: 2px solid var(--accent); }
.start-toast { position: fixed; left: 50%; bottom: calc(var(--sb) + 24px); transform: translateX(-50%); z-index: 50; border-radius: 20px; padding: 10px 18px; font-size: 14px; }

/* ---- App view (shared) ---- */
.app { position: fixed; inset: 0; overflow: hidden; background: #000; font-size: 15px; user-select: none; -webkit-user-select: none; }
.app .view { position: absolute; inset: 0; }
.minimap {
  position: absolute; right: calc(12px + var(--sr)); bottom: calc(var(--sb) + 24px); width: min(32vw, 240px); height: min(32vw, 240px);
  border-radius: var(--r-l); overflow: hidden; z-index: 5; cursor: zoom-in;
  box-shadow: var(--shadow), 0 0 0 .5px rgba(255, 255, 255, .25);
  transition: inset .35s var(--spring), width .35s var(--spring), height .35s var(--spring), border-radius .35s var(--spring), opacity .5s var(--ease);
}
.minimap.expanded { inset: calc(var(--st) + 12px) 12px calc(var(--sb) + 12px); width: auto; height: auto; cursor: zoom-out; z-index: 20; border-radius: var(--r-l); }
/* Attribution stays visible in the minimap (Google/ČÚZK/OSM licences), just compact. */
.minimap .cesium-viewer-bottom { left: 4px; bottom: 2px; padding: 0; transform: scale(.55); transform-origin: left bottom; max-width: 170%; line-height: 1.1; opacity: .8; }
.minimap.expanded .cesium-viewer-bottom { transform: none; max-width: none; }
.minimap.picking { cursor: crosshair; }
.pick-ring { position: absolute; z-index: 3; width: 64px; height: 64px; margin: -32px 0 0 -32px; border-radius: 50%; pointer-events: none;
  background: conic-gradient(var(--cyan) calc(var(--p, 0) * 1turn), rgba(255, 255, 255, .25) 0);
  -webkit-mask: radial-gradient(circle, transparent 26px, #000 27px); mask: radial-gradient(circle, transparent 26px, #000 27px); }
.pick-ring.run { animation: pick-fill .45s linear forwards; }
@property --p { syntax: '<number>'; inherits: false; initial-value: 0; }
@keyframes pick-fill { to { --p: 1; } }
.pick-hint { position: absolute; left: 50%; top: 14px; z-index: 3; transform: translateX(-50%); padding: 6px 12px; border-radius: 14px; background: rgba(0, 0, 0, .6); font-size: 13px; opacity: 0; pointer-events: none; white-space: nowrap; }
.pick-hint.show { animation: flash 1.6s var(--ease); }
@keyframes flash { 10%, 75% { opacity: 1; } }

/* ---- HUD of the simulator and camera AR (ui.js) ---- */
.hud { position: absolute; inset: 0; pointer-events: none; z-index: 10; font-size: 14px; }
.hud > * { pointer-events: auto; }
.hud-bottom { display: contents; }
.hud-status { position: absolute; top: calc(var(--st) + 10px); left: 50%; transform: translateX(-50%); max-width: calc(100% - 32px); display: flex; flex-wrap: wrap; gap: .2rem .8rem; justify-content: center; padding: 7px 14px; border-radius: 18px; color: var(--fg2); font-size: 12.5px; }
.hud-status:empty { display: none; }
.hud-status .err { color: var(--red); }
.hud-status .warn { color: var(--yellow); }
.hud-panel { position: absolute; top: calc(var(--st) + 10px); left: calc(10px + var(--sl)); width: min(300px, calc(100vw - 32px)); max-height: calc(100% - 20px); overflow: auto; border-radius: var(--r-l); padding: 8px 14px 12px; }
.hud-panel details { margin: .3rem 0 .5rem; }
.hud-panel summary { cursor: pointer; color: var(--fg2); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; padding: 6px 0; }
.hud-panel label { display: block; margin: .25rem 0; cursor: pointer; }
.hud-panel label.absent { color: var(--fg3); }
.absent-head { color: var(--fg3); font-size: 12px; margin-top: .4rem; border-top: .5px solid var(--hair); padding-top: .3rem; }
.hud-legend { margin: .3rem 0 .6rem; }
.legend-title { font-size: 12px; color: var(--fg2); margin-bottom: .25rem; }
.legend-bar { height: 8px; border-radius: 4px; }
.legend-ticks { position: relative; height: 1.3em; font-size: 11px; color: var(--fg2); }
.legend-ticks span { position: absolute; transform: translateX(-50%); white-space: nowrap; }
.legend-ticks span:first-child { transform: none; }
.legend-ticks span:last-child { transform: translateX(-100%); }
.hud-hotspots { list-style: none; margin: .3rem 0 0; padding: 0; }
.hud-hotspots li { padding: .45rem .6rem; border-radius: 10px; cursor: pointer; }
.hud-hotspots li:hover { background: var(--fill); }
.hud-hotspots li.sel { background: #fff; color: #000; font-weight: 600; }
.hud-hotspots li.empty { cursor: default; color: var(--fg2); }
.hud-controls { display: flex; flex-direction: column; gap: .4rem; border-top: .5px solid var(--hair); padding-top: .6rem; }
.hud-controls button { min-height: 40px; padding: 0 12px; border: 0; border-radius: 10px; background: var(--fill); font-size: 14px; font-weight: 600; }
.hud-controls button.on { background: #fff; color: #000; }
.hud-controls .help { font-size: 11.5px; }
.hud-guide { position: absolute; left: 50%; bottom: calc(var(--sb) + 24px); transform: translateX(-50%); display: flex; align-items: center; gap: .8rem; border-radius: var(--r-l); padding: 8px 18px 8px 10px; }
.guide-arrow { width: 52px; height: 52px; transition: transform .12s linear; }
.guide-arrow svg { width: 100%; height: 100%; fill: #fff; }
.guide-dist { font-size: 26px; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.guide-name { font-size: 12.5px; color: var(--fg2); }
.hud-guide.arrived .guide-arrow svg { fill: var(--green); }
.hud-guide.arrived .guide-dist { color: var(--green); }
.hud.off-limits, .app.xr.off-limits::after { box-shadow: inset 0 0 0 4px rgba(255, 69, 58, .9), inset 0 0 80px 24px rgba(255, 69, 58, .4); }
.hud-offlimits { position: absolute; top: calc(var(--st) + 56px); left: 50%; transform: translateX(-50%); background: var(--red); color: #fff; font-weight: 600; padding: 8px 16px; border-radius: 18px; }
.fatal { position: absolute; top: 40%; left: 16px; right: 16px; z-index: 30; background: rgba(60, 16, 18, .9); color: #ffb4ae; border-radius: var(--r-m); padding: 16px; box-shadow: var(--shadow); }
@media (max-width: 600px) {
  .hud-panel { width: calc(100vw - 20px); max-height: 40%; }
  /* Status and guidance stack left of a smaller minimap, so neither covers the other. */
  .hud-bottom { display: flex; flex-direction: column; align-items: center; gap: 8px; position: absolute; left: calc(10px + var(--sl)); right: calc(28vw + 22px + var(--sr)); bottom: calc(var(--sb) + 24px); pointer-events: none; }
  .hud-bottom > * { pointer-events: auto; }
  .hud-bottom > .hud-status, .hud-bottom > .hud-guide, .hud-bottom > .ar-anchor { position: static; transform: none; max-width: 100%; }
  .app:not(.xr) .minimap:not(.expanded) { width: 28vw; height: 28vw; bottom: calc(var(--sb) + 24px); }
}

/* ---- Camera AR (ar-basic.js) ---- */
.app.ar { background: #111; }
.ar-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.app.ar .view canvas { display: block; width: 100%; height: 100%; }
.app.ar.aligning .view canvas { cursor: grab; }
.ar-align { display: flex; flex-direction: column; gap: .4rem; }
.ar-align .row { flex-wrap: wrap; }
.ar-align select { width: auto; flex: 1; min-height: 36px; }
.ar-align input[type=range] { width: 100%; }
/* Known-point snap outside the Align panel (ar-basic.js): "I'm standing at A", then aim the centre cross at B. */
.ar-anchor { position: absolute; left: 50%; bottom: calc(var(--sb) + 92px); transform: translateX(-50%); width: max-content; max-width: calc(100vw - 24px); display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }

/* ---- Touch controls (touchpad.js) ---- */
.touch-stick { position: fixed; left: calc(16px + var(--sl)); bottom: calc(20px + var(--sb)); z-index: 20; width: 132px; height: 132px; border-radius: 50%; background: rgba(30, 30, 34, .4); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .25); touch-action: none; user-select: none; -webkit-user-select: none; }
.touch-knob { position: absolute; left: 50%; top: 50%; width: 54px; height: 54px; margin: -27px 0 0 -27px; border-radius: 50%; background: rgba(255, 255, 255, .85); box-shadow: 0 2px 10px rgba(0, 0, 0, .35); pointer-events: none; }
.touch-stick.active { background: rgba(30, 30, 34, .55); }
.touch-stick.run { box-shadow: inset 0 0 0 2px var(--orange); }
.touch-stick.run .touch-knob { background: var(--orange); }
.touch-hint { position: absolute; left: 0; right: 0; top: -20px; text-align: center; font-size: 11px; color: #fff; text-shadow: 0 1px 3px #000; pointer-events: none; }
.app.touch .hud-panel { max-height: 45%; }
@media (max-width: 600px) {
  .app.touch .hud-bottom { bottom: 176px; right: calc(10px + var(--sr)); }
  .app.touch .hud-status { font-size: 11px; }
}

/* ---- WebXR AR (ar-webxr.js, calib-ui.js, xr-hud.js) ---- */
.app.ar.xr { background: transparent; }
/* iOS WebXR wrappers show the camera behind the web view: nothing opaque may cover it during the session. */
html.xr-session, html.xr-session body { background: transparent !important; }
html.xr-session #start, html.xr-session #tour-btn { display: none !important; }
.app.xr .view canvas { display: block; width: 100%; height: 100%; }
.app.xr.off-limits::after { content: ''; position: absolute; inset: 0; pointer-events: none; z-index: 12; }
.calib-ui { position: absolute; inset: 0; pointer-events: none; z-index: 15; }
.calib-ui > *, .xr-top > * { pointer-events: auto; }
.xr-top { position: absolute; top: calc(var(--st) + 12px); left: calc(12px + var(--sl)); right: calc(12px + var(--sr)); display: flex; justify-content: space-between; align-items: flex-start; pointer-events: none !important; }
.xr-top-right { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }

/* Status pill */
.pill { position: relative; display: inline-flex; align-items: center; gap: 9px; height: 44px; padding: 0 16px 0 14px; border: 0; border-radius: 22px; font-size: 15px; transition: transform .2s var(--spring), opacity .5s var(--ease); touch-action: manipulation; }
.pill-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--red); box-shadow: 0 0 0 3px rgba(255, 69, 58, .22), 0 0 10px var(--red); transition: background .4s, box-shadow .4s; }
.pill.good .pill-dot { background: var(--yellow); box-shadow: 0 0 0 3px rgba(255, 214, 10, .2), 0 0 10px var(--yellow); }
.pill.precise .pill-dot { background: var(--green); box-shadow: 0 0 0 3px rgba(48, 209, 88, .22), 0 0 10px var(--green); }
.pill.waiting .pill-dot { background: var(--fg2); box-shadow: none; animation: breathe 1.6s var(--ease) infinite; }
@keyframes breathe { 50% { opacity: .3; } }
.pill-text { display: flex; align-items: baseline; gap: 7px; white-space: nowrap; }
.calib-acc { font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.calib-src { color: var(--fg2); font-size: 13px; }
.calib-lock { display: inline-grid; color: var(--green); margin-left: -2px; }
.calib-lock .ico { width: 15px; height: 15px; stroke-width: 2.2; }

.notice { position: absolute; top: calc(var(--st) + 64px); left: calc(12px + var(--sl)); max-width: min(72vw, 360px); min-height: 32px; padding: 6px 12px; border: 0; border-radius: 16px; font-size: 13px; text-align: left; color: var(--fg2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; animation: drop .35s var(--spring); transition: opacity .5s var(--ease); }
.notice.err { color: #ffd2cf; background: rgba(120, 24, 22, .55); }
@keyframes drop { from { opacity: 0; transform: translateY(-8px) scale(.96); } }

/* Layers */
.layers-btn .ico { width: 22px; height: 22px; }
.popover { position: absolute; top: calc(var(--st) + 64px); right: calc(12px + var(--sr)); width: min(300px, calc(100vw - 24px)); padding: 14px 0 10px; border-radius: var(--r-l); background: var(--glass-strong);
  transform-origin: top right; opacity: 0; transform: scale(.9) translateY(-6px); transition: opacity .2s var(--ease), transform .32s var(--spring); z-index: 30; }
.popover.open { opacity: 1; transform: none; }
.pop-title { padding: 0 16px 8px; font-size: 13px; font-weight: 600; color: var(--fg2); text-transform: uppercase; letter-spacing: .04em; }
.popover .group { margin: 0 10px; border-radius: 14px; background: var(--tint2); }
.popover .switch-row { padding: 4px 12px; }
.pop-slider { display: flex; align-items: center; gap: 12px; padding: 12px 20px 2px; }
.pop-cap { font-size: 14px; color: var(--fg2); }
.legend { padding: 8px 20px 4px; }
.sheet .legend { padding: 4px 0; }
.legend-ends { display: flex; justify-content: space-between; margin-top: 6px; font-size: 12px; color: var(--fg2); font-variant-numeric: tabular-nums; }
.pop-more { margin: 8px 10px 0; }
.pop-more summary { min-height: 40px; padding: 10px 10px; font-size: 14px; color: var(--fg2); cursor: pointer; list-style: none; }
.pop-more summary::-webkit-details-marker { display: none; }
.pop-more summary::before { content: '›'; display: inline-block; width: 1em; transition: transform .2s; }
.pop-more[open] summary::before { transform: rotate(90deg); }

/* Reticle */
.calib-cross { position: absolute; left: 50%; top: 50%; width: 76px; height: 76px; margin: -38px 0 0 -38px; pointer-events: none !important; border-radius: 50%;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, .9), 0 0 0 5px rgba(255, 69, 58, .75), 0 0 18px rgba(0, 0, 0, .45); transition: box-shadow .25s var(--ease), transform .3s var(--spring); }
.calib-cross::before, .calib-cross::after { content: ''; position: absolute; background: #fff; border-radius: 1px; box-shadow: 0 0 3px rgba(0, 0, 0, .6); }
.calib-cross::before { left: 50%; top: -12px; bottom: -12px; width: 2px; margin-left: -1px; -webkit-mask: linear-gradient(#000 0 14px, transparent 14px calc(100% - 14px), #000 0); mask: linear-gradient(#000 0 14px, transparent 14px calc(100% - 14px), #000 0); }
.calib-cross::after { top: 50%; left: -12px; right: -12px; height: 2px; margin-top: -1px; -webkit-mask: linear-gradient(90deg, #000 0 14px, transparent 14px calc(100% - 14px), #000 0); mask: linear-gradient(90deg, #000 0 14px, transparent 14px calc(100% - 14px), #000 0); }
.cross-dot { position: absolute; left: 50%; top: 50%; width: 6px; height: 6px; margin: -3px; border-radius: 50%; background: #fff; box-shadow: 0 0 4px rgba(0, 0, 0, .6); }
.calib-cross.ok { box-shadow: 0 0 0 2px rgba(255, 255, 255, .95), 0 0 0 5px rgba(48, 209, 88, .85), 0 0 22px rgba(48, 209, 88, .45); transform: scale(.92); }

/* Primary floating action */
.fab-row { position: absolute; left: 50%; bottom: calc(var(--sb) + 22px); transform: translateX(-50%); display: flex; align-items: center; gap: 12px; pointer-events: none !important; transition: opacity .5s var(--ease); }
.fab-row > * { pointer-events: auto; }
.fab { position: relative; display: inline-flex; align-items: center; gap: 12px; height: 60px; padding: 0 26px 0 20px; border: 0; border-radius: 30px;
  background: rgba(255, 255, 255, .94); color: #000; box-shadow: 0 10px 30px rgba(0, 0, 0, .35), 0 1px 2px rgba(0, 0, 0, .2);
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); transition: transform .22s var(--spring), background .25s, opacity .25s; touch-action: manipulation; white-space: nowrap; }
.fab:disabled { opacity: 1; background: rgba(60, 60, 66, .6); color: rgba(255, 255, 255, .7); }
.fab .hold-ring { inset: -5px; padding: 3px; background: conic-gradient(from 0deg, #fff calc(var(--hold, 0) * 360deg), transparent 0); }
.fab-ico { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: #000; color: #fff; }
.fab-ico .ico { width: 20px; height: 20px; stroke-width: 2.1; }
.fab[data-kind=next] .fab-ico { background: var(--orange); color: #000; }
.fab[data-kind=capture]:not(:disabled) .fab-ico { background: var(--green); color: #000; }
.fab:disabled .fab-ico { background: rgba(255, 255, 255, .15); }
.fab-label { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.15; }
.fab-text { font-size: 17px; font-weight: 600; letter-spacing: -.01em; }
.fab-sub { font-size: 12px; color: rgba(0, 0, 0, .5); }
.fab:disabled .fab-sub { color: rgba(255, 255, 255, .55); }
.fab-cancel { width: 52px; height: 52px; animation: pop .3s var(--spring); }
@keyframes pop { from { opacity: 0; transform: scale(.6); } }

/* Hotspot guidance card */
.hs-card { position: absolute; left: 50%; bottom: calc(var(--sb) + 98px); transform: translateX(-50%); width: min(calc(100vw - 24px), 360px); display: flex; align-items: center; gap: 14px; padding: 10px 16px 10px 10px; border: 0; border-radius: var(--r-l); text-align: left; transition: background .35s var(--ease), opacity .5s var(--ease), transform .25s var(--spring); animation: drop .4s var(--spring); }
.hs-arrow { display: grid; place-items: center; flex: none; width: 48px; height: 48px; border-radius: 50%; background: rgba(255, 159, 10, .2); color: var(--orange); transition: transform .12s linear; }
.hs-arrow .ico { width: 26px; height: 26px; }
.hs-body { flex: 1; min-width: 0; }
.hs-dist { font-size: 24px; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.hs-meta { font-size: 13px; color: var(--fg2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hs-badge { flex: none; font-size: 13px; color: var(--fg3); font-variant-numeric: tabular-nums; }
.hs-card.dig { background: rgba(28, 92, 48, .62); }
.hs-card.dig .hs-arrow { background: var(--green); color: #000; transform: none !important; }
.hs-card.dig .hs-arrow .ico { display: none; }
.hs-card.dig .hs-arrow::before { content: ''; width: 14px; height: 14px; border-radius: 50%; background: #000; box-shadow: 0 0 0 6px rgba(0, 0, 0, .18); animation: breathe 1.2s var(--ease) infinite; }
.hs-card.dig .hs-dist { color: #b9f6c9; }
.hs-card.dig .hs-badge { color: var(--green); }
.hs-card.dig .hs-badge .ico { width: 26px; height: 26px; }
/* Dig cue inside the pit radius but not "Dig here": controlled area (red) > position too uncertain (amber) */
.hs-card.controlled { background: rgba(120, 24, 24, .7); }
.hs-card.controlled .hs-dist { color: #ffb4ab; }
.hs-card.uncertain { background: rgba(110, 72, 8, .66); }
.hs-card.uncertain .hs-dist { color: #ffd79a; }
.hs-card.controlled .hs-meta, .hs-card.uncertain .hs-meta { white-space: normal; color: var(--fg); }
.hs-card.controlled .hs-badge, .hs-card.uncertain .hs-badge { color: #fff; }
.hs-card.controlled .hs-badge .ico, .hs-card.uncertain .hs-badge .ico { width: 24px; height: 24px; }
.offlimits { position: absolute; left: 50%; top: calc(var(--st) + 112px); transform: translateX(-50%); display: flex; align-items: center; gap: 8px; padding: 8px 16px; border-radius: 20px; background: var(--red); color: #fff; font-weight: 600; font-size: 14px; white-space: nowrap; box-shadow: var(--shadow); animation: drop .35s var(--spring); }
.offlimits .ico { width: 18px; height: 18px; }

/* Instruction card, prompts, toast, tracking lost */
.calib-banner { position: absolute; left: 50%; bottom: calc(var(--sb) + 98px); transform: translateX(-50%); width: min(calc(100vw - 24px), 440px); z-index: 25; padding: 14px 16px; border-radius: var(--r-l); background: var(--glass-strong); font-size: 15px; line-height: 1.35; animation: drop .35s var(--spring); }
.calib-banner .row { flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.calib-banner .row-gap { flex: 0 0 100%; height: 0; margin-top: -4px; }
.calib-banner .calib-pin { flex: 1 1 40%; justify-content: flex-start; min-width: 0; text-align: left; line-height: 1.2; padding-block: 6px; }
.calib-banner .chip-cancel { margin-left: auto; }
.calib-banner .calib-zoom { width: 40px; height: 40px; background: rgba(255, 255, 255, .14); box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
.calib-banner .calib-zoom .ico { width: 18px; height: 18px; }
.calib-banner .calib-step { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; opacity: .7; margin-bottom: 4px; }
.calib-banner[data-kind='step'] .calib-banner-text { font-size: 17px; font-weight: 600; }
.calib-banner .calib-step-sub { margin-top: 6px; font-size: 13px; opacity: .8; }
.calib-banner:not([hidden]) ~ .hs-card { display: none; }
.calib-fig8 { font-size: 34px; line-height: 1; color: var(--orange); animation: calib-wave 1.6s ease-in-out infinite; margin-right: auto; }
@keyframes calib-wave { 0%, 100% { transform: rotate(-20deg); } 50% { transform: rotate(20deg); } }
.calib-lost { position: absolute; left: 50%; top: 34%; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 18px 24px; border-radius: var(--r-l); background: rgba(60, 16, 18, .6); text-align: center; font-size: 15px; color: var(--fg2); pointer-events: none !important; animation: drop .35s var(--spring); }
.calib-lost strong { color: #fff; font-size: 19px; font-weight: 600; }
.lost-ico { width: 30px; height: 30px; color: var(--red); margin-bottom: 4px; }
.calib-toast { position: absolute; left: 50%; top: calc(var(--st) + 66px); transform: translate(-50%, -8px); padding: 9px 18px; border-radius: 20px; font-size: 14px; font-weight: 500; white-space: nowrap; pointer-events: none !important; opacity: 0; transition: opacity .25s var(--ease), transform .35s var(--spring); z-index: 40; }
.calib-toast.show { opacity: 1; transform: translate(-50%, 0); }

/* Bottom sheet */
.sheet { position: absolute; left: 0; right: 0; bottom: 0; margin: 0 auto; width: min(100%, 560px); max-height: min(82%, 720px); display: flex; flex-direction: column; z-index: 35;
  border-radius: 24px 24px 0 0; background: var(--glass-strong); padding-bottom: var(--sb);
  transform: translateY(100%); transition: transform .38s var(--spring); }
.sheet.open { transform: none; }
.sheet.dragging { transition: none; }
.sheet-handle { position: relative; flex: none; height: 22px; border: 0; background: none; touch-action: none; }
.sheet-handle::after { content: ''; position: absolute; left: 50%; top: 8px; width: 38px; height: 5px; margin-left: -19px; border-radius: 3px; background: rgba(255, 255, 255, .32); }
.sheet-head { flex: none; padding: 2px 20px 6px; touch-action: none; }
.sheet-head h2 { margin: 0; font-size: 20px; font-weight: 700; letter-spacing: -.01em; }
.sheet-body { flex: 1; overflow: auto; scrollbar-width: none; padding: 0 16px 20px; overscroll-behavior: contain; user-select: text; -webkit-user-select: text; }
.sheet-sec { margin-top: 20px; }
.sheet-cap { margin: 0 4px 8px; font-size: 13px; color: var(--fg2); text-transform: uppercase; letter-spacing: .04em; }
.calib-summary { padding: 6px 4px 0; }
.sum-val { font-size: 34px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.sum-val.q-rough { color: #ff8a80; } .sum-val.q-good { color: var(--yellow); } .sum-val.q-precise { color: var(--green); }
.sum-sub { color: var(--fg2); font-size: 14px; }
.calib-details { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0; padding: 12px 14px; border-radius: 14px; background: rgba(255, 255, 255, .06); font-size: 13.5px; }
.calib-details:empty { display: none; }
.calib-details dt { color: var(--fg2); }
.calib-details dd { margin: 0; font-variant-numeric: tabular-nums; }
.list { list-style: none; margin: 0; padding: 0; border-radius: 14px; background: rgba(255, 255, 255, .06); overflow: hidden; }
.list li { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 4px 16px; }
.list li + li { border-top: .5px solid var(--hair); }
.list .li-main { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list small { color: var(--fg2); font-variant-numeric: tabular-nums; }
.list small.bad { color: var(--red); }
.list li.empty { color: var(--fg2); font-size: 14px; }
.hs-list li { cursor: pointer; }
.hs-list li:active { background: var(--fill); }
.hs-list li.sel { background: rgba(255, 159, 10, .16); }
.hs-num { display: grid; place-items: center; flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--fill2); font-size: 13px; font-weight: 700; }
.hs-list li.sel .hs-num { background: var(--orange); color: #000; }
.status-lines { padding: 10px 14px; border-radius: 14px; background: rgba(255, 255, 255, .06); font-size: 13.5px; color: var(--fg2); display: flex; flex-direction: column; gap: 4px; }
.status-lines:empty { display: none; }
.status-lines .err { color: #ff8a80; }
.calib-run-row { flex-direction: row; align-items: center; gap: 12px; padding: 0 0 0 14px; border-radius: 12px; background: rgba(255, 255, 255, .06); font-size: 16px; color: var(--fg); }
.calib-run-row span { flex: none; }
.calib-run { background: transparent !important; text-align: right; font-variant-numeric: tabular-nums; }
.save-msg { min-height: 1.3em; margin-top: 8px; font-size: 13.5px; color: var(--fg2); text-align: center; }

/* First-run gesture hint */
.hint { position: absolute; left: 50%; top: 22%; transform: translateX(-50%); width: min(calc(100vw - 48px), 320px); padding: 16px 18px; border-radius: var(--r-l); background: var(--glass-strong); display: flex; flex-direction: column; gap: 12px; font-size: 14.5px; z-index: 45; animation: drop .5s .4s var(--spring) both; transition: opacity .4s var(--ease); }
.hint.gone { opacity: 0; }
.hint-row { display: flex; align-items: center; gap: 12px; }
.hint-g { position: relative; flex: none; width: 30px; height: 30px; border-radius: 50%; background: rgba(255, 255, 255, .9); }
.hint-g.tap { animation: tap 1.6s var(--ease) infinite; }
.hint-g.hold { background: rgba(255, 255, 255, .9) padding-box; box-shadow: 0 0 0 3px rgba(255, 255, 255, .2); }
.hint-g.hold::after { content: ''; position: absolute; inset: -5px; border-radius: 50%; padding: 3px; background: conic-gradient(#fff calc(var(--p, 0) * 1turn), transparent 0); -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0); animation: pick-fill 1.6s linear infinite; }
.hint-g.pill { width: 30px; height: 16px; margin: 7px 0; border-radius: 8px; background: rgba(255, 255, 255, .25); box-shadow: inset 6px 0 0 -2px var(--green); }
@keyframes tap { 0%, 60%, 100% { transform: scale(1); } 30% { transform: scale(.8); } }

/* Minimap card in WebXR: small, top right under the layers button, never over the reticle. */
.app.xr .minimap { top: auto; bottom: calc(var(--sb) + 182px); right: calc(12px + var(--sr)); width: 112px; height: 112px; border-radius: 20px; }
.app.xr .minimap:not(.expanded) .cesium-viewer-bottom { transform: scale(.36); max-width: 270%; opacity: .7; }
/* thumbnail: the data credits stay visible (Google Map Tiles terms: logo and attribution on screen), just small */
.minimap:not(.expanded) .cesium-credit-textContainer { font-size: 9px; line-height: 1.2; }
.app.xr .minimap.expanded { top: calc(var(--st) + 66px); left: calc(12px + var(--sl)); right: calc(12px + var(--sr)); bottom: calc(var(--sb) + 98px); width: auto; height: auto; }
.app.xr.marking .minimap.expanded { bottom: calc(var(--sb) + 256px); }
.app.xr.marking .calib-banner { bottom: calc(var(--sb) + 16px); max-height: calc(100% - 180px - var(--st) - var(--sb)); overflow: auto; }
.app.xr.marking .touch-stick, .app.xr.sheet-open .touch-stick { display: none; }
.app.xr.marking .calib-ui { z-index: 21; }
.app.xr.aiming .minimap { opacity: .4; pointer-events: none; }
.app.xr.aiming .calib-banner { top: calc(var(--st) + 66px); bottom: auto; }
.app.xr.sheet-open .fab-row, .app.xr.sheet-open .hs-card { opacity: 0; pointer-events: none !important; }
.app.xr .touch-stick { width: 104px; height: 104px; bottom: calc(var(--sb) + 176px); }

/* Idle: chrome steps back after a few seconds without input; any touch brings it back. */
.app.xr .xr-top, .app.xr .notice, .app.xr .hs-card, .app.xr .minimap { transition: opacity .25s var(--ease); }
.app.xr.idle .xr-top, .app.xr.idle .notice, .app.xr.idle .minimap:not(.expanded) { opacity: .45; transition: opacity 1.2s var(--ease); }
.app.xr.idle .fab-row, .app.xr.idle .hs-card:not(.dig) { opacity: .78; transition: opacity 1.2s var(--ease); }

@media (min-width: 700px) {
  .app.xr .minimap:not(.expanded) { width: 180px; height: 180px; }
}
/* Immersive AR (DOM overlay): the camera image is composited below the overlay, so backdrop-filter has nothing
   to blur, yet still costs a full-screen blur pass per change on the phone GPU. Same tint, no filter. */
:xr-overlay .glass, :xr-overlay .pill, :xr-overlay .round-btn, :xr-overlay .notice, :xr-overlay .popover, :xr-overlay .sheet,
:xr-overlay .calib-banner, :xr-overlay .calib-toast, :xr-overlay .calib-lost, :xr-overlay .hs-card, :xr-overlay .hint,
:xr-overlay .hud-panel, :xr-overlay .hud-status, :xr-overlay .hud-guide, :xr-overlay .touch-stick { -webkit-backdrop-filter: none; backdrop-filter: none; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
@media (prefers-reduced-transparency: reduce) {
  .glass, .pill, .round-btn, .notice, .popover, .sheet, .calib-banner, .calib-toast, .hs-card, .hint { background: var(--glass-strong); -webkit-backdrop-filter: none; backdrop-filter: none; }
}

/* WebXR session ended (ar-webxr.js): one tap reloads into the start screen */
.ar-ended {
  position: fixed; left: 50%; bottom: max(24px, env(safe-area-inset-bottom)); transform: translateX(-50%);
  z-index: 1000; display: flex; align-items: center; gap: 14px; padding: 12px 14px 12px 18px;
  border-radius: var(--r-s); font-size: 15px; font-weight: 600; white-space: nowrap;
}

/* AR permission walkthrough (permissions.js) */
.perm-backdrop {
  position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center;
  padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom)); background: rgba(0, 0, 0, .55);
}
.perm-guide { width: min(460px, 100%); max-height: 100%; overflow-y: auto; padding: 18px 18px 14px; border-radius: var(--r-l); }
.perm-guide h2 { margin: 0 0 6px; font-size: 20px; }
.perm-steps { list-style: none; margin: 12px 0; padding: 0; display: grid; gap: 10px; }
.perm-step { display: flex; gap: 12px; align-items: flex-start; padding: 10px; border-radius: var(--r-s); background: var(--fill); }
.perm-mark {
  flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  font-weight: 700; background: var(--fill2); color: var(--fg);
}
.perm-step.granted .perm-mark { background: var(--green); color: var(--solid-fg); }
.perm-step.denied .perm-mark { background: var(--red); color: #fff; }
.perm-body { flex: 1; min-width: 0; display: grid; gap: 4px; }
.perm-body .btn { justify-self: start; margin-top: 4px; }
.perm-help { margin: 2px 0 0; padding-left: 18px; font-size: 14px; color: var(--fg); }
.perm-help li { margin: 2px 0; }

/* Google key field: a text input masked with CSS, not type=password. A filled password field made password
   managers (Bitwarden) offer to save a login on every Start tap. */
input.masked { -webkit-text-security: disc; text-security: disc; }

/* ---- Phone landscape (S24: about 844x390 CSS px) ----
   Height is the scarce axis: stacks move to the sides, sheets become a right-hand column, the FAB sits bottom right
   under the thumb and the middle of the camera view stays clear. The camera notch and gesture bar sit left/right. */
@media (orientation: landscape) and (max-height: 500px) {
  /* Start screen: brand on the left, controls in a scrolling column on the right. */
  .start { max-width: none; justify-content: center; gap: 16px;
    padding: calc(var(--st) + 16px) calc(20px + var(--sr)) calc(var(--sb) + 16px) calc(42% + 12px); }
  .start > .hero { position: fixed; top: 0; bottom: 0; left: var(--sl); width: 42%; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 0 16px; }
  .start > :not(.hero) { width: 100%; max-width: 440px; margin-left: auto; margin-right: auto; }
  .app-mark { width: 64px; height: 64px; margin-bottom: 10px; }
  h1 { font-size: 28px; }
  .tagline { font-size: 15px; }

  /* Permission walkthrough: the three steps side by side. */
  .perm-backdrop { padding: max(10px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); }
  .perm-guide { width: min(820px, 100%); padding: 14px 16px 12px; }
  .perm-guide h2 { font-size: 18px; }
  .perm-steps { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); margin: 10px 0; }

  /* Bottom sheet -> right-hand column under the top bar, scrolls inside. */
  .sheet { top: calc(var(--st) + 64px); bottom: 0; left: auto; right: 0; margin: 0; width: min(45vw, 420px); max-height: none;
    border-radius: 24px 0 0 0; padding-right: var(--sr); transform: translateX(100%); }
  .sheet.open { transform: none; }
  .popover { max-height: calc(100dvh - var(--st) - var(--sb) - 92px); overflow-y: auto; }
  .minimap.expanded { left: calc(12px + var(--sl)); right: calc(12px + var(--sr)); }

  /* WebXR HUD (calib-ui.js) */
  .xr-top-right { flex-direction: row; align-items: flex-start; }
  .app.xr .minimap:not(.expanded) { top: calc(var(--st) + 66px); bottom: auto; width: 118px; height: 118px; }
  .app.xr .minimap.expanded { top: calc(var(--st) + 66px); bottom: calc(var(--sb) + 88px); }
  .app.xr.sheet-open .minimap:not(.expanded) { opacity: 0; pointer-events: none; }
  .fab-row { left: auto; right: calc(16px + var(--sr)); bottom: calc(var(--sb) + 16px); transform: none; }
  .hs-card { left: calc(12px + var(--sl)); bottom: calc(var(--sb) + 16px); transform: none; width: min(40vw, 340px); }
  .calib-banner { left: calc(12px + var(--sl)); bottom: calc(var(--sb) + 16px); transform: none; width: min(44vw, 400px); max-height: calc(100% - var(--st) - var(--sb) - 84px); overflow: auto; }
  /* Mark point: the map on the left, the instructions and pin buttons in a column on the right. */
  .app.xr.marking .calib-banner { left: auto; right: calc(12px + var(--sr)); top: calc(var(--st) + 66px); bottom: auto; max-height: calc(100% - var(--st) - var(--sb) - 78px); }
  .app.xr.aiming .calib-banner { max-height: calc(100% - var(--st) - var(--sb) - 160px); }
  .app.xr.marking .minimap.expanded { top: calc(var(--st) + 66px); bottom: calc(var(--sb) + 12px); right: calc(min(44vw, 400px) + 24px + var(--sr)); }
  .app.xr .touch-stick { left: calc(50% - 52px); bottom: calc(var(--sb) + 12px); }

  /* Simulator / camera AR HUD (ui.js): panel on the left, status + guide in a bottom column in the middle,
     map thumbnail and manager bar on the right. */
  .hud-panel, .app.touch .hud-panel { width: min(280px, 34vw); max-height: calc(100% - var(--st) - var(--sb) - 20px); }
  .app.touch .hud-panel { max-height: calc(100% - var(--st) - var(--sb) - 184px); }
  .hud-bottom { display: flex; flex-direction: column; align-items: center; gap: 8px; position: absolute; pointer-events: none;
    left: calc(min(280px, 34vw) + 22px + var(--sl)); right: calc(196px + var(--sr)); bottom: calc(var(--sb) + 12px); }
  .hud-bottom > * { pointer-events: auto; }
  .hud-bottom > .hud-status, .hud-bottom > .hud-guide, .hud-bottom > .ar-anchor { position: static; transform: none; max-width: 100%; }
  .hud-status { font-size: 11.5px; padding: 5px 12px; }
  .app:not(.xr) .minimap:not(.expanded) { top: calc(var(--st) + 66px); bottom: auto; width: min(36vh, 150px); height: min(36vh, 150px); }
  .app:not(.xr) .minimap.expanded { top: calc(var(--st) + 64px); left: calc(min(280px, 34vw) + 22px + var(--sl)); }
}

/* Select chevron: ink colour is baked into the data URI, so the dark variants are separate rules. */
@media (prefers-color-scheme: dark) { select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ebebf5' stroke-opacity='.6' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m7 10 5 5 5-5'/%3E%3C/svg%3E"); } }
.app select, .dark-surface select, .desk-map select, .dig-stage select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ebebf5' stroke-opacity='.6' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m7 10 5 5 5-5'/%3E%3C/svg%3E"); }

/* EN | CS switch (js/lang-toggle.js): inline in a header, or .lang-fixed in the start screen's top-right corner. */
.lang-tog { display: inline-flex; flex: none; gap: 2px; padding: 2px; border-radius: 999px; background: var(--fill); box-shadow: inset 0 0 0 1px var(--hair); }
.lang-tog button { min-width: 36px; min-height: 28px; padding: 0 8px; border: 0; border-radius: 999px; font: 600 13px var(--font); letter-spacing: .02em; color: var(--fg2); background: transparent; cursor: pointer; }
.lang-tog button[aria-pressed="true"] { color: var(--solid-fg); background: var(--solid-bg); cursor: default; }
.lang-tog button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.lang-tog.lang-fixed { position: fixed; top: calc(10px + var(--st, 0px)); right: calc(12px + var(--sr, 0px)); z-index: 20; padding: 4px; background: var(--glass); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); box-shadow: var(--shadow), inset 0 0 0 1px var(--hair); }
.lang-tog.lang-fixed button { min-height: 36px; }
