/* Phase A — DOM UI shell (offline MMO feel), võ hiệp tone, không clone tutien. */

.wx-ui-shell {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 4;
  font-family: inherit;
  color: #e8dcc0;
}

.wx-ui-shell button,
.wx-ui-shell .wx-shell-click {
  pointer-events: auto;
  cursor: pointer;
}

.wx-shell-top {
  position: absolute;
  top: max(8px, env(safe-area-inset-top));
  left: max(8px, env(safe-area-inset-left));
  /* chừa chỗ cho minimap tròn 112 px ở góc phải để không che nút Bản đồ / Giang hồ */
  right: calc(max(8px, env(safe-area-inset-right)) + 124px);
  display: flex;
  align-items: flex-start;
  gap: 10px;
  pointer-events: none;
}

.wx-shell-top .wx-hud {
  flex: 0 1 340px;
  pointer-events: auto;
}

.wx-shell-actions {
  margin-left: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-end;
  pointer-events: none;
}

.wx-shell-actions button {
  min-height: 40px;
  min-width: 44px;
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid #8a6a3b;
  background: rgba(20, 16, 11, 0.92);
  color: #f0c86a;
  font-size: 13px;
}

.wx-shell-quest {
  position: absolute;
  top: max(200px, calc(env(safe-area-inset-top) + 192px));
  left: max(8px, env(safe-area-inset-left));
  width: min(240px, 42vw);
  pointer-events: auto;
  background: rgba(20, 16, 11, 0.88);
  border: 1px solid #4a3b28;
  border-radius: 6px;
  padding: 8px 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.45);
}

.wx-shell-quest-title {
  color: #ffd76a;
  font-weight: bold;
  font-size: 13px;
  margin-bottom: 4px;
}

.wx-shell-quest-obj {
  color: #cbb98f;
  font-size: 12px;
  line-height: 1.35;
}

.wx-shell-minimap {
  position: absolute;
  top: max(8px, env(safe-area-inset-top));
  right: max(8px, env(safe-area-inset-right));
  width: 112px;
  height: 112px;
  pointer-events: none;
  border-radius: 50%;
  border: 2px solid #a89468;
  background: rgba(10, 8, 6, 0.85);
  overflow: hidden;
}

.wx-shell-minimap canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.wx-shell-legend {
  position: absolute;
  bottom: max(52px, calc(env(safe-area-inset-bottom) + 46px));
  left: 50%;
  transform: translateX(-50%);
  max-width: min(96vw, 520px);
  padding: 4px 10px;
  border-radius: 6px;
  background: rgba(10, 8, 6, 0.75);
  border: 1px solid #3a2f1c;
  font-size: 11px;
  color: #9a8a66;
  text-align: center;
  pointer-events: none;
}

.wx-shell-hub {
  position: absolute;
  bottom: max(8px, env(safe-area-inset-bottom));
  left: max(8px, env(safe-area-inset-left));
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-width: min(92vw, 360px);
  pointer-events: none;
}

.wx-shell-hub button {
  min-height: 44px;
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid #6a5230;
  background: rgba(36, 28, 18, 0.94);
  color: #e8dcc0;
  font-size: 12px;
}

.wx-shell-hub button.wx-shell-hub-main {
  border-color: #c9a045;
  color: #ffd76a;
  font-weight: bold;
}

.wx-world-map-wrap {
  position: fixed;
  inset: 0;
  z-index: 600;
  background: rgba(0, 0, 0, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right))
    max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  box-sizing: border-box;
}

.wx-world-map {
  width: min(920px, 100%);
  max-height: 92dvh;
  background: #1a140c;
  border: 2px solid #8a6a3b;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.65);
}

.wx-world-map-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid #3a2f1c;
  background: #14110b;
}

.wx-world-map-head h2 {
  margin: 0;
  font-size: 16px;
  color: #f0c86a;
}

.wx-world-map-tabs {
  display: flex;
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid #2a2216;
  flex-wrap: wrap;
}

.wx-world-map-tabs button {
  min-height: 40px;
  padding: 6px 12px;
  border-radius: 4px;
  border: 1px solid #4a3d22;
  background: #241c12;
  color: #c9b98f;
}

.wx-world-map-tabs button.on {
  border-color: #c9a045;
  color: #ffd76a;
}

.wx-world-map-body {
  flex: 1 1 auto;
  overflow: auto;
  padding: 12px;
  display: grid;
  grid-template-columns: 1fr min(280px, 38vw);
  gap: 12px;
}

@media (max-width: 640px) {
  .wx-world-map-body {
    grid-template-columns: 1fr;
  }
}

.wx-world-graph {
  position: relative;
  min-height: 280px;
  background: radial-gradient(circle at 50% 40%, #2a2218 0%, #120e08 70%);
  border: 1px solid #3a2f1c;
  border-radius: 6px;
}

.wx-world-node {
  position: absolute;
  transform: translate(-50%, -50%);
  min-width: 72px;
  max-width: 120px;
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid #6a5230;
  background: rgba(36, 28, 18, 0.95);
  color: #e8dcc0;
  font-size: 11px;
  text-align: center;
  line-height: 1.25;
  pointer-events: auto;
  cursor: pointer;
}

.wx-world-node.locked {
  opacity: 0.55;
  border-style: dashed;
}

.wx-world-node.here {
  border-color: #ffd76a;
  box-shadow: 0 0 8px rgba(255, 215, 106, 0.35);
}

.wx-world-node.map-link {
  border-color: #4a7ab0;
}

.wx-world-detail {
  background: #14110b;
  border: 1px solid #3a2f1c;
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.45;
}

.wx-world-detail h3 {
  margin: 0 0 8px;
  color: #f0c86a;
  font-size: 15px;
}

.wx-hub-wrap .wx-panel {
  max-width: min(720px, 96vw);
}

.wx-hub-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.wx-hub-nav button {
  min-height: 44px;
  flex: 1 1 auto;
}

.wx-hub-nav button.on {
  border-color: #c9a045;
  color: #ffd76a;
}

.wx-cfg-select {
  width: 100%;
  min-height: 44px;
  margin-top: 4px;
  background: #241c12;
  color: #e8dcc0;
  border: 1px solid #4a3d22;
  border-radius: 4px;
}

@media (max-width: 480px) {
  .wx-shell-legend {
    display: none;
  }
  .wx-ui-shell.wx-show-legend .wx-shell-legend {
    display: block;
  }
}
