/* phonelobby-nov5: app landscape ≈900×415 — usable pick (map vote / Krok 2/2) + compact wait lobby.
   Root: mapwybor ≥821px restored flex .c2Ctr and undid poziomo display:contents → hero grid
   below the fold, empty right pane, overlapping teams, bot panel over confirm. */

/* ===== PICK: force 3-col landscape (beat mapwybor desktop flex) ===== */
@media (orientation: landscape) and (max-height: 500px),
       (max-height: 480px) and (min-width: 700px) {
  .cs2 {
    grid-template-rows: 42px minmax(0, 1fr) !important;
    height: 100% !important;
    max-height: 100% !important;
    overflow: hidden !important;
  }
  .cs2 .c2Top {
    padding: 0 8px !important;
    grid-template-columns: minmax(80px, 130px) minmax(0, 1fr) minmax(80px, 130px) !important;
  }
  .cs2 .c2Title b { font-size: 16px !important; line-height: 1.1 !important; }
  .cs2 .c2Title small { font-size: 10px !important; }
  .cs2 .c2Steps { display: none !important; }
  .cs2 .c2Tm { width: 36px !important; height: 36px !important; }
  .cs2 .c2Tm b { font-size: 13px !important; }

  /* 3 columns: teams | stage+vote+lock | hero/skin grid */
  .cs2 .c2Main {
    display: grid !important;
    grid-template-columns: clamp(118px, 17vw, 150px) clamp(148px, 21vw, 196px) minmax(0, 1fr) !important;
    /* equal halves for blue/red teams; bottom auto = confirm */
    grid-template-rows: minmax(0, 1fr) minmax(0, 1fr) auto !important;
    gap: 4px 6px !important;
    padding: 4px 8px 4px !important;
    padding-right: 44px !important; /* CZAT rail */
    height: 100% !important;
    max-height: 100% !important;
    min-height: 0 !important;
    overflow: hidden !important;
    align-items: stretch !important;
  }
  body.cs2Chatable .cs2 .c2Main { padding-right: 44px !important; padding-left: 4px !important; }

  /* flatten center so children become grid items */
  .cs2 .c2Ctr {
    display: contents !important;
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
  }

  /* teams: blue top / red bottom — equal halves, scroll if needed */
  .cs2 .c2L {
    grid-column: 1 !important;
    grid-row: 1 !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    min-height: 0 !important;
    max-height: 100% !important;
    align-self: stretch !important;
  }
  .cs2 .c2R {
    grid-column: 1 !important;
    grid-row: 2 !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    min-height: 0 !important;
    max-height: 100% !important;
    align-self: stretch !important;
  }
  .cs2 .c2Team { min-height: 0 !important; height: 100% !important; display: flex !important; flex-direction: column !important; gap: 2px !important; }
  .cs2 .c2Team h4 { font-size: 9px !important; margin: 0 !important; padding: 0 !important; line-height: 1.1 !important; flex: none !important; }
  .cs2 .c2Team .c2List { display: flex !important; flex-direction: column !important; gap: 2px !important; flex: 1 1 auto !important; min-height: 0 !important; overflow-y: auto !important; }
  .cs2 .c2L .c2SiD { display: none !important; }
  .cs2 .c2P {
    min-height: 0 !important;
    height: auto !important;
    padding: 2px 3px !important;
    gap: 3px !important;
    flex: 0 0 auto !important;
  }
  .cs2 .c2P .c2Nm, .cs2 .c2P b, .cs2 .c2P .nm { font-size: 10px !important; line-height: 1.1 !important; }
  .cs2 .c2P .c2Meta, .cs2 .c2P .c2Pts, .cs2 .c2P small { display: none !important; }
  .cs2 .c2Hr { width: 22px !important; height: 22px !important; flex: none !important; }

  /* col 2: stage (top half) / map vote (bottom half) / confirm */
  .cs2 .csStage {
    grid-column: 2 !important;
    grid-row: 1 !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: 100% !important;
    align-self: stretch !important;
    order: unset !important;
  }
  .cs2.mvOn .csStage {
    height: 100% !important;
    min-height: 0 !important;
    max-height: 100% !important;
  }
  .cs2 .csStage .c2StB,
  .cs2 .csStage .csStats,
  .cs2 .csStage .csTitle { display: none !important; }
  .cs2 .csStage .csInfo {
    top: auto !important;
    bottom: 4px !important;
    left: 6px !important;
    right: 6px !important;
    max-width: none !important;
  }
  .cs2 .csStage .csName { font-size: 16px !important; line-height: 1.05 !important; }
  .cs2 .csStage .csRole { font-size: 9px !important; }
  .cs2 .csStage .csSkinN { font-size: 10px !important; }
  .cs2.mvOn .csArt { height: 90% !important; }

  .cs2 .mvStrip,
  .cs2.mvOn .mvStrip {
    grid-column: 2 !important;
    grid-row: 2 !important;
    width: 100% !important;
    max-width: 100% !important;
    height: 100% !important;
    max-height: 100% !important;
    margin: 0 !important;
    padding: 2px 3px 3px !important;
    gap: 2px !important;
    order: unset !important;
    flex: none !important;
    align-self: stretch !important;
    overflow: hidden !important;
  }
  .cs2 .mvHead { gap: 3px !important; margin: 0 !important; }
  .cs2 .mvHead b { font-size: 11px !important; }
  .cs2 .mvWho { display: none !important; }
  .cs2 .mvGrid,
  .cs2 .mvGrid.n5,
  .cs2 .mvGrid.n6 {
    grid-template-columns: repeat(auto-fit, minmax(0, 1fr)) !important;
    gap: 3px !important;
  }
  .cs2 .mvT { padding: 2px !important; gap: 1px !important; min-height: 0 !important; }
  .cs2 .mvT .mwI {
    aspect-ratio: 16 / 9 !important;
    min-height: 28px !important;
    max-height: 36px !important;
    height: auto !important;
  }
  .cs2 .mvT b {
    font-size: 8px !important;
    line-height: 1.1 !important;
    height: 1.2em !important;
    min-height: 1.2em !important;
    max-height: 1.2em !important;
    -webkit-line-clamp: 1 !important;
    padding: 0 !important;
  }
  .cs2 .mvT.mvRand .mwI {
    min-height: 32px !important;
    max-height: none !important;
    padding: 10px 2px 2px !important;
  }

  .cs2 .c2Act,
  .cs2.mvOn .c2Act {
    grid-column: 2 !important;
    grid-row: 3 !important;
    position: static !important;
    z-index: auto !important;
    order: unset !important;
    align-self: start !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 4px !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    background: transparent !important;
    background-image: none !important;
    box-shadow: none !important;
  }
  .cs2 .c2Act .btn {
    min-width: 0 !important;
    width: 100% !important;
    font-size: 14px !important;
    line-height: 1.1 !important;
    padding: 7px 8px !important;
    min-height: 40px !important;
    white-space: normal !important;
  }
  .cs2 .csLock { min-width: 0 !important; width: 100% !important; }

  /* col 3: hero/skin pick — ALWAYS visible (Krok 1 + Krok 2) */
  .cs2 .c2Under,
  .cs2.mvOn .c2Under {
    grid-column: 3 !important;
    grid-row: 1 / -1 !important;
    min-height: 0 !important;
    max-height: none !important;
    height: auto !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    display: flex !important;
    flex-direction: column !important;
    gap: 4px !important;
    padding: 0 2px 4px !important;
    order: unset !important;
    align-self: stretch !important;
  }
  .cs2 .c2Under .c2Hint,
  .cs2 .c2Hint,
  .cs2 .csHint {
    display: block !important;
    font-size: 11px !important;
    line-height: 1.25 !important;
    margin: 0 0 2px !important;
    order: -1;
    flex: none;
  }
  .cs2 .c2Under .c2SiM {
    display: flex !important;
    margin: 0 !important;
    --sir: 64px;
    padding: 6px !important;
  }
  .cs2 .csRoles {
    flex-wrap: wrap !important;
    justify-content: center !important;
    gap: 3px !important;
    max-width: 100% !important;
  }
  .cs2 .csRoles > .csRc {
    flex: 0 0 calc((100% - 9px) / 4) !important;
    min-width: 0 !important;
    padding: 3px !important;
    font-size: 10px !important;
  }
  .cs2 .csGrid {
    --ch: 72px;
    max-height: none !important;
    height: calc(var(--ch) * 2 + 12px) !important;
    flex: none !important;
    gap: 6px !important;
    padding: 2px !important;
    overflow-y: auto !important;
  }
  .cs2 .csPick { flex: 0 0 auto !important; min-height: 0 !important; }
  .cs2 .csSkRow, .cs2 .csSkins { max-height: none !important; }

  /* bot level: under confirm column, collapsed, never over hero grid */
  body.cs2On .rmBotLv,
  body:has(.slMain.csMode) .rmBotLv,
  body.cs2On #rmBotLv {
    /* park under team column so it never covers confirm / hero grid */
    left: 8px !important;
    right: auto !important;
    width: clamp(118px, 17vw, 150px) !important;
    bottom: 4px !important;
    top: auto !important;
    max-height: 40vh !important;
    min-width: 0 !important;
    z-index: 40 !important;
    padding: 4px 6px !important;
  }
  body.cs2On .rmBotLv:not(.open) {
    max-height: 28px !important;
    overflow: hidden !important;
  }
  body.cs2On .rmBotLv:not(.open) .rbl { display: none !important; }
  body.cs2On .rmBotLv > b { cursor: pointer; font-size: 11px !important; }

  body.cs2On #acSnd,
  body:has(.slMain.csMode) #acSnd {
    left: auto !important;
    right: 4px !important;
    top: auto !important;
    bottom: 6px !important;
  }
}

