:root {
  --bg: #0a0e14;
  --bg-panel: #141b26;
  --bg-card: #1b2430;
  --bg-card-hover: #232f3e;
  --border: #2a3646;
  --text: #e6edf3;
  --text-dim: #8b97a7;
  --gold: #c8aa6e;
  --gold-bright: #f0e6d2;
  --text-muted: #6b7686;

  /* Cost tier colors */
  --cost-1: #9aa4af;
  --cost-2: #2ecc71;
  --cost-3: #3da9fc;
  --cost-4: #c061f7;
  --cost-5: #f5b942;

  /* Trait tier colors */
  --tier-bronze: #b07d4f;
  --tier-silver: #9fb4c8;
  --tier-gold: #f5cf5b;
  --tier-prismatic: #f08bd0;
}

* { box-sizing: border-box; }
/* Tắt ô sáng lóe khi chạm phần tử bấm được trên mobile (tap highlight). */
* { -webkit-tap-highlight-color: transparent; }

body {
  margin: 0;
  font-family: "Segoe UI", Roboto, system-ui, sans-serif;
  background: #010a13;
  color: var(--text);
  min-height: 100vh;
}
/* Nền gradient xanh đen kiểu doihinhtft.vn: một lớp fixed, quầng sáng xanh-xám
   nhẹ ở đỉnh tan dần về nền xanh đen (#010a13). */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(1200px 700px at 50% -6%, rgba(25, 32, 45, 0.55) 0%, transparent 46%),
    linear-gradient(180deg, #071119 0%, #030b14 55%, #010a13 100%);
  pointer-events: none;
}

/* Top navigation bar */
.navbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(15, 21, 31, 0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.navbar-inner {
  width: 100%;
  margin: 0 auto;
  padding: 0 20px;
  height: 60px;
  display: grid;
  grid-template-columns: auto auto 1fr auto;
  align-items: center;
  gap: 24px;
}

/* Settings gear (top-right of the navbar). Only shown on the planner page,
   where the settings modal + logic (app.js) actually exist. */
.nav-settings-btn {
  display: none;
  justify-self: end;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  line-height: 1;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-dim);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.nav-settings-btn:hover {
  border-color: var(--gold);
  background: rgba(200, 170, 110, 0.12);
  color: var(--gold-bright);
}
.nav-settings-icon { display: block; }
body[data-page="plan"] .nav-settings-btn { display: inline-flex; }

/* Logo (left) */
.brand {
  display: flex;
  align-items: center;
  justify-self: start;
  gap: 10px;
  text-decoration: none;
  font-weight: 800;
  font-size: 1.2rem;
  letter-spacing: 0.5px;
  color: var(--gold-bright);
  white-space: nowrap;
}
.brand-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--gold), #8a6d3b);
  color: #1a1206;
  font-weight: 800;
  font-size: 1.2rem;
  box-shadow: 0 0 16px rgba(200, 170, 110, 0.35);
}
.brand-accent { color: var(--gold); }
.brand-text { display: none; }

.brand-tagline {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.3px;
  color: var(--text-muted, #9a9488);
  padding-left: 10px;
  margin-left: 4px;
  border-left: 1px solid rgba(255, 255, 255, 0.18);
}

/* Hamburger — chỉ hiện trên mobile (xem media query bên dưới). */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  width: 40px;
  height: 40px;
  padding: 9px;
  justify-self: end;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
}
.nav-toggle-bar {
  display: block;
  width: 100%;
  height: 2px;
  border-radius: 2px;
  background: var(--text);
  transition: transform 0.2s, opacity 0.2s;
}
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

.site-nav {
  display: flex;
  align-items: center;
  justify-self: start;
  justify-content: flex-start;
  gap: 22px;
}
.site-nav-link {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 4px;
  border-bottom: 2px solid transparent;
  color: var(--text-dim);
  font-size: 0.9rem;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0.4px;
  text-decoration: none;
  transition: border-color 0.15s, color 0.15s;
}
.site-nav-link:hover,
.site-nav-link.active {
  border-bottom-color: var(--gold);
  color: var(--gold-bright);
}

/* Data dropdown */
.nav-dropdown {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.nav-dropdown-toggle {
  gap: 5px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 650;
}
.nav-dropdown-caret {
  font-size: 0.7rem;
  transition: transform 0.15s;
}
.nav-dropdown.open .nav-dropdown-caret {
  transform: rotate(180deg);
}
.nav-dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 170px;
  display: none;
  flex-direction: column;
  padding: 6px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
  z-index: 60;
}
.nav-dropdown.open .nav-dropdown-menu {
  display: flex;
}
.nav-dropdown-item {
  display: block;
  padding: 8px 12px;
  border-radius: 7px;
  color: var(--text-dim);
  font-size: 0.88rem;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0.4px;
  text-decoration: none;
  transition: background 0.12s, color 0.12s;
}
.nav-dropdown-item:hover,
.nav-dropdown-item.active {
  background: rgba(255, 255, 255, 0.06);
  color: var(--gold-bright);
}

/* Language switcher (top-right) */
.lang-switcher {
  position: relative;
}
/* Trong footer: nằm ở đầu (trái), phía trên khối blog; menu bung lên trên. */
.site-footer .lang-switcher {
  justify-self: start;
}
.site-footer .lang-menu {
  top: auto;
  bottom: calc(100% + 6px);
  left: 0;
  right: auto;
}
.lang-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s, background-color 0.15s;
}
.lang-btn:hover { background: var(--bg-card-hover); border-color: var(--gold); }
.lang-btn .lang-caret { font-size: 0.7rem; color: var(--text-dim); }

/* Flag icon (inline SVG) shown before the language name */
.lang-flag {
  display: inline-flex;
  flex: 0 0 auto;
  width: 22px;
  height: 15px;
}
.lang-flag .flag-svg {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: 3px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.18);
}
.lang-flag .flag-code {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--text-dim);
}
.lang-btn[aria-expanded="true"] .lang-caret { transform: rotate(180deg); }

.lang-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 160px;
  margin: 0;
  padding: 6px;
  list-style: none;
  background: rgba(15, 21, 31, 0.98);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
  z-index: 60;
}
.lang-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  border-radius: 7px;
  color: var(--text-dim);
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.15s, background-color 0.15s;
}
.lang-option:hover { color: var(--text); background: var(--bg-card-hover); }
.lang-option.active { color: var(--gold-bright); background: rgba(200, 170, 110, 0.12); }

.app-header {
  padding: 24px 28px 8px;
  text-align: center;
}
.app-header h1 {
  margin: 0;
  font-size: 1.9rem;
  letter-spacing: 0.5px;
  color: var(--gold-bright);
  text-shadow: 0 0 18px rgba(200, 170, 110, 0.25);
}
.subtitle { margin: 6px 0 0; color: var(--text-dim); font-size: 0.95rem; }
.set-label {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 8px;
  border: 1px solid var(--gold);
  border-radius: 999px;
  color: var(--gold);
  font-size: 0.8rem;
}

/* Mobile-only quick-jump bar (hidden on desktop; shown in the mobile media
   query). Anchors scroll to the boards, the suggestions panel and the generated
   comps panel. */
.mobile-jump { display: none; }

/* Layout */
.layout {
  display: grid;
  /* Left 60% (board + picker), right 40% (suggestions, how-to). */
  grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
  gap: 20px;
  align-items: start;
  max-width: 1440px;
  margin: 16px auto 48px;
  /* Content solid color (tham khảo doihinhtft.vn): nền xanh đen #05080d + quầng
     sáng nhẹ ở đỉnh, viền mảnh, bo góc. */
  padding: 24px;
  background:
    radial-gradient(900px 380px at 50% 0%, rgba(25, 32, 45, 0.33) 0%, transparent 42%),
    #05080d;
  border: 1px solid #131821;
  border-radius: 18px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.5);
}

/* Picker */
.picker { min-width: 0; }
.picker-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-bottom: 14px;
}
#search,
#pickerModalSearch {
  flex: 1 1 200px;
  padding: 9px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.95rem;
}
#search:focus,
#pickerModalSearch:focus { outline: none; border-color: var(--gold); }

.cost-filters { display: flex; gap: 6px; }
.cost-filter {
  width: 38px;
  height: 38px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-dim);
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  transition: 0.15s;
}
.cost-filter:hover { background: var(--bg-card-hover); color: var(--text); }
.cost-filter.active { border-color: var(--gold); color: var(--gold-bright); background: #20283400; }

/* Trait filter chips */
.trait-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
  max-height: 132px;
  overflow-y: auto;
  padding: 2px 2px 4px;
}
.trait-filter {
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-dim);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 0.82rem;
  font-weight: 600; /* fixed weight in every state so the chip never changes width */
  cursor: pointer;
  white-space: nowrap;
  /* Only animate colors — never size — so active chips don't reflow the row. */
  transition: background-color 0.15s, color 0.15s, border-color 0.15s;
}
.trait-filter:hover { background: var(--bg-card-hover); color: var(--text); }
.trait-filter.active {
  border-color: var(--gold);
  color: #1a1206;
  background: var(--gold);
}
/* Unique (1-champion) traits: dimmed, less prominent — but still selectable. */
.trait-filter.muted {
  opacity: 0.45;
  font-weight: 400;
  border-style: dashed;
}
.trait-filter.muted:hover { opacity: 0.8; }
.trait-filter.muted.active { opacity: 1; } /* full emphasis once chosen */

