/* AETHERBORN Online - Android modal sizing test patch.
   Only applies to touch devices; leaves desktop windows intact. */
@media (pointer: coarse) {
  /* Keep dialog content within actual phone viewport; never clip primary actions. */
  #overlay:not(.hidden),
  #worldMenuOverlay:not(.hidden) {
    box-sizing:border-box!important;
    max-width:100dvw!important;
    max-height:100dvh!important;
    overflow-x:hidden!important;
    overflow-y:auto!important;
    padding:6px!important;
    overscroll-behavior:contain;
  }
  #overlay .card.chest-card {
    box-sizing:border-box!important;
    width:min(420px,calc(100dvw - 14px))!important;
    max-width:calc(100dvw - 14px)!important;
    max-height:calc(100dvh - 14px)!important;
    margin:auto!important;
    padding:10px 13px!important;
    overflow-y:auto!important;
    overflow-x:hidden!important;
    -webkit-overflow-scrolling:touch;
    scrollbar-width:thin;
  }
  #overlay .chest-card h1 {font-size:clamp(15px,4.2dvh,22px)!important;margin:4px 0!important}
  #overlay .chest-card .chest-icon {font-size:clamp(30px,9dvh,50px)!important;margin:2px auto!important}
  #overlay .chest-card .chest-reward-text {font-size:clamp(13px,3.4dvh,18px)!important;min-height:0!important}
  #overlay .chest-card .chest-reward-item {padding:5px 7px!important;gap:6px!important}
  #overlay .chest-card .chest-reward-item-icon {width:35px!important;height:35px!important}
  #overlay .chest-card .chest-reward-copy b {font-size:clamp(12px,3dvh,16px)!important}
  #overlay .chest-card .chest-currency-rewards {gap:5px!important;margin:4px 0!important}
  #overlay .chest-card .chest-open-btn,
  #overlay .chest-card #continueAfterChest {min-width:0!important;min-height:34px!important;padding:6px 12px!important;margin-top:6px!important;font-size:14px!important}
  #overlay .card.ae-rift-loot-card {
    box-sizing:border-box!important;
    width:min(420px,calc(100dvw - 14px))!important;
    max-width:calc(100dvw - 14px)!important;
    max-height:calc(100dvh - 14px)!important;
    margin:auto!important;
    padding:9px 12px!important;
    overflow:auto!important;
  }
  #overlay .ae-rift-chest-art {height:min(25dvh,108px)!important;width:min(31dvw,145px)!important}
  #overlay .ae-rift-chest-art img {width:100%!important;height:100%!important;object-fit:contain!important}
  #overlay .ae-rift-loot-card h1 {font-size:clamp(14px,4dvh,20px)!important;margin:3px 0!important}
  #overlay .ae-rift-reward-card {padding:5px 6px!important;gap:6px!important}
  #overlay .ae-rift-reward-list {gap:4px!important;margin-bottom:5px!important}
  /* Other tabbed popups: allow vertical scrolling and horizontal tabs. */
  #worldMenuOverlay .world-menu-card,
  #a419SpiritWindow .a419-spirit-card,
  .soul-overlay .soul-card,
  .ad-panel,
  .ab-duel-card {
    box-sizing:border-box!important;
    max-width:calc(100dvw - 12px)!important;
    max-height:calc(100dvh - 12px)!important;
    overflow-y:auto!important;
    overflow-x:hidden!important;
    -webkit-overflow-scrolling:touch;
  }
  #aetherEquipmentMenu .ae-tabs-rpg,
  #aetherEquipmentMenu .ae-tabs {
    overflow-x:auto!important;
    overflow-y:hidden!important;
    flex-wrap:nowrap!important;
    -webkit-overflow-scrolling:touch;
  }
  #aetherEquipmentMenu .ae-tabs-rpg .ae-tab,
  #aetherEquipmentMenu .ae-tabs .ae-tab {flex-shrink:0!important}
  #aetherEquipmentMenu .ae-card {min-height:0!important}
  #aetherEquipmentMenu .ae-equip-layout,
  #aetherEquipmentMenu .ae-main,
  #aetherEquipmentMenu .ae-content {min-height:0!important}
}
@media (pointer: coarse) and (max-height: 520px) {
  #overlay .card.chest-card,
  #overlay .card.ae-rift-loot-card {max-height:calc(100dvh - 8px)!important;padding:7px 10px!important}
  #overlay .chest-card .chest-icon {font-size:34px!important}
  #overlay .ae-rift-chest-art {height:64px!important;width:92px!important}
  #overlay .ae-rift-loot-card.revealed .ae-rift-chest-art {height:53px!important}
  #overlay .chest-card h1 {font-size:16px!important}
}

/* v1.1 — GAME LOG hide/show toggle follows the centered mobile log,
   even when the log is hidden. The desktop position is unchanged. */
@media (pointer: coarse){
  #abCollapse-log{
    width:28px!important;height:28px!important;
    min-width:28px!important;min-height:28px!important;
    font-size:18px!important;border-radius:7px!important;
    background:linear-gradient(#29495f,#101d2d)!important;
    box-shadow:0 2px 8px #000c!important;
    z-index:10023!important;
    touch-action:manipulation;
  }
}
