/* Touch-friendly Live Match tactics and substitution controls. */
@media (pointer: coarse) and (orientation: landscape) and (max-height: 760px) and (max-width: 1200px) {
  html.gfm-mobile-landscape #liveMatchModal :is(.lm3-sheet-subs, .lm3-sheet-pos, .lm3-sheet-setup) {
    position: fixed !important;
    inset: 0 !important;
    padding: max(4px, env(safe-area-inset-top)) max(6px, env(safe-area-inset-right)) max(4px, env(safe-area-inset-bottom)) max(6px, env(safe-area-inset-left)) !important;
    align-items: stretch !important;
    background: rgba(2, 8, 18, .94) !important;
    touch-action: pan-y pinch-zoom !important;
  }

  html.gfm-mobile-landscape #liveMatchModal :is(.lm3-sheet-subs, .lm3-sheet-pos, .lm3-sheet-setup) .lm3-sheet-box {
    width: 100% !important;
    height: 100% !important;
    max-height: 100% !important;
    border-radius: 10px !important;
  }

  html.gfm-mobile-landscape #liveMatchModal :is(.lm3-sheet-subs, .lm3-sheet-pos, .lm3-sheet-setup) .lm3-sheet-h {
    flex: 0 0 46px !important;
    min-height: 46px !important;
    padding: 6px 10px !important;
    background: #0c2038 !important;
  }

  html.gfm-mobile-landscape #liveMatchModal :is(.lm3-sheet-subs, .lm3-sheet-pos, .lm3-sheet-setup) .lm3-sheet-h b {
    font-size: 14px !important;
  }

  html.gfm-mobile-landscape #liveMatchModal :is(.lm3-sheet-subs, .lm3-sheet-pos, .lm3-sheet-setup) .lm3-sheet-h button {
    width: 38px !important;
    height: 38px !important;
    min-height: 38px !important;
  }

  html.gfm-mobile-landscape #liveMatchModal :is(.lm3-sheet-subs, .lm3-sheet-pos, .lm3-sheet-setup) .lm3-sheet-body {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    padding: 7px 9px 9px !important;
    overflow-y: auto !important;
    overscroll-behavior: contain !important;
    -webkit-overflow-scrolling: touch !important;
  }

  html.gfm-mobile-landscape #liveMatchModal .lm3-substitution-picker {
    display: grid !important;
    grid-template-rows: auto auto minmax(0, 1fr) auto !important;
    gap: 6px !important;
    height: 100% !important;
    min-height: 0 !important;
  }

  html.gfm-mobile-landscape #liveMatchModal .lm3-substitution-picker .lm3-subs-info {
    margin: 0 !important;
    font-size: 11px !important;
  }

  html.gfm-mobile-landscape #liveMatchModal .lm3-sub-summary {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) 28px minmax(0, 1fr) !important;
    align-items: center !important;
    gap: 6px !important;
  }

  html.gfm-mobile-landscape #liveMatchModal .lm3-sub-summary > span {
    display: flex !important;
    flex-direction: column !important;
    min-width: 0 !important;
    padding: 5px 9px !important;
    border: 1px solid #29486b !important;
    border-radius: 8px !important;
    background: #0b1d33 !important;
  }

  html.gfm-mobile-landscape #liveMatchModal .lm3-sub-summary .out { border-color: rgba(248, 113, 113, .7) !important; }
  html.gfm-mobile-landscape #liveMatchModal .lm3-sub-summary .inn { border-color: rgba(74, 222, 128, .7) !important; }
  html.gfm-mobile-landscape #liveMatchModal .lm3-sub-summary small { font-size: 8px !important; font-weight: 900 !important; color: #8fa7c2 !important; }
  html.gfm-mobile-landscape #liveMatchModal .lm3-sub-summary b { overflow: hidden !important; text-overflow: ellipsis !important; white-space: nowrap !important; font-size: 12px !important; }
  html.gfm-mobile-landscape #liveMatchModal .lm3-sub-summary > i { color: #7dd3fc !important; font-size: 20px !important; font-style: normal !important; text-align: center !important; }

  html.gfm-mobile-landscape #liveMatchModal .lm3-substitution-picker .lm3-subs-cols {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) !important;
    gap: 8px !important;
    min-height: 0 !important;
  }

  html.gfm-mobile-landscape #liveMatchModal .lm3-substitution-picker .lm3-subs-cols > div {
    display: flex !important;
    flex-direction: column !important;
    min-height: 0 !important;
    overflow: hidden !important;
  }

  html.gfm-mobile-landscape #liveMatchModal .lm3-substitution-picker .lm3-subs-cols h4 {
    flex: 0 0 auto !important;
    display: flex !important;
    align-items: center !important;
    gap: 5px !important;
    margin: 0 0 4px !important;
    color: #dcecff !important;
  }

  html.gfm-mobile-landscape #liveMatchModal .lm3-substitution-picker .lm3-subs-cols h4 small {
    color: #8299b3 !important;
    font-size: 8px !important;
    text-transform: lowercase !important;
  }

  html.gfm-mobile-landscape #liveMatchModal .lm3-step {
    display: inline-grid !important;
    place-items: center !important;
    width: 19px !important;
    height: 19px !important;
    border-radius: 50% !important;
    background: #1e6ff0 !important;
    color: #fff !important;
    font-size: 10px !important;
  }

  html.gfm-mobile-landscape #liveMatchModal .lm3-substitution-picker .lm3-sub-list {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow-y: auto !important;
    padding: 1px 2px 8px !important;
    touch-action: pan-y !important;
    overscroll-behavior: contain !important;
    -webkit-overflow-scrolling: touch !important;
  }

  html.gfm-mobile-landscape #liveMatchModal :is(.lm3-substitution-picker, .lm3-position-picker) .lm3-sub-row {
    min-height: 46px !important;
    height: auto !important;
    padding: 8px 9px !important;
    gap: 7px !important;
    border-width: 2px !important;
    font-size: 12px !important;
    touch-action: manipulation !important;
  }

  html.gfm-mobile-landscape #liveMatchModal .lm3-sub-row.on {
    border-color: #38bdf8 !important;
    background: linear-gradient(90deg, rgba(14, 116, 144, .48), rgba(30, 111, 240, .25)) !important;
    box-shadow: inset 0 0 0 1px rgba(125, 211, 252, .45) !important;
  }

  html.gfm-mobile-landscape #liveMatchModal .lm3-sub-acts {
    position: sticky !important;
    bottom: 0 !important;
    z-index: 4 !important;
    display: flex !important;
    gap: 7px !important;
    margin: 0 !important;
    padding-top: 5px !important;
    background: linear-gradient(180deg, rgba(8, 22, 40, .2), #081628 35%) !important;
  }

  html.gfm-mobile-landscape #liveMatchModal .lm3-sub-acts .lm3-primary {
    flex: 1 1 0 !important;
    min-height: 46px !important;
    height: 46px !important;
    margin: 0 !important;
    font-size: 12px !important;
    touch-action: manipulation !important;
  }

  html.gfm-mobile-landscape #liveMatchModal .lm3-sub-acts .lm3-primary:disabled {
    opacity: .42 !important;
    filter: grayscale(.55) !important;
  }

  html.gfm-mobile-landscape #liveMatchModal .lm3-position-picker .lm3-subs-cols {
    grid-template-columns: minmax(230px, .85fr) minmax(0, 1.15fr) !important;
    align-items: start !important;
    gap: 10px !important;
  }

  html.gfm-mobile-landscape #liveMatchModal .lm3-position-picker .lm3-mini {
    width: min(100%, 340px) !important;
    max-height: calc(100dvh - 155px) !important;
    margin: 0 auto !important;
  }

  html.gfm-mobile-landscape #liveMatchModal .lm3-position-picker .lm3-sub-list {
    max-height: calc(100dvh - 185px) !important;
    overflow-y: auto !important;
    touch-action: pan-y !important;
  }

  html.gfm-mobile-landscape #liveMatchModal .lm3-tactics-setup {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 7px 10px !important;
  }

  html.gfm-mobile-landscape #liveMatchModal .lm3-tactics-setup > .lm3-subs-info,
  html.gfm-mobile-landscape #liveMatchModal .lm3-tactics-setup > .lm3-formation-sec,
  html.gfm-mobile-landscape #liveMatchModal .lm3-tactics-setup > .lm3-sub-acts {
    grid-column: 1 / -1 !important;
  }

  html.gfm-mobile-landscape #liveMatchModal .lm3-tactics-setup .lm3-menu-sec {
    min-width: 0 !important;
    margin: 0 !important;
    padding: 7px !important;
    border: 1px solid #1d3a5e !important;
    border-radius: 9px !important;
    background: rgba(8, 26, 48, .78) !important;
  }

  html.gfm-mobile-landscape #liveMatchModal .lm3-tactics-setup .lm3-seg {
    grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
    gap: 5px !important;
  }

  html.gfm-mobile-landscape #liveMatchModal .lm3-tactics-setup .lm3-seg button {
    min-height: 42px !important;
    height: auto !important;
    padding: 6px 4px !important;
    font-size: 10px !important;
    line-height: 1.12 !important;
    touch-action: manipulation !important;
  }

  html.gfm-mobile-landscape #liveMatchModal .lm3-tactics-setup .lm3-seg button.on {
    box-shadow: inset 0 0 0 1px #7dd3fc, 0 0 0 1px rgba(56, 189, 248, .35) !important;
  }

  html.gfm-mobile-landscape #liveMatchModal .lm3-pane[data-pane="tactics"] :is(.lm3-ment button, .lm3-primary, .lm3-form-btn, .lm3-tac-chip) {
    min-height: 44px !important;
    height: auto !important;
    touch-action: manipulation !important;
  }
}

@media (pointer: coarse) and (orientation: landscape) and (max-width: 700px) {
  html.gfm-mobile-landscape #liveMatchModal .lm3-substitution-picker .lm3-fit-chip {
    margin-right: 2px !important;
    font-size: 9px !important;
  }

  html.gfm-mobile-landscape #liveMatchModal .lm3-tactics-setup .lm3-seg button {
    font-size: 9px !important;
  }
}
