/* PokeTeamOn M8.3 v0.2.1 — actual mobile sheet hierarchy.
   Additive to v0.2.0. No editor, result, engine or desktop ownership. */
@media (max-width:820px) {
  html.ptm8so-mobile-page :is(.basic-legality-panel,.basic-analysis-panel).ptm8so-live-panel-overlay {
    --ptm83-sheet-canvas:#f3f5f9;
    --ptm83-sheet-line:#d6dce8;
    background:var(--ptm83-sheet-canvas)!important;
    border:1px solid var(--ptm83-sheet-line)!important;
    border-bottom:0!important;
    border-radius:24px 24px 0 0!important;
    padding:12px 14px calc(20px + env(safe-area-inset-bottom))!important;
    box-shadow:none!important;
  }
  /* The gradient is a distinct, inset section—not the entire sheet surface. */
  html.ptm8so-mobile-page :is(.basic-legality-panel,.basic-analysis-panel).ptm8so-live-panel-overlay
  > :is(.basic-legality-heading,.basic-analysis-heading) {
    display:grid;
    grid-template-columns:minmax(0,1fr);
    gap:0;
    margin:0 0 14px!important;
    padding:15px 14px 14px!important;
    border:1px solid rgba(255,255,255,.3);
    border-radius:16px!important;
    background:var(--ptm83-gradient);
    color:#fff;
    box-shadow:none;
  }
  /* Override the later v0.2.0 generic Run rule, which restores its gradient. */
  html.ptm8so-mobile-page .ptm8so-live-panel-overlay
  :is(.basic-legality-heading > button[data-basic-legality-run],
      .basic-analysis-heading > button[data-basic-analysis-run]) {
    display:block;
    width:100%;
    min-height:48px;
    margin:12px 0 0;
    padding:10px 14px;
    border:1px solid rgba(255,255,255,.9);
    border-radius:11px;
    background:#fff;
    color:#155eef;
    font:inherit;
    font-size:13px;
    font-weight:800;
    line-height:1.4;
    box-shadow:none;
    touch-action:manipulation;
  }
  /* Results are white cards on the neutral canvas, with a visible boundary. */
  html.ptm8so-mobile-page :is(.basic-legality-panel,.basic-analysis-panel).ptm8so-live-panel-overlay
  > :is(.basic-legality-result,.basic-analysis-result) {
    box-sizing:border-box;
    margin:0!important;
    padding:14px!important;
    border:1px solid #d8deea!important;
    border-radius:16px!important;
    background:#fff!important;
    box-shadow:none!important;
  }
  html.ptm8so-mobile-page .basic-analysis-panel.ptm8so-live-panel-overlay .basic-analysis-grid {
    margin-top:14px;
    gap:10px;
  }
  /* Preserve the meaningful nested evidence cards, without extra paint effects. */
  html.ptm8so-mobile-page .basic-analysis-panel.ptm8so-live-panel-overlay .basic-analysis-card {
    border-color:#e0e5ef;
    background:#fff;
    box-shadow:none;
  }
  /* Close remains the real M8.2 owner control. A read-only geometry follower
     supplies the top coordinate; the legacy 18vh position is only a fallback. */
  html.ptm8so-mobile-page.ptm8so-sheet-open .ptm8so-live-panel-close {
    top:var(--ptm83-live-close-top,calc(18vh + 10px))!important;
    right:15px;
    width:42px;
    height:42px;
    border:1px solid #d8deea;
    border-radius:11px;
    background:#fff;
    color:#344054;
    font-size:25px;
    line-height:1;
    box-shadow:none!important;
    touch-action:manipulation;
  }
  /* A small persistent label does not obscure the actual tool or its results. */
  [data-ptm83-perf] {position:fixed;top:8px;left:8px;z-index:2147483000;
    max-width:min(330px,calc(100vw - 16px));font:12px/1.45 system-ui,sans-serif;
    color:#101828;box-sizing:border-box;}
  [data-ptm83-perf] * {box-sizing:border-box;}
  [data-ptm83-perf] .ptm83-perf-tab {display:block;border:1px solid #cbd5e1;
    border-radius:9px;background:#fff;color:#101828;padding:6px 10px;
    font:inherit;font-weight:800;box-shadow:none;}
  [data-ptm83-perf] .ptm83-perf-panel {margin-top:6px;padding:12px;
    border:1px solid #cbd5e1;border-radius:12px;background:#fff;color:#101828;
    max-height:60vh;overflow:auto;box-shadow:none;}
  [data-ptm83-perf] .ptm83-perf-actions {display:flex;flex-wrap:wrap;gap:6px;margin-top:10px;}
  [data-ptm83-perf] .ptm83-perf-actions button {min-height:36px;padding:7px 10px;
    border:1px solid #cbd5e1;border-radius:8px;background:#fff;color:#101828;
    font:inherit;font-weight:700;}
  [data-ptm83-perf] .ptm83-perf-actions button:disabled {opacity:.45;}
  [data-ptm83-perf] .ptm83-perf-actions button:focus-visible,
  [data-ptm83-perf] .ptm83-perf-tab:focus-visible {outline:2px solid #155eef;outline-offset:2px;}
  [data-ptm83-perf] pre {margin:8px 0 0;white-space:pre-wrap;overflow-wrap:anywhere;
    font:11px/1.5 ui-monospace,monospace;color:#344054;}
  [data-ptm83-perf] [hidden] {display:none!important;}
}
