/* ============================================================
 * TORIAI mobile shell — モバイルシェル (v1.13.7, 2026-07-07)
 * 会議正本: docs/active/MOBILE_UI_REDESIGN.md (方式 B)
 *
 * 規約 (§5.3 地雷マップ準拠):
 *  - 本ファイルは index.html で【全 CSS の最後】(calcSettingsPanel.css より後) に
 *    読み込む。前に置くと既存 !important に負けてシェルが崩れる。
 *  - 全規則を @media (max-width:768px) + body.mobile-shell で二重 scope し、
 *    デスクトップには 1px も影響させない (裸セレクタ禁止)。
 *  - 既存の @media print には触れない (本ファイル新設要素の print 非表示のみ)。
 *  - 計算エンジン/機能 DOM は不変。ページ遷移は既存 goPage() に委譲
 *    (JS 側 = src/features/mobileShell/mobileShell.js)。
 *
 * z-index scale (モバイルシェル帯 900-920):
 *   mob-tabbar 900 / csp-fab 905 / mobSheetBackdrop 910 / bottom sheet 920
 *   (既存: header 200 / cmdDropdown 200 / shareLogin 1000 / shareHeader dd 1100 /
 *    cart 9100 / usageGuide 10000 — モバイル帯はモーダル群より必ず下)
 * ============================================================ */

/* タブバー/backdrop はデスクトップ・印刷では常に不可視 (シェル外でも安全側) */
.mob-tabbar{ display:none; }
#mobSheetBackdrop{ display:none; }
.hm-row.mob-only{ display:none; }
.mob-add-row-btn{ display:none; }
.mob-alt-toggle{ display:none; }
.mob-share-btn{ display:none; }
#mobResultsPill{ display:none; }
.mob-results-bar{ display:none; }
#mobWWrap{ display:none; }
.mob-w-preview{ display:none; }

@media print{
  .mob-tabbar,
  #mobSheetBackdrop,
  #mobResultsPill,
  .mob-results-bar,
  #mobWWrap,
  .mob-w-preview,
  body.mobile-shell .csp-fab{
    display:none !important;
  }
}

