/* ============================================================================
   TI 2026 — Bento sáng + pastel mềm
   ----------------------------------------------------------------------------
   Không build step: CSS viết tay + custom properties. Không Tailwind, không npm.
   Dockerfile chỉ cần .NET SDK.

   Nguyên tắc màu: nền và bề mặt là trung tính sáng (60%), pastel làm nền cho thẻ
   chỉ số và nhãn (30%), indigo làm điểm nhấn cho hành động và trạng thái (10%).
   Vùng số liệu cố tình TRẦM: bảng 12 cột mà tô pastel khắp nơi thì không đọc được.
   Dễ thương nằm ở vỏ — thẻ, bo góc, icon, chuyển động — không nằm trong bảng số.
   ========================================================================= */

:root {
  color-scheme: light;

  /* --- Nền & bề mặt (60%) --- */
  --bg: #f7f8fc;
  --surface: #ffffff;
  --surface-2: #f2f4fa;
  --border: #e6e9f4;
  --border-strong: #d5dae9;

  /* --- Chữ --- */
  --ink: #262a43;
  --ink-2: #4d5478;
  --muted: #6f77a0;

  /* --- Điểm nhấn (10%) --- */
  --accent: #5b4ee0;
  --accent-hover: #4a3dd0;
  --accent-soft: #ece9ff;
  --accent-ink: #3a2fb0;
  --on-accent: #ffffff;

  /* --- Pastel cho thẻ chỉ số (30%) --- */
  --pastel-1: #ffe4d9;  --pastel-1-ink: #9a4a24;
  --pastel-2: #d9f2e6;  --pastel-2-ink: #17694c;
  --pastel-3: #dbe8ff;  --pastel-3-ink: #2a4f96;
  --pastel-4: #ece3ff;  --pastel-4-ink: #5c3fa8;
  --pastel-5: #fff1cf;  --pastel-5-ink: #8a5f14;

  /* --- Ngữ nghĩa: giữ xanh/đỏ để đọc nhanh thắng/thua --- */
  --pos: #0f8f68;
  --pos-soft: #dcf5ec;
  --neg: #cf3a40;
  --neg-soft: #fde5e6;
  --warn: #a06a12;
  --warn-soft: #fdf0d8;

  /* --- Heatmap của bảng: rất nhạt, không được cạnh tranh với chữ --- */
  --heat-lo: #f7f8fc;
  --heat-hi: #c3d3f5;

  /* --- Hình khối --- */
  --r-lg: 20px;
  --r-md: 14px;
  --r-sm: 10px;
  --r-pill: 999px;

  --shadow-sm: 0 1px 2px rgba(38, 42, 67, .05);
  --shadow-md: 0 1px 2px rgba(38, 42, 67, .04), 0 8px 20px rgba(38, 42, 67, .06);
  --shadow-lg: 0 2px 4px rgba(38, 42, 67, .05), 0 16px 40px rgba(38, 42, 67, .10);

  /* --- Nhịp 4/8, thang dashboard (dày hơn trang marketing) --- */
  --s-1: 4px;  --s-2: 8px;  --s-3: 12px; --s-4: 16px;
  --s-5: 24px; --s-6: 32px; --s-7: 48px;

  --font-head: "Poppins", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-body: "Open Sans", system-ui, -apple-system, "Segoe UI", sans-serif;

  --ease: cubic-bezier(.32, .72, 0, 1);
}

