/* FlowCAD3D — walk-through mode ("Doorloopmodus", js/3d/walk.js + js/ui/walk-hud.js). Colours from the theme
   tokens of css/app.css (light brand theme and dark theme). Tablet mode: every target at least 44 px. */

/* while walking the drawing tools, the view buttons, the axis triad and the panel tabs make room for the HUD */
body.walk-mode #palette, body.walk-mode #viewbar, body.walk-mode #ws-model .triad, body.walk-mode .fc-drawer-handle,
body.walk-mode #hint, body.walk-mode .sec-panel { display: none !important; }
body.walk-mode #viewport { cursor: var(--cur-grab); }
body.walk-mode.walk-looking #viewport { cursor: var(--cur-grabbing); }
body.walk-mode.walk-locked #viewport { cursor: none; }

.wk-hud { position: absolute; inset: 0; z-index: 32; pointer-events: none; color: var(--fg); font-size: 13px; user-select: none; -webkit-user-select: none;
  --wk-l: max(10px, calc(var(--safe-l, 0px) + 6px)); --wk-r: max(10px, calc(var(--safe-r, 0px) + 6px));
  --wk-b: max(12px, calc(var(--safe-b, 0px) + 6px)); --wk-joy: 140px; }
.wk-hud > * { pointer-events: auto; }
.wk-hud .wk-cross, .wk-hud .wk-readout, .wk-hud .wk-hint { pointer-events: none; }
.wk-hud .btn { touch-action: none; }

/* settings panel */
.wk-panel { position: absolute; left: var(--wk-l); top: 10px; width: 272px; max-width: calc(100% - 20px);
  max-height: calc(100% - 20px); overflow: auto; overscroll-behavior: contain; display: flex; flex-direction: column; gap: 8px;
  padding: 6px; background: var(--overlay-bg); border: 1px solid var(--line2); border-radius: 12px; box-shadow: var(--shadow); }
.wk-head { display: flex; align-items: center; gap: 6px; }
.wk-head .wk-mode { flex: 1; }
.wk-mode .btn { flex: 1; border-radius: 0; font-weight: 600; }
.wk-toggle.active { background: var(--accentbg); border-color: var(--accent); }
.wk-body { display: flex; flex-direction: column; gap: 8px; padding: 0 4px 4px; }
.wk-panel.collapsed { width: auto; }
.wk-panel.wk-over { z-index: 3; }
.wk-panel.collapsed .wk-body { display: none; }
.wk-title { display: flex; align-items: center; gap: 6px; font-weight: 700; font-size: 13px; }
.wk-title .ico { width: 20px; height: 20px; color: var(--accent); }
.wk-row { display: flex; align-items: center; gap: 6px; min-height: 36px; }
.wk-k { flex: 1; color: var(--fg2); white-space: nowrap; }
.wk-val { min-width: 58px; text-align: center; font-variant-numeric: tabular-nums; font-weight: 600; }
.wk-row .wk-val:last-child { min-width: 38px; text-align: right; }
.wk-step { min-width: 40px; font-size: 18px; font-weight: 700; border-color: var(--line2); }
.wk-eye { width: 86px; flex: none; text-align: right; font-variant-numeric: tabular-nums; user-select: text; -webkit-user-select: text; }
.wk-fov { flex: 1.2; min-width: 90px; accent-color: var(--accent); }
.wk-tgl { justify-content: flex-start; border-color: var(--line2); }
.wk-tgl[aria-pressed="true"] { background: var(--accentbg); border-color: var(--accent); }
.wk-help { margin: 2px 0 0; padding: 8px 0 0 16px; border-top: 1px solid var(--line); color: var(--fg3); font-size: 12px; line-height: 1.45; }
.wk-help li + li { margin-top: 2px; }

/* exit */
.wk-exit { position: absolute; right: var(--wk-r); top: 10px; min-height: 44px; padding: 0 14px; border-radius: 10px; box-shadow: var(--shadow); }
.wk-exit .wk-exit-s { display: none; }
.wk-narrow .wk-exit .wk-exit-l { display: none; }
.wk-narrow .wk-exit .wk-exit-s { display: inline; }

/* crosshair, lock hint, object data */
.wk-cross { position: absolute; left: 50%; top: 50%; width: 8px; height: 8px; margin: -4px 0 0 -4px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 0 2px rgba(255, 255, 255, .9), 0 0 0 3px rgba(11, 30, 58, .35); }
.wk-hint { position: absolute; left: 50%; top: calc(50% - 56px); transform: translateX(-50%); max-width: min(420px, calc(100% - 24px));
  padding: 6px 12px; border-radius: 8px; background: var(--lbl-bg); color: var(--lbl-fg); text-align: center; font-size: 12px; }
.wk-info { position: absolute; left: 50%; top: calc(50% + 22px); transform: translateX(-50%); display: flex; align-items: flex-start; gap: 4px;
  width: max-content; max-width: min(380px, calc(100% - 24px)); padding: 8px 4px 8px 12px; background: var(--overlay-bg);
  border: 1px solid var(--accent); border-radius: 10px; box-shadow: var(--shadow); }
