
    /* ── Mobile Game Layout (portrait & landscape) ─────────── */

    /* Cards scrollable area in each row */
    .mg-ls-zone-cards {
      flex: 1;
      display: flex;
      flex-direction: row;
      align-items: stretch;
      gap: 2px;
      overflow-x: auto;
      overflow-y: hidden;
      height: 100%;
      padding: 2px 2px;
      scrollbar-width: none;
    }
    .mg-ls-zone-cards::-webkit-scrollbar { display: none; }

    /* Back cards (opponent's face-down cards) */
    .mg-card-chip.back {
      background-image: var(--card-back-image);
      background-size: cover;
      background-position: center;
      cursor: default;
    }

    /* Revealed zone mini action buttons */
    .mg-ls-revealed-wrap {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 1px;
      flex-shrink: 0;
    }
    .mg-ls-rev-act {
      font-size: 0.42rem;
      padding: 1px 3px;
      border-radius: 3px;
      border: 1px solid #d8dfe9;
      background: #f4f6fa;
      color: #243447;
      cursor: pointer;
      font-family: inherit;
      line-height: 1.3;
    }
    .mg-ls-rev-act.red { border-color: #d8dfe9; background: #f4f6fa; color: #243447; }

    @keyframes mg-guide-pulse {
      0%, 100% { box-shadow: 0 0 0 0 rgba(244,96,12,0); }
      50% { box-shadow: 0 0 0 3px rgba(244,96,12,0.5); }
    }

    /* Game log overlay */
    .mg-log-backdrop {
      display: none;
      position: fixed;
      inset: 0;
      background: rgba(0,0,0,0.35);
      z-index: 2490;
    }
    .mg-log-backdrop.open { display: block; }
    .mg-log-overlay {
      display: none;
      position: fixed;
      left: 0;
      right: 0;
      bottom: 0;
      max-height: 62dvh;
      overflow-y: auto;
      background: var(--panel);
      border-top: 1px solid var(--border);
      border-radius: 10px 10px 0 0;
      padding: 8px 12px 10px;
      z-index: 2500;
      box-shadow: 0 -4px 16px rgba(23,32,46,0.18);
    }
    .mg-log-overlay.open { display: flex; flex-direction: column; }

    /* ログシートのヘッダー（ソロ/疑似対戦）。空ログでも正体の分かるシートとして表示する */
    .mg-sheet-head {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
      margin-bottom: 6px;
    }
    .mg-sheet-title {
      font-size: 0.66rem;
      font-weight: 800;
      color: var(--table-label);
    }
    .mg-sheet-close {
      flex: 0 0 auto;
      padding: 5px 14px;
      border: 1px solid var(--table-line);
      border-radius: var(--radius-sm);
      background: var(--table-chip);
      color: var(--table-label);
      font-size: 0.66rem;
      font-weight: 800;
      cursor: pointer;
      font-family: inherit;
    }
    /* ログペインは最新行を下端に固定する。 */
    .mg-sheet-pane {
      flex: 1 1 auto;
      min-height: 0;
      overflow-y: auto;
      display: flex;
      flex-direction: column;
    }
    .mg-sheet-pane > :first-child { margin-top: auto; }

    /* 盤面下端の1行ログティッカー */
    /* 盤面下端ログティッカー: 卓上チップ地に載せ替え */
    .mg-ticker {
      flex: 0 0 auto;
      height: 20px;
      display: flex;
      align-items: center;
      gap: 6px;
      padding: 0 6px;
      background: var(--table-chip);
      border-top: 1px solid var(--table-line);
      cursor: pointer;
      overflow: hidden;
      transition: background-color 0.15s ease;
    }
    .mg-ticker.flash { animation: mgTickerFlash 0.7s ease-out; }
    @keyframes mgTickerFlash {
      0% { background: rgba(59,110,165,0.28); }
      100% { background: var(--table-chip); }
    }
    .mg-ticker-label {
      flex: 0 0 auto;
      font-size: 0.5rem;
      font-weight: 700;
      color: #fff;
      background: var(--secondary);
      border-radius: 3px;
      padding: 1px 4px;
    }
    .mg-ticker-text {
      flex: 1 1 auto;
      min-width: 0;
      font-size: 0.6rem;
      color: var(--text);
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    /* 新しいものが一番下・古いものが上へ流れる（下端固定は .mg-sheet-pane 側で行う） */
    .mg-log-overlay .mg-log-entry {
      font-size: 0.62rem;
      color: var(--text-dim);
      line-height: 1.5;
      border-bottom: 1px solid rgba(23,32,46,0.08);
      padding-bottom: 2px;
      margin-bottom: 2px;
      word-break: break-word;
    }
    /* 3階層: 自分=濃色ボーダー強調 / 相手=淡色 / システム=小さく中央寄せ（PC .dg-side-log-entry と対） */
    .mg-log-entry.log-self {
      color: var(--text);
      font-weight: 600;
      border-left: 2px solid var(--table-line, rgba(23,32,46,0.25));
      padding-left: 6px;
    }
    .mg-log-entry.log-opp {
      color: var(--text-dim);
      border-left: 2px solid transparent;
      padding-left: 6px;
    }
    .mg-log-entry.log-sys {
      color: var(--text-dim);
      opacity: 0.8;
      font-size: 0.56rem;
      text-align: center;
      border-bottom-color: transparent;
      letter-spacing: 0.04em;
    }

    /* ── SP版 横向き1画面レイアウト（3カラム: 左レール / 中央盤面 / 右レール） ─────────── */
    .mg-root.ls2-active {
      display: flex;
      flex-direction: column;
      width: 100vw;
      height: var(--dm-app-h);
      overflow: hidden;
      /* ライト卓面: PCと共通の--table-bgへ載せ替え＋極薄ノイズ＋ビネット（旧: #161f2b ダーク） */
      background: var(--table-noise), var(--table-vignette), var(--table-bg);
      color: var(--text);
      position: relative;
    }
    .mg-ls2-shell {
      flex: 1;
      display: flex;
      flex-direction: row;
      min-height: 0;
      overflow: hidden;
    }
    /* 左レール */
    .mg-ls2-leftrail {
      flex: 0 0 72px;
      width: 72px;
      display: flex;
      flex-direction: column;
      gap: 4px;
      padding: 4px;
      background: var(--table-chip);
      border-right: 1px solid var(--table-line);
      overflow-y: auto;
      scrollbar-width: none;
    }
    .mg-ls2-leftrail::-webkit-scrollbar { display: none; }
    .mg-rail-spacer { flex: 1; }
    /* 既定の控えめレールボタン（戻る/ドロー等の地味操作）: 卓上チップ */
    .mg-rail-btn {
      flex: 0 0 auto;
      padding: 9px 4px;
      border-radius: 6px;
      border: 1px solid var(--table-line);
      background: var(--table-chip);
      color: var(--text);
      font-size: 0.74rem;
      font-weight: 700;
      line-height: 1.15;
      cursor: pointer;
      font-family: inherit;
      text-align: center;
    }
    .mg-rail-btn:active { background: rgba(52,74,106,0.14); }
    /* 塗りトークン系（白文字前提）: ターン終了=accent主役・44px（PCドックと同文法） / ログ=secondary / メニュー=neutral */
    .mg-rail-btn.end  { background: var(--accent); border-color: var(--accent-hover); color: #fff; min-height: 44px; }
    .mg-rail-btn.log  { background: var(--secondary); border-color: var(--secondary-hover); color: #fff; }
    .mg-rail-btn.menu { background: var(--neutral); border-color: var(--neutral-hover); color: #fff; }
    /* ドロー=secondary、1手戻す=neutral（白文字） */
    .mg-rail-btn.draw   { background: var(--secondary); border-color: var(--secondary-hover); color: #fff; }
    .mg-rail-btn.undo { background: var(--neutral); border-color: var(--neutral-hover); color: #fff; }
    /* guideは最後に定義してdrawより優先（ドロー誘導の脈動を維持） */
    .mg-rail-btn.guide {
      background: var(--accent); border-color: var(--accent-hover); color: #fff;
      animation: mg-guide-pulse 1.2s ease-in-out infinite;
    }
    /* 自分の手番: ターン終了に控えめなパルス（PCのdgEndPulseを共用。ドロー誘導中はJS側でmy-turnを付与せずguideを優先） */
    .mg-rail-btn.end.my-turn { animation: dgEndPulse 1.8s var(--ease-out) infinite; }
    @media (prefers-reduced-motion: reduce) {
      .mg-rail-btn.end { animation: none !important; }
    }
    /* 右レール */
    .mg-ls2-rightrail {
      flex: 0 0 68px;
      width: 68px;
      display: flex;
      flex-direction: column;
      justify-content: flex-end;
      gap: 5px;
      padding: 4px;
      background: var(--table-chip);
      border-left: 1px solid var(--table-line);
      overflow-y: auto;
      scrollbar-width: none;
    }
    .mg-ls2-rightrail::-webkit-scrollbar { display: none; }
    /* 枚数カウンタ（山札/墓地/超次元/GR）: 卓上チップ */
    .mg-rail-chip {
      flex: 0 0 auto;
      padding: 9px 4px;
      border-radius: 6px;
      border: 1px solid var(--table-line);
      background: var(--table-chip);
      color: var(--text);
      font-size: 0.72rem;
      font-weight: 700;
      line-height: 1.2;
      cursor: pointer;
      font-family: var(--font-num);
      letter-spacing: 0.02em;
      text-align: center;
    }
    .mg-rail-chip:active { background: rgba(52,74,106,0.14); }

    /* 中央盤面: 縦6段（スクロールなし） */
    .mg-ls2-center {
      flex: 1;
      min-width: 0;
      display: flex;
      flex-direction: column;
      gap: 1px;
      overflow: hidden;
      padding: 1px;
    }
    /* 相手情報帯 */
    .mg-ls2-oppinfo {
      flex: 0 0 22px;
      display: flex;
      align-items: center;
      gap: 6px;
      padding: 0 6px;
      background: var(--table-chip);
      border: 1px solid var(--table-line);
      border-radius: 3px;
      overflow-x: auto;
      white-space: nowrap;
      scrollbar-width: none;
    }
    .mg-ls2-oppinfo::-webkit-scrollbar { display: none; }
    .mg-oi-name { font-size: 0.66rem; font-weight: 800; color: var(--text); }
    .mg-oi-chip {
      font-size: 0.6rem;
      color: var(--text);
      background: var(--table-chip);
      border: 1px solid var(--table-line);
      border-radius: 8px;
      padding: 1px 6px;
      cursor: pointer;
    }
    .mg-oi-chip:active { background: rgba(52,74,106,0.14); }
    /* 手番バッジ: mine=accent塗り白文字 / opp=secondary塗り白文字 */
    .mg-oi-turn {
      margin-left: auto;
      font-size: 0.6rem;
      font-weight: 800;
      padding: 1px 7px;
      border-radius: 8px;
      flex-shrink: 0;
    }
    .mg-oi-turn.mine { background: var(--accent); color: #fff; }
    .mg-oi-turn.opp  { background: var(--secondary); color: #fff; }

    /* 段（セグメント） */
    .mg-ls2-seg {
      flex: 1;
      min-height: 0;
      display: flex;
      flex-direction: row;
      align-items: stretch;
      position: relative;
      border-radius: 3px;
      padding: 0 2px;
      overflow: hidden;
    }
    /* ゾーンセグメントの地色を卓面のくぼみ--table-well系へ載せ替え */
    /* opp-sm（相手シールド+マナ）は内側ハーフで色分けするので地は相手寄せの中立well */
    .mg-ls2-seg.opp-hand { background: var(--table-well-opp); flex: 0.55; }
    .mg-ls2-seg.opp-sm  { background: var(--table-well-opp); flex: 0.85; }
    .mg-ls2-seg.opp-bz  { background: var(--table-well-opp); }
    .mg-ls2-seg.my-bz   { background: var(--table-well); border: 1px solid var(--table-line); }
    .mg-ls2-seg.my-sm   { background: var(--table-well); flex: 0.85; }
    .mg-ls2-seg.my-hand { flex: 1.35; background: var(--table-well); }
    .mg-ls2-seg.my-revealed { flex: 0.7; background: rgba(255,255,255,0.85); }
    /* シールド/マナ同居セグ: 左ハーフ=シールド(青系) / 右ハーフ=マナ(緑系) */
    /* シールド/マナの tint はゾーン種別で指定（DOM順に依存しない）。
       相手側は境界を軸に鏡合わせのため opp-sm 内は マナ→シールドの順、
       自分側は自分バトルゾーンの隣が my-shield なので my-sm 内は シールド→マナの順。 */
    .mg-ls2-seg.my-sm .mg-self-shield,
    .mg-ls2-seg.opp-sm .mg-opp-shield { background: var(--table-well-shield); }
    .mg-ls2-seg.my-sm .mg-self-mana,
    .mg-ls2-seg.opp-sm .mg-opp-mana  { background: var(--table-well-mana); }
    /* 段内: シールド+マナ同居用の左右ハーフ */
    .mg-ls2-half {
      flex: 1;
      min-width: 0;
      display: flex;
      flex-direction: row;
      align-items: center;
      overflow: hidden;
    }
    .mg-ls2-half + .mg-ls2-half { border-left: 1px dashed var(--table-line); }
    /* 縦画面では自分のシールド/マナ横に山札・墓地を置く。横画面は従来の2分割を維持。 */
    .mg-ls2-resource-stack { display: contents; }
    .mg-ls2-resource-actions { display: none; }
    .mg-resource-action {
      border: 1px solid var(--table-line);
      border-radius: 5px;
      background: var(--table-chip);
      color: var(--text);
      font: 700 0.55rem/1.05 var(--font-num);
      cursor: pointer;
    }
    .mg-resource-action b { font-size: 0.72rem; }
    /* 相手/自分の境界を強調 */
    .mg-ls2-boundary {
      flex: 0 0 3px;
      background: linear-gradient(90deg, transparent, var(--table-line), transparent);
      border-radius: 2px;
    }
    /* 段ラベル（縦書き風に左端へ小さく） */
    .mg-seg-tag {
      flex: 0 0 auto;
      align-self: center;
      font-size: 0.5rem;
      color: var(--table-label);
      writing-mode: vertical-rl;
      text-orientation: upright;
      letter-spacing: -1px;
      max-height: 100%;
      overflow: hidden;
      opacity: 0.9;
      padding: 0 1px;
    }
    /* カード高さ: 段ごとに調整（空でも高さ維持は flex:1 で担保） */
    .mg-root.ls2-active .mg-ls-zone-cards {
      flex: 1;
      display: flex;
      flex-direction: row;
      align-items: center;
      gap: 2px;
      overflow-x: auto;
      overflow-y: hidden;
      height: 100%;
      padding: 1px;
      scrollbar-width: none;
    }
    .mg-root.ls2-active .mg-ls-zone-cards::-webkit-scrollbar { display: none; }

    /* SP版特殊ギミック。零龍5枚も1カード強の横幅に収める。 */
    .mg-gimmick {
      position: relative;
      flex: 0 0 auto;
      align-self: stretch;
      height: 100%;
      min-height: 40px;
      max-height: 68px;
      margin-right: 4px;
      color: #fff;
      isolation: isolate;
      order: -1;
      margin-left: 0;
    }
    .mg-gimmick-stage { position: absolute; inset: 0; }
    /* 実体になったギミック（禁断解放・禁断爆発・零龍卍誕）の攻撃ボタン。画像の上に重ねる */
    .mg-gimmick-attack {
      position: absolute;
      z-index: 6;
      left: 50%;
      bottom: 3px;
      transform: translateX(-50%);
      min-height: 24px;
      padding: 2px 12px;
      border: 0;
      border-radius: 9px;
      background: #b4232a;
      color: #fff;
      font-family: inherit;
      font-size: .7rem;
      font-weight: 900;
      white-space: nowrap;
      box-shadow: 0 1px 4px rgba(0,0,0,0.4);
    }
    .mg-gimmick img { display: block; object-fit: contain; }
    .mg-gimmick .placeholder {
      display: flex;
      align-items: center;
      justify-content: center;
      background: #252a32;
      padding: 2px;
      color: #fff;
      font-size: 0.4rem;
      font-weight: 800;
      line-height: 1.2;
      text-align: center;
      word-break: break-all;
    }
    .mg-gimmick-phase {
      position: absolute;
      left: 50%;
      bottom: 0;
      z-index: 8;
      max-width: calc(100% - 2px);
      transform: translateX(-50%);
      padding: 1px 3px;
      border: 1px solid rgba(255,255,255,0.3);
      border-radius: 999px;
      background: rgba(24,29,37,0.88);
      color: #fff;
      font-size: 0.42rem;
      font-weight: 800;
      line-height: 1.1;
      white-space: nowrap;
      pointer-events: none;
    }
    .mg-gimmick-visually-hidden {
      position: absolute;
      width: 1px;
      height: 1px;
      padding: 0;
      margin: -1px;
      overflow: hidden;
      clip: rect(0, 0, 0, 0);
      white-space: nowrap;
      border: 0;
    }

    .mg-gimmick-dokindam { width: 72px; min-width: 72px; }
    .mg-gimmick-core {
      position: absolute;
      left: 0;
      top: 0;
      height: 100%;
      width: auto;
      aspect-ratio: 650/908;
      border-radius: 3px;
      box-shadow: 0 1px 3px rgba(0,0,0,0.42);
    }
    .mg-gimmick-seal { border: 0; font-family: inherit; }
    .mg-gimmick-seal-stack {
      position: absolute;
      right: 0;
      top: 46%;
      z-index: 4;
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 1px;
      transform: translateY(-50%);
      padding: 3px;
      border-radius: 4px;
      background: rgba(25,29,36,0.9);
      color: #fff;
      cursor: pointer;
    }
    .mg-gimmick-seal-back {
      width: 18px;
      height: 25px;
      border: 1px solid #fff;
      border-radius: 2px;
      background: var(--card-back-image), #342c27;
      background-size: cover;
      box-shadow: -2px 1px 0 #65584f, -4px 2px 0 #38312d;
    }
    .mg-gimmick-seal-stack b { font-size: 0.43rem; white-space: nowrap; }

    .mg-card-seal-cover {
      position: absolute;
      right: 1px;
      top: 1px;
      z-index: 28;
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 1px;
      pointer-events: none;
      transform: rotate(5deg);
    }
    .mg-card-seal-cover .dm-card-seal-back {
      display: block;
      width: 20px;
      height: 28px;
      border: 1px solid #fff;
      border-radius: 2px;
      background: var(--card-back-image), #342c27;
      background-size: cover;
      box-shadow: -2px 1px 0 rgba(38,31,27,.82), 0 1px 4px rgba(0,0,0,.55);
    }
    .mg-card-seal-cover b {
      padding: 0 3px;
      border: 1px solid #fff;
      border-radius: 8px;
      background: #332d27;
      color: #fff;
      font-size: .52rem;
      font-weight: 900;
      line-height: 1.2;
      white-space: nowrap;
    }

    .mg-gimmick-dolmageddon { width: 91px; }
    .mg-dolmageddon-art {
      position: absolute;
      inset: 0;
      width: 100%;
      height: 100%;
      border-radius: 3px;
      filter: drop-shadow(0 1px 2px rgba(0,0,0,0.4));
    }
    .mg-gimmick-dolmageddon.is-exploded .mg-dolmageddon-art {
      left: 50%;
      right: auto;
      width: auto;
      transform: translateX(-50%);
    }
    .mg-dolmageddon-seal {
      position: absolute;
      z-index: 5;
      display: flex;
      align-items: center;
      justify-content: center;
      width: 13px;
      height: 13px;
      padding: 0;
      border: 1px solid #fff;
      border-radius: 50%;
      background: var(--card-back-image), #302a26;
      background-size: cover;
      color: #fff;
      font: 900 0.4rem/1 var(--font-num);
      text-shadow: 0 1px 1px #000;
      box-shadow: 0 1px 2px rgba(0,0,0,0.55);
      cursor: pointer;
    }
    .mg-dolmageddon-seal-1 { left: 1px; top: 1px; }
    .mg-dolmageddon-seal-2 { right: 1px; top: 1px; }
    .mg-dolmageddon-seal-3 { left: 1px; bottom: 1px; }
    .mg-dolmageddon-seal-4 { right: 1px; bottom: 1px; }

    .mg-gimmick-zero { width: 78px; }
    .mg-zero-core {
      position: absolute;
      left: 50%;
      top: 0;
      z-index: 3;
      height: 50%;
      width: auto;
      transform: translateX(-50%);
      border-radius: 3px;
      box-shadow: 0 1px 3px rgba(0,0,0,0.45);
    }
    .mg-zero-piece {
      position: absolute;
      z-index: 2;
      display: block;
      height: 50%;
      width: auto;
      aspect-ratio: 650/910;
      padding: 0;
      border: 1px solid rgba(190,205,230,0.9);
      border-radius: 3px;
      background: #161c28;
      overflow: hidden;
      box-shadow: 0 1px 3px rgba(0,0,0,0.45);
      cursor: pointer;
    }
    .mg-zero-piece-1 { left: 0; top: 0; }
    .mg-zero-piece-2 { right: 0; top: 0; }
    .mg-zero-piece-3 { left: 17%; bottom: 0; }
    .mg-zero-piece-4 { right: 17%; bottom: 0; }
    .mg-zero-ritual-art { width: 100%; height: 100%; object-fit: contain !important; }
    .mg-zero-piece.is-linked { border-color: #43c985; box-shadow: 0 0 0 1px #43c985, 0 0 4px rgba(67,201,133,0.72); }
    .mg-zero-status {
      position: absolute;
      right: 0;
      bottom: 0;
      min-width: 10px;
      padding: 1px;
      border-radius: 2px;
      background: rgba(20,25,34,0.88);
      color: #dbe3ee;
      font-size: 0.32rem;
      font-weight: 900;
      line-height: 1;
    }
    .mg-zero-piece.is-linked .mg-zero-status { background: #238656; color: #fff; }
    .mg-zero-born-art {
      position: absolute;
      inset: 0;
      width: 100%;
      height: 100%;
      border-radius: 3px;
      filter: drop-shadow(0 1px 2px rgba(0,0,0,0.4));
    }
    /* 空セグメントのプレート化（破線枠＋ゾーン名透かし。操作は親に残す） */
    .mg-root.ls2-active .mg-zone-plate {
      flex: 1;
      align-self: stretch;
      position: relative;
      margin: 1px;
      border: 1.5px dashed var(--table-line);
      border-radius: var(--radius-sm);
      pointer-events: none;
      user-select: none;
    }
    /* バトルゾーンだけは破線枠を非表示（見にくいとの要望）。透かし文字は残す。 */
    .mg-ls2-seg.my-bz .mg-zone-plate,
    .mg-ls2-seg.opp-bz .mg-zone-plate {
      border: none;
    }
    .mg-root.ls2-active .mg-zone-plate::before {
      content: attr(data-zone-label);
      position: absolute;
      inset: 0;
      display: flex;
      align-items: center;
      justify-content: center;
      color: var(--table-label);
      opacity: 0.45;
      font-weight: 700;
      font-size: 0.6rem;
      letter-spacing: 0.1em;
    }
    .mg-root.ls2-active .mg-card-chip {
      aspect-ratio: 5/7;
      flex-shrink: 0;
      height: 100%;
      max-height: 100%;
      width: auto;
      border-radius: 3px;
      padding: 1px;
      transition: aspect-ratio var(--dur-normal) var(--ease-out), width var(--dur-normal) var(--ease-out), box-shadow var(--dur-fast) ease;
    }
    /* 画像付きカードは.has-image側のpadding:0を優先させる(詳細度0,3,0 vs 0,2,0の逆転を解消) */
    .mg-root.ls2-active .mg-card-chip.has-image {
      padding: 0;
    }
    /* ボディはカード比率(5/7)に固定。スロット幅が広がってもボディは原寸を保つ */
    .mg-root.ls2-active .mg-card-body {
      height: 100%;
      width: auto;
      aspect-ratio: 5/7;
    }
    .mg-root.ls2-active .mg-card-chip.battle.dm-g-link-composite,
    .mg-root.ls2-active .mg-card-chip.battle.dm-g-link-composite .mg-card-body {
      aspect-ratio: calc(var(--dm-link-cols) * 5) / 7;
    }
    .mg-root.ls2-active .mg-card-chip.battle.dm-g-link-composite { flex-shrink: 0; }
    /* PCと同じ表現: 構成カードをその場で横倒しにし、スロットはN枚分の正方相当へ広げる */
    .mg-root.ls2-active .mg-card-chip.battle.tapped.dm-g-link-composite,
    .mg-root.ls2-active .mg-card-chip.battle.tapped.dm-g-link-composite .mg-card-body {
      aspect-ratio: calc(var(--dm-link-cols) * 1) / 1;
    }
    .mg-root.ls2-active .mg-card-chip.battle.tapped.dm-g-link-composite .mg-card-body {
      transform: translate(-50%, -50%);
    }
    .mg-root.ls2-active .mg-card-chip.battle.tapped.dm-g-link-composite .dm-g-link-part {
      transform: rotate(90deg);
    }
    .mg-ls2-seg.opp-bz .mg-card-chip.battle.tapped.dm-g-link-composite .mg-card-body,
    .mg-ls2-seg.opp-sm .mg-card-chip.battle.tapped.dm-g-link-composite .mg-card-body {
      transform: translate(-50%, -50%) rotate(180deg);
    }
    .mg-root.ls2-active .mg-card-chip.battle .mg-under-peek-layer,
    .mg-root.ls2-active .mg-card-chip.mana .mg-under-peek-layer {
      height: 100%;
      width: auto;
      aspect-ratio: 5/7;
    }
    /* タップ: スロット幅=カード縦（正方相当）。ボディだけ90度回転（隣を押し出す横倒し） */
    .mg-root.ls2-active .mg-card-chip.battle.tapped,
    .mg-root.ls2-active .mg-card-chip.mana.tapped { aspect-ratio: 1/1; }
    .mg-root.ls2-active .mg-card-chip.battle.tapped .mg-card-body { transform: translate(-50%, -50%) rotate(90deg); }
    /* マナは常に180度反転が基準。タップはそこからさらに90度回す（非タップ180度・タップ270度）。 */
    .mg-root.ls2-active .mg-card-chip.mana:not(.tapped) .mg-card-body { transform: translate(-50%, -50%) rotate(180deg); }
    .mg-root.ls2-active .mg-card-chip.mana.tapped .mg-card-body { transform: translate(-50%, -50%) rotate(270deg); }
    .mg-root.ls2-active .mg-card-chip.battle.field-card { aspect-ratio: 1/1; }
    .mg-root.ls2-active .mg-card-chip.battle.field-card .mg-card-body { transform: translate(-50%, -50%) rotate(90deg); }
    .mg-root.ls2-active .mg-card-chip.battle.field-card.field-inverted .mg-card-body { transform: translate(-50%, -50%) rotate(270deg); }
    .mg-root.ls2-active .mg-card-chip.mg-selected {
      z-index: 5;
    }
    /* 相手側のカードは180度回転（相手視点）。回転はボディ側に適用 */
    .mg-ls2-seg.opp-hand .mg-card-chip .mg-card-body,
    .mg-ls2-seg.opp-sm .mg-card-chip .mg-card-body,
    .mg-ls2-seg.opp-bz .mg-card-chip .mg-card-body { transform: translate(-50%, -50%) rotate(180deg); }
    /* 相手の未タップマナはさらに180度反転し、結果として自陣から見て正立(0度)になる。 */
    .mg-ls2-seg.opp-sm .mg-card-chip.mana:not(.tapped) .mg-card-body,
    .mg-ls2-seg.opp-bz .mg-card-chip.mana:not(.tapped) .mg-card-body { transform: translate(-50%, -50%) rotate(0deg); }
    .mg-ls2-seg.opp-sm .mg-card-chip.battle.tapped .mg-card-body,
    .mg-ls2-seg.opp-bz .mg-card-chip.battle.tapped .mg-card-body,
    .mg-ls2-seg.opp-sm .mg-card-chip.mana.tapped .mg-card-body,
    .mg-ls2-seg.opp-bz .mg-card-chip.mana.tapped .mg-card-body { transform: translate(-50%, -50%) rotate(270deg); }
    .mg-ls2-seg.opp-bz .mg-card-chip.battle.field-card .mg-card-body { transform: translate(-50%, -50%) rotate(270deg); }
    .mg-ls2-seg.opp-bz .mg-card-chip.battle.field-card.field-inverted .mg-card-body { transform: translate(-50%, -50%) rotate(90deg); }
    .mg-root.ls2-active .mg-card-chip .mg-card-cost  { font-size: 0.55rem; }
    .mg-root.ls2-active .mg-card-chip .mg-card-name  { font-size: 0.46rem; line-height: 1.05; }
    .mg-root.ls2-active .mg-card-chip .mg-card-power { font-size: 0.42rem; }
    .mg-root.ls2-active .mg-card-chip.back {
      background-image: var(--card-back-image);
      background-size: cover; background-position: center;
    }
    /* 相手手札の省略「+N」: 卓面ラベル色で読めるように（旧: インライン#ccc） */
    .mg-hand-overflow { color: var(--table-label); font-size: 0.55rem; font-weight: 700; align-self: center; }

    /* ── 盾/マナのファン圧縮（横重ね）＋展開トグル ─────────── */
    /* デフォルト=圧縮: 2枚目以降を負の左マージンで重ね、横スクロールなしで収める。
       overflowを可視にし、重なりで隠れた札の左端スリバーもタップ可能に保つ。 */
    .mg-root.ls2-active .mg-ls-zone-cards.fanned {
      overflow: visible;
      justify-content: flex-start;
    }
    .mg-root.ls2-active .mg-ls-zone-cards.fanned > .mg-card-chip + .mg-card-chip {
      margin-left: -26px;
    }
    /* 重なり順: 後ろの札ほど手前に来て左端スリバーが押し合わないよう、hover/activeで前面化 */
    .mg-root.ls2-active .mg-ls-zone-cards.fanned > .mg-card-chip:active,
    .mg-root.ls2-active .mg-ls-zone-cards.fanned > .mg-card-chip.mg-selected {
      z-index: 6;
    }
    /* 展開: 重なりを解いて通常表示（height:100% + 横スクロール）に戻す */
    .mg-root.ls2-active .mg-ls-zone-cards.fan-open {
      overflow-x: auto;
      overflow-y: hidden;
    }
    .mg-root.ls2-active .mg-ls-zone-cards.fan-open > .mg-card-chip + .mg-card-chip {
      margin-left: 0;
    }
    .mg-root.ls2-active .mg-ls-zone-cards.remote-shield-stack {
      cursor: pointer;
    }
    .mg-root.ls2-active .mg-ls-zone-cards.remote-shield-stack > .mg-card-chip {
      pointer-events: none;
    }
    /* ファン切替ラベル: 通常のseg-tagにタップ可能マーカーを付与 */
    .mg-seg-tag.fan-tag { cursor: pointer; }
    .mg-seg-tag.fan-tag:active { opacity: 0.6; }
    /* 疑似対戦: 自分シールド一括表裏トグル（目アイコン）。縦書きを解除し正立表示。 */
    .mg-seg-tag.mg-shield-eye-toggle {
      writing-mode: horizontal-tb;
      text-orientation: mixed;
      cursor: pointer;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      padding: 3px;
      opacity: 0.85;
    }
    .mg-seg-tag.mg-shield-eye-toggle svg { display: block; }
    .mg-seg-tag.mg-shield-eye-toggle:active { opacity: 0.5; }
    .mg-fan-mark {
      display: block;
      margin-top: 2px;
      font-size: 0.5rem;
      font-weight: 800;
      color: var(--secondary);
      opacity: 0.9;
    }
    .mg-mana-groups { display: none; }

    /* アクションバー（選択カードがある間・盤面下部に固定） */
    .mg-actionbar {
      position: absolute;
      left: 60px;
      right: 56px;
      bottom: max(4px, env(safe-area-inset-bottom, 0px));
      z-index: 2600;
      display: flex;
      align-items: center;
      gap: 8px;
      padding: 5px 8px;
      background: var(--table-chip);
      border: 1px solid var(--table-line);
      border-radius: 8px;
      box-shadow: var(--shadow-3);
    }
    .mg-act-info { display: flex; flex-direction: column; min-width: 0; flex-shrink: 1; }
    .mg-act-zone { font-size: 0.52rem; color: var(--table-label); }
    .mg-act-name {
      font-size: var(--fs-xs); font-weight: 800; color: var(--text);
      max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    }
    .mg-act-btns { display: flex; gap: 5px; margin-left: auto; flex-wrap: wrap; justify-content: flex-end; }
    /* 既定の中立アクションボタン（白文字塗り）。ゾーン行き先ボタンは下で色相維持 */
    .mg-act-btn {
      padding: 6px 12px;
      border-radius: 6px;
      border: 1px solid var(--neutral-hover);
      background: var(--neutral);
      color: #fff;
      font-size: var(--fs-xs);
      font-weight: 700;
      cursor: pointer;
      font-family: inherit;
      white-space: nowrap;
    }
    .mg-act-btn:active { filter: brightness(0.92); }
    /* ゾーン行き先ボタンの色相は現状維持（意図的にトークン統一の対象外） */
    .mg-act-btn.battle { background: rgba(60,110,60,0.95); border-color: #4a8a4a; color: #fff; }
    .mg-act-btn.mana   { background: rgba(60,90,120,0.95); border-color: #4a7aa8; color: #fff; }
    .mg-act-btn.break  { background: rgba(150,80,60,0.95); border-color: #33415a; color: #fff; }
    .mg-act-btn.grave  { background: #33415a; border-color: #24314a; color: #fff; }
    /* 「破壊」は隣の「→墓地」と結果が同じでも別の操作（破壊誘発が出る）なので色で分ける */
    .mg-act-btn.destroy { background: #8d3a2b; border-color: #732f22; color: #fff; }
    .mg-act-btn.attack { background: #c2503c; border-color: #a8402e; color: #fff; }
    /* カード詳細(detail)=secondary / 閉じる(close)=neutral */
    .mg-act-btn.detail { background: var(--secondary); border-color: var(--secondary-hover); color: #fff; }
    .mg-act-btn.close  { background: var(--neutral); border-color: var(--neutral-hover); color: #fff; }

    /* Portrait-only context area. Landscape keeps the existing floating action bar. */
    .mg-context-tray { display: none; }
    .mg-context-preview {
      flex: 0 0 auto;
      overflow: hidden;
      border: 1px solid var(--table-line);
      border-radius: 5px;
      background: var(--table-well);
      box-shadow: var(--shadow-1);
    }
    .mg-context-preview img,
    .mg-context-preview-placeholder {
      width: 100%;
      height: 100%;
      display: block;
      object-fit: cover;
    }
    .mg-context-preview-placeholder {
      display: grid;
      place-items: center;
      color: var(--table-label);
      font-size: 0.5rem;
    }
    .mg-context-main {
      min-width: 0;
      flex: 1 1 auto;
      display: flex;
      flex-direction: column;
    }
    .mg-context-zone { color: var(--table-label); font-size: 0.54rem; font-weight: 700; }
    .mg-context-name {
      color: var(--text);
      font-size: 0.72rem;
      font-weight: 800;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .mg-context-status { min-height: 1em; color: var(--table-label); font-size: 0.55rem; }
    .mg-context-actions {
      display: flex;
      align-items: center;
      gap: 5px;
      margin-top: auto;
      overflow-x: auto;
      scrollbar-width: none;
    }
    .mg-context-actions::-webkit-scrollbar,
    .mg-context-public-list::-webkit-scrollbar { display: none; }
    .mg-context-btn,
    .mg-context-quick {
      flex: 0 0 auto;
      min-height: 34px;
      padding: 6px 10px;
      border: 1px solid var(--neutral-hover);
      border-radius: 6px;
      background: var(--neutral);
      color: #fff;
      font-size: 0.62rem;
      font-weight: 700;
      line-height: 1.1;
      font-family: inherit;
      white-space: nowrap;
      cursor: pointer;
    }
    .mg-context-btn.battle { background: rgba(60,110,60,0.95); border-color: #4a8a4a; }
    .mg-context-btn.mana { background: rgba(60,90,120,0.95); border-color: #4a7aa8; }
    .mg-context-btn.break { background: rgba(150,80,60,0.95); border-color: #33415a; }
    .mg-context-btn.grave { background: #33415a; border-color: #24314a; }
    .mg-context-btn.destroy { background: #8d3a2b; border-color: #732f22; }
    .mg-context-btn.detail { background: var(--secondary); border-color: var(--secondary-hover); }
    .mg-context-idle-head {
      min-width: 0;
      display: flex;
      flex-direction: column;
      justify-content: center;
      gap: 2px;
    }
    .mg-context-turn { color: var(--text); font: 800 0.72rem/1 var(--font-num); }
    .mg-context-hint {
      color: var(--table-label);
      font-size: 0.56rem;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .mg-context-public-list {
      min-width: 0;
      display: flex;
      align-items: center;
      gap: 4px;
      overflow-x: auto;
      scrollbar-width: none;
    }
    .mg-context-recent {
      min-width: 0;
      display: flex;
      flex-direction: column;
      justify-content: center;
      gap: 3px;
      padding: 7px 9px;
      overflow: hidden;
      border: 1px solid var(--table-line);
      border-radius: 5px;
      background: rgba(255,255,255,0.5);
    }
    .mg-context-recent b { color: var(--table-label); font-size: 0.55rem; }
    .mg-context-recent-entry {
      color: var(--text);
      font-size: 0.6rem;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .mg-context-public-card {
      flex: 0 0 auto;
      height: 100%;
      padding: 0;
      overflow: hidden;
      border: 1px solid var(--table-line);
      border-radius: 4px;
      background: var(--table-well);
      cursor: pointer;
    }
    .mg-context-public-thumb { width: auto; height: 100%; display: block; object-fit: cover; }
    .mg-context-public-thumb.placeholder { display: grid; place-items: center; color: var(--table-label); font-size: 0.45rem; }
    .mg-context-idle-actions {
      flex: 0 0 auto;
      display: flex;
      align-items: center;
      gap: 5px;
      margin-left: auto;
    }

    /* メニュー・ボトムシート */
    .mg-menu-backdrop {
      position: fixed; inset: 0; z-index: 3200;
      background: rgba(0,0,0,0.45);
    }
    .mg-menu-sheet {
      position: fixed; z-index: 3300;
      left: 50%; bottom: 10px; transform: translateX(-50%);
      width: min(560px, calc(100vw - 120px));
      max-height: 82dvh;
      overflow-y: auto;
      background: var(--panel);
      border: 1px solid var(--border);
      border-radius: 12px;
      box-shadow: var(--shadow-3);
      padding: 12px;
    }
    .mg-menu-title { font-size: var(--fs-md); font-weight: 800; color: var(--text); margin-bottom: 8px; text-align: center; }
    .mg-menu-grid {
      display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px;
    }
    .mg-menu-btn {
      min-height: 44px;
      padding: 9px 6px;
      border-radius: 7px;
      border: 1px solid var(--border);
      background: var(--bg);
      color: var(--text);
      font-size: 0.68rem;
      font-weight: 700;
      cursor: pointer;
      font-family: inherit;
    }
    .mg-menu-btn:active { background: var(--border); }
    .mg-menu-btn.danger { background: rgba(184,69,69,0.10); border-color: rgba(184,69,69,0.45); color: var(--danger-hover); grid-column: 1 / -1; }
    .mg-menu-close {
      margin-top: 10px; width: 100%;
      padding: 9px; border-radius: 7px;
      border: none; background: var(--neutral);
      color: #fff; font-size: var(--fs-xs); cursor: pointer; font-family: inherit;
    }

    /* Landscape deck builder: portrait-equivalent controls adapted to limited height. */
    @media (orientation: landscape) and (max-height: 600px) {
      #app-mobile.active > .mlb-root {
        position: relative;
        box-sizing: border-box;
        padding-left: env(safe-area-inset-left, 0px);
        padding-right: calc(72px + env(safe-area-inset-right, 0px));
        padding-bottom: env(safe-area-inset-bottom, 0px);
      }
      #app-mobile.active .mlb-rail {
        width: 70px;
        gap: 3px;
        padding: 3px;
      }
      #app-mobile.active .mlb-rail-account { line-height: 1; padding-bottom: 0; }
      #app-mobile.active .mlb-rail-zones { gap: 3px; }
      #app-mobile.active .mlb-zone-tab {
        flex: 1 1 0;
        min-height: 0;
        padding: 3px 2px;
      }
      #app-mobile.active .mlb-rail-foot { gap: 3px; }
      #app-mobile.active .mlb-rail-btn {
        flex: 0 0 auto;
        min-height: 28px;
        padding: 5px 2px;
      }
      #app-mobile.active .mlb-drawer-panel {
        width: min(430px, 62vw);
        min-width: 320px;
      }
      #app-mobile.active .mlb-search-filters { flex-wrap: wrap; }
      #app-mobile.active .mlb-search-filters .mlb-civ-mode { min-width: 0; }
      #app-mobile.active .mlb-filter-cost .mlb-cost-input { width: 40px; }
      #app-mobile.active .mlb-rail-btn.board { display: none; }
      #app-mobile.active .mlb-center { padding: 4px; }
      #app-mobile.active .mlb-grid { gap: 2px; }
      #app-mobile.active .mlb-grid-main {
        flex: 0 0 100%;
        width: 100%;
        height: 100%;
        grid-template-columns: repeat(10, minmax(0, 1fr));
        grid-template-rows: repeat(4, minmax(0, calc((100% - 6px) / 4)));
        grid-auto-rows: minmax(0, calc((100% - 6px) / 4));
      }
      #app-mobile.active .mlb-grid-main-5rows {
        flex-basis: 125%;
        height: 125%;
        grid-template-rows: repeat(5, minmax(0, calc((100% - 8px) / 5)));
        grid-auto-rows: minmax(0, calc((100% - 8px) / 5));
      }
      #app-mobile.active .mlb-grid-main-6rows {
        flex-basis: 150%;
        height: 150%;
        grid-template-rows: repeat(6, minmax(0, calc((100% - 10px) / 6)));
        grid-auto-rows: minmax(0, calc((100% - 10px) / 6));
      }
      #app-mobile.active .mlb-cell-img-wrap .ml-deck-thumb {
        object-fit: contain;
        object-position: center;
        background: #fff;
      }
      #app-mobile.active .mlb-bar { padding: 4px 5px; }
      #app-mobile.active .mlb-bar-manage {
        display: block;
        min-height: 68px;
        overflow: visible;
      }
      #app-mobile.active .mlb-bar-manage .mlb-bar-deckname-wrap { display: none; }
      #app-mobile.active .mlb-bar-manage-actions {
        width: 100%;
        display: grid;
        grid-template-columns: repeat(12, minmax(0, 1fr));
        grid-template-rows: repeat(2, 32px);
        gap: 4px;
      }
      #app-mobile.active .mlb-bar-manage-actions .mlb-deckpick {
        grid-column: 1 / 6;
        grid-row: 1;
        width: 100%;
        max-width: none;
        min-width: 0;
        height: 32px;
      }
      #app-mobile.active .mlb-bar-manage-actions .mlb-bar-btn.rename { grid-column: 6 / 9; grid-row: 1; }
      #app-mobile.active .mlb-bar-manage-actions .mlb-bar-btn.save { grid-column: 9 / 11; grid-row: 1; }
      #app-mobile.active .mlb-bar-manage-actions .mlb-bar-btn.del { grid-column: 11 / 13; grid-row: 1; }
      #app-mobile.active .mlb-bar-manage-actions .mlb-bar-btn.solo { grid-column: 1 / 4; grid-row: 2; }
      #app-mobile.active .mlb-bar-manage-actions .mlb-bar-btn.vs { grid-column: 4 / 7; grid-row: 2; }
      #app-mobile.active .mlb-bar-manage-actions .mlb-bar-btn.trial { grid-column: 7 / 10; grid-row: 2; }
      #app-mobile.active .mlb-bar-manage-actions .mlb-gimmick-control {
        grid-column: 10 / 13;
        grid-row: 2;
        min-width: 0;
        display: grid;
        grid-template-columns: auto minmax(0, 1fr);
        align-items: center;
        gap: 3px;
        padding: 1px 3px;
        border: 1px solid var(--builder-border);
        border-radius: 7px;
        background: rgba(255,255,255,0.92);
        color: #33415a;
        font-size: clamp(0.53rem, 1.25vw, 0.64rem);
        line-height: 1;
      }
      #app-mobile.active .mlb-bar-manage-actions .mlb-gimmick-control select {
        width: 100%;
        min-width: 0;
        height: 27px;
        margin: 0;
        padding: 1px 16px 1px 3px;
        border: 0;
        background-color: transparent;
        font-size: clamp(0.57rem, 1.3vw, 0.68rem);
      }
      #app-mobile.active .mlb-bar-manage-actions .mlb-bar-deck-count,
      #app-mobile.active .mlb-bar-manage-actions .mlb-bar-btn.custom,
      #app-mobile.active .mlb-bar-manage-actions .mlb-bar-btn.online { display: none; }
      #app-mobile.active .mlb-bar-btn {
        min-height: 32px;
        padding: 4px 3px;
        font-size: clamp(0.61rem, 1.45vw, 0.72rem);
      }
      #app-mobile.active .mlb-search-custom-btn {
        display: block;
        border: 0;
        border-left: 1px solid rgba(59,110,165,0.35);
        background: #65507f;
        color: #fff;
        padding: 5px 10px;
        font-size: var(--fs-xs);
        font-weight: 700;
        cursor: pointer;
      }
      #app-mobile.active .mlb-search-custom-btn:disabled {
        background: #aeb4bc;
        color: #e8ecef;
        cursor: not-allowed;
      }
      #app-mobile.active .mlb-bottom-nav {
        position: absolute;
        z-index: 10;
        top: 0;
        right: env(safe-area-inset-right, 0px);
        bottom: 0;
        width: 72px;
        display: grid;
        grid-template-rows: repeat(3, minmax(0, 1fr));
        gap: 2px;
        padding: 5px 4px;
        box-sizing: border-box;
        border-left: 1px solid var(--border);
        background: var(--panel);
        box-shadow: -4px 0 14px rgba(23,32,46,0.2);
      }
      #app-mobile.active .mlb-bottom-nav-btn {
        min-width: 0;
        border: 0;
        border-radius: 8px;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 3px;
        padding: 4px 2px;
        background: transparent;
        color: var(--text-dim);
        font: 700 clamp(0.54rem, 1.35vw, 0.65rem)/1.15 inherit;
        cursor: pointer;
      }
      #app-mobile.active .mlb-bottom-nav-btn svg {
        width: 24px;
        height: 24px;
        fill: none;
        stroke: currentColor;
        stroke-width: 1.8;
        stroke-linecap: round;
        stroke-linejoin: round;
      }
      #app-mobile.active .mlb-bottom-nav-btn.active {
        background: var(--secondary);
        color: #fff;
        box-shadow: 0 2px 8px rgba(23,32,46,0.18);
      }
      #app-mobile.active .mlb-bottom-nav-btn.online { color: var(--secondary); }
      #app-mobile.active .mlb-bottom-nav-btn:disabled { color: #6d7784; cursor: not-allowed; }
      /* 「更新内容」は横では左レール、縦では下部ナビに置く（縦のレールは幅が足りない。報告板 No.245） */
      #app-mobile.active .mlb-bottom-nav-btn.notes { display: none; }
    }

    /* Portrait mobile UI. */
    @media (orientation: portrait) {
      body:has(#app-mobile.active) { overflow: hidden; }
      #app-mobile.active {
        width: 100vw;
        height: var(--dm-app-h);
        overflow: hidden;
      }
      #app-mobile.active > .mlb-root,
      #app-mobile.active > .mg-root {
        width: 100vw;
        height: var(--dm-app-h);
      }

      /* body直下の選択モーダルも、処理中バーを除いたviewport内で完結させる。
         見出しと候補だけをスクロールさせ、キャンセルは常に手元へ残す。 */
      body:has(#app-mobile.active) .dm-break-choice-modal {
        box-sizing: border-box;
        overflow: hidden;
        padding: max(8px, env(safe-area-inset-top, 0px)) 8px
          max(8px, env(safe-area-inset-bottom, 0px));
      }
      body:has(#app-mobile.active) .dm-break-choice-body {
        box-sizing: border-box;
        width: min(100%, 520px);
        max-height: 100%;
        min-height: 0;
        gap: 10px;
        padding: clamp(10px, 3vw, 16px);
      }
      body:has(#app-mobile.active) .dm-break-choice-modal:has(.dm-break-choice-actions.card-grid) .dm-break-choice-body {
        width: min(100%, 760px);
      }
      body:has(#app-mobile.active) .dm-break-choice-scroll {
        overflow-y: auto;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
      }
      body:has(#app-mobile.active) .dm-break-choice-card img {
        width: min(25vw, 96px);
        max-height: min(25dvh, 140px);
        object-fit: contain;
      }

      /* 効果カットインは盤面確認を妨げない補助演出に留める。処理中バーの
         実測高も避け、カード全体をcontainで表示する。 */
      body:has(#app-mobile.active) .dm-effect-cutin {
        box-sizing: border-box;
        padding: max(8px, env(safe-area-inset-top, 0px)) 8px
          max(8px, env(safe-area-inset-bottom, 0px));
      }
      body:has(#app-mobile.active) .dm-effect-cutin-inner {
        width: min(24dvh, 34vw, 140px);
        max-height: 100%;
        gap: 5px;
      }
      body:has(#app-mobile.active) .dm-effect-cutin-card {
        width: 100%;
        max-height: min(34dvh, 250px);
        object-fit: contain;
      }
      body:has(#app-mobile.active) .dm-effect-cutin-label {
        max-width: min(80vw, 320px);
        white-space: normal;
        overflow-wrap: anywhere;
      }

      /* 「唱える／場に出す」のカットインも同じ占有率へ揃える。 */
      body:has(#app-mobile.active) .dm-cast-inner:not(.no-image) {
        width: min(24dvh, 34vw, 140px);
        max-height: 100%;
        gap: 5px;
      }
      body:has(#app-mobile.active) .dm-cast-inner:not(.no-image) .dm-cast-card {
        width: 100%;
        max-height: min(34dvh, 250px);
        object-fit: contain;
      }
      body:has(#app-mobile.active) .dm-cast-inner .dm-cast-label {
        max-width: min(80vw, 320px);
        white-space: pre-line;
        overflow-wrap: anywhere;
      }

      /* Battle screen: commands / board / private zones. */
      #app-mobile.active .mg-ls2-shell { flex-direction: column; }
      #app-mobile.active .mg-ls2-leftrail {
        --mg-bottom-lift: max(8px, env(safe-area-inset-bottom, 0px));
        --mg-bottom-lift: calc(max(8px, env(safe-area-inset-bottom, 0px)) + clamp(2px, (var(--dm-app-h) - 810px) * 0.28, 30px));
        order: 3;
        flex: 0 0 auto;
        width: 100%;
        min-height: calc(50px + var(--mg-bottom-lift));
        max-height: calc(54px + var(--mg-bottom-lift));
        display: grid;
        grid-template-columns: repeat(5, minmax(0, 1fr));
        gap: 3px;
        padding: 4px 4px var(--mg-bottom-lift);
        overflow-x: hidden;
        overflow-y: hidden;
        border-right: 0;
        border-bottom: 1px solid var(--table-line);
      }
      #app-mobile.active .mg-ls2-leftrail .mg-rail-spacer { display: none; }
      #app-mobile.active .mg-ls2-leftrail .mg-rail-btn {
        min-width: 0;
        width: 100%;
        min-height: 40px;
        padding: 4px 2px;
        font-size: clamp(0.55rem, 2.5vw, 0.66rem);
        line-height: 1.1;
      }
      #app-mobile.active .mg-ls2-leftrail .mg-rail-btn.end { min-height: 44px; }
      #app-mobile.active .mg-ls2-center {
        order: 1;
        flex: 1 1 auto;
        width: 100%;
        min-height: 0;
      }
      #app-mobile.active .mg-root.ls2-active > .mg-actionbar { display: none; }
      #app-mobile.active .mg-context-tray {
        min-width: 0;
        display: flex;
        align-items: stretch;
        gap: 7px;
        padding: 6px;
        overflow: hidden;
        border: 1px solid var(--table-line);
        border-radius: 6px;
        background: linear-gradient(135deg, var(--table-chip), rgba(255,255,255,0.72));
        box-shadow: inset 0 1px 0 rgba(255,255,255,0.48);
      }
      /* idle/選択時とも同じ固定高（トレイの出現で盤面が動かないようにする） */
      #app-mobile.active .mg-context-tray {
        --mg-tray-h: 94px;
        --mg-tray-h: calc(94px + clamp(4px, (var(--dm-app-h) - 810px) * 0.3, 36px));
        flex: 0 0 var(--mg-tray-h);
        min-height: var(--mg-tray-h);
        max-height: var(--mg-tray-h);
        margin-top: auto;
      }
      #app-mobile.active .mg-context-tray.has-selection {
        padding: 5px 6px 6px;
      }
      #app-mobile.active .mg-context-tray.idle {
        align-items: center;
        justify-content: center;
      }
      #app-mobile.active .mg-context-tray.idle .mg-context-idle-head {
        align-items: center;
        text-align: center;
      }
      #app-mobile.active .mg-context-tray.has-selection .mg-context-main { width: 100%; }
      #app-mobile.active .mg-context-selection-meta {
        min-height: 17px;
        display: flex;
        align-items: center;
        gap: 6px;
        overflow: hidden;
      }
      #app-mobile.active .mg-context-selection-meta .mg-context-name { flex: 1; }
      #app-mobile.active .mg-context-actions {
        flex: 1 1 auto;
        display: flex;
        flex-direction: column;
        align-items: stretch;
        width: 100%;
        gap: 4px;
        margin-top: 2px;
        overflow: hidden;
      }
      #app-mobile.active .mg-context-action-row {
        flex: 1 1 0;
        min-height: 0;
        display: grid;
        grid-template-columns: repeat(var(--mg-action-count), minmax(0, 1fr));
        gap: 4px;
      }
      #app-mobile.active .mg-context-btn {
        width: 100%;
        min-width: 0;
        min-height: 0;
        padding: 3px 2px;
        white-space: normal;
        font-size: clamp(0.52rem, 2.4vw, 0.64rem);
      }
      #app-mobile.active .mg-context-btn.cast { background: var(--accent); border-color: var(--accent-hover); }
      #app-mobile.active .mg-context-btn.attack { background: #c2503c; border-color: #a8402e; color: #fff; }
      #app-mobile.active .mg-ls2-seg.my-hand,
      #app-mobile.active .mg-ls2-seg.opp-hand { flex: 0 0 calc(var(--mg-portrait-card-w) * 1.4 + 10px); }
      /* シールド/マナも手札・場と同寸（全対戦モード・PC版とサイズパリティ）。帯高は段内で見切れない値を確保する */
      #app-mobile.active .mg-ls2-seg.my-sm,
      #app-mobile.active .mg-ls2-seg.opp-sm {
        flex: 1 1 calc(var(--mg-portrait-card-w) * 2.8 + 20px);
        max-height: calc(var(--mg-portrait-card-w) * 2.8 + 34px);
        flex-direction: row;
      }
      #app-mobile.active .mg-ls2-resource-stack {
        display: flex;
        flex: 1 1 auto;
        min-width: 0;
        flex-direction: column;
      }
      #app-mobile.active .mg-ls2-resource-actions {
        flex: 0 0 48px;
        display: grid;
        grid-template-rows: repeat(2, minmax(0, 1fr));
        gap: 3px;
        padding: 3px;
        border-left: 1px dashed var(--table-line);
        background: var(--table-chip);
      }
      #app-mobile.active .mg-ls2-seg.my-sm .mg-ls2-half,
      #app-mobile.active .mg-ls2-seg.opp-sm .mg-ls2-half {
        width: 100%;
        flex: 1 1 50%;
        min-height: 0;
      }
      #app-mobile.active .mg-ls2-seg.my-sm .mg-ls2-half + .mg-ls2-half,
      #app-mobile.active .mg-ls2-seg.opp-sm .mg-ls2-half + .mg-ls2-half {
        border-left: 0;
        border-top: 1px dashed var(--table-line);
      }
      /* 対戦/オンラインのバトルゾーンは1段固定（折返さず横スクロール）。
         2段以上へ広げていた縦幅をカード寸法（--mg-portrait-card-base）へ還元する。
         ソロは自分の場だけで縦に余裕があるため従来どおり折返す。 */
      #app-mobile.active .mg-root.ls2-active:not(.solo-mode) .mg-ls2-seg.my-bz,
      #app-mobile.active .mg-root.ls2-active:not(.solo-mode) .mg-ls2-seg.opp-bz {
        flex: 0 0 calc(var(--mg-portrait-card-w) * 1.4 + 16px);
        min-height: calc(var(--mg-portrait-card-w) * 1.4 + 16px);
        max-height: calc(var(--mg-portrait-card-w) * 1.4 + 16px);
      }
      #app-mobile.active .mg-root.ls2-active:not(.solo-mode) .mg-ls2-seg.my-bz .mg-ls-zone-cards,
      #app-mobile.active .mg-root.ls2-active:not(.solo-mode) .mg-ls2-seg.opp-bz .mg-ls-zone-cards {
        flex-wrap: nowrap;
        align-items: center;
        overflow-x: auto;
        overflow-y: hidden;
      }
      #app-mobile.active .mg-root.solo-mode .mg-ls2-seg.my-bz .mg-ls-zone-cards {
        flex-wrap: wrap;
        align-content: center;
        overflow-y: auto;
      }
      #app-mobile.active .mg-ls2-rightrail {
        order: 2;
        flex: 0 0 auto;
        width: 100%;
        min-height: 50px;
        max-height: 56px;
        flex-direction: row;
        justify-content: flex-start;
        gap: 5px;
        padding: 5px;
        overflow-x: auto;
        overflow-y: hidden;
        border-left: 0;
        border-top: 1px solid var(--table-line);
      }
      #app-mobile.active .mg-ls2-rightrail .mg-rail-chip {
        flex: 0 0 auto;
        min-width: 68px;
        min-height: 40px;
        padding: 4px 8px;
      }
      #app-mobile.active .mg-ls2-rightrail .mg-rail-chip.deck,
      #app-mobile.active .mg-ls2-rightrail .mg-rail-chip.grave { display: none; }
      /* 相手の山札/墓地: 縦画面では opp-sm の対称ボタン(.mg-resource-action)側に一本化し、
         相手情報帯のchipは二重表示を避けるため隠す（横画面はchip側のみ表示のまま）。 */
      #app-mobile.active .mg-ls2-oppinfo .mg-oi-chip.deck,
      #app-mobile.active .mg-ls2-oppinfo .mg-oi-chip.grave { display: none; }
      #app-mobile.active .mg-root.ls2-active .mg-ls-zone-cards {
        gap: 1px;
        overflow-x: auto;
        justify-content: flex-start;
      }
      /* カード寸法の正本（縦）。幅制約と「端末高の余白をカードへ還元する」高さ制約のmin。
         2行目のdvh式が無効な環境では1行目の従来値へフォールバックする。 */
      #app-mobile.active .mg-root.ls2-active {
        --mg-portrait-card-base: clamp(34px, calc((100vw - 94px) / 8), 40px);
        --mg-portrait-card-base: clamp(34px, min(calc((100vw - 94px) / 6.5), max(calc((100vw - 94px) / 8), calc((var(--dm-app-h) - 457px) / 8.4))), 47px);
        --mg-portrait-card-w: var(--mg-portrait-card-base);
      }
      #app-mobile.active .mg-root.ls2-active .mg-card-chip {
        flex: 0 0 var(--mg-portrait-card-w);
        width: var(--mg-portrait-card-w);
        min-width: 0;
        height: calc(var(--mg-portrait-card-w) * 1.4);
        max-height: calc(var(--mg-portrait-card-w) * 1.4);
        aspect-ratio: 5 / 7;
      }
      #app-mobile.active .mg-root.ls2-active .mg-card-chip.battle.tapped,
      #app-mobile.active .mg-root.ls2-active .mg-card-chip.mana.tapped,
      #app-mobile.active .mg-root.ls2-active .mg-card-chip.battle.field-card {
        width: calc(var(--mg-portrait-card-w) * 1.4);
        flex-basis: calc(var(--mg-portrait-card-w) * 1.4);
        aspect-ratio: 1 / 1;
      }
      #app-mobile.active .mg-root.solo-mode .mg-ls2-center {
        gap: 6px;
        padding: 4px;
        justify-content: flex-start;
      }
      #app-mobile.active .mg-root.solo-mode .mg-ls2-seg {
        border: 1px solid var(--table-line);
        border-radius: 6px;
      }
      #app-mobile.active .mg-root.solo-mode .mg-ls2-seg.solo-opponent-shield {
        flex: 0 0 78px;
        min-height: 78px;
        max-height: 78px;
      }
      #app-mobile.active .mg-root.solo-mode .mg-ls2-seg.my-bz {
        flex: 0 0 168px;
        min-height: 168px;
        max-height: 168px;
      }
      #app-mobile.active .mg-root.solo-mode .mg-ls2-seg.my-sm {
        /* シールド/マナ帯の縦幅。カード裏面(5:7比)を余白付きで潰さず入れつつ、
           狭い端末 (360x800 等) で残り区画がはみ出さないよう 175px を上限に。
           半分 ~87px にシールドチップ h=73.5 を余裕付きで収容。 */
        flex: 0 0 174px;
        max-height: 174px;
      }
      #app-mobile.active .mg-root.solo-mode .mg-ls2-seg.my-hand {
        flex: 0 0 118px;
      }
      #app-mobile.active .mg-root.solo-mode {
        --mg-portrait-card-base: clamp(44px, 12.5vw, 49px);
      }
      #app-mobile.active .mg-root.solo-mode .mg-ls-zone-cards { gap: 3px; }
      #app-mobile.active .mg-root.solo-mode .mg-ls2-seg.my-bz .mg-card-chip {
        --mg-portrait-card-w: clamp(53px, 15.5vw, 61px);
      }
      /* シールドは常時5枚が主。カード裏面（500x700）を潰さず視認できる幅まで拡大。
         同じ帯内のマナは枚数可変なのでベース幅を継承させ、はみ出しは横スクロールで受ける。
         solo mode 限定: VS/オンラインは opp+my を同じ列に積むため帯高が狭く、
         同じ拡大幅だと縦がはみ出して見切れる。VS/オンラインではベース寸法を使う。 */
      #app-mobile.active .mg-root.solo-mode .mg-ls2-seg.my-sm .mg-card-chip.shield {
        --mg-portrait-card-w: clamp(50px, 14vw, 58px);
      }
      /* カード選択時の帯圧縮は廃止（選択トレイの高さは各帯のflex縮小で自然に吸収する） */
      #app-mobile.active .mg-root.ls2-active .mg-ls-zone-cards.fanned {
        overflow-x: auto;
      }
      #app-mobile.active .mg-root.ls2-active .mg-ls-zone-cards.fanned > .mg-card-chip + .mg-card-chip {
        margin-left: 0;
      }
      #app-mobile.active .mg-mana-dense-card { display: none; }
      #app-mobile.active .mg-mana-groups {
        display: flex;
        align-items: center;
        gap: 6px;
        height: 100%;
        padding: 1px 3px;
      }
      #app-mobile.active .mg-mana-pile {
        position: relative;
        display: flex;
        align-items: center;
        gap: 5px;
        height: 52px;
        min-width: 94px;
        padding: 2px 7px 2px 3px;
        border: 1px solid var(--table-line);
        border-radius: 7px;
        color: var(--text);
        background: rgba(255,255,255,0.76);
        box-shadow: 2px 0 0 rgba(64,91,72,0.28), 4px 0 0 rgba(64,91,72,0.16);
      }
      #app-mobile.active .mg-mana-pile-art {
        width: 32px;
        height: 45px;
        flex: 0 0 32px;
        overflow: hidden;
        border-radius: 3px;
        background: var(--table-well-mana);
      }
      #app-mobile.active .mg-mana-pile-art img {
        width: 100%;
        height: 100%;
        object-fit: cover;
      }
      #app-mobile.active .mg-mana-pile.tapped .mg-mana-pile-art img {
        transform: rotate(90deg) scale(0.72);
      }
      #app-mobile.active .mg-mana-pile.untapped .mg-mana-pile-art img {
        transform: rotate(180deg);
      }
      #app-mobile.active .mg-mana-pile-label {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        font-size: 0.55rem;
        line-height: 1.05;
      }
      #app-mobile.active .mg-mana-pile-label b { font-size: 1rem; }
      #app-mobile.active .mg-mana-pile-placeholder {
        display: grid;
        place-items: center;
        width: 100%;
        height: 100%;
        font-size: 0.45rem;
      }
      #app-mobile.active .mg-actionbar {
        position: fixed;
        left: 5px;
        right: 5px;
        bottom: calc(58px + env(safe-area-inset-bottom, 0px));
        max-height: 38dvh;
        overflow-y: auto;
        gap: 5px;
        padding: 6px;
      }
      #app-mobile.active .mg-act-info { flex: 0 1 86px; }
      #app-mobile.active .mg-act-name { max-width: 86px; }
      #app-mobile.active .mg-act-btns {
        flex: 1 1 auto;
        flex-wrap: nowrap;
        justify-content: flex-start;
        overflow-x: auto;
        overscroll-behavior-x: contain;
      }
      #app-mobile.active .mg-act-btn { min-height: 40px; padding: 7px 10px; }
      #app-mobile.active .mg-menu-sheet {
        width: calc(100vw - 16px);
        bottom: max(8px, env(safe-area-inset-bottom, 0px));
        max-height: calc(var(--dm-app-h) - 16px);
      }
      #app-mobile.active .mg-menu-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
      #app-mobile.active .mg-log-overlay { max-height: 72dvh; }
      #app-mobile.active .mg-zone-menu-sheet {
        bottom: max(8px, env(safe-area-inset-bottom, 0px));
        max-height: calc(var(--dm-app-h) - 16px);
      }

      /* Deck builder: DeckMaker-like dense deck grid with a persistent search shelf. */
      #app-mobile.active .mlb-body {
        flex: 0 1 auto;
        flex-direction: column;
        /* 短い端末でも検索棚を操作できる高さを先に残す。足りない分は
           デッキグリッド側の既存スクロールで扱い、下部UIを押し出さない。 */
        max-height: calc(var(--dm-app-h) - 258px - env(safe-area-inset-bottom, 0px));
      }
      #app-mobile.active .mlb-rail {
        width: 100%;
        flex: 0 0 auto;
        flex-direction: row;
        align-items: center;
        gap: 5px;
        padding: 5px;
        border-right: 0;
        border-bottom: 2px solid rgba(59,110,165,0.45);
        box-shadow: 0 2px 8px rgba(23,32,46,0.22);
        overflow-x: auto;
        overflow-y: hidden;
      }
      #app-mobile.active .mlb-rail-account {
        flex: 0 0 clamp(48px, 18vw, 72px);
        width: clamp(48px, 18vw, 72px);
        max-width: none;
        padding: 0 4px;
        overflow: visible;
        text-overflow: clip;
        white-space: normal;
        overflow-wrap: anywhere;
        line-height: 1.1;
      }
      #app-mobile.active .mlb-rail-zones {
        flex: 1 0 auto;
        min-width: max-content;
        flex-direction: row;
        gap: 4px;
      }
      #app-mobile.active .mlb-zone-tab {
        flex: 0 0 auto;
        min-width: clamp(54px, 18vw, 65px);
        min-height: 44px;
        padding: 5px 4px;
      }
      #app-mobile.active .mlb-rail-foot {
        flex: 0 0 auto;
        flex-direction: row;
        gap: 4px;
      }
      #app-mobile.active .mlb-rail-btn {
        flex: 0 0 auto;
        min-width: clamp(48px, 15vw, 60px);
        min-height: 42px;
        padding: 5px 4px;
      }
      #app-mobile.active .mlb-rail-btn.search { display: none; }
      #app-mobile.active .mlb-rail-btn.board { display: none; }
      #app-mobile.active .mlb-rail-btn.custom { display: none; }
      #app-mobile.active .mlb-center {
        /* 8列セル幅（(100vw - 左右padding10px - 列間gap14px)/8）×カード比88/63＋セル枠2px。
           旧64px固定capは幅430px級端末でカード下端が見切れるため、実寸連動へ変更 */
        --mlb-portrait-row: clamp(54px, calc(((100vw - 24px) / 8 - 2px) * 1.397 + 2px), 86px);
        flex: 0 1 calc(var(--mlb-portrait-row) + var(--mlb-portrait-row) + var(--mlb-portrait-row) + var(--mlb-portrait-row) + var(--mlb-portrait-row) + 18px);
        height: calc(var(--mlb-portrait-row) + var(--mlb-portrait-row) + var(--mlb-portrait-row) + var(--mlb-portrait-row) + var(--mlb-portrait-row) + 18px);
        min-height: 216px;
        padding: 5px;
        align-items: flex-start;
        overscroll-behavior-y: contain;
        scrollbar-width: thin;
      }
      #app-mobile.active .mlb-grid-main {
        flex: 0 0 auto;
        width: 100%;
        grid-template-columns: repeat(8, minmax(0, 1fr));
        grid-auto-rows: var(--mlb-portrait-row);
        gap: 2px;
      }
      #app-mobile.active .mlb-cell-img-wrap .ml-deck-thumb {
        object-fit: contain;
        object-position: center;
      }
      #app-mobile.active .mlb-grid-hyper,
      #app-mobile.active .mlb-grid-gr {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        grid-auto-rows: minmax(96px, calc((100% - 8px) / 3));
      }
      #app-mobile.active .mlb-bar { padding: 6px; }
      #app-mobile.active .mlb-bar-sel,
      #app-mobile.active .mlb-bar-manage {
        align-items: stretch;
        gap: 5px;
      }
      #app-mobile.active .mlb-bar-manage {
        display: block;
        min-height: 86px;
        overflow: visible;
      }
      #app-mobile.active .mlb-bar-manage .mlb-bar-deckname-wrap { display: none; }
      #app-mobile.active .mlb-bar-manage-actions {
        width: 100%;
        display: grid;
        grid-template-columns: repeat(12, minmax(0, 1fr));
        grid-template-rows: repeat(2, 40px);
        gap: 5px;
      }
      #app-mobile.active .mlb-bar-manage-actions .mlb-deckpick {
        grid-column: 1 / 6;
        grid-row: 1;
        width: 100%;
        max-width: none;
        min-width: 0;
        height: 40px;
      }
      #app-mobile.active .mlb-bar-manage-actions .mlb-bar-btn.rename { grid-column: 6 / 9; grid-row: 1; }
      #app-mobile.active .mlb-bar-manage-actions .mlb-bar-btn.save { grid-column: 9 / 11; grid-row: 1; }
      #app-mobile.active .mlb-bar-manage-actions .mlb-bar-btn.del { grid-column: 11 / 13; grid-row: 1; }
      #app-mobile.active .mlb-bar-manage-actions .mlb-bar-btn.solo { grid-column: 1 / 4; grid-row: 2; }
      #app-mobile.active .mlb-bar-manage-actions .mlb-bar-btn.vs { grid-column: 4 / 7; grid-row: 2; }
      #app-mobile.active .mlb-bar-manage-actions .mlb-bar-btn.trial { grid-column: 7 / 10; grid-row: 2; }
      #app-mobile.active .mlb-bar-manage-actions .mlb-gimmick-control {
        grid-column: 10 / 13;
        grid-row: 2;
        min-width: 0;
        display: grid;
        grid-template-rows: 12px 1fr;
        gap: 0;
        align-items: center;
        padding: 1px 3px 2px;
        border: 1px solid var(--builder-border);
        border-radius: 7px;
        background: rgba(255,255,255,0.9);
        color: #33415a;
        font-size: clamp(0.54rem, 2.35vw, 0.62rem);
        line-height: 1;
        text-align: center;
      }
      #app-mobile.active .mlb-bar-manage-actions .mlb-gimmick-control select {
        width: 100%;
        min-width: 0;
        height: 24px;
        margin: 0;
        padding: 1px 16px 1px 4px;
        border: 0;
        background-color: transparent;
        font-size: clamp(0.58rem, 2.45vw, 0.68rem);
      }
      #app-mobile.active .mlb-bar-manage-actions .mlb-bar-deck-count,
      #app-mobile.active .mlb-bar-manage-actions .mlb-bar-btn.custom,
      #app-mobile.active .mlb-bar-manage-actions .mlb-bar-btn.online { display: none; }
      #app-mobile.active .mlb-bar-sel { overflow-x: auto; }
      #app-mobile.active .mlb-bar-sel-actions { flex: 0 0 auto; }
      #app-mobile.active .mlb-bar-btn {
        min-height: 40px;
        padding: 6px 2px;
        font-size: clamp(0.62rem, 2.7vw, 0.72rem);
      }
      #app-mobile.active .mlb-drawer {
        position: static;
        inset: auto;
        z-index: auto;
        display: block;
        flex: 1 1 0;
        min-height: 0;
        overflow: hidden;
      }
      #app-mobile.active .mlb-drawer-backdrop,
      #app-mobile.active .mlb-drawer-head { display: none; }
      #app-mobile.active .mlb-drawer-panel {
        position: static;
        width: 100%;
        height: 100%;
        min-width: 0;
        min-height: 0;
        box-sizing: border-box;
        gap: 4px;
        padding: 5px 6px max(5px, env(safe-area-inset-bottom, 0px));
        overflow-x: hidden;
        overflow-y: auto;
        overscroll-behavior-y: contain;
        scroll-padding-bottom: 12px;
        border-top: 1px solid var(--builder-border);
        box-shadow: 0 -3px 12px rgba(23,32,46,0.12);
        animation: none;
      }
      #app-mobile.active .mlb-drawer-panel > * { flex-shrink: 0; }
      #app-mobile.active .mlb-search-results {
        order: 2;
        flex: 0 0 clamp(112px, 34vw, 136px);
        display: flex;
        flex-direction: row;
        align-items: stretch;
        gap: 4px;
        overflow-x: auto;
        overflow-y: hidden;
        overscroll-behavior-x: contain;
        scrollbar-width: thin;
      }
      #app-mobile.active .mlb-search-input {
        min-height: 38px;
        padding: 7px 10px;
      }
      #app-mobile.active .mlb-search-targets {
        order: 1;
        min-height: 28px;
        padding: 2px 1px;
        gap: 5px 9px;
        font-size: clamp(0.68rem, 2.8vw, 0.78rem);
      }
      #app-mobile.active .mlb-search-filters {
        order: 3;
        flex-wrap: wrap;
        gap: 4px;
      }
      #app-mobile.active .mlb-search-filters .mlb-civ-mode {
        min-width: 0;
        height: 32px;
      }
      #app-mobile.active .mlb-filter-cost .mlb-cost-input {
        width: 42px;
        height: 32px;
      }
      #app-mobile.active .mlb-search-results > .ml-search-summary {
        display: none;
      }
      #app-mobile.active .mlb-search-results > .ml-search-item {
        position: relative;
        flex: 0 0 auto;
        aspect-ratio: 5 / 7;
        min-width: 0;
        height: 100%;
        box-sizing: border-box;
        padding: 0;
        border-radius: 4px;
        overflow: hidden;
        border: 0;
        background: transparent;
        cursor: pointer;
      }
      #app-mobile.active .ml-search-item .ml-search-card-head {
        display: block;
        width: 100%;
        height: 100%;
      }
      #app-mobile.active .ml-search-item .ml-search-main { display: none; }
      #app-mobile.active .ml-search-item .ml-search-thumb {
        width: 100%;
        height: 100%;
        border-radius: 3px;
        object-fit: contain;
        border: 0;
        background: transparent;
      }
      #app-mobile.active .ml-search-item .ml-search-actions {
        display: none;
      }
      #app-mobile.active .mlb-search-results > .ml-more-btn {
        flex: 0 0 72px;
        height: 100%;
        margin: 0;
        padding: 6px;
      }
      #app-mobile.active .mlb-search-results > .ml-search-empty {
        flex: 1 0 100%;
        align-self: center;
        padding: 8px;
      }
      #app-mobile.active .mlb-search-custom-btn {
        display: block;
        border: 0;
        border-left: 1px solid rgba(59,110,165,0.35);
        background: #65507f;
        color: #fff;
        padding: 5px 10px;
        font-size: var(--fs-xs);
        font-weight: 700;
        cursor: pointer;
      }
      #app-mobile.active .mlb-search-custom-btn:disabled {
        background: #aeb4bc;
        color: #e8ecef;
        cursor: not-allowed;
      }
      #app-mobile.active .mlb-bottom-nav {
        position: relative;
        flex: 0 0 auto;
        margin-top: auto;
        min-height: 64px;
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        align-items: stretch;
        gap: 2px;
        padding: 4px 6px max(4px, env(safe-area-inset-bottom, 0px));
        border-top: 1px solid var(--border);
        background: var(--panel);
        box-shadow: 0 -4px 14px rgba(23,32,46,0.2);
        z-index: 3;
      }
      #app-mobile.active .mlb-bottom-nav-btn {
        min-width: 0;
        border: 0;
        border-radius: 8px;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 2px;
        padding: 4px 2px;
        background: transparent;
        color: var(--text-dim);
        font: 700 clamp(0.61rem, 2.7vw, 0.72rem)/1.15 inherit;
        cursor: pointer;
      }
      #app-mobile.active .mlb-bottom-nav-btn svg {
        width: 25px;
        height: 25px;
        fill: none;
        stroke: currentColor;
        stroke-width: 1.8;
        stroke-linecap: round;
        stroke-linejoin: round;
      }
      #app-mobile.active .mlb-bottom-nav-btn.active {
        margin-top: 0;
        padding-top: 4px;
        border-radius: 8px;
        background: var(--secondary);
        color: #fff;
        box-shadow: inset 0 0 0 2px rgba(255,255,255,0.2), 0 2px 8px rgba(23,32,46,0.18);
      }
      #app-mobile.active .mlb-bottom-nav-btn.online { color: var(--secondary); }
      #app-mobile.active .mlb-bottom-nav-btn:disabled {
        color: #6d7784;
        cursor: not-allowed;
      }
      /* 縦のレールに「更新内容」を足すと「戻る」が右端から溢れるので、下部ナビの4つ目にする（報告板 No.245） */
      #app-mobile.active .mlb-rail-btn.notes { display: none; }
    }
