body:not(.touch) #hud-menu .menu-bar {
  --menu-cell: clamp(39px, 5.6vw, 54px);
  --menu-gap: 3px;
  width: max-content;
  max-width: calc(8 * var(--menu-cell) + 7 * var(--menu-gap));
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: var(--menu-gap);
  padding: 0;
  border: 0;
  background: none;
  box-shadow: none;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

body:not(.touch) #hud:not([data-hl-moved~=menu]) {
  --mello-stack-base: calc(var(--pad) + var(--safe-b) + var(--bar-h, 68px) + 6px);
  --hud-cast-bottom: calc(var(--mello-stack-base) + 114px);
}

body:not(.touch) #hud:not([data-hl-moved~=menu]) #hotbars {
  bottom: var(--mello-stack-base);
}

body:not(.touch) #hud:not(.hb-stack):not([data-hl-moved~=menu]):not([data-hl-moved~=pet]) #hud-pet {
  bottom: max(var(--mello-stack-base), calc(var(--pad) + var(--safe-b) + 66px * var(--hs, 1)));
}

body:not(.touch) #hud:not(.hb-stack):not([data-hl-moved~=menu]):not([data-hl-moved~=guarder]) #hud-guarder {
  --mello-guarder-rise: 146px;
  bottom: calc(max(var(--mello-stack-base), var(--pad) + var(--safe-b) + 70px * var(--hs, 1))
    + var(--gp-on) * var(--mello-guarder-rise) * var(--hs, 1));
}

@media (max-height: 700px) and (min-width: 1180px) {
  body:not(.touch) #hud:not(.hb-stack):not([data-hl-moved~=menu]):not([data-hl-moved~=guarder]) #hud-guarder {
    --mello-guarder-rise: 0px;
  }
}

body:not(.touch) #hud.hb-stack:not([data-hl-moved~=menu]):not([data-hl-moved~=pet]) #hud-pet {
  bottom: calc(var(--mello-stack-base) + 116px * var(--hs, 1));
}

body:not(.touch) #hud.hb-stack:not([data-hl-moved~=menu]):not([data-hl-moved~=guarder]) #hud-guarder {
  bottom: calc(var(--mello-stack-base) + (120px + var(--gp-on) * 146px) * var(--hs, 1));
}

body:not(.touch) #hud #hud-menu .menu-bar .mbtn {
  width: var(--menu-cell);
  height: 49px;
  gap: 2px;
  color: #fffdf5;
  border-radius: 10px;
}

body:not(.touch) #hud #hud-menu .menu-bar .mbtn-ico {
  width: 26px;
  height: 26px;
  color: inherit;
  background: none;
  box-shadow: none;
}

body:not(.touch) #hud #hud-menu .menu-bar .mbtn-ico .ico {
  width: 22px;
  height: 22px;
  stroke-width: 1.85;
  filter: drop-shadow(0 1px 1px #081921) drop-shadow(0 1px 3px #081921b3);
}

body:not(.touch) #hud #hud-menu .menu-bar .mbtn small {
  display: block;
  padding-inline: 2px;
  color: inherit;
  font-size: 10px;
  text-shadow: 0 1px 2px #081921, 0 1px 4px #081921;
}

body:not(.touch) #hud #hud-menu .menu-bar .mbtn:is(:hover, :focus-visible, .active, [aria-expanded=true]) {
  color: #ffe6ad;
  background: #173e55bd;
}

body:not(.touch) #hud #hud-menu .menu-bar .mbtn:focus-visible {
  outline: 2px solid #a5e3e7;
  outline-offset: 1px;
}

body:not(.touch) #hud #hud-menu .menu-bar .mbtn.notify::after {
  width: 8px;
  height: 8px;
  top: 4px;
  right: 10px;
  background: #ffc76c;
  box-shadow: 0 0 0 1.5px #fff4d8, 0 2px 5px #102638;
}

#hud .menu-items {
  --mello-menu-ink: #203d4b;
  --mello-menu-line: #d9e4df;
  max-width: calc(100vw - 2 * var(--pad) - var(--safe-l) - var(--safe-r));
  grid-template-columns: repeat(4, minmax(0, 78px));
  gap: 6px;
  padding: 10px;
  color: var(--mello-menu-ink);
  background: #faf7ee;
  border: 1px solid #a9c5c1;
  border-radius: 18px;
  box-shadow: inset 0 1px #fff, 0 8px 24px #0c273657;
  scrollbar-color: #91b1af transparent;
}

#hud .menu-items .mello-menu-heading {
  order: -1;
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  margin-bottom: 3px;
  padding: 5px 9px;
  border: 1px solid #cfdfda;
  border-radius: 11px;
  background: linear-gradient(105deg, #daede9, #eef4e7);
  font-size: 16px;
}

.mello-menu-emblem {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  color: #fffaf0;
  background: #2b5d61;
}

.mello-menu-emblem .ico {
  width: 17px;
  height: 17px;
}

