/* V36.34.14 — layout mobile nativo para Chrome/Android.
   Esta folha é carregada depois de styles.css e substitui o antigo sistema de
   escala. A viewport real decide o espaço; conteúdo excedente rola. */

@media (orientation: landscape) and (max-height: 700px) {
  html,
  body,
  .app-shell,
  .game-frame {
    width: 100%;
    height: 100%;
    height: 100dvh;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
  }

  .menu-overlay {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: stretch;
    padding:
      max(3px, env(safe-area-inset-top))
      max(3px, env(safe-area-inset-right))
      max(3px, env(safe-area-inset-bottom))
      max(3px, env(safe-area-inset-left));
    overflow: hidden !important;
    touch-action: pan-y !important;
  }

  .menu-overlay > .game-menu-window,
  .menu-overlay > .menu-window {
    display: block;
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    min-width: 0;
    min-height: 0;
    padding: 4px;
    overflow: hidden !important;
    border-radius: 9px;
  }

  /* Todas as páginas comuns usam o tamanho real da viewport. O conteúdo nunca
     é reduzido por transform e sempre permanece alcançável por rolagem. */
  .game-menu-window > .menu-page:not([hidden]) {
    box-sizing: border-box;
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    max-height: 100% !important;
    min-width: 0 !important;
    min-height: 0 !important;
    padding: 3px 6px 8px 44px !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    overscroll-behavior: contain !important;
    touch-action: pan-y !important;
    scrollbar-width: thin !important;
    -webkit-overflow-scrolling: touch;
    transform: none !important;
  }

  .menu-page--scroll-fallback:not([hidden]) {
    overflow-y: auto !important;
  }

  .menu-back-button {
    position: absolute !important;
    z-index: 80;
    top: max(7px, env(safe-area-inset-top));
    left: max(7px, env(safe-area-inset-left));
    width: 34px;
    height: 34px;
    min-height: 34px !important;
    border-radius: 8px;
    font-size: 1.4rem;
  }

  .game-menu-window > .menu-page:not([hidden]) button,
  .game-menu-window > .menu-page:not([hidden]) input,
  .game-menu-window > .menu-page:not([hidden]) select,
  .game-menu-window > .menu-page:not([hidden]) textarea {
    box-sizing: border-box;
    min-height: 32px;
  }

  .menu-title-block,
  .menu-page > h2 {
    margin: 0 0 5px !important;
  }

  .menu-tile-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
  }

  .menu-tile {
    min-height: 58px;
    padding: 6px 8px;
  }

  /* Mercado: cabeçalho e ações de venda ficam fixos. Compra e mochila rolam
     dentro das próprias colunas, sem cortar botões no fim dos cards. */
  .game-menu-window > .merchant-page:not([hidden]) {
    display: grid !important;
    grid-template-rows: auto auto minmax(0, 1fr);
    gap: 5px;
    overflow: hidden !important;
    touch-action: manipulation !important;
  }

  .merchant-page > h2 {
    min-height: 25px;
    font-size: clamp(.9rem, 3.6vmin, 1.2rem);
    text-align: center;
  }

  .merchant-scroll-controls {
    position: static !important;
    z-index: auto;
    display: grid !important;
    grid-template-columns: minmax(82px, auto) minmax(100px, 1fr) minmax(82px, auto);
    align-items: center;
    gap: 5px;
    margin: 0 !important;
    padding: 3px 5px;
    border: 1px solid rgba(255, 226, 122, .28);
    border-radius: 7px;
    background: rgba(5, 13, 18, .96);
  }

  .merchant-scroll-controls button {
    min-height: 30px !important;
    padding: 3px 7px;
    touch-action: manipulation !important;
  }

  .merchant-scroll-controls span {
    overflow: hidden;
    font-size: .63rem;
    text-align: center;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .merchant-layout {
    display: grid !important;
    grid-template-columns: minmax(0, 1.28fr) minmax(250px, .72fr) !important;
    align-items: stretch !important;
    gap: 6px !important;
    width: 100%;
    height: 100% !important;
    min-width: 0 !important;
    min-height: 0 !important;
    overflow: hidden !important;
  }

  .merchant-buy-panel,
  .merchant-sell-panel {
    display: flex !important;
    flex-direction: column;
    width: 100%;
    height: 100%;
    min-width: 0 !important;
    min-height: 0 !important;
    padding: 5px !important;
    overflow: hidden !important;
  }

  .merchant-heading,
  .merchant-buy-panel > h3,
  .merchant-sell-panel > h3,
  .merchant-selection {
    flex: 0 0 auto;
  }

  .merchant-heading,
  .merchant-buy-panel > h3,
  .merchant-sell-panel > h3 {
    min-height: 21px;
    margin: 0 0 4px !important;
  }

  .game-menu-window .merchant-buy-grid,
  .game-menu-window .merchant-sell-grid {
    flex: 1 1 0;
    width: 100%;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    padding: 1px 4px 5px 1px;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    overscroll-behavior: contain !important;
    touch-action: pan-y !important;
    scrollbar-width: thin !important;
    -webkit-overflow-scrolling: touch;
  }

  .merchant-buy-grid {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    grid-auto-rows: max-content !important;
    align-content: start !important;
    gap: 5px !important;
  }

  .merchant-product {
    display: grid !important;
    grid-template-columns: 28px minmax(0, 1fr) !important;
    grid-template-rows: auto auto !important;
    min-width: 0 !important;
    min-height: 0 !important;
    height: auto !important;
    padding: 5px 6px !important;
    gap: 3px 5px !important;
    overflow: visible !important;
  }

  .merchant-product > .inventory-item-icon {
    width: 27px !important;
    height: 27px !important;
  }

  .merchant-product > span:nth-child(2) b {
    font-size: .67rem !important;
    line-height: 1.08;
  }

  .merchant-product small {
    font-size: .56rem !important;
    line-height: 1.13;
  }

  .merchant-buy-actions {
    grid-column: 1 / -1;
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 3px !important;
    width: 100%;
  }

  .merchant-buy-actions button {
    display: block !important;
    visibility: visible !important;
    min-width: 0 !important;
    min-height: 30px !important;
    padding: 3px 4px !important;
    font-size: .59rem !important;
    line-height: 1.05;
    white-space: normal !important;
    opacity: 1;
  }

  .merchant-sell-grid {
    display: grid !important;
    grid-template-columns: repeat(5, minmax(42px, 1fr)) !important;
    grid-auto-rows: 48px !important;
    align-content: start !important;
    gap: 4px !important;
  }

  .merchant-sell-slot {
    min-width: 0 !important;
    min-height: 44px !important;
    height: 48px !important;
  }

  .merchant-selection {
    display: grid !important;
    min-height: 62px !important;
    max-height: 92px;
    margin: 4px 0 0 !important;
    padding: 5px !important;
    overflow-y: auto;
    gap: 3px !important;
  }

  .merchant-selection strong { font-size: .67rem; }
  .merchant-selection small { font-size: .56rem; line-height: 1.12; }

  .merchant-sell-actions {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px;
  }

  .merchant-sell-actions > button:not([hidden]) {
    display: block !important;
    visibility: visible !important;
    min-height: 30px !important;
  }

  /* Inventário, banco, forja, status e páginas de conta usam rolagem de página
     como fallback. Nenhuma ação fica fora de alcance. */
  .inventory-layout-v16,
  .bank-layout,
  .blacksmith-layout,
  .account-layout--compact {
    min-width: 0 !important;
    min-height: 0 !important;
    gap: 6px !important;
  }

  .inventory-layout-v16 {
    grid-template-columns: minmax(205px, .9fr) minmax(215px, 1fr) minmax(170px, .72fr) !important;
  }

  .inventory-layout-v16 .inventory-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 4px;
  }

  .equipment-panel,
  .backpack-panel,
  .inventory-details,
  .settings-card,
  .status-card,
  .attribute-panel,
  .attribute-summary,
  .account-card,
  .credits-card {
    padding: 6px !important;
  }

  .bank-page,
  .blacksmith-page {
    overflow-y: auto !important;
  }

  .bank-layout { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .bank-grid { max-height: 42dvh !important; overflow-y: auto !important; }

  .blacksmith-layout {
    grid-template-columns: minmax(0, 1.05fr) minmax(280px, .95fr) !important;
  }

  .blacksmith-equipment-grid,
  .blacksmith-recipe-grid {
    max-height: 45dvh !important;
    overflow-y: auto !important;
  }

  .account-layout--compact { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }

  .admin-inventory-page:not([hidden]) {
    overflow: hidden !important;
  }

  .admin-inventory-content,
  .admin-inventory-grid,
  .admin-inventory-categories,
  .chat-messages {
    min-height: 0 !important;
    overflow-y: auto !important;
    overscroll-behavior: contain;
  }

  .login-overlay,
  .class-selection-overlay {
    padding: max(4px, env(safe-area-inset-top)) max(5px, env(safe-area-inset-right)) max(4px, env(safe-area-inset-bottom)) max(5px, env(safe-area-inset-left));
    overflow-y: auto !important;
    overscroll-behavior: contain;
  }

  .login-card,
  .class-selection-window {
    max-height: calc(100dvh - 8px) !important;
    overflow-y: auto !important;
  }

  .npc-dialogue__card {
    width: min(900px, 96vw);
    max-height: min(72dvh, 320px);
  }

  .npc-dialogue__choices {
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  }
}

