/* ==============================================================================
 * Hệ Thống Tự Động (Auto Module) - Tu Tiên 2D
 * File: src/auto/auto.css
 * Chỉ hiển thị 2 nút mở rộng: Auto Menu (F6) và Map (F8)
 * ============================================================================== */

/* Nút Cài Auto (F6) - Hàng 2 ngay phía trên nút Tọa */
#btn-auto-menu,
.tbtn.utility.auto-menu-touch {
  right: 0px !important;
  bottom: 268px !important;
  width: 48px !important;
  height: 48px !important;
  z-index: 10 !important;
  display: block !important;
  border: 2px solid #b49a66 !important;
  border-radius: 8px !important;
  background: radial-gradient(circle at 38% 30%, rgba(117, 94, 57, 0.86), rgba(30, 22, 15, 0.96) 70%) !important;
  box-shadow: 0 5px 10px rgba(12, 7, 4, 0.66), inset 0 0 0 1px rgba(0, 0, 0, 0.75) !important;
  cursor: pointer;
}
#btn-auto-menu .hud-icon {
  position: absolute;
  top: 1px;
  left: 50%;
  z-index: 1;
  display: block;
  width: 32px;
  height: 32px;
  transform: translateX(-50%);
  object-fit: contain;
  image-rendering: pixelated;
  pointer-events: none;
}
#btn-auto-menu .skill-name {
  position: absolute;
  left: 2px;
  right: 2px;
  bottom: 2px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: #efe2c2 !important;
  font-size: 8px;
  line-height: 10px;
  text-align: center;
  text-shadow: 0 1px 1px #000;
}
#btn-auto-menu.active {
  border-color: #8fc88e !important;
  box-shadow: 0 0 10px rgba(143, 200, 142, 0.65), inset 0 0 0 1px rgba(0, 0, 0, 0.75) !important;
}
#btn-auto-menu.active .skill-name {
  color: #a3e6aa !important;
  font-weight: bold;
}

/* Nút Bản Đồ & Chuyển Khu (F8) - Cạnh nút Auto Menu */
#btn-auto-map,
.tbtn.utility.auto-map-touch {
  right: 54px !important;
  bottom: 268px !important;
  width: 48px !important;
  height: 48px !important;
  z-index: 10 !important;
  display: block !important;
  border: 2px solid #b49a66 !important;
  border-radius: 8px !important;
  background: radial-gradient(circle at 38% 30%, rgba(117, 94, 57, 0.86), rgba(30, 22, 15, 0.96) 70%) !important;
  box-shadow: 0 5px 10px rgba(12, 7, 4, 0.66), inset 0 0 0 1px rgba(0, 0, 0, 0.75) !important;
  cursor: pointer;
}
#btn-auto-map .hud-glyph {
  position: absolute;
  top: 3px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 19px;
  line-height: 24px;
  pointer-events: none;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.8));
}
#btn-auto-map .skill-name {
  position: absolute;
  left: 2px;
  right: 2px;
  bottom: 2px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: #efe2c2 !important;
  font-size: 8px;
  line-height: 10px;
  text-align: center;
  text-shadow: 0 1px 1px #000;
}
#btn-auto-map.active,
#btn-auto-map.traveling {
  border-color: #8fc88e !important;
  box-shadow: 0 0 10px rgba(143, 200, 142, 0.65), inset 0 0 0 1px rgba(0, 0, 0, 0.75) !important;
}
#btn-auto-map.active .skill-name,
#btn-auto-map.traveling .skill-name {
  color: #a3e6aa !important;
  font-weight: bold;
}

/* Nút Auto (F7 / T) phát sáng xanh khi bật */
.auto-touch.active {
  border-color: #44ff88 !important;
  box-shadow: 0 0 12px rgba(68, 255, 136, 0.7), inset 0 0 6px rgba(68, 255, 136, 0.4) !important;
  background: radial-gradient(circle at 38% 30%, rgba(30, 80, 45, 0.95), rgba(15, 30, 20, 0.98) 70%) !important;
}
.auto-touch.active .skill-name {
  color: #44ff88 !important;
  font-weight: bold;
}

