/* Desktop keeps the existing direct controls. Narrow viewports get one bottom row and an explicit tools popover. */
.gm__toolbox, .gm__tools { display: contents; }
.gm__tools-toggle { display: none; }
.gm .gm__planner-entry {
  position: absolute; left: var(--planner-left,3.5rem); top: var(--planner-top,.2rem); width: var(--planner-width,1.2rem);
  min-width: 60px; min-height: 44px; height: max(.4rem,44px); padding: 0 6px; justify-content: center; gap: 6px;
}
.gm .gm__planner-entry .btn__label { font-size: max(.14rem,12px); white-space: nowrap; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.gm__hud[data-planner-narrow] .gm__planner-entry .btn__icon { display: none; }
.gm__hud[data-tight-planner] .gm__bonds { top: max(1.36rem,104px); }
@media (pointer: coarse), (any-pointer: coarse) {
  .gm__corner { gap: max(.1rem,8px); }
  .gm__tools > .gm__gear { min-width: 44px; min-height: 44px; }
  .gm__tools > .lo-entry { min-height: 44px; }
}
@media (max-width: 1100px) {
  .gm .gm__corner, .gm.is-collapsed .gm__corner {
    width: auto; height: 44px; min-height: 44px; flex-wrap: nowrap; align-items: center; gap: 8px;
  }
  .gm .gm__corner .gm__tools-toggle {
    display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 2px;
    flex: 0 0 44px; width: 44px; height: 44px; font-size: 12px; line-height: 1;
  }
  .gm .gm__tools-toggle .icon { width: 18px; height: 18px; }
  .gm .gm__tools-toggle[aria-expanded="true"] { color: var(--mint-400); border-color: var(--mint-700); }
  .gm .gm__corner .ewheel__btn, .gm .gm__corner .ewheel__btn.has-sprite {
    --ewb-w: 52px; width: 52px; min-width: 52px; height: 44px; padding: 0; display: flex;
    align-items: center; justify-content: center; background: rgba(8,11,10,.9); border: 1px solid var(--line-2); border-radius: 0;
  }
  .gm .gm__corner .ewheel__btn .icon { display: none; }
  .gm .gm__corner .ewheel__btn .ewheel__label {
    position: static; inset: auto; display: block; height: auto; font-size: 12px; line-height: 1; letter-spacing: .03em;
  }
  .gm .gm__corner .gm__tools { display: none; }
  .gm .gm__corner .gm__tools.is-open {
    position: absolute; left: 0; bottom: calc(100% + 8px); z-index: 22;
    display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 6px; padding: 8px;
    width: min(264px,calc(100vw - 32px)); max-height: calc(100dvh - 110px); overflow-y: auto;
    background: rgba(8,15,13,.98); border: 1px solid var(--mint-700); box-shadow: 0 4px 20px #0009;
  }
  .gm .gm__tools > .gm__gear, .gm .gm__tools > .lo-entry {
    display: flex; align-items: center; justify-content: center; gap: 6px; width: 100%; min-width: 0;
    height: 44px; min-height: 44px; padding: 0 6px; font-size: 12px; line-height: 1.2;
  }
  .gm .gm__tools > .gm__gear::after { content: attr(aria-label); }
  .gm .gm__tools > .gm__gear .icon, .gm .gm__tools > .lo-entry .icon, .gm .gm__tools > .lo-entry .lo-entry__icon { width: 18px; height: 18px; flex: none; }
  .gm .gm__tools .lo-entry .btn__label { font-size: 12px; }
  .gm .gm__tools .lo-entry__n, .gm .gm__tools .lo-entry__own { display: none; }
  .gm .gm__bonds { left: 160px; top: 64px; }
  .gm__hud[data-tight-planner] .gm__bonds { top: 104px; }
  .gm .team {
    --mobile-team-top: min(2.36rem,max(48px,calc(var(--match-hud-height,100svh) - 232px)));
    top: var(--mobile-team-top); bottom: 56px; gap: 0; min-height: 0;
  }
  .gm .team__row { min-height: 44px; flex: 0 0 auto; align-self: flex-start; pointer-events: none; }
  .gm .team__btn { width: 44px; height: 44px; display: grid; place-items: center; flex: none; }
  .gm .team__btn .pavatar { --pa: .8rem; }
  .gm .team__info { position: relative; pointer-events: auto; }
  .gm .team__row > .team__btn { pointer-events: auto; }
  .gm .team__name { font-size: max(.15rem,10px); }
  .gm .team__ob, .gm .team__back { position: static; left: auto; bottom: auto; height: 44px; min-height: 44px; margin-top: 4px; white-space: nowrap; }
  .gm__hud[data-short-sidebar] .team { overflow-y: auto; overflow-x: hidden; width: 240px; scrollbar-width: thin; overscroll-behavior: contain; pointer-events: none; }
  .gm .team__seat { left: 4px; top: 4px; font-size: max(.11rem,8px); }
  .gm .team__you { top: 2px; right: 2px; }
  .gm .team__frame { inset: 3px; }
  /* The lower teammate rows must remain below the bonds when browser bars or custom insets shorten the HUD. */
  .gm__hud:not([data-short-sidebar]) .team { overflow: visible; }
  .gm .gm__hud .team:has(.team__ob, .team__back) { top: max(var(--mobile-team-top),calc(var(--planner-top,8px) + max(.4rem,44px) + 4px)); overflow-y: auto; overflow-x: hidden; width: 240px; scrollbar-width: thin; overscroll-behavior: contain; pointer-events: none; }
  .gm .dpanel:not(.dpanel--right) { bottom: 64px; }
}
