/* ============================================================================
   TS ALL-FOR-ONE — UNIFIED ROUND HUD DOCK (Bản đồ · GM Panel · Phím tắt · Zoom · Cỡ chữ)
   Consolidates all 5 floating pills into 1 clean draggable gilded bronze orb!
   ============================================================================ */

/* Hide the 5 cluttered individual floating pills (keep their modals & wheel toast intact!) */
#tswm-fab,
#tsgm-fab,
#tsgm-font-bar,
#tshk-fab,
#tszm-bar {
  display: none !important;
}

#tshd-root {
  --hd-font: "Be Vietnam Pro", "Nunito", "Segoe UI", system-ui, -apple-system, sans-serif;
  --hd-font-disp: "Playfair Display", "Noto Serif", Georgia, serif;
  --hd-mono: "Cascadia Mono", Consolas, ui-monospace, monospace;
  --hd-ebony-0: #140e0a;
  --hd-ebony-1: #1d140e;
  --hd-ebony-2: #2b1d14;
  --hd-gold: #c99746;
  --hd-gold-hi: #f3d48c;
  --hd-cream: #f5ead6;
  --hd-sand: #bfa886;
  --hd-jade: #38d983;
  --hd-crimson: #ef5350;

  position: fixed;
  inset: 0;
  z-index: 9650;
  pointer-events: none;
  font-family: var(--hd-font);
  user-select: none;
}

#tshd-root *, #tshd-root *::before, #tshd-root *::after {
  box-sizing: border-box;
}

/* ==================== SINGLE ORNATE ROUND FLOATING ORB ==================== */
.tshd-orb {
  position: fixed;
  top: calc(50% - 23px);
  right: 14px;
  width: 46px;
  height: 46px;
  padding: 0;
  border-radius: 50%;
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 32% 26%, #4a321e 0%, #24170f 62%, #140c08 100%);
  border: 2px solid var(--hd-gold);
  box-shadow:
    0 0 0 1.5px rgba(243, 212, 140, 0.32),
    0 8px 22px rgba(6, 3, 1, 0.72),
    inset 0 1.5px 2px rgba(255, 232, 178, 0.42);
  color: var(--hd-gold-hi);
  cursor: pointer;
  touch-action: none;
  opacity: 0.90;
  transition: transform .16s ease, box-shadow .18s ease, border-color .16s ease, opacity .16s ease, background .18s ease;
}

.tshd-orb:hover {
  opacity: 1;
  border-color: var(--hd-gold-hi);
  transform: scale(1.06);
  box-shadow:
    0 0 0 2px rgba(243, 212, 140, 0.55),
    0 10px 26px rgba(6, 3, 1, 0.82),
    0 0 18px rgba(201, 151, 70, 0.42),
    inset 0 1.5px 2px rgba(255, 240, 195, 0.55);
}

.tshd-orb:active {
  transform: scale(0.95);
}

.tshd-orb.open {
  opacity: 1;
  background: radial-gradient(circle at 32% 26%, #a8322a 0%, #681a15 65%, #3d0d0a 100%);
  border-color: var(--hd-gold-hi);
  box-shadow:
    0 0 0 2px rgba(243, 212, 140, 0.72),
    0 10px 26px rgba(80, 16, 12, 0.75),
    0 0 20px rgba(201, 151, 70, 0.45);
}

.tshd-orb.dragging {
  cursor: grabbing;
  transform: scale(1.04);
  opacity: 0.96;
}

.tshd-orb-svg {
  width: 22px;
  height: 22px;
  display: block;
  transition: transform .22s cubic-bezier(0.22, 1, 0.36, 1);
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.85));
}

.tshd-orb.open .tshd-orb-svg {
  transform: rotate(90deg);
}

/* Tiny status dot on top-right rim of orb (reflects GM online / active zoom) */
.tshd-orb-dot {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--hd-gold-hi);
  border: 1.5px solid #160e09;
  box-shadow: 0 0 6px rgba(243, 212, 140, 0.8);
  pointer-events: none;
}

.tshd-orb-dot.online {
  background: var(--hd-jade);
  box-shadow: 0 0 7px rgba(56, 217, 131, 0.9);
}

.tshd-orb-dot.offline {
  background: var(--hd-crimson);
  box-shadow: 0 0 6px rgba(239, 83, 80, 0.8);
}