@media (orientation: landscape) and (max-height: 700px) and (max-width: 760px) {
  .merchant-layout {
    grid-template-columns: minmax(0, 1.18fr) minmax(210px, .82fr) !important;
  }
  .merchant-buy-grid { grid-template-columns: 1fr !important; }
  .merchant-product .merchant-product-effect { display: none; }
  .merchant-sell-grid { grid-template-columns: repeat(4, minmax(38px, 1fr)) !important; }
  .inventory-layout-v16 { grid-template-columns: minmax(180px, .9fr) minmax(190px, 1fr) minmax(145px, .7fr) !important; }
}

/* V36.34.15 — Mercado inteiro na tela, sem paginação ou rolagem.
   A vitrine comporta os dez produtos possíveis em 2×5; a venda comporta os
   quarenta espaços do inventário em 7×6 (ou 6×7 nas telas mais estreitas). */
@media (orientation: landscape) and (max-height: 700px) {
  .game-menu-window > .merchant-page:not([hidden]) {
    display: grid !important;
    grid-template-rows: auto minmax(0, 1fr) !important;
    gap: 3px !important;
    overflow: hidden !important;
    touch-action: manipulation !important;
  }
  .merchant-scroll-controls { display: none !important; }
  .merchant-page > h2 {
    overflow: hidden;
    min-height: 20px;
    margin: 0 !important;
    font-size: clamp(.82rem, 3.2vmin, 1.08rem);
    line-height: 1.08;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .merchant-layout {
    display: grid !important;
    grid-template-columns: minmax(0, 1.36fr) minmax(205px, .64fr) !important;
    align-items: stretch !important;
    gap: 4px !important;
    width: 100%;
    height: 100% !important;
    min-width: 0 !important;
    min-height: 0 !important;
    overflow: hidden !important;
  }
  .merchant-buy-panel,
  .merchant-sell-panel {
    display: grid !important;
    width: 100%;
    height: 100%;
    min-width: 0 !important;
    min-height: 0 !important;
    padding: 4px !important;
    overflow: hidden !important;
  }
  .merchant-buy-panel { grid-template-rows: auto minmax(0, 1fr); }
  .merchant-sell-panel { grid-template-rows: auto minmax(0, 1fr) auto; }
  .merchant-heading,
  .merchant-buy-panel > h3,
  .merchant-sell-panel > h3 {
    min-height: 16px;
    margin: 0 0 2px !important;
    font-size: clamp(.62rem, 2.3vmin, .78rem) !important;
    line-height: 1.05;
  }
  .merchant-heading > strong { font-size: clamp(.56rem, 2.1vmin, .72rem); }
  .game-menu-window .merchant-buy-grid,
  .game-menu-window .merchant-sell-grid {
    width: 100%;
    height: 100% !important;
    min-height: 0 !important;
    max-height: none !important;
    padding: 0 !important;
    overflow-x: hidden !important;
    overflow-y: hidden !important;
    overscroll-behavior: none !important;
    touch-action: manipulation !important;
    scrollbar-width: none !important;
  }
  .merchant-buy-grid::-webkit-scrollbar,
  .merchant-sell-grid::-webkit-scrollbar { display: none !important; }
  .merchant-buy-grid {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    grid-template-rows: repeat(var(--merchant-buy-row-count, 5), clamp(38px, 13.6dvh, 72px)) !important;
    grid-auto-flow: row !important;
    align-content: start !important;
    gap: 3px !important;
  }
  .merchant-product {
    box-sizing: border-box;
    display: grid !important;
    grid-template-columns: clamp(18px, 5.3dvh, 25px) minmax(0, 1fr) !important;
    grid-template-rows: minmax(0, 1fr) auto !important;
    width: 100%;
    min-width: 0 !important;
    min-height: 0 !important;
    height: 100% !important;
    margin: 0 !important;
    padding: 3px 4px !important;
    gap: 1px 4px !important;
    overflow: hidden !important;
    border-width: 1px !important;
    border-radius: 6px !important;
  }
  .merchant-product > .inventory-item-icon {
    align-self: center;
    width: clamp(18px, 5.3dvh, 25px) !important;
    height: clamp(18px, 5.3dvh, 25px) !important;
  }
  .merchant-product > span:nth-child(2) {
    align-self: center;
    display: block;
    min-width: 0;
    overflow: hidden;
  }
  .merchant-product > span:nth-child(2) b {
    display: block;
    overflow: hidden;
    font-size: clamp(.50rem, 1.85vmin, .64rem) !important;
    line-height: 1.05;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .merchant-product small {
    display: -webkit-box;
    overflow: hidden;
    font-size: clamp(.42rem, 1.5vmin, .53rem) !important;
    line-height: 1.05;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }
  .merchant-product .merchant-product-effect { display: none !important; }
  .merchant-buy-actions {
    grid-column: 1 / -1;
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 2px !important;
    width: 100%;
    min-width: 0;
  }
  .merchant-product--stackable .merchant-buy-actions {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }
  .merchant-buy-actions button {
    display: block !important;
    visibility: visible !important;
    min-width: 0 !important;
    min-height: 0 !important;
    height: clamp(18px, 5.2dvh, 23px) !important;
    padding: 1px 2px !important;
    overflow: hidden;
    font-size: clamp(.43rem, 1.55vmin, .54rem) !important;
    line-height: 1 !important;
    text-overflow: ellipsis;
    white-space: nowrap !important;
    opacity: 1;
  }
  .merchant-sell-grid {
    display: grid !important;
    grid-template-columns: repeat(7, minmax(0, 1fr)) !important;
    grid-template-rows: repeat(6, clamp(25px, 6.8dvh, 39px)) !important;
    grid-auto-flow: row !important;
    align-content: start !important;
    gap: 2px !important;
  }
  .merchant-sell-grid > p {
    grid-column: 1 / -1;
    margin: 4px;
    font-size: .56rem;
  }
  .merchant-sell-slot {
    width: 100% !important;
    min-width: 0 !important;
    min-height: 0 !important;
    height: 100% !important;
    padding: 1px !important;
    overflow: hidden;
    aspect-ratio: auto !important;
    border-width: 1px !important;
    border-radius: 5px !important;
  }
  .merchant-sell-slot .inventory-item-icon {
    width: clamp(16px, 4.5dvh, 24px) !important;
    height: clamp(16px, 4.5dvh, 24px) !important;
  }
  .merchant-sell-slot strong {
    right: 2px;
    bottom: 1px;
    font-size: .48rem;
  }
  .merchant-selection {
    box-sizing: border-box;
    display: grid !important;
    grid-template-rows: auto minmax(0, 1fr) auto;
    width: 100%;
    min-height: 0 !important;
    height: clamp(52px, 16dvh, 68px) !important;
    max-height: none !important;
    margin: 3px 0 0 !important;
    padding: 3px 4px !important;
    overflow: hidden !important;
    gap: 1px !important;
  }
  .merchant-selection strong {
    overflow: hidden;
    font-size: clamp(.48rem, 1.8vmin, .61rem);
    line-height: 1.05;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .merchant-selection small {
    display: -webkit-box;
    overflow: hidden;
    font-size: clamp(.40rem, 1.42vmin, .50rem);
    line-height: 1.05;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }
  .merchant-sell-actions {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 2px;
  }
  .merchant-sell-actions > button:not([hidden]) {
    display: block !important;
    visibility: visible !important;
    min-height: 0 !important;
    height: clamp(18px, 5dvh, 23px) !important;
    padding: 1px 3px !important;
    font-size: clamp(.43rem, 1.55vmin, .54rem);
  }
}
@media (orientation: landscape) and (max-height: 700px) and (max-width: 760px) {
  .merchant-layout {
    grid-template-columns: minmax(0, 1.52fr) minmax(160px, .48fr) !important;
  }
  .merchant-buy-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    grid-template-rows: repeat(var(--merchant-buy-row-count, 5), clamp(36px, 13dvh, 58px)) !important;
  }
  .merchant-sell-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr)) !important;
    grid-template-rows: repeat(7, clamp(22px, 6dvh, 34px)) !important;
  }
}