.wk-info[hidden], .wk-hint[hidden] { display: none; }
.wk-info-t { flex: 1; min-width: 0; line-height: 1.4; padding-top: 2px; }
.wk-info-t b { font-size: 13px; }
.wk-info-l { color: var(--fg2); overflow-wrap: anywhere; }
.wk-info-d { color: var(--fg3); font-size: 12px; margin-top: 2px; }
.wk-info-x { min-width: 36px; min-height: 36px; }

/* compass and position */
.wk-readout { position: absolute; left: 50%; bottom: var(--wk-b); transform: translateX(-50%); display: flex; align-items: center; gap: 8px;
  padding: 4px 12px 4px 4px; background: var(--overlay-bg); border: 1px solid var(--line2); border-radius: 32px; box-shadow: var(--shadow); white-space: nowrap; }
.wk-compass { width: 56px; height: 56px; color: var(--fg2); flex: none; }
.wk-compass svg { display: block; }
.wk-c-ring { fill: var(--bg3); stroke: var(--line2); stroke-width: 1.5; }
.wk-c-head { fill: var(--accent); }
.wk-rtxt { line-height: 1.35; }
.wk-pk { color: var(--fg3); font-size: 11px; text-transform: uppercase; letter-spacing: .05em; }
.wk-pos { font-variant-numeric: tabular-nums; font-weight: 600; }
.wk-floor { color: var(--fg2); font-size: 12px; max-width: 260px; overflow: hidden; text-overflow: ellipsis; }

/* tablet: joystick and up/down */
.wk-joy { position: absolute; left: calc(var(--wk-l) + 6px); bottom: var(--wk-b); width: var(--wk-joy); height: var(--wk-joy); border-radius: 50%;
  touch-action: none; user-select: none; -webkit-user-select: none; background: color-mix(in srgb, var(--overlay-bg) 70%, transparent);
  border: 2px solid var(--line2); box-shadow: var(--shadow); }
.wk-joy::before { content: ''; position: absolute; inset: 22%; border-radius: 50%; border: 1px dashed var(--line2); }
.wk-knob { position: absolute; left: 50%; top: 50%; width: 58px; height: 58px; margin: -29px 0 0 -29px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 2px 8px rgba(11, 30, 58, .35), inset 0 0 0 3px rgba(255, 255, 255, .35); pointer-events: none; }
.wk-joy:not(.on) .wk-knob { transition: transform .12s ease-out; }
.wk-joy.on { border-color: var(--accent); }
.wk-vert { position: absolute; right: var(--wk-r); bottom: var(--wk-b); display: none; flex-direction: column; gap: 10px; }
.wk-fly .wk-vert { display: flex; }
.wk-vert .btn { width: 56px; height: 56px; border-radius: 50%; background: var(--overlay-bg); border: 1px solid var(--line2); box-shadow: var(--shadow); }
.wk-vert .btn.active { background: var(--accent); color: #FFFFFF; border-color: var(--accent); }
.wk-vert .btn .ico { width: 26px; height: 26px; }
.wk-vert .wk-v-up .ico { transform: rotate(-90deg); }
.wk-vert .wk-v-down .ico { transform: rotate(90deg); }

/* tablet mode: large targets */
.wk-touch .wk-panel .btn, .wk-touch .wk-exit { min-height: 44px; min-width: 44px; }
.wk-touch .wk-eye { min-height: 44px; }
.wk-touch .wk-fov { min-height: 44px; }
.wk-touch .wk-info-x { min-width: 44px; min-height: 44px; }
.wk-touch .wk-readout { bottom: var(--wk-b); }

/* small drawing area (phone, landscape phone): compact readout, smaller joystick; the readout goes above the
   joystick on a narrow screen so nothing overlaps */
.wk-narrow .wk-readout { padding-right: 10px; }
.wk-narrow .wk-pk, .wk-short .wk-pk { display: none; }
.wk-narrow .wk-pos { font-size: 12px; }
.wk-touch.wk-narrow .wk-readout { bottom: calc(var(--wk-b) + var(--wk-joy) + 10px); }
.wk-short { --wk-joy: 116px; }
.wk-short .wk-compass, .wk-short .wk-compass svg { width: 44px; height: 44px; }
.wk-short .wk-knob { width: 50px; height: 50px; margin: -25px 0 0 -25px; }
.wk-short .wk-vert { gap: 6px; }
.wk-short .wk-vert .btn { width: 48px; height: 48px; }
/* low drawing area (landscape phone): the readout moves to the top between the settings and the exit button
   (short exit label), the object data to the bottom between the joystick and the up/down buttons */
.wk-short .wk-exit .wk-exit-l { display: none; }
.wk-short .wk-exit .wk-exit-s { display: inline; }
.wk-short:not(.wk-narrow) .wk-readout { top: 10px; bottom: auto; padding: 2px 10px 2px 2px; }
.wk-short .wk-info { top: auto; bottom: var(--wk-b); }
.wk-touch.wk-short:not(.wk-narrow) .wk-info { left: calc(var(--wk-l) + var(--wk-joy) + 24px); right: calc(var(--wk-r) + 64px); transform: none; width: auto; max-width: none; }
.wk-panel:not(.collapsed) { z-index: 2; }