[data-theme="dark"] {
  color-scheme: dark;

  --bg: #14151f;
  --surface: #1c1e2c;
  --surface-2: #232638;
  --border: #2c3048;
  --border-strong: #3a3f5c;

  --ink: #eceef8;
  --ink-2: #b9c0dc;
  --muted: #949cc2;

  --accent: #a99bff;
  --accent-hover: #bcb0ff;
  --accent-soft: #2a2750;
  --accent-ink: #cfc6ff;
  --on-accent: #191a27;

  /* Dark mode dùng biến thể tối đi, KHÔNG đảo màu — đảo màu làm pastel thành
     những mảng chói không đọc được chữ. */
  --pastel-1: #46291f;  --pastel-1-ink: #ffc7ae;
  --pastel-2: #163a2d;  --pastel-2-ink: #96e6c6;
  --pastel-3: #1e2f4d;  --pastel-3-ink: #a8c8ff;
  --pastel-4: #2f2650;  --pastel-4-ink: #cbb8ff;
  --pastel-5: #40331a;  --pastel-5-ink: #f5d491;

  --pos: #46d3a3;
  --pos-soft: #14382c;
  --neg: #ff8a8f;
  --neg-soft: #402224;
  --warn: #e8b45c;
  --warn-soft: #3b2f16;

  --heat-lo: #1c1e2c;
  --heat-hi: #33447a;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow-md: 0 1px 2px rgba(0, 0, 0, .25), 0 8px 20px rgba(0, 0, 0, .35);
  --shadow-lg: 0 2px 4px rgba(0, 0, 0, .3), 0 16px 40px rgba(0, 0, 0, .45);
}

/* ============================ Cơ bản ============================ */

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* Mọi con số trong bảng/thẻ dùng chữ số đều bề rộng, nếu không cột sẽ nhảy khi
   giá trị đổi và mắt rất khó dò theo hàng. */
.num, table, .kpi-value, .stat-value { font-variant-numeric: tabular-nums; }

h1, h2, h3 { font-family: var(--font-head); font-weight: 600; margin: 0; letter-spacing: -.015em; }

a { color: var(--accent); }

:where(a, button, select, input, [tabindex]):focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

/* Bỏ hiệu ứng khi người dùng khai báo muốn giảm chuyển động. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}

.wrap { max-width: 1240px; margin: 0 auto; padding: var(--s-5) var(--s-4) var(--s-7); }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; left: var(--s-4); top: -60px; z-index: 100;
  background: var(--accent); color: var(--on-accent);
  padding: var(--s-2) var(--s-4); border-radius: var(--r-sm);
  text-decoration: none; font-weight: 600;
  transition: top .15s var(--ease);
}
.skip-link:focus { top: var(--s-4); }

/* ============================ Header ============================ */

.top {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: var(--s-4); flex-wrap: wrap; margin-bottom: var(--s-5);
}

.brand { display: flex; align-items: center; gap: var(--s-3); }

.brand-mark {
  width: 44px; height: 44px; border-radius: var(--r-md);
  background: linear-gradient(135deg, var(--accent), #8b7cff);
  display: grid; place-items: center; color: #fff; flex: none;
  box-shadow: var(--shadow-md);
}
.brand-mark svg { width: 24px; height: 24px; }

h1 { font-size: 22px; line-height: 1.25; }
.subtitle { color: var(--ink-2); font-size: 13.5px; margin: 2px 0 0; }

.top-actions { display: flex; gap: var(--s-2); align-items: center; }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-pill); padding: 6px 13px;
  font-size: 12.5px; color: var(--ink-2);
}
.chip .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--pos); flex: none; }
.chip .dot.stale { background: var(--warn); }
.chip b { color: var(--ink); font-weight: 600; }

