/* ==========================================================================
   MU Việt: Đăng nhập / Đăng ký + HUD (web/account.js, web/hud.js)
   ========================================================================== */

.mu-account {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: radial-gradient(ellipse at center, rgba(40, 24, 8, 0.92), rgba(0, 0, 0, 0.97));
  font-family: 'Outfit', system-ui, sans-serif;
}
.mu-account.hidden { display: none; }
.mu-acc-card {
  width: min(360px, 100%);
  box-sizing: border-box;
  max-height: calc(100dvh - 32px);
  overflow: auto;
  padding: 22px 22px 16px;
  border-radius: 14px;
  border: 1px solid rgba(234, 179, 8, 0.35);
  background: rgba(14, 15, 20, 0.96);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7);
}
.mu-acc-logo { text-align: center; font: 900 30px/1 'Outfit', sans-serif; letter-spacing: 3px; color: #fbbf24; }
.mu-acc-sub { text-align: center; color: #94a3b8; font-size: 13px; margin: 6px 0 14px; }
.mu-acc-tabs { display: flex; gap: 6px; margin-bottom: 12px; }
.mu-acc-tabs button {
  flex: 1; min-height: 36px; border-radius: 8px; border: 1px solid rgba(255, 255, 255, 0.12);
  background: #1b1e27; color: #cbd5e1; font-weight: 700; cursor: pointer;
}
.mu-acc-tabs button.active { background: #ca8a04; color: #111; border-color: #ca8a04; }
.mu-acc-row { display: flex; flex-direction: column; gap: 4px; margin: 9px 0; color: #e2e8f0; font-size: 13px; }
.mu-acc-row input {
  height: 40px; padding: 0 10px; border-radius: 8px; border: 1px solid rgba(255, 255, 255, 0.15);
  background: #1b1e27; color: #f8fafc; font-size: 16px; outline: none;
}
.mu-acc-row input:focus { border-color: #eab308; }
.mu-acc-msg { min-height: 18px; margin: 6px 0; color: #f87171; font-size: 13px; }
.mu-acc-msg.ok { color: #4ade80; }
.mu-acc-submit {
  width: 100%; height: 44px; border: 0; border-radius: 9px; background: linear-gradient(#eab308, #ca8a04);
  color: #111; font: 800 16px 'Outfit', sans-serif; cursor: pointer;
}
.mu-acc-note { margin: 10px 0 0; color: #64748b; font-size: 12px; text-align: center; }
.mu-acc-actions { display: flex; flex-direction: column; gap: 8px; }
.mu-acc-actions .mu-top-btn { height: 42px; justify-content: flex-start; padding: 0 14px; font-size: 14px; }
.mu-acc-logout { color: #fca5a5 !important; }

/* ── HUD ─────────────────────────────────────────────────────────────────── */
.mu-hud { display: none; font-family: 'Outfit', system-ui, sans-serif; }
body.mu-ingame .mu-hud { display: block; }
body:not(.mu-ingame) .mu-admin-toggle { display: none; }
body.mu-ingame #muQuickBar,
body.mu-ingame #muRBtn { display: none !important; }
.mu-hud > div { position: fixed; z-index: 9; }
.mu-hud > .mu-player-label {
  position: fixed; z-index: 8; pointer-events: none; transform: translate(-50%, -100%); white-space: nowrap;
  font: 600 clamp(10px, 1.5vw, 13px) system-ui, sans-serif; color: #fff2c9;
  background: rgb(15 10 4 / 75%); padding: 2px 5px; border-radius: 4px; border: 0;
}
.mu-hud > button.mu-player-label { pointer-events: auto; cursor: pointer; }
.mu-hud > button.mu-player-label:hover { background: #58431d; }

/* Character card */
.mu-hud-card {
  left: 8px; top: 48px; width: 230px; padding: 8px;
  border-radius: 10px; border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(10, 11, 16, 0.78);
}
.mu-hud-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.mu-hud-lv {
  width: 40px; height: 40px; border-radius: 50%; flex: none;
  border: 2px solid #ca8a04; background: radial-gradient(#3b2a0a, #120d04);
  display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1;
}
.mu-hud-lv span { font-size: 9px; color: #fde68a; font-weight: 700; }
.mu-hud-lv b { font-size: 14px; color: #fff; }
.mu-hud-name { color: #f8fafc; font-weight: 800; font-size: 14px; }
.mu-hud-cls { color: #94a3b8; font-size: 11.5px; }
.mu-vitals { display: flex; justify-content: center; gap: 12px; margin: 7px 0; }
.mu-vital {
  position: relative; display: grid; place-items: center; isolation: isolate; overflow: hidden;
  width: clamp(48px, 12vh, 72px); aspect-ratio: 1; border-radius: 50%;
  background: #10121a; border: 1px solid #7b6540; box-shadow: inset 0 0 0 3px #222334;
  color: #fff; text-align: center; text-shadow: 0 1px 2px #000;
}
.mu-vital i { position: absolute; z-index: -1; inset: auto 0 0; height: 0; transition: height .2s; }
.mu-vital.hp i { background: linear-gradient(#ff7b72, #8c1427 70%); }
.mu-vital.mp i { background: linear-gradient(#7dd3fc, #1e40af 70%); }
.mu-vital span { display: grid; gap: 2px; font-size: 12px; }
.mu-vital small { font-size: clamp(8px, 2vh, 10px); font-weight: 700; }
.mu-hud-bar {
  position: relative; height: 15px; margin: 3px 0; border-radius: 4px; overflow: hidden;
  background: rgba(255, 255, 255, 0.08); border: 1px solid rgba(0, 0, 0, 0.5);
}
.mu-hud-bar i { position: absolute; left: 0; top: 0; bottom: 0; width: 0; transition: width .2s; }
.mu-hud-bar span {
  position: relative; display: block; text-align: center; color: #fff;
  font: 700 10.5px/15px 'Outfit', sans-serif; text-shadow: 0 1px 2px #000;
}
.mu-hud-bar.hp i { background: linear-gradient(#ef4444, #991b1b); }
.mu-hud-bar.mp i { background: linear-gradient(#3b82f6, #1e3a8a); }
.mu-hud-bar.ag i { background: linear-gradient(#a855f7, #581c87); }
.mu-hud-bar.xp { height: 4px; }
.mu-hud-bar.xp i { background: #eab308; }
/* Location + menu */
.mu-hud-side { right: 8px; top: 48px; width: 230px; display: flex; flex-direction: column; align-items: stretch; gap: 6px; }
.mu-hud-loc {
  display: flex; justify-content: space-between; padding: 6px 10px; border-radius: 8px;
  background: rgba(10, 11, 16, 0.78); border: 1px solid rgba(255, 255, 255, 0.12); color: #e2e8f0; font-size: 12.5px;
}
.mu-hud-loc b { color: #fde68a; }
.mu-hud-map-row { display: flex; flex-direction: row-reverse; align-items: flex-start; gap: 5px; }
.mu-map-shortcuts {
  --mu-map-icon: 32px; --mu-map-shortcut: 44px;
  flex: none; display: grid; grid-template-columns: repeat(2, var(--mu-map-shortcut)); gap: 4px;
}
.mu-map-shortcuts button {
  min-width: 0; padding: 2px 0; display: grid; justify-items: center; align-content: start; gap: 2px;
  border: 0; border-radius: 6px; background: #171c27; color: #fff1cf;
  cursor: pointer; touch-action: manipulation;
}
.mu-map-shortcuts button:is(:hover, :focus-visible) { background: #332d24; }
.mu-map-shortcuts button[data-act="jewelbank"] { grid-column: 1 / -1; }
.mu-map-shortcuts i {
  box-sizing: border-box; display: grid; place-items: center; width: var(--mu-map-icon); height: var(--mu-map-icon);
  border: 1px solid #776039; border-radius: 50%; font-style: normal; font-size: 17px; line-height: 1;
}
.mu-map-shortcut-label { text-align: center; font: 700 10px/1.12 system-ui, sans-serif; }
.mu-hud-minimap {
  position: relative; width: clamp(78px, 19vh, 146px); min-width: 0; aspect-ratio: 1;
  padding: 0; overflow: hidden; cursor: pointer; border-radius: 8px;
  border: 1px solid #776039; color: #fde68a; background: #0f171f;
}
.mu-hud-minimap.has-terrain { background-image: url('hud-terrain.png?v=login139'); background-repeat: no-repeat; }
.mu-hud-minimap i {
  position: absolute; width: 7px; height: 7px; border-radius: 50%; background: #fbbf24;
  transform: translate(-50%, -50%); box-shadow: 0 0 0 1px #111, 0 0 5px #fbbf24;
}
.mu-hud-minimap span {
  position: absolute; right: 3px; bottom: 3px; padding: 1px 4px; border-radius: 3px;
  background: #10151b; font-size: 10px;
}
.mu-hud-menu {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; padding: 8px; border-radius: 10px;
  max-height: 45vh; overflow: auto;
  background: rgba(10, 11, 16, 0.78); border: 1px solid rgba(255, 255, 255, 0.12);
}
.mu-hud-menu.closed { display: none; }
.mu-hud-menu button {
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0; border: 0;
  border-radius: 8px; background: transparent; color: #e2e8f0; font-size: 10.5px; cursor: pointer;
}
.mu-hud-menu button i {
  font-style: normal; font-size: 17px; width: 34px; height: 34px; line-height: 34px; text-align: center;
  border-radius: 50%; background: radial-gradient(#2a3040, #12151d); border: 1px solid rgba(234, 179, 8, 0.45);
}
.mu-hud-menu button:active i { background: #ca8a04; }

.mu-hud-dialog {
  box-sizing: border-box; width: min(440px, calc(100vw - 24px)); max-height: 84vh; overflow: auto;
  padding: 14px; border: 1px solid #6f562e; border-radius: 12px; background: #141720; color: #e2e8f0;
}
.mu-hud-dialog::backdrop { background: rgba(0, 0, 0, .56); }
.mu-hud-dialog header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.mu-hud-dialog h2 { margin: 0; font-size: 19px; color: #fde68a; }
.mu-hud-dialog p { margin: 8px 0; font-size: 13px; }
.mu-hud-dialog button, .mu-hud-dialog input:not([type="checkbox"]), .mu-hud-dialog select {
  min-height: 34px; border-radius: 6px; border: 1px solid #454957; background: #252936; color: #f8fafc;
}
.mu-hud-dialog button { padding: 4px 10px; cursor: pointer; }
.mu-hud-dialog button:disabled { opacity: .48; cursor: default; }
.mu-hud-dialog button:not(:disabled):hover { border-color: #fbbf24; }
.mu-travel-list { display: grid; gap: 5px; }
.mu-travel-choice { display: flex; justify-content: space-between; align-items: center; text-align: left; }
.mu-travel-choice span { font-size: 12px; color: #fde68a; }
.mu-inspect-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  grid-template-areas:
    "pet helm helm wings wings"
    "main main armor off off"
    "main main pants off off"
    "gloves ring1 necklace ring2 boots";
  gap: 4px;
  padding: 5px;
  border: 1px solid #5d5341;
  border-radius: 8px;
  background: #0e1118;
}
.mu-inspect-grid .mu-inspect-slot {
  box-sizing: border-box;
  min-height: 64px;
  padding: 3px;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 3px;
  border: 1px solid #626070;
  border-radius: 5px;
  background: radial-gradient(ellipse at center, #3a3d4b, #1b1e27 78%);
}
.mu-inspect-grid .empty { border-color: #393c47; background: #151820; color: #a4abba; }
.mu-inspect-grid [aria-pressed="true"] { border-color: #f6d47e; box-shadow: inset 0 0 0 1px #f6d47e; }
.mu-inspect-slot-label { font-size: 10px; text-align: center; }
.mu-inspect-grid .model { max-width: 100%; }
.mu-inspect-detail { display: grid; gap: 3px; min-height: 38px; padding: 6px 2px; font-size: 13px; }
.mu-inspect-detail strong { color: #fde68a; }
.mu-admin-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.mu-hud-dialog fieldset { margin: 10px 0 0; border: 1px solid #454957; border-radius: 8px; }
.mu-admin-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 10px; align-items: end; }
.mu-admin-fields label { font-size: 13px; }
.mu-admin-fields input:not([type="checkbox"]), .mu-admin-fields select, .mu-admin-item-picker select {
  box-sizing: border-box; display: block; width: 100%; padding: 3px 6px; font-size: 16px;
}
.mu-admin-item-picker { display: grid; grid-template-columns: 48px minmax(0, 1fr); align-items: end; gap: 8px; margin-bottom: 10px; }
#muAdminItemIcon { display: grid; place-items: center; width: 48px; height: 48px; font-size: 26px; background: #272b35; border-radius: 8px; }
#muAdminItem button { margin-top: 8px; }
#muHudAdminStatus { color: #7dd3fc; }
.mu-rank-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.mu-rank-table th, .mu-rank-table td { padding: 6px; border-bottom: 1px solid #454957; text-align: left; }
.mu-rank-table th { color: #fde68a; }
.mu-attendance-days {
  display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; list-style: none;
  margin: 12px 0; padding: 0;
}
.mu-attendance-days li {
  display: grid; place-items: center; aspect-ratio: 1; width: min(100%, 38px); justify-self: center; border: 1px solid #454957; border-radius: 50%; background: #252936;
}
.mu-attendance-days .claimed { border-color: #3f9878; background: #214738; color: #baffdd; }
.mu-attendance-days .milestone { border-color: #b79147; color: #fde68a; }
.mu-attendance-days li button { width: 100%; height: 100%; padding: 0; border: 0; border-radius: 50%; background: transparent; color: inherit; }
.mu-attendance-days button[aria-pressed="true"] { box-shadow: 0 0 0 2px #f6d47e; }
.mu-attendance-preview { display: grid; gap: 5px; }
.mu-attendance-preview h3 { margin: 3px 0; font-size: 14px; color: #fde68a; }
.mu-attendance-reward { display: flex; gap: 8px; align-items: center; }

/* Chat panel (above the game's bottom bar) */
.mu-hud-chat {
  left: 8px; bottom: calc(13vh + 6px); width: min(380px, 46vw); display: flex; flex-direction: column;
  border-radius: 10px; border: 1px solid rgba(255, 255, 255, 0.12); background: rgba(10, 11, 16, 0.8);
  overflow: hidden;
}
.mu-chat-tabs { display: flex; gap: 2px; padding: 4px; background: rgba(0, 0, 0, 0.35); }
.mu-chat-tabs button {
  flex: 1; height: 24px; border: 0; border-radius: 5px; background: transparent; color: #94a3b8;
  font-size: 12px; font-weight: 700; cursor: pointer;
}
.mu-chat-tabs button.active { background: #ca8a04; color: #111; }
.mu-chat-tabs .mu-chat-min { flex: 0 0 28px; color: #e2e8f0; }
.mu-chat-log {
  height: 150px; overflow-y: auto; padding: 4px 8px; font-size: 12.5px; line-height: 1.35; color: #e2e8f0;
  overscroll-behavior: contain;
}
.mu-chat-open { display: none; }
.mu-hud-chat.min { width: fit-content; border: 0; background: transparent; overflow: visible; }
.mu-hud-chat.min #muChatPanel { display: none; }
.mu-hud-chat.min .mu-chat-open {
  position: relative; display: grid; place-items: center; width: 42px; height: 42px;
  border: 1px solid #ae8a48; border-radius: 50%; background: #171d29;
  color: #fff; font-size: 21px; cursor: pointer;
}
.mu-chat-unread:not([hidden]) {
  position: absolute; top: -4px; right: -6px; min-width: 17px; height: 17px;
  padding-inline: 2px; display: grid; place-items: center;
  border-radius: 12px; background: #bd263b; color: #fff; font: 800 10px/1 system-ui, sans-serif;
}
.mu-chat-line { margin: 1px 0; word-wrap: break-word; }
.mu-chat-line em { color: #64748b; font-style: normal; font-size: 11px; }
.mu-chat-line u { text-decoration: none; font-weight: 700; }
.mu-chat-line b { color: #fbbf24; }
.mu-chat-line.world { color: #fde68a; }
.mu-chat-line.world u { color: #f59e0b; }
.mu-chat-item-link {
  color: #93dcff; background: transparent; border: 0; padding: 1px 2px;
  font: inherit; text-decoration: underline; cursor: pointer;
}
.mu-shared-item { display: flex; align-items: center; gap: 12px; }
.mu-shared-item [data-item-icon] { display: grid; place-items: center; min-width: 54px; min-height: 54px; }
.mu-shared-item [data-owner] { margin: 3px 0; }
.mu-chat-line.sys { color: #7dd3fc; }
.mu-chat-line.party { color: #93c5fd; }
.mu-chat-line.guild { color: #86efac; }
.mu-chat-line.whisper { color: #f0abfc; }
.mu-chat-log[data-filter="world"] .mu-chat-line:not(.world) { display: none; }
.mu-chat-log[data-filter="sys"] .mu-chat-line:not(.sys) { display: none; }
.mu-chat-input { display: flex; gap: 4px; padding: 5px; border-top: 1px solid rgba(255, 255, 255, 0.08); }
.mu-chat-input input {
  flex: 1; min-width: 0; height: 32px; padding: 0 8px; border-radius: 6px; outline: none;
  border: 1px solid rgba(255, 255, 255, 0.14); background: #1b1e27; color: #f8fafc; font-size: 16px;
}
.mu-chat-input input:focus { border-color: #eab308; }
.mu-chat-input button {
  height: 32px; padding: 0 10px; border: 0; border-radius: 6px; background: #ca8a04; color: #111;
  font-weight: 800; font-size: 13px; cursor: pointer;
}
.mu-chat-input .mu-chat-chan { background: #2a2d37; color: #cbd5e1; font-weight: 700; font-size: 12px; }
.mu-chat-input .mu-chat-chan.on { background: #78350f; color: #fde68a; }

/* Action buttons (bottom right, above the game's bar) */
.mu-hud-actions {
  right: 10px; bottom: calc(13vh + 6px); display: grid;
  grid-template-columns: repeat(3, 46px) 76px; grid-template-rows: repeat(3, 46px); gap: 6px;
  touch-action: none; user-select: none; -webkit-user-select: none;
}
.mu-hud-actions button {
  border-radius: 50%; border: 1px solid rgba(255, 255, 255, 0.2); background: rgba(14, 16, 22, 0.82);
  color: #f1f5f9; font: 800 15px/1 'Outfit', sans-serif; cursor: pointer; touch-action: none; padding: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.mu-hud-actions button span { font-size: 9.5px; font-weight: 700; margin-top: 2px; }
.mu-hud-actions button.on { background: #ca8a04; color: #111; }
.mu-act-main {
  grid-column: 4; grid-row: 2 / span 2; width: 76px; height: 76px; align-self: end;
  font-size: 24px !important; border: 2px solid #ca8a04 !important; background: radial-gradient(#4a2e05, #140c02) !important;
}
.mu-act-skill { grid-row: 3; }
.mu-act-skill[data-key="52"] { grid-column: 4; grid-row: 1; width: 46px; justify-self: center; }
.mu-act-pick { grid-column: 1; grid-row: 2; background: #14532d !important; font-size: 18px !important; }
.mu-act-hp { grid-column: 2; grid-row: 2; border-color: #ef4444 !important; }
.mu-act-mp { grid-column: 3; grid-row: 2; border-color: #3b82f6 !important; }

.mu-hud-dock {
  right: max(10px, env(safe-area-inset-right)); bottom: calc(13vh + 160px);
}
.mu-hud > .mu-hud-dock { z-index: 15; }
.mu-hud-shortcuts { display: flex; gap: 7px; justify-content: flex-end; }
.mu-hud-shortcuts button {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  min-width: 44px; padding: 0 2px; border: 0; background: transparent; cursor: pointer;
  color: #f8fafc; font: 700 10px/1.2 'Outfit', sans-serif; text-shadow: 0 1px 2px #000;
}
.mu-hud-shortcuts button i {
  display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%;
  border: 1px solid #ae8a48; background: radial-gradient(#353144, #17131d);
  color: #f8d678; font: 700 18px/1 system-ui, sans-serif;
}
.mu-hud-shortcuts button[aria-expanded="true"] i, .mu-hud-shortcuts button:active i { background: #83601f; }
.mu-hud-menu {
  position: absolute; right: 0; bottom: calc(100% + 6px); width: min(384px, calc(100vw - 24px));
  box-sizing: border-box; max-height: min(46dvh, calc(82dvh - 220px - env(safe-area-inset-top)));
  overscroll-behavior: contain; background: #141720;
}
.mu-act-assignable span { max-width: 100%; padding-inline: 2px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.mu-auto-mode { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.mu-auto-mode button[aria-pressed="true"] { background: #78350f; color: #fff7d6; border-color: #fbbf24; }
#muHudNumberSkill { width: min(460px, calc(100vw - 20px)); }
.mu-skill-grid {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px; max-height: 47dvh; overflow: auto;
}
.mu-hud-dialog .mu-skill-choice {
  display: flex; align-items: center; gap: 4px; min-height: 42px;
  padding: 4px; text-align: left; font-size: 12px; overflow-wrap: anywhere;
}
.mu-skill-choice i { flex: none; width: 24px; height: 24px; }
.mu-skill-choice[aria-pressed="true"] { border-color: #fbbf24; background: #4a3516; }
.mu-skill-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; margin-top: 8px; }
.mu-skill-actions button { min-height: 36px; }
@media (max-width: 360px) { .mu-skill-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

@media (max-width: 900px), (pointer: coarse) {
  body.mu-ingame header.mu-topbar {
    height: calc(40px + env(safe-area-inset-top));
    padding: env(safe-area-inset-top) max(6px, env(safe-area-inset-right)) 0 max(6px, env(safe-area-inset-left));
  }
  body.mu-ingame .mu-topbar-right { min-width: 0; gap: 3px; }
  body.mu-ingame .mu-topbar-right .mu-top-btn { padding-inline: 6px; min-width: 28px; }
  body.mu-ingame .mu-topbar .mu-top-sep,
  body.mu-ingame .mu-topbar .mu-realm-badge,
  body.mu-ingame #muBtnInfo { display: none; }
  .mu-hud-card {
    box-sizing: border-box; left: auto; right: max(8px, env(safe-area-inset-right));
    top: calc(46px + env(safe-area-inset-top)); width: min(54vw, 210px); padding: 5px;
  }
  .mu-hud-head { margin-bottom: 3px; min-width: 0; }
  .mu-hud-lv { width: 29px; height: 29px; }
  .mu-hud-lv b { font-size: 12px; }
  .mu-hud-who { min-width: 0; }
  .mu-hud-name, .mu-hud-cls { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
  .mu-hud-name { font-size: 12px; }
  .mu-vitals { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 4px; margin: 3px 0; }
  .mu-vital { width: auto; aspect-ratio: auto; min-height: 27px; border-radius: 5px; box-shadow: none; }
  .mu-vital span { gap: 1px; font-size: 10px; }
  .mu-vital small { font-size: 9px; white-space: nowrap; }
  .mu-hud-bar { height: 10px; margin: 2px 0; }
  .mu-hud-bar span { line-height: 10px; font-size: 9px; }
  .mu-hud-bar.xp { height: 4px; }
  .mu-hud-side {
    left: max(8px, env(safe-area-inset-left)); right: auto;
    top: calc(46px + env(safe-area-inset-top)); width: min(38vw, 132px); gap: 4px;
  }
  .mu-hud-loc { gap: 4px; padding: 4px; font-size: 11px; }
  .mu-hud-map-row { flex-direction: row; gap: 4px; }
  .mu-map-shortcuts { --mu-map-icon: 26px; --mu-map-shortcut: clamp(32px, 9vw, 36px); gap: 3px; }
  .mu-map-shortcuts i { font-size: 14px; }
  .mu-map-shortcut-label { font-size: 9px; }
  .mu-hud-minimap { width: clamp(54px, 15dvh, 84px); }
  .mu-hud-minimap span { font-size: 8px; }
  .mu-hud-dock { right: max(8px, env(safe-area-inset-right)); bottom: calc(124px + env(safe-area-inset-bottom)); }
  .mu-hud-shortcuts { gap: 3px; }
  .mu-hud-shortcuts button { min-width: 40px; font-size: 9px; }
  .mu-hud-shortcuts button i { width: 33px; height: 33px; font-size: 15px; }
  .mu-hud-menu {
    width: min(360px, calc(100vw - 20px - env(safe-area-inset-left) - env(safe-area-inset-right)));
    max-height: calc(100dvh - 225px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  }
  .mu-hud-menu button { min-height: 38px; padding: 2px 0; }
  .mu-hud-menu button i { width: 25px; height: 25px; line-height: 25px; font-size: 14px; }
  .mu-hud-chat {
    left: max(8px, env(safe-area-inset-left)); right: max(8px, env(safe-area-inset-right));
    bottom: calc(177px + env(safe-area-inset-bottom)); width: min(330px, calc(100vw - 20px - env(safe-area-inset-left) - env(safe-area-inset-right)));
  }
  .mu-chat-log { height: clamp(36px, 12dvh, 76px); }
  .mu-hud-actions {
    right: max(8px, env(safe-area-inset-right)); bottom: calc(10px + env(safe-area-inset-bottom));
    grid-template-columns: repeat(3, 34px) 58px; grid-template-rows: repeat(3, 34px); gap: 4px;
    pointer-events: none;
  }
  .mu-hud-actions button { pointer-events: auto; }
  .mu-hud-actions button span { font-size: 8px; }
  .mu-act-main { width: 58px; height: 58px; }
  .mu-act-skill[data-key="52"] { width: 34px; }
  body.mu-ingame #muKeyBtn {
    top: auto; right: auto; left: max(108px, calc(env(safe-area-inset-left) + 103px));
    bottom: calc(10px + env(safe-area-inset-bottom)); width: 30px; height: 30px;
  }
  body.mu-ingame #muStick {
    width: 88px; height: 88px; left: max(8px, env(safe-area-inset-left)); bottom: calc(10px + env(safe-area-inset-bottom));
  }
  body.mu-ingame #muStickKnob { width: 40px; height: 40px; margin: -20px 0 0 -20px; }
  .mu-hud-dialog {
    width: min(440px, calc(100vw - 24px - env(safe-area-inset-left) - env(safe-area-inset-right)));
    max-height: calc(100dvh - 12px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  }
}
@media (orientation: landscape) and (max-height: 500px) {
  .mu-hud-chat {
    left: max(145px, calc(env(safe-area-inset-left) + 145px)); right: auto;
    bottom: calc(8px + env(safe-area-inset-bottom)); width: min(300px, calc(100vw - 346px - env(safe-area-inset-left) - env(safe-area-inset-right)));
  }
  .mu-chat-log { height: clamp(20px, 16dvh, 70px); }
}

@media (orientation: portrait) and (max-width: 900px) {
  .mu-hud-menu {
    position: fixed; right: max(8px, env(safe-area-inset-right));
    bottom: calc(346px + env(safe-area-inset-bottom));
    max-height: calc(100dvh - 394px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  }
  .mu-hud-chat.min { bottom: calc(108px + env(safe-area-inset-bottom)); }
}

.mu-display-tools { display: none; position: relative; }
body.mu-ingame .mu-display-tools { display: block; }
.mu-display-tools summary { list-style: none; cursor: pointer; white-space: nowrap; }
.mu-display-tools summary::-webkit-details-marker { display: none; }
.mu-display-options {
  position: absolute; top: calc(100% + 7px); right: 0; width: max-content;
  max-width: calc(100vw - 24px); max-height: min(65dvh, 256px); overflow: auto;
  display: grid; gap: 4px; box-sizing: border-box; padding: 6px;
  border: 1px solid #635332; border-radius: 8px; background: #141720;
}
.mu-display-options button {
  min-height: 34px; padding: 4px 8px; border: 1px solid #454957; border-radius: 6px;
  text-align: left; color: #f8fafc; background: #252936; cursor: pointer;
}
.mu-display-options button[aria-pressed="true"] {
  color: #dcfce7; background: #166534; border-color: #22c55e;
}
body.mu-native-panel .mu-hud > :is(.mu-hud-card, .mu-hud-side, .mu-hud-chat, .mu-hud-actions, .mu-hud-dock, .mu-player-label),
body.mu-native-panel :is(#muStick,#muKeyBtn,#muKeys) { display: none; }

@media (max-width: 720px) {
  body.mu-ingame :is(#muBtnAutoAttack,#muBtnAutoCfg) .mu-btn-text {
    display: inline; white-space: nowrap; font-size: 11px;
  }
  body.mu-ingame #muBtnAutoCfg .mu-btn-icon { display: none; }
  body.mu-ingame .mu-display-tools summary { font-size: 11px; }
}
@media (max-width: 900px), (pointer: coarse) {
  body.mu-ingame canvas#canvas {
    top: calc(40px + env(safe-area-inset-top));
    height: calc(100% - 40px - env(safe-area-inset-top));
  }
}

.mu-hud-actions .mu-act-skill { position: relative; }
.mu-act-skill i { display: grid; place-items: center; width: 70%; height: 70%; border: 0; margin: 0; }
.mu-act-skill[data-skill="0"] i { display: none; }
.mu-hud-actions .mu-quick-ice-storm {
  background-image: url('auto-skill-icons.jpg?v=login148');
  background-size: 800% 800%;
  background-position: 0 100%;
  color: #fff;
  text-shadow: 0 1px 3px #00182f;
}
.mu-act-skill[data-skill]:not([data-skill="0"]) span {
  position: absolute; bottom: 0; right: 2px; margin: 0; padding: 1px 3px; background: #151923; border-radius: 5px;
}
.mu-act-skill[aria-pressed="true"] { border-color: #fbbf24; box-shadow: 0 0 0 1px #fbbf24; }

#muHudAdmin { width: min(1320px, calc(100vw - 24px)); max-height: 92dvh; }
.mu-admin-columns { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: start; gap: 12px; }
.mu-admin-columns > :is(form, section) { min-width: 0; }
.mu-admin-columns fieldset { min-inline-size: 0; }
.mu-admin-columns > [hidden] { display: none; }
.mu-admin-actions [aria-pressed="true"] { border-color: #e3b66b; color: #ffe1a2; }
.mu-admin-card-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(82px,1fr)); gap: 5px; max-height: 250px; overflow: auto; padding: 2px; margin: 8px 0; }
.mu-admin-card { display: grid; justify-items: center; align-content: start; gap: 4px; font-size: 11px; }
.mu-admin-card[aria-pressed="true"] { border-color: #fbbf24; background: #463618; }
.mu-admin-card-icon { display: grid; place-items: center; width: 32px; height: 32px; color: #e0ba68; font-size: 26px; }
.mu-admin-card-icon.model { background: url('admin-item-icons.png?v=login165') no-repeat; background-size: 512px auto; }
.mu-admin-card-name { overflow-wrap: anywhere; text-align: center; }
#muAdminShopStockCards { grid-column: 1 / -1; }
/* Items tab: gift form on the left, storage + shop stacked on the right (no empty middle column). */
.mu-admin-columns[data-group="items"] { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.mu-admin-columns[data-group="items"] > #muAdminItem { grid-row: span 2; }
.mu-admin-fields > .mu-admin-wide, #muGiftReload { grid-column: 1 / -1; }
.mu-admin-fields > button { min-height: 32px; }
.mu-admin-card-grid:empty { display: none; }
#muAdminShop .mu-admin-card-grid { max-height: 220px; }
#muAdminStorageStatus:empty { display: none; }
@media (max-width: 1120px) { .mu-admin-columns { grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (max-width: 720px) {
  .mu-admin-columns[data-group="items"] { grid-template-columns: minmax(0,1fr); }
  .mu-admin-columns[data-group="items"] > #muAdminItem { grid-row: auto; }
}
@media (max-width: 720px) { .mu-admin-columns { grid-template-columns: minmax(0,1fr); } }

.mu-hud-minimap .mu-hud-other-dot {
  width: 5px;
  height: 5px;
  background: #69edff;
  box-shadow: 0 0 4px #33c6ff;
}
.mu-hud-minimap .mu-hud-other-dot.teammate { width: 7px; height: 7px; background: #a8fa75; box-shadow: 0 0 5px #91fa5c; z-index: 1; }
.mu-party-locations { box-sizing: border-box; width: min(35vw, 184px); padding: 4px 7px; background: rgba(10, 11, 16, .88); border: 1px solid #456a48; border-radius: 6px; color: #d4f5c6; font-size: 11px; }
.mu-party-locations summary { cursor: pointer; }
.mu-party-locations ul { margin: 4px 0 0; padding: 0; list-style: none; }
.mu-party-locations li { overflow-wrap: anywhere; }
.mu-party-locations button {
  width: 100%; min-height: 30px; margin-top: 4px; border: 1px solid #82635a; border-radius: 5px;
  background: #302126; color: #ffddd3; font: inherit; font-weight: 700; cursor: pointer;
}
@media (max-height: 500px) {
  .mu-party-locations ul { max-height: 13dvh; overflow: auto; }
}


.mu-panda-buff { align-self: center; color: #ffdc91; white-space: nowrap; font-size: 12px; }
.mu-panda-buff[hidden] { display: none; }
.mu-bank-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(155px, 1fr)); gap: 8px; }
.mu-bank-card { display: grid; justify-items: center; gap: 5px; padding: 8px; border: 1px solid #51556a; border-radius: 12px; background: #1c2030; }
.mu-bank-card output { color: #f7cf78; font-weight: 700; }
.mu-bank-card small { color: #b9c0d8; min-height: 1.2em; }
.mu-bank-actions { display: flex; align-items: end; justify-content: center; flex-wrap: wrap; gap: 5px; }
.mu-bank-actions label { flex: 1 1 100%; }
.mu-bank-actions input { width: 100%; }
.mu-bank-fallback { font-size: 22px; color: #80d4ff; }
.mu-bank-color-0 { color: #e5af60; }
.mu-bank-color-1 { color: #a88cff; }
.mu-bank-color-2 { color: #6cbbff; }
.mu-bank-color-3 { color: #ff7791; }
.mu-bank-color-4 { color: #72e592; }
.mu-bank-color-5 { color: #f6d365; }

#muAdminChatHistory { grid-column: 1 / -1; }
.mu-admin-chat-history { max-height: 48vh; overflow: auto; overflow-wrap: anywhere; }
.mu-admin-chat-history li { padding-block: 5px; }

body.mu-in-party .mu-hud-side { left: 8px; right: auto; top: 225px; }
body.mu-in-party .mu-hud-map-row { flex-direction: row; }
@media (max-width: 900px), (pointer: coarse) {
  body.mu-in-party .mu-hud-side { left: max(8px, env(safe-area-inset-left)); top: calc(46px + env(safe-area-inset-top)); }
  body.mu-in-party .mu-hud-card { right: calc(9vw + 8px); width: min(46vw, 210px); }
}

/* Touch: tap feedback and the item action menu (Mặc / Cầm lên / Bán / Mua). */
.mu-tap-ring {
  position: fixed; z-index: 30; width: 34px; height: 34px; margin: -17px 0 0 -17px;
  border: 2px solid rgba(255, 225, 150, 0.9); border-radius: 50%; pointer-events: none;
  animation: mu-tap-ring 0.36s ease-out forwards;
}
@keyframes mu-tap-ring { from { transform: scale(0.4); opacity: 1; } to { transform: scale(1.4); opacity: 0; } }
.mu-item-menu {
  position: fixed; z-index: 40; display: grid; gap: 4px; min-width: 128px; padding: 6px;
  border: 1px solid #e3b66b; border-radius: 10px; background: rgba(20, 22, 32, 0.96);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.5);
}
.mu-item-menu button { min-height: 40px; padding: 4px 12px; font-size: 15px; }
.mu-item-menu button:last-child { color: #b9c0d8; }
#muStick.on { border-color: rgba(255, 225, 150, 0.55); }
@media (prefers-reduced-motion: reduce) { .mu-tap-ring { animation: none; opacity: 0; } }

/* Phones in landscape: the left HUD column (map, shortcuts, party) ran down to
   the bottom edge and covered the stick, so touches hit the party panel instead.
   Keep the bottom-left corner for the stick and draw the stick above the HUD. */
@media (pointer: coarse) and (orientation: landscape) and (max-height: 500px) {
  .mu-hud > .mu-hud-side, body.mu-in-party .mu-hud > .mu-hud-side {
    max-height: calc(100dvh - 160px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    overflow-y: auto; overscroll-behavior: contain;
  }
  body.mu-ingame #muStick { z-index: 12; }
}
@media (pointer: coarse) {
  body.mu-ingame #muStick.on { z-index: 12; }
}

.mu-sale-dialog { width: min(660px, calc(100vw - 24px)); }
.mu-sale-dialog fieldset { min-inline-size: 0; margin: 0; }
.mu-sale-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 6px; max-height: 46dvh; overflow-y: auto; margin: 0 0 10px;
}
.mu-sale-grid .mu-sale-card {
  display: grid; justify-items: center; gap: 4px; padding: 5px;
  position: relative; text-align: center; border: 1px solid #52596c; border-radius: 6px;
  background: #222836; cursor: pointer; overflow-wrap: anywhere;
}
.mu-sale-card:has(:checked) { border-color: #ffcf58; background: #43361f; }
.mu-sale-card input[type=checkbox] { position: absolute; top: 4px; right: 4px; }
.mu-sale-card small { color: #ffdc84; }

@media (pointer: coarse) {
  .mu-hud-actions .mu-act-main,
  .mu-hud-actions .mu-act-skill,
  .mu-hud-actions .mu-act-assignable { display: none; }
}

.mu-character-entry {
  position: fixed;
  bottom: max(20px, env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  width: min(90vw, 600px);
  z-index: 30;
}
.mu-character-entry[hidden] { display: none; }
.mu-character-entry button {
  min-height: 44px;
  padding: 10px 18px;
  border: 1px solid #c39a3d;
  border-radius: 8px;
  background: #1d2028;
  color: #ffe5a1;
  font: inherit;
  cursor: pointer;
}