/* Nút F5 khi bị hạ gục */
.downed-btn {
  display: block;
  width: 100%;
  padding: 8px 12px;
  border-radius: 6px;
  border: 1px solid #38bdf8;
  background: #1e293b;
  color: #38bdf8;
  font-family: inherit;
  font-size: 13px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
}
.downed-btn:hover {
  background: #0284c7;
  color: #fff;
  border-color: #7dd3fc;
}

/* ==============================================================================
 * THANH HUD GIỜ BOSS THẾ GIỚI (World Boss Countdown Bar)
 * Chuẩn 1:1 theo giao diện: [⏱ GIỜ BOSS] [🐉 Xích Long: 2:59:29] [🐯 Linh Hổ: 1:44:42] [🐆 Ma Báo: 11h–21h] [—]
 * ============================================================================== */
#pntt-boss-bar {
  position: fixed;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 999;
  display: flex;
  align-items: center;
  gap: 5px;
  background: rgba(24, 16, 9, 0.94);
  border: 1.5px solid #7c5828;
  border-radius: 5px;
  padding: 3px 5px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.75), inset 0 0 0 1px rgba(0, 0, 0, 0.6);
  user-select: none;
  font-family: inherit;
  font-size: 11.5px;
  line-height: 1.2;
  transition: opacity 0.2s, box-shadow 0.2s;
}

#pntt-boss-bar.dragging {
  opacity: 0.85;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.9), 0 0 10px rgba(223, 193, 140, 0.4);
}

.pntt-boss-bar-title {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(45, 30, 18, 0.9);
  border: 1px solid #6b4d24;
  border-radius: 3px;
  padding: 3px 7px;
  color: #dfc18c;
  font-weight: bold;
  font-size: 11px;
  cursor: grab;
  letter-spacing: 0.3px;
  transition: all 0.15s;
}
.pntt-boss-bar-title:hover {
  background: rgba(70, 48, 28, 0.95);
  border-color: #b49a66;
  color: #fff;
}
.pntt-boss-bar-title:active {
  cursor: grabbing;
}
.pntt-boss-bar-title.syncing .pntt-boss-title-icon {
  display: inline-block;
  animation: pntt-boss-spin 0.8s linear infinite;
}
@keyframes pntt-boss-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.pntt-boss-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(20, 14, 8, 0.85);
  border: 1px solid #4a341b;
  border-radius: 3px;
  padding: 3px 7px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
}
.pntt-boss-item:hover {
  background: rgba(50, 35, 20, 0.95);
  border-color: #94713c;
  transform: translateY(-1px);
}
.pntt-boss-item:active {
  transform: translateY(0);
}

.pntt-boss-icon {
  font-size: 13px;
  line-height: 1;
}

.pntt-boss-name {
  color: #ffffff;
  font-weight: bold;
  font-size: 11px;
}

.pntt-boss-time {
  color: #f5be57;
  font-weight: bold;
  font-size: 11.5px;
  min-width: 46px;
  text-align: right;
  letter-spacing: 0.3px;
}

.pntt-boss-item.alive {
  border-color: rgba(68, 255, 136, 0.6);
  background: rgba(18, 40, 25, 0.88);
}
.pntt-boss-item.alive .pntt-boss-time {
  color: #44ff88 !important;
  text-shadow: 0 0 6px rgba(68, 255, 136, 0.7);
  animation: pntt-boss-pulse 1.8s infinite;
}
@keyframes pntt-boss-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.65; }
}

