/* Mobile release; the asset include checks the server switch and page scope.
 * Preserve the existing sprite chrome and reflow the surrounding interface.
 * A narrow desktop window keeps the desktop layout. */
.mobile-preview-close, #cbp-chat-toggle, #cbp-mobile-chat { display: none; }
.mobile-sidebar-backdrop, .mobile-map-popover, .mobile-account-link, .mobile-booster-info, .mobile-pool-close { display: none; }
.mobile-booster-wrap { display: contents; }
.mobile-menu-shell { display: contents; }
.mobile-parent-destination { display: none !important; }
.mobile-utility-bar, .mobile-sidebar-close { display: none; }
.mobile-only-menu-item, .mobile-character-card { display: none; }
.mobile-character-links { display: contents; }

@media (max-width: 1024px) and (pointer: coarse) {
  html.klanz-mobile-web { scrollbar-gutter: auto; }
  html.klanz-mobile-web body:not(.page-cbp-battle) :is(div.wrapper, div#inner) {
    min-width: 0; width: 100%; overflow: visible;
  }
  html.klanz-mobile-web body:not(.page-cbp-battle) #page {
    box-sizing: border-box; width: 100%; max-width: 100%; left: 0;
    padding: 0 max(3px, env(safe-area-inset-right)) 24px max(3px, env(safe-area-inset-left));
    display: flex; flex-direction: column; gap: 0;
  }
  html.klanz-mobile-web body:not(.page-cbp-battle) #right_col {
    flex: 1 1 auto; width: 100%; max-width: 792px; min-width: 0; margin: 0 auto; padding: 0 0 16px;
  }
  html.klanz-mobile-web body:not(.page-cbp-battle) #left_col {
    display: none; width: 168px; padding: 0;
  }
  html.klanz-mobile-web body.mobile-account-open #left_col {
    display: block; position: fixed; left: auto; right: 8px; transform: none;
    top: 52px; bottom: auto; max-height: calc(100dvh - 60px); overflow-y: auto; overflow-x: hidden;
    z-index: 302; padding: 0; background: transparent; border: 0;
  }
  html.klanz-mobile-web #left_col #logo-link { display: none; }
  html.klanz-mobile-web .mobile-sidebar-backdrop:not([hidden]) {
    display: block; position: fixed; inset: 0; border: 0; background: #0009; z-index: 301;
  }
  html.klanz-mobile-web body:not(.page-cbp-battle) ul#menu {
    display: flex; flex-wrap: nowrap; width: max-content; min-width: 0 !important; height: 38px;
    padding: 0; margin: 0; position: absolute; top: 8px;
    border: 2px solid #c5b15e;
    box-shadow: 0 0 0 1px #211d25, inset 0 0 0 1px #171923;
    background: #362c43;
    transform: scale(var(--mobile-menu-scale, 1)); transform-origin: left top; z-index: 100;
  }
  html.klanz-mobile-web ul#menu > li[id] {
    flex: 0 0 auto; box-sizing: border-box; width: auto; height: 38px;
    padding: 0; margin: 0 !important; left: auto; background: none;
    border-right: 1px solid #24212d;
  }
  html.klanz-mobile-web ul#menu > li[id]:last-child { border-right: 0; }
  html.klanz-mobile-web ul#menu > li[id] > a {
    box-sizing: border-box; width: auto; height: 38px; padding: 0 14px;
    white-space: nowrap; font-size: 16px; line-height: 36px; text-indent: 0;
    background-size: 100% 76px; background-position: 0 0;
  }
  html.klanz-mobile-web ul#menu > li#menu_item_auth_play > a {
    background-image: url('/interface/top_menu/menu-item-task.png');
  }
  html.klanz-mobile-web ul#menu > .mobile-only-menu-item { display: block; }
  html.klanz-mobile-web ul#menu > .mobile-only-menu-item > a {
    display: block; background-image: url('/interface/top_menu/menu-item-task.png');
    color: #fff; text-decoration: none; text-align: center;
  }
  html.klanz-mobile-web ul#menu > li[id] > a:is(:hover, .has-trade-alert),
  html.klanz-mobile-web ul#menu > li.has-trade-alert > a { background-position: 0 -38px; }
  html.klanz-mobile-web ul#menu > li.has-mobile-alert > a { background-position: 0 -38px; color: #ffd100; }
  html.klanz-mobile-web ul#menu div.menu a.has-mobile-alert { color: #ffca00; }
  /* One native outer frame; no overlapping frames or negative cell offsets. */
  html.klanz-mobile-web .mobile-menu-shell {
    display: block; position: relative; width: 100%; max-width: 792px; margin: 0 auto;
    flex: 0 0 auto; z-index: 100;
  }
  html.klanz-mobile-web ul#menu > li.with_subitems > div.menu,
  html.klanz-mobile-web ul#menu > li.with_subitems > div.top { display: none; }
  html.klanz-mobile-web ul#menu > li.is-mobile-menu-open { z-index: 125 !important; }
  html.klanz-mobile-web ul#menu > li.is-mobile-menu-open > :is(div.menu, div.top) { display: block; }
  html.klanz-mobile-web ul#menu > li > div.menu {
    width: 208px; min-width: 0; box-sizing: border-box; top: 44px;
    border-style: solid; border-color: transparent; border-width: 14px 24px 24px 14px;
    border-image: url('/interface/backgrounds/battle_popup.png') 14 24 24 14 fill / 14px 24px 24px 14px stretch;
    background: transparent; padding: 0 4px;
    transform: scale(var(--mobile-menu-inverse, 1)); transform-origin: left top;
    max-height: calc(100dvh - 64px); overflow-y: auto; overscroll-behavior: contain;
    scrollbar-width: thin; scrollbar-color: #8a7750 #35343b;
    filter: drop-shadow(0 3px 5px #0008);
  }
  html.klanz-mobile-web ul#menu > li > div.menu > a,
  html.klanz-mobile-web ul#menu .mobile-character-links > a,
  html.klanz-mobile-web ul#menu .mobile-logout > button {
    box-sizing: border-box; width: 100% !important; min-height: 40px;
    padding: 11px 6px !important; font-size: 13px !important; line-height: 18px !important;
    text-indent: 0; border-bottom: 1px solid #514b48 !important;
  }
  html.klanz-mobile-web ul#menu > li > div.menu > a:last-child { border-bottom: 0 !important; }
  html.klanz-mobile-web ul#menu > li > div.menu > a:active,
  html.klanz-mobile-web ul#menu > li > div.menu > a:focus-visible {
    color: #ffca00; background: #242229 !important;
  }
  html.klanz-mobile-web ul#menu .mobile-parent-destination,
  html.klanz-mobile-web ul#menu .mobile-account-link { display: block !important; }
  html.klanz-mobile-web .mobile-utility-bar.mobile-utility-empty { display: none; }
  html.klanz-mobile-web ul#menu #menu_item_auth_task.is-mobile-menu-open > div.menu {
    display: grid; grid-template-columns: minmax(0, 1fr) 168px; gap: 12px;
    width: 360px; padding: 0 0 8px; border: 0; background: none;
    border-image: none; align-items: start;
    max-height: none !important; overflow: visible; overscroll-behavior: auto;
  }
  html.klanz-mobile-web .mobile-character-card { display: block; }
  html.klanz-mobile-web .mobile-character-card .player-panel { margin: 0; }
  html.klanz-mobile-web .mobile-character-card .player-alerts { display: none; }
  html.klanz-mobile-web ul#menu .mobile-character-card .player-battle-hitbox {
    width: 150px !important; height: 34px !important; padding: 0 !important; margin: 0 !important;
    border: 0 !important; top: 7px; left: 40px;
  }
  html.klanz-mobile-web ul#menu .mobile-character-card .player-name {
    width: auto !important; height: auto !important; margin: 0 !important; padding: 0 !important;
    border: 0 !important; line-height: 13px !important; font-size: 11px !important;
    text-align: left !important;
  }
  html.klanz-mobile-web .mobile-character-links {
    display: block; padding: 4px 8px; background: #35343b;
    border: 1px solid #8a7750; box-shadow: inset 0 0 0 1px #1a181f;
  }
  html.klanz-mobile-web ul#menu .mobile-logout { position: static; margin: 0; }
  html.klanz-mobile-web ul#menu .mobile-logout > button {
    display: block; position: static; height: auto; margin: 0; text-indent: 0;
    background: none; border: 0; color: #ddd; text-align: left; cursor: pointer;
    font: 13px Tahoma, Arial, sans-serif; border-bottom: 0 !important;
  }
  html.klanz-mobile-web ul#menu .mobile-logout > button:hover { color: #ffca00; }
  html.klanz-mobile-web .mobile-utility-bar {
    display: flex; align-items: center; gap: 4px; flex-wrap: wrap;
    width: calc(100% - 16px); max-width: 750px; min-height: 40px; margin: 0 auto 8px;
    padding: 0 2px; box-sizing: border-box;
    border: solid transparent; border-width: 5px 8px 7px;
    border-image: url('/interface/buttons/deck-black.png') 5 8 7 8 fill / 5px 8px 7px 8px stretch;
    color: #ddd; font: 11px Tahoma, Arial, sans-serif;
  }
  html.klanz-mobile-web .mobile-utility-bar > a,
  html.klanz-mobile-web .mobile-utility-bar > .mobile-panel-toggle {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    height: 30px; padding: 0 8px; box-sizing: border-box;
    border: 0; background: none;
    color: #eee2c5; text-decoration: none; flex-shrink: 0; text-shadow: 0 1px 2px #000;
    font: 11px Tahoma, Arial, sans-serif; cursor: pointer;
  }
  html.klanz-mobile-web .mobile-home-link svg { width: 14px; height: 14px; color: #ccb875; }
  html.klanz-mobile-web .mobile-utility-bar > .mobile-home-link { border-right: 1px solid #514a42; padding-right: 14px; }
  html.klanz-mobile-web .mobile-utility-bar > .mobile-panel-toggle { border-left: 1px solid #514a42; padding-left: 14px; }
  html.klanz-mobile-web .mobile-account-name { max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  html.klanz-mobile-web .mobile-account-arrow { color: #ccb875; }
  html.klanz-mobile-web .mobile-panel-toggle, html.klanz-mobile-web .mobile-sidebar-close {
    display: block; padding: 7px 4px; border: 0; background: none; color: #ddc78c;
    font: 11px Tahoma, Arial, sans-serif; flex-shrink: 0;
  }
  html.klanz-mobile-web .mobile-sidebar-close { width: 100%; text-align: right; margin-bottom: 6px; }
  html.klanz-mobile-web .mobile-utility-bar .player-currencies {
    position: static; display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 10px;
    min-width: 0; margin: 0 auto; color: #eee; background: none;
    padding: 0 4px; line-height: 16px;
    box-sizing: border-box;
  }
  html.klanz-mobile-web .mobile-utility-bar .player-currencies-row { display: contents; }
  html.klanz-mobile-web .mobile-utility-bar .player-currency { position: static; gap: 4px; }
  html.klanz-mobile-web .mobile-utility-bar .player-currency-ico { position: static; margin: 0; }
  html.klanz-mobile-web .mobile-utility-bar .player-currency .value { margin: 0; font-size: 11px; }
  html.klanz-mobile-web .mobile-utility-bar .player-alerts { position: static; display: flex; flex-direction: row; align-items: center; margin-left: auto; gap: 2px; }
  html.klanz-mobile-web .mobile-utility-bar .player-alerts a { width: 30px; height: 28px; padding: 0; margin: 0; background-size: 30px 25px; }
  html.klanz-mobile-web .mobile-utility-bar .mobile-panel-toggle { margin-left: auto; }
  html.klanz-mobile-web .mobile-utility-bar:has(.player-alerts) .mobile-panel-toggle { margin-left: 0; }
  @media (max-width: 740px) {
    html.klanz-mobile-web .mobile-utility-bar:has(.player-alerts) .player-currencies {
      order: 4; width: 100%; padding: 5px 0 0; justify-content: space-evenly;
      border-top: 1px solid #514a42;
    }
  }
  html.klanz-mobile-web body:not(.page-cbp-battle) :is(.r_l, .res_l) {
    float: none; width: 100%; max-width: 100%; box-sizing: border-box; min-width: 0;
  }
  html.klanz-mobile-web body:not(.page-cbp-battle) :is(.r_r, .res_r) {
    float: none; width: 100%; max-width: 100%; min-width: 0; padding-left: 29px; padding-right: 29px;
    box-sizing: border-box;
  }
  html.klanz-mobile-web body:not(.page-cbp-battle) :is(.r_r, .res_r) > :is(.r_h, .r_f, .r_s) {
    width: calc(100% + 16px); max-width: none; margin-left: -8px; margin-right: -8px;
  }
  html.klanz-mobile-web body:not(.page-cbp-battle) :is(.r_h, .r_f, .r_s) {
    width: 100%; max-width: 100%; background-size: 100% auto;
  }
  html.klanz-mobile-web body:not(.page-cbp-battle) :is(.r_h, .r_f) { background-size: 100% 22px; }
  html.klanz-mobile-web :is(button, a, input, select, textarea) { touch-action: manipulation; }
  html.klanz-mobile-web :is(button, a, input, select, textarea):focus-visible { outline: 2px solid #ffca00; outline-offset: 2px; }
  html.klanz-mobile-web #klanz-global-chat .testtest-chat-msg-input:focus { outline: none; }
  html.klanz-mobile-web .mobile-full-separator {
    position: relative; background-image: none !important; overflow: visible !important;
  }
  html.klanz-mobile-web .mobile-full-separator::after {
    content: ''; position: absolute; top: 0; bottom: 0;
    left: var(--separator-left, 0px); right: var(--separator-right, 0px);
    background: url('/interface/backgrounds/v_ln.png') left center / 100% 6px no-repeat;
    pointer-events: none;
  }
  html.klanz-mobile-web body:not(.page-cbp-battle) :is(input:not([type=checkbox]):not([type=radio]):not([type=hidden]):not([type=submit]):not([type=button]):not([type=image]):not([type=file]), select, textarea) {
    max-width: 100%; box-sizing: border-box; font-size: 16px; line-height: 20px;
    min-height: 34px; padding: 6px 8px;
  }
  html.klanz-mobile-web :is(.clan-filters, .own-filters, .gift-filters) { line-height: 2; white-space: normal !important; }
  html.klanz-mobile-web :is(.clan-filters, .own-filters, .gift-filters) a { display: inline-block; padding: 5px 2px; }
  html.klanz-mobile-web :is(.clan-switch, .card-actions a, .import-paste, .mkt-lot-act) { min-height: 40px; }
  html.klanz-mobile-web .card-actions a { display: inline-flex; align-items: center; font-size: 12px; }
  html.klanz-mobile-web :is(.clan-switches, .collection-saved-decks, .clan-filters-row, .collection-sort-search-row, .partner-bar, .picker-search, .picker-mode-row, .ex-toolbar, .funts-row) {
    flex-wrap: wrap; min-width: 0;
  }
  html.klanz-mobile-web :is(.mkt-clan-bar, .shop-clan-bar, .clan, .collection-deck-tabs) { flex-wrap: wrap; }
  html.klanz-mobile-web .clan { height: auto; min-height: 40px; padding: 8px 10px; }
  html.klanz-mobile-web .clan-switch { display: inline-flex; align-items: center; justify-content: center; }
  html.klanz-mobile-web :is(.deck, .mkt-body, .ex-body, .ex-n-content, .ex-d-content, .drafts-pick-cards-wrap) {
    margin-left: 0 !important; margin-right: 0 !important; padding-left: 0; padding-right: 0;
  }
  html.klanz-mobile-web :is(div.cards:not(.clans2-index-mode), .picked-cards, .drafts-pick-cards:not(.cascade-offer-cards), .shop-cards-grid, .card-thumbs, .open-cards, .reveal-grid, .reveal-grid.is-count-3, .reveal-grid.is-count-4) {
    display: grid; grid-template-columns: repeat(auto-fit, 172px); gap: 12px 4px; justify-content: center;
  }
  html.klanz-mobile-web #picked-cards { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px 6px; }
  html.klanz-mobile-web #picked-cards .card { zoom: var(--mobile-picked-scale, 1); transform: none; }
  html.klanz-mobile-web :is(.cards-pagination, .mkt-pag, .topic-pag, .klanz-pag) { max-width: 100%; }
  html.klanz-mobile-web :is(.cards-pagination .pagination, .mkt-pag-nums, .topic-pag-nums, .klanz-pag-nums) {
    flex-wrap: wrap; min-width: 0; gap: 3px;
  }
  html.klanz-mobile-web :is(.cards-pagination, .mkt-pag, .topic-pag, .klanz-pag) a { min-height: 40px; }
  html.klanz-mobile-web :is(.deck-import-dialog, .filters-code-dialog) { max-height: 85dvh; overflow-y: auto; }

  /* Preserve the map and its existing hover panels; touch opens one panel. */
  html.klanz-mobile-web .mobile-map-frame { margin-left: auto; margin-right: auto; }
  html.klanz-mobile-web body:not(.page-cbp-battle) .mobile-map-frame > .r_r { padding-left: 21px; padding-right: 21px; }
  html.klanz-mobile-web .mobile-map-canvas { width: 100%; overflow: hidden; }
  html.klanz-mobile-web .mobile-map-canvas .map-wrap { width: 750px; transform-origin: top left; }
  html.klanz-mobile-web .mobile-map-canvas .map-location-tip,
  html.klanz-mobile-web .mobile-map-canvas .map-help-box { visibility: hidden !important; }
  html.klanz-mobile-web .mobile-map-popover {
    display: block; position: fixed; width: 260px; z-index: 200;
    max-height: 80dvh; overflow-y: auto; filter: drop-shadow(0 3px 6px #0008);
  }
  html.klanz-mobile-web .mobile-map-enter {
    display: block; position: relative; z-index: 10; align-self: center;
    padding: 5px 12px; margin: 4px auto 0; text-align: center; line-height: 24px;
    color: #ffca00; background: none; text-decoration: underline; font-size: 13px;
  }
  html.klanz-mobile-web .mobile-map-popover .map-location-tip,
  html.klanz-mobile-web .mobile-map-popover .map-help-box {
    display: block; position: relative; left: auto; top: auto; bottom: auto;
    visibility: visible; opacity: 1; pointer-events: auto; margin: 0 auto;
  }
  html.klanz-mobile-web .mobile-map-popover :is(.map-location-tip, .map-location-tip-stack) { width: 218px; height: auto; }
  html.klanz-mobile-web .mobile-map-popover .map-location-tip-stack { padding: 35px 0 8px; box-sizing: border-box; }
  html.klanz-mobile-web .mobile-map-popover :is(.map-location-tip-title-img, .map-location-tip-title) { width: 100%; }
  html.klanz-mobile-web .mobile-map-popover :is(.map-location-tip-top, .map-location-tip-back, .map-location-tip-bottom) { width: calc(100% - 2px); }
  html.klanz-mobile-web .mobile-map-popover .map-location-tip-back { height: calc(100% - 48px); }
  html.klanz-mobile-web .mobile-map-popover .map-location-tip-bottom { top: auto; bottom: 0; }
  html.klanz-mobile-web .mobile-map-popover .map-location-tip-title { gap: 6px; padding: 0 12px; }
  html.klanz-mobile-web .mobile-map-popover .map-location-tip-name { max-width: none; font-size: 15px; color: #ffca00; }
  html.klanz-mobile-web .mobile-map-popover .map-location-tip-body {
    position: relative; left: 0; top: 0; width: 100%; height: auto; min-height: 40px;
    padding: 8px 12px; font-size: 12px; line-height: 18px;
  }
  html.klanz-mobile-web .mobile-map-popover :is(.map-help-box, .map-help-stack) { width: 260px; }
  html.klanz-mobile-web .mobile-map-popover :is(.hb-top, .hb-bottom, .hb-mid, .hb-top-title) { width: 237px; }
  html.klanz-mobile-web .mobile-map-popover .hb-mid { background-size: 237px 55px; }
  html.klanz-mobile-web .mobile-map-popover .hb-back-label { font-size: 12px; line-height: 17px; gap: 7px; padding: 6px 10px 10px; pointer-events: auto; }
  html.klanz-mobile-web .mobile-map-description { border-bottom: 1px solid #615d76; padding-bottom: 8px; margin-bottom: 2px; }
  html.klanz-mobile-web .mobile-map-description strong { display: block; color: #ffca00; font-weight: normal; font-size: 14px; margin-bottom: 4px; }
  html.klanz-mobile-web .mobile-map-description .map-location-tip-online { display: block; font-size: 11px; margin-top: 4px; }
  /* Draft/sealed: retain the card overlays, opened explicitly by touch. */
  html.klanz-mobile-web .drafts-pick-players { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); padding: 0; gap: 12px 4px; }
  html.klanz-mobile-web .drafts-pick-player-slot { min-width: 0; overflow: hidden; }
  html.klanz-mobile-web .drafts-pick-player-image { width: 100%; max-width: 100%; min-width: 0; height: auto; }
  html.klanz-mobile-web .drafts-pick-status-row { grid-template-columns: minmax(0, 1fr) 90px; gap: 4px; padding: 0; }
  html.klanz-mobile-web .drafts-pick-status-box { max-width: 100%; min-width: 0; overflow: hidden; }
  html.klanz-mobile-web .drafts-pick-status-box--ind { grid-column: 1; width: 100%; max-width: 100%; overflow: hidden; }
  html.klanz-mobile-web .drafts-pick-status-box--time { grid-column: 2; }
  html.klanz-mobile-web .drafts-pick-status-box img { max-width: 100%; }
  html.klanz-mobile-web .drafts-pick-status-box--time > img { width: 100%; height: 60px; object-fit: fill; }
  html.klanz-mobile-web .drafts-pick-ind-frame { transform: none; height: 60px; overflow: hidden; }
  html.klanz-mobile-web .drafts-pick-ind-frame-center { width: 100%; max-width: 100%; left: 50%; height: 56px; transform: translateX(-50%); }
  html.klanz-mobile-web .drafts-pick-status-box img.drafts-pick-ind-frame-top,
  html.klanz-mobile-web .drafts-pick-status-box img.drafts-pick-ind-frame-bottom { width: 100%; height: 22px; }
  html.klanz-mobile-web .drafts-pick-ind-frame-bottom { top: auto; bottom: 0; }
  html.klanz-mobile-web .drafts-pick-status-box img.drafts-pick-ind-tile { width: 100%; height: 100%; }
  html.klanz-mobile-web .drafts-pick-card.is-touch-active .drafts-pick-card-overlay { opacity: 1; pointer-events: auto; }
  /* A touch browser synthesizes :hover before click. Do not let that first tap
     land on a newly revealed select button and pick a card immediately.
     Keep .is-removed overlays (cascade cut «Убрана») always visible. */
  html.klanz-mobile-web .drafts-pick-card:not(.is-touch-active):not(.is-selected):not(.is-removed) .drafts-pick-card-overlay {
    opacity: 0 !important; pointer-events: none !important;
  }
  html.klanz-mobile-web .drafts-pick-card.is-removed {
    filter: grayscale(0.55) brightness(0.62);
  }
  html.klanz-mobile-web .drafts-pick-card.is-removed .drafts-pick-card-overlay {
    opacity: 1 !important;
    pointer-events: auto !important;
    background: rgba(0, 0, 0, 0.72);
  }
  /* Cascade cut «Убрана»: label idle; restore button only after tap (like sealed «Выбрана»). */
  html.klanz-mobile-web .drafts-pick-card.is-removed:not(.is-touch-active) .cascade-cut-removed-label,
  html.klanz-mobile-web .drafts-pick-card.is-removed.just-removed .cascade-cut-removed-label {
    display: block !important;
  }
  html.klanz-mobile-web .drafts-pick-card.is-removed:not(.is-touch-active) .cascade-cut-stack,
  html.klanz-mobile-web .drafts-pick-card.is-removed.just-removed .cascade-cut-stack {
    display: none !important;
  }
  html.klanz-mobile-web .drafts-pick-card.is-removed.is-touch-active:not(.just-removed) .cascade-cut-removed-label {
    display: none !important;
  }
  html.klanz-mobile-web .drafts-pick-card.is-removed.is-touch-active:not(.just-removed) .cascade-cut-stack {
    display: flex !important;
  }
  html.klanz-mobile-web .drafts-pick-cards.can-cut .drafts-pick-card:not(.is-removed).is-touch-active .cascade-cut-stack {
    display: flex !important;
  }
  html.klanz-mobile-web .drafts-pick-card.is-selected:not(.is-touch-active) .drafts-pick-card-cancel-btn { display: none !important; }
  html.klanz-mobile-web .drafts-pick-card.is-selected:not(.is-touch-active) .drafts-pick-card-selected-label { display: block !important; }
  html.klanz-mobile-web .drafts-pick-card-select-btn,
  html.klanz-mobile-web .drafts-pick-card-cancel-btn { min-height: 42px; min-width: 120px; }
  html.klanz-mobile-web .drafts-pick-card.is-selected.is-touch-active:has(.drafts-pick-card-cancel-btn) .drafts-pick-card-cancel-btn { display: block; }
  html.klanz-mobile-web .drafts-pick-card.is-selected.is-touch-active:has(.drafts-pick-card-cancel-btn) .drafts-pick-card-selected-label { display: none; }
  html.klanz-mobile-web .drafts-pick-underlay-line { white-space: normal; }

  /* Cascade offer (all mobile): 3 cards side-by-side, scaled to fit, never into frames */
  html.klanz-mobile-web body:not(.page-cbp-battle) .cascade-pick-page > .r_l > .r_r {
    padding-left: 21px !important;
    padding-right: 21px !important;
    overflow-x: hidden;
    box-sizing: border-box;
  }
  html.klanz-mobile-web .cascade-pick-page .cascade-pick-status-row {
    display: flex !important;
    flex-wrap: nowrap;
    gap: 8px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    padding: 8px 0 0 !important;
    overflow: hidden;
  }
  html.klanz-mobile-web .cascade-pick-page .cascade-pick-explain { flex: 1 1 auto; min-width: 0; }
  html.klanz-mobile-web .cascade-pick-page .cascade-pick-time {
    flex: 0 0 112px; width: 112px !important; max-width: 112px; height: 36px; overflow: hidden;
  }
  html.klanz-mobile-web .cascade-pick-page .cascade-pick-time img {
    width: 100% !important; height: 36px !important; transform: none !important; object-fit: fill;
  }
  html.klanz-mobile-web .cascade-pick-page .cascade-pick-timer-text { font-size: 16px !important; }
  html.klanz-mobile-web .drafts-pick-cards.cascade-offer-cards {
    display: flex !important;
    flex-flow: row nowrap !important;
    justify-content: space-between;
    align-items: flex-start;
    gap: 4px !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
    transform: none !important;
    grid-template-columns: none !important;
  }
  html.klanz-mobile-web .drafts-pick-cards.cascade-offer-cards > .drafts-pick-card {
    flex: 0 0 auto !important;
    width: 172px !important;
    margin: 0 !important;
    transform: none !important;
    zoom: var(--mobile-cascade-offer-scale, 0.48);
  }
  html.klanz-mobile-web .drafts-pick-cards-wrap:has(> .cascade-offer-cards) {
    width: 100%; max-width: 100%; overflow: hidden; box-sizing: border-box;
  }
  html.klanz-mobile-web .drafts-top-actions a { max-width: 100%; }
  html.klanz-mobile-web :is(.drafts-top-actions, .drafts-empty-note) img { max-width: 100%; height: auto; }
  html.klanz-mobile-web .drafts-head { grid-template-columns: 60px 1fr 75px; }
  html.klanz-mobile-web .draft-row { grid-template-columns: 1fr; gap: 8px; padding: 12px 6px; }
  html.klanz-mobile-web :is(.draft-joined-row, .draft-joined-left) { flex-wrap: wrap; }
  html.klanz-mobile-web .draft-cell-right { display: flex; flex-wrap: wrap; gap: 16px; border: 0; }
  /* Create form (/bunker/new): stack table rows; keep KlanZ panel look. */
  html.klanz-mobile-web :is(.drafts-create-table, .drafts-create-table tbody, .drafts-create-table tr, .drafts-create-table td) {
    display: block; width: 100%; max-width: 100%; box-sizing: border-box;
  }
  html.klanz-mobile-web .drafts-create-table { border: 1px solid #56525d; background: #2c2a33; }
  html.klanz-mobile-web .drafts-create-table tr {
    margin: 0 0 8px; border: 1px solid #4b4752; background: #26242c;
  }
  html.klanz-mobile-web .drafts-create-table tr:last-child { margin-bottom: 0; }
  html.klanz-mobile-web .drafts-create-table td { border: 0; padding: 8px 10px; }
  html.klanz-mobile-web .drafts-col-label {
    width: auto; white-space: normal; padding-bottom: 6px;
    border-bottom: 1px solid #4b4752; color: #ffca00; font-size: 12px;
  }
  html.klanz-mobile-web .drafts-type-options { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  html.klanz-mobile-web .drafts-type-options .drafts-option {
    min-height: 44px; padding: 10px 8px; white-space: normal; align-items: center;
  }
  html.klanz-mobile-web .drafts-type-options .drafts-option + .drafts-option { border-left: 0; }
  html.klanz-mobile-web .drafts-type-options .drafts-option:nth-child(odd) { border-right: 1px inset #56525d; }
  html.klanz-mobile-web .drafts-type-options .drafts-option:nth-child(-n+2) { border-bottom: 1px inset #56525d; }
  html.klanz-mobile-web .drafts-format-grid { grid-template-columns: 1fr; }
  html.klanz-mobile-web .drafts-format-block + .drafts-format-block {
    border-left: 0; border-top: 1px inset #56525d;
  }
  html.klanz-mobile-web .drafts-participants-controls {
    display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px; width: 100%; justify-content: stretch;
  }
  html.klanz-mobile-web .drafts-participants-controls > label { min-width: 0; }
  html.klanz-mobile-web .drafts-player-choice {
    display: flex; justify-content: center; width: 100%; box-sizing: border-box; padding: 8px 4px;
  }
  html.klanz-mobile-web .drafts-player-choice img { max-width: 100%; height: auto; }
  html.klanz-mobile-web .drafts-type-cell { width: auto !important; padding-left: 10px !important; }
  html.klanz-mobile-web .drafts-split-cell { padding: 0 !important; }
  html.klanz-mobile-web .drafts-split-cell .drafts-type-options { min-height: 0; }
  html.klanz-mobile-web :is(.drafts-select, .drafts-password input, .drafts-custom-input-wrap textarea) {
    width: 100%; max-width: 100%; box-sizing: border-box;
  }
  html.klanz-mobile-web :is(.drafts-booster-controls, .drafts-fee-controls, .drafts-access-controls) {
    flex-wrap: wrap; gap: 10px 14px; align-items: center;
  }
  html.klanz-mobile-web .drafts-booster-flags { gap: 10px; }
  html.klanz-mobile-web .drafts-option { white-space: normal; }
  html.klanz-mobile-web .drafts-actions { flex-wrap: wrap; gap: 10px; }
  html.klanz-mobile-web .drafts-actions img { max-width: min(100%, 280px); height: auto; }
  html.klanz-mobile-web .drafts-cost-overrides { margin-left: 0; flex-wrap: wrap; }
  html.klanz-mobile-web :is(.draft-cell-desc, .draft-title, .draft-joined-left) { min-width: 0; white-space: normal; }

  /* Room rosters: all player fields stay visible, with rows that grow vertically. */
  html.klanz-mobile-web .testtest-bg-block { width: 100%; box-sizing: border-box; }
  html.klanz-mobile-web .testtest-bg-top {
    min-height: 260px; padding: 0; background: transparent;
    border: solid transparent; border-width: 52px 25px 93px;
    border-image: url('/interface/backgrounds/spisok_1.jpg') 52 25 93 fill / 52px 25px 93px stretch;
  }
  html.klanz-mobile-web .testtest-bg-top > img { display: none; }
  html.klanz-mobile-web .testtest-heading-strip { position: absolute; top: -37px; left: -25px; right: auto; width: calc(100% + 50px); padding: 0 20px 0 22px; }
  html.klanz-mobile-web ul#warehouse-roster { position: relative; top: auto; left: auto; width: 100%; max-width: 100%; max-height: 60dvh; }
  html.klanz-mobile-web .warehouse-slot-hit {
    display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; width: 100%; height: auto;
    min-height: 44px; padding: 8px; line-height: 1.4; background: transparent url('/interface/backgrounds/lst_sheet.png') left top / 100% 200% no-repeat; border: 0;
  }
  html.klanz-mobile-web .warehouse-slot-hit > :is(span, a) { position: static; height: auto; line-height: 1.4; margin: 0; white-space: normal; }
  html.klanz-mobile-web .warehouse-slot-hit-text { max-width: none; overflow-wrap: anywhere; }
  html.klanz-mobile-web .warehouse-slot-hit-mail { min-height: 30px; display: flex; align-items: center; }
  html.klanz-mobile-web :is(.arena-hud, .arpad-hud) { flex-wrap: wrap; gap: 12px; }
  html.klanz-mobile-web :is(.arena-hud-cell, .arpad-hud-cell) { flex: 1 1 110px; min-width: 0; }
  html.klanz-mobile-web .arpad-ui-page .arpad-cups-row { flex-wrap: nowrap; gap: 4px; }
  html.klanz-mobile-web .arpad-ui-page .arpad-cup { min-width: 0; padding: 6px 2px; }
  html.klanz-mobile-web .arpad-ui-page .arpad-cup > img { max-width: 100%; height: auto; }
  html.klanz-mobile-web .arpad-ui-page .arpad-cup-lab { overflow-wrap: anywhere; }
  html.klanz-mobile-web .warehouse-slot:hover .warehouse-slot-hit { background-position: left bottom; }
  html.klanz-mobile-web .arena-track { overflow-x: auto; overflow-y: hidden; margin: 0; height: 162px; }
  html.klanz-mobile-web .arena-track-inner { width: 610px; right: auto; margin-right: 28px; }
  html.klanz-mobile-web :is(.warehouse-modal, .arena-modal) { max-width: calc(100vw - 32px); box-sizing: border-box; }
  html.klanz-mobile-web .warehouse-modal { width: 288px; }
  html.klanz-mobile-web .warehouse-modal img.bg { width: 100%; height: 240px; }
  html.klanz-mobile-web .warehouse-modal .content { padding: 16px; }
  html.klanz-mobile-web .warehouse-modal .line { margin-top: 14px; flex-wrap: wrap; }
  html.klanz-mobile-web .warehouse-modal .actions { margin-top: 30px; }
  html.klanz-mobile-web .warehouse-modal .cancel { min-height: 32px; bottom: 16px; font-size: 12px; }

  /* Mobile chat uses the original channels and handlers, with a fluid frame. */
  html.klanz-mobile-web #klanz-global-chat .testtest-bg-bottom {
    display: grid; grid-template-columns: minmax(0, 1fr) 38px;
    grid-template-rows: auto minmax(0, 1fr) 40px; gap: 7px;
    width: 100%; height: 310px; min-height: 0; padding: 8px;
    box-sizing: border-box; background: #292c3e; border: 1px solid #656275;
    box-shadow: inset 0 1px #92909d, inset 0 -1px #151521;
  }
  html.klanz-mobile-web #klanz-global-chat .testtest-bg-bottom > img,
  html.klanz-mobile-web #klanz-global-chat .testtest-chat-focus { display: none; }
  html.klanz-mobile-web #klanz-global-chat .testtest-chat-tabs {
    position: static; grid-column: 1 / -1; grid-row: 1; display: flex; flex-wrap: wrap;
    gap: 3px; width: auto; height: auto; min-width: 0;
  }
  html.klanz-mobile-web #klanz-global-chat .testtest-chat-tab-label {
    position: static; flex: 1 1 0; width: auto; height: 32px; min-width: 0;
    padding: 0 3px; box-sizing: border-box; clip-path: none; font-size: 11px;
    background: linear-gradient(#444c67, #2d354d); border: 1px solid #555b72;
    color: #ddd9bd; box-shadow: inset 0 1px #686c80;
  }
  html.klanz-mobile-web #klanz-global-chat .testtest-chat-tab-label span { transform: none; }
  html.klanz-mobile-web #klanz-global-chat .common-active .tab-common,
  html.klanz-mobile-web #klanz-global-chat .private-active .tab-private,
  html.klanz-mobile-web #klanz-global-chat .trade-active .tab-trade,
  html.klanz-mobile-web #klanz-global-chat .guild-active .tab-guild {
    background: linear-gradient(#627294, #354563); border-color: #9298aa; color: #fff3b0;
  }
  html.klanz-mobile-web #klanz-global-chat .testtest-chat-opponent {
    position: static; flex: 1 0 100%; justify-content: flex-end; height: 26px; font-size: 11px;
  }
  html.klanz-mobile-web #klanz-global-chat .testtest-chat-log {
    position: static; grid-column: 1 / -1; grid-row: 2; min-height: 0; max-height: none;
    padding: 7px 8px; font-size: 12px; background: #293653;
    border: 1px solid #171e32; box-shadow: inset 0 1px 3px #1118;
    overscroll-behavior: contain;
  }
  html.klanz-mobile-web #klanz-global-chat .testtest-chat-msg-input {
    position: static; grid-column: 1; grid-row: 3; width: 100%; min-width: 0; height: 40px;
    padding: 7px; margin: 0; box-sizing: border-box; font-size: 16px; font-weight: normal;
    line-height: 24px; background: #1d263c; border: 1px solid #75778b; color: #fff;
  }
  html.klanz-mobile-web #klanz-global-chat .testtest-chat-ban {
    grid-column: 1 / -1; white-space: normal !important; font-size: 11px; line-height: 14px;
  }
  html.klanz-mobile-web #klanz-global-chat .testtest-send-btn {
    position: static; grid-column: 2; grid-row: 3; display: flex; align-items: center;
    justify-content: center; width: 38px; height: 40px; min-height: 0; box-sizing: border-box;
    background: #343746; border: 1px solid #a18a58; box-shadow: inset 0 0 0 1px #19181e;
  }
  html.klanz-mobile-web #klanz-global-chat .testtest-send-btn img { width: 34px; height: auto; max-height: 34px; object-fit: contain; }

  /* Market, trades and recipes. */
  html.klanz-mobile-web .mkt-strip { flex-wrap: wrap; display: flex; gap: 10px; }
  html.klanz-mobile-web .mkt-name-search { width: 100%; max-width: 100%; min-width: 0; grid-template-columns: minmax(0, 1fr); }
  html.klanz-mobile-web .mkt-name-search-ruler { overflow: hidden; }
  html.klanz-mobile-web .mkt-name { overflow-wrap: anywhere; }
  html.klanz-mobile-web .mkt-meta { flex: 1 1 115px; }
  html.klanz-mobile-web .mkt-lots { width: 100%; flex-basis: 100%; }
  html.klanz-mobile-web .market-page .mkt-strip { display: grid; grid-template-columns: minmax(0, 275px) minmax(190px, 1fr); gap: 10px; }
  html.klanz-mobile-web .market-page .mkt-left { flex-wrap: nowrap; gap: 8px; }
  html.klanz-mobile-web .market-page .mkt-meta { flex: 1 1 0; min-width: 0; }
  html.klanz-mobile-web .market-page .mkt-lot-row { padding-left: 5px; padding-right: 5px; font-size: 11px; }
  html.klanz-mobile-web .mkt-lots-body { max-height: 230px; }
  html.klanz-mobile-web .mkt-lot-row { min-height: 44px; font-size: 13px; }
  html.klanz-mobile-web :is(.give-grid, .want-grid, .event-grid) { grid-template-columns: repeat(auto-fit, minmax(80px, 1fr)); }
  html.klanz-mobile-web .ex-r .ex-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  html.klanz-mobile-web :is(.ex-r, .ex-one) .rcp-strip { height: auto; min-height: 128px; }
  html.klanz-mobile-web :is(.ex-r, .ex-one) .rcp-info { min-width: 0; height: auto; min-height: 128px; }
  html.klanz-mobile-web .ex-r .rcp-btn { max-width: 100%; background-size: 100% 27px; }
  html.klanz-mobile-web .ex-r .rcp-row { padding-left: 6px; padding-right: 6px; }
  html.klanz-mobile-web :is(.ex-n, .ex-one) .text-input { min-width: 0; max-width: 100%; }
  html.klanz-mobile-web :is(.tray, .reward-strip, .quota-list) { flex-wrap: wrap; }
  html.klanz-mobile-web :is(.shop-title-nav, .ex-title-nav) { display: flex; flex-wrap: wrap; gap: 6px; }
  html.klanz-mobile-web .booster-packs { grid-template-columns: repeat(auto-fit, 193px); gap: 20px 10px; }
  html.klanz-mobile-web .booster-pack[data-slug="zeal"] { grid-column: auto; }
  html.klanz-mobile-web .shop-donate-packs { grid-template-columns: repeat(auto-fit, 257px); }
  html.klanz-mobile-web .starter-pack-art { max-width: 100%; height: auto; }
  html.klanz-mobile-web .mobile-booster-wrap { display: block; position: relative; padding-bottom: 26px; }
  html.klanz-mobile-web .mobile-booster-info { display: block; min-height: 34px; padding: 0 10px; margin: 0 auto; background: none; border: 0; color: #ffca00; text-decoration: underline; }
  html.klanz-mobile-web .booster-pool-tip { position: fixed; left: 50% !important; right: auto !important; top: 50%; transform: translate(-50%, -50%); width: 260px !important; max-width: calc(100vw - 48px); max-height: 65dvh; overflow-y: auto; box-sizing: border-box; }
  html.klanz-mobile-web .mobile-pool-close { display: block; color: #ffca00; text-align: right; padding: 8px 0; }
  html.klanz-mobile-web .gifts-page .gift-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; padding: 16px 10px; }

  /* Forum keeps alternating table rows and every metadata column. */
  html.klanz-mobile-web table.forum { width: 100%; table-layout: auto; }
  html.klanz-mobile-web table.forum :is(td, th) { width: auto; overflow-wrap: anywhere; }
  html.klanz-mobile-web table.forum .th_1 { width: 62%; }
  html.klanz-mobile-web table.forum .th_3 { width: 40%; }
  html.klanz-mobile-web table.forum .th_4 { width: 15%; }
  html.klanz-mobile-web table.forum :is(.td_1, .td_2, .td_3) { padding: 8px 4px; }
  html.klanz-mobile-web table.forum .td_1 img { width: 65px; height: auto; margin: 0 8px 4px 0; }
  html.klanz-mobile-web table.forum .td_1 h3 { font-size: 14px; }
  html.klanz-mobile-web table.forum .td_l { width: auto; padding: 10px 12px; }
  html.klanz-mobile-web table.forum .td_r { width: 132px; min-width: 120px; padding: 10px 12px; }
  html.klanz-mobile-web table.forum .td_r .ava { width: 100px; height: 100px; margin: 5px 0; }
  html.klanz-mobile-web table.forum .td_r .ava img { width: 100px; height: 100px; object-fit: cover; }
  html.klanz-mobile-web :is(.reply-grid, .reply-grid tbody, .reply-grid tr, .reply-grid td) { display: block; width: 100%; box-sizing: border-box; }
  html.klanz-mobile-web .reply-grid tr { display: grid; grid-template-columns: minmax(0, 1fr) 170px; }
  html.klanz-mobile-web .reply-grid .reply-left { padding: 12px; min-width: 0; }
  html.klanz-mobile-web .reply-grid .reply-right { padding: 12px 8px 12px 4px; min-width: 0; }
  html.klanz-mobile-web .reply-grid .md-title { font-size: 12px; margin-bottom: 6px; }
  html.klanz-mobile-web .reply-grid .md-help { overflow-wrap: anywhere; }
  html.klanz-mobile-web :is(.reply-form, .c_topic, .new-topic-form) { width: auto; max-width: 100%; margin-left: 0; margin-right: 0; }
  html.klanz-mobile-web :is(.reply-form, .message-edit-form) textarea { width: 100%; }
  html.klanz-mobile-web .message-content img { max-width: 100%; height: auto; }
  html.klanz-mobile-web .message-content pre { white-space: pre-wrap; }
  html.klanz-mobile-web .mobile-table-scroll { max-width: 100%; overflow-x: auto; overscroll-behavior-x: contain; }
  html.klanz-mobile-web #klanz-card-hover-preview.mobile-preview-open { position: fixed; left: 50% !important; top: 50% !important; transform: translate(-50%, -50%); pointer-events: auto; padding: 0; background: none; border: 0; outline: none; }

  /* The standalone character profile does not inherit base.html. */
  html.klanz-mobile-web .profile-head { flex-wrap: wrap; padding: 8px; gap: 8px; }
  html.klanz-mobile-web .profile-head h1 { margin: 0; }
  html.klanz-mobile-web .profile-search-input { max-width: 100%; min-height: 42px; }
  html.klanz-mobile-web .profile-layout, html.klanz-mobile-web .profile-layout > tbody { display: block; width: 100%; }
  html.klanz-mobile-web .profile-layout > tbody > tr { display: flex; gap: 16px; align-items: flex-start; }
  html.klanz-mobile-web .profile-layout > tbody > tr > td { display: block; box-sizing: border-box; min-width: 0; }
  html.klanz-mobile-web .profile-layout > tbody > tr > td:first-child { flex: 0 0 168px; width: 168px; }
  html.klanz-mobile-web .profile-layout > tbody > tr > td:nth-child(2) { display: none; }
  html.klanz-mobile-web .profile-layout > tbody > tr > td:last-child { flex: 1; width: auto; }
  /* Header sprite is 35px; keep .u_m_hd inside it (border-box). Desktop pair is
     u_m 529 / u_t 520 + margin-left 4 — mirror that so the orange table edge
     meets the gold corner, not sitting wide/detached under a content-box blowout. */
  html.klanz-mobile-web .profile-layout .u_m {
    width: 100%; box-sizing: border-box; margin-left: 0;
    height: 35px; overflow: hidden; background-size: 100% 35px;
  }
  html.klanz-mobile-web .profile-layout .u_m_hd {
    box-sizing: border-box; width: 100%; max-width: 100%; height: 35px;
    margin: 0; padding: 0 10px 0 12px;
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    line-height: 1.15; overflow: hidden;
  }
  /* Desktop headers use float left/right for «ред.» / ban actions; flex ignores float. */
  html.klanz-mobile-web .profile-layout .u_m_hd > div {
    float: none;
  }
  html.klanz-mobile-web .profile-layout .u_m_hd > div:last-child:not(:only-child) {
    flex: 0 0 auto; margin-left: auto; padding-right: 4px;
  }
  html.klanz-mobile-web .profile-layout .u_t {
    box-sizing: border-box; width: calc(100% - 9px);
    margin: 0 5px 20px 4px; table-layout: fixed; overflow-wrap: anywhere;
  }
  html.klanz-mobile-web body:not(.page-cbp-battle) .res_l:has(.profile-layout) { max-width: 792px; margin-left: auto; margin-right: auto; }
  html.klanz-mobile-web .profile-layout .u_t td { width: auto; padding: 8px 4px; }
  html.klanz-mobile-web .profile-layout .u_t img { max-width: 100%; }

  /* Other player pages keep their original frames and forms. */
  html.klanz-mobile-web body.pink-bg.bs-stats-wide.bs-stats-standalone ul#menu { display: var(--mobile-menu-layout, flex) !important; }
  html.klanz-mobile-web body.pink-bg.bs-stats-wide.bs-stats-standalone #page { display: flex; width: 100%; padding: 0 3px 24px; }
  html.klanz-mobile-web body.pink-bg.bs-stats-wide.bs-stats-standalone #right_col { width: 100%; max-width: 792px; }
  html.klanz-mobile-web .bs-section { min-width: 0; }
  html.klanz-mobile-web .bs-clan-rooms-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
  html.klanz-mobile-web .bs-clan-room-block { min-width: 0; width: auto; }
  html.klanz-mobile-web .bs-matrix-wrap { max-width: 100%; overflow-x: auto; overscroll-behavior-x: contain; }
  html.klanz-mobile-web .bs-matrix { width: max-content; min-width: 100%; }
  html.klanz-mobile-web #left_col .l_lr { height: 175px; }
  html.klanz-mobile-web #left_col #login,
  html.klanz-mobile-web #left_col #password { font-size: 13px; font-weight: normal; height: 28px; min-height: 28px; line-height: 16px; padding: 3px 6px; }
  html.klanz-mobile-web #splash_block { width: 100%; height: auto; aspect-ratio: 750 / 393; }
  html.klanz-mobile-web body:not(.page-cbp-battle) #content_m_bl { padding-left: 21px; padding-right: 21px; }
  html.klanz-mobile-web :is(#ind2, #ind3) { box-sizing: border-box; width: 50%; padding: 0 16px; left: 0; }
  html.klanz-mobile-web #ind3 { background: none; }
  html.klanz-mobile-web #cards_image { max-width: 100%; height: auto; }
  html.klanz-mobile-web #register { width: 100%; height: auto; min-height: 0; padding: 0 0 20px; background-position: center; background-size: cover; }
  html.klanz-mobile-web #register h1 { padding: 18px 8px 14px; font-size: 22px; }
  html.klanz-mobile-web #registration_form {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px;
    width: calc(100% - 32px); max-width: 540px; left: 0; padding: 18px 20px;
    box-sizing: border-box; background: #27262d; border: 1px solid #8a7750;
    box-shadow: inset 0 0 0 1px #17161b;
  }
  html.klanz-mobile-web #register .txt { display: grid; grid-template-columns: minmax(0, 1fr); width: 100%; min-width: 0; margin: 0; gap: 4px; align-content: start; }
  html.klanz-mobile-web #register .txt label { grid-column: 1; grid-row: 1; width: auto; min-height: 16px; line-height: 16px; color: #e6e1d7; font-size: 12px; font-weight: normal; }
  html.klanz-mobile-web #register .txt input { grid-column: 1; grid-row: 2; width: 100%; height: 34px; padding: 6px 30px 6px 8px; font-size: 13px; }
  html.klanz-mobile-web #register .txt.optional { grid-column: 1 / -1; grid-template-columns: minmax(0, 1fr); }
  html.klanz-mobile-web #register .txt::after { position: absolute; right: 6px; top: 27px; width: 20px; height: 20px; background-size: contain; pointer-events: none; }
  html.klanz-mobile-web #register .txt:not(.is-mobile-field-edited)::after { visibility: hidden; }
  html.klanz-mobile-web #register .txt .field-help { position: static; grid-column: 1; grid-row: 3; width: auto; margin: 2px 0 0; padding: 7px; line-height: 1.4; background: #201f25; color: #d8d2c5; border-color: #5c5660; }
  html.klanz-mobile-web #register .txt.login-taken .field-help,
  html.klanz-mobile-web #register .txt.email-taken .field-help { color: #ffb29e; }
  html.klanz-mobile-web #register_butt { grid-column: 1 / -1; display: block; position: static; transform: none; width: 139px; height: 37px; max-width: 100%; margin: 8px auto 0; background-size: auto; }
  html.klanz-mobile-web #register .reg-consent { grid-column: 1 / -1; position: static; margin: 0; max-width: none; color: #ddd; }
  html.klanz-mobile-web #register .reg-consent-label,
  html.klanz-mobile-web #register .reg-consent-label a { color: #ddd; }
  html.klanz-mobile-web #register .reg-consent .field-help { position: static; width: auto; margin-top: 8px; }
  html.klanz-mobile-web .market-page .mkt-name-search input::placeholder { font-size: 14px; }
  html.klanz-mobile-web .main2-home-row { display: grid; grid-template-columns: minmax(0, 441fr) minmax(0, 328fr); gap: 10px; }
  html.klanz-mobile-web .main2-home-row > * { min-width: 0; }
  html.klanz-mobile-web :is(.main2-square, .main2-square-top, .main2-square-bottom, .main2-square-middle, .main2-next-top, .main2-news-middle, .main2-forums-middle, .main2-news-bottom, .main2-clan-winrates-wrap, .main2-clan-cap-top, .main2-clan-cap-bottom, .main2-clan-mid, .main2-clan-inner) { width: 100%; margin-left: 0; }
  html.klanz-mobile-web :is(.main2-square-top, .main2-square-bottom, .main2-next-top, .main2-news-bottom, .main2-clan-cap-top, .main2-clan-cap-bottom) { background-size: 100% 100%; }
  html.klanz-mobile-web .main2-square-middle { height: auto; }
  html.klanz-mobile-web .main2-square-image { width: 100%; height: auto; }
  html.klanz-mobile-web :is(.main2-news-inner, .main2-forums-inner) { width: calc(100% - 40px); }
  html.klanz-mobile-web .main2-forum-table { width: 100%; }
  html.klanz-mobile-web .clans2-index-row { grid-template-columns: repeat(3, minmax(0, 1fr)); column-gap: 12px; }
  html.klanz-mobile-web .clans2-index-item { min-width: 0; }
  html.klanz-mobile-web .clans2-index-item img { max-width: 100%; }
  html.klanz-mobile-web .avatars-container { grid-template-columns: repeat(auto-fit, 102px); justify-content: center; }
  html.klanz-mobile-web :is(.guilds-table, .mail-table) { width: 100%; table-layout: fixed; }
  html.klanz-mobile-web :is(.guilds-table, .mail-table) :is(th, td) { width: auto; overflow-wrap: anywhere; }
  html.klanz-mobile-web .guilds-name-link { white-space: normal; }
  html.klanz-mobile-web .guild-layout { display: grid; grid-template-columns: minmax(0, 396fr) minmax(0, 305fr); }
  html.klanz-mobile-web :is(.guild-main, .guild-side, .gr-head, .gl-head) { width: 100%; min-width: 0; }
  html.klanz-mobile-web :is(.gr-head, .gl-head) { background-size: 100% 34px; }
  html.klanz-mobile-web :is(.guild-table, .guild-table-side) { width: calc(100% - 6px) !important; max-width: none; }
  html.klanz-mobile-web .guild-hero-name { white-space: normal; overflow-wrap: anywhere; }
  html.klanz-mobile-web .guild-controls { width: auto; }
  html.klanz-mobile-web .guild-controls .control-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0 4px; white-space: normal; }
  html.klanz-mobile-web .guild-controls .control-link { min-height: 36px; }
  html.klanz-mobile-web .help-thread-table { width: 100%; table-layout: fixed; }
  html.klanz-mobile-web .mail-table .col-actions { width: 70px; }

  /* FAQ: keep content inside side frames; scale demo cards (172px) to fit */
  html.klanz-mobile-web body:not(.page-cbp-battle) .faq-page > .r_r {
    padding-left: 21px !important;
    padding-right: 21px !important;
  }
  html.klanz-mobile-web .faq-page .faq-wrap {
    padding-left: 8px;
    padding-right: 8px;
    max-width: 100%;
    box-sizing: border-box;
  }
  html.klanz-mobile-web .faq-page :is(.faq-example, .faq-demo, .faq-ui, .faq-prose, .faq-kw-block) {
    max-width: 100%;
    box-sizing: border-box;
    margin-left: 0 !important;
    margin-right: 0 !important;
  }
  html.klanz-mobile-web .faq-page .faq-kw-block {
    flex-wrap: wrap;
    gap: 12px;
  }
  html.klanz-mobile-web .faq-page .faq-kw-card-wrap {
    flex: 0 0 auto;
    zoom: var(--mobile-faq-card-scale, 0.85);
  }
  html.klanz-mobile-web .faq-page :is(.faq-card-row, .faq-boost-result, .faq-dp-cards, .faq-cascade-offer, .faq-shop-row) {
    display: grid !important;
    grid-template-columns: repeat(var(--mobile-faq-card-columns, 2), minmax(0, 1fr));
    gap: 8px 6px;
    width: 100% !important;
    max-width: 100%;
    box-sizing: border-box;
    justify-items: center;
    overflow: visible;
  }
  html.klanz-mobile-web .faq-page :is(.faq-card-row, .faq-boost-result, .faq-dp-cards, .faq-cascade-offer)
    > :is(.faq-case-side, .drafts-pick-card) {
    flex: 0 0 auto !important;
    width: 172px !important;
    max-width: none;
    zoom: var(--mobile-faq-card-scale, 0.85);
    justify-self: center;
  }
  html.klanz-mobile-web .faq-page .faq-shop-row > .faq-shop-slot {
    flex: 0 0 auto !important;
    width: 172px !important;
    max-width: none;
    zoom: var(--mobile-faq-card-scale, 0.85);
    justify-self: center;
  }
  /* boost-result children are bare card links */
  html.klanz-mobile-web .faq-page .faq-boost-result > :is(.faq-kw-card-link, a, .card) {
    zoom: var(--mobile-faq-card-scale, 0.85);
    justify-self: center;
  }
  html.klanz-mobile-web .faq-page .faq-pair {
    flex-direction: column;
  }
  /* FAQ rating matrices (draft/sealed/cascade): scroll, don't clip into frames */
  html.klanz-mobile-web .faq-page .faq-dp-rating-table {
    display: block;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    box-sizing: border-box;
    font-size: 10px;
  }
  html.klanz-mobile-web .faq-page .faq-dp-rating-table :is(thead, tbody, tr) {
    width: max-content;
    min-width: 100%;
  }
  html.klanz-mobile-web .faq-page .faq-dp-rating-table :is(th, td) {
    white-space: nowrap;
    padding: 4px 6px;
    font-size: 10px;
  }
  /* /draft_rating — never keep desktop 750px on mobile */
  html.klanz-mobile-web body:not(.page-cbp-battle) .drafts-page:has(.draft-rating-table) > .r_l > .r_r {
    padding-left: 21px !important;
    padding-right: 21px !important;
  }
  html.klanz-mobile-web table.forum.draft-rating-table {
    width: 100% !important;
    max-width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    table-layout: fixed;
  }
  html.klanz-mobile-web .draft-rating-table :is(.th_guild, .td_guild) {
    width: auto;
    white-space: normal;
  }
  html.klanz-mobile-web .draft-rating-table :is(.th_name, .td_name) {
    width: 22%;
    overflow-wrap: anywhere;
  }
  html.klanz-mobile-web .draft-rating-table :is(.th_rank, .td_rank) { width: 28px; }
  html.klanz-mobile-web .draft-rating-table :is(.th_rating, .td_rating, .th_part, .td_part) {
    width: 56px;
  }
  html.klanz-mobile-web .draft-rating-table :is(.th_chatls, .td_chatls) { width: 64px; }
  /* Background bands meet the frame; their contents retain their padding. */
  html.klanz-mobile-web :is(.r_r > .mail-table, .r_r > table.forum, .r_r > .guilds-table, .r_r > .clan, .deck > .clan, .notif-feed, .r_r > .gift-filters, .market-page .mkt-clan-bar, .shop-clan-bar) {
    width: calc(100% + 16px); max-width: none; margin-left: -8px; margin-right: -8px;
    box-sizing: border-box;
  }
  html.klanz-mobile-web :is(.mail-table, table.forum) tr > :first-child:not(.line-cell) { padding-left: 12px; }
  html.klanz-mobile-web :is(.mail-table, table.forum) tr > :last-child:not(.line-cell) { padding-right: 12px; }
  html.klanz-mobile-web .post-actions { flex-wrap: wrap; }
  /* Battles table: time 92 / out 78 / score 48 / arpad 36 — rest to nick; no cell overflow */
  html.klanz-mobile-web .user-battles-table {
    width: 100% !important; max-width: 100% !important; table-layout: fixed !important;
  }
  html.klanz-mobile-web .user-battles-table .col-opp-shift { transform: none !important; }
  html.klanz-mobile-web .user-battles-table :is(.th-out, td.col-out) { margin-left: 0 !important; }
  html.klanz-mobile-web .user-battles-table th {
    height: auto; min-height: 28px; padding-top: 6px; padding-bottom: 6px;
    line-height: 1.2; vertical-align: middle; box-sizing: border-box !important;
  }
  html.klanz-mobile-web .user-battles-table td { box-sizing: border-box !important; }
  html.klanz-mobile-web body:not(.page-cbp-battle) .user-battles-page .r_r {
    padding-left: 21px !important; padding-right: 21px !important;
  }
  html.klanz-mobile-web .user-battles-table .battle-time-desk { display: none !important; }
  html.klanz-mobile-web .user-battles-table .battle-time-mob {
    display: inline !important;
    color: #fff !important;
    font-weight: bold;
    white-space: nowrap;
  }
  html.klanz-mobile-web .user-battles-table col.col-time { width: 92px !important; }
  html.klanz-mobile-web .user-battles-table col.col-opp { width: auto !important; }
  html.klanz-mobile-web .user-battles-table col.col-out { width: 78px !important; }
  html.klanz-mobile-web .user-battles-table col.col-score { width: 48px !important; }
  html.klanz-mobile-web .user-battles-table col.col-arpad { width: 36px !important; }
  html.klanz-mobile-web .user-battles-table .th-time,
  html.klanz-mobile-web .user-battles-table .col-time,
  html.klanz-mobile-web .user-battles-table tr.battle-data-row td.col-time {
    width: 92px !important;
    color: #fff !important;
    font-weight: bold;
    white-space: nowrap !important;
    overflow: hidden !important;
    padding-left: 4px !important;
    padding-right: 8px !important;
  }
  html.klanz-mobile-web .user-battles-table .th-opp,
  html.klanz-mobile-web .user-battles-table .col-opp,
  html.klanz-mobile-web .user-battles-table tr.battle-data-row td.col-opp {
    width: auto !important; min-width: 0 !important;
    padding-left: 2px !important; padding-right: 6px !important;
    white-space: nowrap !important; overflow: hidden !important;
  }
  html.klanz-mobile-web .user-battles-table .col-opp .col-opp-shift,
  html.klanz-mobile-web .user-battles-table .col-opp .opp-link {
    display: inline; white-space: nowrap !important;
  }
  html.klanz-mobile-web .user-battles-table .th-out,
  html.klanz-mobile-web .user-battles-table .col-out,
  html.klanz-mobile-web .user-battles-table tr.battle-data-row td.col-out {
    width: 78px !important; white-space: nowrap !important;
    padding-left: 4px !important; padding-right: 4px !important;
  }
  html.klanz-mobile-web .user-battles-table .th-score,
  html.klanz-mobile-web .user-battles-table .col-score,
  html.klanz-mobile-web .user-battles-table tr.battle-data-row td.col-score {
    width: 48px !important; white-space: nowrap !important;
    padding-left: 2px !important; padding-right: 2px !important;
  }
  html.klanz-mobile-web .user-battles-table .th-arpad,
  html.klanz-mobile-web .user-battles-table .col-arpad,
  html.klanz-mobile-web .user-battles-table tr.battle-data-row td.col-arpad {
    width: 36px !important; white-space: nowrap !important;
    text-align: right !important; overflow: hidden !important;
    padding-left: 2px !important; padding-right: 4px !important;
  }
  html.klanz-mobile-web .user-battles-table .th-arpad img { max-width: 12px; height: auto; }
  html.klanz-mobile-web .user-battles-table .th-label-full { display: none !important; }
  html.klanz-mobile-web .user-battles-table .th-label-short { display: inline !important; }
  html.klanz-mobile-web .mobile-chart-frame { width: 100%; overflow: hidden; }
  html.klanz-mobile-web .drafts-bracket-header { height: auto; min-height: 32px; flex-wrap: wrap; gap: 8px 16px; }
  html.klanz-mobile-web .drafts-bracket-title { flex: 1 1 auto; }
  html.klanz-mobile-web .drafts-bracket-time { position: relative; left: auto; top: auto; transform: none; }
  html.klanz-mobile-web .drafts-bracket-time:has([style*="display:none"], [style*="display: none"]) { display: none; }
  html.klanz-mobile-web .missions-layout { grid-template-columns: 168px minmax(0, 1fr); }
  html.klanz-mobile-web :is(.missions-main, .missions-panel),
  html.klanz-mobile-web .missions-panel:before,
  html.klanz-mobile-web .missions-panel:after,
  html.klanz-mobile-web .mission-row:after { width: 100%; background-size: 100% auto; }
  html.klanz-mobile-web .missions-panel > :is(h1, h2) { height: auto; background-size: 100% auto; }
  html.klanz-mobile-web .mission-row { grid-template-columns: 72px minmax(0, 1fr) 65px 103px; gap: 8px; padding: 12px; }
  html.klanz-mobile-web .missions-category-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; padding: 16px; }
  html.klanz-mobile-web .missions-layout-hall { grid-template-columns: minmax(0, 1fr); }

}

/*
 * Battle chat lives outside the scaled table. Keep visible on tablet landscape
 * too — iPad CSS width is often >1024, so the phone MQ above never matched and
 * the rail toggle stayed display:none / never injected.
 */
html.klanz-mobile-web .page-cbp-battle-mobile #cbp-chat-toggle { display: flex; }
html.klanz-mobile-web .page-cbp-battle-mobile .mobile-battle-alerts {
  position: static; display: flex; flex-direction: column; align-items: center; gap: 3px;
}
html.klanz-mobile-web .page-cbp-battle-mobile .mobile-battle-alerts a {
  width: 30px; height: 28px; margin: 0; background-size: 30px 25px;
}
html.klanz-mobile-web .page-cbp-battle-mobile #cbp-mobile-chat:not([hidden]) {
  display: flex; flex-direction: column;
}
html.klanz-mobile-web .page-cbp-battle-mobile.is-mobile-chat-open #right_col { align-items: flex-start; }
html.klanz-mobile-web .page-cbp-battle-mobile.is-mobile-chat-open .cbp-mobile-scale-host {
  margin-left: max(2px, env(safe-area-inset-left));
}
html.klanz-mobile-web .page-cbp-battle-mobile #cbp-mobile-chat {
  position: fixed; right: max(2px, env(safe-area-inset-right)); top: var(--mobile-chat-top, 2px);
  width: var(--mobile-chat-width, 280px);
  height: var(--mobile-chat-height, calc(100dvh - 4px));
  max-height: calc(100dvh - 4px);
  box-sizing: border-box; z-index: 10000; background: #27262d; border: 1px solid #8a7750;
  pointer-events: auto; overflow: hidden;
}
html.klanz-mobile-web .page-cbp-battle-mobile .mobile-chat-heading {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 8px; color: #dfc994; min-height: 28px; font: 12px Tahoma, sans-serif;
}
html.klanz-mobile-web .page-cbp-battle-mobile #cbp-chat-close {
  min-width: 32px; min-height: 28px; border: 0; background: transparent; color: #dfc994; font-size: 22px;
}
html.klanz-mobile-web .page-cbp-battle-mobile #cbp-mobile-chat > .r_s,
html.klanz-mobile-web .page-cbp-battle-mobile #cbp-mobile-chat :is(.r_h, .r_f) { display: none; }
html.klanz-mobile-web .page-cbp-battle-mobile #cbp-mobile-chat #klanz-global-chat {
  flex: 1; width: 100%; min-height: 0; margin: 0; background: none;
}
html.klanz-mobile-web .page-cbp-battle-mobile #cbp-mobile-chat #klanz-global-chat .r_r {
  width: 100%; height: 100%; padding: 0; background: none;
}
html.klanz-mobile-web .page-cbp-battle-mobile #cbp-mobile-chat #klanz-global-chat .testtest-bg-bottom {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 38px;
  grid-template-rows: auto minmax(0, 1fr) 40px;
  gap: 7px; width: 100%; height: 100%; min-height: 0; padding: 8px;
  box-sizing: border-box; border: 0; background: #292c3e;
}
html.klanz-mobile-web .page-cbp-battle-mobile #cbp-mobile-chat #klanz-global-chat .testtest-bg-bottom > img,
html.klanz-mobile-web .page-cbp-battle-mobile #cbp-mobile-chat #klanz-global-chat .testtest-chat-focus {
  display: none;
}
html.klanz-mobile-web .page-cbp-battle-mobile #cbp-mobile-chat #klanz-global-chat .testtest-chat-tabs {
  position: static; grid-column: 1 / -1; grid-row: 1;
  display: flex; flex-wrap: wrap; gap: 3px; width: auto; height: auto; min-width: 0;
}
html.klanz-mobile-web .page-cbp-battle-mobile #cbp-mobile-chat #klanz-global-chat .testtest-chat-tab-label {
  position: static; flex: 1 1 0; width: auto; min-width: 0; height: 32px;
  padding: 0 3px; box-sizing: border-box; clip-path: none; font-size: 11px;
  background: linear-gradient(#444c67, #2d354d); border: 1px solid #555b72;
  color: #ddd9bd; box-shadow: inset 0 1px #686c80;
}
html.klanz-mobile-web .page-cbp-battle-mobile #cbp-mobile-chat #klanz-global-chat .testtest-chat-tab-label span {
  transform: none;
}
html.klanz-mobile-web .page-cbp-battle-mobile #cbp-mobile-chat #klanz-global-chat .testtest-chat-opponent {
  position: static; flex: 1 0 100%; justify-content: flex-end; height: 26px; font-size: 11px;
}
html.klanz-mobile-web .page-cbp-battle-mobile #cbp-mobile-chat #klanz-global-chat .testtest-chat-log {
  position: static; grid-column: 1 / -1; grid-row: 2;
  min-height: 0; max-height: none; padding: 7px 8px; font-size: 12px;
  background: #293653; border: 1px solid #171e32; pointer-events: auto;
}
html.klanz-mobile-web .page-cbp-battle-mobile #cbp-mobile-chat #klanz-global-chat .testtest-chat-msg-input {
  position: static; grid-column: 1; grid-row: 3;
  width: 100%; min-width: 0; height: 40px; padding: 7px; margin: 0;
  box-sizing: border-box; font-size: 16px; font-weight: normal; line-height: 24px;
  background: #1d263c; border: 1px solid #75778b; color: #fff; pointer-events: auto;
}
html.klanz-mobile-web .page-cbp-battle-mobile #cbp-mobile-chat #klanz-global-chat .testtest-send-btn {
  position: static; grid-column: 2; grid-row: 3;
  display: flex; align-items: center; justify-content: center;
  width: 38px; height: 40px; box-sizing: border-box;
}
/* iPad landscape is wider than the phone MQ. Keep the drawer inside the
   keyboard's visible viewport without moving or restyling the battle itself. */