.mello-menu-brand {
  margin-inline-start: auto;
  color: #44676b;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

#hud .menu-items .mbtn {
  width: 100%;
  height: 62px;
  gap: 4px;
  padding-inline: 3px;
  color: var(--mello-menu-ink);
  border: 1px solid var(--mello-menu-line);
  border-radius: 11px;
  background: #fffdfa;
}

#hud .menu-items .mbtn[data-sys] {
  background: #f0f4f1;
}

#hud .menu-items .mbtn:is(:hover, :focus-visible, .active, [aria-expanded=true]) {
  color: #173d44;
  border-color: #8eb7b4;
  background: #e7f3ef;
}

#hud .menu-items .mbtn:focus-visible {
  outline: 2px solid #2b676d;
  outline-offset: -2px;
}

#hud .menu-items .mbtn-ico {
  width: 28px;
  height: 28px;
  color: #23545d;
  color: color-mix(in srgb, var(--mc-b) 38%, #1c3d48);
  border-radius: 8px;
  background: #e6f1ed;
  background: color-mix(in srgb, var(--mc-a) 42%, #fffdf7);
  box-shadow: none;
}

#hud .menu-items .mbtn-ico .ico {
  width: 18px;
  height: 18px;
  stroke-width: 1.9;
  filter: none;
}

#hud .menu-items .mbtn:hover .mbtn-ico {
  transform: translateY(-1px);
}

#hud .menu-items .mbtn small {
  color: inherit;
  text-shadow: none;
  font-size: 11px;
  line-height: 1.15;
}

#hud .menu-items .mbtn.notify::after {
  top: 5px;
  right: 6px;
  width: 8px;
  height: 8px;
  background: #c85139;
  box-shadow: 0 0 0 2px #fffdfa;
}

#hud .menu-items .menu-foot {
  order: 1;
  gap: 7px;
  flex-wrap: wrap;
  padding: 8px 0 0;
  border-top: 1px solid #ccdcd6;
}

#hud .menu-items .menu-hint {
  flex: 1 1 150px;
  color: #48616d;
  text-shadow: none;
}

#hud .menu-items .menu-foot .btn {
  min-height: 30px;
  color: #244e55;
  border: 1px solid #afcbc4;
  border-radius: 9px;
  background: #e5f0eb;
  box-shadow: none;
}

#hud .menu-items .menu-foot .btn:not(:disabled):is(:hover, :focus-visible) {
  background: #d4e9e2;
}

body.touch #hud .menu-items {
  max-width: min(570px, calc(100vw - max(8px, var(--safe-l)) - max(8px, var(--safe-r))));
  max-height: calc(100dvh - 82px - var(--safe-t) - var(--safe-b));
  margin-inline: auto;
  grid-template-columns: repeat(auto-fill, minmax(68px, 1fr));
  padding: 9px;
}

body.touch #hud .menu-items .menu-foot .btn {
  min-height: 44px;
}

#hud .hotbar {
  --mello-hot-accent: #285b5f;
  --mello-hot-tint: #e0efeb;
  --mello-hot-line: #a9c9c1;
  background: #faf7eef5;
  border-color: #adc8c1;
  border-radius: 14px;
  box-shadow: inset 0 1px #fff, 0 3px 10px #102e3b55;
}

#hud #hotbar-2 {
  --mello-hot-accent: #785124;
  --mello-hot-tint: #f4e8d4;
  --mello-hot-line: #d8be95;
}

#hud #hotbar-1[data-page="2"] {
  --mello-hot-accent: #574c78;
  --mello-hot-tint: #ebe5f3;
  --mello-hot-line: #c6b7d9;
}

#hud .hotbar .hot {
  border-radius: 9px;
  background: var(--mello-hot-tint);
}

#hud .hotbar .hot:not(.on, .hold-ask, .cd-queued, .drop-hover) {
  box-shadow: inset 0 0 0 1px var(--mello-hot-line);
}

#hud .hotbar .hot:not(.on, .hold-ask, .cd-queued, .drop-hover):hover {
  box-shadow: inset 0 0 0 2px var(--mello-hot-accent);
}

#hud .hotbar .hot .icon {
  border-radius: 6px;
}

#hud :is(#hotbar-1, #hotbar-2) .hot-key {
  color: #fff;
  background: var(--mello-hot-accent);
  box-shadow: 0 0 0 1px #fffdf4;
}

#hud :is(#hotbar-1, #hotbar-2) .hot:is(:not(:has(.icon)), .out) .hot-key {
  color: var(--mello-hot-accent);
  background: none;
  box-shadow: none;
}

#hud .hotbar .slot-count {
  background: #263f50;
}

#hud .hotbar .hp-btn {
  color: var(--mello-hot-accent);
  background: var(--mello-hot-tint);
}

#hud .hotbar .hp-btn:is(:hover, :focus-visible) {
  color: #fff;
  background: var(--mello-hot-accent);
}

#hud #hotbar-1 .hp-num {
  color: var(--mello-hot-accent);
  background: none;
  text-shadow: none;
  box-shadow: none;
}

body.touch #hud .hotbar,
body.touch #hud .hotbar .hot {
  border-radius: 7px;
}

body.touch #hud .hot-page {
  /* Keep the page controls above the bar's expanded touch hit area. */
  position: relative;
}