.game-menu-window > .menu-page[hidden],
.npc-dialogue[hidden],
.login-overlay[hidden],
.class-selection-overlay[hidden] {
  display: none !important;
}

/* V36.58.2 — autoridade final do Ferreiro paginado no celular. Esta folha é
   carregada depois de styles.css, portanto deve preservar aqui as três páginas. */
@media (pointer: coarse), (max-width: 900px), (max-height: 700px) {
  .game-menu-window > .blacksmith-page:not([hidden]) {
    display: grid !important;
    grid-template-rows: auto auto minmax(0, 1fr) !important;
    align-content: start !important;
    width: 100% !important;
    height: 100% !important;
    min-width: 0 !important;
    min-height: 0 !important;
    overflow: hidden !important;
  }

  .blacksmith-page .blacksmith-header {
    min-width: 0 !important;
  }

  .blacksmith-page .blacksmith-page-tabs {
    position: relative !important;
    top: auto !important;
    z-index: 4 !important;
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    width: 100% !important;
    min-width: 0 !important;
    gap: 4px !important;
    padding: 2px 0 !important;
    overflow: visible !important;
    background: #071116 !important;
  }

  .blacksmith-page .blacksmith-page-tabs button {
    display: block !important;
    min-width: 0 !important;
    min-height: 40px !important;
    padding: 4px 3px !important;
    overflow: hidden !important;
    font-size: clamp(8px, 2.2dvh, 11px) !important;
    line-height: 1.05 !important;
    text-overflow: ellipsis !important;
    white-space: normal !important;
    touch-action: manipulation !important;
  }

  .blacksmith-page .blacksmith-layout {
    display: block !important;
    min-width: 0 !important;
    min-height: 0 !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    overscroll-behavior: contain !important;
    touch-action: pan-y !important;
  }

  .blacksmith-page .blacksmith-view[hidden] {
    display: none !important;
  }

  .blacksmith-page .blacksmith-view:not([hidden]) {
    display: flex !important;
    width: 100% !important;
    min-width: 0 !important;
    min-height: 0 !important;
    overflow: visible !important;
  }

  .blacksmith-page .blacksmith-commerce-panel .material-commerce-grid {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)) !important;
  }
}

