/* Vistructor Outdoor v30 · smartphone hardening for Carport + Outdoor Bar/Kitchen.
   Desktop/tablet behavior is intentionally unchanged. */

.vmobile-touch-toggle,
.vmobile-arrange-toggle,
.vmobile-view-controls { display: none; }

@media screen and (max-width: 760px) {
  .carport-module-shell,
  #vok-module.vok-module-shell {
    width: 100vw !important;
    max-width: 100vw !important;
    overflow-x: hidden !important;
  }

  /* Smartphone interaction contract:
     Scroll mode = vertical finger gesture belongs to the page.
     Interact mode = the 3D canvas receives full pointer gestures. */
  .carport-module-shell.vmobile-scroll-mode .tent-viewer canvas,
  #vok-module.vmobile-scroll-mode .vok-canvas-wrap .vok-gl-canvas {
    touch-action: pan-y !important;
    pointer-events: none !important;
  }

  .carport-module-shell.vmobile-interact .tent-viewer canvas,
  #vok-module.vmobile-interact .vok-canvas-wrap .vok-gl-canvas {
    touch-action: none !important;
    pointer-events: auto !important;
  }

  /* Keep the dimension/annotation overlay non-interactive. */
  #vok-module .vok-overlay-canvas { pointer-events: none !important; }

  /* Always-visible mobile 3D controls. They live inside the viewer rather than the
     horizontally scrolling desktop toolbar, so they cannot disappear off-screen. */
  .vmobile-view-controls {
    display: flex !important;
    position: absolute !important;
    z-index: 42 !important;
    top: 10px !important;
    left: 10px !important;
    right: 10px !important;
    width: max-content !important;
    max-width: calc(100% - 20px) !important;
    gap: 7px !important;
    align-items: center !important;
    pointer-events: auto !important;
  }

  .vmobile-touch-toggle,
  .vmobile-arrange-toggle {
    display: inline-flex !important;
    flex: 0 0 auto !important;
    min-width: max-content !important;
    min-height: 44px !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
    padding: 0 12px !important;
    border: 1px solid #90a695 !important;
    border-radius: 9px !important;
    background: rgba(247,250,246,.96) !important;
    color: #214b31 !important;
    box-shadow: 0 6px 18px rgba(27,52,37,.16) !important;
    font: 800 11px/1 system-ui,-apple-system,"Segoe UI",sans-serif !important;
    white-space: nowrap !important;
    backdrop-filter: blur(10px) !important;
  }
  .vmobile-touch-toggle[aria-pressed="true"],
  .vmobile-arrange-toggle[aria-pressed="true"] {
    border-color: #285b37 !important;
    background: #285b37 !important;
    color: #fff !important;
  }
  .vmobile-touch-toggle::before { content: "☝"; font-size: 14px; line-height: 1; }
  .vmobile-arrange-toggle::before { content: "↔"; font-size: 15px; line-height: 1; }

  /* CARPORT — one natural vertical flow, no nested control-panel scrolling. */
  .carport-module-shell .tent-configurator {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    min-width: 0 !important;
    overflow: visible !important;
  }
  .carport-module-shell .tent-control-panel {
    min-height: 0 !important;
    height: auto !important;
    overflow: visible !important;
    border-right: 0 !important;
  }
  .carport-module-shell .tent-panel-fields,
  .carport-module-shell .carport-panel-fields {
    max-height: none !important;
    height: auto !important;
    overflow: visible !important;
    padding: 10px 12px 14px !important;
  }
  .carport-module-shell .panel-navigation {
    position: sticky !important;
    bottom: 0 !important;
    z-index: 18 !important;
    padding: 8px 10px max(8px, env(safe-area-inset-bottom)) !important;
    background: rgba(255,254,250,.96) !important;
    backdrop-filter: blur(10px) !important;
  }
  .carport-module-shell .panel-navigation button {
    min-height: 46px !important;
    font-size: 13px !important;
  }
  .carport-module-shell .tent-visualizer,
  .carport-module-shell .carport-viewer {
    width: 100% !important;
    min-width: 0 !important;
  }
  .carport-module-shell .tent-viewer,
  .carport-module-shell .tent-visualizer .viewer-stage { position: relative !important; }
  .carport-module-shell .tent-visualizer .viewer-stage {
    height: clamp(510px, 70svh, 640px) !important;
    min-height: 510px !important;
  }
  .carport-module-shell .tent-viewer-actions {
    left: 10px !important;
    right: 10px !important;
    top: 66px !important;
    max-width: calc(100% - 20px) !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    scroll-snap-type: x proximity !important;
    -webkit-overflow-scrolling: touch !important;
  }
  .carport-module-shell .tent-viewer-actions > * { scroll-snap-align: start !important; }
  .carport-module-shell .tent-viewer-actions button,
  .carport-module-shell .tent-viewer-actions label {
    min-height: 42px !important;
    height: 42px !important;
    padding-inline: 10px !important;
    font-size: 11px !important;
  }
  .carport-module-shell .tent-cad-status {
    top: 114px !important;
    left: 10px !important;
    max-width: calc(100% - 20px) !important;
  }
  .carport-module-shell .carport-material-hud {
    min-width: 0 !important;
    max-width: calc(100% - 20px) !important;
    left: 10px !important;
    right: auto !important;
    bottom: 12px !important;
    padding: 7px 9px !important;
  }
  .carport-module-shell .carport-model-grid > button {
    grid-template-columns: 60px minmax(0,1fr) 24px !important;
    min-height: 94px !important;
    gap: 9px !important;
  }
  .carport-module-shell .carport-model-grid > button > span:nth-child(2) strong { font-size: 13px !important; }
  .carport-module-shell .carport-model-grid > button > span:nth-child(2) p { font-size: 10.5px !important; line-height: 1.4 !important; }
  .carport-module-shell .carport-model-grid > button > span:nth-child(2) small { font-size: 9px !important; }
  .carport-module-shell input,
  .carport-module-shell select,
  .carport-module-shell textarea { font-size: 16px !important; }

  /* BAR / KITCHEN — vertically scrollable smartphone workspace. */
  #vok-module.vok-module-shell {
    position: fixed !important;
    inset: 0 !important;
    height: 100dvh !important;
    min-height: 100dvh !important;
    display: block !important;
    overflow-y: auto !important;
    overscroll-behavior-y: contain !important;
    -webkit-overflow-scrolling: touch !important;
    padding-bottom: env(safe-area-inset-bottom) !important;
    background: #f1eee7 !important;
  }
  #vok-module > .topbar {
    position: sticky !important;
    top: 0 !important;
    z-index: 70 !important;
  }
  #vok-module > .vok-workflow-header {
    position: sticky !important;
    top: 40px !important;
    z-index: 65 !important;
    width: 100% !important;
  }
  #vok-module .vok-configurator {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    min-width: 0 !important;
    min-height: 0 !important;
    height: auto !important;
    overflow: visible !important;
  }
  #vok-module .vok-control-panel {
    display: block !important;
    width: 100% !important;
    min-height: 0 !important;
    height: auto !important;
    overflow: visible !important;
    border-right: 0 !important;
    border-bottom: 1px solid var(--vok-line) !important;
    scroll-margin-top: 86px !important;
  }
  #vok-module .vok-panel-heading { min-height: 56px !important; height: auto !important; }
  #vok-module .vok-panel-fields {
    max-height: none !important;
    min-height: 0 !important;
    height: auto !important;
    overflow: visible !important;
    padding: 10px 11px 14px !important;
  }
  #vok-module .vok-panel-navigation {
    position: sticky !important;
    bottom: 0 !important;
    z-index: 40 !important;
    padding: 8px 10px max(8px, env(safe-area-inset-bottom)) !important;
    background: rgba(255,254,250,.96) !important;
    backdrop-filter: blur(10px) !important;
  }
  #vok-module .vok-panel-navigation button { min-height: 46px !important; font-size: 13px !important; }
  #vok-module .vok-field input[type="text"],
  #vok-module .vok-field input[type="number"],
  #vok-module .vok-field select,
  #vok-module .vok-field textarea { min-height: 44px !important; font-size: 16px !important; }
  #vok-module .vok-check { min-height: 44px !important; font-size: 12px !important; }
  #vok-module .vok-field > span { font-size: 12px !important; }
  #vok-module .vok-field-group > h3 { font-size: 11px !important; }
  #vok-module .vok-field-group > p { font-size: 11px !important; }

  #vok-module .vok-visualizer {
    width: 100% !important;
    min-width: 0 !important;
    height: clamp(540px, 74svh, 690px) !important;
    min-height: 540px !important;
    display: grid !important;
    grid-template-rows: auto minmax(0,1fr) !important;
    overflow: hidden !important;
  }
  #vok-module .vok-view-toolbar {
    width: 100% !important;
    max-width: 100% !important;
    min-height: 48px !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    flex-wrap: nowrap !important;
    gap: 6px !important;
    padding: 4px 7px !important;
    scroll-snap-type: x proximity !important;
    -webkit-overflow-scrolling: touch !important;
  }
  #vok-module .vok-view-toolbar > * { flex: 0 0 auto !important; scroll-snap-align: start !important; }
  #vok-module .vok-view-switch button,
  #vok-module .vok-tool-button,
  #vok-module .vok-tool-check { min-height: 40px !important; font-size: 11px !important; }
  #vok-module .vok-tool-check { padding-inline: 7px !important; }
  #vok-module .vok-canvas-wrap { min-height: 480px !important; position: relative !important; }

  /* The mobile dock occupies the top of the 3D window, so move help below it. */
  #vok-module .vok-interaction-hint {
    left: 8px !important;
    right: 8px !important;
    top: 64px !important;
    max-width: calc(100% - 16px) !important;
    padding: 7px 9px !important;
  }
  #vok-module .vok-interaction-hint b { font-size: 11px !important; }
  #vok-module .vok-interaction-hint span { font-size: 10px !important; }
  #vok-module .vok-selection-panel {
    left: 8px !important;
    right: 8px !important;
    top: auto !important;
    bottom: 8px !important;
    width: auto !important;
    max-width: none !important;
    max-height: 180px !important;
    overflow-y: auto !important;
  }
  #vok-module .vok-summary-panel { display: none !important; }
  #vok-module .vok-workspace { inset: 48px 0 0 !important; padding: 8px !important; }
}

@media screen and (max-width: 390px) {
  .carport-module-shell .tent-viewer-actions button,
  .carport-module-shell .tent-viewer-actions label,
  #vok-module .vok-view-switch button,
  #vok-module .vok-tool-button,
  #vok-module .vok-tool-check,
  .vmobile-touch-toggle,
  .vmobile-arrange-toggle { font-size: 10.5px !important; }

  .vmobile-touch-toggle,
  .vmobile-arrange-toggle { padding-inline: 9px !important; }
  #vok-module .vok-visualizer { height: clamp(520px, 72svh, 650px) !important; min-height: 520px !important; }
  #vok-module .vok-canvas-wrap { min-height: 460px !important; }
  .carport-module-shell .tent-visualizer .viewer-stage { height: clamp(500px, 68svh, 610px) !important; min-height: 500px !important; }
}