/* Only shrink height — keep top and composer row order. Reordering the input
   on focus made mobile browsers drop focus and close the keyboard. */
html.klanz-mobile-web body.page-cbp-battle-mobile.mobile-chat-keyboard-open #cbp-mobile-chat {
  top: var(--mobile-chat-top, 2px);
  height: var(--mobile-chat-editor-height, var(--mobile-chat-height));
  max-height: var(--mobile-chat-editor-height, var(--mobile-chat-height));
}
/* While the battle composer is focused: drop chrome so log + input stay visible
   above the landscape keyboard. Do not reorder the input row. */
html.klanz-mobile-web body.page-cbp-battle-mobile.mobile-battle-chat-writing
  #cbp-mobile-chat > .mobile-chat-heading {
  display: none;
}
html.klanz-mobile-web body.page-cbp-battle-mobile.mobile-battle-chat-writing
  #cbp-mobile-chat #klanz-global-chat .testtest-bg-bottom {
  gap: 4px; padding: 4px;
  grid-template-rows: auto minmax(0, 1fr) 36px;
}
html.klanz-mobile-web body.page-cbp-battle-mobile.mobile-battle-chat-writing
  #cbp-mobile-chat #klanz-global-chat .testtest-chat-tabs {
  gap: 2px;
}
html.klanz-mobile-web body.page-cbp-battle-mobile.mobile-battle-chat-writing
  #cbp-mobile-chat #klanz-global-chat .testtest-chat-tab-label {
  height: 22px; font-size: 10px; padding: 0 2px;
}
html.klanz-mobile-web body.page-cbp-battle-mobile.mobile-battle-chat-writing
  #cbp-mobile-chat #klanz-global-chat .testtest-chat-opponent {
  display: none;
}
html.klanz-mobile-web body.page-cbp-battle-mobile.mobile-battle-chat-writing
  #cbp-mobile-chat #klanz-global-chat .testtest-chat-log {
  padding: 4px 6px; font-size: 11px;
}
html.klanz-mobile-web body.page-cbp-battle-mobile.mobile-battle-chat-writing
  #cbp-mobile-chat #klanz-global-chat .testtest-chat-msg-input,