/* V36.58.4 — Loja nativa no Android, sem recorte das categorias ou pacotes. */
@media (pointer: coarse), (max-width: 900px), (max-height: 700px) {
  .game-menu-window > .store-page:not([hidden]) {
    display: grid !important;
    grid-template-rows: auto auto minmax(0, 1fr) !important;
    width: 100% !important;
    height: 100% !important;
    min-width: 0 !important;
    min-height: 0 !important;
    overflow: hidden !important;
  }
  .store-page .store-tabs { display:grid!important;grid-template-columns:repeat(3,minmax(0,1fr))!important;gap:4px!important; }
  .store-page .store-tabs button { min-width:0!important;min-height:40px!important;padding:3px!important;font-size:clamp(8px,2.2dvh,11px)!important;line-height:1.05!important;white-space:normal!important;touch-action:manipulation!important; }
  .store-page .store-content { min-width:0!important;min-height:0!important;overflow:hidden!important; }
  .store-page .store-view { min-width:0!important;min-height:0!important;max-width:100%!important; }
  .store-page .store-view[hidden] { display:none!important; }
  .store-page .store-diamonds-view:not([hidden]) { display:block!important;overflow-x:hidden!important;overflow-y:auto!important;overscroll-behavior:contain!important;touch-action:pan-y!important;-webkit-overflow-scrolling:touch!important; }
  .store-page .diamond-package-grid { grid-template-columns:repeat(5,minmax(118px,1fr))!important;min-width:610px; }
  .store-page .diamond-package-grid { overflow:visible!important; }
  .store-page .store-diamonds-view { overflow-x:auto!important; }
  .store-page .diamond-package button { touch-action:manipulation!important; }
  .store-page .store-coming-view:not([hidden]) { display:grid!important;overflow-y:auto!important;touch-action:pan-y!important; }
  .store-page .store-player-view:not([hidden]) { display:grid!important;align-content:start!important;gap:6px!important;overflow-x:hidden!important;overflow-y:auto!important;overscroll-behavior:contain!important;touch-action:pan-y!important;-webkit-overflow-scrolling:touch!important;scrollbar-width:thin!important; }
  .store-page .store-mount-view:not([hidden]) { display:grid!important;align-content:start!important;gap:6px!important;overflow-x:hidden!important;overflow-y:auto!important;overscroll-behavior:contain!important;touch-action:pan-y!important;-webkit-overflow-scrolling:touch!important;scrollbar-width:thin!important; }
  .store-page .cosmetic-product { width:100%!important;min-width:0!important;max-width:100%!important;min-height:0!important;grid-template-columns:minmax(0,.9fr) minmax(0,1.2fr) minmax(104px,.5fr)!important;gap:6px!important;padding:6px!important; }
  .store-page .cosmetic-product > *,
  .store-page .cosmetic-product-copy { min-width:0!important;max-width:100%!important; }
  .store-page .phoenix-store-preview,
  .store-page .eclipse-store-preview { min-height:140px!important; }
  .store-page .player-outfit-store-preview { width:100%!important;height:auto!important;max-height:150px!important; }
  .store-page .cosmetic-product-buy button { touch-action:manipulation!important; }
}

