/* In-game menu: collapsible groups everywhere; on phones it becomes a bottom sheet with two-column links. */
#hudMenu a[hidden]{display:none!important}
html body #hudMenu,html body #hudMenu[data-open="true"]{display:block}
/* Phones: the Menu list slides out from the right, just under the top bar, like the utilities panel slides in from the side. */
@media (max-width: 700px) {
 html body #hudMenu { position: fixed; top: 64px; right: 0; bottom: auto; left: auto; width: min(280px, 82vw); max-height: calc(100vh - 80px); border-radius: 12px 0 0 12px; transform: translateX(calc(100% + 24px)); transition: transform .25s ease; pointer-events: none; visibility: hidden; z-index: var(--z-menu,900); }
 html body #hudMenu[data-open="true"] { transform: none; pointer-events: auto; visibility: visible; }
}
#hudMenu{max-height:min(70vh,560px);overflow:auto;-webkit-overflow-scrolling:touch;overscroll-behavior:contain}
#hudMenu details.hud-group{border-bottom:1px solid #4a4a2e;margin:0}
#hudMenu details.hud-group>summary{list-style:none;cursor:pointer;display:flex;align-items:center;justify-content:space-between;min-height:44px;padding:8px 10px;font:700 14.5px/1.2 Grenze Gotisch,Georgia,serif;letter-spacing:.04em;color:#f1d39a;text-transform:uppercase}
#hudMenu details.hud-group>summary::-webkit-details-marker{display:none}
#hudMenu details.hud-group>summary::after{content:"+";font:700 20px/1 Grenze Gotisch,Georgia,serif;color:#d9b777}
#hudMenu details.hud-group[open]>summary::after{content:"\2212"}
html body #hudMenu .hud-group-links{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:6px;padding:4px 6px 10px}
html body #hudMenu .hud-group-links a{min-width:0;display:flex;align-items:center;min-height:44px;padding:8px 10px;border-radius:8px;background:#203a2d;border:1px solid #49644f;color:#f4efde;font:600 14.5px/1.25 Grenze Gotisch,Georgia,serif;text-decoration:none}
#hudMenu .hud-group-links a:hover,#hudMenu .hud-group-links a:focus-visible{background:#355b47;border-color:#d2b875}
@media (max-width:480px){
  /* Bottom sheet: sits above the launchers, leaves the map visible above it, and scrolls inside itself. */
  html body #hudMenu{position:fixed;left:0;right:0;bottom:0;top:auto;width:100%;max-width:100%;max-height:60vh;background:#0f1d17f7;border-radius:16px 16px 0 0;border-width:1px 0 0;padding:0 0 env(safe-area-inset-bottom,0);box-shadow:0 -10px 28px rgb(0 0 0 / .55);z-index:var(--z-menu,900)}
  #hudMenu::before{content:"";display:block;width:44px;height:5px;border-radius:3px;background:#8f7a51;margin:8px auto 2px}
  html body #hudMenu .hud-group-links{grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:6px;padding:4px 12px 12px}
  html body #hudMenu .hud-group-links a{font-size:15.5px;min-width:0}
}
/* Plain-class versions of the rules below. Browsers without :has() drop those rules, so play.html sets body.k-menu-sheet-open
   from the menu's data-open attribute; these rules work from that class alone. */
body.k-menu-sheet-open .k-lore-button,body.k-menu-sheet-open .k-feat-button,body.k-menu-sheet-open .k-mg-button,body.k-menu-sheet-open .k-feat-panel,body.k-menu-sheet-open .k-lore-panel,body.k-menu-sheet-open .k-mg-panel{visibility:hidden!important}
body.k-menu-sheet-open #kTouch .kt-btns,body.k-menu-sheet-open #kTouch .kt-joy,body.k-menu-sheet-open #kDockToggle{visibility:hidden!important}
/* While the menu sheet is open, the bottom launchers step aside so the sheet is fully readable. */
body:has(#hudMenu[data-open="true"]) .k-lore-button,body:has(#hudMenu[data-open="true"]) .k-feat-button,body:has(#hudMenu[data-open="true"]) .k-mg-button{visibility:hidden}
/* While the menu sheet is open, the touch buttons and the side tab step aside. The sheet is solid, so the map does not show through the text. */
body:has(#hudMenu[data-open="true"]) #kTouch .kt-btns,body:has(#hudMenu[data-open="true"]) #kTouch .kt-joy,body:has(#hudMenu[data-open="true"]) #kDockToggle{visibility:hidden}
@media (max-width:480px){html body #hudMenu{background:#0f1d17;}}

/* Lore, Features and Minigames already live under Tools in the HUD menu. The floating launchers covered the map and chat, so they are hidden. */
.k-feat-button,.k-lore-button,.k-mg-button{display:none !important}
