/* ============================================================
   英魂之刃 英雄排行榜 (HTML 版)
   暗色主题，与 HEROES_EVOLVED_JIANGZHEHU 保持一致
   ============================================================ */
:root {
  --bg: #fdf8f0; --bg2: #f5efe6; --bg3: #ede4d8;
  --accent: #c0392b; --accent2: #e67e22; --gold: #8b6914; --blue: #2565ae;
  --text: #333333; --text2: #888888; --border: #ddd0c0;
  --win: #27ae60; --lose: #e74c3c;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: 'Microsoft YaHei','PingFang SC',sans-serif;
  background: var(--bg); color: var(--text);
  min-height: 100vh; line-height: 1.5;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

/* Header */
.header {
  background: linear-gradient(135deg,#f8f0e3,#fdf8f0,#f0e8d8);
  padding: 10px 0 0; text-align: center;
  border-bottom: 2px solid var(--accent);
  position: sticky; top: 0; z-index: 100;
}
.header h1 {
  font-size: 18px; color: var(--gold);
  text-shadow: none;
  padding: 6px 0 8px;
  display: flex; align-items: center; justify-content: center; gap: 12px;
  flex-wrap: wrap;
}
.header h1 .title-text {
  white-space: nowrap;
}

/* QQ交流群 link with tooltip */
.qq-group-link {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 13px; color: var(--accent);
  text-decoration: none; cursor: pointer;
  position: relative; padding: 2px 8px;
  border-radius: 4px; background: rgba(233,68,96,.1);
  transition: background .2s; white-space: nowrap;
}
.qq-group-link:hover {
  background: rgba(233,68,96,.2);
}
.qq-group-link .qr-tooltip {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: #fff;
  border-radius: 8px;
  padding: 8px;
  box-shadow: 0 4px 20px rgba(0,0,0,.4);
  z-index: 999;
  text-align: center;
}
.qq-group-link:hover .qr-tooltip {
  display: block;
}
.qq-group-link .qr-tooltip img {
  max-width: 200px;
  max-height: 200px;
  width: auto;
  height: auto;
  display: block;
  border-radius: 4px;
}

/* Tab Navigation */
.tab-nav {
  display: flex; gap: 0; padding: 0 10px;
  background: var(--bg); border-bottom: 1px solid var(--border);
  overflow-x: auto;
}
.tab-nav::-webkit-scrollbar { height: 0; }
.tab-btn {
  padding: 8px 16px; border: none; border-bottom: 2px solid transparent;
  background: transparent; color: var(--text2);
  cursor: pointer; font-size: 13px; font-family: inherit;
  transition: all .2s; white-space: nowrap;
  border-radius: 4px 4px 0 0;
}
.tab-btn:hover {
  background: rgba(233,68,96,.08); color: var(--text);
}
.tab-btn.active {
  color: var(--gold); border-bottom-color: var(--gold);
  background: rgba(139,105,20,.06);
  font-weight: 700;
}

/* Toolbar */
.toolbar {
  display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 12px;
  background: var(--bg2); border-radius: 8px; margin: 10px;
  align-items: center; justify-content: flex-end;
}
.toolbar-left-global {
  margin-right: auto;
}
.toolbar-right {
  display: flex;
  gap: 6px;
  align-items: center;
}
.toolbar .btn {
  padding: 5px 12px; border: none; border-radius: 4px;
  cursor: pointer; font-size: 12px; font-family: inherit;
  transition: all .2s; white-space: nowrap;
}
.toolbar .btn-primary { background: var(--accent); color: #fff; }
.toolbar .btn-primary:hover { background: #ff5370; }
.toolbar .btn-outline {
  background: transparent; border: 1px solid var(--accent);
  color: var(--accent);
}
.toolbar .btn-outline:hover { background: rgba(233,68,96,.1); }
.toolbar .btn-success { background: var(--win); color: #fff; }
.toolbar .btn-success:hover { background: #43a047; }
.toolbar .btn-accent { background: var(--accent2); color: #fff; }
.toolbar .btn-accent:hover { background: #ff8a65; }
.toolbar .btn-danger { background: #f44336; color: #fff; }
.toolbar .btn-danger:hover { background: #d32f2f; }

/* Generic dropdown */
.dropdown-wrap { position:relative; display:inline-block; }
.dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 4px 0;
  min-width: 170px;
  z-index: 200;
  box-shadow: 0 4px 16px rgba(0,0,0,.5);
}
.dropdown-option {
  display: block;
  width: 100%;
  padding: 8px 14px;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 12px;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  white-space: nowrap;
}
.dropdown-option:hover {
  background: rgba(233,68,96,.15);
  color: var(--accent);
}

.toolbar input[type="text"] {
  padding: 5px 8px; background: var(--bg3);
  border: 1px solid var(--border); color: var(--text);
  border-radius: 4px; font-size: 12px; font-family: inherit;
  width: 140px;
  user-select: text;
  -webkit-user-select: text;
  -moz-user-select: text;
  -ms-user-select: text;
}

/* Main layout */
.main-container {
  display: flex; gap: 10px; padding: 0 10px 10px;
  height: calc(100vh - 170px);
}

/* Left: tier list area */
.tier-area {
  flex: 1; overflow-y: auto; background: var(--bg2);
  border-radius: 8px; padding: 10px;
}

/* Tier row */
.tier-row {
  display: flex; border: 2px solid var(--border);
  border-radius: 6px; margin-bottom: 6px; min-height: 100px;
}
.tier-label {
  width: 60px; flex-shrink: 0; display: flex;
  align-items: center; justify-content: center;
  font-size: 16px; font-weight: 700; color: #fff;
  border-radius: 4px 0 0 4px; user-select: none;
}
.tier-label.t0 { background: #ff9800; }
.tier-label.t1 { background: #4caf50; }
.tier-label.t2 { background: #2196f3; }
.tier-label.t3 { background: #9c27b0; }
.tier-label.npc { background: #607d8b; }

.tier-content {
  flex: 1; display: flex; flex-wrap: wrap;
  gap: 4px; padding: 6px 8px;
  min-height: calc(56px + 16px);
  align-content: flex-start;
  transition: background .2s;
}
.tier-content.drag-over { background: rgba(233,68,96,.08); }

/* Hero avatar in tier */
.tier-avatar {
  width: 56px; text-align: center; cursor: grab;
  padding: 2px; border-radius: 4px; transition: all .15s;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
}
.tier-avatar:hover { background: rgba(233,68,96,.15); }
.tier-avatar img {
  width: 56px; height: 56px; border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--bg3);
  display: block;
}

.tier-avatar .name {
  max-width: 56px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.1;
  font-weight: 600;
}

/* 行1：英雄名 */
.tier-avatar .hero-name-line {
  font-size: 8px; color: var(--text); margin-top: 1px;
}
/* 行2：技能名（战技巅峰用，红色） */
.tier-avatar .skill-name-line {
  font-size: 7px; color: var(--accent); margin-top: 0;
}

/* Right: pick area */
.pick-area {
  width: 300px; flex-shrink: 0; display: flex;
  flex-direction: column; gap: 6px;
  transition: all .2s;
}
.pick-area.hidden {
  display: none;
}
.pick-header {
  display: flex; gap: 4px; align-items: center;
  user-select: none;
}
.pick-grid {
  display: grid; grid-template-columns: repeat(5, 1fr);
  gap: 4px; flex: 1; overflow-y: auto;
  background: var(--bg2); border-radius: 8px;
  padding: 6px;
  align-content: flex-start;
}

/* Pick avatar */
.pick-avatar {
  width: 100%; text-align: center; cursor: grab;
  padding: 2px; border-radius: 4px; transition: all .15s;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
}
.pick-avatar:hover { background: rgba(233,68,96,.1); }
.pick-avatar.disabled-avatar,
.pick-avatar.disabled-avatar:hover { background: transparent; cursor: not-allowed; pointer-events: none; }
.pick-avatar img {
  width: 48px; height: 48px; border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--bg3);
  display: block;
}

.pick-avatar .name {
  max-width: 48px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.1;
  font-weight: 600;
}

/* 行1：英雄名 */
.pick-avatar .hero-name-line {
  font-size: 8px; color: var(--text); margin-top: 1px;
}
/* 行2：技能名（战技巅峰用，红色） */
.pick-avatar .skill-name-line {
  font-size: 7px; color: var(--accent); margin-top: 0;
}

/* Highlight animation for search results in tier area */
@keyframes highlight-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(233,68,96,0.7); transform: none; }
  50% { box-shadow: 0 0 0 6px rgba(233,68,96,0); transform: scale(1.05); }
}
.tier-avatar.search-match {
  animation: highlight-pulse 1s ease-in-out 3;
  border-radius: 50%;
}

/* Drag ghost */
.drag-ghost {
  position: fixed; pointer-events: none; z-index: 9999;
  opacity: 0.8;
}
.drag-ghost img {
  width: 56px; height: 56px; border-radius: 50%;
  border: 2px solid var(--gold);
  box-shadow: 0 4px 12px rgba(0,0,0,.5);
}

/* Toast */
.toast {
  position: fixed; top: 16px; right: 16px;
  background: #4caf50; color: #fff; padding: 8px 16px;
  border-radius: 4px; z-index: 9999; font-size: 13px;
  pointer-events: none;
}

/* Modal overlay */
.modal-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,.7); z-index: 9998;
  display: flex; align-items: center; justify-content: center;
}
.modal-box {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 10px; padding: 20px; max-width: 600px;
  width: 90%; max-height: 70vh; overflow-y: auto;
  box-shadow: 0 8px 32px rgba(0,0,0,.5);
}
.modal-box h3 { color: var(--gold); margin-bottom: 12px; font-size: 16px; }
.modal-box input[type="file"] { margin: 8px 0; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; }
.modal-actions button {
  padding: 6px 18px; border: none; border-radius: 4px;
  cursor: pointer; font-size: 12px; font-family: inherit;
}

::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

@media (max-width: 900px) {
  .main-container { flex-direction: column; height: auto; }
  .pick-area { width: auto; }
  .tab-nav { flex-wrap: nowrap; }
  .tab-btn { padding: 6px 10px; font-size: 12px; }
}