/* V36.62.3 — cards de skins adaptáveis: em celulares estreitos a descrição
   desce para uma segunda linha e a própria aba continua rolável. */
@media (max-width: 680px) {
  .store-page .cosmetic-product {
    grid-template-columns:minmax(0,1fr) minmax(104px,.46fr)!important;
    align-items:start!important;
  }
  .store-page .cosmetic-product > :first-child {
    grid-column:1!important;
    grid-row:1!important;
    align-self:stretch!important;
  }
  .store-page .cosmetic-product-copy {
    grid-column:1 / -1!important;
    grid-row:2!important;
  }
  .store-page .cosmetic-product-buy {
    grid-column:2!important;
    grid-row:1!important;
    align-self:stretch!important;
  }
  .store-page .cosmetic-product-copy ul {
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
  }
}

@media (max-width: 520px) {
  .store-page .cosmetic-product { grid-template-columns:minmax(0,1fr)!important; }
  .store-page .cosmetic-product > :first-child,
  .store-page .cosmetic-product-copy,
  .store-page .cosmetic-product-buy {
    grid-column:1!important;
    grid-row:auto!important;
  }
  .store-page .cosmetic-product-buy { width:100%!important; }
}

/* V36.58.3 — Banco Android paginado e coleções navegáveis por gesto. */
@media (pointer: coarse), (max-width: 900px), (max-height: 700px) {
  .game-menu-window > .bank-page:not([hidden]) {
    display: grid !important;
    grid-template-rows: auto auto minmax(0, 1fr) !important;
    width: 100% !important;
    height: 100% !important;
    min-width: 0 !important;
    min-height: 0 !important;
    overflow: hidden !important;
  }
  .bank-page .bank-page-tabs {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    min-width: 0 !important;
    gap: 4px !important;
    margin: 0 0 4px !important;
  }
  .bank-page .bank-page-tabs button {
    min-width: 0 !important;
    min-height: 40px !important;
    padding: 4px !important;
    font-size: clamp(9px, 2.35dvh, 12px) !important;
    touch-action: manipulation !important;
  }
  .bank-page .bank-page-content,
  .bank-page .bank-view:not([hidden]) {
    min-width: 0 !important;
    min-height: 0 !important;
    overflow: hidden !important;
  }
  .bank-page .bank-view[hidden] { display: none !important; }
  .bank-page .bank-layout {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    min-width: 0 !important;
    min-height: 0 !important;
    overflow: hidden !important;
  }
  .bank-page .bank-storage-panel,
  .bank-page .bank-inventory-panel {
    min-width: 0 !important;
    min-height: 0 !important;
    overflow: hidden !important;
  }
  .game-menu-window .bank-page .bank-grid {
    flex: 1 1 auto !important;
    min-width: 0 !important;
    min-height: 88px !important;
    max-height: none !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    overscroll-behavior: contain !important;
    touch-action: pan-y !important;
    -webkit-overflow-scrolling: touch !important;
    scrollbar-width: thin !important;
  }
  .bank-page .bank-slot { touch-action: pan-y !important; }
  .bank-page .bank-material-panel:not([hidden]) {
    display: block !important;
    padding: 8px !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    overscroll-behavior: contain !important;
    touch-action: pan-y !important;
  }
  .bank-page .material-commerce-grid {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)) !important;
  }

  /* Coleções que historicamente perdiam scroll no Android permanecem
     arrastáveis mesmo quando o gesto começa em cima de um item. */
  .quiver-grid,
  .admin-inventory-grid {
    overflow-x: hidden !important;
    overflow-y: auto !important;
    overscroll-behavior: contain !important;
    touch-action: pan-y !important;
    -webkit-overflow-scrolling: touch !important;
  }
  .quiver-grid > *,
  .admin-inventory-grid > * { touch-action: pan-y !important; }
}