/* ==================== POPOVER UTILITY MENU PANEL ==================== */
.tshd-panel {
  position: fixed;
  width: 288px;
  pointer-events: auto;
  display: none;
  flex-direction: column;
  gap: 10px;
  padding: 11px 12px 12px;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(35, 24, 17, 0.96) 0%, rgba(20, 14, 10, 0.97) 100%);
  border: 1.5px solid var(--hd-gold);
  box-shadow:
    0 0 0 1px rgba(243, 212, 140, 0.25),
    0 18px 46px rgba(0, 0, 0, 0.82),
    inset 0 1px 0 rgba(243, 212, 140, 0.25);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: var(--hd-cream);
  transform-origin: top right;
}

.tshd-panel.open {
  display: flex;
  animation: tshd-pop .16s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes tshd-pop {
  from { opacity: 0; transform: scale(0.93) translateY(-4px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.tshd-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(201, 151, 70, 0.28);
}

.tshd-title {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--hd-font-disp);
  font-size: 14px;
  font-weight: 700;
  color: var(--hd-gold-hi);
  letter-spacing: 0.25px;
}

.tshd-head-right {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.tshd-fps {
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(10, 22, 52, 0.78);
  border: 1px solid rgba(74, 222, 128, 0.65);
  color: #4ade80;
  font: 700 10.5px var(--hd-mono);
  white-space: nowrap;
}

.tshd-fps.mid { border-color: #fde047; color: #fde047; }
.tshd-fps.low { border-color: #fca5a5; color: #fb7185; }
.tshd-fps.hidden { display: none; }

.tshd-close {
  width: 24px;
  height: 24px;
  border-radius: 7px;
  border: 1px solid rgba(201, 151, 70, 0.45);
  background: rgba(255, 255, 255, 0.05);
  color: var(--hd-gold-hi);
  font: 700 15px/1 var(--hd-font);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  transition: background .12s ease, border-color .12s ease;
}

.tshd-close:hover {
  background: rgba(184, 51, 42, 0.45);
  border-color: #f08a82;
}

/* ==================== 4 QUICK ACTION TILES (2x2: Bản đồ · GM · Doanh Trận · Phím tắt) ==================== */
.tshd-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.tshd-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 9px 6px 8px;
  border-radius: 10px;
  border: 1px solid rgba(201, 151, 70, 0.42);
  background: linear-gradient(180deg, rgba(58, 39, 25, 0.82) 0%, rgba(28, 19, 13, 0.90) 100%);
  color: var(--hd-cream);
  cursor: pointer;
  text-align: center;
  transition: transform .1s ease, border-color .14s ease, background .14s ease, box-shadow .14s ease;
}

.tshd-tile:hover {
  border-color: var(--hd-gold-hi);
  background: linear-gradient(180deg, rgba(84, 56, 34, 0.92) 0%, rgba(42, 27, 17, 0.95) 100%);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45), 0 0 10px rgba(201, 151, 70, 0.22);
  transform: translateY(-1px);
}

.tshd-tile:active {
  transform: scale(0.96);
}

.tshd-tile-map {
  border-color: rgba(88, 184, 245, 0.52);
  background: linear-gradient(180deg, rgba(28, 72, 128, 0.72) 0%, rgba(16, 36, 68, 0.88) 100%);
}

.tshd-tile-map:hover {
  border-color: #7ad8ff;
  background: linear-gradient(180deg, rgba(42, 108, 188, 0.85) 0%, rgba(22, 52, 98, 0.94) 100%);
}

.tshd-tile-camp {
  border-color: rgba(235, 168, 72, 0.52);
  background: linear-gradient(180deg, rgba(114, 46, 30, 0.72) 0%, rgba(56, 22, 14, 0.88) 100%);
}

.tshd-tile-camp:hover {
  border-color: #ffd37a;
  background: linear-gradient(180deg, rgba(152, 62, 40, 0.86) 0%, rgba(76, 30, 18, 0.94) 100%);
}

.tshd-tile-icon {
  font-size: 18px;
  line-height: 1.1;
}

.tshd-tile-name {
  font-size: 11.5px;
  font-weight: 800;
  color: var(--hd-gold-hi);
  white-space: nowrap;
}

.tshd-tile-map .tshd-tile-name {
  color: #e6f6ff;
}

.tshd-tile-sub {
  font-size: 10px;
  font-weight: 600;
  color: var(--hd-sand);
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tshd-tile-kbd {
  position: absolute;
  top: 4px;
  right: 5px;
  padding: 1px 4px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(243, 212, 140, 0.35);
  color: var(--hd-gold-hi);
  font: 700 9px/1.2 var(--hd-mono);
}

.tshd-tile-dot {
  position: absolute;
  top: 5px;
  left: 6px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--hd-gold-hi);
}

.tshd-tile-dot.online { background: var(--hd-jade); box-shadow: 0 0 6px rgba(56, 217, 131, 0.85); }
.tshd-tile-dot.offline { background: var(--hd-crimson); }

/* ==================== LIVE CONTROLS (Zoom & Cỡ chữ) ==================== */
.tshd-controls {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tshd-row {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 8px 9px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(201, 151, 70, 0.24);
}

.tshd-row-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.tshd-row-lbl {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--hd-cream);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.tshd-row-hint {
  font-size: 10px;
  color: var(--hd-sand);
}

.tshd-ctrl-line {
  display: flex;
  align-items: center;
  gap: 6px;
}

.tshd-btn {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px solid rgba(243, 212, 140, 0.55);
  background: linear-gradient(180deg, #392619 0%, #22160f 100%);
  color: var(--hd-gold-hi);
  font: 800 13px/1 var(--hd-font);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  transition: background .12s ease, border-color .12s ease, transform .08s ease;
}

.tshd-btn:hover {
  background: linear-gradient(180deg, #563922 0%, #311f13 100%);
  border-color: var(--hd-gold-hi);
}

.tshd-btn:active { transform: scale(0.92); }

.tshd-slider-wrap {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  height: 20px;
}

.tshd-tick {
  position: absolute;
  left: calc(7px + (100% - 14px) * 0.3548);
  top: 50%;
  width: 2px;
  height: 10px;
  transform: translate(-50%, -50%);
  border-radius: 1px;
  background: rgba(243, 212, 140, 0.58);
  pointer-events: none;
  z-index: 1;
}

.tshd-slider {
  -webkit-appearance: none;
  appearance: none;
  position: relative;
  z-index: 2;
  width: 100%;
  height: 5px;
  margin: 0;
  border-radius: 999px;
  outline: none;
  cursor: pointer;
  background: linear-gradient(
    90deg,
    #d8a248 0%,
    #f3d48c var(--hd-pct, 35.48%),
    rgba(255, 240, 200, 0.16) var(--hd-pct, 35.48%),
    rgba(255, 240, 200, 0.16) 100%
  );
  border: 1px solid rgba(201, 151, 70, 0.36);
}

.tshd-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff3c7 0%, #e4b255 55%, #8a5b18 100%);
  border: 1.5px solid #fff0c7;
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.78), 0 0 6px rgba(243, 212, 140, 0.45);
  cursor: pointer;
  transition: transform .1s ease;
}

.tshd-slider::-webkit-slider-thumb:hover { transform: scale(1.14); }

.tshd-slider::-moz-range-thumb {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff3c7 0%, #e4b255 55%, #8a5b18 100%);
  border: 1.5px solid #fff0c7;
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.78);
  cursor: pointer;
}

.tshd-slider::-moz-range-track {
  height: 5px;
  border-radius: 999px;
  background: transparent;
}

.tshd-val {
  min-width: 44px;
  text-align: center;
  padding: 2px 6px;
  border-radius: 6px;
  border: 1px solid rgba(201, 151, 70, 0.32);
  background: rgba(255, 240, 200, 0.08);
  color: var(--hd-gold-hi);
  font: 700 11px var(--hd-mono);
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  flex-shrink: 0;
  transition: background .12s ease, border-color .12s ease;
}

.tshd-val:hover {
  background: rgba(243, 212, 140, 0.22);
  border-color: var(--hd-gold-hi);
}

.tshd-val.active {
  background: rgba(201, 151, 70, 0.26);
  border-color: rgba(243, 212, 140, 0.75);
  color: #fff3c7;
}

.tshd-foot {
  font-size: 10px;
  color: var(--hd-sand);
  text-align: center;
  opacity: 0.85;
}

/* ==================== IN-CLIENT DOANH TRẬN (5 PHE) MODAL ==================== */
.tshd-camp-backdrop {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 14px;
  background: rgba(10, 7, 4, 0.68);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  pointer-events: auto;
}

.tshd-camp-backdrop.show {
  display: flex;
}

.tshd-camp-modal {
  width: min(470px, 95vw);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  border-radius: 14px;
  background: linear-gradient(180deg, #251911 0%, #150e09 100%);
  border: 1.5px solid var(--hd-gold);
  box-shadow:
    0 0 0 1px rgba(243, 212, 140, 0.25),
    0 20px 54px rgba(0, 0, 0, 0.84),
    inset 0 1px 0 rgba(243, 212, 140, 0.24);
  color: var(--hd-cream);
  overflow: hidden;
  animation: tshd-pop .16s cubic-bezier(0.22, 1, 0.36, 1);
}

.tshd-camp-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 11px 14px;
  background: linear-gradient(180deg, rgba(201, 151, 70, 0.18) 0%, rgba(201, 151, 70, 0.04) 100%);
  border-bottom: 1px solid rgba(201, 151, 70, 0.32);
}

.tshd-camp-title {
  font-family: var(--hd-font-disp);
  font-size: 15px;
  font-weight: 700;
  color: var(--hd-gold-hi);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.tshd-camp-dom {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(201, 151, 70, 0.18);
  border: 1px solid rgba(243, 212, 140, 0.45);
  color: #fff3c7;
}

.tshd-camp-body {
  padding: 11px 13px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
}

.tshd-camp-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.30);
  border: 1px solid rgba(201, 151, 70, 0.24);
}

.tshd-camp-card.dominant {
  border-color: rgba(243, 212, 140, 0.72);
  background: rgba(201, 151, 70, 0.10);
}

.tshd-camp-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.tshd-camp-name {
  font-size: 12.5px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.tshd-camp-swatch {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.tshd-camp-score {
  font: 800 12px var(--hd-mono);
  font-variant-numeric: tabular-nums;
  color: var(--hd-gold-hi);
}

.tshd-camp-track {
  width: 100%;
  height: 5px;
  border-radius: 999px;
  background: rgba(255, 240, 200, 0.12);
  overflow: hidden;
}

.tshd-camp-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  transition: width .2s ease;
}

.tshd-camp-btns {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}

.tshd-cbtn {
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid rgba(201, 151, 70, 0.45);
  background: linear-gradient(180deg, #3a2719 0%, #22160f 100%);
  color: var(--hd-gold-hi);
  font: 700 11px var(--hd-mono);
  cursor: pointer;
  transition: border-color .12s ease, background .12s ease, transform .08s ease;
}

.tshd-cbtn:hover {
  border-color: var(--hd-gold-hi);
  background: linear-gradient(180deg, #563922 0%, #311f13 100%);
}

.tshd-cbtn:active { transform: scale(0.95); }

.tshd-cbtn.neg {
  border-color: rgba(239, 83, 80, 0.48);
  color: #ffb4b0;
}

.tshd-cbtn.pos {
  border-color: rgba(56, 217, 131, 0.48);
  color: #a9f5ca;
}

.tshd-camp-input {
  width: 66px;
  padding: 3px 6px;
  border-radius: 6px;
  border: 1px solid rgba(201, 151, 70, 0.45);
  background: rgba(12, 8, 5, 0.78);
  color: #fff3c7;
  font: 700 11px var(--hd-mono);
  text-align: center;
  outline: none;
  margin-left: auto;
}

.tshd-camp-input:focus {
  border-color: var(--hd-gold-hi);
}

.tshd-camp-foot {
  padding: 9px 13px 11px;
  border-top: 1px solid rgba(201, 151, 70, 0.24);
  background: rgba(0, 0, 0, 0.24);
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.tshd-camp-bulk {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.tshd-camp-note {
  font-size: 10.5px;
  color: var(--hd-sand);
  line-height: 1.4;
}

@media (max-width: 760px) {
  .tshd-orb {
    top: calc(50% - 21px);
    right: 8px;
    width: 42px;
    height: 42px;
  }
  .tshd-panel {
    width: min(280px, calc(100vw - 16px));
  }
}