.unit-groups {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.cost-group.hidden { display: none; }
.cost-group-head {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0 0 7px;
  padding-bottom: 5px;
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--cost-color, var(--text-dim));
  border-bottom: 1px solid var(--border);
}
.cost-group-pips { letter-spacing: 1px; }

.unit-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(86px, 1fr));
  gap: 8px;
}

.unit-card {
  position: relative;
  background: var(--bg-card);
  color: var(--text); /* <button> doesn't inherit color — set it so names aren't black */
  border: 1px solid var(--border);
  border-top: 3px solid var(--cost-color, var(--border));
  border-radius: 9px;
  padding: 6px 4px 7px;
  cursor: pointer;
  text-align: center;
  transition: transform 0.12s, background 0.15s, box-shadow 0.15s;
  user-select: none;
}
.unit-card:hover { background: var(--bg-card-hover); transform: translateY(-2px); }
.unit-card.selected {
  border-color: var(--gold);
  box-shadow: 0 0 0 1px var(--gold), 0 0 16px rgba(200, 170, 110, 0.35);
  background: #232c1c33;
}
.unit-card.selected::after {
  content: "✓";
  position: absolute;
  top: 4px; right: 6px;
  color: var(--gold-bright);
  font-weight: 700;
  font-size: 0.85rem;
}
.unit-card.hidden { display: none; }

.unit-portrait {
  width: 44px;
  height: 44px;
  border-radius: 7px;
  object-fit: cover;
  background: #0d141d;
  display: block;
  margin: 0 auto 5px;
  border: 1px solid var(--border);
}
.unit-portrait.fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: var(--text-dim);
  font-size: 1.1rem;
}
.unit-name {
  font-size: 0.76rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.unit-cost { font-size: 0.66rem; color: var(--cost-color, var(--text-dim)); }
.unit-traits { font-size: 0.6rem; color: var(--text-dim); margin-top: 2px; line-height: 1.2; }

/* Play-guide panels (single right column) */
.guide-panel {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
}
.guide-panel h2 { margin: 0 0 2px; font-size: 1.05rem; color: var(--gold); font-weight: 600; }
.generated-comps-panel {
  margin-top: 28px;
}
.generated-comps-panel h2 {
  margin: 0 0 2px;
  font-size: 1.05rem;
  color: var(--gold);
  font-weight: 600;
}
.play-guide-list {
  margin: 10px 0 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  color: var(--text);
  font-size: 0.9rem;
  line-height: 1.45;
}
.play-guide-section {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.02);
}
.play-guide-section h3 {
  margin: 0;
  color: var(--gold);
  font-size: 0.88rem;
  font-weight: 700;
}
.play-guide-steps {
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.play-guide-step {
  color: var(--text);
}
.guide-units-inline {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 5px;
  margin: 0 4px;
  vertical-align: middle;
}
.guide-unit-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 160px;
  padding: 2px 7px 2px 2px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-card);
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 600;
  vertical-align: middle;
}
.guide-unit-chip > span:last-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.guide-units-inline .comp-unit {
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
}
.guide-units-inline .comp-unit img,
.guide-units-inline .comp-unit-fallback {
  width: 30px;
  height: 30px;
}

