/* Small touch screens in landscape - Android tablets of 8" (~960 x 600 CSS px: Galaxy Tab A 8, Lenovo Tab M8) and anything
   narrower than 1050 or lower than 640 (step 29 E6b - docs/SERIES_PLAN.md E6, Wykonanie). Everything sits under body.touch
   (ui/platform.js - Settings → Sterowanie, 'auto' on a touch screen) and in one media query, so a mouse at a desktop size
   and the larger tablets (10-13": 1280 x 800, 1400 x 880 - the E5 / E6 layouts) look exactly as before; a portrait screen
   keeps the strip of tabs over the panel (menu.css) and the note to turn the device over a battle (touch.css). Loaded last.
   The rules: the menu's rail stays on the left with the tabs' names but not their lines, the head is one slim band, every
   tab, the room and the briefing fit the screen without scrolling the page (the skirmish with its participants folded -
   ui/platform.js); the battle's sidebar narrower, the touch bar's buttons 46 x 44, the group bar's 46 x 40, the selection
   panel narrower and folded to its head at the start (ui/platform.js inBattle). Touch targets never under 40 px tall,
   text never under 11 px. */
@media (orientation: landscape) and (max-width: 1050px), (orientation: landscape) and (max-height: 640px) {

  /* ---------------- the menu: the head as one slim band, the rail on the left (menu.css made it a strip under 1000) */
  body.touch .overlay.menu { gap: 8px; padding: calc(6px + var(--sa-t)) calc(12px + var(--sa-r)) calc(10px + var(--sa-b)) calc(12px + var(--sa-l)); }
  body.touch .menu-head { gap: 1px; padding-top: 0; }
  body.touch .menu-head .logo img { width: auto; height: 34px; }
  body.touch .menu-head .byline { gap: 10px; font-size: 11px; letter-spacing: 5px; }
  body.touch .menu-head .byline::before, body.touch .menu-head .byline::after { width: 64px; }
  body.touch #lang-select-dd { position: absolute; top: 0; right: 0; align-self: auto; min-width: 120px; }
  body.touch .menu-notice { font-size: 12px; padding: 4px 12px; }
  body.touch .menu-body { grid-template-columns: 184px minmax(0, 1fr); gap: 12px; }
  body.touch .rail { position: sticky; top: 0; gap: 8px; }
  body.touch .rail > * { padding: 6px; gap: 2px; }
  body.touch .tabs, body.touch .rail-foot { flex-direction: column; flex-wrap: nowrap; align-items: stretch; }
  body.touch .tabs button { flex: none; min-height: 44px; grid-template-columns: 20px 1fr; column-gap: 9px; padding: 6px 10px; }
  body.touch .tabs button::before { width: 20px; height: 20px; }
  body.touch .tabs button span { font-size: 13px; letter-spacing: 1.4px; white-space: nowrap; }
  body.touch .tabs button small, body.touch .tabs em.soon { display: none; }
  body.touch .rail-foot button { min-height: 44px; padding: 6px 8px; letter-spacing: .4px; }
  body.touch .rail-foot .nv-off small { font-size: 11px; }
  body.touch .rail-foot .version { margin-left: 0; padding: 3px 8px 1px; }

  /* the panels: tighter, the tab's header smaller (Kampanie's goes - the rail names it, the carousel has its own title) */
  body.touch .panels > .panel { gap: 9px; padding: 12px 16px 14px; }
  body.touch .panels .ph { padding-bottom: 7px; }
  body.touch .panels .ph h2 { font-size: 19px; letter-spacing: 3px; }
  body.touch .panels .ph p { font-size: 12px; line-height: 1.35; }
  body.touch #panel-campaign > .ph { display: none; }
  /* the action bar's dock reaches over these panels' lower bottom padding (widgets.css .ab-dock --dock-b) */
  body.touch :is(.panels > .panel, .modal > .panel, #screen-settings > .panel, .panel.end) .ab-dock { --dock-b: 14px; }
  body.touch #screen-brief .brief .ab-dock { --dock-b: 12px; }

  /* ---------------- Potyczka: the faction as a band over the options, the map on the right */
  body.touch .sk-cols { grid-template-columns: minmax(0, 1fr) 168px; grid-template-areas: "side map" "opts map"; gap: 8px 14px; }
  body.touch .sk-side { grid-area: side; }
  body.touch .sk-side > .cap { display: none; }
  body.touch :is(#faction-current, .sg-faction) { display: grid; grid-template-columns: 46px minmax(0, 1fr) auto; grid-template-rows: auto auto; column-gap: 12px; row-gap: 0;
    align-items: center; justify-items: start; min-height: 58px; padding: 6px 12px 6px 8px; text-align: left; }
  body.touch :is(#faction-current, .sg-faction) .emb { grid-row: 1 / 3; width: 46px; height: 46px; }
  body.touch :is(#faction-current, .sg-faction) img { width: 40px; height: 40px; }
  body.touch :is(#faction-current, .sg-faction) b { font-size: 16px; }
  body.touch :is(#faction-current, .sg-faction) small { font-size: 11.5px; }
  body.touch :is(#faction-current, .sg-faction) .chg { grid-column: 3; grid-row: 1 / 3; margin: 0; }
  body.touch .sk-opts { grid-area: opts; gap: 5px; }
  body.touch .sk-opts .grid + .cap { margin-top: 2px; }
  body.touch .sk-map { grid-area: map; gap: 5px; }
  body.touch #sk-preview, body.touch .sg-preview { width: 168px; height: 168px; }
  body.touch .sk-note { font-size: 11px; }
  body.touch .sk-sec { padding-top: 4px; }
  body.touch .sk-bar { margin: 6px 0 4px; }
  body.touch #sk-players th { font-size: 11px; }

  /* ---------------- Tryby (step 31 F0): lower cards, the four on one screen; a mode's window as the skirmish above */
  body.touch .md-list { gap: 8px; }
  body.touch :is(.overlay, .modal) .card.md-card { min-height: 0; gap: 5px; padding: 11px 14px 12px; }
  body.touch .md-ico { width: 30px; height: 30px; }
  body.touch .md-head h3 { font-size: 17px; letter-spacing: 2px; }
  body.touch .md-blurb { font-size: 12px; line-height: 1.38; }
  body.touch .md-card::after { width: 96px; height: 96px; }

  /* ---------------- Kampanie: the carousel's card as tall as the screen leaves, the emblems in one row that scrolls */
  body.touch .cc { --cc-h: clamp(280px, calc(100dvh - 158px - var(--sa-t) - var(--sa-b)), 560px); gap: 8px; }
  body.touch .cc-card { gap: 10px; }
  body.touch .cc-top { padding: 14px 22px 0; }
  body.touch .cc-num b { font-size: 20px; }
  body.touch .cc-body { gap: 7px; padding: 0 62px 18px; }
  body.touch .cc-head { gap: 12px; }
  body.touch .cc-emb { width: 56px; height: 56px; }
  body.touch .cc-kick { font-size: 11.5px; letter-spacing: 3px; }
  body.touch .cc-title { font-size: 32px; letter-spacing: 3.5px; }
  body.touch .cc-blurb { font-size: 13px; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
  body.touch .cc-foot { gap: 12px; margin-top: 4px; }
  body.touch .cc-m { width: 80px; min-width: 72px; }  /* (72 x 40.5: a finger's) */
  body.touch .cc-act > .ab { width: 236px; }  /* (the card's action bar - docs/NAVIGATION.md: the same 52 px) */
  body.touch .cc-arrow { width: 48px; height: 88px; margin-top: -44px; }
  body.touch .cc-arrow.prev { left: 10px; }
  body.touch .cc-arrow.next { right: 10px; }
  body.touch .cc-prompt { top: 46px; right: 20px; }
  body.touch .cc-index { flex-wrap: nowrap; justify-content: flex-start; gap: 2px; padding: 3px 6px; overflow-x: auto; touch-action: pan-x pan-y; scrollbar-width: none;
    -webkit-mask: linear-gradient(90deg, transparent, #000 14px, #000 calc(100% - 22px), transparent); mask: linear-gradient(90deg, transparent, #000 14px, #000 calc(100% - 22px), transparent); }
  body.touch .cc-index::-webkit-scrollbar { display: none; }
  body.touch .cc-index button { flex: none; width: 40px; height: 40px; }

  /* the mission select (campaign.css): a lower frame, its texts tighter (the campaign's line goes - the emblem and the
     title stay), a smaller radar, the frames of the strip and the objectives' row lower; the dock's row 44 tall */
  body.touch .msn-view { --objs-h: clamp(34px, calc(100vh - 660px), 90px); --stage-h: clamp(186px, calc(100vh - 358px - var(--objs-h)), 420px); --tile-h: 60px; --radar: 88px; gap: 8px; }
  body.touch .msn-stage { padding: 11px 14px 12px; }
  body.touch .msn-art .prompt { padding: 46px calc(var(--radar) + 30px) 0 14px; }
  body.touch .msn-stage .msn-top { padding-bottom: 0; }
  body.touch .msn-stage .msn-top .msn-sub { display: none; }
  body.touch .msn-stage .msn-top .msn-cap { gap: 10px; font-size: 18px; letter-spacing: 3px; }
  body.touch .msn-cap img { width: 28px; height: 28px; }
  body.touch .msn-foe { margin-top: -2px; padding: 3px 10px 3px 4px; }
  body.touch .msn-foe img { width: 28px; height: 28px; }
  body.touch .msn-main { gap: 3px; padding-right: calc(var(--radar) + 26px); }
  body.touch .msn-num b { font-size: 17px; }
  body.touch .msn-title { font-size: 22px; letter-spacing: 2.5px; }
  body.touch .msn-blurb { font-size: 12.5px; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
  body.touch .msn-map { right: 10px; bottom: 10px; padding: 4px; }
  body.touch .msn-map .cap { display: none; }
  body.touch .msn-strip { padding: 7px; }
  body.touch .msn-list { gap: 6px; }
  body.touch .msn-list button { row-gap: 1px; padding: 5px 7px 7px 6px; }
  body.touch .msn-list button b { font-size: 11px; letter-spacing: .6px; }
  body.touch .msn-objs { padding: 6px 10px; }
  body.touch .msn-objs li { font-size: 12px; }
  body.touch .msn-objs li small, body.touch .msn-objs li.step { font-size: 11px; }

  /* ---------------- Gra sieciowa: the cards lower, the rooms and the server side by side, the how-to goes */
  body.touch .net-cols { flex-basis: 168px; min-height: 160px; }
  body.touch :is(.overlay, .modal) .net-card { padding: 14px 16px 14px; }
  body.touch .net-card::after { width: 84px; height: 84px; }
  body.touch .net-card h3 { font-size: 18px; }
  body.touch .net-low { grid-template-columns: minmax(0, 1fr) 260px; gap: 14px; }
  body.touch .net-how { display: none; }

  /* ---------------- Powtórki: the list fills the panel beside the rail */
  body.touch #panel-replays:not([hidden]) { height: calc(100dvh - 76px - var(--sa-t) - var(--sa-b)); min-height: 280px; }

  /* ---------------- Ustawienia (the tab and over the battle): the sub-tabs without their lines, the rows over what is left */
  body.touch .set-body { grid-template-columns: 164px minmax(0, 1fr); gap: 12px; }
  body.touch .set-tabs button { min-height: 44px; padding: 6px 10px; }
  body.touch .set-tabs button small { display: none; }
  body.touch .set-rows { max-height: max(220px, calc(100dvh - 226px - var(--sa-t) - var(--sa-b))); }
  body.touch #screen-settings .set-rows { max-height: max(200px, calc(100dvh - 228px - var(--sa-t) - var(--sa-b))); }  /* (its action bar under the rows) */
  body.touch .set-a2hs ~ .set-body .set-rows { max-height: max(200px, calc(100dvh - 276px - var(--sa-t) - var(--sa-b))); }
  body.touch #screen-settings .set-a2hs ~ .set-body .set-rows { max-height: max(180px, calc(100dvh - 280px - var(--sa-t) - var(--sa-b))); }
  body.touch .set-row { grid-template-columns: minmax(0, 1fr) 196px; gap: 12px; padding-top: 6px; padding-bottom: 6px; }
  body.touch .set-txt b { font-size: 13px; }
  body.touch .set-a2hs { padding: 6px 10px; font-size: 12px; }
  body.touch #screen-settings { padding-top: calc(8px + var(--sa-t)); padding-bottom: calc(8px + var(--sa-b)); }
  body.touch #screen-settings > .panel { width: calc(100vw - 24px); gap: 9px; padding: 12px 16px 14px; }

  /* ---------------- the windows over the menu: the factions five to a row, smaller cards */
  body.touch .modal { padding: calc(10px + var(--sa-t)) 12px calc(10px + var(--sa-b)); }
  body.touch .modal > .panel.modal-box { gap: 10px; padding: 12px 16px 14px; }
  body.touch .factions { grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: 6px; }
  body.touch .faction { gap: 2px; padding: 8px 6px 7px; }
  body.touch .faction img { width: 40px; height: 40px; }
  body.touch .faction span { font-size: 13.5px; }

  /* ---------------- the room: two columns kept, the seats and the rules tighter, the map small beside its facts */
  body.touch #screen-lobby { padding: calc(8px + var(--sa-t)) 0 calc(8px + var(--sa-b)); }
  body.touch #screen-lobby > .panel { width: calc(100vw - 24px); gap: 8px; padding: 12px 16px 12px; }
  body.touch .room .ph p { display: none; }
  body.touch .room .ph h2 { font-size: 19px; }
  body.touch .room-cols { grid-template-columns: minmax(0, 1fr) 232px; gap: 14px; }
  body.touch .room-main, body.touch .room-side { gap: 8px; }
  body.touch #lobby-slots thead { display: none; }  /* (the rows tell themselves: a name, an emblem with its faction, a team, a chip) */
  body.touch #lobby-slots td { height: 44px; padding: 2px 5px; }
  body.touch #lobby-slots .who small, body.touch .st-chip { font-size: 11px; }
  body.touch .room-opts { grid-template-columns: minmax(0, 1fr) minmax(0, 1.16fr) minmax(0, 1fr); gap: 10px; padding-top: 6px; }  /* (the middle one takes both toggles in a row) */
  body.touch .room-opts > section { gap: 4px; }
  body.touch .room-opts label { font-size: 11px; letter-spacing: 1px; }
  body.touch .room-opts .tgls { flex-wrap: nowrap; gap: 2px 10px; padding-top: 0; }
  body.touch .room-opts label.tgl { gap: 6px; }
  body.touch .room-map { grid-template-columns: 104px minmax(0, 1fr); gap: 10px; }
  body.touch #lobby-preview { width: 104px; height: 104px; }
  body.touch .room-facts b { font-size: 13.5px; }
  body.touch .room-facts .note { font-size: 11px; }
  body.touch #lobby-chat { min-height: 64px; max-height: 150px; }

  /* ---------------- the briefing: the picture and the objectives side by side (screens.css stacks them under 1000) and
     the whole frame on the screen - an overflow: hidden flex item shrank to the window and cut its own buttons off */
  body.touch #screen-brief { padding-top: calc(8px + var(--sa-t)); padding-bottom: calc(8px + var(--sa-b)); }
  body.touch #screen-brief .brief { flex-shrink: 0; width: calc(100vw - 24px); gap: 10px; padding: 12px 18px 12px; }
  body.touch .brief .ph h2 { font-size: 21px; letter-spacing: 3px; }
  body.touch .br-emb { width: 44px; height: 44px; }
  body.touch .br-cols { grid-template-columns: minmax(0, 46%) minmax(0, 1fr); gap: 18px; }
  body.touch .br-art { width: 100%; max-width: none; }
  body.touch .br-side { max-height: calc(100dvh - 256px); overflow-y: auto; overscroll-behavior: contain; padding-right: 4px; touch-action: pan-y; }  /* (its action bar under it) */
  body.touch .br-text { max-height: min(22dvh, 180px); }
  body.touch .br-text p { font-size: 13px; }
  body.touch .br-voice > span { font-size: 11px; }

  /* ---------------- the pause and the end over a low screen */
  body.touch #screen-pause, body.touch #screen-end { padding-top: calc(8px + var(--sa-t)); padding-bottom: calc(8px + var(--sa-b)); }
  body.touch .panel.end { gap: 10px; padding: 14px 18px 14px; }

  /* ================= the battle ================= */
  /* the sidebar narrower (the cameos ~88 x 66, the tools 36 x 44), its small texts at 11 px */
  body.touch { --sb: calc(208px * var(--hud)); }
  body.touch #sidebar { padding: 5px calc(5px + var(--sa-r)) calc(5px + var(--sa-b)) 5px; gap: 5px; }
  html.themed body.touch #sidebar { padding: 8px calc(8px + var(--sa-r)) calc(8px + var(--sa-b)) 8px; }
  body.touch #sb-tools { gap: 3px; }
  body.touch #radar-off, body.touch .cameo .owned { font-size: 11px; }
  body.touch .cameo .owned { width: 15px; height: 15px; line-height: 15px; }

  /* the touch bar: 46 x 44 buttons, two rows at most at 960 (the camera's group goes up on the right) */
  body.touch #touchbar { left: calc(8px + var(--sa-l, 0px)); right: 8px; bottom: calc(8px + var(--sa-b, 0px)); gap: calc(5px * var(--hud)) calc(8px * var(--hud)); }
  body.touch .tb-grp { gap: calc(3px * var(--hud)); padding: calc(3px * var(--hud)); }
  body.touch #app #touchbar .tb-b { width: calc(46px * var(--hud)); height: calc(44px * var(--hud)); }
  body.touch #app #touchbar .tb-b svg.hi { width: calc(22px * var(--hud)); height: calc(22px * var(--hud)); }
  body.touch #view-wrap.tb-on > #sel-panel, body.touch #view-wrap.tb-on > #group-bar { bottom: calc(var(--tb-h, 0px) + 12px + var(--sa-b, 0px)); }

  /* the group bar: slots 46 x 40, the views 40 x 40 - one row beside the selection panel */
  body.touch #app #group-bar button { width: calc(46px * var(--hud)); height: calc(40px * var(--hud)); }
  body.touch #app #group-bar .gb-mark { width: calc(40px * var(--hud)); }
  body.touch #view-wrap:has(#sel-panel:not([hidden])) #group-bar { max-width: calc(100% - 30px - calc(288px * var(--hud))); }

  /* the selection panel: narrower, its body lower, its fold button a finger's (it starts folded on a low screen) */
  body.touch #sel-panel { width: calc(288px * var(--hud)); gap: 4px; padding: 6px 8px 8px; }
  body.touch .sp-head { gap: 7px; }
  body.touch .sp-head img { width: calc(48px * var(--hud)); height: calc(36px * var(--hud)); }
  body.touch .sp-title b { font-size: calc(14px * var(--hud)); }
  body.touch #app .sp-min { width: calc(44px * var(--hud)); height: calc(44px * var(--hud)); font-size: calc(17px * var(--hud)); align-self: center; }
  body.touch .sp-body { max-height: calc(108px * var(--hud)); }
  body.touch .sp-hp span, body.touch .sp-body h4, body.touch .sp-body small { font-size: calc(11px * var(--hud)); }
  body.touch .sp-hp { height: calc(13px * var(--hud)); }
  body.touch .sp-hp span { line-height: calc(13px * var(--hud)); }
  body.touch #objectives { width: calc(244px * var(--hud)); }
}

/* A 10-13" tablet in landscape lower than 900 (1280 x 800, 1400 x 880 - the targets' sizes bigger than a mouse's): the head a
   little lower, the participants' bar tighter - so the skirmish fits without scrolling as at 1366 x 768 with a mouse (the
   mission select fits by campaign.css's low-window heights: 1280 x 800 with touch measured, scratch/msn/build). */
@media (orientation: landscape) and (min-width: 1051px) and (min-height: 641px) and (max-height: 900px) {
  body.touch .overlay.menu { gap: 10px; padding-top: calc(6px + var(--sa-t)); }
  body.touch .menu-head .logo img { width: auto; height: 46px; }
  body.touch .panels > .panel { gap: 10px; padding-top: 14px; }
  body.touch .sk-cols { gap: 12px 16px; }
  body.touch .sk-bar { margin: 6px 0 4px; }
  body.touch #sk-add { margin-top: 4px; }
}