.icon-btn {
  width: 44px; height: 44px; flex: none;
  display: grid; place-items: center;
  background: var(--surface); color: var(--ink-2);
  border: 1px solid var(--border); border-radius: var(--r-md);
  cursor: pointer; transition: background .15s var(--ease), color .15s var(--ease);
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn svg { width: 20px; height: 20px; }

/* ============================ Điều hướng ============================ */

nav {
  display: flex; gap: var(--s-1); flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: var(--s-1); margin-bottom: var(--s-5);
  box-shadow: var(--shadow-sm);
}

nav button {
  display: inline-flex; align-items: center; gap: 7px;
  background: none; border: none; border-radius: var(--r-sm);
  color: var(--ink-2); font-family: var(--font-body);
  font-size: 14px; font-weight: 500;
  padding: 10px 15px; min-height: 44px; cursor: pointer;
  transition: background .15s var(--ease), color .15s var(--ease);
}
nav button svg { width: 17px; height: 17px; flex: none; }
nav button:hover { background: var(--surface-2); color: var(--ink); }
nav button[aria-selected="true"] {
  background: var(--accent-soft); color: var(--accent-ink); font-weight: 600;
}

.view { display: none; }
.view.active { display: block; animation: fade .22s var(--ease); }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ============================ Bento ============================ */

.bento {
  display: grid; gap: var(--s-3);
  grid-template-columns: repeat(auto-fit, minmax(215px, 1fr));
  margin-bottom: var(--s-5);
}

.kpi {
  border-radius: var(--r-lg); padding: var(--s-4) var(--s-5);
  border: 1px solid transparent; box-shadow: var(--shadow-sm);
  transition: transform .18s var(--ease), box-shadow .18s var(--ease);
}
.kpi:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

.kpi-label {
  font-size: 11.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; opacity: .8;
}
.kpi-value {
  font-family: var(--font-head); font-size: 34px; font-weight: 600;
  line-height: 1.1; margin: var(--s-2) 0 var(--s-1); letter-spacing: -.02em;
}
.kpi-team { font-size: 13px; font-weight: 600; }
.kpi-note { font-size: 12px; opacity: .78; }

.kpi.p1 { background: var(--pastel-1); color: var(--pastel-1-ink); }
.kpi.p2 { background: var(--pastel-2); color: var(--pastel-2-ink); }
.kpi.p3 { background: var(--pastel-3); color: var(--pastel-3-ink); }
.kpi.p4 { background: var(--pastel-4); color: var(--pastel-4-ink); }
.kpi.p5 { background: var(--pastel-5); color: var(--pastel-5-ink); }

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: var(--s-5);
  box-shadow: var(--shadow-sm); margin-bottom: var(--s-4);
}
.card > header { margin-bottom: var(--s-4); }
.card h2 { font-size: 16px; }
.card .desc { color: var(--ink-2); font-size: 13px; margin: 3px 0 0; }

/* ============================ Bảng ============================ */

.table-scroll { overflow-x: auto; margin: 0 calc(var(--s-5) * -1) calc(var(--s-5) * -1); padding: 0 var(--s-5) var(--s-5); }

table { width: 100%; border-collapse: collapse; font-size: 13px; }

th, td { padding: 9px 10px; text-align: right; white-space: nowrap; }
th:first-child, td:first-child { text-align: left; position: sticky; left: 0; background: var(--surface); z-index: 1; }

thead th {
  color: var(--ink-2); font-weight: 600; font-size: 11.5px;
  text-transform: uppercase; letter-spacing: .04em;
  background: var(--surface-2); cursor: pointer; user-select: none;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 2;
}
thead th:first-child { z-index: 3; background: var(--surface-2); border-radius: var(--r-sm) 0 0 0; }
thead th:last-child { border-radius: 0 var(--r-sm) 0 0; }
thead th:hover { color: var(--ink); }
thead th .sort { opacity: .45; margin-left: 3px; }
thead th[aria-sort] .sort { opacity: 1; color: var(--accent); }

tbody tr { border-bottom: 1px solid var(--border); }
tbody tr:hover td { background: var(--surface-2); }
tbody tr:hover td:first-child { background: var(--surface-2); }

td.na { color: var(--muted); }

.team-cell { display: flex; align-items: center; gap: var(--s-2); font-weight: 600; }

.logo {
  width: 24px; height: 24px; border-radius: 7px; object-fit: contain;
  background: var(--surface-2); flex: none;
}
.logo-fallback {
  width: 24px; height: 24px; border-radius: 7px; flex: none;
  display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent-ink);
  font-size: 11px; font-weight: 700;
}