/* Suggestion rows (Đầu/Cuối game) */
.suggest-line { margin-top: 10px; }
.suggest-line-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.suggest-line-label { font-weight: 600; font-size: 0.9rem; color: var(--text); }
.see-more {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--gold);
  border-radius: 7px;
  padding: 3px 10px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: 0.15s;
}
.see-more:hover { border-color: var(--gold); background: rgba(200, 170, 110, 0.12); }
.suggest-strip {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.suggest-strip[hidden] { display: none; }
.strip-unit {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 9px;
  width: 50px;
  background: transparent;
  border: none;
  padding: 0;
  color: var(--text); /* button: keep name text light */
  cursor: pointer;
}
.strip-thumb { position: relative; }
.strip-unit .comp-unit { width: 46px; height: 46px; }
.strip-unit:hover .comp-unit { box-shadow: 0 0 0 2px var(--gold); }
.strip-name {
  width: 50px;
  font-size: 0.66rem;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.strip-gain {
  position: absolute;
  bottom: -5px; left: 50%;
  transform: translateX(-50%);
  padding: 0 6px;
  border-radius: 999px;
  background: #3ddc84;
  color: #0a0e14;
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 15px;
  white-space: nowrap;
}

/* Extra info */
.info-block { margin-top: 10px; }
.info-label { font-size: 0.82rem; font-weight: 600; color: var(--text-dim); margin-bottom: 6px; }
.info-units { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 8px; }
.info-unit { display: flex; align-items: center; gap: 6px; }
.info-unit .comp-unit { width: 36px; height: 36px; }
.info-unit-name { font-size: 0.8rem; color: var(--text); white-space: nowrap; }
.carry-rank {
  font-weight: 800;
  color: var(--gold-bright);
  font-size: 0.85rem;
}
.similar-comps {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 340px;
  overflow-y: auto;
  padding-right: 4px; /* room for the scrollbar */
}
.similar-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.similar-row:hover { background: var(--bg-card-hover); }
.similar-row.active { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold); }
.similar-row .comp-info { flex: 1; min-width: 0; }
.comp-unit.match { box-shadow: 0 0 0 2px #3ddc84; }
.similar-metrics {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  text-align: center;
}
.similar-metrics .comp-score { min-width: 42px; padding: 2px 8px; font-size: 0.9rem; }
.similar-overlap {
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 0.74rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.comp-diff { display: flex; flex-direction: column; gap: 12px; }
.diff-title { font-weight: 600; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.diff-title .comp-score { font-size: 0.9rem; }
.diff-title .comp-tier { width: 22px; height: 22px; font-size: 0.8rem; }
.diff-group {
  border-radius: 9px;
  padding: 8px 10px;
  border: 1px solid var(--border);
}
.diff-group.remove { background: rgba(217, 83, 79, 0.10); border-color: rgba(217, 83, 79, 0.35); }
.diff-group.add { background: rgba(61, 220, 132, 0.10); border-color: rgba(61, 220, 132, 0.35); }
.diff-label { font-size: 0.82rem; font-weight: 700; margin-bottom: 7px; }
.diff-group.remove .diff-label { color: #ff9d9a; }
.diff-group.add .diff-label { color: #6ef0a6; }
.diff-units { display: flex; flex-wrap: wrap; gap: 10px; }
.diff-unit { width: 48px; text-align: center; }
.diff-unit-name {
  display: block;
  font-size: 0.62rem;
  color: var(--text-dim);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Sidebar */
.sidebar {
  position: sticky;
  top: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.board-panel, .traits-panel, .suggest-panel {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
}
/* Board panels live at the top of the left column. */
.picker > .board-panel,
#boardsMount > .board-panel { position: relative; margin-bottom: 12px; cursor: pointer; transition: border-color 0.06s, box-shadow 0.06s; }
.picker > .board-panel.active,
#boardsMount > .board-panel.active { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold); }
.picker > .board-panel:not(.active),
#boardsMount > .board-panel:not(.active) { opacity: 0.92; }
.picker > .board-panel:not(.active):hover,
#boardsMount > .board-panel:not(.active):hover { border-color: var(--gold); opacity: 1; }
.board-tools { margin-bottom: 16px; display: flex; flex-direction: column; gap: 8px; }
.board-tool-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 12px 0; }
.board-tools .top-comps-btn {
  align-self: flex-start;
  margin-right: 0;
  padding: 9px 18px;
  font-size: 0.95rem;
  border-color: var(--border);
  background: var(--bg-card);
  color: var(--text-dim);
  font-weight: 500;
}
.board-tools .top-comps-btn:hover {
  border-color: var(--gold);
  background: rgba(200, 170, 110, 0.12);
  color: var(--gold-bright);
}
.board-tools .teamcode { margin-top: 0; padding-top: 0; border-top: none; }
.board-tools .teamcode-msg { margin-top: 0; }
.board-head, .traits-panel h2, .suggest-panel h2 { margin: 0; }
.board-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.board-head h2, .traits-panel h2, .suggest-panel h2 {
  font-size: 1.05rem;
  color: var(--gold);
  font-weight: 600;
}
.panel-sub { margin: 4px 0 12px; color: var(--text-dim); font-size: 0.82rem; }
.panel-sub.warn { color: var(--cost-5); }
.board-count { color: var(--text-dim); font-size: 0.9rem; font-weight: 500; }
.board-count.full { color: var(--cost-5); }
.team-score {
  margin-left: auto;
  margin-right: 10px;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(61, 220, 132, 0.14);
  border: 1px solid rgba(61, 220, 132, 0.45);
  color: #6ef0a6;
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
}
.role-balance {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-right: 10px;
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
}
.role-balance .rb-tank,
.role-balance .rb-dmg {
  padding: 3px 9px;
  border-radius: 999px;
}
.role-balance .rb-tank {
  background: rgba(59, 130, 246, 0.16);
  border: 1px solid rgba(59, 130, 246, 0.5);
  color: #7db1ff;
}
.role-balance .rb-dmg {
  background: rgba(229, 72, 77, 0.16);
  border: 1px solid rgba(229, 72, 77, 0.5);
  color: #f2888b;
}
/* Nút xóa đội: dấu × trơn, gọn (giống nút đóng popup). */
.clear-btn {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 1.5rem;
  line-height: 1;
  padding: 0 6px;
  cursor: pointer;
  transition: 0.15s;
}
.clear-btn:hover { color: #ff7b76; }
.board-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto; /* đẩy cụm nút sang phải, cùng hàng với "Ấn" */
}
.board-copy-code,
.board-move-btn,
.board-save {
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-dim);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  transition: none;
}
.board-copy-code:hover,
.board-move-btn:hover,
.board-save:hover {
  border-color: var(--gold);
  color: var(--gold-bright);
  background: rgba(200, 170, 110, 0.12);
}
.board-save.saved {
  border-color: var(--gold);
  background: rgba(61, 220, 132, 0.18);
}
.top-comps-btn {
  margin-right: 8px;
  padding: 5px 12px;
  border-radius: 7px;
  border: 1px solid var(--gold);
  background: rgba(200, 170, 110, 0.12);
  color: var(--gold-bright);
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: 0.15s;
}
.top-comps-btn:hover { background: var(--gold); color: #1a1206; }

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 100;
}
.modal-overlay[hidden] { display: none; }
.modal {
  width: 100%;
  max-width: 720px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
.modal-head h2 { margin: 0; font-size: 1.05rem; color: var(--gold); }
.modal-close {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
}
.modal-close:hover { color: var(--text); }

/* Settings popup */
.settings-modal { max-width: 460px; }
.settings-body {
  overflow-y: auto;
  padding: 14px 18px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.02);
  cursor: pointer;
}
.setting-text { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.setting-label { font-weight: 600; color: var(--text); }
.setting-hint { font-size: 0.82rem; color: var(--text-dim); line-height: 1.4; }
/* Toggle switch */
.switch { position: relative; flex: none; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch-track {
  display: block;
  width: 44px;
  height: 24px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid var(--border);
  transition: background 0.15s;
}
.switch-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #d8d8d8;
  transition: transform 0.15s, background 0.15s;
}
.switch input:checked + .switch-track { background: var(--gold); border-color: var(--gold); }
.switch input:checked + .switch-track .switch-thumb { transform: translateX(20px); background: #1a1206; }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--gold-bright); outline-offset: 2px; }

.picker-modal {
  max-width: 980px;
}
.picker-modal-body {
  overflow-y: auto;
  padding: 14px 16px 18px;
}
.picker-modal-body .picker-toolbar {
  margin-bottom: 12px;
}
.comps-list {
  overflow-y: auto;
  padding: 12px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.comp-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.comp-tier {
  flex: 0 0 auto;
  width: 26px; height: 26px;
  border-radius: 6px;
  font-weight: 800;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #0a0e14;
}
.comp-tier.tier-S { background: #ff5d5d; color: #fff; }
.comp-tier.tier-A { background: #f5b942; }
.comp-tier.tier-B { background: #3da9fc; }
.comp-tier.tier-C { background: #9aa4af; }
.comp-tier.tier-D { background: #6b7280; color: #e6edf3; }
.comp-info { flex: 1; min-width: 0; }
.comp-name {
  color: var(--text); /* <button> rows don't inherit color — keep names light */
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.comp-units { display: flex; flex-wrap: wrap; gap: 4px; }
.comp-unit {
  width: 32px; height: 32px;
  border-radius: 6px;
  border: 1px solid var(--cost-color, var(--border));
  overflow: hidden;
}
.comp-unit img { width: 100%; height: 100%; object-fit: cover; display: block; }
.comp-unit-fallback {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.65rem; font-weight: 700; color: var(--text-dim); background: #0d141d;
}
.comp-score {
  flex: 0 0 auto;
  min-width: 34px;
  padding: 4px 9px;
  border-radius: 8px;
  background: rgba(61, 220, 132, 0.16);
  border: 1px solid rgba(61, 220, 132, 0.5);
  color: #6ef0a6;
  font-size: 1rem;
  font-weight: 700;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.comp-pick {
  flex: 0 0 auto;
  padding: 7px 16px;
  border-radius: 8px;
  border: 1px solid var(--gold);
  background: var(--gold);
  color: #1a1206;
  font-weight: 700;
  cursor: pointer;
  transition: filter 0.15s;
}
.comp-pick:hover { filter: brightness(1.1); }

#myTeamsList { min-height: 320px; }
.saved-team-slot {
  flex: 0 0 auto;
  min-width: 34px;
  padding: 4px 9px;
  border-radius: 8px;
  background: rgba(200, 170, 110, 0.14);
  border: 1px solid rgba(200, 170, 110, 0.5);
  color: var(--gold-bright);
  font-size: 0.78rem;
  font-weight: 700;
  text-align: center;
  white-space: nowrap;
}
.comp-row.empty-slot { border-style: dashed; opacity: 0.6; }
.saved-team-empty { color: var(--text-dim); font-size: 0.85rem; font-style: italic; }
.saved-team-actions { flex: 0 0 auto; display: flex; align-items: center; gap: 6px; }
.saved-team-meta { color: var(--text-dim); font-size: 0.74rem; margin-top: 4px; }
.saved-team-del {
  flex: 0 0 auto;
  padding: 7px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-dim);
  font-weight: 600;
  cursor: pointer;
  transition: 0.15s;
}
.saved-team-del:hover { border-color: #d9534f; color: #ff7b76; }

/* Save-slot picker popup */
.save-slot-sub { margin: 0; padding: 4px 16px 0; color: var(--text-dim); font-size: 0.82rem; }
.save-slot-grid {
  overflow-y: auto;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.save-slot-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  text-align: left;
  transition: 0.12s;
}
.save-slot-card.selected {
  border-color: var(--gold);
  box-shadow: 0 0 0 1px var(--gold);
  background: rgba(200, 170, 110, 0.12);
}
.save-slot-badge {
  flex: 0 0 auto;
  min-width: 34px;
  padding: 4px 9px;
  border-radius: 8px;
  background: rgba(200, 170, 110, 0.14);
  border: 1px solid rgba(200, 170, 110, 0.5);
  color: var(--gold-bright);
  font-size: 0.78rem;
  font-weight: 700;
  text-align: center;
  white-space: nowrap;
}
.save-slot-info { flex: 1; min-width: 0; }
.save-slot-name {
  font-size: 0.88rem;
  font-weight: 600;
  margin-bottom: 5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.save-slot-card .comp-unit { width: 28px; height: 28px; }
.save-slot-empty {
  color: var(--text-dim);
  font-size: 0.85rem;
  font-style: italic;
}
/* Nút lưu trực tiếp trên mỗi ô */
.save-slot-btn {
  flex: 0 0 auto;
  padding: 6px 16px;
  border-radius: 8px;
  border: 1px solid var(--gold);
  background: rgba(200, 170, 110, 0.15);
  color: var(--gold-bright);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: 0.12s;
}
.save-slot-btn:hover { background: rgba(200, 170, 110, 0.32); }
.save-slot-btn.overwrite {
  border-color: #d9843b;
  background: rgba(217, 132, 59, 0.14);
  color: #f0b884;
}
.save-slot-btn.overwrite:hover { background: rgba(217, 132, 59, 0.3); }
.save-slot-foot {
  display: flex;
  justify-content: flex-end;
  padding: 12px 16px 16px;
  border-top: 1px solid var(--border);
}
.save-slot-foot .comp-pick:disabled { opacity: 0.4; cursor: not-allowed; }

.board-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 56px;
}
.board-chip {
  position: relative;
  width: 46px;
  cursor: pointer;
}
/* Bọc ảnh 46x46 để badge điểm / nút × / chấm role neo theo ảnh. */
.chip-img {
  position: relative;
  width: 46px;
  height: 46px;
}
/* Hàng số sao dưới mỗi tướng — hiển thị như nút để người dùng biết bấm được. */
.chip-stars {
  margin-top: 11px;
  padding: 2px 0 1px;
  text-align: center;
  font-size: 10px;
  letter-spacing: 0.5px;
  line-height: 1;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.04);
}
.chip-stars.star-2 { color: #cdd3da; }
.chip-stars.star-3 { color: #ffcf40; }
.chip-stars.star-4 { color: #b98bff; text-shadow: 0 0 4px rgba(185, 139, 255, 0.65); }
.chip-stars:hover {
  filter: brightness(1.3);
  border-color: var(--gold);
  background: rgba(255, 255, 255, 0.08);
}
.board-chip img {
  width: 46px; height: 46px;
  border-radius: 7px;
  border: 2px solid var(--cost-color, var(--border));
  object-fit: cover;
  display: block;
}
.board-chip .remove {
  position: absolute;
  top: -5px; right: -5px;
  width: 16px; height: 16px;
  background: #d9534f;
  color: #fff;
  border-radius: 50%;
  font-size: 11px;
  line-height: 16px;
  text-align: center;
  opacity: 0;
  transition: 0.12s;
}
.board-chip:hover .remove { opacity: 1; }
/* Unit on the board that isn't activating any trait. */
.board-chip.no-synergy img { border-color: #d9534f; border-style: dashed; opacity: 0.65; }
/* Unit activating the most traits (highest score = Σ active counts × cost). */
.board-chip.top-synergy img {
  border-color: #3ddc84;
  box-shadow: 0 0 10px rgba(61, 220, 132, 0.6);
}
/* Visible synergy-score badge on each unit. */
.chip-score {
  position: absolute;
  bottom: -7px; left: -7px;
  min-width: 22px; height: 22px;
  padding: 0 5px;
  box-sizing: border-box;
  background: #2a3646;
  color: var(--text);
  border: 1px solid var(--bg);
  border-radius: 11px;
  font-size: 13px;
  font-weight: 700;
  line-height: 20px;
  text-align: center;
}
.board-chip.top-synergy .chip-score { background: #3ddc84; color: #0a0e14; }
.board-chip.no-synergy .chip-score { background: #d9534f; color: #fff; }

.board-notice {
  margin: 10px 0 0;
  padding: 6px 10px;
  font-size: 0.8rem;
  color: #ffb4b1;
  background: rgba(217, 83, 79, 0.12);
  border: 1px solid rgba(217, 83, 79, 0.4);
  border-radius: 7px;
}

.board-slot.empty,
.board-add-slot,
.board-suggest-slot {
  width: 46px;
  height: 46px;
  border-radius: 7px;
}
.board-slot.empty {
  border: 1px dashed var(--border);
  background: rgba(255, 255, 255, 0.02);
  opacity: 0.5;
  cursor: pointer;
}
.board-slot.empty.inert {
  cursor: default;
  pointer-events: none;
}
.board-add-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  border: 1px dashed var(--gold);
  background: rgba(200, 170, 110, 0.1);
  color: var(--gold-bright);
  cursor: pointer;
  line-height: 1;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.board-add-icon {
  font-size: 1.35rem;
  font-weight: 400;
}
.board-add-label {
  font-size: 0.62rem;
  font-weight: 400;
  letter-spacing: 0.02em;
}
.board-add-slot:hover {
  border-color: var(--gold-bright);
  background: rgba(200, 170, 110, 0.2);
  color: #fff;
}
.board-suggest-slot {
  position: relative;
  padding: 0;
  overflow: hidden;
  border: 2px solid #3ddc84;
  background: rgba(61, 220, 132, 0.12);
  cursor: pointer;
  box-shadow: 0 0 0 1px rgba(5, 8, 13, 0.35);
}
.board-suggest-slot img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.board-suggest-slot:hover {
  border-color: #75f0ad;
  filter: brightness(1.08);
}
/* Điểm cộng của tướng gợi ý — nằm dưới chip (ở hàng như số sao), không đè lên icon. */
.chip-stars.chip-suggest-gain {
  color: #6dffab;
  font-weight: 900;
  border-color: rgba(61, 220, 132, 0.5);
  background: rgba(61, 220, 132, 0.12);
  cursor: default;
}
.chip-stars.chip-suggest-gain:hover { filter: none; }

/* Active-traits summary (concise, under the board) */
.active-summary-wrap {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}
.active-summary-label {
  flex: 0 0 auto;
  color: var(--text-dim);
  font-size: 0.8rem;
}
.active-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.empty-hint.sm { font-size: 0.8rem; margin: 0; }
.active-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 0.8rem;
  background: var(--bg-card);
  border: 1px solid var(--tier-color, var(--border));
  color: var(--text);
}
.active-chip strong { color: var(--tier-color, var(--text)); font-variant-numeric: tabular-nums; }

/* Emblems ("Ấn") row on each board */
.emblem-wrap {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}
.emblem-label { flex: 0 0 auto; color: var(--text-dim); font-size: 0.8rem; }
.emblem-list { display: flex; flex-wrap: wrap; gap: 6px; flex: 0 1 auto; min-width: 0; }
.emblem-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.8rem;
  background: rgba(140, 110, 200, 0.14);
  border: 1px solid rgba(160, 130, 220, 0.55);
  color: #cdbcf0;
  cursor: pointer;
  transition: 0.15s;
}
.emblem-chip:hover { border-color: #d9534f; color: #ff9d9a; }
.emblem-chip .emblem-ico { color: #b69cf0; font-size: 0.7rem; }
.emblem-chip .emblem-x { color: var(--text-dim); font-weight: 700; }
.emblem-add {
  flex: 0 0 auto;
  padding: 4px 12px;
  border-radius: 999px;
  border: 1px dashed rgba(160, 130, 220, 0.6);
  background: transparent;
  color: #b69cf0;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: 0.15s;
}
.emblem-add:hover { background: rgba(140, 110, 200, 0.14); border-style: solid; }

/* Emblem picker popup */
.emblem-modal-sub { margin: 0; padding: 4px 16px 0; color: var(--text-dim); font-size: 0.82rem; }
.emblem-grid {
  overflow-y: auto;
  padding: 12px 16px 16px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
}
.emblem-pick {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 12px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  transition: 0.12s;
}
.emblem-pick:hover { border-color: #a082dc; background: rgba(140, 110, 200, 0.12); }
.emblem-pick.has { border-color: rgba(160, 130, 220, 0.7); background: rgba(140, 110, 200, 0.16); }
.emblem-pick-count {
  flex: 0 0 auto;
  min-width: 20px;
  padding: 1px 7px;
  border-radius: 999px;
  background: rgba(160, 130, 220, 0.85);
  color: #14101f;
  font-weight: 800;
  font-size: 0.78rem;
  text-align: center;
}

/* Paste-team-code row */
.teamcode {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}
.teamcode-top {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
  gap: 10px;
}
.teamcode-top #teamCodeInput {
  padding: 12px 16px;
  font-size: 1rem;
  border-radius: 10px;
}
.teamcode-top #teamCodeBtn {
  padding: 12px 24px;
  font-size: 1rem;
  border-radius: 10px;
}
#teamCodeInput {
  flex: 1 1 auto;
  min-width: 0;
  padding: 8px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.85rem;
  font-family: ui-monospace, "Consolas", monospace;
}
#teamCodeInput:focus { outline: none; border-color: var(--gold); }
#teamCodeBtn {
  flex: 0 0 auto;
  padding: 8px 16px;
  background: var(--gold);
  color: #1a1206;
  border: 1px solid var(--gold);
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: filter 0.15s;
}
#teamCodeBtn:hover { filter: brightness(1.1); }
.teamcode-msg {
  margin: 8px 0 0;
  font-size: 0.8rem;
  color: var(--text-dim);
  min-height: 1em;
}
.teamcode-msg.error { color: #ff7b76; }

.suggest-tabs { display: flex; gap: 6px; margin-bottom: 10px; }
.suggest-tab {
  flex: 1;
  padding: 7px 10px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-dim);
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s, border-color 0.15s;
}
.suggest-tab:hover { background: var(--bg-card-hover); color: var(--text); }
.suggest-tab.active { border-color: var(--gold); background: var(--gold); color: #1a1206; }

.suggest-list { display: flex; flex-direction: column; gap: 8px; }
.suggest-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 7px 9px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--cost-color, var(--border));
  border-radius: 9px;
  background: var(--bg-card);
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s, transform 0.12s;
}
.suggest-item:hover { background: var(--bg-card-hover); transform: translateX(2px); }
.suggest-portrait {
  width: 40px; height: 40px;
  border-radius: 7px;
  object-fit: cover;
  flex: 0 0 auto;
  border: 1px solid var(--border);
  background: #0d141d;
}
.suggest-portrait.fallback {
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: var(--text-dim); font-size: 0.85rem;
}
.suggest-info { min-width: 0; flex: 1; }
.suggest-name {
  font-weight: 600;
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.suggest-cost { color: var(--cost-color, var(--text-dim)); font-size: 0.78rem; }
/* Icon vai trò ở panel "Top các tướng phù hợp nhất" — khung nhỏ, viền theo màu vai trò */
.suggest-role {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px; height: 22px;
  margin-left: 8px;
  font-size: 12px;
  line-height: 1;
  border: 1px solid var(--border);
  border-radius: 6px;
  flex: 0 0 auto;
}
.suggest-role.role-tank { border-color: #3b82f6; }
.suggest-role.role-damage { border-color: #e5484d; }
.suggest-role.role-fighter { border-color: #8a6bd0; }
.suggest-role .role-svg { display: block; }
/* Hàng vai trò trên mỗi tướng — icon trong khung nút, viền theo màu vai trò */
.chip-role-btn {
  height: 16px;
  box-sizing: border-box;
  margin-top: 0;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  line-height: 1;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  user-select: none;
}
.chip-role-btn.role-tank { border-color: #3b82f6; }
.chip-role-btn.role-damage { border-color: #e5484d; }
.chip-role-btn.role-fighter { border-color: #8a6bd0; }
.chip-role-btn .role-svg { display: block; }
/* Ô trống / nút "+" dùng chung cấu trúc chip để căn thẳng hàng. */
.slot-chip { width: 46px; }
.chip-role-btn.placeholder {
  background: none;
  border-color: var(--border);
  box-shadow: none;
  opacity: 0.45;
}
.chip-stars.placeholder {
  color: transparent;
  border-color: var(--border);
  background: none;
  cursor: default;
  opacity: 0.45;
}
.chip-stars.placeholder:hover { filter: none; }
.suggest-why { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 3px; }
.why-chip {
  font-size: 0.7rem;
  padding: 1px 7px;
  border-radius: 999px;
  background: #0d141d;
  border: 1px solid var(--tier-color, var(--border));
  color: var(--tier-color, var(--text-dim));
  white-space: nowrap;
  font-weight: 600;
}

/* Suggestion score (same formula as the board). */
.suggest-score {
  flex: 0 0 auto;
  min-width: 30px;
  padding: 2px 8px;
  border-radius: 8px;
  background: rgba(61, 220, 132, 0.16);
  border: 1px solid rgba(61, 220, 132, 0.5);
  color: #6ef0a6;
  font-size: 1rem;
  font-weight: 700;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.generated-comps {
  display: flex;
  flex-direction: column;
  gap: 28px;
}
.generated-comps > .board-panel {
  position: relative;
  cursor: default;
}
.generated-comps > .board-panel.read-only {
  opacity: 1;
}
.generated-comps > .board-panel.read-only .board-chip,
.generated-comps > .board-panel.read-only .chip-stars,
.generated-comps > .board-panel.read-only .emblem-chip {
  cursor: default;
}
.generated-comps > .board-panel.read-only .chip-stars:hover {
  filter: none;
  border-color: var(--border);
  background: rgba(255, 255, 255, 0.04);
}
.generated-remove-note {
  margin: 6px 0 10px;
  color: #ffb4b1;
  font-size: 0.82rem;
  font-weight: 600;
}

.empty-hint { color: var(--text-dim); font-size: 0.88rem; margin: 6px 0; }

.site-footer {
  border-top: 1px solid var(--border);
  background: rgba(15, 21, 31, 0.68);
}
.site-footer-inner {
  max-width: 1440px;
  margin: 0 auto;
  padding: 20px;
  display: grid;
  /* Cột ngôn ngữ (rộng theo nội dung) tách riêng, cột blog chiếm phần còn lại. */
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 12px 32px;
  color: var(--text-dim);
  font-size: 0.86rem;
}
.footer-blog {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px 18px;
}
.footer-blog h2 {
  grid-column: 1 / -1;
  margin: 0 0 2px;
  color: var(--gold);
  font-size: 0.92rem;
}
.footer-blog a {
  color: var(--text-dim);
  text-decoration: none;
  line-height: 1.4;
}
.footer-blog a:hover {
  color: var(--gold-bright);
}

.content-page {
  max-width: 1120px;
  margin: 34px auto 64px;
  /* Content solid color (xem .layout). */
  padding: 8px 28px 40px;
  background:
    radial-gradient(900px 380px at 50% 0%, rgba(25, 32, 45, 0.33) 0%, transparent 42%),
    #05080d;
  border: 1px solid #131821;
  border-radius: 18px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.5);
}
.content-hero {
  padding: 18px 0 26px;
  border-bottom: 1px solid var(--border);
}
.content-hero .eyebrow {
  margin: 0 0 8px;
  color: var(--gold);
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.champion-detail-main .eyebrow {
  margin: 0 0 8px;
  color: var(--gold);
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.content-hero h1 {
  margin: 0;
  color: var(--gold-bright);
  font-size: 2rem;
  line-height: 1.15;
}
.content-hero p {
  max-width: 720px;
  margin: 12px 0 0;
  color: var(--text-dim);
  font-size: 1rem;
  line-height: 1.6;
}
/* Hero bài blog: banner key art (qua --hero-art) + lớp phủ tối cho chữ nổi. */
.blog-article .content-hero {
  position: relative;
  margin-top: 4px;
  padding: 26px 24px 24px;
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  background:
    linear-gradient(120deg, rgba(10, 14, 20, 0.9) 0%, rgba(10, 14, 20, 0.66) 55%, rgba(10, 14, 20, 0.42) 100%),
    var(--hero-art, url("assets/arts/art-banner.jpg")) center 28% / cover no-repeat,
    linear-gradient(158deg, #1b2637, #0d131c);
}
.blog-article .content-hero h1 {
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.55);
}
.blog-article .content-hero p {
  color: var(--text);
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.55);
}
.content-section {
  padding: 26px 0 0;
}
.content-section h2 {
  margin: 0 0 14px;
  color: var(--gold);
  font-size: 1.15rem;
}
.champion-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 14px;
}
.champion-section-head h2 {
  margin: 0;
}
.champion-source-link {
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 650;
  text-decoration: none;
}
.champion-source-link:hover {
  color: var(--gold-bright);
}
.champion-item-build {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.champion-item-card {
  position: relative;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-panel);
  color: var(--text);
  text-decoration: none;
}
.champion-item-card:hover {
  border-color: rgba(212, 168, 83, 0.48);
  background: var(--bg-card-hover);
}
.champion-item-icon {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  object-fit: cover;
}
.champion-item-name {
  min-width: 0;
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.25;
}
.champion-item-rank {
  position: absolute;
  top: 5px;
  left: 5px;
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border: 1px solid rgba(5, 8, 13, 0.72);
  border-radius: 999px;
  background: var(--gold);
  color: #090d13;
  font-size: 0.72rem;
  font-weight: 900;
}
.content-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.content-card {
  min-width: 0;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-panel);
}
.content-card h3 {
  margin: 0 0 8px;
  color: var(--text);
  font-size: 0.98rem;
}
.content-card p {
  margin: 0;
  color: var(--text-dim);
  font-size: 0.9rem;
  line-height: 1.55;
}
.content-card code {
  color: var(--gold-bright);
  font-family: ui-monospace, "Consolas", monospace;
  font-size: 0.9em;
}
.guide-article {
  max-width: 860px;
}
.guide-topic {
  padding: 20px 0;
  border-bottom: 1px solid var(--border);
}
.guide-topic:last-child {
  border-bottom: none;
}
.guide-topic h3 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 10px;
  color: var(--gold-bright);
  font-size: 1.08rem;
  line-height: 1.35;
}
.guide-topic p {
  margin: 10px 0 0;
  color: var(--text-dim);
  font-size: 0.98rem;
  line-height: 1.75;
}
.guide-figure {
  margin: 16px 0 4px;
}
.guide-figure img {
  display: block;
  width: 100%;
  max-height: 560px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-panel);
  object-fit: contain;
}
.guide-figure.compact img {
  max-width: 620px;
}
.guide-figure.split {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.guide-figure.split figcaption {
  grid-column: 1 / -1;
}
.guide-figure figcaption {
  margin-top: 8px;
  color: var(--text-muted);
  font-size: 0.86rem;
  line-height: 1.45;
}
.guide-topic strong,
.guide-flow strong {
  color: var(--gold-bright);
  font-weight: 800;
}
.guide-icon {
  flex: 0 0 auto;
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid rgba(212, 168, 83, 0.46);
  border-radius: 8px;
  background: rgba(212, 168, 83, 0.12);
  color: var(--gold-bright);
  font-size: 0.94rem;
  font-weight: 900;
  line-height: 1;
}
.guide-flow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-panel);
}
.guide-flow p {
  max-width: 780px;
  margin: 0;
  color: var(--text-dim);
  font-size: 0.95rem;
  line-height: 1.6;
}
.guide-cta {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid rgba(212, 168, 83, 0.56);
  border-radius: 8px;
  background: rgba(212, 168, 83, 0.12);
  color: var(--gold-bright);
  font-size: 0.9rem;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}
.guide-cta:hover {
  border-color: rgba(242, 205, 126, 0.76);
  background: rgba(212, 168, 83, 0.18);
}
.blog-section-title {
  margin: 6px 0 14px;
  font-size: 1.12rem;
  color: var(--gold-bright);
}
.blog-section-title + .blog-list {
  margin-bottom: 30px;
}
.blog-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}
.blog-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--bg-card);
  color: inherit;
  text-decoration: none;
  transition: border-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}
.blog-card:hover {
  border-color: rgba(212, 168, 83, 0.5);
  transform: translateY(-3px);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.38);
}

/* ---- Cover (ảnh demo mỗi bài) ---- */
.blog-cover {
  position: relative;
  height: 152px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
  background:
    radial-gradient(130% 120% at 50% 0%, rgba(60, 169, 252, 0.14), transparent 62%),
    linear-gradient(158deg, #1b2637, #0d131c);
  border-bottom: 1px solid var(--border);
  overflow: hidden;
}
/* Ảnh key art làm nền thumbnail (đặt qua biến --art). Lớp phủ tối gradient nằm
   trên ảnh để dàn tướng / emoji phía trước luôn nổi và dễ đọc. */
.blog-cover.has-art {
  background:
    linear-gradient(158deg, rgba(12, 17, 25, 0.62), rgba(12, 17, 25, 0.86)),
    var(--art) center / cover no-repeat,
    linear-gradient(158deg, #1b2637, #0d131c);
}
.blog-card:hover .blog-cover.has-art {
  background:
    linear-gradient(158deg, rgba(12, 17, 25, 0.5), rgba(12, 17, 25, 0.8)),
    var(--art) center / cover no-repeat,
    linear-gradient(158deg, #1b2637, #0d131c);
}
.blog-cover.has-art .blog-cover-units,
.blog-cover.has-art .blog-cover-emoji {
  position: relative;
  z-index: 1;
}
.blog-cover-tag {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 2;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(8, 12, 18, 0.74);
  border: 1px solid var(--border);
  color: var(--gold-bright);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}
/* Dàn tướng làm ảnh demo cho bài đội hình. */
.blog-cover-units {
  display: flex;
  gap: 7px;
}
.blog-cover .bcu {
  width: 50px;
  height: 50px;
  border-radius: 11px;
  border: 2px solid var(--cost-color, var(--border));
  background: #0d141d;
  overflow: hidden;
  box-shadow: 0 5px 12px rgba(0, 0, 0, 0.45);
  transition: transform 0.18s ease;
}
.blog-card:hover .bcu {
  transform: translateY(-2px);
}
.blog-cover .bcu img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
/* Cover bài kỹ năng: nền key art (qua .has-art) + emoji lớn. */
.blog-cover-emoji {
  font-size: 3.1rem;
  line-height: 1;
  filter: drop-shadow(0 5px 10px rgba(0, 0, 0, 0.45));
}

/* ---- Thân card ---- */
.blog-card-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 14px 16px 16px;
}
.blog-card-tags {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  font-size: 0.75rem;
  color: var(--text-muted);
}
.blog-tag {
  padding: 2px 9px;
  border-radius: 6px;
  border: 1px solid var(--border);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: var(--gold-bright);
  background: rgba(200, 170, 110, 0.12);
  border-color: rgba(200, 170, 110, 0.34);
}
.blog-tag.t-reroll { color: var(--cost-2); background: rgba(46, 204, 113, 0.12); border-color: rgba(46, 204, 113, 0.34); }
.blog-tag.t-late,
.blog-tag.t-mix { color: var(--cost-4); background: rgba(192, 97, 247, 0.12); border-color: rgba(192, 97, 247, 0.34); }
.blog-tag.t-bruiser { color: var(--cost-5); background: rgba(245, 185, 66, 0.12); border-color: rgba(245, 185, 66, 0.34); }
.blog-tag.t-basic,
.blog-tag.t-tempo { color: var(--cost-3); background: rgba(61, 169, 252, 0.12); border-color: rgba(61, 169, 252, 0.34); }
.blog-readtime::before {
  content: "⏱ ";
}
.blog-card h3 {
  margin: 0 0 6px;
  color: var(--gold-bright);
  font-size: 1.06rem;
  line-height: 1.35;
}
.blog-card:hover h3 {
  color: #fff;
}
.blog-card p {
  margin: 0;
  color: var(--text-dim);
  font-size: 0.92rem;
  line-height: 1.6;
}
.blog-more {
  margin-top: 14px;
  align-self: flex-start;
  color: var(--gold-bright);
  font-weight: 700;
  font-size: 0.86rem;
  transition: transform 0.18s ease, color 0.18s ease;
}
.blog-card:hover .blog-more {
  color: var(--gold);
  transform: translateX(3px);
}
.blog-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 12px;
  color: var(--text-muted);
  font-size: 0.84rem;
}
.blog-article {
  max-width: 860px;
}
.blog-article .content-section {
  line-height: 1.72;
}
.blog-article h2 {
  margin-top: 8px;
}
.blog-article h3 {
  margin: 22px 0 8px;
  color: var(--text);
  font-size: 1rem;
}
.blog-article p,
.blog-article li {
  color: var(--text-dim);
  font-size: 0.97rem;
}
.blog-article ul,
.blog-article ol {
  margin: 10px 0 0;
  padding-left: 22px;
}
.blog-note {
  margin: 18px 0;
  padding: 12px 14px;
  border-left: 3px solid var(--gold);
  background: rgba(212, 168, 83, 0.08);
  color: var(--text-dim);
}
/* Đội hình demo nhúng trong bài viết (board.js readOnly). */
.tft-demo {
  margin: 16px 0 22px;
}
.tft-demo .board-panel.blog-board {
  cursor: default;
}
.blog-article .tft-demo p,
.blog-article .tft-demo li {
  font-size: inherit;
}
.tft-caption {
  margin: -8px 0 18px;
  color: var(--text-muted);
  font-size: 0.86rem;
}

/* Đội hình đề xuất trong trang chi tiết tướng (board.js readOnly, 10 đội). */
.champion-comps-hint {
  margin: 0 0 16px;
  max-width: 720px;
  color: var(--text-dim);
  font-size: 0.92rem;
  line-height: 1.6;
}
.champion-comps {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
}
.champion-comp-item {
  position: relative;
}
.champion-comp-rank {
  position: absolute;
  top: -9px;
  left: -9px;
  z-index: 3;
  min-width: 27px;
  height: 27px;
  padding: 0 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--gold);
  color: #10141b;
  font-size: 0.78rem;
  font-weight: 800;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.45);
}
.champion-comp-board {
  height: 100%;
  cursor: default;
}
.blog-table {
  width: 100%;
  margin: 12px 0 4px;
  border-collapse: collapse;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
}
.blog-table th,
.blog-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text-dim);
  text-align: left;
  vertical-align: top;
}
.blog-table th {
  color: var(--gold);
  background: var(--bg-panel);
}
.blog-table tr:last-child td {
  border-bottom: 0;
}
.champion-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  gap: 6px;
}
.champion-selector h2 {
  margin: 0 0 10px;
  color: var(--gold);
  font-size: 1rem;
}
.champion-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 0;
  padding: 5px 3px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s, transform 0.12s;
}
.champion-card:hover {
  background: transparent;
  transform: translateY(-1px);
}
.champion-card.active .champion-card-name {
  color: var(--gold-bright);
}
.champion-card.active img {
  box-shadow: 0 0 0 2px var(--gold), 0 0 12px rgba(200, 170, 110, 0.45);
}
.champion-card img {
  width: 42px;
  height: 42px;
  border-radius: 7px;
  border: 2px solid var(--cost-color, var(--border));
  object-fit: cover;
}
.champion-card-name {
  width: 100%;
  font-size: 0.72rem;
  font-weight: 800;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.champion-card-meta {
  color: var(--cost-color, var(--text-dim));
  font-size: 0.74rem;
  font-weight: 700;
}
.champion-page-layout {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 26px;
}
.champion-selector-panel {
  position: sticky;
  top: 86px;
  align-self: start;
  max-height: calc(100vh - 108px);
  overflow-y: auto;
  padding-right: 24px;
  border-right: 1px solid var(--border);
  scrollbar-width: thin;
  scrollbar-color: rgba(200, 170, 110, 0.45) rgba(255, 255, 255, 0.04);
}
.champion-selector-panel::-webkit-scrollbar {
  width: 8px;
}
.champion-selector-panel::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.035);
  border-radius: 999px;
}
.champion-selector-panel::-webkit-scrollbar-thumb {
  background: rgba(200, 170, 110, 0.38);
  border-radius: 999px;
}
.champion-selector-panel::-webkit-scrollbar-thumb:hover {
  background: rgba(200, 170, 110, 0.62);
}
.champion-selector-panel .champion-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.champion-detail-content {
  min-width: 0;
}
.champion-detail-hero {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr);
  gap: 22px;
  align-items: center;
  padding: 24px 0 28px;
  border-bottom: 1px solid var(--border);
}
.champion-detail-portrait img {
  width: 140px;
  height: 140px;
  border-radius: 12px;
  border: 3px solid var(--cost-color, var(--border));
  object-fit: cover;
  background: #0d141d;
}
.champion-detail-main h1 {
  margin: 0;
  color: var(--gold-bright);
  font-size: 2.25rem;
  line-height: 1.1;
}
.champion-detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}
.champion-detail-meta span {
  padding: 4px 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-card);
  color: var(--text-dim);
  font-size: 0.84rem;
  font-weight: 700;
}
.champion-trait-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}
.champion-trait-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(200, 170, 110, 0.10);
  color: var(--gold-bright);
  font-size: 0.9rem;
  font-weight: 800;
  text-decoration: none;
}
a.champion-trait-chip:hover { border-color: var(--gold-bright); }
a.champion-trait-card { text-decoration: none; color: inherit; }
a.champion-trait-card:hover { border-color: var(--gold-bright); }
.champion-trait-chip small,
.champion-trait-card small {
  color: var(--text-dim);
  font-size: 0.78em;
  font-weight: 600;
}
.champion-info-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.champion-cost {
  color: var(--cost-color, var(--gold-bright));
}
.content-back-link {
  display: inline-flex;
  align-items: center;
  color: var(--gold-bright);
  text-decoration: none;
  font-weight: 800;
}
.content-back-link:hover { text-decoration: underline; }

/* Champion detail — description, ability, stats */
.champion-desc { color: var(--text-dim); line-height: 1.6; }
.champion-ability-card { display: flex; flex-direction: column; gap: 12px; }
.champion-ability-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.champion-ability-head h3 { margin: 0; color: var(--gold-bright); }
.champion-mana {
  font-size: 0.82rem;
  font-weight: 700;
  color: #6cc4ff;
  padding: 3px 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(60, 140, 220, 0.12);
}
.champion-ability-desc { line-height: 1.65; color: var(--text); }
.champion-ability-desc .ab-phys  { color: #ff9a6c; font-weight: 700; }
.champion-ability-desc .ab-magic { color: #9ec5ff; font-weight: 700; }
.champion-ability-desc .ab-true  { color: #ffe8a3; font-weight: 700; }
.champion-ability-desc .ab-heal  { color: #7ee0a0; font-weight: 700; }
.champion-ability-desc .ab-bonus { color: var(--gold-bright); font-weight: 700; }
.champion-ability-desc .ab-var {
  color: var(--text-dim);
  font-style: italic;
  font-weight: 600;
}
.champion-scaling h4 { margin: 4px 0 8px; font-size: 0.9rem; color: var(--text-dim); }
.champion-stats-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.champion-stats-table th,
.champion-stats-table td {
  padding: 7px 10px;
  text-align: center;
  border-bottom: 1px solid var(--border);
  font-variant-numeric: tabular-nums;
}
.champion-stats-table thead th { color: var(--text-dim); font-size: 0.82rem; }
.champion-stats-table tbody th {
  text-align: left;
  color: var(--text);
  font-weight: 700;
}
.champion-stats-table tbody tr:last-child th,
.champion-stats-table tbody tr:last-child td { border-bottom: none; }

/* Reference index grids + detail heroes (traits / items / augments) */
.entry-search {
  margin-top: 14px;
  width: 100%;
  max-width: 340px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-card);
  color: var(--text);
  font-size: 0.92rem;
}
.entry-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  gap: 12px;
}
.entry-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-card);
  color: var(--text);
  text-decoration: none;
  text-align: center;
  transition: border-color 0.15s, transform 0.15s;
}
.entry-card:hover { border-color: var(--gold-bright); transform: translateY(-2px); }
.entry-icon { width: 52px; height: 52px; border-radius: 8px; object-fit: cover; }
.entry-name { font-size: 0.84rem; font-weight: 700; line-height: 1.2; }
.entry-sub { font-size: 0.76rem; color: var(--text-dim); }
.item-stat-panel {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px;
}
.item-stat-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 8px 10px;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.035);
}
.item-stat-icon-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}
.item-stat-icon {
  width: 28px;
  height: 28px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 6px;
  object-fit: cover;
}
.item-stat-glyph {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 6px;
  color: var(--gold-bright);
  background: rgba(200, 170, 110, 0.1);
  font-size: 0.78rem;
}
.item-stat-value {
  color: var(--gold-bright);
  font-size: 0.96rem;
  font-weight: 900;
}
.item-stat-main {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.item-stat-name {
  min-width: 0;
  color: var(--text-dim);
  font-size: 0.78rem;
  font-weight: 650;
  line-height: 1.2;
}

.detail-hero {
  display: flex;
  align-items: center;
  gap: 18px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
}
.detail-hero-icon img { width: 84px; height: 84px; border-radius: 12px; object-fit: cover; }
.detail-hero-main h1 { margin: 6px 0; }
.detail-hero-main h1 small { color: var(--text-dim); font-size: 0.5em; font-weight: 600; }
.trait-effect-card .trait-row-desc {
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  line-height: 1.55;
}
.trait-effect-card .trait-row-desc:last-child { border-bottom: none; }

/* Augment tiers */
.tier-label { font-weight: 800; }
.tier-silver { --tier-c: #c7d0da; }
.tier-gold { --tier-c: var(--gold-bright); }
.tier-prismatic { --tier-c: #e79bff; }
.tier-none { --tier-c: var(--border); }
.augment-card { border-top: 3px solid var(--tier-c, var(--border)); }
.augment-card .tier-label { color: var(--tier-c, var(--text-dim)); }
.detail-hero-icon.tier-silver img,
.detail-hero-icon.tier-gold img,
.detail-hero-icon.tier-prismatic img { box-shadow: 0 0 0 2px var(--tier-c); }
.champion-detail-meta .tier-label { color: var(--tier-c, var(--text)); }

/* Traits */
.traits-list { display: flex; flex-direction: column; gap: 7px; }
.trait-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: 8px;
  background: var(--bg-card);
  border-left: 4px solid var(--tier-color, var(--border));
}
.trait-row.inactive { opacity: 0.5; border-left-color: var(--border); }
.trait-tier-dot {
  width: 12px; height: 12px;
  border-radius: 3px;
  flex: 0 0 auto;
  background: var(--tier-color, var(--text-dim));
  box-shadow: 0 0 8px var(--tier-color, transparent);
}
.trait-name { flex: 1; font-weight: 600; font-size: 0.92rem; }
.trait-count {
  font-variant-numeric: tabular-nums;
  font-size: 0.85rem;
  color: var(--text-dim);
}
.trait-count strong { color: var(--text); }

/* Tier color helpers */
.tier-bronze    { --tier-color: var(--tier-bronze); }
.tier-silver    { --tier-color: var(--tier-silver); }
.tier-gold      { --tier-color: var(--tier-gold); }
.tier-prismatic { --tier-color: var(--tier-prismatic); }

/* Cost helpers */
.c1 { --cost-color: var(--cost-1); }
.c2 { --cost-color: var(--cost-2); }
.c3 { --cost-color: var(--cost-3); }
.c4 { --cost-color: var(--cost-4); }
.c5 { --cost-color: var(--cost-5); }

/* Flash when board is full */
@keyframes flash-full { 0%,100%{ box-shadow:none; } 50%{ box-shadow:0 0 0 2px var(--cost-5); } }
.board-panel.flash { animation: flash-full 0.4s ease; }

/* Responsive */
@media (max-width: 880px) {
  /* Trên điện thoại gộp cột trái (.picker) và phải (.sidebar) thành MỘT dòng
     flex duy nhất bằng display:contents, để có thể xen kẽ thứ tự các panel giữa
     hai cột. Nhờ vậy "Top các tướng phù hợp nhất" (trong sidebar) hiện ngay sau
     phần bảng đội hình + "Bỏ ra/Thêm vào", còn "Gợi ý đội hình"
     (#generatedCompsPanel, vốn nằm trong .picker) bị đẩy xuống cuối. */
  .layout {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
  }
  .picker,
  .sidebar { display: contents; }
  #generatedCompsPanel { order: 1; margin-top: 0; }
  .unit-grid { grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); }

  /* Quick-jump bar: sticky right under the navbar (60px tall). Text links,
     not buttons — the active section gets an underline. */
  .mobile-jump {
    display: flex;
    justify-content: center;
    gap: 22px;
    position: sticky;
    top: 60px;
    z-index: 40;
    padding: 10px 14px;
    background: rgba(15, 21, 31, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
  }
  .mobile-jump-btn {
    padding: 2px 2px 4px;
    border: 0;
    background: none;
    color: var(--text-dim);
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1.2;
    text-decoration: none;
    border-bottom: 2px solid transparent;
    transition: color 0.15s, border-color 0.15s;
  }
  .mobile-jump-btn:hover { color: var(--text); }
  .mobile-jump-btn.active {
    color: var(--gold-bright);
    border-bottom-color: var(--gold);
  }
  /* Land the jumped-to section below both sticky bars (navbar 60 + jump bar). */
  #compSection,
  #suggestPanel,
  #generatedCompsPanel { scroll-margin-top: 116px; }

  .brand-tagline { display: none; }

  /* Menu điều hướng thu gọn thành hamburger. */
  .navbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
  }
  .nav-toggle { display: inline-flex; order: 3; }
  /* Keep brand on the left; group the gear + hamburger on the right. */
  .brand { order: 1; }
  .nav-settings-btn { order: 2; margin-left: auto; }
  .site-nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    /* left+right alone shrink-wraps inside the flex navbar; width:100% fills it. */
    width: 100%;
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 6px 16px 12px;
    background: rgba(15, 21, 31, 0.98);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 18px 34px rgba(0, 0, 0, 0.45);
  }
  .site-nav.open { display: flex; }
  .site-nav-link {
    min-height: 46px;
    padding: 0 6px;
    font-size: 0.98rem;
    border-bottom: 2px solid transparent;
    border-top: 1px solid var(--border);
  }
  .site-nav-link:first-child { border-top: none; }

  /* Popup vừa với màn hình điện thoại. */
  .modal-overlay { padding: 10px; }
  .modal,
  .picker-modal { max-width: 100%; max-height: 90vh; }
  .modal-head { padding: 12px 14px; }
  .modal-head h2 { font-size: 1rem; }
  .picker-modal-body { padding: 12px 12px 16px; }
  .trait-filters { max-height: 100px; }
  .emblem-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }

  .content-grid { grid-template-columns: 1fr; }
  .guide-topic h3 { align-items: flex-start; font-size: 1rem; }
  .guide-topic p { font-size: 0.94rem; }
  .guide-figure.split { grid-template-columns: 1fr; }
  .guide-figure img { max-height: none; }
  .guide-flow { align-items: stretch; flex-direction: column; }
  .guide-cta { width: 100%; }
  .champion-section-head { align-items: flex-start; flex-direction: column; gap: 6px; }
  .champion-item-build { grid-template-columns: 1fr; }
  .champion-page-layout { grid-template-columns: 1fr; }
  .champion-selector-panel {
    position: static;
    max-height: none;
    overflow: visible;
    padding-right: 0;
    padding-bottom: 18px;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .champion-selector-panel .champion-grid { grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); }
  /* Trên mobile, ẩn bảng chọn nhanh bên trái ở MỌI trang chi tiết (tướng, hệ,
     trang bị, lõi) — lưới chọn chiếm quá nhiều chỗ trước nội dung. Bảng chọn
     tổng ở trang danh sách (.champion-selector, [data-index]) không bị ảnh hưởng.
     Người dùng chuyển mục qua menu điều hướng hoặc link "quay lại danh sách". */
  .champion-selector-panel { display: none; }
  .champion-detail-hero { grid-template-columns: 1fr; }
  .champion-info-grid { grid-template-columns: 1fr; }
  .site-footer-inner { grid-template-columns: 1fr; }
  .footer-blog { grid-template-columns: 1fr; }

  /* Trên điện thoại: đưa tiêu đề bảng ra một dòng riêng ở trên, rồi mới tới
     các chỉ số (Điểm đội / tỉ lệ tank-damage) ở dòng dưới, để tiêu đề không bị
     co lại vì phần bên phải quá dài. */
  .board-head { flex-wrap: wrap; row-gap: 8px; justify-content: flex-start; }
  .board-head h2 { flex-basis: 100%; order: 0; }
  .team-score { order: 1; margin-left: 0; }
  .role-balance { order: 2; }
  .board-clear { order: 3; margin-left: auto; }
}

/* Điện thoại hẹp: popup gần như toàn màn hình, lưới tướng/ấn nhỏ lại. */
@media (max-width: 520px) {
  .modal-overlay { padding: 6px; }
  .modal,
  .picker-modal { max-height: 94vh; border-radius: 12px; }
  .modal-head { padding: 10px 12px; }
  .picker-modal-body { padding: 10px 10px 14px; }
  .picker-toolbar { gap: 8px; }
  .cost-filter { width: 34px; height: 34px; }
  .unit-grid { grid-template-columns: repeat(auto-fill, minmax(68px, 1fr)); }
  .emblem-grid { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); }
  .comps-list,
  .save-slot-grid,
  .emblem-grid { padding-left: 12px; padding-right: 12px; }
  /* Hàng đội mạnh / đội đã lưu: cho phép xuống dòng để không tràn ngang. */
  .comp-row { flex-wrap: wrap; gap: 8px 10px; }
  .comp-info { flex-basis: 100%; order: 3; }
  .comp-pick { padding: 7px 14px; }
}