/* V36.67.5 — HUD mobile quadrado e ajustável. O desktop conserva a hotbar
   horizontal original; mobile apenas reorganiza os mesmos botões/ações. */
html.mobile-performance .mobile-hud-settings-card {
  display: grid;
}

html.mobile-performance .action-hotbar {
  --mobile-hud-button-size: clamp(56px, 13.5dvh, 80px);
  --mobile-hud-gap: clamp(7px, 1.6dvh, 12px);
  left: calc(max(8px, env(safe-area-inset-left)) + var(--mobile-hud-offset-x, 12px));
  right: auto;
  bottom: max(8px, env(safe-area-inset-bottom));
  display: grid;
  grid-template-columns: repeat(2, var(--mobile-hud-button-size));
  grid-template-rows: repeat(3, var(--mobile-hud-button-size));
  grid-template-areas:
    "skill-3 skill-4"
    "health skill-5"
    "mana fishing";
  gap: var(--mobile-hud-gap);
  max-width: none;
  transform: scale(var(--mobile-hud-scale, 1));
  transform-origin: left bottom;
}

html.mobile-performance #healthPotionSlot { grid-area: health; }
html.mobile-performance #manaPotionSlot { grid-area: mana; }
html.mobile-performance #heavyStrikeSlot { grid-area: skill-3; }
html.mobile-performance #spinSlot { grid-area: skill-4; }
html.mobile-performance #bombSlot { grid-area: skill-5; }
html.mobile-performance #fishingButton { grid-area: fishing; }

html.mobile-performance .action-slot {
  width: var(--mobile-hud-button-size);
  height: var(--mobile-hud-button-size);
  min-width: 0;
  min-height: 0;
  border-color: rgba(226, 187, 84, .54);
  border-radius: clamp(8px, 1.8dvh, 12px);
  background: linear-gradient(145deg, rgba(19,29,38,.94), rgba(6,12,18,.92));
  box-shadow:
    inset 0 0 0 2px rgba(0,0,0,.48),
    inset 0 -8px 0 rgba(0,0,0,.14),
    0 4px 10px rgba(0,0,0,.28);
  -webkit-tap-highlight-color: transparent;
}

html.mobile-performance .action-slot:active:not(:disabled) {
  transform: scale(.94);
  filter: brightness(1.16);
}

html.mobile-performance .action-slot--health .action-key,
html.mobile-performance .action-slot--mana .action-key {
  display: none;
}

html.mobile-performance .action-icon {
  transform: scale(1.12);
}

html.mobile-performance .action-key {
  top: 5px;
  left: 7px;
  font-size: clamp(.66rem, 2.3dvh, .86rem);
}

html.mobile-performance .action-slot > strong,
html.mobile-performance .action-slot > small {
  right: 6px;
  bottom: 5px;
  font-size: clamp(.68rem, 2.25dvh, .86rem);
}

/* No mobile o chat ocupa o centro inferior onde ficava a hotbar horizontal.
   As regras de desktop continuam em styles.css sem qualquer deslocamento. */
@media (pointer: coarse), (any-pointer: coarse), (hover: none) {
  .game-frame .chat-dock {
    left: 50%;
    right: auto;
    bottom: max(7px, env(safe-area-inset-bottom));
    width: min(58vw, 560px);
    min-width: min(320px, calc(100vw - 18px));
    transform: translateX(-50%);
  }

  .game-frame .chat-dock.open {
    left: 50%;
    right: auto;
    bottom: max(7px, env(safe-area-inset-bottom));
    width: min(76vw, 680px);
    max-width: calc(100vw - 18px);
    transform: translateX(-50%);
  }
}

@media (orientation: landscape) and (max-height: 430px) {
  html.mobile-performance .action-hotbar {
    --mobile-hud-button-size: clamp(52px, 15dvh, 62px);
    --mobile-hud-gap: clamp(6px, 1.4dvh, 9px);
  }

  html.mobile-performance .mobile-hud-settings-card {
    gap: 5px;
  }

  html.mobile-performance .mobile-hud-setting {
    padding-top: 4px;
  }
}