html.klanz-mobile-web body.page-cbp-battle-mobile.mobile-battle-chat-writing
  #cbp-mobile-chat #klanz-global-chat .testtest-send-btn {
  height: 36px;
}
html.klanz-mobile-web.is-cbp-mobile-portrait #cbp-mobile-chat { visibility: hidden; }

@media (max-width: 740px) and (pointer: coarse) {
  html.klanz-mobile-web .guild-layout { grid-template-columns: minmax(0, 1fr); }
  html.klanz-mobile-web .ex-r .rcp-strip .mkt-frame { zoom: .75; }
  html.klanz-mobile-web .missions-layout { grid-template-columns: minmax(0, 1fr); }
  html.klanz-mobile-web .missions-sidebar { width: 100%; }
  html.klanz-mobile-web .missions-rating { padding: 12px 0; }
  html.klanz-mobile-web #missions-nav { display: flex; flex-wrap: wrap; width: 100%; box-sizing: border-box; gap: 4px 12px; padding: 8px; margin-bottom: 16px; }
  html.klanz-mobile-web #missions-nav a { flex: 1 1 auto; }
}
@media (max-width: 390px) and (pointer: coarse) {
  html.klanz-mobile-web :is(div.cards:not(.clans2-index-mode), .drafts-pick-cards:not(.cascade-offer-cards), .shop-cards-grid, .card-thumbs, .open-cards, .reveal-grid, .reveal-grid.is-count-3, .reveal-grid.is-count-4) { grid-template-columns: repeat(auto-fit, 155px); }
  /* Draft pick cards use transform:scale (not zoom) — exclude them here. */
  html.klanz-mobile-web :is(.cards > .card-block, .shop-card-slot, .card-thumbs > .card-wrap, .reveal-slot, .open-cards > .card, .news-release-cards > .news-release-card-link) { zoom: .9; }
  html.klanz-mobile-web .drafts-pick-cards.cascade-offer-cards > .drafts-pick-card {
    zoom: var(--mobile-cascade-offer-scale, 0.48);
  }
}
@media (prefers-reduced-motion: reduce) {
  html.klanz-mobile-web .mobile-map-canvas { scroll-behavior: auto; }
}

