/* Touch screens and the device the page runs on (step 29 E6 - docs/SERIES_PLAN.md E6.6, docs/series/audit/touch.md 4.5):
   the page without text selection, callouts, tap flashes and rubber banding; the safe area of a home-screen app (its
   status bar over the top, the home bar under the bottom); which parts the browser may pan by finger (the map and the
   sidebar are the game's - ui/touch.js); the menus' targets for a finger under body.touch (ui/platform.js - Settings →
   Sterowanie, 'auto' on a touch screen); the note over a portrait battle; the menu's line about Ogg Opus; the device
   check page (?probe=1, ui/probe.js). Loaded after every other sheet but touchbar.css (the order bar's own: ui/touchbar.js).
   A mouse keeps every hover effect: each :hover rule of the other sheets sits in @media (hover: hover). */
:root { --sa-t: env(safe-area-inset-top, 0px); --sa-r: env(safe-area-inset-right, 0px); --sa-b: env(safe-area-inset-bottom, 0px); --sa-l: env(safe-area-inset-left, 0px); }

/* ---------------- the page */
html, body { -webkit-user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; overscroll-behavior: none; }
input, textarea, .nr-room .code, .art .prompt span, .cc-prompt span, #lobby-chat, #probe pre { -webkit-user-select: text; user-select: text; -webkit-touch-callout: default; }
/* the finger on the map and the sidebar is the game's (no page scroll or zoom, no doubled mouse events); the lists inside
   them and every screen outside the battle still scroll up and down by finger, never zoom (no double-tap delay) */
#view-wrap, #sidebar { touch-action: none; }
.col, .sp-body, .sg-cells, #objectives .obj-list, #msg-log ol, #screen-pause .help, .overlay, .modal, .set-rows, #replay-list, .dd-list, .br-text,
#lobby-chat, .msn-objs ul, .art .prompt, .cc-prompt span, #probe pre { touch-action: pan-y; }

/* ---------------- the safe area: zero on a desktop and in a Safari tab; the home-screen app has the status bar on top
   (black-translucent: the page reaches under it - the battle starts below it) and the home bar at the bottom */
#app { padding-top: var(--sa-t); }
.overlay { padding-top: calc(16px + var(--sa-t)); padding-bottom: calc(16px + var(--sa-b)); }
.overlay.menu { padding-top: calc(10px + var(--sa-t)); padding-bottom: calc(20px + var(--sa-b)); }
#sidebar { padding-right: calc(7px + var(--sa-r)); padding-bottom: calc(7px + var(--sa-b)); }
html.themed #sidebar { padding-right: calc(12px + var(--sa-r)); padding-bottom: calc(13px + var(--sa-b)); }
#fps, #messages, #comms, #msg-log { left: calc(10px + var(--sa-l)); }
#sel-panel, #chat-box, #replay-bar { left: calc(10px + var(--sa-l)); bottom: calc(10px + var(--sa-b)); }
#group-bar { bottom: calc(10px + var(--sa-b)); }
#chat-box:not([hidden]) ~ #sel-panel { bottom: calc(52px + var(--sa-b)); }
#replay-bar:not([hidden]) ~ #sel-panel { bottom: calc(60px + var(--sa-b)); }

