/* Telefon je určen v 29_mobil.js i při otevření naležato. Úzké okno má stejný fallback.
   Obsahové panely dosud nepřepracovaných karet mají dočasný vnitřní scroll. */
.mob-bar, .mob-back, .mob-players-toggle { display: none; }
html[data-mobile="true"], body[data-mobile="true"] { overflow: hidden; overscroll-behavior: none; -webkit-text-size-adjust: 100%; }
body[data-mobile="true"] input, body[data-mobile="true"] select, body[data-mobile="true"] textarea { font-size: 16px; }
body[data-mobile="true"] .btn { min-height: 44px; }
body[data-mobile="true"] #scr-game {
  position: fixed; top: var(--app-offset-top, 0px); left: var(--app-offset-left, 0px);
  width: var(--app-width, 100%); height: var(--app-height, 100dvh); min-height: 0; max-height: none;
  display: grid; grid-template-rows: auto minmax(0, 1fr) auto; overflow: hidden;
  padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) 0 env(safe-area-inset-left, 0px);
}
body[data-mobile="true"] .topbar { flex-wrap: wrap; gap: 4px; padding: 4px 6px; min-width: 0; position: relative; }
body[data-mobile="true"] .topbar .logo-small { font-size: 12px; letter-spacing: 1px; margin-right: auto; }
body[data-mobile="true"] .topbar > .muted { font-size: 11px; }
body[data-mobile="true"] .topbar #btn-sound, body[data-mobile="true"] .topbar > a[href="#/"] { display: none; }
/* Úzký telefon: záhlaví v jednom řádku (menší logo, bez počtu online, užší Postavy/Účet). */
@media (max-width: 480px) {
  body[data-mobile="true"] .topbar .logo-small img { width: 92px; height: auto; }
  body[data-mobile="true"] .topbar > .muted { display: none; }
  body[data-mobile="true"] .topbar > #btn-switch, body[data-mobile="true"] .topbar > a[href="#/ucet"] { padding: 0 7px; font-size: 12px; }
}
body[data-mobile="true"] #tabs {
  order: 10; flex: 1 1 100%; min-width: 0; flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden;
  scrollbar-width: thin; overscroll-behavior-x: contain; scroll-snap-type: x proximity; padding-bottom: 2px;
}
body[data-mobile="true"] .tab { flex: 0 0 auto; padding: 6px 10px; min-height: 44px; white-space: nowrap; scroll-snap-align: start; }
body[data-mobile="true"] .layout { display: block; height: auto; min-height: 0; min-width: 0; padding: 6px; overflow: hidden; }
body[data-mobile="true"] .layout > * { height: 100%; min-height: 0; min-width: 0; overflow: auto; overscroll-behavior: contain; }
body[data-mobile="true"][data-mp="game"] #left,
body[data-mobile="true"][data-mp="game"] #right,
body[data-mobile="true"][data-mp="hero"] #center,
body[data-mobile="true"][data-mp="hero"] #right,
body[data-mobile="true"][data-mp="chat"] #left,
body[data-mobile="true"][data-mp="chat"] #center { display: none; }
body[data-mobile="true"][data-mp="chat"] #right { display: flex; flex-direction: column; gap: 4px; height: 100%; overflow: hidden; }
body[data-mobile="true"][data-mp="chat"] #zone-side { display: none; flex: 0 1 45%; max-height: 45%; min-height: 0; overflow: auto; }
body[data-mobile="true"][data-mp="chat"][data-mobile-players="true"] #zone-side { display: block; }
body[data-mobile="true"][data-mp="chat"] .mob-players-toggle { display: block; flex: 0 0 auto; }
body[data-mobile="true"][data-mp="chat"] .chat { min-height: 0; min-width: 0; padding: 4px; overflow: hidden; }
body[data-mobile="true"] .chat-tabs { flex: 0 0 auto; display: flex; gap: 4px; overflow-x: auto; }
body[data-mobile="true"] .ctab { flex: 1 0 auto; min-height: 44px; padding: 4px 8px; }
body[data-mobile="true"] #chat-log { min-height: 0; min-width: 0; overflow: auto; overflow-wrap: anywhere; }
body[data-mobile="true"] #chat-form { display: flex; flex: 0 0 auto; align-items: center; gap: 6px; margin: 0; }
body[data-mobile="true"] #chat-input { flex: 1 1 auto; min-width: 0; min-height: 44px; margin: 0; }
body[data-mobile="true"] #chat-form button[type="submit"] { flex: 0 0 auto; white-space: nowrap; }
body[data-mobile="true"] .mob-bar {
  display: flex; position: relative; min-width: 0; gap: 4px; z-index: 40;
  border-top: 1px solid var(--line); padding: 4px 6px calc(4px + env(safe-area-inset-bottom, 0px));
}
body[data-mobile="true"] .mob-bar button {
  flex: 1 1 0; min-width: 0; min-height: 48px; padding: 6px 2px; cursor: pointer; position: relative;
  display: flex; align-items: center; justify-content: center; gap: 6px;
}
.mob-bar .mb-dot { position: absolute; top: 3px; right: 18%; width: 8px; height: 8px; border-radius: 50%; background: var(--bad); }
body[data-mobile="true"]:not([data-mp="game"]) .mob-back { display: block; }
body[data-mobile="true"]:not([data-mp="game"]) #tabs { display: none; }
body[data-mobile="true"]:not([data-mp="game"]) .topbar .logo-small { margin-right: 8px; }
body[data-mobile="true"]:not([data-mp="game"]) .topbar > :not(.logo-small):not(.lang-slot):not(.mob-back) { display: none; }
/* Klávesnice je systémová: aplikace využije pouze skutečný visualViewport. */
body[data-mobile="true"][data-keyboard="true"] #scr-game { grid-template-rows: auto minmax(0, 1fr); }
body[data-mobile="true"][data-keyboard="true"] .mob-bar { display: none; }
body[data-mobile="true"][data-keyboard="true"][data-mp="chat"] .mob-players-toggle,
body[data-mobile="true"][data-keyboard="true"][data-mp="chat"] #zone-side,
body[data-mobile="true"][data-keyboard="true"][data-mp="chat"] .ctab:not(.active) { display: none; }
body[data-mobile="true"][data-keyboard="true"][data-mp="chat"] .ctab { flex: 0 1 auto; min-height: 32px; padding: 2px 8px; }
body[data-mobile="true"][data-keyboard="true"] .layout { padding: 2px 6px; }