.tier-badge {
  display: inline-grid; place-items: center; min-width: 26px; height: 22px;
  padding: 0 7px; border-radius: 7px;
  font-size: 11.5px; font-weight: 700; color: #fff;
}

/* ============================ Thẻ đội ============================ */

.team-grid { display: grid; gap: var(--s-4); grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); }

.team-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: var(--s-5); box-shadow: var(--shadow-sm); }
.team-card header { display: flex; align-items: center; gap: var(--s-3); margin-bottom: var(--s-3); }
.team-card .logo, .team-card .logo-fallback { width: 38px; height: 38px; border-radius: 11px; font-size: 15px; }
.team-card h3 { font-size: 16.5px; }
.team-card .region { font-size: 12px; color: var(--muted); }

.tags { display: flex; flex-wrap: wrap; gap: 6px; margin: var(--s-3) 0; }
.tag {
  font-size: 11.5px; font-weight: 600; padding: 4px 10px; border-radius: var(--r-pill);
  background: var(--pos-soft); color: var(--pos);
}
.tag.warn { background: var(--neg-soft); color: var(--neg); }

.mini-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s-3); margin-top: var(--s-3); }
.mini-stats .label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.mini-stats .stat-value { font-family: var(--font-head); font-size: 17px; font-weight: 600; }