.pntt-boss-collapse {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  background: rgba(35, 25, 15, 0.9);
  border: 1.5px solid #8c6a38;
  border-radius: 4px;
  color: #dfc18c;
  font-size: 12px;
  font-weight: bold;
  cursor: pointer;
  line-height: 1;
  padding: 0;
  transition: all 0.15s;
}
.pntt-boss-collapse:hover {
  background: rgba(65, 45, 25, 0.98);
  border-color: #b49a66;
  color: #ffffff;
}

/* Trạng thái thu gọn */
#pntt-boss-bar.collapsed .pntt-boss-item {
  display: none !important;
}
#pntt-boss-bar.collapsed {
  gap: 3px;
  padding: 2px 4px;
}


/* Auto menu: readable controls on desktop and touch screens. */
#auto-config-panel {width:min(560px,96vw)!important;}
#auto-config-panel button {min-height:34px;touch-action:manipulation;}
#auto-config-panel button:focus-visible {outline:2px solid #ffeaa0;outline-offset:2px;}
#auto-config-panel .auto-help {font-size:11px;line-height:1.5;color:#c9ba98;margin:5px 0 9px;}
#cfg-bosshunt-card {padding:12px!important;border-radius:10px!important;}
#cfg-bosshunt-card label {align-items:flex-start!important;line-height:1.5;padding:4px 0;}
#cfg-bosshunt-card input {flex-shrink:0;margin-top:2px;}
#cfg-xich-long-log-download,#cfg-xich-long-log-clear {border:1px solid #b49a66;border-radius:6px;background:#33291c;color:#ffeaa0;padding:6px 10px;cursor:pointer;}
#cfg-xich-long-log-clear {color:#efb4a2;border-color:#8a5d49;}
#cfg-boss-log-count {flex-basis:100%;margin:0!important;}

#cfg-bosshunt-status-line {line-height:1.5;overflow-wrap:anywhere;}
@media(max-width:480px){
 #auto-config-panel {padding:10px!important;max-height:94dvh!important;}
 #auto-config-panel .cfg-bosshunt-target-btn {font-size:11px!important;min-height:40px;}
 #cfg-bosshunt-card span {white-space:normal;}
}

#pntt-boss-bar {max-width:calc(100vw - 16px);box-sizing:border-box;overflow:visible;flex-wrap:wrap;}
#pntt-boss-bar > * {flex-shrink:0;}
#cfg-boss-bar-show {border:1px solid #b49a66;border-radius:6px;background:#33291c;color:#ffeaa0;padding:6px 10px;cursor:pointer;}

