/* ============================================================
   BOOM WORLD 4.1 // COMPACT DESKTOP REBUILD
   UI-only layer. No gameplay / DB / progression changes.
   ============================================================ */

:root {
  --w41-gap: 14px;
}

@media (min-width: 901px) and (pointer: fine) {
  /* ----------------------------------------------------------
     Main desktop composition
     Left: map + location + compact controls
     Right: party + fixed-height chat + compact trade
     ---------------------------------------------------------- */
  body.boom-world .wrap {
    width: min(1460px, 100%) !important;
    max-width: 1460px !important;
    grid-template-columns: minmax(0, 2.08fr) minmax(390px, .92fr) !important;
    grid-template-areas:
      "auth auth"
      "map hud"
      "map chat"
      "status trade"
      "dpad trade"
      "footer footer" !important;
    gap: var(--w41-gap) !important;
    align-items: start !important;
  }

  body.boom-world .auth { grid-area: auth !important; }
  body.boom-world #game-frame { grid-area: map !important; align-self: start !important; }
  body.boom-world .hud {
    grid-area: hud !important;
    position: relative !important;
    top: auto !important;
    width: 100% !important;
    min-width: 0 !important;
  }

  /* Party stays rich, but slightly tighter so the rail aligns to the map. */
  body.boom-world .hud {
    padding: 14px !important;
  }
  body.boom-world .hud:before {
    margin-bottom: 9px !important;
  }
  body.boom-world .party-bar {
    gap: 7px !important;
  }
  body.boom-world .mon {
    min-height: 88px !important;
    padding-top: 6px !important;
  }
  body.boom-world .mon img {
    width: 43px !important;
    height: 43px !important;
  }
  body.boom-world .btns {
    margin-top: 9px !important;
  }

  /* Fixed-height chat. Message history scrolls inside the card instead of
     pushing the whole page several screens down. */
  body.boom-world #world-chat.world-chat {
    grid-area: chat !important;
    position: relative !important;
    inset: auto !important;
    bottom: auto !important;
    width: 100% !important;
    height: clamp(315px, 34vh, 365px) !important;
    min-height: 315px !important;
    max-height: 365px !important;
    margin: 0 !important;
    padding: 12px !important;
    overflow: hidden !important;
  }
  body.boom-world #world-chat .ch-hint {
    margin: 0 0 8px 0 !important;
    line-height: 1.2 !important;
  }
  body.boom-world #world-chat .ch-msgs {
    display: flex !important;
    flex: 1 1 auto !important;
    min-height: 95px !important;
    overflow-y: auto !important;
    overscroll-behavior: contain;
    scrollbar-width: thin;
  }
  body.boom-world #world-chat .ch-compose {
    flex: 0 0 auto !important;
  }

  /* VIP palette is still available, but no longer permanently consumes a
     large chunk of the chat card. */
  body.boom-world #world-chat .vip-chat-style.show:not(.world41-open) {
    display: none !important;
  }
  body.boom-world .world41-vip-toggle {
    display: none;
    width: 100%;
    min-height: 31px;
    margin: 7px 0 0;
    padding: 6px 10px !important;
    border: 1px solid rgba(255,213,74,.28) !important;
    border-radius: 9px !important;
    background: rgba(255,213,74,.065) !important;
    color: #ffe16b !important;
    font: 800 8px Orbitron, sans-serif !important;
    letter-spacing: .08em;
    cursor: pointer;
  }
  body.boom-world .world41-vip-toggle.is-visible {
    display: block !important;
  }
  body.boom-world .world41-vip-toggle:hover {
    background: rgba(255,213,74,.13) !important;
  }

  /* Trade becomes a compact rail card. It can expand when needed, but never
     creates the giant desktop tail seen in WORLD 4.0. */
  body.boom-world #trade-panel.trade-panel {
    grid-area: trade !important;
    position: relative !important;
    width: 100% !important;
    max-width: none !important;
    max-height: 238px !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding: 12px 13px !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    align-self: start !important;
    border-radius: 20px !important;
    scrollbar-width: thin;
  }
  body.boom-world #trade-panel > h3 {
    min-height: 28px;
    margin: 0 !important;
    padding: 4px 105px 7px 0 !important;
    display: flex;
    align-items: center;
    line-height: 1.15;
  }
  body.boom-world #trade-panel.world41-collapsed {
    max-height: 54px !important;
    min-height: 54px !important;
    overflow: hidden !important;
  }
  body.boom-world #trade-panel.world41-collapsed > :not(h3):not(.world41-trade-toggle):not(.world-sheet-close) {
    display: none !important;
  }
  body.boom-world .world41-trade-toggle {
    position: absolute;
    top: 9px;
    right: 10px;
    min-width: 82px;
    min-height: 31px;
    padding: 5px 8px !important;
    border: 1px solid rgba(82,234,255,.25) !important;
    border-radius: 9px !important;
    background: rgba(82,234,255,.07) !important;
    color: #64eeff !important;
    font: 800 7px Orbitron, sans-serif !important;
    letter-spacing: .07em;
    cursor: pointer;
  }
  body.boom-world .world41-trade-toggle:hover {
    background: rgba(82,234,255,.14) !important;
  }
  body.boom-world #trade-panel .world-sheet-close {
    display: none !important;
  }

  /* Location strip directly below the map. */
  body.boom-world #status {
    grid-area: status !important;
    width: 100% !important;
    min-height: 46px !important;
    margin: 0 !important;
    padding: 11px 16px !important;
    display: flex !important;
    align-items: center;
    border: 1px solid rgba(82,234,255,.21) !important;
    border-radius: 16px !important;
    background: linear-gradient(100deg, rgba(6,28,54,.92), rgba(16,13,55,.80)) !important;
    color: #69efff !important;
    font-weight: 900 !important;
    letter-spacing: .02em;
  }
  body.boom-world #status:before {
    content: "●";
    margin-right: 10px;
    color: #55e8bd;
    text-shadow: 0 0 10px rgba(85,232,189,.75);
  }

  /* Movement is now an actual control card instead of a giant empty panel. */
  body.boom-world .dpad-wrap {
    grid-area: dpad !important;
    display: flex !important;
    position: relative !important;
    width: 100% !important;
    min-height: 168px !important;
    height: 168px !important;
    margin: 0 !important;
    padding: 14px 20px !important;
    justify-content: center !important;
    align-items: center !important;
    overflow: hidden !important;
    border-radius: 20px !important;
  }
  body.boom-world .dpad-wrap:before {
    content: "MOVEMENT // WASD + ARROWS" !important;
    position: absolute !important;
    left: 16px !important;
    top: 13px !important;
    color: #8193b8 !important;
    font: 800 7px Orbitron, sans-serif !important;
    letter-spacing: .12em !important;
  }
  body.boom-world .dpad-wrap:after {
    content: "A / E = INTERACT  ·  TALL GRASS = TRAIN" !important;
    position: absolute !important;
    left: 16px !important;
    right: auto !important;
    bottom: 13px !important;
    color: #607493 !important;
    font: 800 6px Orbitron, sans-serif !important;
    letter-spacing: .10em !important;
  }
  body.boom-world .dpad {
    grid-template-columns: 42px 42px 42px !important;
    grid-template-rows: 42px 42px 42px !important;
    gap: 4px !important;
  }
  body.boom-world .dpad button {
    width: 42px !important;
    height: 42px !important;
    min-width: 42px !important;
    min-height: 42px !important;
    border-radius: 11px !important;
    font-size: .95rem !important;
  }
  body.boom-world .dpad .mid#btn-interact {
    font-size: .9rem !important;
  }
  body.boom-world .mob-actions {
    display: none !important;
  }

  /* Old instruction paragraphs are replaced by the compact movement labels. */
  body.boom-world .wrap > .hint,
  body.boom-world .hint-desktop {
    display: none !important;
  }

  /* Bottom navigation becomes one proper footer rather than orphaned links. */
  body.boom-world #world41-footer {
    grid-area: footer !important;
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    min-height: 50px;
    padding: 8px 10px;
    border: 1px solid rgba(82,234,255,.14);
    border-radius: 16px;
    background: rgba(4,11,29,.70);
  }
  body.boom-world #world41-footer .world41-footer-links {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
  }
  body.boom-world #world41-footer a.back {
    display: inline-flex !important;
    margin: 0 !important;
    padding: 8px 12px !important;
    align-items: center;
    gap: 5px;
    border-radius: 10px !important;
    font: 800 9px Orbitron, sans-serif !important;
    letter-spacing: .04em;
  }
  body.boom-world #world41-footer .world41-footnote {
    color: #6d7fa3;
    font: 700 7px Orbitron, sans-serif;
    letter-spacing: .08em;
    text-align: right;
  }
  body.boom-world .wrap > a.back {
    display: none !important;
  }

  /* Desktop already has the command header. The floating mobile MENU clone is
     redundant here and caused visual clutter. Mobile keeps it untouched. */
  body.boom-world #boom-mobile-menu-dock,
  body.boom-world .boom-mobile-real-menu {
    display: none !important;
  }

  /* Keep floating MMORPG / Society launchers hidden. WORLD 4 header proxies
     remain the desktop entry points. */
  body.boom-world #boom-region-switch,
  body.boom-world #boom-society-toggle,
  body.boom-world #boom-mmo6-journal > .m6btn {
    display: none !important;
  }
}

/* Mid-size desktop: keep the rail useful without squeezing the map. */
@media (min-width: 901px) and (max-width: 1180px) and (pointer: fine) {
  body.boom-world .wrap {
    grid-template-columns: minmax(0, 1.65fr) minmax(350px, 1fr) !important;
  }
  body.boom-world #world-chat.world-chat {
    height: 330px !important;
  }
}

/* Phone / touch layout intentionally remains under the existing WORLD mobile
   system. WORLD 4.1 only adds a simple footer treatment there. */
@media (max-width: 900px), (pointer: coarse) {
  body.boom-world #world41-footer {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    order: 10;
    width: 100%;
    margin-top: 4px;
  }
  body.boom-world #world41-footer .world41-footer-links {
    display: flex;
    gap: 7px;
    flex-wrap: wrap;
  }
  body.boom-world #world41-footer .world41-footnote {
    display: none;
  }
  body.boom-world #world41-footer a.back {
    margin: 0 !important;
  }
}