/* Stávající úpravy obsahu zůstávají omezené na mobil. Finální rozložení vlastní jeho karta. */
body[data-mobile="true"] .tabpane table, body[data-mobile="true"] .page table { display: block; overflow-x: auto; max-width: 100%; }
body[data-mobile="true"] .fighter { width: 92px; font-size: 10px; }
body[data-mobile="true"] .fighter.boss { width: 100%; max-width: 260px; }
body[data-mobile="true"] .fighter.boss img { width: 120px; height: 120px; }
body[data-mobile="true"] .btn.def { min-width: 0; }
body[data-mobile="true"] .log { max-height: 180px; }
body[data-mobile="true"] .scene-title { font-size: 13px; }
body[data-mobile="true"] .row { flex-wrap: wrap; }
body[data-mobile="true"] .dng-img { max-width: 96px; height: auto; }
body[data-mobile="true"] .av-say { max-width: 120px; }
body[data-mobile="true"] #wm-wrap { margin-left: -6px; margin-right: -6px; }
body[data-mobile="true"] .wm-node .wm-label, body[data-mobile="true"] .wm-node .wm-lvl { font-size: 9px; }
body[data-mobile="true"] .page { padding: 10px; }
body[data-mobile="true"] .admin-tabs { flex-wrap: wrap; }
body[data-mobile="true"] .town { aspect-ratio: 1 / 1; }
body[data-mobile="true"] .bld-ico { font-size: 18px; }
body[data-mobile="true"] .bld-name { font-size: 8px; padding: 0 3px; max-width: 84px; overflow: hidden; text-overflow: ellipsis; }