.squad { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s-3) var(--s-2); margin-top: var(--s-4); padding-top: var(--s-4); border-top: 1px solid var(--border); }
.player { text-align: center; min-width: 0; }
.avatar {
  position: relative; width: 52px; height: 52px; margin: 0 auto 6px;
  border-radius: 16px; background: var(--accent-soft); color: var(--accent-ink);
  display: grid; place-items: center; font-weight: 700; font-size: 19px;
  font-family: var(--font-head);
}
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: 16px; object-fit: cover; }
.avatar .role {
  position: absolute; right: -5px; bottom: -4px;
  min-width: 20px; height: 20px; padding: 0 5px; border-radius: var(--r-pill);
  background: var(--accent); color: var(--on-accent);
  font-size: 10px; font-weight: 700; line-height: 20px;
  border: 2px solid var(--surface);
}
.avatar.coach { background: var(--pastel-5); color: var(--pastel-5-ink); }
.avatar.coach .role { background: var(--warn); }
.player .nick { font-size: 12px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player .real { font-size: 10.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ============================ Điều khiển ============================ */

.controls { display: flex; gap: var(--s-2); flex-wrap: wrap; align-items: center; margin-bottom: var(--s-4); }

select, input[type="search"], input[type="text"] {
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--border-strong); border-radius: var(--r-sm);
  padding: 10px 13px; min-height: 44px;
  font-family: var(--font-body); font-size: 14px;
}

.pill {
  background: var(--surface); border: 1px solid var(--border);
  color: var(--ink-2); border-radius: var(--r-pill);
  padding: 9px 16px; min-height: 44px;
  font-family: var(--font-body); font-size: 13.5px; font-weight: 500; cursor: pointer;
  transition: background .15s var(--ease), color .15s var(--ease), border-color .15s var(--ease);
}
.pill:hover { background: var(--surface-2); color: var(--ink); }
.pill[aria-pressed="true"] {
  background: var(--accent); border-color: var(--accent);
  color: var(--on-accent); font-weight: 600;
}

/* ============================ H2H ============================ */

.h2h-head { display: grid; grid-template-columns: 1fr auto 1fr; gap: var(--s-3); align-items: center; margin-bottom: var(--s-5); }
.h2h-side { display: flex; align-items: center; gap: var(--s-3); }
.h2h-side.right { flex-direction: row-reverse; text-align: right; }
.h2h-side .logo, .h2h-side .logo-fallback { width: 44px; height: 44px; border-radius: 13px; font-size: 17px; }
.h2h-vs { font-family: var(--font-head); font-weight: 700; color: var(--muted); font-size: 13px; }

.h2h-row { display: grid; grid-template-columns: 1fr 150px 1fr; gap: var(--s-3); align-items: center; margin-bottom: var(--s-3); }
.h2h-bar-wrap { display: flex; align-items: center; gap: var(--s-2); }
.h2h-bar-wrap.left { flex-direction: row-reverse; }
.h2h-bar { height: 16px; border-radius: 5px; min-width: 3px; transition: width .3s var(--ease); }
.h2h-bar.a { background: var(--accent); }
.h2h-bar.b { background: var(--pastel-3-ink); }
.h2h-val { font-size: 12.5px; color: var(--ink-2); white-space: nowrap; }
.h2h-val.win { font-weight: 700; color: var(--ink); }
.h2h-metric { text-align: center; font-size: 12px; color: var(--ink-2); }
.h2h-metric small { display: block; color: var(--muted); font-size: 10.5px; }

@media (max-width: 640px) { .h2h-row { grid-template-columns: 1fr 105px 1fr; } }

/* ============================ Tier list ============================ */

.tier-row { display: grid; grid-template-columns: 108px 1fr; gap: var(--s-2); margin-bottom: var(--s-2); }
.tier-label {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  border-radius: var(--r-md); padding: var(--s-3) var(--s-2);
  font-family: var(--font-head); font-weight: 700; font-size: 18px;
  color: #1a1a1a; text-align: center; line-height: 1.15;
}
.tier-label small { font-size: 9px; font-weight: 600; opacity: .78; margin-top: 4px; }

.hero-strip {
  display: flex; flex-wrap: wrap; gap: 5px; align-content: flex-start;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 6px;
}

.hero {
  position: relative; width: 96px; height: 54px; border-radius: 7px;
  overflow: hidden; background: var(--surface-2); cursor: help;
  transition: transform .12s var(--ease);
}
.hero:hover { transform: scale(1.06); z-index: 3; }
.hero img { width: 100%; height: 100%; object-fit: cover; display: block; }
.hero .name {
  position: absolute; left: 0; right: 0; bottom: 0;
  font-size: 9px; font-weight: 700; color: #fff;
  background: linear-gradient(transparent, rgba(0, 0, 0, .88));
  padding: 10px 3px 3px; text-align: center;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.hero .fallback {
  position: absolute; inset: 0; display: none; align-items: center; justify-content: center;
  font-size: 9.5px; font-weight: 700; color: var(--ink-2); padding: 3px; text-align: center; line-height: 1.15;
}
.hero.noimg .name { display: none; }
.hero.noimg .fallback { display: flex; }
.hero.dim { opacity: .16; }

/* ============================ Xếp hạng phân kỳ ============================ */

.rank-row {
  display: grid; grid-template-columns: 26px minmax(150px, 1fr) minmax(160px, 2fr) 78px;
  gap: var(--s-3); align-items: center; padding: 5px 0;
}
.rank-row + .rank-row { border-top: 1px solid var(--border); }

.rank-no { color: var(--muted); font-size: 12.5px; text-align: right; }
.rank-team { display: flex; align-items: center; gap: var(--s-2); min-width: 0; }
.rank-name { font-weight: 600; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-thin {
  font-size: 10.5px; padding: 2px 7px; border-radius: var(--r-pill); flex: none;
  background: var(--warn-soft); color: var(--warn); font-weight: 600;
}

.rank-track { display: grid; grid-template-columns: 1fr 1px 1fr; align-items: center; }
.rank-half { display: flex; height: 16px; }
.rank-half.left { justify-content: flex-end; }
.rank-axis { height: 22px; background: var(--border-strong); }

.rank-bar { height: 16px; border-radius: 4px; min-width: 2px; transition: width .3s var(--ease); }
.rank-bar.pos { background: var(--pos); border-radius: 0 4px 4px 0; }
.rank-bar.neg { background: var(--neg); border-radius: 4px 0 0 4px; }

.rank-val { text-align: right; font-weight: 600; font-size: 13px; white-space: nowrap; }

@media (max-width: 700px) {
  .rank-row { grid-template-columns: 22px 1fr 64px; }
  .rank-track { display: none; }
}

/* ============================ Elo ============================ */

.elo-track { height: 16px; background: var(--surface-2); border-radius: 5px; overflow: hidden; }
.elo-bar {
  display: block; height: 100%; border-radius: 5px;
  background: linear-gradient(90deg, var(--accent-soft), var(--accent));
  transition: width .3s var(--ease);
}
.elo-wr { display: block; font-size: 11px; font-weight: 400; color: var(--muted); }

/* ============================ Dự đoán ============================ */

.pred-head {
  display: grid; grid-template-columns: 1fr minmax(180px, 1.2fr) 1fr;
  gap: var(--s-4); align-items: center; margin-bottom: var(--s-5);
}
.pred-side { display: flex; align-items: center; gap: var(--s-3); }
.pred-side.right { flex-direction: row-reverse; text-align: right; }
.pred-elo { font-size: 12px; color: var(--muted); }

.pred-odds { display: grid; grid-template-columns: auto 1fr auto; gap: var(--s-2); align-items: center; }
.pred-pct { font-family: var(--font-head); font-size: 20px; font-weight: 600; color: var(--accent); }
.pred-pct.right { color: var(--pastel-3-ink); }
.pred-split { display: flex; height: 12px; border-radius: 6px; overflow: hidden; background: var(--surface-2); }
.pred-split span:first-child { background: var(--accent); }
.pred-split span:last-child { background: var(--pastel-3-ink); }

.pred-grid { display: grid; gap: var(--s-4); grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }

.pred-block {
  background: var(--surface-2); border-radius: var(--r-md);
  padding: var(--s-4); margin-top: var(--s-4);
}
.pred-grid .pred-block { margin-top: 0; }
.pred-block h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-2); margin-bottom: var(--s-2); }
.pred-h2h { font-size: 20px; font-family: var(--font-head); margin: 0 0 var(--s-3); }
.pred-h2h .mu { font-size: 12px; font-family: var(--font-body); font-weight: 400; }

.pred-hist {
  display: grid; grid-template-columns: 82px 1fr auto; gap: var(--s-2);
  font-size: 12px; padding: 5px 0; border-top: 1px solid var(--border);
}
.pred-hist .pos { color: var(--pos); font-weight: 600; }
.pred-hist .neg { color: var(--pastel-3-ink); font-weight: 600; }

.line-row { display: grid; grid-template-columns: 78px 1fr 46px; gap: var(--s-2); align-items: center; font-size: 12.5px; padding: 3px 0; }
.line-bar { height: 10px; background: var(--surface); border-radius: 5px; overflow: hidden; }
.line-bar span { display: block; height: 100%; background: var(--accent); border-radius: 5px; }
.line-pct { text-align: right; font-weight: 600; }

/* ============================ Biến động ============================ */

.change {
  display: grid; grid-template-columns: 22px 1fr; gap: var(--s-3);
  padding: var(--s-3) var(--s-4); border-radius: var(--r-md);
  margin-bottom: var(--s-2); border-left: 3px solid transparent;
}
.change.up { background: var(--pos-soft); border-left-color: var(--pos); }
.change.down { background: var(--neg-soft); border-left-color: var(--neg); }
.change-arrow { font-size: 13px; line-height: 1.5; }
.change.up .change-arrow { color: var(--pos); }
.change.down .change-arrow { color: var(--neg); }
.change-text { font-size: 13.5px; font-weight: 500; }
.change-meta { font-size: 11.5px; color: var(--muted); margin-top: 2px; }

/* ============================ Hero thực chiến ============================ */

.hero.good { outline: 2px solid var(--pos); outline-offset: -2px; }
.hero.bad { outline: 2px solid var(--neg); outline-offset: -2px; }
.hero-badge {
  position: absolute; top: 3px; right: 3px;
  background: rgba(0, 0, 0, .72); color: #fff;
  font-size: 8.5px; font-weight: 700; padding: 1px 4px; border-radius: 4px;
}

/* ============================ Biểu đồ form ============================ */

.chart-wrap { position: relative; width: 100%; overflow-x: auto; }
.chart { display: block; width: 100%; min-width: 520px; height: auto; }
.chart .grid-line { stroke: var(--border); stroke-width: 1; }
.chart .axis-text { fill: var(--muted); font-size: 11px; font-family: var(--font-body); }
.chart .series { fill: none; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.chart .point { stroke: var(--surface); stroke-width: 2; }

.legend { display: flex; flex-wrap: wrap; gap: var(--s-3); margin-top: var(--s-4); font-size: 12.5px; }
.legend button {
  display: inline-flex; align-items: center; gap: 7px;
  background: none; border: none; cursor: pointer; padding: 4px 6px;
  border-radius: var(--r-sm); color: var(--ink-2);
  font-family: var(--font-body); font-size: 12.5px; min-height: 32px;
}
.legend button:hover { background: var(--surface-2); }
.legend button[aria-pressed="false"] { opacity: .4; }
.legend .swatch { width: 12px; height: 12px; border-radius: 4px; flex: none; }

/* ============================ Trạng thái ============================ */

.empty, .error, .loading {
  border-radius: var(--r-md); padding: var(--s-5);
  text-align: center; font-size: 13.5px;
}
.empty { border: 1px dashed var(--border-strong); color: var(--muted); }
.error { background: var(--neg-soft); color: var(--neg); border: 1px solid transparent; }
.loading { color: var(--muted); }

.skeleton {
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--border) 37%, var(--surface-2) 63%);
  background-size: 400% 100%; animation: shimmer 1.4s ease infinite;
  border-radius: var(--r-md);
}
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }

.note {
  display: flex; gap: var(--s-2); align-items: flex-start;
  background: var(--warn-soft); color: var(--warn);
  border-radius: var(--r-md); padding: var(--s-3) var(--s-4);
  font-size: 12.5px; margin-bottom: var(--s-4);
}
.note svg { width: 17px; height: 17px; flex: none; margin-top: 1px; }

footer { color: var(--muted); font-size: 12px; margin-top: var(--s-6); text-align: center; }

@media (max-width: 560px) {
  .wrap { padding: var(--s-4) var(--s-3) var(--s-6); }
  .squad, .mini-stats { grid-template-columns: repeat(2, 1fr); }
  .tier-row { grid-template-columns: 76px 1fr; }
  .hero { width: 78px; height: 46px; }
}

/* ============================ Hiệu chuẩn ============================ */

.cal-good { color: var(--pos); font-weight: 600; }
.cal-mid  { color: var(--warn); font-weight: 600; }
.cal-bad  { color: var(--neg); font-weight: 600; }

/* Cảnh báo mạnh hơn ghi chú thường: dùng khi tham số mô hình đã lệch khỏi dữ liệu */
.note.warn { background: var(--neg-soft); color: var(--neg); }

/* ============================ Mục con trong một tab ============================ */

/* Thanh mục con là SEGMENTED CONTROL, không phải mấy chữ rời.
   Bản trước chỉ là text trần trên nền trang: không có hình khối nào nói rằng bấm được, nên nó
   biến mất khỏi tầm mắt. Giờ có vỏ lõm + ô đang chọn NỔI LÊN — cùng ngôn ngữ với nav chính
   nhưng nhỏ hơn và không icon, nên vẫn đọc ra là cấp dưới. */