/* V36.67.15 — Shop mobile com uma única região de rolagem nativa.
   Preserva o contrato V36.67.6 — Shop de skins mobile.
   A aba ativa ocupa exatamente a faixa restante do Shop e controla o próprio
   scroll. Isso evita a disputa entre store-content e a coleção de skins no
   Chrome/WebView Android. */
@media (pointer: coarse), (max-width: 900px), (max-height: 700px) {
  .store-page .store-content {
    display: grid !important;
    grid-template-rows: minmax(0, 1fr) !important;
    width: 100% !important;
    height: 100% !important;
    max-height: 100% !important;
    min-width: 0 !important;
    min-height: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    overscroll-behavior: none !important;
    touch-action: pan-y !important;
  }

  .store-page .store-view {
    grid-area: 1 / 1 !important;
    width: 100% !important;
    height: 100% !important;
    max-height: 100% !important;
    min-width: 0 !important;
    min-height: 0 !important;
    overflow: hidden !important;
  }

  .store-page .store-view[hidden] {
    display: none !important;
  }

  .store-page .store-player-view:not([hidden]),
  .store-page .store-mount-view:not([hidden]) {
    display: grid !important;
    align-content: start !important;
    gap: 6px !important;
    padding: 6px 8px max(14px, env(safe-area-inset-bottom)) 6px !important;
    padding-bottom: max(14px, env(safe-area-inset-bottom)) !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    overscroll-behavior-x: none !important;
    overscroll-behavior-y: contain !important;
    scrollbar-gutter: stable !important;
    scrollbar-width: thin !important;
    touch-action: pan-y !important;
    -webkit-overflow-scrolling: touch !important;
  }

  .store-page .store-player-view::-webkit-scrollbar,
  .store-page .store-mount-view::-webkit-scrollbar {
    width: 8px;
  }

  .store-page .store-player-view::-webkit-scrollbar-track,
  .store-page .store-mount-view::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, .16);
    border-radius: 999px;
  }

  .store-page .store-player-view::-webkit-scrollbar-thumb,
  .store-page .store-mount-view::-webkit-scrollbar-thumb {
    background: rgba(135, 177, 193, .58);
    border-radius: 999px;
  }

  .store-page .store-player-view .cosmetic-product,
  .store-page .store-mount-view .cosmetic-product,
  .store-page .store-player-view .cosmetic-product > *,
  .store-page .store-mount-view .cosmetic-product > * {
    touch-action: pan-y !important;
  }

  .store-page .cosmetic-product-buy button {
    touch-action: manipulation !important;
  }

  .store-page .player-outfit-store-preview {
    pointer-events: none !important;
    touch-action: pan-y !important;
  }
}

/* V36.67.16 — fallback determinístico de arraste para Android/WebView.
   Quando Pointer Events está disponível, a UI move o scrollTop diretamente;
   touch-action:none impede a camada do jogo de assumir o gesto antes da Loja. */
@media (pointer: coarse), (max-width: 900px), (max-height: 700px) {
  .store-page .store-player-view.store-touch-drag,
  .store-page .store-mount-view.store-touch-drag,
  .store-page .store-player-view.store-touch-drag *,
  .store-page .store-mount-view.store-touch-drag * {
    touch-action: none !important;
  }

  .store-page .store-view.store-touch-drag.is-touch-dragging {
    cursor: grabbing;
    user-select: none;
    -webkit-user-select: none;
  }
}

/* V36.67.7 — Configurações do HUD sempre visíveis em aparelhos touch.
   A detecção de desempenho continua existindo, mas a interface de ajuste não
   depende dela: alguns navegadores Android anunciam hover de forma imprecisa. */
@media (pointer: coarse), (any-pointer: coarse), (hover: none) {
  html .config-page .mobile-hud-settings-card {
    display: grid !important;
    order: -1;
  }

  html .config-page .desktop-control-card {
    display: none !important;
  }

  html .config-page .mobile-hud-setting > input[type="range"] {
    min-height: 38px;
    touch-action: pan-x;
  }
}

/* V36.67.8 — Config mobile inteira dentro da viewport landscape. */
@media (orientation: landscape) and (max-height: 700px) {
  html .game-menu-window > .config-page:not([hidden]) {
    display: grid !important;
    grid-template-rows: auto minmax(0, 1fr);
    align-content: stretch;
  }

  html .config-page > h2 {
    margin-bottom: 3px !important;
    font-size: clamp(18px, 3.8dvh, 24px) !important;
    line-height: 1 !important;
  }

  html .config-page .settings-stack {
    align-content: start;
    gap: clamp(4px, .9dvh, 7px);
    min-height: 0;
  }

  html .config-page .settings-card {
    min-height: 0;
    padding: clamp(6px, 1.2dvh, 9px) 12px;
    border-radius: 9px;
  }

  html .config-page .settings-card-heading,
  html .config-page .settings-card--toggle {
    gap: 10px;
  }

  html .config-page .settings-card strong {
    font-size: clamp(13px, 2.5dvh, 16px);
    line-height: 1.05;
  }

  html .config-page .settings-card small {
    margin-top: 1px;
    font-size: clamp(11px, 2.05dvh, 14px);
    line-height: 1.08;
  }

  html .config-page .settings-card output {
    min-width: 54px;
    font-size: clamp(12px, 2.4dvh, 16px);
  }

  html .config-page .mobile-hud-settings-card {
    gap: clamp(2px, .55dvh, 4px);
  }

  html .config-page .mobile-hud-setting {
    gap: 2px 8px;
    padding-top: clamp(2px, .65dvh, 5px);
  }

  html .config-page .mobile-hud-setting > input[type="range"],
  html .config-page .volume-slider {
    min-height: clamp(28px, 4.8dvh, 34px);
    margin-top: 1px;
  }

  html .config-page .mobile-hud-reset {
    min-height: 30px !important;
    padding: 4px 9px;
    font-size: clamp(12px, 2.2dvh, 15px);
  }

  html .config-page .switch-control {
    width: 54px;
    height: 30px;
  }

  html .config-page .switch-control span::after {
    width: 20px;
    height: 20px;
  }

  html .config-page .switch-control input:checked + span::after {
    transform: translateX(24px);
  }
}