/* ===================== Landing / Trang chủ ===================== */
.landing {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 20px;
}

.landing-hero {
  position: relative;
  text-align: center;
  padding: 96px 16px 72px;
  overflow: hidden;
}
.landing-hero-inner {
  position: relative;
  z-index: 1;
  max-width: 780px;
  margin: 0 auto;
}
.landing-hero-glow {
  position: absolute;
  top: -160px;
  left: 50%;
  transform: translateX(-50%);
  width: 720px;
  height: 460px;
  background: radial-gradient(closest-side, rgba(200, 170, 110, 0.22), transparent 70%);
  pointer-events: none;
  z-index: 0;
}
.landing-eyebrow {
  display: inline-block;
  margin: 0 0 18px;
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-card);
  color: var(--gold);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
}
.landing-title {
  margin: 0 0 20px;
  font-size: clamp(2.2rem, 5vw, 3.5rem);
  line-height: 1.08;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--gold-bright);
}
.landing-subtitle {
  margin: 0 auto 34px;
  max-width: 620px;
  font-size: clamp(1rem, 2vw, 1.2rem);
  line-height: 1.6;
  color: var(--text-dim);
}
.landing-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  justify-content: center;
}
.landing-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 50px;
  padding: 0 30px;
  border-radius: 12px;
  font-size: 1.02rem;
  font-weight: 700;
  text-decoration: none;
  transition: transform 0.12s, box-shadow 0.15s, background 0.15s, border-color 0.15s;
}
.landing-btn:hover { transform: translateY(-2px); }
.landing-btn-primary {
  background: linear-gradient(135deg, var(--gold), #8a6d3b);
  color: #1a1206;
  box-shadow: 0 10px 26px rgba(200, 170, 110, 0.3);
}
.landing-btn-primary:hover { box-shadow: 0 14px 32px rgba(200, 170, 110, 0.42); }
.landing-btn-ghost {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
}
.landing-btn-ghost:hover { border-color: var(--gold); color: var(--gold-bright); }

.landing-features {
  padding: 40px 0 24px;
}
.landing-features-inner {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
}
.landing-card {
  padding: 26px 22px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  transition: transform 0.14s, border-color 0.14s, background 0.14s;
}
.landing-card:hover {
  transform: translateY(-3px);
  border-color: var(--gold);
  background: var(--bg-card-hover);
}
.landing-card-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin-bottom: 14px;
  border-radius: 11px;
  background: linear-gradient(135deg, var(--gold), #8a6d3b);
  color: #1a1206;
  font-size: 1.3rem;
}
.landing-card h2 {
  margin: 0 0 8px;
  font-size: 1.06rem;
  font-weight: 700;
  color: var(--gold-bright);
}
.landing-card p {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.55;
  color: var(--text-dim);
}

.landing-final {
  text-align: center;
  margin: 40px 0 80px;
  padding: 56px 24px;
  background: radial-gradient(700px 300px at 50% 0%, rgba(200, 170, 110, 0.1), transparent 70%), var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 18px;
}
.landing-final h2 {
  margin: 0 0 10px;
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 800;
  color: var(--gold-bright);
}
.landing-final p {
  margin: 0 0 26px;
  color: var(--text-dim);
}

@media (max-width: 880px) {
  .landing-features-inner { grid-template-columns: 1fr 1fr; }
  .landing-hero { padding: 64px 12px 48px; }
}
@media (max-width: 520px) {
  .landing-features-inner { grid-template-columns: 1fr; }
  .landing-btn { width: 100%; }
}
