/* ============================================================
   BOOM WORLD 4.1.1 // MOBILE BALL MENU + CHAT POLISH
   UI-only layer. No gameplay / DB / Society / MMORPG logic changes.
   ============================================================ */

/* Desktop: give WORLD CHAT more breathing room and remove the long helper copy. */
@media (min-width: 901px) and (pointer: fine) {
  body.boom-world #world-chat.world-chat {
    height: clamp(390px, 40vh, 455px) !important;
    min-height: 390px !important;
    max-height: 455px !important;
  }

  body.boom-world #world-chat .ch-hint {
    display: none !important;
  }

  body.boom-world #world-chat .ch-msgs {
    min-height: 180px !important;
  }
}

/* Mobile / coarse pointer */
@media (max-width: 900px), (pointer: coarse) {
  /* The Poké Ball is now the in-game WORLD menu trigger. Keep it compact. */
  body.boom-world .world-command {
    z-index: 100050 !important;
  }

  body.boom-world .world-command.boom-mobile-collapsed {
    z-index: 100050 !important;
  }

  body.boom-world .world-command.boom-mobile-collapsed .world-ball {
    cursor: pointer !important;
    touch-action: manipulation;
  }

  body.boom-world .world-command.boom-mobile-collapsed .world-ball:active {
    transform: scale(.94) !important;
  }

  /* Society/MMORPG no longer float over the map/user card. They are launched
     from the Poké Ball menu instead. */
  body.boom-world #boom-society-toggle,
  body.boom-world #boom-mmo6-journal > .m6btn {
    display: none !important;
  }

  /* Their actual panels remain available and are made properly mobile-sized. */
  body.boom-world #boom-society-panel {
    left: 8px !important;
    right: 8px !important;
    top: 72px !important;
    width: auto !important;
    max-height: calc(100dvh - 86px) !important;
    z-index: 100030 !important;
  }

  body.boom-world #boom-mmo6-journal {
    left: 8px !important;
    right: 8px !important;
    top: 72px !important;
    width: auto !important;
    z-index: 100030 !important;
  }

  body.boom-world #boom-mmo6-journal .m6panel {
    width: 100% !important;
    max-height: calc(100dvh - 86px) !important;
    margin-top: 0 !important;
    overflow-y: auto !important;
    overscroll-behavior: contain;
  }

  /* Backdrop + slide-down game menu. */
  body.boom-world #world411-menu-shade {
    position: fixed;
    inset: 0;
    z-index: 100038;
    background: rgba(1, 5, 15, .52);
    backdrop-filter: blur(3px);
    opacity: 0;
    pointer-events: none;
    transition: opacity .18s ease;
  }

  body.boom-world #world411-menu-shade.open {
    opacity: 1;
    pointer-events: auto;
  }

  body.boom-world #world411-ball-menu {
    position: fixed;
    top: 68px;
    right: 8px;
    z-index: 100045;
    width: min(330px, calc(100vw - 16px));
    max-height: calc(100dvh - 84px);
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 10px;
    border: 1px solid rgba(93, 234, 255, .38);
    border-radius: 18px;
    background:
      radial-gradient(circle at 88% 0%, rgba(109, 91, 255, .20), transparent 34%),
      linear-gradient(160deg, rgba(9, 25, 54, .985), rgba(3, 9, 24, .99));
    box-shadow: 0 22px 65px rgba(0,0,0,.68), 0 0 28px rgba(82,234,255,.12);
    backdrop-filter: blur(15px);
    transform-origin: top right;
    transform: translateY(-10px) scale(.975);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity .16s ease, transform .18s ease, visibility .18s;
  }

  body.boom-world #world411-ball-menu.open {
    transform: translateY(0) scale(1);
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }

  body.boom-world .world411-menu-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 3px 4px 9px;
    border-bottom: 1px solid rgba(105, 236, 255, .13);
  }

  body.boom-world .world411-menu-head strong {
    color: #f3fbff;
    font: 900 11px Orbitron, sans-serif;
    letter-spacing: .08em;
  }

  body.boom-world .world411-menu-head span {
    display: block;
    margin-top: 3px;
    color: #7185aa;
    font: 800 6px Orbitron, sans-serif;
    letter-spacing: .10em;
  }

  body.boom-world .world411-menu-close {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    border: 1px solid rgba(104, 234, 255, .20);
    border-radius: 10px;
    background: rgba(91, 226, 255, .06);
    color: #66ecff;
    font: 900 18px/1 Rajdhani, sans-serif;
    cursor: pointer;
  }

  body.boom-world .world411-menu-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 7px;
    margin-top: 9px;
  }

  body.boom-world .world411-menu-item {
    display: grid;
    grid-template-columns: 38px minmax(0,1fr) auto;
    align-items: center;
    gap: 9px;
    width: 100%;
    min-height: 52px;
    padding: 8px 10px;
    border: 1px solid rgba(101, 229, 255, .17);
    border-radius: 13px;
    background: rgba(12, 31, 64, .72);
    color: #eafaff;
    text-align: left;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }

  body.boom-world .world411-menu-item:active {
    transform: scale(.985);
    background: rgba(29, 72, 112, .88);
  }

  body.boom-world .world411-menu-icon {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 11px;
    background: rgba(85, 232, 255, .08);
    color: #63edff;
    font-size: 18px;
  }

  body.boom-world .world411-menu-copy b {
    display: block;
    color: #eefcff;
    font: 900 11px Orbitron, sans-serif;
    letter-spacing: .035em;
  }

  body.boom-world .world411-menu-copy small {
    display: block;
    margin-top: 3px;
    color: #7f94b8;
    font: 700 9px Rajdhani, sans-serif;
  }

  body.boom-world .world411-menu-state {
    color: #5cecad;
    font: 900 7px Orbitron, sans-serif;
    letter-spacing: .06em;
  }

  body.boom-world .world411-menu-item.vip {
    border-color: rgba(255, 216, 74, .24);
    background: linear-gradient(100deg, rgba(85, 58, 9, .30), rgba(12,31,64,.72));
  }

  body.boom-world .world411-menu-item.vip .world411-menu-icon,
  body.boom-world .world411-menu-item.vip .world411-menu-state {
    color: #ffe164;
  }

  body.boom-world .world411-menu-item.society {
    border-color: rgba(87, 238, 187, .22);
  }

  body.boom-world .world411-menu-item.mmorpg {
    border-color: rgba(176, 112, 255, .25);
  }

  /* When the in-game menu is open, keep the old site drawer launcher behind it
     instead of letting controls visually collide. */
  body.boom-world.world411-menu-open .bn-launch,
  body.boom-world.world411-menu-open .boom-mobile-real-menu {
    opacity: 0 !important;
    pointer-events: none !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  body.boom-world #world411-ball-menu,
  body.boom-world #world411-menu-shade {
    transition: none !important;
  }
}