/* ---------------- a finger's targets in the menus (Apple: 44 pt; the battle's own: touchbar.css) */
body.touch button.dd { min-height: 40px; }
body.touch .dd-opt { padding: 11px 16px 11px 24px; font-size: 14px; }
body.touch .chips label.check { min-height: 40px; padding: 6px 14px 6px 10px; }
body.touch .chips input { width: 20px; height: 20px; }
body.touch input[type=checkbox]:not(.tg) { width: 24px; height: 24px; }
body.touch input.tg { width: 52px; height: 28px; border-radius: 14px; }
body.touch input.tg::before { width: 24px; height: 24px; }
body.touch input.tg:checked::before { transform: translateX(24px); }
body.touch input[type=range] { height: 32px; }
body.touch input[type=range]::-webkit-slider-thumb { width: 24px; height: 24px; margin-top: -9px; }
body.touch input[type=range]::-moz-range-thumb { width: 24px; height: 24px; }
body.touch button.ib, body.touch #app button.ib { width: 44px; height: 44px; }  /* (as widgets.css gives a coarse pointer - also with touch set on by hand; docs/NAVIGATION.md 4) */
body.touch :is(.rp-act, .ns, #lobby-slots) button.ib { width: 40px; height: 40px; }  /* (in a list's row: 40, the row a finger's) */
body.touch button.ib::before { width: 18px; height: 18px; }
body.touch .cc .camp-voice { min-height: 44px; }
body.touch .cc-arrow { min-width: 48px; }
body.touch .rail-foot button { min-height: 44px; }
body.touch .panel .foot > button:not(.ib) { min-height: 44px; }
body.touch .sk-bar button, body.touch #sk-add, body.touch #opt-seed { min-height: 40px; }
body.touch .sk-sec > summary { min-height: 40px; align-items: center; }  /* (Uczestnicy: the line that folds the list) */
body.touch .set-row { padding-top: 9px; padding-bottom: 9px; }
body.touch .set-key { min-height: 40px; }  /* (a key's button: an iPad with a keyboard sets keys by finger too) */
body.touch .set-a2hs button { min-height: 44px; margin: -8px 0 -8px 6px; padding: 0 14px; }  /* (Zainstaluj: a finger's, the hint's line no taller - step 29 E6b/c check) */
body.touch .room-copy, body.touch .room-opts label.tgl, body.touch #net-name, body.touch #lobby-say, body.touch #lobby-opts input[type=text] { min-height: 40px; }  /* (the room - step 29 E6b; the room's code: as tall as its action bar - screens.css) */
body.touch .room-copy { position: relative; }
body.touch .room-copy::after { content: ''; position: absolute; inset: -2px; }  /* (Kopiuj link: a finger's 44 by an invisible margin - the room's header no taller, the room fits 960 x 600) */
body.touch .cmdr #cmdr-box > details > summary, body.touch #cmdr-copy { min-height: 44px; }  /* (the Commander's report: the line that unfolds it, its copy button) */
@media (max-width: 1000px) { body.touch .tabs button, body.touch .set-tabs button { min-height: 44px; } }  /* (a portrait iPad: the rail and the sub-tabs as strips of tabs - menu.css, menu_opts.css) */
/* iOS zooms the page into a text field typed in under 16 px */
body.touch :is(input[type=text], input[type=search], input:not([type]), textarea) { font-size: 16px; }
body.touch .row.join input { font-size: 18px; }
/* the carousel's emblems a finger's 40 (campaign.css 38) */
body.touch .cc-index button { width: 40px; height: 40px; }
/* no text under 11 px on a touch screen (step 29 E6b - read from further away than a monitor): the small captions of the
   rail, the skirmish's and the room's tables, the HUD's (with the HUD's scale) */
body.touch :is(.rail-foot .nv-off small, #sk-players th, #sk-players small, #lobby-slots th, #lobby-slots .who small, .st-chip, .room-opts label, .br-voice > span) { font-size: 11px; }
body.touch :is(#radar-off, .sp-hp span, .cameo .owned, .sp-body h4, .sp-body small) { font-size: max(11px, calc(10px * var(--hud))); }
/* the radar's buttons showed in full on hover only (themes.css) */
body.touch #mm-tools { opacity: 1; }
/* the battle's own small buttons under a finger (docs/NAVIGATION.md 4 - the HUD keeps its icons, only their size is the
   rule's): the test mode's tools 40 as segments (rows of two to five) in a panel that scrolls by finger within 40% of the
   screen's height - the build columns under it keep their room (at 960 x 600 they had none before); the folds of the
   selection panel and the objectives 44; the siege's "Wezwij teraz" keeps its look in the wave bar at the top and takes a
   finger's 44 by an invisible margin round it */
body.touch #test-tools { flex: none; max-height: 40vh; overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y; }
body.touch #test-tools :is(button, .dd) { min-height: 40px; }
body.touch #app .sp-min { min-width: 44px; min-height: 44px; }
body.touch #wave-bar .call { position: relative; }
body.touch #wave-bar .call::after { content: ''; position: absolute; inset: -12px -6px; }

/* ---------------- a battle on a portrait screen (768 x 1024): turn the device - the sidebar would leave the map a strip */
#rotate-note { display: none; }
@media (orientation: portrait) {
  body.touch.battle #rotate-note { position: fixed; inset: 0; z-index: 90; display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 12px; padding: 24px; text-align: center; background: radial-gradient(ellipse at 50% 40%, #3a0f0a, #000 70%); }
}
#rotate-note i { width: 72px; height: 72px; background: var(--gold); filter: drop-shadow(0 0 10px rgba(240, 200, 80, .4)); animation: rot-hint 2.4s ease-in-out infinite;
  -webkit-mask: var(--ico) center / contain no-repeat; mask: var(--ico) center / contain no-repeat;
  --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill-rule='evenodd' d='M7 2h7a2 2 0 0 1 2 2v9h-2V4H7v16h4v2H7a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2zm1.5 15h2v1.5h-2zM13 17h7a2 2 0 0 1 2 2v1a2 2 0 0 1-2 2h-7zm2 2v1h5v-1zM18 6.5a5 5 0 0 1 3 4.5h1.6L20 14l-2.6-3H19a3 3 0 0 0-1.6-2.7z'/%3E%3C/svg%3E"); }
@keyframes rot-hint { 0%, 30% { transform: none; } 60%, 100% { transform: rotate(-90deg); } }
#rotate-note b { font: 700 24px var(--font-d); letter-spacing: 4px; text-transform: uppercase; color: var(--t1); text-shadow: 0 2px 0 #000; }
#rotate-note > span { max-width: 420px; color: var(--t3); font-size: 15px; }
body.ios #rotate-note .rn-any, body:not(.ios) #rotate-note .rn-ios { display: none; }  /* ("Obróć iPada" on iOS, "Obróć tablet" elsewhere - ui/platform.js) */
@media (prefers-reduced-motion: reduce) { #rotate-note i { animation: none; } }

/* ---------------- the menu's line: this browser cannot play Ogg Opus (ui/platform.js musicNotice) */
.menu-notice { max-width: min(760px, calc(100vw - 32px)); margin: 2px 0 0; padding: 6px 14px; border: 1px solid rgba(240, 176, 64, .45); border-radius: 4px;
  background: rgba(40, 26, 6, .88); color: #ffd98a; font-size: 12.5px; line-height: 1.4; text-align: center; text-shadow: 0 1px 0 #000; }
/* Settings: the home screen's full screen (ui/settings.js, touch screens outside the home-screen app) */
.set-a2hs { margin: 0; padding: 8px 12px; border-left: 3px solid var(--gold); border-radius: 2px; background: rgba(240, 200, 80, .07); color: var(--t2); font-size: 12.5px; }
/* (the note takes its height from the list, so the panel's foot stays on an iPad mini's screen - 744 pt) */
.set-a2hs ~ .set-body .set-rows { max-height: max(260px, calc(100vh - 372px)); }
#screen-settings .set-a2hs ~ .set-body .set-rows { max-height: max(260px, calc(100vh - 352px)); }  /* (over the battle: its action bar under the rows) */

/* ---------------- the device check page (?probe=1) */
#probe { position: fixed; z-index: 95; left: calc(12px + var(--sa-l)); top: calc(12px + var(--sa-t)); width: min(760px, calc(100vw - 24px)); max-height: calc(100dvh - 24px - var(--sa-t));
  display: flex; flex-direction: column; gap: 8px; padding: 12px 14px; border: 1px solid #000; border-radius: 5px; background: rgba(10, 11, 13, .95);
  box-shadow: 0 0 0 1px var(--metal), 0 12px 30px rgba(0, 0, 0, .8); color: var(--text); }
#probe header { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
#probe header b { font: 700 16px var(--font-d); letter-spacing: 2.5px; text-transform: uppercase; color: var(--gold); }
#probe header span { color: var(--t3); font-size: 12px; }
#probe pre { flex: 1 1 auto; min-height: 0; margin: 0; overflow: auto; white-space: pre-wrap; word-break: break-word; font: 11.5px/1.5 Consolas, Menlo, monospace; color: #d6ecc6; }
#probe .probe-state { margin: 0; color: #fc8; font-size: 12.5px; }
#probe .foot-row { margin: 0; }  /* (then its action bar [Zamknij | Kopiuj wyniki] - widgets.css .ab) */
#probe .foot-row > button { min-height: 44px; }