/* ===== WAIT lobby (#room.srvLobby) short landscape ===== */
@media (orientation: landscape) and (max-height: 500px),
       (max-height: 480px) and (min-width: 700px) {
  #room.srvLobby .slWrap {
    padding: 6px 10px 56px !important;
    gap: 8px !important;
    max-width: none !important;
  }
  #room.srvLobby .slHead { gap: 6px !important; }
  #room.srvLobby .slTitle h2 { font-size: 18px !important; }
  #room.srvLobby .slMain {
    grid-template-columns: minmax(0, 1fr) minmax(200px, 260px) !important;
    gap: 8px !important;
  }
  #room.srvLobby .slTeams { gap: 6px !important; }
  #room.srvLobby .slot,
  #room.srvLobby .slP {
    padding: 3px 6px !important;
    gap: 4px !important;
    min-height: 0 !important;
  }
  #room.srvLobby .slSide { gap: 6px !important; }
  #room.srvLobby .slSet { gap: 4px !important; font-size: 12px !important; }
  #room.srvLobby .slChat { min-height: 100px !important; max-height: 160px !important; }
  #room.srvLobby .slFoot .btn {
    min-height: 40px !important;
    font-size: 15px !important;
    padding: 8px 14px !important;
  }
  #rsMapBox .mwGrid,
  #rsMapBox .mwGrid.sm { max-height: 72px !important; }
}