#auto-loot-history {position:fixed;right:8px;bottom:85px;z-index:990;width:min(280px,70vw);background:rgba(24,18,12,.94);border:1px solid #b49a66;border-radius:8px;color:#eadbb7;font:11px system-ui,sans-serif;padding:7px;}
.loot-history-header {display:flex;justify-content:space-between;gap:8px;}
.loot-history-header button {border:0;background:transparent;color:#ffeaa0;cursor:pointer;padding:5px;}
.loot-history-list {max-height:160px;overflow-y:auto;margin-top:5px;}
.loot-history-row {padding:5px 2px;border-bottom:1px solid rgba(180,154,102,.15);overflow-wrap:anywhere;}
#pntt-thiendao-banner {display:none!important;}

/* Replace the minimap picture with the confirmed pickup history (except in Tam Lo 5v5 MOBA). */
body:not(.tl-tran) #minimap {display:none!important;}
body.tl-tran #minimap {display:block!important;}
body.tl-tran #hud-right {width:auto!important;}
body.tl-tran #auto-loot-history {display:none!important;}
#hud-right {width:min(270px,42vw);box-sizing:border-box;}
#hud-map {text-align:center;padding:4px 0;}
#hud-right #auto-loot-history {position:static;width:100%;max-width:none;padding:5px 0 0;margin-top:5px;border:0;border-top:1px solid rgba(180,154,102,.35);border-radius:0;background:transparent;box-sizing:border-box;pointer-events:auto;}
#hud-right .loot-history-list {max-height:140px;}
#hud-right #hud-weather {position:static;max-width:100%;margin-top:3px;}
@media(max-width:480px){#hud-right {width:min(220px,44vw);}#hud-right .loot-history-list {max-height:100px;}}

#pntt-boss-nearest {display:none;color:#ffeaa0;white-space:nowrap;font-size:11px;padding:2px 5px;}
#pntt-boss-bar.collapsed #pntt-boss-nearest {display:block;}
#pntt-boss-bar {width:max-content;max-width:calc(100vw - 16px);}
#hud-right .loot-history-list {max-height:none;overflow:visible;}

/* Chat raises the HUD layer; keep its map/pickup sidebar out of the chat surface. */
#hud-right #auto-loot-history {z-index:auto;}
body.chat-open #hud-right {visibility:hidden;pointer-events:none;}
body.chat-open #hud-right * {visibility:hidden;pointer-events:none;}


#cfg-farm-toggle {width:100%;padding:8px;border:1px solid #b49a66;border-radius:6px;background:#25432a;color:#e7efc4;cursor:pointer;font-weight:bold;}


/* Auto settings: compact navigation, original wood-and-brass palette. */
#auto-config-panel {
  width:min(880px,96vw)!important;
  height:min(740px,90vh);height:min(740px,90dvh);
  max-height:90vh!important;max-height:90dvh!important;
  padding:0!important;background:#191710!important;
  border:1px solid #736244!important;border-radius:12px!important;
  box-shadow:0 20px 70px #000b!important;font-size:13px;line-height:1.5;
  overflow:hidden;
}
#auto-config-panel .auto-menu-header {
  padding:16px 20px!important;margin:0!important;
  border-bottom:1px solid #4c422f!important;background:#211c13;
}
#auto-config-panel .auto-menu-header strong {font-size:15px!important;letter-spacing:.04em!important;}
#auto-config-panel .auto-menu-subtitle {display:block;margin-top:2px;font-size:11px;font-weight:400;letter-spacing:0;color:#b9ad95;}
#auto-config-panel .auto-menu-header button {min-width:36px;border-radius:6px;}
#auto-config-panel .auto-menu-header button:hover {background:#ffffff0a!important;}
#auto-config-panel .auto-menu-toolbar {display:flex;gap:12px;align-items:center;padding:12px 20px;border-bottom:1px solid #4c422f;flex-shrink:0;}
#auto-config-panel #auto-panel-toggle-btn {width:auto!important;min-height:38px;flex:0 0 250px;padding:8px 12px!important;border-radius:7px!important;font-size:12px!important;}
#auto-config-panel .auto-search {display:flex;align-items:center;gap:8px;flex:1;min-width:0;padding:0 10px;background:#12100c;border:1px solid #5d4f37;border-radius:7px;}
#auto-config-panel .auto-search:focus-within {border-color:#c9a45c;box-shadow:0 0 0 2px #c9a45c20;}
#auto-config-panel .auto-search > span {font-size:24px;color:#b49a66;line-height:1;}
#auto-menu-search {width:100%;min-width:0;height:38px;border:0;outline:none;background:transparent;color:#eadbb7;font:inherit;font-size:13px;user-select:text;}
#auto-menu-search::placeholder {color:#9c9079;}
#auto-config-panel .auto-menu-body {display:flex;flex:1;min-height:0;overflow:hidden;}
#auto-config-panel .auto-menu-sidebar {width:178px;flex-shrink:0;display:flex;flex-direction:column;padding:18px 10px;border-right:1px solid #4c422f;background:#1d1911;overflow-y:auto;}
#auto-config-panel .auto-nav-label {padding:0 10px 10px;font-size:10px;letter-spacing:.12em;color:#9f9073;}
#auto-config-panel .auto-menu-nav {display:flex;flex-direction:column;gap:5px;flex-shrink:0;margin:0;}
#auto-config-panel .auto-tab-btn {display:flex;align-items:center;gap:9px;text-align:left;padding:10px 9px;background:transparent;border:1px solid transparent;border-radius:7px;color:#c9bfa8;font:inherit;font-size:12px;cursor:pointer;}
#auto-config-panel .auto-tab-btn:hover {background:#352f22;color:#f5e9cf;}
#auto-config-panel .auto-tab-btn.is-active {background:#4b3c23;border-color:#947747;color:#ffe3a8;font-weight:700;}
#auto-config-panel .auto-nav-icon {width:17px;text-align:center;color:#c9a45c;font-size:17px;}
#auto-config-panel .auto-nav-text {flex:1;white-space:nowrap;}
#auto-config-panel .auto-nav-count {font-size:10px;min-width:18px;text-align:center;border-radius:4px;background:#0003;color:#cdbb96;}
#auto-config-panel .auto-sidebar-hint {margin:auto 10px 0;padding-top:24px;color:#9f927a;font-size:11px;line-height:1.7;}
#auto-config-panel .auto-menu-content {display:flex;flex-direction:column;flex:1;min-width:0;min-height:0;padding:16px 20px 0;}
#auto-config-panel .auto-content-header {display:flex;align-items:center;justify-content:space-between;gap:12px;padding:0 0 12px;flex-shrink:0;}
#auto-config-panel #auto-category-title {margin:0;font-size:17px;color:#f1dfbc;}
#auto-menu-result-count {color:#b9ad95;font-size:11px;white-space:nowrap;}
#auto-cards-scroll {min-height:0;overscroll-behavior:contain;scrollbar-width:thin;scrollbar-color:#74603d transparent;padding:0 5px 12px 0!important;margin:0!important;}
#auto-config-panel .auto-group-box {display:flex;flex-direction:column;gap:12px;}
#auto-config-panel [hidden] {display:none!important;}
#auto-config-panel .auto-category-description {color:#b9ad95;font-size:12px;margin:0 0 2px;}
#auto-config-panel .auto-menu-card {box-sizing:border-box;min-width:0;margin:0!important;padding:14px!important;border:1px solid #4c422f!important;border-radius:8px!important;background:#242017!important;box-shadow:none!important;overflow-wrap:anywhere;}
#auto-config-panel .auto-menu-card b {font-size:13px!important;}
#auto-config-panel .auto-menu-card button {font-family:inherit;line-height:1.4;white-space:normal!important;}
#auto-config-panel .auto-menu-card > button,
#auto-config-panel .auto-log-actions button {min-height:38px;padding:8px 12px;border:1px solid #74603d;border-radius:6px;background:#342d20;color:#efddb7;cursor:pointer;}
#auto-config-panel .auto-menu-card select {box-sizing:border-box;max-width:100%;min-height:38px;padding:6px;background:#191710;color:#eadbb7;border:1px solid #74603d;border-radius:6px;font:inherit;}
#auto-config-panel .auto-menu-card label {line-height:1.5;}
#auto-config-panel input[type=checkbox] {width:16px;height:16px;accent-color:#c9a45c;flex-shrink:0;cursor:pointer;}
#auto-config-panel .auto-help {margin:6px 0;font-size:12px;}
#auto-config-panel .auto-menu-details {margin:8px 0;border-top:1px solid #4c422f;padding-top:7px;}
#auto-config-panel .auto-menu-details summary {color:#cdbb96;cursor:pointer;padding:5px 0;font-size:12px;}
#auto-config-panel .auto-menu-details > div {margin-top:7px;}
#auto-config-panel .auto-log-actions {display:flex;flex-direction:column;gap:8px;}
#auto-config-panel .auto-menu-footer {gap:12px;padding:10px 20px!important;font-size:11px!important;background:#211c13;border-top:1px solid #4c422f!important;}
#auto-config-panel .auto-menu-footer span {white-space:normal!important;}
#auto-config-panel #auto-menu-empty {padding:36px 16px;text-align:center;color:#b9ad95;}
#auto-menu-empty > span {display:block;font-size:40px;color:#b49a66;}
#auto-menu-empty b {color:#eadbb7;}
#auto-menu-empty p {font-size:12px;}
#auto-menu-empty button {border:1px solid #74603d;border-radius:6px;background:#342d20;color:#efddb7;padding:8px 14px;cursor:pointer;}
@media(max-width:640px) {
  #auto-config-panel {width:96vw!important;height:94vh;height:94dvh;max-height:94vh!important;max-height:94dvh!important;}
  #auto-config-panel .auto-menu-header {padding:10px 12px!important;}
  #auto-config-panel .auto-menu-toolbar {padding:10px 12px;gap:8px;flex-wrap:wrap;}
  #auto-config-panel #auto-panel-toggle-btn {flex:1 1 100%;}
  #auto-config-panel .auto-search {flex-basis:100%;}
  #auto-config-panel .auto-menu-body {flex-direction:column;}
  #auto-config-panel .auto-menu-sidebar {width:auto;padding:8px 12px;border-right:0;border-bottom:1px solid #4c422f;overflow:visible;}
  #auto-config-panel .auto-menu-nav {flex-direction:row;overflow-x:auto;scrollbar-width:thin;}
  #auto-config-panel .auto-tab-btn {flex-shrink:0;padding:8px;gap:5px;}
  #auto-config-panel .auto-nav-label,#auto-config-panel .auto-sidebar-hint,#auto-config-panel .auto-nav-count {display:none;}
  #auto-config-panel .auto-menu-content {padding:12px 12px 0;}
  #auto-config-panel .auto-menu-card {padding:10px!important;}
  #auto-config-panel .auto-menu-footer {padding:8px 12px!important;}
}
@media(max-height:560px) {
  #auto-config-panel {height:96vh;height:96dvh;max-height:96vh!important;max-height:96dvh!important;}
  #auto-config-panel .auto-menu-header {padding:6px 12px!important;}
  #auto-config-panel .auto-menu-subtitle {display:none;}
  #auto-config-panel .auto-menu-toolbar {padding:6px 12px;}
  #auto-config-panel .auto-menu-content {padding-top:8px;}
}

