body { margin: 0; font: 16px system-ui, sans-serif; }
#controls { position: absolute; z-index: 2; top: 12px; left: 12px; width: min(390px, calc(100vw - 48px)); max-height: calc(100dvh - 110px); overflow: auto; background: #fffffff2; color: #182533; border-radius: 10px; padding: 12px; box-shadow: 0 2px 16px #0003; }
summary { cursor: pointer; font-weight: 700; margin-bottom: 8px; }
label { display: block; }
button, select, input { font: inherit; padding: 8px; max-width: 100%; box-sizing: border-box; }
button { cursor: pointer; }
select { width: 100%; }
.buttons, .coordinates { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.coordinates label { flex: 1 1 42%; }
input { width: 100%; }
fieldset { border: 1px solid #9aaaba; border-radius: 6px; margin: 12px 0; }
p { font-size: 14px; line-height: 1.4; }
.immersive #controls { display: none; }
#ar-overlay { display: none; }
body.ar-walking #ar-overlay { display: block; position: fixed; z-index: 3; inset: 0; pointer-events: none; }
#ar-controls { position: absolute; left: 8px; right: 8px; bottom: 8px; max-height: 45dvh; overflow: auto; padding: 10px; border-radius: 10px; background: #fffffff2; color: #182533; pointer-events: auto; }
#ar-controls p { margin: 4px 0; }
#ar-controls select { width: auto; }

#walking-map { display: block; width: 100%; height: auto; background: #f3f6f8; border: 1px solid #9aaaba; cursor: crosshair; touch-action: manipulation; }

#live-test-panel { margin: 8px 0; padding: 10px; border: 2px solid #38618a; border-radius: 8px; background: #fff; color: #182533; pointer-events: auto; }
#live-test-panel input[type=checkbox] { width: auto; }
#live-test-panel [data-instruction] { font-size: 16px; }

/* Setup is opened deliberately; the camera view keeps only compact controls. */
#controls > summary { margin: 0; min-height: 24px; }
#controls > details, #walking-setup > details { margin: 12px 0; padding: 10px 0; border-top: 1px solid #cbd5df; }
#controls > details > summary { min-height: 28px; }
.ar-toolbar { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 6px; }
.ar-toolbar > button { white-space: nowrap; min-height: 44px; }
#ar-options { flex: 1; min-width: 0; }
#ar-options > summary { box-sizing: border-box; min-height: 44px; padding: 10px; margin: 0; border: 1px solid #9aaaba; border-radius: 5px; }
.ar-toolbar:has(#ar-options[open]) { flex-wrap: wrap; }
#ar-options[open] { order: 3; flex-basis: 100%; }
#ar-options select { width: 100%; }
#ar-controls { background: #fffffff5; max-height: 48dvh; }
#live-test-panel { border: 0; padding: 0; margin: 8px 0 0; }
#live-test-panel summary { min-height: 36px; margin: 0; display: list-item; padding: 4px 0; box-sizing: border-box; }
#live-test-panel [data-card] > summary { font-weight: 700; }
#live-test-panel [data-progress] { float: right; font-weight: 400; }
#live-test-panel h2 { font-size: 17px; margin: 4px 0; }
#live-test-panel [data-instruction] { font-size: 15px; line-height: 1.35; margin: 6px 0; }
#live-test-panel button { min-height: 44px; }
#live-test-panel [data-ready], #live-test-panel [data-begin] { background: #174e7d; color: white; border: 0; border-radius: 5px; }
#live-test-panel [data-output] { font-size: 13px; }
#live-test-panel [data-more] { border-top: 1px solid #d2dce5; }
#live-test-panel [data-more] button { margin: 3px 0; }
#live-test-panel [data-help] p { margin: 4px 0 8px; }
body.ar-walking:has(#live-test-panel) #ar-controls { max-height: 48dvh; }
body.ar-walking #live-test-panel form { display: none; }
[hidden] { display: none !important; }
@media (max-width: 600px), (max-height: 500px) {
  #controls[open] { position: fixed; inset: 0; width: 100%; max-height: 100dvh; border-radius: 0; box-sizing: border-box; background: #fff; padding: 12px 16px; }
  #controls[open] > summary { position: sticky; top: -12px; background: #fff; z-index: 1; padding: 12px 0; border-bottom: 1px solid #cbd5df; }
  #ar-controls { bottom: max(8px, env(safe-area-inset-bottom)); }
}
@media (max-height: 500px) {
  body.ar-walking:has(#live-test-panel) #ar-controls { max-height: 58dvh; }
}


#cal-model { display: block; width: 100%; height: auto; background: #e9eff4; touch-action: none; cursor: crosshair; }
.cal-pan { display: grid; grid-template-areas: ". north ." "west fit east" ". south ."; grid-template-columns: 1fr 1fr 1fr; gap: 4px; margin: 8px 0; }
.cal-pan button { min-height: 44px; }
#cal-north { grid-area: north; }
#cal-west { grid-area: west; }
#cal-fit { grid-area: fit; }
#cal-east { grid-area: east; }
#cal-south { grid-area: south; }
.cal-point { display: flex; gap: 6px; align-items: end; margin: 8px 0; }
.cal-point label { flex: 1; min-width: 0; overflow-wrap: anywhere; }
#cal-crosshair { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); font: 40px monospace; color: white; text-shadow: 0 0 3px black; pointer-events: none; }
#cal-live input[type=checkbox] { width: auto; }
#cal-live { margin-bottom: 8px; }
#cal-live select { width: 100%; }