/* Portrait and browser-chrome-safe layout for the enabled mobile release. */
@media (max-width: 1024px) and (pointer: coarse) {
  html.klanz-mobile-web { min-height: 100%; background-color: #32222f; }
  html.klanz-mobile-web body { margin: 0; min-height: 100dvh; background-color: #32222f; background-size: cover; }
  html.klanz-mobile-web ul#menu #menu_item_auth_task > div.menu { max-width: calc(100vw - 12px); }
  html.klanz-mobile-web :is(div.cards:not(.clans2-index-mode), .drafts-pick-cards:not(.cascade-offer-cards), .open-cards, .reveal-grid, .reveal-grid.is-count-3, .reveal-grid.is-count-4) { grid-template-columns: repeat(var(--mobile-card-columns, 2), minmax(0, 1fr)); gap: 12px 4px; }
  html.klanz-mobile-web :is(.cards > .card-block, .open-cards > .card, .reveal-slot, .news-release-cards > .news-release-card-link) { zoom: var(--mobile-card-scale, 1); justify-self: center; }
  html.klanz-mobile-web .news-release-cards.cards {
    grid-template-columns: repeat(var(--mobile-card-columns, 2), minmax(0, 1fr));
    gap: 12px 8px;
    justify-content: center;
  }
  /*
   * Draft/sealed pick cards: CSS zoom on iOS Safari can leave font-size unscaled
   * while chrome shrinks (ability text overflows). transform:scale scales paint
   * including text; negative margins collapse the leftover layout box (zoom used to).
   * Card chrome height: header 42 + avatar 120 + footer 83 − header overlap 2 = 243.
   */
  html.klanz-mobile-web .drafts-pick-cards:not(.cascade-offer-cards) > .drafts-pick-card {
    --mobile-card-s: var(--mobile-card-scale, 1);
    zoom: normal;
    transform: scale(var(--mobile-card-s));
    transform-origin: top center;
    justify-self: center;
    margin-left: calc(172px * (var(--mobile-card-s) - 1) / 2);
    margin-right: calc(172px * (var(--mobile-card-s) - 1) / 2);
    margin-bottom: calc(243px * (var(--mobile-card-s) - 1));
  }
  html.klanz-mobile-web .cards-pagination .pagination-stable { display: flex; flex-wrap: nowrap; justify-content: center; align-items: center; gap: 6px; }
  html.klanz-mobile-web .cards-pagination :is(.pagination-nav, .pagination-nums) { display: flex; flex-wrap: nowrap; align-items: center; gap: 3px; }
  html.klanz-mobile-web .pagination-stable :is(.pagination-sep, .pagination-gap-slot) { flex-shrink: 0; }
  html.klanz-mobile-web .pagination-stable .pagination-sep { display: none; }
  html.klanz-mobile-web .pagination-stable :is(.pagination-num, .pagination-jump, .pagination-gap-slot) { display: inline-flex; align-items: center; justify-content: center; width: auto; min-width: 24px; min-height: 36px; padding: 0 2px; box-sizing: border-box; }
  html.klanz-mobile-web .pagination-gap-slot { background: none; border: 0; color: #ffca00; font: inherit; cursor: pointer; }
  html.klanz-mobile-web .mobile-dialog { position: fixed; inset: auto; left: 50%; top: calc(var(--mobile-visible-top, 0px) + var(--mobile-visible-height, 100dvh) / 2); transform: translate(-50%, -50%); margin: 0; padding: 18px; width: 340px; max-width: calc(100vw - 24px); max-height: calc(var(--mobile-visible-height, 100dvh) - 20px); overflow: auto; box-sizing: border-box; background: #27262d; color: #eee; border: 2px solid #8a7750; font: 14px/1.5 Tahoma, Arial, sans-serif; }
  html.klanz-mobile-web .mobile-dialog::backdrop { background: #0009; }
  html.klanz-mobile-web .mobile-dialog h2 { font-size: 16px; color: #ffca00; margin: 0 0 12px; }
  html.klanz-mobile-web .mobile-dialog :is(input, select) { width: 100%; margin: 12px 0; font: 16px Tahoma, Arial, sans-serif; padding: 8px; box-sizing: border-box; }
  html.klanz-mobile-web .mobile-dialog label { display: block; overflow-wrap: anywhere; }
  html.klanz-mobile-web .mobile-dialog-actions { display: flex; justify-content: flex-end; gap: 12px; margin: 16px 0 4px; }
  html.klanz-mobile-web .mobile-dialog button { min-height: 36px; padding: 6px 16px; background: #35343b; color: #ffca00; border: 1px solid #8a7750; font: 13px Tahoma, Arial, sans-serif; }
  html.klanz-mobile-web .mobile-pool-sheet { width: 420px; }
  html.klanz-mobile-web .mobile-pool-sheet .mobile-pool-close { display: block; position: sticky; top: -18px; margin: -8px 0 12px auto; background: #27262d; }
  html.klanz-mobile-web .mobile-pool-sheet .booster-pool-card-name { display: inline; color: #ffca00; line-height: 1.8; }
  html.klanz-mobile-web .booster-pool-tip { display: none !important; }
  html.klanz-mobile-web #klanz-global-chat #chat-send-status { grid-column: 1 / -1; grid-row: 4; font-size: 11px; }
  html.klanz-mobile-web #chat-send-status:empty { display: none; }
  html.klanz-mobile-web .warehouse-modal[data-mode="random_search"] { width: 300px; height: auto; min-height: 130px; max-height: calc(var(--mobile-visible-height, 100dvh) - 20px); padding: 18px; background: #27262d; border: 2px solid #8a7750; box-sizing: border-box; }
  html.klanz-mobile-web .warehouse-modal[data-mode="random_search"] img.bg { display: none; }
  html.klanz-mobile-web .warehouse-modal[data-mode="random_search"] .content { position: static; padding: 0; }
  html.klanz-mobile-web .warehouse-modal[data-mode="random_search"] .cancel { position: static; display: block; margin: 14px auto 0; }
}

@media (max-width: 619px) and (orientation: portrait) and (pointer: coarse) {
  html.klanz-mobile-web body:not(.page-cbp-battle) ul#menu { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); width: calc(100% - 4px); height: auto; }
  html.klanz-mobile-web ul#menu > li[id] { min-width: 0; height: 38px; }
  html.klanz-mobile-web ul#menu > li[id] > a { width: 100%; padding: 0 4px; text-align: center; font-size: 14px; }
  html.klanz-mobile-web .market-page .mkt-strip { grid-template-columns: minmax(0, 1fr); }
  html.klanz-mobile-web .market-page .mkt-lots { min-width: 0; width: 100%; }
  /* ~5 lot rows (44px) then scroll; cheapest are already first from API */
  html.klanz-mobile-web .market-page .mkt-lots-body {
    max-height: 220px;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  /* /bunker/new — portrait: card sections, full-width fields, no horizontal overflow */
  html.klanz-mobile-web .drafts-page .r_r { padding: 10px 12px 14px; font-size: 12px; }

  html.klanz-mobile-web .user-battles-page .battle-day-divider td { padding-left: 4px; }

  /*
   * Draft pick portrait — keep chrome inside side sprites; never overflow-x:hidden on .r_l
   * (clips .r_h gold rod → pink gap under menu). Sealed has no .drafts-pick-players.
   * text-size-adjust: stop Safari auto-inflating tiny card/guild fonts (iPhone only here).
   */
  html.klanz-mobile-web .drafts-page:has(.drafts-pick-players) {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
  }
  html.klanz-mobile-web body:not(.page-cbp-battle) .drafts-page:has(.drafts-pick-players) .r_l {
    overflow: visible;
  }
  html.klanz-mobile-web body:not(.page-cbp-battle) .drafts-page:has(.drafts-pick-players) .r_r {
    padding: 10px 21px 12px;
    overflow-x: hidden;
    box-sizing: border-box;
  }
  html.klanz-mobile-web .drafts-pick-head {
    font-size: 15px;
    padding: 12px 0 0;
    margin: 0;
    max-width: 100%;
    overflow-wrap: anywhere;
    line-height: 1.2;
  }
  html.klanz-mobile-web .drafts-pick-players {
    grid-auto-rows: min-content;
    align-items: start;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    margin: 8px 0 0;
    gap: 3px;
    box-sizing: border-box;
  }
  html.klanz-mobile-web .drafts-pick-player-image { aspect-ratio: 170 / 27; }
  html.klanz-mobile-web .drafts-pick-placeholder {
    top: 2px; left: 2px; right: 2px;
    font-size: 9px; line-height: 1.1;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  html.klanz-mobile-web .drafts-pick-underlay {
    width: 100%; max-width: 100%;
    height: 34px !important; min-height: 34px !important; max-height: 34px !important;
    margin: 0; padding: 0 !important; overflow: hidden; box-sizing: border-box;
  }
  html.klanz-mobile-web .drafts-pick-underlay-guild-pane {
    flex: 0 0 14px !important; height: 14px !important;
    min-height: 14px !important; max-height: 14px !important; padding: 0 2px !important;
  }
  html.klanz-mobile-web .drafts-pick-underlay-booster-pane {
    flex: 0 0 20px !important; height: 20px !important;
    min-height: 20px !important; max-height: 20px !important; padding: 0 2px !important;
  }
  html.klanz-mobile-web .drafts-pick-guild-empty,
  html.klanz-mobile-web .drafts-pick-guild-name,
  html.klanz-mobile-web .drafts-pick-guild-link { font-size: 8px; }
  html.klanz-mobile-web .drafts-pick-underlay-line {
    white-space: nowrap !important; overflow: hidden; text-overflow: ellipsis;
    gap: 2px; font-size: 8px; max-width: 100%;
  }
  html.klanz-mobile-web .drafts-pick-underlay-line strong { font-size: 8px; }
  html.klanz-mobile-web .drafts-pick-underlay-line img { width: 9px; flex-shrink: 0; }
  html.klanz-mobile-web .drafts-pick-underlay-line img + span { display: none; }
  html.klanz-mobile-web .drafts-pick-status-row {
    display: flex; align-items: stretch;
    width: 100%; max-width: 100%; min-width: 0;
    box-sizing: border-box; padding: 0; margin: 6px 0 0; gap: 4px;
    grid-template-columns: none;
  }
  html.klanz-mobile-web .drafts-pick-status-box--ind {
    flex: 1 1 auto; grid-column: auto; width: auto; min-width: 0; overflow: hidden;
  }
  html.klanz-mobile-web .drafts-pick-status-box--time {
    flex: 0 0 64px; grid-column: auto; width: 64px; max-width: 64px; min-width: 64px; overflow: hidden;
  }
  html.klanz-mobile-web .drafts-pick-status-box--time > img { height: 42px; transform: none; }
  html.klanz-mobile-web .drafts-pick-ind-frame { height: 42px; width: 100%; max-width: 100%; }
  html.klanz-mobile-web .drafts-pick-ind-frame-center { height: 38px; }
  html.klanz-mobile-web .drafts-pick-status-box img.drafts-pick-ind-frame-top,
  html.klanz-mobile-web .drafts-pick-status-box img.drafts-pick-ind-frame-bottom { height: 15px; }
  html.klanz-mobile-web .drafts-pick-status-text { font-size: 10px; padding: 0 4px; line-height: 1.15; }
  html.klanz-mobile-web .drafts-pick-status-separator { margin: 8px 0 0; }
  html.klanz-mobile-web .drafts-page:has(.drafts-pick-players) .drafts-pick-cards-wrap {
    margin-top: 8px; padding-left: 0; padding-right: 0; max-width: 100%; overflow-x: hidden;
  }

  /* Cascade page: never paint into side frames; never overlap siblings */
  html.klanz-mobile-web body:not(.page-cbp-battle) .cascade-pick-page > .r_l {
    display: flow-root;
    overflow: visible;
  }
  html.klanz-mobile-web body:not(.page-cbp-battle) .cascade-pick-page > .r_l > .r_r {
    padding: 10px 21px 14px !important;
    overflow-x: hidden;
    box-sizing: border-box;
    max-width: 100%;
  }
  html.klanz-mobile-web .cascade-pick-page :is(.cascade-pick-head, .cascade-pick-title) {
    padding-left: 0 !important;
    padding-right: 0 !important;
    max-width: 100%;
    box-sizing: border-box;
  }
  html.klanz-mobile-web .cascade-pick-page .cascade-pick-status-row {
    display: flex !important;
    flex-wrap: nowrap;
    align-items: flex-start;
    gap: 8px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    padding: 8px 0 0 !important;
    overflow: hidden;
  }
  html.klanz-mobile-web .cascade-pick-page .cascade-pick-explain {
    flex: 1 1 auto;
    min-width: 0;
    max-width: 100%;
  }
  html.klanz-mobile-web .cascade-pick-page .cascade-pick-time {
    position: relative;
    flex: 0 0 112px;
    width: 112px !important;
    max-width: 112px;
    height: 36px;
    overflow: hidden;
  }
  html.klanz-mobile-web .cascade-pick-page .cascade-pick-time img {
    display: block;
    width: 100% !important;
    height: 36px !important;
    max-width: 100%;
    transform: none !important;
    object-fit: fill;
  }
  html.klanz-mobile-web .cascade-pick-page .cascade-pick-timer-text {
    font-size: 16px !important;
  }
  /*
   * Cascade 3-card offer: flex + per-card zoom sized so 3×172×scale ≤ width.
   * Never leave 172px unscaled in a narrow cell (that was the overlap).
   */
  html.klanz-mobile-web .cascade-pick-page .drafts-pick-cards-wrap:has(> .cascade-offer-cards),
  html.klanz-mobile-web .drafts-pick-cards-wrap:has(> .cascade-offer-cards) {
    display: block;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden;
    padding: 0 0 8px;
  }
  html.klanz-mobile-web .cascade-pick-page .drafts-pick-cards.cascade-offer-cards,
  html.klanz-mobile-web .drafts-pick-cards.cascade-offer-cards {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    justify-content: space-between;
    align-items: flex-start;
    gap: 4px !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
    transform: none !important;
    grid-template-columns: none !important;
  }
  html.klanz-mobile-web .cascade-pick-page .drafts-pick-cards.cascade-offer-cards > .drafts-pick-card,
  html.klanz-mobile-web .drafts-pick-cards.cascade-offer-cards > .drafts-pick-card {
    flex: 0 0 auto !important;
    width: 172px !important;
    max-width: none;
    min-width: 0;
    margin: 0 !important;
    transform: none !important;
    zoom: var(--mobile-cascade-offer-scale, 0.48);
  }
  html.klanz-mobile-web .cascade-pick-page .drafts-pick-cards:not(.cascade-offer-cards) {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }
  html.klanz-mobile-web .cascade-pick-page #cascade-selected-cards {
    grid-template-columns: repeat(var(--mobile-card-columns, 4), minmax(0, 1fr)) !important;
  }
  html.klanz-mobile-web .cascade-pick-page .drafts-pick-selected-wrap {
    max-width: 100%;
    overflow: hidden;
  }
  html.klanz-mobile-web .drafts-create-table tr { margin-bottom: 10px; }
  html.klanz-mobile-web .drafts-create-table td { padding: 10px; }
  html.klanz-mobile-web .drafts-col-label { font-size: 13px; letter-spacing: 0.02em; }
  html.klanz-mobile-web .drafts-type-options .drafts-option { font-size: 13px; }
  html.klanz-mobile-web .drafts-format-pair {
    flex-wrap: wrap; white-space: normal; justify-content: space-between; gap: 8px;
  }
  html.klanz-mobile-web .drafts-format-pair label { min-width: 0; flex: 1 1 auto; }
  html.klanz-mobile-web .drafts-format-pair input,
  html.klanz-mobile-web .drafts-input {
    width: 72px; max-width: 40%; box-sizing: border-box; min-height: 36px;
  }
  html.klanz-mobile-web .drafts-select,
  html.klanz-mobile-web .drafts-password input {
    min-height: 40px; font-size: 13px; padding: 8px 10px;
  }
  html.klanz-mobile-web .drafts-password {
    flex-direction: column; align-items: stretch; gap: 6px; margin-top: 4px;
  }
  html.klanz-mobile-web .drafts-fee-controls,
  html.klanz-mobile-web .drafts-access-controls,
  html.klanz-mobile-web .drafts-access-wrap {
    width: 100%;
  }
  html.klanz-mobile-web .drafts-fee-controls .drafts-option,
  html.klanz-mobile-web .drafts-access-controls .drafts-option {
    width: 100%; min-height: 44px; padding: 8px 0;
  }
  html.klanz-mobile-web .drafts-custom-wrap { overflow-wrap: anywhere; line-height: 1.4; }
  html.klanz-mobile-web .drafts-actions { margin-top: 14px; }
  html.klanz-mobile-web .drafts-cost-overrides {
    width: 100%; flex-direction: column; align-items: flex-start; gap: 8px;
  }
  html.klanz-mobile-web .main2-home-row { grid-template-columns: minmax(0, 1fr); }
  html.klanz-mobile-web .ex-r .ex-grid { grid-template-columns: minmax(0, 1fr); }
  html.klanz-mobile-web .gift-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  html.klanz-mobile-web .mission-row { grid-template-columns: 56px minmax(0, 1fr); }
  html.klanz-mobile-web .mission-row > :nth-child(n+3) { grid-column: 2; }
  html.klanz-mobile-web .testtest-chat-tab-label { font-size: 11px; }
  html.klanz-mobile-web .clans2-index-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 379px) and (pointer: coarse) {
  html.klanz-mobile-web ul#menu #menu_item_auth_task.is-mobile-menu-open > div.menu { grid-template-columns: minmax(0, 1fr); width: 250px; }
  html.klanz-mobile-web .mobile-character-card { justify-self: center; }
}

@media (max-width: 1024px) and (pointer: coarse) {
  html.klanz-mobile-web .deckbuilder-head { flex-wrap: wrap; }
  html.klanz-mobile-web .deckbuilder-filter-share { white-space: normal; line-height: 1.8; margin-bottom: 10px; }
  html.klanz-mobile-web .endurance-page .end-cup img { max-width: 100%; height: auto; }
}

@media (max-width: 1024px) and (pointer: coarse) {
  html.klanz-mobile-web .mobile-character-card .mobile-online-counters { list-style: none; background: url('/interface/backgrounds/cnt.png') no-repeat; height: 98px; margin: -1px 0 0; padding-left: 9px; }
  html.klanz-mobile-web .mobile-character-card .mobile-online-counters li { display: block; color: #ccc; text-align: center; float: left; width: 69px; padding: 15px 5px 0; }
  html.klanz-mobile-web .mobile-character-card .mobile-online-counters strong { display: block; line-height: 40px; font-size: 16px; color: #fff; font-weight: normal; }
}



@media (max-width: 619px) and (orientation: portrait) and (pointer: coarse) {
  html.klanz-mobile-web .reply-grid tr { grid-template-columns: minmax(0, 1fr); }
  html.klanz-mobile-web .reply-grid .reply-right { padding: 0 12px 12px; }
  html.klanz-mobile-web table.forum tr:has(> .td_l) { display: flex; flex-direction: column; }
  html.klanz-mobile-web table.forum tr > :is(.td_l, .td_r) { display: block; width: 100%; min-width: 0; box-sizing: border-box; }
  html.klanz-mobile-web table.forum tr > .td_r { order: -1; text-align: left; min-height: 90px; padding-left: 94px; position: relative; }
  html.klanz-mobile-web table.forum .td_r .ava { position: absolute; left: 12px; top: 10px; width: 70px; height: 70px; margin: 0; }
  html.klanz-mobile-web table.forum .td_r .ava img { width: 70px; height: 70px; }
  html.klanz-mobile-web .gifts-page .gift-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 8px; }
  /* Forum edit/reply: global mobile min-height:34px crushed the editor to ~2 lines. */
  html.klanz-mobile-web body:not(.page-cbp-battle) :is(.reply-form, .message-edit-form) textarea {
    width: 100%;
    min-height: min(50dvh, 360px);
    height: min(50dvh, 360px);
    max-height: 70dvh;
    font-size: 16px;
    line-height: 22px;
    padding: 10px;
    resize: vertical;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
}

@media (max-width: 1024px) and (pointer: coarse) {
  html.klanz-mobile-web .drafts-pick-placeholder { max-width: calc(100% - 16px); overflow-wrap: anywhere; font-size: clamp(8px, 1.8vw, 11px); line-height: 1.1; }
}

@media (max-width: 1024px) and (pointer: coarse) {
  html.klanz-mobile-web #open-cards > .card { zoom: var(--mobile-card-scale, 1); justify-self: center; }
}

/* Portrait: booster open + news release cards — 2-up, transform-scale (zoom leaves full layout box → overlap). */
@media (max-width: 619px) and (orientation: portrait) and (pointer: coarse) {
  html.klanz-mobile-web :is(#open-cards, .open-cards, .reveal-grid, .reveal-grid.is-count-3, .reveal-grid.is-count-4, .news-release-cards.cards) {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 12px 8px;
    justify-content: center;
  }
  html.klanz-mobile-web :is(#open-cards > .card, .open-cards > .card, .reveal-slot, .news-release-cards > .news-release-card-link) {
    --mobile-card-s: var(--mobile-card-scale, 1);
    zoom: normal;
    transform: scale(var(--mobile-card-s));
    transform-origin: top center;
    justify-self: center;
    width: 172px;
    max-width: 172px;
    margin-left: calc(172px * (var(--mobile-card-s) - 1) / 2);
    margin-right: calc(172px * (var(--mobile-card-s) - 1) / 2);
    margin-bottom: calc(243px * (var(--mobile-card-s) - 1));
  }
}

/* Home keeps its original sidebar and proportions; only its content can pan. */
.mobile-home-scroll, .mobile-home-columns { display: contents; }
@media (max-width: 1024px) and (pointer: coarse) {
  html.klanz-mobile-web body.mobile-home-sidebar .mobile-home-scroll { display: block; width: 100%; overflow-x: auto; overscroll-behavior-x: contain; }
  html.klanz-mobile-web body.mobile-home-sidebar .mobile-home-columns { display: flex; align-items: flex-start; gap: 15px; width: 975px; padding: 4px 0 8px; }
  html.klanz-mobile-web body.mobile-home-sidebar:not(.mobile-account-open) #left_col { display: block !important; flex: 0 0 168px; width: 168px; padding: 0; }
  html.klanz-mobile-web body.mobile-home-sidebar #right_col { flex: 0 0 792px; width: 792px; min-width: 792px; margin: 0; }
  html.klanz-mobile-web body.mobile-home-sidebar .main2-home-row { grid-template-columns: minmax(0, 441fr) minmax(0, 328fr); }
}

/* Portrait controls share even columns and keep the game's existing palette. */
@media (max-width: 619px) and (orientation: portrait) and (pointer: coarse) {
  html.klanz-mobile-web .collection-deck-tabs { display: grid; grid-template-columns: repeat(2, minmax(0, 124px)); gap: 8px; justify-content: center; margin: 4px 0 12px; }
  html.klanz-mobile-web .collection-deck-tabs .deck-tab img { width: 100%; max-width: 100%; }
  html.klanz-mobile-web .collection-deck-stats { margin: 0 0 10px; }
  html.klanz-mobile-web .market-page .clan-filters > a[data-filter="price"] { grid-column: span 2; }
  html.klanz-mobile-web .ex-n .clan-filters > a[data-filter="duplicates"] { grid-column: span 3; }
  html.klanz-mobile-web .r_r:has(> #clan-title) > .clan-filters > a[data-filter="star"] { grid-column: span 3; }
  html.klanz-mobile-web :is(.own-filters, .clan-filters):not(.hidden):not(.view-hidden) {
    display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 3px; margin: 0 0 10px; padding: 0; line-height: 16px;
  }
  html.klanz-mobile-web :is(.own-filters, .clan-filters) > .label {
    grid-column: 1 / -1; color: #a7a5ad; font-size: 11px; line-height: 16px;
  }
  html.klanz-mobile-web :is(.own-filters, .clan-filters) > .sep { display: none; }
  html.klanz-mobile-web :is(.own-filters, .clan-filters) > a,
  html.klanz-mobile-web .gift-filters > div > a {
    display: flex; align-items: center; justify-content: center; min-width: 0;
    min-height: 30px; box-sizing: border-box; padding: 3px 2px; margin: 0;
    color: #c6c4cc; font-size: 11px; line-height: 14px; text-align: center;
    text-decoration: none; background: #302f36; border-bottom: 1px solid #47454d;
  }
  html.klanz-mobile-web :is(.own-filters, .clan-filters) > a.active,
  html.klanz-mobile-web .gift-filters > div > a.active { color: #ffca00; border-bottom-color: #b79a4f; background: #39363a; }
  html.klanz-mobile-web .clan-filters > a[data-filter="added"] { grid-column: span 2; }
  html.klanz-mobile-web .clan-filters > a[data-filter="reset"] { color: #aaa6b0; grid-column: -2 / -1; }
  html.klanz-mobile-web :is(.col-name-search, .mkt-name-search) {
    display: grid; grid-column: 1 / -1; width: 100% !important; max-width: 100%; min-width: 0;
    grid-template-columns: minmax(0, 1fr); margin: 5px 0 0; box-sizing: border-box;
  }
  html.klanz-mobile-web :is(.col-name-search-ruler, .mkt-name-search-ruler) { display: none; }
  html.klanz-mobile-web :is(#col-name-q, #mkt-name-q) { width: 100% !important; }
  html.klanz-mobile-web .market-page .clan-filters-row { display: block; margin: 0 0 10px; }
  html.klanz-mobile-web .market-page .clan-filters-row .clan-filters { margin-bottom: 5px; }
  html.klanz-mobile-web :is(.clan, .mkt-clan-bar, .shop-clan-bar) { padding: 6px 8px; }
  html.klanz-mobile-web :is(.market-page, .ex-n) .mkt-clan-bar { display: block; }
  html.klanz-mobile-web :is(.market-page, .ex-n) .mkt-clan-label { display: block; margin-bottom: 4px; font-size: 11px; color: #bbb8c1; }
  html.klanz-mobile-web .clan-switches { display: flex; flex-wrap: wrap; gap: 2px; justify-content: center; }
  html.klanz-mobile-web .clan-switch {
    flex: 0 0 32px; width: 32px; height: 32px; min-height: 32px;
    box-sizing: border-box; padding: 6px; position: relative; touch-action: manipulation;
  }
  html.klanz-mobile-web .clan-switch img { width: 18px; height: 20px; pointer-events: none; }
  html.klanz-mobile-web .clan-switch.is-active { background: #242229; outline: 1px solid #b49c50; outline-offset: -1px; }
  html.klanz-mobile-web h1.shop-title { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 12px; margin: 10px 0 14px; font-size: 18px; line-height: 38px; text-align: center; }
  html.klanz-mobile-web h1.shop-title > :not(.shop-title-sep) { display: block; min-width: 0; min-height: 38px; }
  html.klanz-mobile-web h1.shop-title .shop-title-sep { display: none; }
  html.klanz-mobile-web .gift-filters { padding: 8px 8px 12px; }
  html.klanz-mobile-web .gift-filters > div { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 3px; margin-bottom: 8px; }
  html.klanz-mobile-web .gift-filters > div > span { width: auto; grid-column: 1 / -1; color: #a7a5ad; font-size: 11px; line-height: 16px; }
  html.klanz-mobile-web .gift-filter-sep { display: none; }
  html.klanz-mobile-web .gift-inventory-link { margin: 6px 0 0; text-align: right; }
  html.klanz-mobile-web .gift-inventory-link a { padding: 4px 0; margin: 0; }
  html.klanz-mobile-web .gifts-page .gift-grid { padding: 12px 4px; gap: 16px 12px; }
  html.klanz-mobile-web .gifts-page .gift-info { flex-direction: column; align-items: center; gap: 6px; text-align: center; }
  html.klanz-mobile-web .gifts-page .gift-info > div { width: 100%; }
  html.klanz-mobile-web .gifts-page .gift-name { min-height: 28px; line-height: 14px; }
  html.klanz-mobile-web .gifts-page .gift-price { margin-top: 5px; }
  html.klanz-mobile-web .gifts-page .gift-purchase-status:empty { height: 0; margin: 0; }
  html.klanz-mobile-web .ex-p .ex-toolbar { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
  html.klanz-mobile-web .ex-p .ex-tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); grid-column: 1 / -1; gap: 3px; }
  html.klanz-mobile-web .ex-p .ex-tabs > .sep { display: none; }
  html.klanz-mobile-web .ex-p .ex-tabs > a { min-width: 0; min-height: 30px; display: flex; align-items: center; justify-content: center; background: #302f36; border-bottom: 1px solid #47454d; text-decoration: none; color: #c6c4cc; font-size: 11px; }
  html.klanz-mobile-web .ex-p .ex-tabs > a.is-current { color: #ffca00; border-color: #b79a4f; }
  html.klanz-mobile-web .ex-p .ex-create-row { grid-column: 2; }
  html.klanz-mobile-web .ex-n .partner-bar { display: grid; grid-template-columns: auto minmax(0, 1fr) 72px; padding: 8px; gap: 6px; }
  html.klanz-mobile-web .ex-n .partner-bar > input { width: 100%; min-width: 0; }
  html.klanz-mobile-web .ex-n .partner-bar > button { width: 72px; min-width: 0; }
  html.klanz-mobile-web .ex-n .partner-bar #partner-status { grid-column: 1 / -1; }
  html.klanz-mobile-web .ex-n .side { padding: 8px; }
  html.klanz-mobile-web .ex-n .picker-search { display: grid; grid-template-columns: minmax(0, 1fr) 96px; gap: 6px; }
  html.klanz-mobile-web .ex-n .picker-search .text-input.search { width: 100%; }
  html.klanz-mobile-web .ex-n .picker-search .show-all { width: 96px; min-width: 0; }
  html.klanz-mobile-web .clans2-index-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 12px; margin-top: 8px; }
  html.klanz-mobile-web .clans2-index-row { display: contents; }
  html.klanz-mobile-web .clans2-index-sep-line { display: none; }
  html.klanz-mobile-web .clans2-index-item { display: flex; flex-direction: column; align-items: center; }
  html.klanz-mobile-web .clans2-index-item > a { display: block; width: 100%; }
  html.klanz-mobile-web .clans2-index-item img { width: 100%; aspect-ratio: 3 / 2; object-fit: contain; margin: 0; }
  html.klanz-mobile-web .clans2-index-bonus { width: 100%; margin-top: 7px; font-size: 11px; line-height: 15px; }
  html.klanz-mobile-web #cards.clans2-index-mode { margin-top: 8px; }
  html.klanz-mobile-web .cards-pagination:empty { display: none; }
}
@media (max-width: 379px) and (orientation: portrait) and (pointer: coarse) {
  html.klanz-mobile-web .own-filters:not(.hidden):not(.view-hidden) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  html.klanz-mobile-web .clan-filters:not(.hidden):not(.view-hidden) { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  html.klanz-mobile-web .clan-filters > a { font-size: 10px; }
  html.klanz-mobile-web .clan-filters > .label { grid-column: 1 / 3; order: -2; align-self: center; }
  html.klanz-mobile-web .clan-filters > a[data-filter="reset"] { order: -1; }
  html.klanz-mobile-web .clan-filters > a[data-filter="added"],
  html.klanz-mobile-web .market-page .clan-filters > a[data-filter="price"] { grid-column: auto; }
  html.klanz-mobile-web .ex-n .clan-filters > a[data-filter="duplicates"],
  html.klanz-mobile-web .r_r:has(> #clan-title) > .clan-filters > a[data-filter="star"] { grid-column: span 2; }
  html.klanz-mobile-web .gift-filters > div:first-child { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  html.klanz-mobile-web .gift-filters > div > a { font-size: 10px; }
}

/* Portrait room lists keep their original artwork and all player actions. */
@media (max-width: 619px) and (orientation: portrait) and (pointer: coarse) {
  html.klanz-mobile-web .drafts-page--list > .r_l > .r_r { padding-left: 21px; padding-right: 21px; }
  html.klanz-mobile-web .drafts-page--list .drafts-intro-block { padding: 0 10px; }
  html.klanz-mobile-web .mobile-bunker-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 0 10px; }
  html.klanz-mobile-web .mobile-bunker-heading .drafts-intro-title { margin: 0; font-size: 21px; line-height: 1.15; }
  html.klanz-mobile-web .mobile-bunker-info { margin: 0 0 10px; }
  html.klanz-mobile-web .mobile-bunker-info > summary { color: #ffca00; font-size: 12px; line-height: 30px; cursor: pointer; }
  html.klanz-mobile-web .mobile-bunker-info[open] > summary { margin-bottom: 6px; }
  html.klanz-mobile-web .drafts-page--list .drafts-mode-links { margin: 8px 0; font-size: 12px; line-height: 1.5; }
  html.klanz-mobile-web .drafts-page--list .drafts-top-actions { justify-content: space-between; gap: 8px; padding: 0 10px; }
  html.klanz-mobile-web .drafts-page--list .drafts-head,
  html.klanz-mobile-web .drafts-page--list #drafts-list-separator { display: none; }
  html.klanz-mobile-web .drafts-page--list .drafts-line--after-btn { margin-bottom: 0; }
  html.klanz-mobile-web .drafts-page--list .drafts-list { margin: 0; }
  html.klanz-mobile-web .drafts-page--list .draft-row { display: block; position: relative; padding: 10px; }
  html.klanz-mobile-web .drafts-page--list .draft-cell-players { position: absolute; right: 9px; top: 9px; padding: 3px 6px; border: 1px solid #56525d; line-height: 18px; background: #242229; color: #ffca00; }
  html.klanz-mobile-web .drafts-page--list .draft-players-count { margin: 0; white-space: nowrap; }
  html.klanz-mobile-web .drafts-page--list .draft-cell-desc { padding: 0; }
  html.klanz-mobile-web .drafts-page--list .draft-title { padding-right: 54px; margin: 0 0 7px; line-height: 1.5; }
  html.klanz-mobile-web .drafts-page--list .draft-title img { margin-right: 2px; }
  html.klanz-mobile-web .drafts-page--list .draft-joined-row { gap: 6px; }
  html.klanz-mobile-web .drafts-page--list .draft-joined-left { line-height: 1.5; }
  html.klanz-mobile-web .drafts-page--list .draft-joined-actions { margin-left: auto; }
  html.klanz-mobile-web .drafts-page--list .draft-cell-right { display: grid; grid-template-columns: minmax(62px, .75fr) minmax(0, 1.25fr); grid-template-rows: auto; gap: 10px; margin-top: 6px; padding-top: 6px; border: 0; border-top: 1px solid #4b4752; }
  html.klanz-mobile-web .drafts-page--list :is(.draft-right-top, .draft-right-bottom) { padding: 0; border: 0; display: flex; flex-wrap: wrap; align-content: start; align-items: baseline; gap: 4px 6px; }
  html.klanz-mobile-web .drafts-page--list :is(.draft-fee-line, .draft-prize-line) { margin: 0; white-space: nowrap; line-height: 1.5; }
  html.klanz-mobile-web .drafts-page--list .draft-right-label { flex-basis: 100%; }

  html.klanz-mobile-web .testtest-bg-top { min-height: 0; border-width: 50px 5px 8px; border-image-width: 50px 5px 8px; }
  html.klanz-mobile-web .testtest-heading-strip { left: -5px; width: calc(100% + 10px); top: -40px; padding: 0 8px; }
  html.klanz-mobile-web .testtest-title { font-size: 25px; }
  html.klanz-mobile-web .testtest-back-city { margin-right: 0; }
  html.klanz-mobile-web ul#warehouse-roster { max-height: none; overflow: visible; }
  html.klanz-mobile-web .warehouse-slot-hit { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; grid-template-rows: auto auto; align-items: center; gap: 2px 6px; min-height: 64px; padding: 8px 30px 8px 3px; }
  html.klanz-mobile-web .warehouse-slot-hit > .warehouse-slot-hit-mail { grid-column: 1; grid-row: 1 / 3; display: flex; align-items: center; justify-content: center; width: 30px; min-height: 40px; }
  html.klanz-mobile-web .warehouse-slot-hit-mail img { width: 30px; height: auto; }
  html.klanz-mobile-web .warehouse-slot-hit > .warehouse-slot-hit-text { grid-column: 2 / 4; grid-row: 1; min-width: 0; line-height: 1.35; font-size: 12px; }
  html.klanz-mobile-web .warehouse-slot-hit > .warehouse-slot-title-wrap { grid-column: 2; grid-row: 2; min-width: 0; font-size: 11px; }
  html.klanz-mobile-web .warehouse-slot-hit > .warehouse-slot-level-wrap { grid-column: 3; grid-row: 2; white-space: nowrap; font-size: 11px; }
  html.klanz-mobile-web .warehouse-slot-hit > .warehouse-slot-guild-wrap { grid-column: 2 / 4; grid-row: 3; min-width: 0; line-height: 1.4; }
  html.klanz-mobile-web .warehouse-slot-hit > .warehouse-slot-arpad-wrap { grid-column: 2 / 4; grid-row: 4; min-width: 0; line-height: 1.4; }
  html.klanz-mobile-web .warehouse-slot-guild { white-space: normal; }
  html.klanz-mobile-web .warehouse-slot-guild-name { overflow-wrap: anywhere; }
  html.klanz-mobile-web .warehouse-slot > .warehouse-slot-info { top: 6px; right: 1px; width: 28px; height: 32px; display: flex; align-items: center; justify-content: center; transform: none; }
}
@media (min-width: 620px), (orientation: landscape), (pointer: fine) {
  .mobile-bunker-heading { display: contents; }
  .mobile-bunker-info { display: contents; }
  .mobile-bunker-info > summary { display: none; }
}

/* Portrait missions: reserve actual artwork space and give every value its own grid cell. */
@media (max-width: 619px) and (pointer: coarse) {
  html.klanz-mobile-web .missions-page .missions-layout { grid-template-columns: minmax(0, 1fr); gap: 0; }
  html.klanz-mobile-web .missions-page .missions-rating { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 12px 0; }
  html.klanz-mobile-web .missions-page .missions-rating > span { margin: 0; }
  html.klanz-mobile-web .missions-page .missions-rating strong { font-size: 25px; }
  html.klanz-mobile-web .missions-page #missions-nav { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px 8px; padding: 8px; margin-bottom: 20px; }
  html.klanz-mobile-web .missions-page #missions-nav a { display: flex; flex-direction: column; justify-content: center; min-width: 0; min-height: 34px; padding: 3px 5px 3px 12px; font-size: 12px; line-height: 16px; box-sizing: border-box; background-position: 0 center; }
  html.klanz-mobile-web .missions-page #missions-nav a.active { background-position: center; }
  html.klanz-mobile-web .missions-page .missions-panel > :is(h1, h2) { font-size: 15px; line-height: 21px; padding: 12px 10px; }
  html.klanz-mobile-web .missions-page .missions-panel { background-size: 100% auto; }
  html.klanz-mobile-web .missions-page :is(.missions-category-intro, .missions-filters, .missions-total) { padding-left: 12px; padding-right: 12px; background-size: 100% auto; }
  html.klanz-mobile-web .missions-page .missions-filters { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0; padding-top: 4px; padding-bottom: 12px; }
  html.klanz-mobile-web .missions-page .missions-filters label { min-height: 32px; }
  html.klanz-mobile-web .missions-page .missions-filters input { width: 16px; height: 16px; min-height: 0; flex: none; }
  html.klanz-mobile-web .missions-page .mission-row { grid-template-columns: 72px minmax(0, 1fr); grid-template-areas: 'art body' 'points rewards'; gap: 8px 10px; padding: 12px 12px 16px; min-height: 0; }
  html.klanz-mobile-web .missions-page .mission-row > .mission-art { grid-area: art; width: 72px; height: 72px; }
  html.klanz-mobile-web .missions-page .mission-row > .mission-body { grid-area: body; min-width: 0; }
  html.klanz-mobile-web .missions-page .mission-body h3 { margin-bottom: 6px; font-size: 14px; line-height: 18px; }
  html.klanz-mobile-web .missions-page .mission-body p { margin-bottom: 6px; }
  html.klanz-mobile-web .missions-page .mission-row > .mission-rewards { grid-area: rewards; display: flex; flex-wrap: wrap; gap: 4px 10px; width: auto; max-width: none; padding: 2px 0 0; }
  html.klanz-mobile-web .missions-page .mission-row > .mission-rewards > .mission-muted { flex-basis: 100%; margin: 0; }
  html.klanz-mobile-web .missions-page .mission-row > .mission-rewards .mission-currency { display: inline-flex; align-items: center; margin: 0; white-space: nowrap; }
  html.klanz-mobile-web .missions-page .mission-row > .mission-rewards .mission-reward-label { display: block; flex-basis: 100%; white-space: normal; }
  html.klanz-mobile-web .missions-page .mission-row > .mission-shield { grid-area: points; width: 72px; height: 61px; background-size: 72px 61px; align-self: start; }
  html.klanz-mobile-web .missions-page .mission-shield strong { height: 43px; padding-top: 2px; line-height: 40px; font-size: 23px; }
  html.klanz-mobile-web .missions-page .mission-shield span { font-size: 8px; line-height: 13px; white-space: nowrap; }
  html.klanz-mobile-web .missions-page .mission-hall-row { grid-template-areas: 'art body' 'rewards rewards' 'first first'; }
  html.klanz-mobile-web .missions-page .mission-hall-row > .mission-first { grid-area: first; width: auto; max-width: none; padding: 0; }
  html.klanz-mobile-web .missions-page .mission-hall-row .mission-first br { display: none; }
  html.klanz-mobile-web .missions-page .mission-hall-row .mission-first a { margin-left: 4px; }
  html.klanz-mobile-web .missions-page .mission-hall-row .mission-first-date { display: inline; margin-left: 6px; }
  html.klanz-mobile-web .missions-page .missions-category-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 12px; padding: 14px 12px; }
  html.klanz-mobile-web .missions-page .mission-category { display: grid; grid-template-columns: minmax(0, 1fr); align-content: start; gap: 4px; min-width: 0; }
  html.klanz-mobile-web .missions-page .mission-category > span { min-height: 30px; line-height: 15px; }
  html.klanz-mobile-web .missions-page .mission-category strong { float: none; }
  html.klanz-mobile-web .missions-page .mission-category .mission-bar { margin: 0; }
  html.klanz-mobile-web .missions-page .missions-empty { padding: 20px 12px; }
  html.klanz-mobile-web .missions-page .missions-milestones { padding: 12px; }
  html.klanz-mobile-web .missions-page .missions-milestones h2 { font-size: 15px; line-height: 21px; }
}
@media (min-width: 380px) and (max-width: 619px) and (pointer: coarse) {
  html.klanz-mobile-web .missions-page #missions-nav { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2px 4px; }
  html.klanz-mobile-web .missions-page #missions-nav a { min-height: 38px; font-size: 11px; }
}

/* Equal menu cells, including standalone statistics pages. */
@media (max-width: 619px) and (orientation: portrait) and (pointer: coarse) {
  html.klanz-mobile-web body:not(.page-cbp-battle) ul#menu { --mobile-menu-layout: grid; gap: 1px; background: #24212d; }
  html.klanz-mobile-web ul#menu > li[id] { border: 0; float: none; position: relative; }
  html.klanz-mobile-web ul#menu > li[id] > a { display: flex; align-items: center; justify-content: center; line-height: 1; }
  html.klanz-mobile-web .hist-page h1.shop-title { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; margin: 8px; font-size: 16px; line-height: 32px; }
  html.klanz-mobile-web .hist-page h1.shop-title > a { min-height: 32px; }
  html.klanz-mobile-web .hist-page .hist-lead { margin: 0 8px 8px; }
  html.klanz-mobile-web .hist-page #hist-table { table-layout: fixed; width: calc(100% + 16px); }
  html.klanz-mobile-web .hist-page #hist-table :where(th, td):not(.line-cell) { box-sizing: border-box; width: auto; padding: 6px; line-height: 15px; white-space: normal; height: auto; }
  html.klanz-mobile-web .hist-page #hist-table .hist-date-col { width: 27%; }
  html.klanz-mobile-web .hist-page #hist-table .hist-status-col { width: 28%; }
  html.klanz-mobile-web .hist-page #hist-table[data-history-section="market"] .hist-date-col { width: 29%; }
  html.klanz-mobile-web .hist-page #hist-table .hist-num-col { width: 16%; }
  html.klanz-mobile-web .hist-page #hist-table .hist-side-col { width: 28%; }
  html.klanz-mobile-web .hist-page #hist-table :is(.th_date, .td_date) { overflow-wrap: normal; }
  html.klanz-mobile-web .hist-page #hist-table :is(.th_num, .td_num) { padding-left: 2px; padding-right: 2px; }
  html.klanz-mobile-web .hist-page #hist-table .klanz-list-empty td { padding: 18px 8px; }
  html.klanz-mobile-web .hist-page #hist-table[data-market-side="listed"] { min-width: 580px; width: 100%; margin: 0; }
  html.klanz-mobile-web .hist-page .mobile-table-scroll:has(#hist-table) { width: calc(100% + 16px); max-width: none; margin: 0 -8px; }
  html.klanz-mobile-web .hist-page #hist-table[data-market-side="listed"] .hist-date-col { width: 80px; }
  html.klanz-mobile-web .hist-page #hist-table .hist-pos-col { width: 100px; }
  html.klanz-mobile-web .hist-page #hist-table .hist-price-col { width: 82px; }
  html.klanz-mobile-web .hist-page #hist-table .hist-act-col { width: 116px; }
}

/* Dense portrait room roster: identity and level share the first line;
   titles and guild details grow only when present. Original row sprite remains. */
@media (max-width: 619px) and (orientation: portrait) and (pointer: coarse) {
  html.klanz-mobile-web #testtest-mount > .testtest-panel > .r_r { padding-left: 21px; padding-right: 21px; }
  html.klanz-mobile-web #warehouse-roster .warehouse-slot-hit {
    position: relative; display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: auto auto; grid-auto-rows: auto;
    align-items: baseline; align-content: center;
    gap: 0 5px; min-height: 44px; height: auto;
    padding: 5px 29px 5px 30px;
    line-height: 1.25; box-sizing: border-box;
  }
  html.klanz-mobile-web #warehouse-roster .warehouse-slot-hit > .warehouse-slot-hit-mail {
    display: flex; position: absolute; inset: 0 auto 0 0; grid-area: auto;
    width: 30px; height: 100%; min-height: 0;
    align-items: center; justify-content: center;
  }
  html.klanz-mobile-web #warehouse-roster .warehouse-slot-hit-mail img { width: 30px; height: auto; }
  html.klanz-mobile-web #warehouse-roster .warehouse-slot-hit > .warehouse-slot-hit-text {
    grid-column: 1; grid-row: 1; font-size: 12px; line-height: 1.25;
    max-width: none; min-width: 0; overflow: visible; overflow-wrap: anywhere;
    white-space: normal;
  }
  html.klanz-mobile-web #warehouse-roster .warehouse-slot-hit > .warehouse-slot-level-wrap {
    grid-column: 2; grid-row: 1; align-self: start; justify-self: end;
    white-space: nowrap; font-size: 11px; line-height: 15px;
  }
  html.klanz-mobile-web #warehouse-roster .warehouse-slot-level-label { font-size: 0; }
  html.klanz-mobile-web #warehouse-roster .warehouse-slot-level-label::after { content: ' ур.'; font-size: 10px; }
  html.klanz-mobile-web #warehouse-roster .warehouse-slot-hit > .warehouse-slot-title-wrap {
    grid-column: 1 / -1; grid-row: 2; min-width: 0;
    font-size: 10px; line-height: 14px; color: #414654;
  }
  html.klanz-mobile-web #warehouse-roster .warehouse-slot-hit > .warehouse-slot-guild-wrap {
    grid-column: 1; grid-row: 3; min-width: 0;
    font-size: 10px; line-height: 14px;
  }
  html.klanz-mobile-web #warehouse-roster .warehouse-slot-guild { align-items: baseline; gap: 3px; font-size: 10px; line-height: 14px; }
  html.klanz-mobile-web #warehouse-roster .warehouse-slot-guild img { align-self: center; width: 11px; height: 11px; }
  html.klanz-mobile-web #warehouse-roster .warehouse-slot-hit > .warehouse-slot-arpad-wrap {
    grid-column: 2; grid-row: 3; justify-self: end; align-self: end;
    min-width: 0; font-size: 10px; line-height: 14px;
  }
  html.klanz-mobile-web #warehouse-roster .warehouse-slot-arpad-wrap img { max-height: 12px; width: auto; }
  html.klanz-mobile-web #warehouse-roster .warehouse-slot > .warehouse-slot-info {
    display: flex; position: absolute; inset: 0 0 0 auto;
    width: 28px; height: 100%; min-height: 0;
    align-items: center; justify-content: center; transform: none;
  }
}

/* Append after the existing mobile mission rules: compact rows without empty artwork columns. */
@media (max-width:619px) and (orientation:portrait) and (pointer:coarse) {
 html.klanz-mobile-web .missions-page .mission-row { grid-template-columns:40px minmax(0,1fr) 40px; grid-template-areas:'art body points' 'rewards rewards rewards'; gap:4px 8px;padding:8px 10px 12px; }
 html.klanz-mobile-web .missions-page .mission-row > .mission-art, html.klanz-mobile-web .missions-page .mission-art img { width:40px;height:40px; }
 html.klanz-mobile-web .missions-page .mission-placeholder {width:36px;height:36px;font-size:24px;line-height:36px;}
 html.klanz-mobile-web .missions-page .mission-body h3 {font-size:14px;line-height:18px;margin-bottom:4px;}
 html.klanz-mobile-web .missions-page .mission-body p {margin-bottom:4px;}
 html.klanz-mobile-web .missions-page .mission-body .mission-progress-label {margin:2px 0;}
 html.klanz-mobile-web .missions-page .mission-row > .mission-shield {width:40px;height:34px;background-size:40px 34px;}
 html.klanz-mobile-web .missions-page .mission-shield strong {height:24px;padding-top:1px;line-height:22px;font-size:17px;}
 html.klanz-mobile-web .missions-page .mission-shield span {font-size:10px;line-height:13px;white-space:normal;}
 html.klanz-mobile-web .missions-page .mission-shield:has(span:not(:empty)) {width:60px;height:auto;min-height:51px;background-size:60px 51px;}
 html.klanz-mobile-web .missions-page .mission-row:has(.mission-shield span:not(:empty)) {grid-template-columns:40px minmax(0,1fr) 60px;}
 html.klanz-mobile-web .missions-page .mission-shield:has(span:not(:empty)) strong {height:36px;line-height:33px;}
 html.klanz-mobile-web .missions-page .mission-row > .mission-rewards {padding-top:2px;align-items:center;gap:3px 8px;}
 html.klanz-mobile-web .missions-page .mission-row > .mission-rewards > .mission-muted {flex-basis:auto;}
 html.klanz-mobile-web .missions-page .mission-row > .mission-rewards .mission-reward-label {flex-basis:auto;}
 html.klanz-mobile-web .missions-page .mission-hall-row {grid-template-columns:40px minmax(0,1fr);grid-template-areas:'art body' 'rewards rewards' 'first first';}
}
@media (max-width:619px) and (orientation:portrait) and (pointer:coarse) {
 /* The description clears the small artwork before the full-width progress line. */
 html.klanz-mobile-web .missions-page .mission-body > p:first-of-type {min-height:16px;}
 html.klanz-mobile-web .missions-page .mission-row:not(:has(.mission-shield span:not(:empty))) .mission-body > :is(.mission-progress-label,.mission-bar) {margin-left:-48px;width:calc(100% + 96px);}
}

/* The desktop sprites have irregular painted edges; draw straight mobile borders. */
@media (max-width: 619px) and (orientation: portrait) and (pointer: coarse) {
  html.klanz-mobile-web ul#menu > li[id] > a {
    border-top: 1px solid #17141e;
    border-bottom: 1px solid #17141e;
    background-origin: border-box;
    background-clip: padding-box;
  }
}

/* Plain room links stay centred in equal columns without orphan separators. */
@media (max-width: 1024px) and (pointer: coarse) {
  html.klanz-mobile-web .arpad-ui-page .arpad-foot {
    display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 2px 8px; margin: 8px 12px 10px;
  }
  html.klanz-mobile-web .arpad-ui-page .arpad-foot > .sep { display: none; }
  html.klanz-mobile-web .arpad-ui-page .arpad-foot > a {
    display: flex; align-items: center; justify-content: center;
    min-width: 0; min-height: 32px; padding: 0 3px;
    box-sizing: border-box; border: 0;
    background: none; color: #ffca00; text-decoration: underline;
    font: 12px/16px Tahoma, Arial, sans-serif; text-align: center;
  }
  html.klanz-mobile-web .arpad-ui-page .arpad-foot > a:active { color: #fff; }
}
@media (max-width: 619px) and (pointer: coarse) {
  html.klanz-mobile-web .arpad-ui-page .arpad-foot { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Keep the active checkpoint centred, including both ends of the scrollable track. */
@media (max-width: 1024px) and (pointer: coarse) {
  html.klanz-mobile-web .arena-page .arena-track { display: flex; transform: none; scroll-behavior: auto; }
  html.klanz-mobile-web .arena-page .arena-track::before,
  html.klanz-mobile-web .arena-page .arena-track::after { content: ''; display: block; flex: 0 0 50%; height: 1px; pointer-events: none; }
  html.klanz-mobile-web .arena-page .arena-track-inner { position: relative; flex: 0 0 610px; left: auto; right: auto; top: auto; bottom: auto; width: 610px; height: 148px; margin: 0; }
  html.klanz-mobile-web .arena-page .arena-hud-cell.is-lives { flex: 1 1 128px; min-width: 128px; }
  html.klanz-mobile-web .arena-page .arena-lives { flex-shrink: 0; }
  html.klanz-mobile-web .arena-page .arena-life { flex-shrink: 0; }
}

/* Extra wrappers preserve the original inline desktop summary. */
.mobile-draft-result-part, .mobile-draft-result-divider { display: contents; }
@media (max-width: 1024px) and (pointer: coarse) {
  html.klanz-mobile-web .mobile-bunker-lists > .r_l > .r_r { padding-left: 20px; padding-right: 20px; }
  html.klanz-mobile-web .mobile-bunker-lists .drafts-intro-block { padding: 0 12px; }
  html.klanz-mobile-web .mobile-bunker-lists .drafts-intro-title { font-size: 21px; line-height: 1.2; }
  html.klanz-mobile-web .mobile-bunker-lists .drafts-top-actions { padding-left: 12px; padding-right: 12px; }
  html.klanz-mobile-web .mobile-bunker-lists .drafts-mode-links { margin: 8px 0; font-size: 12px; line-height: 1.5; }
  html.klanz-mobile-web .mobile-bunker-lists .drafts-mode-links a { display: inline-block; padding: 5px 0; }
  html.klanz-mobile-web .mobile-bunker-lists .drafts-head:has(.col-players),
  html.klanz-mobile-web .mobile-bunker-lists #drafts-list-separator { display: none; }
  html.klanz-mobile-web .mobile-bunker-lists .drafts-line.mobile-full-separator::after { left: 0; right: 0; }
  html.klanz-mobile-web .mobile-bunker-lists .drafts-list { width: 100%; margin: 0; background: #30303a; }
  html.klanz-mobile-web .mobile-bunker-lists .drafts-list .draft-row {
    display: block; position: relative; padding: 12px; margin: 0; border: 0; box-sizing: border-box;
  }
  /* Between rows: v_ln only — no #242229 gutter (read as a foreign slit). */
  html.klanz-mobile-web .mobile-bunker-lists .draft-row + .draft-row {
    margin-top: 0;
    padding-top: 18px;
  }
  html.klanz-mobile-web .mobile-bunker-lists .draft-row + .draft-row::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 6px;
    background: url('/interface/backgrounds/v_ln.png') left top / 100% 6px no-repeat;
    pointer-events: none;
  }
  /* Under last row: do NOT crop r_f. Extend the row fill under the footer so
     transparent/charcoal sprite pixels sit on заявка color, not a foreign slit.
     Skip when a bottom paginator follows (прошедшие) — underfill covered the nums. */
  html.klanz-mobile-web .mobile-bunker-lists .drafts-list {
    position: relative;
    z-index: 0;
    overflow: visible;
  }
  html.klanz-mobile-web .mobile-bunker-lists .drafts-list .draft-row:last-child {
    padding-bottom: 12px;
    margin-bottom: 0;
  }
  html.klanz-mobile-web .mobile-bunker-lists .drafts-list:not(:has(+ .past-pag)):not(:has(+ .past-pages)) .draft-row:last-child::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    height: 28px;
    background: inherit;
    pointer-events: none;
    z-index: 0;
  }
  html.klanz-mobile-web .mobile-bunker-lists .past-pag.bottom {
    position: relative;
    z-index: 1;
    background: #30303a;
  }
  html.klanz-mobile-web body:not(.page-cbp-battle) .mobile-bunker-lists > .r_l > .r_f {
    bottom: -19px;
    height: 22px;
    background-size: 100% 22px;
    background-position: center top;
    z-index: 2;
  }
  html.klanz-mobile-web .mobile-bunker-lists .draft-cell-players { position: absolute; right: 12px; top: 11px; padding: 3px 6px; border: 1px solid #56525d; line-height: 18px; background: #242229; color: #ffca00; }
  html.klanz-mobile-web .mobile-bunker-lists .draft-players-count { margin: 0; white-space: nowrap; }
  html.klanz-mobile-web .mobile-bunker-history .draft-players-count::before { content: 'Игроков: '; color: #b9b5bd; }
  html.klanz-mobile-web .mobile-bunker-lists .draft-cell-desc { min-width: 0; padding: 0; }
  html.klanz-mobile-web .mobile-bunker-lists .draft-title { margin: 0 0 7px; padding-right: 58px; line-height: 1.5; overflow-wrap: anywhere; }
  html.klanz-mobile-web .mobile-bunker-lists .draft-title img { margin-right: 2px; }
  html.klanz-mobile-web .mobile-bunker-history .draft-title { padding-right: 0; }
  html.klanz-mobile-web .mobile-bunker-history .draft-title:first-child { padding-right: 86px; min-height: 26px; margin-bottom: 5px; color: #b9b5bd; font-size: 10px; line-height: 15px; }
  html.klanz-mobile-web .mobile-bunker-lists .draft-joined-row { gap: 6px; }
  html.klanz-mobile-web .mobile-bunker-lists .draft-joined-left { line-height: 1.6; overflow-wrap: anywhere; }
  html.klanz-mobile-web .mobile-bunker-lists .draft-joined-actions { margin-left: auto; }
  html.klanz-mobile-web .mobile-bunker-lists .draft-joined-actions:empty { display: none; }
  html.klanz-mobile-web .mobile-bunker-lists .draft-cell-right { display: grid; grid-template-columns: minmax(64px, .7fr) minmax(0, 1.3fr); grid-template-rows: auto; gap: 12px; margin-top: 8px; padding: 7px 0 0; border: 0; border-top: 1px solid #4b4752; }
  html.klanz-mobile-web .mobile-bunker-lists :is(.draft-right-top, .draft-right-bottom) { padding: 0; border: 0; display: flex; flex-wrap: wrap; align-content: start; align-items: baseline; gap: 3px 8px; }
  html.klanz-mobile-web .mobile-bunker-lists .draft-right-label { flex-basis: 100%; }
  html.klanz-mobile-web .mobile-bunker-lists :is(.draft-fee-line, .draft-prize-line) { margin: 0; line-height: 1.5; }
  html.klanz-mobile-web .mobile-bunker-lists .draft-prize-line { white-space: nowrap; }
  html.klanz-mobile-web .mobile-bunker-lists .draft-fee-line { white-space: normal; }
  html.klanz-mobile-web .mobile-bunker-lists .draft-cost { white-space: nowrap; }
  html.klanz-mobile-web .mobile-bunker-lists .mobile-draft-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 3px 12px; margin-top: 7px !important; padding-top: 6px; border-top: 1px solid #4b4752; }
  html.klanz-mobile-web .mobile-bunker-lists .mobile-draft-result-part { display: block; }
  html.klanz-mobile-web .mobile-bunker-lists .mobile-draft-result-divider { display: none; }
  html.klanz-mobile-web .mobile-bunker-lists .mobile-draft-result-part:last-child { flex-basis: 100%; }
  html.klanz-mobile-web .mobile-bunker-lists .tree-link { display: inline-block; min-height: 30px; line-height: 30px; }
  html.klanz-mobile-web .mobile-bunker-lists .past-pag.bottom { padding: 0 12px; }
  html.klanz-mobile-web .mobile-bunker-lists .past-pag-bar { grid-template-columns: 28px minmax(0, 1fr) 28px; }
  html.klanz-mobile-web .mobile-bunker-lists .past-pag-nums { gap: 2px; }
  html.klanz-mobile-web .mobile-bunker-lists :is(.past-pag-num, .past-pag-gap, .past-pag-nav a, .past-pag-nav .disabled) { min-width: 24px; min-height: 30px; line-height: 30px; padding: 0; }
  html.klanz-mobile-web .mobile-bunker-lists .past-pag-sep { display: none; }
  html.klanz-mobile-web .mobile-bunker-lists .past-pages .pagination { display: flex; flex-wrap: wrap; gap: 2px; }
  html.klanz-mobile-web .mobile-bunker-lists .past-pages .pagination :is(a, .current) { min-width: 24px; min-height: 30px; line-height: 30px; text-align: center; padding: 0; }
  html.klanz-mobile-web .mobile-bunker-lists .past-pages .d_gray { display: none; }
}
@media (min-width: 740px) and (max-width: 1024px) and (pointer: coarse) {
  html.klanz-mobile-web .mobile-bunker-lists .drafts-list .draft-row { display: grid; grid-template-columns: 70px minmax(0, 1fr) 160px; gap: 12px; }
  html.klanz-mobile-web .mobile-bunker-lists .draft-cell-players { position: static; align-self: start; padding: 4px; text-align: center; }
  html.klanz-mobile-web .mobile-bunker-lists .draft-players-count { white-space: normal; }
  html.klanz-mobile-web .mobile-bunker-history .draft-players-count::before { display: block; }
  html.klanz-mobile-web .mobile-bunker-lists .draft-title,
  html.klanz-mobile-web .mobile-bunker-history .draft-title:first-child { padding-right: 0; min-height: 0; }
  html.klanz-mobile-web .mobile-bunker-lists .draft-cell-right { grid-template-columns: minmax(0, 1fr); align-content: start; gap: 10px; margin: 0; padding: 0 0 0 12px; border-top: 0; border-left: 1px solid #4b4752; }
}

/* Warehouse only: metadata shares the row; absent fields never reserve extra lines. */
@media (max-width: 1024px) and (pointer: coarse) {
  html.klanz-mobile-web #warehouse-roster.room-warehouse .warehouse-slot-hit {
    display: flex; flex-wrap: wrap; align-items: center; align-content: center;
    gap: 0 5px; min-height: 30px; height: auto;
    padding: 2px 24px 2px 30px; box-sizing: border-box; line-height: 14px;
    background-size: 100% 200%;
  }
  html.klanz-mobile-web #warehouse-roster.room-warehouse .warehouse-slot-hit > :is(span, a) {
    grid-area: auto; position: static; inset: auto; min-width: 0;
    height: auto; margin: 0; line-height: 14px;
  }
  html.klanz-mobile-web #warehouse-roster.room-warehouse .warehouse-slot-hit > .warehouse-slot-hit-text {
    flex: 0 1 auto; max-width: 100%; font-size: 12px; line-height: 15px;
    white-space: normal; overflow: visible; overflow-wrap: anywhere;
  }
  html.klanz-mobile-web #warehouse-roster.room-warehouse .warehouse-slot-hit > .warehouse-slot-title-wrap {
    flex: 0 1 auto; max-width: 100%; font-size: 10px; line-height: 14px;
    white-space: normal; overflow-wrap: anywhere; color: #414654;
  }
  html.klanz-mobile-web #warehouse-roster.room-warehouse .warehouse-slot-hit > .warehouse-slot-level-wrap {
    display: inline-flex; flex: 0 0 auto; align-items: center; gap: 2px; margin-left: auto;
    font-size: 11px; line-height: 14px; white-space: nowrap;
  }
  html.klanz-mobile-web #warehouse-roster.room-warehouse .warehouse-slot-level-num { line-height: 14px; }
  html.klanz-mobile-web #warehouse-roster.room-warehouse .warehouse-slot-level-label { display: inline-flex; align-items: center; font-size: 0; line-height: 0; }
  html.klanz-mobile-web #warehouse-roster.room-warehouse .warehouse-slot-level-label::after { content: ' ур.'; font-size: 10px; line-height: 14px; }
  html.klanz-mobile-web #warehouse-roster.room-warehouse .warehouse-slot-hit > .warehouse-slot-guild-wrap {
    display: flex; flex: 0 1 auto; max-width: 100%; min-width: 0; font-size: 10px; line-height: 14px;
  }
  html.klanz-mobile-web #warehouse-roster.room-warehouse .warehouse-slot-guild {
    max-width: 100%; min-width: 0; align-items: center; gap: 3px;
    font-size: 10px; line-height: 14px; white-space: normal;
  }
  html.klanz-mobile-web #warehouse-roster.room-warehouse .warehouse-slot-guild img { width: 11px; height: 11px; }
  html.klanz-mobile-web #warehouse-roster.room-warehouse .warehouse-slot-guild-name { min-width: 0; overflow-wrap: anywhere; }
  html.klanz-mobile-web #warehouse-roster.room-warehouse .warehouse-slot-hit > .warehouse-slot-arpad-wrap {
    flex: 0 0 auto; margin-left: auto; gap: 3px; font-size: 10px; line-height: 14px;
  }
  html.klanz-mobile-web #warehouse-roster.room-warehouse .warehouse-slot-arpad-wrap img { max-height: 12px; width: auto; }
  html.klanz-mobile-web #warehouse-roster.room-warehouse .warehouse-slot-hit > .warehouse-slot-hit-mail {
    display: flex; position: absolute; inset: 0 auto 0 0; width: 24px; height: 100%; min-height: 0;
    align-items: center; justify-content: center;
  }
  html.klanz-mobile-web #warehouse-roster.room-warehouse .warehouse-slot-hit-mail img { width: 24px; height: 14px; }
  html.klanz-mobile-web #warehouse-roster.room-warehouse .warehouse-slot > .warehouse-slot-info {
    display: flex; position: absolute; inset: 0 0 0 auto; width: 24px; height: 100%; min-height: 0;
    align-items: center; justify-content: center; transform: none;
  }
}

/* The explicit profile destination belongs to the touch menu only. */
html.klanz-mobile-web ul#menu #mobile-my-profile { display: none !important; }

/* Deck chooser uses the same game controls for links and buttons. */
@media (max-width: 1024px) and (pointer: coarse) {
  html.klanz-mobile-web ul#menu #mobile-my-profile { display: block !important; }
  html.klanz-mobile-web #mobile-deck-dialog .mobile-dialog-actions { justify-content: center; gap: 10px; }
  html.klanz-mobile-web #mobile-deck-dialog :is(.mobile-dialog-actions > button, .mobile-deck-collection-link) {
    display: inline-flex; align-items: center; justify-content: center;
    box-sizing: border-box; min-height: 32px; padding: 2px 10px;
    border: 6px solid transparent;
    border-image: url('/interface/buttons/button_under_card.png') 6 fill / 6px stretch;
    background: none; color: #ffca00; font: 12px/16px Tahoma, Arial, sans-serif;
    text-align: center; text-decoration: none;
  }
  html.klanz-mobile-web #mobile-deck-dialog .mobile-dialog-actions > button { min-width: 96px; }
  html.klanz-mobile-web #mobile-deck-dialog button:disabled { opacity: .55; }
  html.klanz-mobile-web #mobile-deck-dialog a.mobile-deck-collection-link { display: flex; width: max-content; max-width: 100%; margin: 12px auto 0; }
  html.klanz-mobile-web #mobile-deck-dialog .mobile-deck-collection-link:visited { color: #ffca00; }
  html.klanz-mobile-web #mobile-deck-dialog :is(button:not(:disabled), .mobile-deck-collection-link):is(:hover, :focus-visible) { color: #fff; }
}

/* Portrait tables retain their native rows, data and action handlers. */
@media (max-width: 619px) and (orientation: portrait) and (pointer: coarse) {
  html.klanz-mobile-web .drafts-page:has(.arpada-table:not(.arpada-table--past)) .arpada-intro { padding: 6px 4px 10px; }
  html.klanz-mobile-web .drafts-page:has(.arpada-table:not(.arpada-table--past)) .arpada-intro h1 { margin: 0; font-size: 20px; }
  html.klanz-mobile-web .drafts-page:has(.arpada-table:not(.arpada-table--past)) .arpada-hero { display: flow-root; padding: 0 4px 10px; }
  html.klanz-mobile-web .drafts-page:has(.arpada-table:not(.arpada-table--past)) .arpada-hero img.podium { float: left; width: 88px; height: auto; margin: 0 10px 5px 0; transform: none; }
  html.klanz-mobile-web .drafts-page:has(.arpada-table:not(.arpada-table--past)) .arpada-rules-text { margin: 0; padding: 0; line-height: 1.45; }
  html.klanz-mobile-web .drafts-page:has(.arpada-table:not(.arpada-table--past)) .arpada-nav-link { padding: 0 4px 10px; line-height: 1.7; }

  html.klanz-mobile-web table.forum.arpada-table:not(.arpada-table--past) { display: block; min-width: 0; table-layout: auto; }
  html.klanz-mobile-web .arpada-table:not(.arpada-table--past) > colgroup { display: none; }
  html.klanz-mobile-web .arpada-table:not(.arpada-table--past) > tbody { display: block; }
  html.klanz-mobile-web .arpada-table:not(.arpada-table--past) tr:has(> th),
  html.klanz-mobile-web .arpada-table:not(.arpada-table--past) tr:has(> th) + tr:has(.line-cell) { display: none; }
  html.klanz-mobile-web .arpada-table:not(.arpada-table--past) tr:has(.line-cell),
  html.klanz-mobile-web .arpada-table:not(.arpada-table--past) .line-cell { display: block; width: 100%; }
  html.klanz-mobile-web .arpada-table:not(.arpada-table--past) tr:has(> .td_place) {
    display: grid; grid-template-columns: 28px minmax(0, 1fr) minmax(0, 1fr);
    grid-template-areas: 'place player player' 'place guild guild' 'place wl rating';
    gap: 2px 8px; padding: 8px 12px 9px; border-bottom: 1px solid #1a191f;
  }
  html.klanz-mobile-web .arpada-table:not(.arpada-table--past) tr.dark { background: #242229; }
  html.klanz-mobile-web .arpada-table:not(.arpada-table--past) tr.light { background: #2e2b34; }
  html.klanz-mobile-web .arpada-table:not(.arpada-table--past) tr.arpada-top3,
  html.klanz-mobile-web .arpada-table:not(.arpada-table--past) tr.arpada-row--mine { background: #4e3150; }
  html.klanz-mobile-web table.forum.arpada-table:not(.arpada-table--past) tr:has(> .td_place) > td {
    display: block; box-sizing: border-box; width: auto !important; min-width: 0 !important;
    max-width: none !important; height: auto; padding: 0 !important; border: 0 !important;
    background: none !important; overflow: visible; white-space: normal; overflow-wrap: normal;
    line-height: 18px; text-align: left;
  }
  html.klanz-mobile-web .arpada-table:not(.arpada-table--past) .td_place { grid-area: place; color: #a6a0ac; font-size: 13px; }
  html.klanz-mobile-web .arpada-table:not(.arpada-table--past) .td_place::before { content: '#'; }
  html.klanz-mobile-web .arpada-table:not(.arpada-table--past) .td_name.player-col { grid-area: player; }
  html.klanz-mobile-web .arpada-table:not(.arpada-table--past) .td_name.player-col a.forum_user {
    white-space: normal; overflow: visible; overflow-wrap: break-word; font-size: 12px;
  }
  html.klanz-mobile-web .arpada-table:not(.arpada-table--past) .td_name.guild-col { grid-area: guild; }
  html.klanz-mobile-web .arpada-table:not(.arpada-table--past) .td_name.guild-col:not(:has(a)) { display: none; }
  html.klanz-mobile-web .arpada-table:not(.arpada-table--past) .td_name.guild-col a.forum_user { display: flex; align-items: baseline; white-space: normal; font-weight: normal; }
  html.klanz-mobile-web .arpada-table:not(.arpada-table--past) .td_name.guild-col a.forum_user img { flex: 0 0 13px; align-self: flex-start; margin-top: 2px; }
  html.klanz-mobile-web .arpada-table:not(.arpada-table--past) .guild-name-text { min-width: 0; overflow-wrap: break-word; }
  html.klanz-mobile-web .arpada-table:not(.arpada-table--past) .td_wl { grid-area: wl; white-space: nowrap !important; }
  html.klanz-mobile-web .arpada-table:not(.arpada-table--past) .td_rating { grid-area: rating; white-space: nowrap !important; text-align: right !important; }
  html.klanz-mobile-web .arpada-table:not(.arpada-table--past) .td_wl::before { content: 'W / L: '; color: #a6a0ac; font-weight: normal; }
  html.klanz-mobile-web .arpada-table:not(.arpada-table--past) .td_rating::before { content: 'Рейтинг: '; color: #a6a0ac; font-weight: normal; }
  html.klanz-mobile-web .arpada-table:not(.arpada-table--past) .arpada-empty { display: block; }
  html.klanz-mobile-web .arpada-table:not(.arpada-table--past) .arpada-empty > td { display: block; height: auto; padding: 18px 12px; line-height: 1.5; overflow-wrap: normal; }

  html.klanz-mobile-web .hist-page .mobile-table-scroll:has(#hist-table[data-market-side='listed']) { overflow: visible; }
  html.klanz-mobile-web .hist-page #hist-table[data-market-side='listed'] { display: block; min-width: 0; width: 100%; table-layout: auto; }
  html.klanz-mobile-web .hist-page #hist-table[data-market-side='listed'] > colgroup,
  html.klanz-mobile-web .hist-page #hist-table[data-market-side='listed'] thead > tr:not(.line-row),
  html.klanz-mobile-web .hist-page #hist-table[data-market-side='listed'] thead > .line-row:last-child { display: none; }
  html.klanz-mobile-web .hist-page #hist-table[data-market-side='listed'] :is(thead, tbody, .line-row, .line-cell) { display: block; width: 100%; }
  html.klanz-mobile-web .hist-page #hist-table[data-market-side='listed'] tr[data-listing] {
    display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-areas: 'name name' 'date price' 'pos actions';
    column-gap: 8px; padding: 7px 12px; border-bottom: 1px solid #1a191f;
  }
  html.klanz-mobile-web .hist-page #hist-table[data-market-side='listed'] tr.dark { background: #242229; }
  html.klanz-mobile-web .hist-page #hist-table[data-market-side='listed'] tr.light { background: #2e2b34; }
  html.klanz-mobile-web .hist-page #hist-table[data-market-side='listed'] tr[data-listing] > td {
    display: flex; align-items: center; width: auto; min-width: 0; height: auto; min-height: 24px;
    padding: 0; border: 0; background: none; white-space: normal; overflow-wrap: normal;
  }
  html.klanz-mobile-web .hist-page #hist-table[data-market-side='listed'] .td_main { grid-area: name; font-size: 12px; }
  html.klanz-mobile-web .hist-page #hist-table[data-market-side='listed'] .td_main a { padding: 3px 0; overflow-wrap: break-word; }
  html.klanz-mobile-web .hist-page #hist-table[data-market-side='listed'] .td_date { grid-area: date; font-size: 10px; }
  html.klanz-mobile-web .hist-page #hist-table[data-market-side='listed'] .td_pos { grid-area: pos; font-size: 10px; line-height: 15px; }
  html.klanz-mobile-web .hist-page #hist-table[data-market-side='listed'] .td_pos .hist-pos-icon { flex: 0 0 auto; }
  html.klanz-mobile-web .hist-page #hist-table[data-market-side='listed'] .td_price { grid-area: price; justify-content: flex-end; gap: 4px; white-space: nowrap; }
  html.klanz-mobile-web .hist-page #hist-table[data-market-side='listed'] .td_price::before { content: 'Цена:'; color: #9a96a0; font-weight: normal; }
  html.klanz-mobile-web .hist-page #hist-table[data-market-side='listed'] .td_act { grid-area: actions; justify-content: flex-end; gap: 8px; }
  html.klanz-mobile-web .hist-page #hist-table[data-market-side='listed'] .hist-act-sep { display: none; }
  html.klanz-mobile-web .hist-page #hist-table[data-market-side='listed'] .hist-list-act { min-height: 34px; color: #bdb8c4; white-space: nowrap; }
  html.klanz-mobile-web .hist-page #hist-table[data-market-side='listed'] .hist-list-act:disabled { color: #79747f; }
  html.klanz-mobile-web .hist-page #hist-table[data-market-side='listed'] .hist-price-input { box-sizing: border-box; width: 88px; max-width: calc(100% - 30px); height: 30px; min-height: 30px; padding: 3px 5px; font-size: 13px; }
  html.klanz-mobile-web .hist-page #hist-table[data-market-side='listed'] .klanz-list-empty,
  html.klanz-mobile-web .hist-page #hist-table[data-market-side='listed'] .klanz-list-empty > td { display: block; width: 100%; box-sizing: border-box; }
}

/* On a horizontal phone retain columns, but honour their original widths. */
@media (max-width: 1024px) and (orientation: landscape) and (pointer: coarse) {
  html.klanz-mobile-web table.forum.arpada-table:not(.arpada-table--past) { table-layout: fixed; }
  html.klanz-mobile-web .arpada-table:not(.arpada-table--past) :is(.th_wl, .th_rating, .td_wl, .td_rating) { white-space: nowrap; overflow-wrap: normal; }
  html.klanz-mobile-web .arpada-table:not(.arpada-table--past) .td_name.player-col a.forum_user { white-space: normal; overflow-wrap: break-word; }
  html.klanz-mobile-web .arpada-table:not(.arpada-table--past) .td_name.guild-col a.forum_user { max-width: 100%; white-space: normal; }
  html.klanz-mobile-web .arpada-table:not(.arpada-table--past) .td_name.guild-col a.forum_user img { flex: 0 0 13px; }
  html.klanz-mobile-web .arpada-table:not(.arpada-table--past) .guild-name-text { min-width: 0; overflow-wrap: break-word; }
}

/* Keep the existing guild roster inside its frame on touch screens. */
@media (max-width: 1024px) and (pointer: coarse) {
  html.klanz-mobile-web .guild-page .guild-table :is(th, td) {
    box-sizing: border-box;
    padding: 5px 3px;
    white-space: normal;
    overflow-wrap: anywhere;
  }
  html.klanz-mobile-web .guild-page .guild-table .col-n { width: 22px; }
  html.klanz-mobile-web .guild-page .guild-table .col-name { width: auto; }
  html.klanz-mobile-web .guild-page .guild-table .col-rank { width: 25%; }
  html.klanz-mobile-web .guild-page .guild-table .col-rating { width: 44px; }
  html.klanz-mobile-web .guild-page .guild-table .col-status { width: 52px; white-space: nowrap; }
  html.klanz-mobile-web .guild-page .guild-table .guild-rank-edit {
    white-space: normal;
    overflow: visible;
    overflow-wrap: anywhere;
    text-overflow: clip;
  }
}

/* Native browser anchoring and the message anchor must not both adjust the log. */
@media (max-width: 1024px) and (pointer: coarse) {
  html.klanz-mobile-web .mobile-chat-scroll-position { overflow-anchor: none; }
}
/* The same inline chat is used in every room. Only its editor follows the keyboard. */
#mobile-chat-keyboard-close { display: none; }
@media (max-width: 1024px) and (pointer: coarse) {
  html.klanz-mobile-web body.mobile-chat-editing #klanz-global-chat {
    position: fixed; z-index: 500; margin: 0; padding: 0; background: none;
    left: calc(var(--mobile-visible-left, 0px) + max(2px, env(safe-area-inset-left)));
    top: var(--mobile-chat-editor-top);
    width: calc(var(--mobile-visible-width, 100vw) - max(2px, env(safe-area-inset-left)) - max(2px, env(safe-area-inset-right)));
    height: var(--mobile-chat-editor-height);
  }
  html.klanz-mobile-web body.mobile-chat-editing #klanz-global-chat :is(.r_h, .r_f) { display: none; }
  html.klanz-mobile-web body.mobile-chat-editing #klanz-global-chat > .r_r { width: 100%; height: 100%; padding: 0; background: none; }
  html.klanz-mobile-web body.mobile-chat-editing #klanz-global-chat .testtest-bg-bottom { height: 100%; }
  html.klanz-mobile-web body.mobile-chat-editing #klanz-global-chat .testtest-chat-tabs { grid-column: 1; }
  html.klanz-mobile-web body.mobile-chat-editing #mobile-chat-keyboard-close {
    display: flex; align-items: center; justify-content: center; grid-column: 2; grid-row: 1;
    width: 38px; height: 28px; min-height: 0; padding: 0; box-sizing: border-box;
    background: #343746; border: 1px solid #656275; color: #dfc994; font: 22px/1 Tahoma, sans-serif;
  }
  html.klanz-mobile-web #cbp-mobile-chat > .mobile-chat-heading { flex: 0 0 auto; }
  html.klanz-mobile-web #cbp-mobile-chat #klanz-global-chat { flex: 1 1 0; overflow: hidden; }
  html.klanz-mobile-web body.mobile-chat-keyboard-open #klanz-global-chat .testtest-bg-bottom { padding: 4px; gap: 4px; grid-template-rows: auto minmax(0, 1fr) 34px; }
  html.klanz-mobile-web body.mobile-chat-keyboard-open #klanz-global-chat .testtest-chat-tab-label { height: 26px; }
  html.klanz-mobile-web body.mobile-chat-keyboard-open #klanz-global-chat .testtest-chat-opponent { height: 18px; font-size: 10px; }
  html.klanz-mobile-web body.mobile-chat-keyboard-open #klanz-global-chat .testtest-chat-log { padding: 3px 6px; }
  html.klanz-mobile-web body.mobile-chat-keyboard-open #klanz-global-chat :is(.testtest-chat-msg-input, .testtest-send-btn) { height: 34px; }
  html.klanz-mobile-web body.mobile-chat-keyboard-open #klanz-global-chat .testtest-chat-msg-input { padding: 4px 6px; }
  html.klanz-mobile-web body.mobile-chat-keyboard-open #cbp-mobile-chat { top: var(--mobile-chat-editor-top); height: var(--mobile-chat-editor-height); }
  html.klanz-mobile-web body.mobile-battle-chat-writing .cbp-mobile-scale-host {
    position: fixed; margin: 0; left: var(--mobile-battle-writing-left);
    top: calc(var(--mobile-visible-top, 0px) + var(--mobile-battle-writing-top, 2px));
  }

  /* Landscape: compose first, then channels and history. Input remains accessible
     even when the OS overlays its keyboard without a VisualViewport resize. */
  html.klanz-mobile-web body.mobile-chat-input-first #klanz-global-chat .testtest-bg-bottom {
    grid-template-columns: minmax(0, 1fr) 38px 32px;
    grid-template-rows: 34px auto minmax(0, 1fr);
  }
  html.klanz-mobile-web body.mobile-chat-input-first #klanz-global-chat .testtest-chat-msg-input { grid-column: 1; grid-row: 1; }
  html.klanz-mobile-web body.mobile-chat-input-first #klanz-global-chat .testtest-send-btn { grid-column: 2; grid-row: 1; }
  html.klanz-mobile-web body.mobile-chat-input-first #klanz-global-chat .testtest-chat-tabs { grid-column: 1 / -1; grid-row: 2; }
  html.klanz-mobile-web body.mobile-chat-input-first #klanz-global-chat .testtest-chat-log { grid-column: 1 / -1; grid-row: 3; }
  html.klanz-mobile-web body.mobile-chat-input-first #mobile-chat-keyboard-close { grid-column: 3; grid-row: 1; width: 32px; height: 34px; background: none; border: 0; }
  html.klanz-mobile-web body.mobile-chat-input-first #cbp-mobile-chat > .mobile-chat-heading { position: absolute; top: 4px; right: 4px; z-index: 1; padding: 0; min-height: 0; }
  html.klanz-mobile-web body.mobile-chat-input-first #cbp-mobile-chat > .mobile-chat-heading > span { display: none; }
  html.klanz-mobile-web body.mobile-chat-input-first #cbp-chat-close { padding: 0; width: 32px; height: 34px; min-height: 0; }
  html.klanz-mobile-web body.mobile-chat-keyboard-tight #klanz-global-chat .testtest-bg-bottom { padding: 2px; gap: 2px; }
  html.klanz-mobile-web body.mobile-chat-keyboard-tight #klanz-global-chat .testtest-chat-tab-label { height: 22px; }
  html.klanz-mobile-web body.mobile-chat-keyboard-tight #klanz-global-chat .testtest-chat-log { padding: 0 4px; border: 0; }
  html.klanz-mobile-web body.mobile-chat-keyboard-tight #cbp-mobile-chat > .mobile-chat-heading { top: 2px; right: 2px; }
}

/* A portrait profile reads as one column, with the original player card intact. */
@media (max-width: 619px) and (orientation: portrait) and (pointer: coarse) {
  html.klanz-mobile-web .profile-head {
    display: grid; grid-template-columns: minmax(0, 1fr);
    gap: 8px; padding: 8px 0 12px;
  }
  html.klanz-mobile-web .profile-head h1 { font-size: 21px; line-height: 1.25; overflow-wrap: anywhere; }
  html.klanz-mobile-web .profile-search-wrap { margin: 0; }
  html.klanz-mobile-web .profile-search-input { width: 100%; max-width: 100%; }
  html.klanz-mobile-web .profile-layout > tbody > tr { display: block; }
  html.klanz-mobile-web .profile-layout > tbody > tr > :is(td:first-child, td:last-child) {
    display: block; width: 100% !important; min-width: 0;
  }
  html.klanz-mobile-web .profile-layout > tbody > tr > td:first-child { margin-bottom: 12px; }
  html.klanz-mobile-web .profile-layout > tbody > tr > td:first-child > div { margin-left: auto !important; margin-right: auto; }
  html.klanz-mobile-web .profile-layout .u_t { margin-bottom: 12px; }
  html.klanz-mobile-web .profile-layout .u_t td { padding: 5px 6px; line-height: 15px; }
  html.klanz-mobile-web .profile-layout .u_t:first-of-type .u_td_3 { width: 60%; }
  html.klanz-mobile-web .profile-layout .u_t:first-of-type .u_td_4 { width: 40%; }
  html.klanz-mobile-web .profile-layout .profile-guild-link { max-width: 100%; white-space: normal; }
  html.klanz-mobile-web .profile-layout .profile-guild-link img { flex: 0 0 13px; }
  html.klanz-mobile-web .profile-layout .profile-guild-link-text { min-width: 0; overflow-wrap: anywhere; }
  html.klanz-mobile-web .profile-layout :is(.profile-awards-grid, .profile-received-gifts) {
    display: grid; grid-template-columns: repeat(auto-fit, 72px); justify-content: center;
    gap: 8px; padding: 8px 0; box-sizing: border-box;
  }
}

/* The guild rating heading stays on one line, including the owner's roster. */
@media (max-width: 1024px) and (pointer: coarse) {
  html.klanz-mobile-web .guild-page .guild-table .col-rating { width: 52px; }
  html.klanz-mobile-web .guild-page .guild-table th.col-rating { white-space: nowrap; }
}

/* Past Arpada archive only; current-tournament standings keep their own layout. */
@media (max-width: 1024px) and (pointer: coarse) {
  html.klanz-mobile-web .drafts-page:has(.arpada-past-table) > .r_l > .r_r { padding-left: 20px; padding-right: 20px; }
  html.klanz-mobile-web .drafts-page .r_r > table.forum.arpada-past-table { width: 100%; margin-left: 0; margin-right: 0; table-layout: fixed; }
  html.klanz-mobile-web .arpada-past-table .line-cell { border-left: 0; }
  html.klanz-mobile-web .arpada-past-table .line-cell.mobile-full-separator::after { left: 0; right: 0; }
  html.klanz-mobile-web .arpada-past-table :is(.td_winner, .td_cards) { white-space: normal; overflow-wrap: break-word; }
  html.klanz-mobile-web .arpada-past-table .arpada-results-link { min-height: 34px; color: #ffca00; }
  html.klanz-mobile-web .arpada-past-pagination { box-sizing: border-box; padding: 0 10px; }
  html.klanz-mobile-web .arpada-past-pagination .pagination { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 2px 4px; }
  html.klanz-mobile-web .arpada-past-pagination .d_gray { display: none; }
  html.klanz-mobile-web .arpada-past-pagination .pagination > :not(.d_gray) { display: inline-flex; align-items: center; justify-content: center; box-sizing: border-box; min-width: 28px; min-height: 34px; padding: 0 4px; font-size: 12px; }
}
@media (max-width: 619px) and (orientation: portrait) and (pointer: coarse) {
  html.klanz-mobile-web .drafts-page:has(.arpada-past-table) .arpada-intro { padding: 6px 12px 10px; }
  html.klanz-mobile-web .drafts-page:has(.arpada-past-table) .arpada-intro h1 { margin: 0; font-size: 20px; line-height: 1.2; }
  html.klanz-mobile-web .drafts-page:has(.arpada-past-table) .arpada-hero { display: flow-root; padding: 0 12px 10px; }
  html.klanz-mobile-web .drafts-page:has(.arpada-past-table) .arpada-hero img.podium { float: left; width: 88px; height: auto; margin: 0 10px 5px 0; transform: none; }
  html.klanz-mobile-web .drafts-page:has(.arpada-past-table) .arpada-rules-text { margin: 0; padding: 0; line-height: 1.45; }
  html.klanz-mobile-web .drafts-page:has(.arpada-past-table) .arpada-nav-link { padding: 0 12px 10px; line-height: 1.7; }
  html.klanz-mobile-web table.forum.arpada-past-table { display: block; min-width: 0; }
  html.klanz-mobile-web .arpada-past-table > colgroup { display: none; }
  html.klanz-mobile-web .arpada-past-table > tbody { display: block; }
  html.klanz-mobile-web .arpada-past-table tr:has(> th),
  html.klanz-mobile-web .arpada-past-table tr:has(> th) + tr:has(.line-cell) { display: none; }
  html.klanz-mobile-web .arpada-past-table tr:has(.line-cell),
  html.klanz-mobile-web .arpada-past-table .line-cell { display: block; width: 100%; }
  html.klanz-mobile-web .arpada-past-table tr:has(> .td_num) {
    display: grid; grid-template-columns: max-content minmax(0, 1fr) auto;
    grid-template-areas: 'num date results' 'winner winner winner' 'cards cards cards';
    gap: 4px 8px; padding: 8px 12px 10px; border-bottom: 1px solid #1a191f;
  }
  html.klanz-mobile-web .arpada-past-table tr.dark { background: #242229; }
  html.klanz-mobile-web .arpada-past-table tr.light { background: #2e2b34; }
  html.klanz-mobile-web table.forum.arpada-past-table tr:has(> .td_num) > td {
    display: block; box-sizing: border-box; min-width: 0; width: auto; height: auto;
    padding: 0 !important; border: 0 !important; background: none !important;
    overflow: visible; overflow-wrap: normal; white-space: normal; line-height: 18px;
    font-size: 12px; text-align: left;
  }
  html.klanz-mobile-web .arpada-past-table .td_num { grid-area: num; align-self: center; color: #aaa4ae; }
  html.klanz-mobile-web .arpada-past-table .td_num::before { content: '#'; }
  html.klanz-mobile-web .arpada-past-table .td_date { grid-area: date; align-self: center; }
  html.klanz-mobile-web .arpada-past-table .td_date::before { content: 'Начало: '; color: #aaa4ae; font-weight: normal; font-size: 10px; }
  html.klanz-mobile-web .arpada-past-table .td_winner { grid-area: winner; }
  html.klanz-mobile-web .arpada-past-table .td_winner::before { content: 'Победитель: '; color: #aaa4ae; font-size: 11px; }
  html.klanz-mobile-web .arpada-past-table .arpada-winner-link { overflow-wrap: anywhere; }
  html.klanz-mobile-web .arpada-past-table .td_cards { grid-area: cards; }
  html.klanz-mobile-web .arpada-past-table .td_cards::before { content: 'Разыграны карты: '; color: #aaa4ae; font-size: 11px; }
  html.klanz-mobile-web .arpada-past-table .td_cards:not(:has(a))::before { content: 'Разыграны карты: —'; }
  html.klanz-mobile-web .arpada-past-table .td_cards a { overflow-wrap: anywhere; font-size: 12px; line-height: 19px; }
  html.klanz-mobile-web .arpada-past-table .td_results { grid-area: results; align-self: center; }
  html.klanz-mobile-web .arpada-past-table .arpada-results-link { gap: 2px; padding: 0 1px; }
  html.klanz-mobile-web .arpada-past-table .arpada-results-link::before { content: 'Результаты'; margin-right: 3px; font-size: 11px; }
  html.klanz-mobile-web .arpada-past-table .arpada-empty,
  html.klanz-mobile-web .arpada-past-table .arpada-empty > td { display: block; box-sizing: border-box; width: 100%; height: auto; }
  html.klanz-mobile-web .arpada-past-table .arpada-empty > td { padding: 20px 12px; line-height: 18px; }
  html.klanz-mobile-web .arpada-past-pagination .pagination > :is(:first-child, :last-child) { order: -1; flex: 0 0 calc(50% - 2px); }
}

/* Compact card filters: original controls and handlers, no individual option tiles. */
@media (max-width: 1024px) and (pointer: coarse) {
  html.klanz-mobile-web .collection-deck-stats { white-space: pre-line; line-height: 1.6; }

  /* The same compact link rows cover collection, market, trades, recipes and gifts. */
  html.klanz-mobile-web :is(.own-filters, .clan-filters):not(.hidden):not(.view-hidden),
  html.klanz-mobile-web .gift-filters > div {
    display: flex; flex-wrap: wrap; align-items: center; gap: 0 10px;
    margin: 0 0 5px; padding: 0; line-height: 16px;
  }
  html.klanz-mobile-web :is(.own-filters, .clan-filters) > .label,
  html.klanz-mobile-web .gift-filters > div > span {
    flex: 0 0 auto; width: auto; margin: 0; min-height: 26px; display: inline-flex;
    align-items: center; order: 0; color: #a7a5ad; font-size: 11px; line-height: 16px;
  }
  html.klanz-mobile-web :is(.own-filters, .clan-filters) > a,
  html.klanz-mobile-web .gift-filters > div > a {
    display: inline-flex; align-items: center; justify-content: flex-start; min-width: 24px;
    min-height: 26px; box-sizing: border-box; padding: 3px 0; margin: 0;
    color: #bdbac4; font-size: 11px; line-height: 16px; white-space: nowrap;
    text-align: left; text-decoration: none; background: none; border: 0;
  }
  html.klanz-mobile-web :is(.own-filters, .clan-filters) > a.active,
  html.klanz-mobile-web .gift-filters > div > a.active {
    color: #ffca00; background: none; border: 0; text-decoration: underline; text-underline-offset: 3px;
  }
  html.klanz-mobile-web :is(.own-filters, .clan-filters) > .sep,
  html.klanz-mobile-web .gift-filter-sep { display: none; }
  html.klanz-mobile-web .clan-filters > a[data-filter='reset'] { order: 0; color: #aaa6b0; }
  html.klanz-mobile-web :is(.col-name-search, .mkt-name-search) { flex: 0 0 100%; margin-top: 4px; }
  html.klanz-mobile-web .market-page .clan-filters-row { margin-bottom: 6px; }
  html.klanz-mobile-web .gift-filters { padding-top: 5px; padding-bottom: 5px; }

  html.klanz-mobile-web :is(.deckbuilder-page, .cards-page) { margin: 8px 4px 24px; min-width: 0; }
  html.klanz-mobile-web :is(.deckbuilder-page, .cards-page) > .clan {
    box-sizing: border-box; width: calc(100% + 24px); margin: 0 -12px;
    padding: 6px 12px; min-height: 0;
  }
  html.klanz-mobile-web :is(.deckbuilder-page, .cards-page) .clan-switches {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(30px, 1fr));
    gap: 3px; align-items: stretch; justify-content: stretch;
  }
  html.klanz-mobile-web :is(.deckbuilder-page, .cards-page) :is(.clan-switch, .clan-select-all) {
    display: flex; align-items: center; justify-content: center; min-width: 0; min-height: 32px;
    margin: 0; padding: 0; box-sizing: border-box;
  }
  html.klanz-mobile-web :is(.deckbuilder-page, .cards-page) .clan-select-all { gap: 3px; font-size: 10px; }
  html.klanz-mobile-web :is(#deck-filters, #cards-filters) { padding: 6px 8px; }
  html.klanz-mobile-web :is(#deck-filters, #cards-filters) .filters-grid { gap: 6px; }
  html.klanz-mobile-web :is(#deck-filters, #cards-filters) .bands {
    display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, .8fr) minmax(0, 1.4fr); gap: 8px;
  }
  html.klanz-mobile-web :is(#deck-filters, #cards-filters) .band { gap: 0; }
  html.klanz-mobile-web :is(#deck-filters, #cards-filters) .band-title {
    margin: 0; font-size: 10px; font-weight: normal; line-height: 16px; text-transform: none; color: #bbb8c1;
  }
  html.klanz-mobile-web :is(#deck-filters, #cards-filters) .row:has(input[type='number']) {
    display: grid; grid-template-columns: 32px minmax(0, 1fr) minmax(0, 1fr); gap: 5px; font-size: 11px;
  }
  html.klanz-mobile-web :is(#deck-filters, #cards-filters) .row:has(input[type='number']) label {
    display: grid; grid-template-columns: 15px minmax(0, 1fr); align-items: center; gap: 3px; min-width: 0;
  }
  html.klanz-mobile-web :is(#deck-filters, #cards-filters) input[type='number'] {
    box-sizing: border-box; width: 100%; min-width: 0; height: 28px; min-height: 28px; padding: 2px 4px; text-align: center;
  }
  html.klanz-mobile-web :is(#deck-filters, #cards-filters) .row:has(input[type='number']) + .row { margin-top: 2px; }
  html.klanz-mobile-web :is(#deck-filters, #cards-filters) :is(.row:has(.level-filter), .rarity-row, .col-star-plus-row),
  html.klanz-mobile-web .picker-attr-row {
    display: flex; flex-wrap: wrap; align-items: center; gap: 0 8px;
  }
  html.klanz-mobile-web :is(#deck-filters, #cards-filters) .band .chk,
  html.klanz-mobile-web .picker-attr-chk {
    display: inline-flex; align-items: center; justify-content: flex-start; gap: 3px; box-sizing: border-box;
    min-width: 24px; min-height: 24px; padding: 4px 0; margin: 0; border: 0;
    color: #ccc; background: none; font-size: 11px; line-height: 16px; white-space: nowrap;
  }
  html.klanz-mobile-web :is(#deck-filters, #cards-filters) .band .chk:has(input:checked),
  html.klanz-mobile-web .picker-attr-chk:has(input:checked) { color: #ffca00; }
  html.klanz-mobile-web :is(#deck-filters, #cards-filters, .picker-attr-filters) input:is([type='checkbox'], [type='radio']) {
    flex: 0 0 auto; margin: 0; width: 14px; height: 14px; accent-color: #ffca00;
  }
  html.klanz-mobile-web :is(#deck-filters, #cards-filters, .picker-attr-filters) .rdot { flex: 0 0 6px; width: 6px; height: 6px; margin: 0; }
  html.klanz-mobile-web :is(#deck-filters, #cards-filters) .kw-wrap { margin-top: 0; }
  html.klanz-mobile-web :is(#deck-filters, #cards-filters) .kw-panels { gap: 6px; }
  html.klanz-mobile-web :is(#deck-filters, #cards-filters) .kw-panel-head { padding: 3px 6px; }
  html.klanz-mobile-web :is(#deck-filters, #cards-filters) .kw-panel-title { font-size: 10px; line-height: 14px; }
  html.klanz-mobile-web :is(#deck-filters, #cards-filters) .kw-chip-grid {
    grid-template-columns: repeat(auto-fit, minmax(88px, 1fr)); gap: 0 6px; padding: 2px 6px;
  }
  html.klanz-mobile-web :is(#deck-filters, #cards-filters) .kw-chip {
    min-height: 24px; padding: 2px 0; gap: 4px; border: 0; border-radius: 0; background: none; box-shadow: none;
  }
  html.klanz-mobile-web :is(#deck-filters, #cards-filters) .kw-chip:has(input:checked) { border: 0; background: none; box-shadow: none; }
  html.klanz-mobile-web :is(#deck-filters, #cards-filters) .kw-chip-text {
    min-width: 0; font-size: 10px; line-height: 12px; word-break: normal; overflow-wrap: break-word;
  }
  html.klanz-mobile-web :is(#deck-filters, #cards-filters) .kw-chip:has(input:checked) .kw-chip-text { color: #ffca00; }
  html.klanz-mobile-web :is(#deck-filters, #cards-filters) .kw-key-mode-row {
    display: flex; flex-wrap: wrap; gap: 0 10px; padding: 2px 0; margin-top: 4px; border: 0; background: none;
  }
  html.klanz-mobile-web :is(#deck-filters, #cards-filters) .kw-key-mode-label { margin: 0; }
  html.klanz-mobile-web :is(#deck-filters, #cards-filters) .kw-key-mode-row .chk {
    min-height: 24px; padding: 4px 0; gap: 4px; font-size: 11px; line-height: 16px;
    white-space: nowrap; box-sizing: border-box;
  }
  html.klanz-mobile-web :is(.deckbuilder-page, .cards-page) .toolbar { gap: 6px; }
  html.klanz-mobile-web :is(.deckbuilder-page, .cards-page) .toolbar-right { min-width: 0; width: 100%; margin-left: 0; }
  html.klanz-mobile-web :is(.deckbuilder-page, .cards-page) .toolbar-right input[type='text'] { min-width: 0; max-width: none; width: 100%; flex: 1 1 0; }
  html.klanz-mobile-web :is(.deckbuilder-page, .cards-page) .toolbar-left-actions { gap: 5px; }
  html.klanz-mobile-web :is(.deckbuilder-page, .cards-page) :is(.reset-filters, .owned-filter) { min-height: 30px; padding: 3px 6px; }

  /* Retain the existing narrow frame fix on the counter-offer page. */
  html.klanz-mobile-web body:not(.page-cbp-battle) .ex-d > .r_r > :is(.r_h, .r_f) {
    width: 100%; max-width: 100%; margin-left: 0; margin-right: 0;
  }
  html.klanz-mobile-web .picker-attr-filters {
    container: klanz-card-attrs / inline-size; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 4px 10px; margin: 5px 0; padding: 4px 8px; border: 0;
  }
  html.klanz-mobile-web .picker-attr-band { min-width: 0; gap: 0; }
  html.klanz-mobile-web .picker-attr-title {
    margin: 0; color: #bbb8c1; font: normal 10px/16px Tahoma, Arial, sans-serif; text-transform: none;
  }
}
@media (max-width: 619px) and (pointer: coarse) {
  html.klanz-mobile-web :is(#deck-filters, #cards-filters) .bands { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  html.klanz-mobile-web :is(#deck-filters, #cards-filters) .band:has(.level-filter) {
    flex-direction: row; align-items: center; flex-wrap: wrap; gap: 0 8px;
  }
  html.klanz-mobile-web :is(#deck-filters, #cards-filters) .kw-panels { grid-template-columns: minmax(0, 1fr); }
  html.klanz-mobile-web :is(.deckbuilder-page, .cards-page) .toolbar-left { width: 100%; }
  html.klanz-mobile-web :is(.deckbuilder-page, .cards-page) .toolbar-left-actions { display: flex; flex-wrap: wrap; width: 100%; }
  html.klanz-mobile-web .picker-attr-filters { grid-template-columns: minmax(0, 1fr); }
  html.klanz-mobile-web .picker-attr-band:first-child { flex-direction: row; align-items: center; flex-wrap: wrap; gap: 0 8px; }
  @container klanz-card-attrs (max-width: 240px) {
    html.klanz-mobile-web .picker-attr-row.rarity-row { column-gap: 10px; }
    html.klanz-mobile-web .picker-attr-row.rarity-row > label { flex: 0 0 calc(50% - 5px); }
  }
}
@media (max-width: 359px) and (pointer: coarse) {
  html.klanz-mobile-web :is(#deck-filters, #cards-filters) .rarity-row > .chk { flex: 0 0 calc(50% - 4px); }
}

/* Keep the right edge around the last child's margin after mobile removes floats.
   Low specificity deliberately preserves page layouts such as the gift flex column. */
@media (max-width: 1024px) and (pointer: coarse) {
  :where(html.klanz-mobile-web body:not(.page-cbp-battle) .r_l) > .r_r {
    display: flow-root;
  }

  /* r_h/r_f are scaled from 792px. Scale the matching 264px connector tile
     and its original 114px offset by the same factor; keep its 23px height. */
  html.klanz-mobile-web body:not(.page-cbp-battle) .r_s {
    background-size: 33.333333% 23px;
    background-position: 21.590909% 0;
  }

  /* The home column uses 441px caps, with connectors starting at x=80px.
     Position the tile against the full cap width instead of an 80px margin. */
  html.klanz-mobile-web body:not(.page-cbp-battle) .main2-connector {
    width: 100%; max-width: 100%; margin-left: 0;
    background-size: 59.863946% 23px;
    background-position: 45.197740% 0;
  }
}

/* Portrait phones: crop the middle of the original caps, keeping both ends
   at native size. Inherit the image so page-specific frame artwork survives.
   The tournament canvas already has its own native-size cap treatment. */
@media (max-width: 619px) and (orientation: portrait) and (pointer: coarse) {
  html.klanz-mobile-web body:not(.page-cbp-battle) :is(.r_h, .r_f, .r_s):not(.double-cup *) {
    background-size: 0 0;
    pointer-events: none;
  }
  html.klanz-mobile-web body:not(.page-cbp-battle) .r_s { position: relative; }
  html.klanz-mobile-web body:not(.page-cbp-battle) :is(.r_h, .r_f, .r_s):not(.double-cup *)::before,
  html.klanz-mobile-web body:not(.page-cbp-battle) :is(.r_h, .r_f, .r_s):not(.double-cup *)::after {
    content: '';
    position: absolute;
    top: 0;
    width: 50%;
    height: 100%;
    background-image: inherit;
    background-size: auto 100%;
    background-repeat: no-repeat;
    pointer-events: none;
  }
  html.klanz-mobile-web body:not(.page-cbp-battle) :is(.r_h, .r_f, .r_s):not(.double-cup *)::before {
    left: 0;
    background-position: left center;
  }
  html.klanz-mobile-web body:not(.page-cbp-battle) :is(.r_h, .r_f, .r_s):not(.double-cup *)::after {
    right: 0;
    background-position: right center;
  }
  /* Match the same crop in the 792px frame's connecting cables (264px tile,
     114px original offset), so they still meet the caps' mounting points. */
  html.klanz-mobile-web body:not(.page-cbp-battle) .r_s:not(.double-cup *)::before,
  html.klanz-mobile-web body:not(.page-cbp-battle) .r_s:not(.double-cup *)::after {
    background-size: 264px 23px;
    background-repeat: repeat-x;
  }
  html.klanz-mobile-web body:not(.page-cbp-battle) .r_s:not(.double-cup *)::before { background-position: 114px 0; }
  html.klanz-mobile-web body:not(.page-cbp-battle) .r_s:not(.double-cup *)::after { background-position: calc(100% + 114px) 0; }
}

/* Clan pages render .card directly, while collection/deck pages use .card-block. */
@media (max-width: 1024px) and (pointer: coarse) {
  html.klanz-mobile-web div.cards:not(.clans2-index-mode) > .card {
    zoom: var(--mobile-card-scale, 1);
    justify-self: center;
  }
}

/* /referrals — portrait: 2 invitee cards per row; stats fill width. */
@media (max-width: 619px) and (orientation: portrait) and (pointer: coarse) {
  html.klanz-mobile-web .referrals-page .ref-h1,
  html.klanz-mobile-web .referrals-page .ref-lead,
  html.klanz-mobile-web .referrals-page .ref-form,
  html.klanz-mobile-web .referrals-page .ref-section-title,
  html.klanz-mobile-web .referrals-page .ref-hint {
    margin-left: 0;
    margin-right: 0;
  }
  html.klanz-mobile-web .referrals-page .r_r {
    padding-left: 12px;
    padding-right: 12px;
  }
  html.klanz-mobile-web .referrals-page .ref-link-row {
    flex-wrap: wrap;
    max-width: 100%;
  }
  html.klanz-mobile-web .referrals-page .ref-link-row .ref-text-input {
    width: 100%;
    flex: 1 1 100%;
  }
  html.klanz-mobile-web .referrals-page .ref-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1px;
    margin: 14px 0 0;
    max-width: none;
    width: 100%;
    box-sizing: border-box;
  }
  html.klanz-mobile-web .referrals-page .ref-stat {
    flex: none;
    min-width: 0;
    width: auto;
  }
  /* 3 tiles: top pair + full-width bottom — no empty 4th cell */
  html.klanz-mobile-web .referrals-page .ref-stat:last-child {
    grid-column: 1 / -1;
  }
  html.klanz-mobile-web .referrals-page table.forum.klanz-list-table {
    display: block;
    width: 100%;
    min-width: 0;
    margin: 0 0 10px;
  }
  html.klanz-mobile-web .referrals-page .klanz-list-table > tbody {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
  }
  html.klanz-mobile-web .referrals-page .klanz-list-table tr:has(> th),
  html.klanz-mobile-web .referrals-page .klanz-list-table tr.line-row {
    display: none;
  }
  html.klanz-mobile-web .referrals-page .klanz-list-table tr:has(> .td_main) {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "login lvl"
      "date date"
      "status status"
      "donate donate";
    gap: 3px 6px;
    align-content: start;
    min-width: 0;
    box-sizing: border-box;
    padding: 8px 8px 9px;
    border: 1px solid #38373d;
  }
  /* Same fill for every card — no desktop dark/light chessboard in portrait. */
  html.klanz-mobile-web .referrals-page .klanz-list-table tr:has(> .td_main),
  html.klanz-mobile-web .referrals-page .klanz-list-table tr.dark,
  html.klanz-mobile-web .referrals-page .klanz-list-table tr.light {
    background: #27262d;
  }
  html.klanz-mobile-web .referrals-page table.forum.klanz-list-table tr:has(> .td_main) > td {
    display: block;
    box-sizing: border-box;
    min-width: 0;
    width: auto;
    height: auto;
    padding: 0 !important;
    border: 0 !important;
    background: none !important;
    overflow: visible;
    overflow-wrap: anywhere;
    white-space: normal;
    line-height: 15px;
    font-size: 11px;
    text-align: left;
  }
  html.klanz-mobile-web .referrals-page .klanz-list-table .td_main {
    grid-area: login;
    align-self: start;
  }
  html.klanz-mobile-web .referrals-page .klanz-list-table .td_main a.forum_user {
    overflow-wrap: anywhere;
    word-break: break-word;
    font-size: 11px;
    line-height: 14px;
  }
  html.klanz-mobile-web .referrals-page .klanz-list-table .td_num {
    grid-area: lvl;
    align-self: start;
    justify-self: end;
    text-align: right;
    white-space: nowrap;
    overflow-wrap: normal;
    font-size: 11px;
  }
  html.klanz-mobile-web .referrals-page .klanz-list-table .td_num::after {
    content: " ур.";
    color: #9a96a0;
    font-weight: normal;
    font-size: 9px;
  }
  html.klanz-mobile-web .referrals-page .klanz-list-table .td_date {
    grid-area: date;
    color: #9a96a0;
    font-size: 10px;
    line-height: 13px;
  }
  html.klanz-mobile-web .referrals-page .klanz-list-table .td_date::before {
    content: "Рег.: ";
    color: #aaa4ae;
    font-size: 9px;
  }
  html.klanz-mobile-web .referrals-page .klanz-list-table .td_status {
    grid-area: status;
    font-size: 10px;
    line-height: 13px;
  }
  html.klanz-mobile-web .referrals-page .klanz-list-table .td_status::before {
    content: "Ур.: ";
    color: #aaa4ae;
    font-size: 9px;
  }
  html.klanz-mobile-web .referrals-page .klanz-list-table tr:has(> .td_main) > .td_num:last-child {
    grid-area: donate;
    justify-self: start;
    text-align: left;
    font-size: 10px;
  }
  html.klanz-mobile-web .referrals-page .klanz-list-table tr:has(> .td_main) > .td_num:last-child::before {
    content: "%: ";
    color: #aaa4ae;
    font-weight: normal;
    font-size: 9px;
  }
  html.klanz-mobile-web .referrals-page .klanz-list-table tr:has(> .td_main) > .td_num:last-child::after {
    content: none;
  }
  html.klanz-mobile-web .referrals-page .klanz-list-table .klanz-list-empty {
    grid-column: 1 / -1;
    display: block;
  }
  html.klanz-mobile-web .referrals-page .klanz-list-table .klanz-list-empty > td {
    display: block;
    box-sizing: border-box;
    width: 100%;
    height: auto;
    padding: 20px 12px;
    line-height: 18px;
  }
}

/* FAQ hub currencies — portrait only: 3 rows instead of 3 columns */
@media (max-width: 619px) and (orientation: portrait) and (pointer: coarse) {
  html.klanz-mobile-web .faq-cur-table,
  html.klanz-mobile-web .faq-cur-table tbody,
  html.klanz-mobile-web .faq-cur-table tr {
    display: block;
    width: 100%;
  }
  html.klanz-mobile-web .faq-cur-table {
    border-spacing: 0;
    margin: 0 0 8px;
  }
  html.klanz-mobile-web .faq-cur-cell {
    display: block;
    width: 100% !important;
    box-sizing: border-box;
    margin: 0 0 8px;
  }
  html.klanz-mobile-web .faq-cur-cell:last-child { margin-bottom: 0; }

  /* FAQ draft/sealed/cascade rating tables — denser scrollable matrix */
  html.klanz-mobile-web .faq-page .faq-dp-rating-table {
    font-size: 10px;
  }
  html.klanz-mobile-web .faq-page .faq-dp-rating-table :is(th, td) {
    padding: 5px 6px;
    font-size: 10px;
  }
}

/* /draft_rating — portrait: card per place (grid, not fragile inline tds) */
@media (max-width: 619px) and (orientation: portrait) and (pointer: coarse) {
  html.klanz-mobile-web .drafts-page:has(.draft-rating-table) .draft-rating-intro {
    padding: 4px 0 8px;
  }
  html.klanz-mobile-web .drafts-page:has(.draft-rating-table) .draft-rating-intro h1 {
    font-size: 20px;
    line-height: 1.2;
  }
  html.klanz-mobile-web .drafts-page:has(.draft-rating-table) .draft-rating-tabs {
    font-size: 12px;
    line-height: 1.5;
  }
  html.klanz-mobile-web table.forum.draft-rating-table {
    display: block;
    width: 100% !important;
    min-width: 0;
    margin: 0 0 12px;
    table-layout: auto;
  }
  html.klanz-mobile-web .draft-rating-table > tbody {
    display: block;
  }
  html.klanz-mobile-web .draft-rating-table tr:has(> th),
  html.klanz-mobile-web .draft-rating-table tr:has(> .line-cell) {
    display: none;
  }
  html.klanz-mobile-web .draft-rating-table tr:has(> .td_rank) {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    column-gap: 6px;
    row-gap: 4px;
    box-sizing: border-box;
    min-width: 0;
    padding: 10px 10px 11px;
    border-bottom: 1px solid #1a191f;
    font-size: 12px;
    line-height: 17px;
  }
  html.klanz-mobile-web .draft-rating-table tr:has(> .td_rank),
  html.klanz-mobile-web .draft-rating-table tr.dark,
  html.klanz-mobile-web .draft-rating-table tr.light {
    background: #27262d;
  }
  html.klanz-mobile-web .draft-rating-table tr.draft-rating-row--mine {
    background: #4e3150;
  }
  html.klanz-mobile-web table.forum.draft-rating-table tr:has(> .td_rank) > td {
    display: block;
    box-sizing: border-box;
    width: auto !important;
    height: auto;
    padding: 0 !important;
    margin: 0 !important;
    border: 0 !important;
    background: none !important;
    white-space: normal !important;
    text-align: left;
    font-size: 12px;
    line-height: 17px;
  }
  html.klanz-mobile-web .draft-rating-table .td_rank {
    flex: 0 0 auto;
    color: #9a96a0;
    font-size: 11px;
  }
  html.klanz-mobile-web .draft-rating-table .td_rank::before { content: "#"; }
  html.klanz-mobile-web .draft-rating-table .td_name {
    flex: 1 1 auto;
    min-width: 0;
  }
  html.klanz-mobile-web .draft-rating-table .td_name a.forum_user {
    font-size: 13px;
    line-height: 17px;
    overflow-wrap: anywhere;
  }
  html.klanz-mobile-web .draft-rating-table .td_guild {
    flex: 1 1 100%;
    min-width: 0;
  }
  html.klanz-mobile-web .draft-rating-table .td_guild:not(:has(a)) {
    display: none;
  }
  html.klanz-mobile-web .draft-rating-table .td_guild a {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: normal;
    overflow-wrap: anywhere;
  }
  html.klanz-mobile-web .draft-rating-table .td_guild a img {
    flex: 0 0 auto;
  }
  html.klanz-mobile-web .draft-rating-table .td_rating,
  html.klanz-mobile-web .draft-rating-table .td_part,
  html.klanz-mobile-web .draft-rating-table .td_chatls {
    flex: 0 1 auto;
  }
  html.klanz-mobile-web .draft-rating-table .td_rating {
    color: #ffca00;
    font-weight: bold;
  }
  html.klanz-mobile-web .draft-rating-table .td_rating::before {
    content: "рейтинг ";
    color: #aaa4ae;
    font-weight: normal;
    font-size: 11px;
  }
  html.klanz-mobile-web .draft-rating-table .td_part::before {
    content: " | участий ";
    color: #aaa4ae;
    font-weight: normal;
    font-size: 11px;
  }
  html.klanz-mobile-web .draft-rating-table .td_chatls:not(:empty)::before {
    content: " | чатлов ";
    color: #aaa4ae;
    font-weight: normal;
    font-size: 11px;
  }
  html.klanz-mobile-web .draft-rating-table .td_chatls:empty {
    display: none !important;
  }
  html.klanz-mobile-web .draft-rating-table .td_chatls img {
    margin-left: 2px;
    vertical-align: -2px;
  }
  html.klanz-mobile-web .draft-rating-table .draft-rating-empty {
    display: block;
  }
  html.klanz-mobile-web .draft-rating-table .draft-rating-empty > td {
    display: block;
    box-sizing: border-box;
    width: 100%;
    height: auto;
    padding: 20px 12px;
    line-height: 18px;
    border: 0;
  }
}

/* /user_settings — portrait: desktop 320px label cols overflow the frame */
@media (max-width: 619px) and (orientation: portrait) and (pointer: coarse) {
  html.klanz-mobile-web .settings-wrap {
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    padding: 14px 8px;
    overflow-x: hidden;
  }
  html.klanz-mobile-web .settings-row {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    min-width: 0;
  }
  html.klanz-mobile-web .settings-row label {
    display: block;
    min-width: 0;
    width: auto;
  }
  html.klanz-mobile-web .settings-row input {
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
  }
  html.klanz-mobile-web .settings-toggle-row {
    grid-template-columns: minmax(0, 1fr) 44px 28px;
    column-gap: 8px;
    min-width: 0;
  }
  html.klanz-mobile-web .settings-choice-row {
    grid-template-columns: 1fr;
    row-gap: 6px;
    min-width: 0;
  }
  html.klanz-mobile-web .settings-choice-opts {
    min-width: 0;
  }
  html.klanz-mobile-web .settings-choice-opts label {
    min-width: 0;
    white-space: normal;
  }
  html.klanz-mobile-web .settings-draft-push-hint {
    padding-left: 0;
    max-width: 100%;
  }
  html.klanz-mobile-web .settings-flash {
    box-sizing: border-box;
    max-width: 100%;
  }
}

/* /tournament/clan-ban-vote — portrait: 3×200px illu overflow the frame.
 * Never overflow-hidden on .r_l — it clips absolute .r_h (top:-19px).
 * r_h sprite bottom is transparent; seal the pink hairline under the gold rod. */
@media (max-width: 619px) and (orientation: portrait) and (pointer: coarse) {
  html.klanz-mobile-web body:not(.page-cbp-battle) .cbv-page.r_l {
    max-width: 100%;
    overflow: visible;
    box-shadow: 0 -3px 0 0 #27262d;
  }
  html.klanz-mobile-web body:not(.page-cbp-battle) .cbv-page > .r_h {
    top: -19px;
    height: 22px;
    background-size: 100% 22px;
    background-position: bottom;
  }
  html.klanz-mobile-web body:not(.page-cbp-battle) .cbv-page > .r_r {
    padding-left: 21px !important;
    padding-right: 21px !important;
    box-sizing: border-box;
    max-width: 100%;
  }
  html.klanz-mobile-web .cbv-page h1 {
    margin: 10px 0 0;
    font-size: 20px;
    line-height: 1.2;
  }
  html.klanz-mobile-web .cbv-page .cbv-intro {
    margin: 0 0 8px;
    font-size: 12px;
  }
  html.klanz-mobile-web .cbv-page .cbv-toolbar {
    flex-wrap: wrap;
    gap: 10px;
    margin: 10px 0 4px;
  }
  html.klanz-mobile-web .cbv-page .arpada-nav-link {
    margin: 0 0 10px;
  }
  html.klanz-mobile-web .cbv-page .cbv-deck {
    margin: 8px 0 12px;
    max-width: 100%;
    overflow: hidden;
    box-sizing: border-box;
  }
  html.klanz-mobile-web .cbv-page .cbv-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    column-gap: 8px;
    margin: 0 0 10px;
    min-width: 0;
  }
  html.klanz-mobile-web .cbv-page .cbv-item {
    min-width: 0;
    max-width: 100%;
  }
  html.klanz-mobile-web .cbv-page .cbv-item img.cbv-illu {
    width: 100%;
    max-width: 100%;
    height: auto;
  }
  html.klanz-mobile-web .cbv-page .cbv-item .cbv-x {
    width: 36px;
    height: 36px;
    margin: -18px 0 0 -18px;
  }
  html.klanz-mobile-web .cbv-page .line {
    margin: 8px 0;
  }
}

/* /post_boxes — portrait: letter cards instead of 5 crushed columns */
@media (max-width: 619px) and (orientation: portrait) and (pointer: coarse) {
  html.klanz-mobile-web .post-header {
    margin: 12px 4px 8px;
    font-size: 22px;
    line-height: 1.2;
  }
  html.klanz-mobile-web .post-filters {
    margin: 0 4px 8px;
    font-size: 13px;
    line-height: 1.6;
  }
  html.klanz-mobile-web .post-actions {
    margin: 10px 4px;
    gap: 8px;
    flex-wrap: wrap;
  }
  html.klanz-mobile-web .post-actions .pages {
    padding-right: 0;
  }
  html.klanz-mobile-web .mail-table {
    display: block;
    width: 100%;
    max-width: 100%;
    table-layout: auto;
    margin: 0;
  }
  html.klanz-mobile-web .mail-table > thead { display: none; }
  html.klanz-mobile-web .mail-table > tbody { display: block; width: 100%; }
  html.klanz-mobile-web .mail-table tr:has(> .line-cell) { display: none; }
  html.klanz-mobile-web .mail-table tr.mail-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-areas:
      "topic topic"
      "from to"
      "time actions";
    column-gap: 10px;
    row-gap: 5px;
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    padding: 11px 12px 12px;
    border-bottom: 1px solid #1a191f;
  }
  html.klanz-mobile-web .mail-table tr.mail-row.light,
  html.klanz-mobile-web .mail-table tr.mail-row.dark {
    background: #27262d;
  }
  html.klanz-mobile-web .mail-table tr.mail-row.light { background: #2e2b34; }
  html.klanz-mobile-web .mail-table tr.mail-row > td {
    display: block;
    box-sizing: border-box;
    width: auto !important;
    height: auto !important;
    min-width: 0;
    margin: 0;
    padding: 0 !important;
    border: 0 !important;
    background: none !important;
    text-align: left !important;
    overflow-wrap: break-word;
    word-break: normal;
    white-space: normal;
    font-size: 12px;
    line-height: 16px;
    color: #ddd;
  }
  html.klanz-mobile-web .mail-table .mail-cell-topic { grid-area: topic; }
  html.klanz-mobile-web .mail-table .mail-cell-topic .topic-link {
    display: inline;
    font-size: 13px;
    line-height: 18px;
    overflow-wrap: anywhere;
  }
  html.klanz-mobile-web .mail-table .mail-cell-from { grid-area: from; }
  html.klanz-mobile-web .mail-table .mail-cell-to { grid-area: to; }
  html.klanz-mobile-web .mail-table .mail-cell-from::before,
  html.klanz-mobile-web .mail-table .mail-cell-to::before {
    color: #9a96a0;
    font-weight: normal;
  }
  html.klanz-mobile-web .mail-table .mail-cell-from::before { content: "От "; }
  html.klanz-mobile-web .mail-table .mail-cell-to::before { content: "Кому "; }
  /* Inbox: you are always the receiver. Sent: you are always the sender. */
  html.klanz-mobile-web .r_r:has(.post-filters a.active[href="/post_boxes/inbox"]) .mail-table tr.mail-row {
    grid-template-areas:
      "topic topic"
      "from from"
      "time actions";
  }
  html.klanz-mobile-web .r_r:has(.post-filters a.active[href="/post_boxes/inbox"]) .mail-table .mail-cell-to {
    display: none !important;
  }
  html.klanz-mobile-web .r_r:has(.post-filters a.active[href="/post_boxes/sent"]) .mail-table tr.mail-row {
    grid-template-areas:
      "topic topic"
      "to to"
      "time actions";
  }
  html.klanz-mobile-web .r_r:has(.post-filters a.active[href="/post_boxes/sent"]) .mail-table .mail-cell-from {
    display: none !important;
  }
  html.klanz-mobile-web .mail-table .mail-cell-time {
    grid-area: time;
    align-self: center;
    color: #b9b5bd;
    font-size: 11px;
    line-height: 15px;
    white-space: nowrap;
  }
  html.klanz-mobile-web .mail-table .mail-cell-actions {
    grid-area: actions;
    align-self: center;
    text-align: right !important;
  }
  html.klanz-mobile-web .mail-table .mail-cell-actions .delete-btn {
    min-height: 32px;
    padding: 4px 2px;
    font-size: 12px;
  }
  html.klanz-mobile-web .mail-table tr.empty-row {
    display: block;
    padding: 16px 12px;
    text-align: center;
    background: #27262d;
  }
  html.klanz-mobile-web .mail-table tr.empty-row > td {
    display: block;
    width: auto !important;
    border: 0 !important;
    padding: 0 !important;
    text-align: center !important;
  }
}