.subnav {
  display: inline-flex; flex-wrap: wrap; gap: 3px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  padding: 4px;
  margin-bottom: var(--s-5);
  max-width: 100%;
}
.subpill {
  border: none; background: transparent; color: var(--ink-2);
  padding: 8px 16px; min-height: 38px; border-radius: var(--r-pill); cursor: pointer;
  font: inherit; font-size: 13.5px; font-weight: 600; white-space: nowrap;
  transition: background .15s var(--ease), color .15s var(--ease), box-shadow .15s var(--ease);
}
.subpill:hover { color: var(--ink); }

/* Ô đang chọn nổi lên khỏi rãnh — bóng đổ làm việc nặng ở đây, màu chỉ là lớp xác nhận */
.subpill[aria-selected="true"] {
  background: var(--surface);
  color: var(--accent-ink);
  box-shadow: var(--shadow-sm);
}

@media (max-width: 560px) {
  .subnav { width: 100%; }
  .subpill { flex: 1 1 auto; text-align: center; padding: 8px 10px; }
}

/* ============================ Tier list tính động ============================ */

.tl-hero {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: var(--s-2) var(--s-3); border-radius: var(--r-md);
  background: var(--surface-2); min-width: 88px;
}
.tl-hero img { border-radius: var(--r-sm); }
.tl-name {
  font-size: 12px; font-weight: 600; color: var(--ink); text-align: center;
  line-height: 1.25; max-width: 92px;
}
/* Con số luôn đi kèm hero: một cái tên trần không nói được vì sao nó ở tier đó */
.tl-num { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }

