/* Jarvis tester-release mobile and interaction hardening. Loaded last on purpose. */
:root { --jarvis-mobile-gutter: 12px; }

/* PIP panel must be viewport-owned, never constrained by the 64px companion wrapper. */
@media (max-width: 767px) {
  html body #pipInsightPanel.pip-panel {
    position: fixed !important;
    inset: auto var(--jarvis-mobile-gutter) calc(104px + env(safe-area-inset-bottom, 0px)) var(--jarvis-mobile-gutter) !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    max-height: min(66dvh, 560px) !important;
    margin: 0 !important;
    transform: none !important;
    translate: none !important;
    box-sizing: border-box !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    overscroll-behavior: contain !important;
    z-index: 1002 !important;
    border-radius: 20px !important;
    padding: 14px !important;
  }
  html body #pipInsightPanel[hidden] { display: none !important; }
  html body.pip-panel-open::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 1001 !important;
    background: rgba(1, 7, 14, .68);
    pointer-events: auto !important;
  }
  html body #pipCompanion {
    contain: none !important;
    isolation: auto !important;
  }
  html body #pipCompanion.is-open {
    width: 64px !important;
    max-width: 64px !important;
    left: auto !important;
    right: max(12px, env(safe-area-inset-right, 0px)) !important;
  }
  html body #pipInsightPanel .pip-panel-head {
    position: sticky;
    top: -14px;
    z-index: 2;
    margin: -14px -14px 10px;
    padding: 14px;
    background: rgba(8, 20, 35, .98);
    border-bottom: 1px solid rgba(130, 192, 240, .28);
  }
  html body #pipInsightPanel .pip-panel-title { max-width: calc(100% - 82px); }
  html body #pipInsightPanel .pip-panel-body p { font-size: 14px !important; line-height: 1.48 !important; overflow-wrap: anywhere; }
  html body #pipInsightPanel .pip-panel-actions { align-items: stretch !important; }
  html body #pipInsightPanel .pip-hub-launch { width: 100%; }

  /* No global action dock over content or dialogs. */
  body.jarvis-controls-open #propControlBarRoot,
  body.prop-modal-active #propControlBarRoot,
  body.pip-panel-open #propControlBarRoot { display: none !important; }

  /* Prop profile is a true mobile dialog with reachable fields and footer. */
  html body #propModalRoot.prop-modal-root {
    position: fixed !important;
    inset: 0 !important;
    width: 100vw !important;
    height: 100dvh !important;
    z-index: 1100 !important;
    padding: max(8px, env(safe-area-inset-top, 0px)) 8px max(8px, env(safe-area-inset-bottom, 0px)) !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
  }
  #propModalRoot .prop-modal-card {
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    max-height: none !important;
    display: grid !important;
    grid-template-rows: auto minmax(0, 1fr) auto !important;
    overflow: hidden !important;
  }
  #propModalRoot .prop-modal-scroll-area { min-height: 0 !important; overflow-y: auto !important; padding-bottom: 140px !important; }
  #propModalRoot .prop-form-actions-sticky { position: sticky !important; bottom: 0 !important; z-index: 4 !important; display: grid !important; grid-template-columns: 1fr !important; gap: 10px !important; background: rgba(8, 20, 35, .98) !important; padding: 12px 0 calc(12px + env(safe-area-inset-bottom, 0px)) !important; }
  #propModalRoot .prop-form-actions-sticky button { width: 100% !important; min-height: 52px !important; }
}

/* Clean raw data states and lower-timeframe lane presentation. */
.mnq-micro-lanes { margin: 16px 0; padding: 14px; border: 1px solid rgba(96, 205, 255, .25); border-radius: 18px; background: rgba(4, 16, 29, .48); }
.mnq-risk-lane-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.mnq-risk-lane { min-width: 0; padding: 14px; border-radius: 15px; border: 1px solid rgba(118, 176, 226, .28); background: rgba(7, 18, 32, .82); }
.mnq-risk-lane header { display: grid; gap: 4px; margin-bottom: 10px; }
.mnq-risk-lane header span, .mnq-risk-lane p { color: var(--text-muted); font-size: 12px; line-height: 1.45; }
.mnq-risk-lane div { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; border-top: 1px solid rgba(118, 176, 226, .12); }
.mnq-risk-lane div span { color: var(--text-muted); font-size: 12px; }
.mnq-risk-lane[data-lane="tight"] { border-color: rgba(81, 219, 255, .38); }
.mnq-risk-lane[data-lane="balanced"] { border-color: rgba(92, 235, 174, .38); }
.mnq-risk-lane[data-lane="structural"] { border-color: rgba(255, 194, 94, .38); }
@media (max-width: 800px) { .mnq-risk-lane-grid { grid-template-columns: 1fr; } }

/* Keep the intro smooth on phones without hiding its established art. */
@media (max-width: 767px), (prefers-reduced-motion: reduce) {
  .access-gateway *, .intro-cinematic * { animation-duration: .45s !important; animation-iteration-count: 1 !important; }
}