/* V36.67.17 — Shop paginado sem rolagem.
   A classe/montaria escolhe o catálogo; as setas trocam somente o card ativo. */
@media (pointer: coarse), (max-width: 900px), (max-height: 700px) {
  .store-page .store-player-view:not([hidden]),
  .store-page .store-mount-view:not([hidden]) {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    min-width: 0 !important;
    min-height: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    overscroll-behavior: none !important;
    touch-action: manipulation !important;
  }

  .store-page .store-skin-browser {
    grid-template-rows: auto minmax(0, 1fr) auto !important;
    gap: 3px !important;
    height: 100% !important;
    min-height: 0 !important;
    padding: 3px !important;
    overflow: hidden !important;
    touch-action: manipulation !important;
  }

  .store-page .skin-category-tabs { gap: 3px !important; }

  .store-page .skin-category-tabs button {
    min-height: clamp(28px, 7dvh, 34px) !important;
    padding: 2px 3px !important;
    font-size: clamp(8px, 2.2dvh, 11px) !important;
    line-height: 1 !important;
    touch-action: manipulation !important;
  }

  .store-page .skin-carousel {
    grid-template-columns: clamp(32px, 6vw, 40px) minmax(0, 1fr) clamp(32px, 6vw, 40px) !important;
    gap: 3px !important;
    min-height: 0 !important;
    overflow: hidden !important;
  }

  .store-page .skin-carousel-arrow {
    width: 100% !important;
    height: min(92px, 48%) !important;
    min-height: 56px !important;
    border-radius: 8px !important;
    font-size: clamp(25px, 8dvh, 38px) !important;
    touch-action: manipulation !important;
  }

  .store-page .skin-card-frame {
    min-width: 0 !important;
    min-height: 0 !important;
    overflow: hidden !important;
    touch-action: manipulation !important;
  }

  .store-page .skin-card-frame > .cosmetic-product {
    width: 100% !important;
    height: 100% !important;
    min-width: 0 !important;
    min-height: 0 !important;
    max-height: 100% !important;
    grid-template-columns: minmax(150px, .9fr) minmax(170px, 1.08fr) minmax(90px, .48fr) !important;
    align-items: stretch !important;
    gap: 4px !important;
    padding: 4px !important;
    overflow: hidden !important;
    touch-action: manipulation !important;
  }

  .store-page .skin-card-frame > .cosmetic-product[hidden] { display: none !important; }

  .store-page .skin-card-frame .player-outfit-store-preview,
  .store-page .skin-card-frame .phoenix-store-preview,
  .store-page .skin-card-frame .eclipse-store-preview {
    width: 100% !important;
    height: 100% !important;
    min-width: 0 !important;
    min-height: 0 !important;
    max-height: 100% !important;
    object-fit: contain !important;
    overflow: hidden !important;
  }

  .store-page .skin-card-frame .cosmetic-product-copy {
    align-self: center !important;
    max-height: 100% !important;
    overflow: hidden !important;
  }

  .store-page .skin-card-frame .cosmetic-product-copy h3 {
    margin: 2px 0 4px !important;
    font-size: clamp(12px, 3.4dvh, 17px) !important;
    line-height: 1.05 !important;
  }

  .store-page .skin-card-frame .cosmetic-product-copy p,
  .store-page .skin-card-frame .cosmetic-product-copy ul {
    display: none !important;
  }

  .store-page .skin-card-frame .cosmetic-product-copy > span {
    padding: 4px 5px !important;
    font-size: clamp(8px, 2dvh, 10px) !important;
    line-height: 1.15 !important;
  }

  .store-page .skin-card-frame .cosmetic-product-buy {
    align-self: center !important;
    gap: 4px !important;
    padding: 5px !important;
    overflow: hidden !important;
  }

  .store-page .skin-card-frame .cosmetic-product-buy button {
    min-height: clamp(30px, 7.5dvh, 38px) !important;
    padding: 2px 4px !important;
    font-size: clamp(8px, 2.1dvh, 11px) !important;
    touch-action: manipulation !important;
  }

  .store-page .skin-browser-footer {
    min-height: 18px !important;
    font-size: clamp(8px, 1.9dvh, 10px) !important;
  }

  .store-page .skin-browser-footer small { display: none !important; }
}