.who { font-size: 12px; color: var(--muted); max-width: 260px; }

/* ============================ Bản game ============================ */

.minibar {
  height: 8px; border-radius: var(--r-pill); background: var(--surface-2);
  overflow: hidden; min-width: 70px;
}
.minibar span {
  display: block; height: 100%; border-radius: var(--r-pill);
  background: linear-gradient(90deg, var(--accent), var(--accent-hover));
}
/* Ô có ảnh hero/item kèm tên — ảnh không được đẩy chữ xuống dòng */
.hero-cell { display: flex; align-items: center; gap: var(--s-3); min-width: 148px; }
.hero-cell img {
  border-radius: var(--r-sm); flex: none; object-fit: cover;
  background: var(--surface-2);
}
.hero-cell span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

tr.row-current td { background: var(--accent-soft); }
tr.row-current .chip {
  background: var(--accent); color: var(--on-accent); padding: 1px 8px;
  font-size: 11px; font-weight: 600; border: 0;
}

/* ============================ Trạng thái cập nhật ============================ */

/* Chấm trạng thái: màu KHÔNG phải tín hiệu duy nhất — chữ bên cạnh luôn nói rõ kết quả,
   để người không phân biệt được màu vẫn đọc được bảng. */
.run-dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  margin-right: 7px; flex: none; background: var(--muted); vertical-align: middle;
}
.run-dot.ok  { background: var(--pos); }
.run-dot.bad { background: var(--neg); }
.run-dot.run { background: var(--accent); animation: run-pulse 1.6s ease-in-out infinite; }

@keyframes run-pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: .35; }
}

/* Người đặt "giảm chuyển động" thì bỏ nhấp nháy — nó là trang trại, không mang thông tin */
@media (prefers-reduced-motion: reduce) {
  .run-dot.run { animation: none; }
}

.progress {
  height: 10px; border-radius: var(--r-pill); background: var(--surface-2);
  overflow: hidden;
}
.progress > span {
  display: block; height: 100%; border-radius: var(--r-pill);
  background: linear-gradient(90deg, var(--accent), var(--accent-hover));
  transition: width .4s ease;
}

.run-err {
  font-size: 12px; color: var(--neg); max-width: 320px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* Sắc thái cho thẻ hero dùng chung (tier list + hero thực chiến) */
.tl-hero.good { background: var(--pos-soft); }
.tl-hero.bad  { background: var(--neg-soft); }
.tl-hero.dim  { opacity: .3; }

/* Tiêu đề bảng bấm được: con trỏ và vùng bấm phải nói rõ nó là nút */
thead th[data-sort-ready] { cursor: pointer; user-select: none; }
thead th[data-sort-ready]:hover { color: var(--accent-ink); background: var(--surface-2); }