@media (max-width:768px){

  /* ── A. シェル基礎 ─────────────────────────────── */
  body.mobile-shell{
    overflow-x:hidden;
    /* ボトムタブバーの高さ分、常に下余白 (コンテンツ/フッターが隠れない) */
    padding-bottom:calc(58px + env(safe-area-inset-bottom, 0px)) !important;
  }

  /* ── B. ヘッダー: タブナビはボトムタブへ移譲、右側を密に ── */
  body.mobile-shell header{
    gap:10px !important;
    padding:0 12px !important;
  }
  body.mobile-shell header nav{
    display:none !important; /* M1: 縦文字折れの根治 = モバイルでは非表示 */
  }
  body.mobile-shell #guideBtn{
    display:none !important; /* ガイドはハンバーガー内「使い方ガイド」から */
  }
  body.mobile-shell .hdr-right{
    margin-left:auto;
    min-width:0;
  }
  body.mobile-shell .hdr-right > #cartBadge{
    padding:0 8px !important;
    font-size:10px !important;
    white-space:nowrap;
  }
  /* ロゴはマスコット+文字 両方維持 (2026-05-12 master 指示)、少し縮める */
  body.mobile-shell .logo-image{ height:26px !important; }
  body.mobile-shell .logo-mascot{ height:24px !important; width:auto !important; }

  /* ハンバーガー内 モバイル専用行 (データタブの受け皿) */
  body.mobile-shell .hm-row.mob-only{ display:flex; }

  /* ── C. ボトムタブバー ────────────────────────── */
  body.mobile-shell .mob-tabbar{
    display:flex;
    position:fixed;
    left:0; right:0; bottom:0;
    z-index:900;
    background:var(--sf, #ffffff);
    border-top:1px solid var(--line, #e3e4eb);
    padding-bottom:env(safe-area-inset-bottom, 0px);
    box-shadow:0 -2px 12px rgba(20,20,40,.06);
  }
  body.mobile-shell .mob-tab{
    flex:1;
    display:flex;
    flex-direction:column;
    align-items:center;
    justify-content:center;
    gap:2px;
    min-height:52px;
    padding:7px 0 6px;
    border:none;
    background:transparent;
    cursor:pointer;
    font-family:inherit;
    font-size:10px;
    font-weight:700;
    color:var(--ink-soft, #77798a);
    -webkit-tap-highlight-color:transparent;
  }
  body.mobile-shell .mob-tab svg{
    width:20px;
    height:20px;
    fill:none;
    stroke:currentColor;
    stroke-width:1.8;
    stroke-linecap:round;
    stroke-linejoin:round;
  }
  body.mobile-shell .mob-tab.on{
    color:var(--br, #4f46e5);
  }

  /* ── D. 在庫/履歴 #hip シェル (M2 根治) ─────────────
     overrideLayers.css の無条件 `#hip .hi-panel-layout { 300px sidebar }` 後置き規則が
     mobile 1 カラム化を潰していた (Codex §5.1-2)。本ファイルが最後に読まれるので勝つ。 */
  body.mobile-shell #hip .hi-panel-layout,
  body.mobile-shell #hip #hiPanelH .hi-panel-layout,
  body.mobile-shell #hip #hiPanelI .hi-panel-layout{
    grid-template-columns:1fr !important;
    /* themeSidebar の height:calc(100vh-108px)+overflow:hidden がサイドバー行を
       38px に圧縮していた → モバイルは高さ auto でページスクロールに任せる */
    height:auto !important;
    min-height:calc(100vh - 140px);
    overflow:visible !important;
    grid-template-rows:auto auto !important;
    background:var(--toriai-app-bg, #f3f3f7) !important;
  }
  body.mobile-shell #hip .hi-sb{
    width:auto !important;
    min-width:0 !important;
    max-width:none !important;
    height:auto !important;
    min-height:0 !important;
    overflow:visible !important;
    border-right:none !important;
    padding:10px 12px 4px !important;
  }
  body.mobile-shell #hip .hi-sb-main{
    min-width:0 !important;
    height:auto !important;
  }
  /* 在庫サマリー 3 カード: 180px 固定 min 幅→均等 3 分割、縦落ち防止 */
  body.mobile-shell #hip .inv-head-row{
    grid-template-columns:1fr !important;
    gap:10px !important;
  }
  body.mobile-shell #hip .inv-summary-grid{
    grid-template-columns:repeat(3, minmax(0,1fr)) !important;
    column-gap:8px !important;
    row-gap:8px !important;
    margin-left:0 !important;
  }
  body.mobile-shell #hip .inv-summary-card{
    padding:10px 10px 10px 12px !important;
    height:auto !important;
    min-height:64px;
  }
  body.mobile-shell #hip .inv-summary-label{
    white-space:nowrap;
    font-size:10px !important;
    margin-bottom:4px !important;
  }
  body.mobile-shell #hip .inv-summary-value{
    font-size:16px !important;
    white-space:nowrap;
  }
  body.mobile-shell #hip .inv-summary-card button,
  body.mobile-shell #hip .inv-summary-card .inv-summary-edit{
    white-space:nowrap;
  }
  /* フィルタ項目 (種別/期間/鋼材) は縦リスト→チップ横並びで場所を食わない */
  body.mobile-shell #hip .hi-sb-sec{ margin-bottom:8px; }
  body.mobile-shell #hip .hi-sb-item{
    display:inline-flex !important;
    align-items:center;
    gap:4px;
    width:auto !important;
    padding:5px 11px !important;
    margin:0 6px 6px 0 !important;
    border:1px solid var(--bd, #dcdce6);
    border-radius:14px;
    background:var(--sf, #ffffff);
    font-size:11px;
  }
  body.mobile-shell #hip .hi-sb-item.on{
    border-color:var(--br, #4f46e5);
    background:var(--br-soft, #eef2ff);
  }
  body.mobile-shell #hip .inv-head-row{
    flex-wrap:wrap !important;
    gap:8px !important;
  }

  /* ── E. 取り合い右パネル → 不透明ボトムシート (M3 根治) ──
     calcSettingsPanel.css @media<=1100 の fixed + background:transparent を上書き。 */
  body.mobile-shell .calc-settings-panel{
    top:auto !important;
    left:0 !important;
    right:0 !important;
    bottom:0 !important;
    width:100vw !important;
    max-width:100vw !important;
    height:min(72dvh, 620px) !important;
    transform:translateY(105%) !important;
    border-radius:16px 16px 0 0 !important;
    border:none !important;
    background:var(--toriai-app-bg, #f3f3f7) !important;
    box-shadow:0 -10px 36px rgba(15,15,35,.22) !important;
    z-index:920 !important;
    padding:12px 10px calc(14px + env(safe-area-inset-bottom, 0px)) !important;
    overflow-y:auto !important;
    pointer-events:none;
  }
  html[data-theme="dark"] body.mobile-shell .calc-settings-panel{
    background:var(--bk, #0f0f14) !important;
  }
  body.mobile-shell .calc-settings-panel.is-mobile-open{
    transform:translateY(0) !important;
    pointer-events:auto;
  }

  /* シート backdrop (タップで閉じる、生成は mobileShell.js) */
  body.mobile-shell.csp-mobile-open #mobSheetBackdrop{
    display:block;
    position:fixed;
    inset:0;
    background:rgba(18,18,34,.44);
    z-index:910;
  }

  /* ── F. シートを開く FAB: 28px 透明ボタン→タブバー上の丸ボタンに ── */
  body.mobile-shell .csp-fab{
    top:auto !important;
    bottom:calc(70px + env(safe-area-inset-bottom, 0px)) !important;
    right:14px !important;
    width:44px !important;
    height:44px !important;
    border-radius:22px !important;
    background:var(--br, #4f46e5) !important;
    color:#ffffff !important;
    box-shadow:0 6px 18px rgba(79,70,229,.4) !important;
    z-index:905 !important;
  }
  body.mobile-shell .csp-fab svg{
    width:20px !important;
    height:20px !important;
  }
  body.mobile-shell.csp-mobile-open .csp-fab{
    display:none !important;
  }

  /* ── G. 取り合い入力のタッチ最適化 (第 2 弾 v1.13.8) ──────
     master 2026-07-07: 「ウェブの UI にとらわれず、スマホならではの見やすい・操作しやすいを一番に」 */
  /* sticky 計算ボタンを body スクロール基準で効かせる (sb の overflow:auto を解除) */
  body.mobile-shell #cp aside.sb{
    overflow:visible !important;
  }
  /* iOS Safari は font-size<16px の input フォーカスで勝手に画面ズームする → 16px 固定 */
  body.mobile-shell #cp .sb input,
  body.mobile-shell #cp .sb select,
  body.mobile-shell #wpp .sb input,
  body.mobile-shell #wpp .sb select,
  body.mobile-shell .calc-settings-panel input,
  body.mobile-shell .calc-settings-panel select{
    font-size:16px !important;
  }
  body.mobile-shell #cp .pt-row input{
    min-height:44px !important;
  }
  body.mobile-shell #cp .calc-steel-input,
  body.mobile-shell #wpp .calc-steel-input,
  body.mobile-shell #wpp #wCmdInput{
    min-height:44px !important;
  }
  /* 空行畳み: mobileShell.js が「最後の入力行 +1」以降に .mob-row-hidden を付与 */
  body.mobile-shell #cp .pt-row.mob-row-hidden{
    display:none !important;
  }
  body.mobile-shell .mob-add-row-btn{
    display:flex;
    width:100%;
    align-items:center;
    justify-content:center;
    gap:6px;
    min-height:44px;
    margin-top:8px;
    border:1.5px dashed var(--bd, #c9c9d6);
    border-radius:10px;
    background:transparent;
    color:var(--ink-soft, #77798a);
    font-family:inherit;
    font-size:13px;
    font-weight:700;
    cursor:pointer;
  }
  /* sticky 計算ボタン: 入力域が画面内にある間は下に浮く (結果閲覧中は流れて消える) */
  body.mobile-shell #cp #runBtn{
    position:sticky;
    bottom:calc(64px + env(safe-area-inset-bottom, 0px));
    z-index:60;
    font-size:14px;
    box-shadow:0 8px 22px rgba(79,70,229,.35);
  }
  body.mobile-shell #cp #runBtn .run-hint{
    display:none; /* Ctrl+Enter ヒントはスマホでは無意味 */
  }

  /* ── J. 結果ボトムシート (第 5 弾 v1.13.12、master「A」採用) ──────
     計算→スクロール移動を廃止し、#rp をワン画面完結のシートに。
     計算完了で自動オープン (mobileShell.js が body.mob-results-open を付与)。
     z-order: シート 893 < タブバー 900 < FAB 905 < backdrop 910 < 設定シート 920 */
  body.mobile-shell #cp #rp{
    position:fixed !important;
    left:0 !important;
    right:0 !important;
    top:calc(var(--toriai-header-h, 54px) + 6px) !important;
    bottom:calc(52px + env(safe-area-inset-bottom, 0px)) !important;
    height:auto !important;
    max-height:none !important;
    width:auto !important;
    transform:translateY(110%);
    transition:transform .25s ease;
    z-index:893;
    background:var(--toriai-app-bg, #f3f3f7) !important;
    border-radius:16px 16px 0 0;
    box-shadow:0 -10px 36px rgba(15,15,35,.22);
    overflow-y:auto !important;
    padding:0 10px 16px !important;
    pointer-events:none;
  }
  html[data-theme="dark"] body.mobile-shell #cp #rp{
    background:var(--bk, #0f0f14) !important;
  }
  body.mobile-shell.mob-results-open #cp #rp{
    transform:translateY(0);
    pointer-events:auto;
  }
  /* シートのヘッダーバー (render 毎に mobileShell.js が再注入、sticky でスクロール中も見える) */
  body.mobile-shell #cp #rp .mob-results-bar{
    display:flex;
    align-items:center;
    justify-content:space-between;
    position:sticky;
    top:0;
    z-index:5;
    margin:0 -10px 8px;
    padding:12px 14px 10px;
    background:var(--toriai-app-bg, #f3f3f7);
    border-radius:16px 16px 0 0;
    border-bottom:1px solid var(--line, #e3e4eb);
  }
  html[data-theme="dark"] body.mobile-shell #cp #rp .mob-results-bar{
    background:var(--bk, #0f0f14);
  }
  body.mobile-shell #cp #rp .mob-results-ttl{
    font-size:14px;
    font-weight:800;
    color:var(--ink, #1a1a2e);
  }
  body.mobile-shell #cp #rp .mob-results-close{
    display:inline-flex;
    align-items:center;
    gap:5px;
    border:1px solid var(--bd, #d4d4dc);
    border-radius:16px;
    background:var(--sf, #ffffff);
    color:var(--ink, #2a2a3e);
    padding:6px 12px;
    font-family:inherit;
    font-size:12px;
    font-weight:700;
    cursor:pointer;
    -webkit-tap-highlight-color:transparent;
  }
  body.mobile-shell #cp #rp .mob-results-close svg{
    width:14px;
    height:14px;
    fill:none;
    stroke:currentColor;
    stroke-width:2;
    stroke-linecap:round;
    stroke-linejoin:round;
  }
  /* 「結果を見る」ピル: 結果があってシートが閉じているときだけ、タブバー上に出す */
  body.mobile-shell.mob-has-results:not(.mob-results-open) #mobResultsPill{
    display:inline-flex;
    align-items:center;
    gap:6px;
    position:fixed;
    left:50%;
    transform:translateX(-50%);
    bottom:calc(64px + env(safe-area-inset-bottom, 0px));
    z-index:896;
    border:none;
    border-radius:20px;
    background:var(--ink, #1a1a2e);
    color:#ffffff;
    padding:10px 18px;
    font-family:inherit;
    font-size:13px;
    font-weight:800;
    cursor:pointer;
    box-shadow:0 6px 18px rgba(15,15,35,.3);
    -webkit-tap-highlight-color:transparent;
  }
  body.mobile-shell #mobResultsPill svg{
    width:15px;
    height:15px;
    fill:none;
    stroke:currentColor;
    stroke-width:2.2;
    stroke-linecap:round;
    stroke-linejoin:round;
  }
  /* 結果シートを開いている間は sticky 計算ボタン/FAB と干渉しない (シートが上に被る) */

  /* ── K. 結果カードヘッダー (第 6 弾 v1.13.13、master 2026-07-10 スクショ指摘) ──
     「6,000mm ×…」が省略されて定尺構成が読めない → タイトルを 1 行目全幅に、
     統計 (歩留まり/カット数/重量) とボタンは 2 行目に折り返す。 */
  body.mobile-shell #rp .cc-hd{
    flex-wrap:wrap !important;
    row-gap:6px;
  }
  body.mobile-shell #rp .cc-desc{
    flex:1 1 100% !important;
    min-width:0 !important;
    white-space:normal !important;
    overflow:visible !important;
    text-overflow:clip !important;
    font-size:15px !important;
    line-height:1.45;
  }
  body.mobile-shell #rp .cc-stats{
    margin-left:0 !important;
  }

  /* ── L. 重量計算タブ: バッジ (オプションチップ) 全非表示 (master 2026-07-10「全部いらない」) ── */
  body.mobile-shell #wpp .w-opt-chips{
    display:none !important;
  }
  body.mobile-shell #wpp .w-badge-hint{
    display:none !important;
  }

  /* ── M. モバイル総点検 (第 7 弾 v1.13.14、master「いらない機能は全部消す」→
     Claude⇄Codex 会議収束 2026-07-10)。DOM 削除はせず導線の非表示のみ。
     残すと決めたもの: 発注メール / データバックアップ / 計算モード / PWA メニュー。 */
  /* (a) ONELINE promo (Windows 常駐アプリの宣伝) */
  body.mobile-shell .hm-section--oneline{ display:none !important; }
  /* (b) ひな形編集 (モバイル対象外機能への導線。JS が inline style で再表示するため !important 必須) */
  body.mobile-shell #cartUnifiedTplBtn,
  body.mobile-shell #livePreviewEditTemplateBtn{ display:none !important; }
  /* (c) CSV 保存 (スマホで CSV は扱えない。発注メール/コピー/重量タブは残す) */
  body.mobile-shell #cartCutCsvBtn{ display:none !important; }
  body.mobile-shell .csp-cart-open-sub{ display:none !important; }
  body.mobile-shell #wExportCsvBtn{ display:none !important; }
  /* (d) キーボードショートカット節 (使い方ガイド。行単位でなく節ごと非表示 = 文章を壊さない) */
  body.mobile-shell .ug-kbd-sec{ display:none !important; }
  /* (e) 操作チュートリアル開始ボタン (自動起動は calcTutorial.js 側の mobile ガードで抑止) */
  body.mobile-shell .ug-tut-btn{ display:none !important; }
  /* (追加1) ファイル読み込み導線 (CSV/TSV ファイル選択はスマホ外) */
  body.mobile-shell .paste-file,
  body.mobile-shell .paste-file-hint{ display:none !important; }
  /* (追加4) データタブの hover tooltip (ホバー前提 UI) */
  body.mobile-shell .dt-sb-tooltip{ display:none !important; }
  /* (追加5) 重量バッジのパネル残骸 (デスクトップ幅から縮めた場合の保険) */
  body.mobile-shell #wPanel_title,
  body.mobile-shell #wPanel_name,
  body.mobile-shell #wPanel_price,
  body.mobile-shell #wPanel_paint,
  body.mobile-shell #wPanel_rev{ display:none !important; }

  /* ── N. 重量計算タブ 1 ページ化 (第 8 弾 v1.14.2、master 2026-07-12 Discord 指示) ──
     「1ページ完結 / 横スクロールなしで重量が真っ先に見える / 重量計算書ボタン撤去→共有」。
     横スクロール前提のテーブル (#wTableWrap min-width:700px) と上部バー (重量計算書/CSV/
     パンくず) はモバイルでは隠し、mobileShell.js が #mobWWrap にカード型リスト +
     合計サマリー (共有ボタン付き) を描画する。render.js のインライン style に勝つため !important。 */
  body.mobile-shell #wTopBar{ display:none !important; }
  body.mobile-shell #wTableWrap{ display:none !important; }
  body.mobile-shell #mobWWrap{ display:block; }

  /* 入力→リストを 1 本のページスクロールに (refresh2026.css の max-height:100vh-60px +
     内部スクロールを解除。これが残ると sticky サマリーが .mn 内部で貼り付いてカードに重なる) */
  body.mobile-shell #wpp aside.sb,
  body.mobile-shell #wpp main.mn{
    max-height:none !important;
    height:auto !important;
    min-height:0 !important;
    overflow:visible !important;
  }

  /* 合計サマリー: 一番見たい数字を最上部に。スクロールしても sticky で残る */
  body.mobile-shell .mob-w-summary{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:10px;
    position:sticky;
    top:calc(var(--toriai-header-h, 54px) + 4px);
    z-index:50;
    background:var(--sf, #ffffff);
    border:1px solid var(--line, #e3e4eb);
    border-radius:14px;
    padding:10px 12px 10px 14px;
    margin-bottom:10px;
    box-shadow:0 4px 16px rgba(20,20,40,.10);
  }
  body.mobile-shell .mob-w-summary-lbl{
    font-size:11px;
    font-weight:700;
    color:var(--ink-soft, #77798a);
    margin-bottom:2px;
  }
  body.mobile-shell .mob-w-summary-val{
    font-size:26px;
    font-weight:800;
    line-height:1.1;
    color:var(--ink, #1a1a2e);
    font-variant-numeric:tabular-nums;
  }
  body.mobile-shell .mob-w-summary-unit{
    font-size:14px;
    font-weight:700;
    color:var(--ink-soft, #77798a);
  }
  body.mobile-shell .mob-w-share-btn{
    display:inline-flex;
    align-items:center;
    gap:6px;
    flex-shrink:0;
    min-height:44px;
    border:none;
    border-radius:12px;
    background:var(--br, #4f46e5);
    color:#ffffff;
    padding:0 16px;
    font-family:inherit;
    font-size:13px;
    font-weight:800;
    cursor:pointer;
    -webkit-tap-highlight-color:transparent;
  }
  body.mobile-shell .mob-w-share-btn svg{
    width:15px;
    height:15px;
    fill:none;
    stroke:currentColor;
    stroke-width:2;
    stroke-linecap:round;
    stroke-linejoin:round;
  }

  /* カード型リスト: 1 行 = 1 カード、重量は右下に大きく (横スクロール不要) */
  body.mobile-shell .mob-w-card{
    background:var(--sf, #ffffff);
    border:1px solid var(--line, #e3e4eb);
    border-radius:12px;
    padding:10px 12px;
    margin-bottom:8px;
    cursor:pointer;
    -webkit-tap-highlight-color:transparent;
  }
  body.mobile-shell .mob-w-card.editing{
    border-color:var(--br, #4f46e5);
    box-shadow:0 0 0 2px var(--br-soft, #eef2ff);
  }
  body.mobile-shell .mob-w-card-top{
    display:flex;
    align-items:center;
    gap:8px;
    min-width:0;
  }
  body.mobile-shell .mob-w-idx{
    font-size:11px;
    font-weight:700;
    color:var(--ink-soft, #9a9ab0);
    flex-shrink:0;
  }
  body.mobile-shell .mob-w-kind{
    flex-shrink:0;
    font-size:10px;
    font-weight:700;
    color:var(--br, #4f46e5);
    background:var(--br-soft, #eef2ff);
    border-radius:8px;
    padding:2px 7px;
    white-space:nowrap;
  }
  body.mobile-shell .mob-w-spec{
    flex:1;
    min-width:0;
    font-size:13px;
    font-weight:700;
    color:var(--ink, #1a1a2e);
    overflow-wrap:anywhere;
  }
  body.mobile-shell .mob-w-del{
    flex-shrink:0;
    width:32px;
    height:32px;
    border:none;
    border-radius:8px;
    background:transparent;
    color:var(--ink-soft, #9a9ab0);
    font-size:14px;
    cursor:pointer;
    -webkit-tap-highlight-color:transparent;
  }
  body.mobile-shell .mob-w-memo{
    margin-top:2px;
    padding-left:26px;
    font-size:11px;
    color:var(--ink-soft, #77798a);
    overflow-wrap:anywhere;
  }
  body.mobile-shell .mob-w-nums{
    display:flex;
    align-items:baseline;
    justify-content:space-between;
    gap:8px;
    margin-top:6px;
  }
  body.mobile-shell .mob-w-lenqty{
    font-size:12px;
    color:var(--ink-soft, #77798a);
    font-variant-numeric:tabular-nums;
  }
  body.mobile-shell .mob-w-kg{
    font-size:17px;
    font-weight:800;
    color:var(--ink, #1a1a2e);
    font-variant-numeric:tabular-nums;
    white-space:nowrap;
  }
  body.mobile-shell .mob-w-kg-sub{
    font-size:11px;
    font-weight:700;
    color:var(--ink-soft, #9a9ab0);
  }

  /* 入力中プレビュー: 追加前でも鋼材+長さ+本数が揃えば重量を出す (サッと重量用途)。
     .on は mobileShell.js が入力の妥当性で付け外しする */
  body.mobile-shell .mob-w-preview.on{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:10px;
    margin-top:8px;
    padding:9px 12px;
    border:1.5px dashed var(--br, #4f46e5);
    border-radius:10px;
    background:var(--br-soft, #eef2ff);
  }
  body.mobile-shell .mob-w-preview-lbl{
    font-size:10px;
    font-weight:800;
    color:var(--br, #4f46e5);
  }
  body.mobile-shell .mob-w-preview-sub{
    font-size:10px;
    color:var(--ink-soft, #77798a);
    font-variant-numeric:tabular-nums;
  }
  body.mobile-shell .mob-w-preview-val{
    font-size:19px;
    font-weight:800;
    color:var(--ink, #1a1a2e);
    font-variant-numeric:tabular-nums;
    white-space:nowrap;
  }

  /* ── H. 結果のモバイル最適化 (第 2 弾) ──────────────
     切断図はモバイル既定「数字表示」(mobileShell.js が transient mode を設定)。
     取り合いパターン比較は折りたたみ (.mob-altsec/.mob-collapsed は mobileShell.js 付与)。 */
  body.mobile-shell #rp .an.mob-altsec .res-hd{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:8px;
  }
  body.mobile-shell #rp .an.mob-altsec.mob-collapsed > *:not(.res-hd){
    display:none !important;
  }
  body.mobile-shell .mob-alt-toggle{
    display:inline-flex;
    align-items:center;
    gap:4px;
    flex-shrink:0;
    border:1px solid var(--bd, #d4d4dc);
    border-radius:16px;
    background:var(--sf, #ffffff);
    color:var(--ink, #2a2a3e);
    padding:6px 12px;
    font-family:inherit;
    font-size:12px;
    font-weight:700;
    cursor:pointer;
  }

  /* ── I. カートモーダル (第 4 弾 v1.13.11) ──────────────
     cartModal.css <=880 の grid-template-rows: minmax(0,1fr) auto は
     フォーム行 (auto) が全高を食い、プレビュー行が 0px に解決していた。
     プレビュー 42% / フォーム残り で固定し両方スクロール可能に。 */
  body.mobile-shell .cart-unified-body{
    grid-template-columns:1fr !important;
    grid-template-rows:minmax(240px, 42%) minmax(0, 1fr) !important;
  }
  body.mobile-shell .cart-unified-left{
    max-height:none !important;
    min-height:0 !important;
    overflow:auto !important;
  }
  body.mobile-shell .cart-unified-right{
    max-height:none !important;
    overflow:auto !important;
  }
  /* タブ (作業情報/材質/母材/部材ごと/パターン) の縦文字折れ防止 → 横スクロール */
  body.mobile-shell .cart-unified-tabs{
    overflow-x:auto;
    flex-wrap:nowrap;
  }
  body.mobile-shell .cart-unified-tab{
    white-space:nowrap;
    padding:8px 9px;
    font-size:11px;
  }

  /* お問い合わせ: iOS のアドレスバー変動 (100vh 問題) とボトムタブバー被りの保険 */
  body.mobile-shell #cop{
    height:calc(100dvh - 54px) !important;
  }
  body.mobile-shell #cop .contact-shell{
    padding-bottom:76px;
  }

  /* 結果カードの共有ボタン (第 3 弾 v1.13.10、master「共有OK」) */
  body.mobile-shell .mob-share-btn{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    width:34px;
    height:34px;
    border:1px solid var(--bd, #d4d4dc);
    border-radius:9px;
    background:var(--sf, #ffffff);
    color:var(--ink, #2a2a3e);
    cursor:pointer;
    -webkit-tap-highlight-color:transparent;
  }
  body.mobile-shell .mob-share-btn svg{
    width:16px;
    height:16px;
    fill:none;
    stroke:currentColor;
    stroke-width:1.8;
    stroke-linecap:round;
    stroke-linejoin:round;
  }
}

/* v1.14.0: 手動コピーポップの textarea (calc-notice-box 内で使用、全画面幅で崩れない) */
.mob-share-copy-text{
  width:100%;
  min-height:120px;
  margin-bottom:12px;
  padding:10px;
  border:1px solid var(--bd, #d4d4dc);
  border-radius:8px;
  font-family:inherit;
  font-size:12px;
  line-height:1.6;
  resize:none;
  box-sizing:border-box;
  background:var(--sf, #ffffff);
  color:var(--ink, #2a2a3e);
}