/* Dungeon menu: six compact activity cards, secondary controls on demand. */
#auto-config-panel .auto-quest-card {padding:12px!important;}
#auto-config-panel .auto-quest-header {display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:10px;}
#auto-config-panel .auto-quest-title {display:flex;flex-direction:column;gap:2px;min-width:0;}
#auto-config-panel .auto-quest-title b {color:#ffeaa0;font-size:14px!important;}
#auto-config-panel .auto-quest-title > span {color:#b9ad95;font-size:11px;}
#auto-config-panel .auto-quest-header kbd {padding:2px 6px;border:1px solid #74603d;border-radius:4px;color:#dfc18c;background:#302719;font:11px inherit;flex-shrink:0;}
#auto-config-panel .auto-quest-toggle {width:100%!important;min-height:36px!important;margin:0!important;padding:7px 10px!important;font-size:12px!important;}
#auto-config-panel .auto-quest-options {margin:10px 0 0;padding-top:4px;}
#auto-config-panel .auto-quest-options > summary {padding:4px 0;font-size:11px;}
#auto-config-panel .auto-quest-options-body {display:flex;flex-direction:column;gap:8px;}
#auto-config-panel .auto-quest-options-body > div:empty {display:none!important;}
#auto-config-panel .auto-quest-options-body > div {max-width:100%;box-sizing:border-box;}
#auto-config-panel .auto-quest-loot-options {display:flex;flex-direction:column;gap:6px;border-top:1px solid #4c422f;padding-top:10px;}

/* Tối ưu chuyển cảnh sang map: giảm độ trễ mờ đen từ 0.42s xuống 0.15s */
#fade {
  transition: opacity 0.15s ease !important;
}
