:root {
  --bg: #0d1012;
  --bg-2: #11161a;
  --panel: #161c20;
  --panel-2: #1b2328;
  --panel-3: #222c32;
  --border: #253038;
  --border-2: #34434d;
  --text: #ece6d6;
  --text-2: #bdb7a8;
  --muted: #7f8b90;
  --accent: #d9a74a;
  --accent-2: #f2c66b;
  --win: #43c48b;
  --win-bg: rgba(67, 196, 139, 0.1);
  --loss: #e5625c;
  --loss-bg: rgba(229, 98, 92, 0.1);
  --amber: #e8a33d;
  --sapphire: #5b9cf0;
  --weapon: #e3953a;
  --vitality: #79c043;
  --spirit: #b57ee5;
  --radius: 10px;
  --shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --display: 'Oswald', 'Inter', system-ui, sans-serif;
}

* { box-sizing: border-box; }

html { color-scheme: dark; }

body {
  margin: 0;
  background:
    radial-gradient(1200px 500px at 50% -200px, rgba(217, 167, 74, 0.08), transparent 70%),
    var(--bg);
  color: var(--text);
  font: 14px/1.5 var(--font);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--accent-2); text-decoration: none; }
a:hover { color: #fff; }

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

img { display: block; }

.muted { color: var(--muted); }
.center { text-align: center; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---------- topbar ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(13, 16, 18, 0.88);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  max-width: 1240px;
  margin: 0 auto;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 24px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-family: var(--display);
  font-size: 20px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}
.logo b { color: var(--accent); font-weight: 600; margin-left: 2px; }
.logo:hover { color: var(--text); }

.nav { display: flex; gap: 2px; }
.nav a {
  color: var(--text-2);
  padding: 7px 10px;
  border-radius: 8px;
  font-weight: 500;
  white-space: nowrap;
}
.nav a:hover { color: var(--text); background: var(--panel); }
.nav a.active { color: var(--accent-2); background: var(--panel-2); }

.search { margin-left: auto; flex: 0 1 300px; min-width: 180px; }
.search input, .big-search input, .text-input {
  width: 100%;
  background: var(--panel);
  border: 1px solid var(--border-2);
  border-radius: 8px;
  color: var(--text);
  padding: 8px 12px;
  font: inherit;
  outline: none;
}
.search input:focus, .big-search input:focus, .text-input:focus { border-color: var(--accent); }

/* ---------- layout ---------- */

#app { flex: 1; }

.page {
  max-width: 1240px;
  margin: 0 auto;
  padding: 24px 16px 48px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px 24px;
}
.page-head h1 { font-size: 30px; text-transform: uppercase; }
.page-head p { margin: 4px 0 0; color: var(--muted); }

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.grid-side { display: grid; grid-template-columns: minmax(0, 380px) minmax(0, 1fr); gap: 20px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 20px; min-width: 0; }

.card {
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-width: 0;
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.card-head h2 { font-size: 16px; text-transform: uppercase; color: var(--text); }
.card-head .hint { color: var(--muted); font-size: 12px; }
.card-body { padding: 14px 16px 16px; }
.card-body.flush { padding: 0; }

/* ---------- filters, tabs ---------- */

.filters { display: flex; flex-wrap: wrap; gap: 8px; }
.filter select, .select {
  appearance: none;
  background: var(--panel) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%237f8b90'/%3E%3C/svg%3E") no-repeat right 10px center;
  border: 1px solid var(--border-2);
  border-radius: 8px;
  color: var(--text);
  font: inherit;
  padding: 7px 30px 7px 12px;
  cursor: pointer;
}
.filter select:hover, .select:hover { border-color: var(--accent); }
.filter select:disabled { opacity: 0.5; cursor: not-allowed; border-color: var(--border-2); }

.tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.tab {
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text-2);
  border-radius: 999px;
  padding: 5px 12px;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.tab:hover { color: var(--text); border-color: var(--border-2); }
.tab.active { background: rgba(217, 167, 74, 0.14); border-color: var(--accent); color: var(--accent-2); }

.toolbar { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; justify-content: space-between; }
.toolbar .text-input { max-width: 240px; }

.btn {
  background: var(--panel-3);
  border: 1px solid var(--border-2);
  color: var(--text);
  border-radius: 8px;
  padding: 8px 14px;
  font: inherit;
  cursor: pointer;
}
.btn:hover { border-color: var(--accent); color: var(--accent-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #1a1408; font-weight: 600; }
.btn.primary:hover { background: var(--accent-2); color: #1a1408; }
.btn.more { display: block; margin: 12px auto 0; }

/* ---------- table ---------- */

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.table th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 600;
  padding: 10px 10px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  user-select: none;
}
.table th.num { text-align: right; }
.table th.sortable { cursor: pointer; }
.table th.sortable:hover { color: var(--text); }
.table th.sorted { color: var(--accent-2); }
.table th.sorted.desc::after { content: ' ▼'; font-size: 9px; }
.table th.sorted.asc::after { content: ' ▲'; font-size: 9px; }
.table td { padding: 8px 10px; border-bottom: 1px solid rgba(37, 48, 56, 0.6); vertical-align: middle; }
.table tbody tr:hover { background: rgba(255, 255, 255, 0.025); }
.table tr.clickable { cursor: pointer; }
.table .rank-col { width: 36px; color: var(--muted); text-align: center; }
.table.compact th, .table.compact td { padding-left: 6px; padding-right: 6px; }
.table.compact .hero-cell { min-width: 0; }

/* ---------- heroes / items / ranks ---------- */

.hero-icon {
  border-radius: 8px;
  object-fit: cover;
  background: var(--panel-3);
  border: 1px solid var(--border-2);
  flex-shrink: 0;
}
.hero-icon.placeholder { display: inline-block; }
.hero-link { display: inline-block; }
.hero-link:hover .hero-icon { border-color: var(--accent); }

.hero-cell { display: flex; align-items: center; gap: 10px; color: var(--text); min-width: 150px; }
.hero-cell:hover { color: var(--accent-2); }
.hero-cell-text { display: flex; flex-direction: column; line-height: 1.25; }
.hero-cell-text b { font-weight: 600; }
.hero-cell-text small { color: var(--muted); font-size: 12px; }

.item-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 7px;
  border: 1.5px solid var(--border-2);
  background: var(--panel-3);
  flex-shrink: 0;
  overflow: hidden;
}
.item-icon img { width: 82%; height: 82%; object-fit: contain; }
.item-icon.slot-weapon { border-color: var(--weapon); background: rgba(227, 149, 58, 0.16); }
.item-icon.slot-vitality { border-color: var(--vitality); background: rgba(121, 192, 67, 0.16); }
.item-icon.slot-spirit { border-color: var(--spirit); background: rgba(181, 126, 229, 0.16); }
.item-icon.active { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35); }
.item-cell { display: flex; align-items: center; gap: 10px; min-width: 170px; }
.item-cell > span:last-child { display: flex; flex-direction: column; line-height: 1.25; }
.item-cell small { font-size: 12px; }
.slot-text-weapon { color: var(--weapon); }
.slot-text-vitality { color: var(--vitality); }
.slot-text-spirit { color: var(--spirit); }
.items-row { display: flex; flex-wrap: wrap; gap: 4px; }

.rank-badge { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; white-space: nowrap; }
.rank-badge img { object-fit: contain; }

/* win rate */
.wr-great { color: #4fd99b; font-weight: 600; }
.wr-good { color: #9ad9b4; }
.wr-mid { color: var(--text); }
.wr-bad { color: #eba58f; }
.wr-awful { color: #f0706a; font-weight: 600; }
.win { color: var(--win); }
.loss { color: var(--loss); }

.wr-bar-wrap { display: inline-flex; align-items: center; gap: 10px; justify-content: flex-end; }
.wr-bar-wrap > span:first-child { min-width: 48px; text-align: right; }
.wr-bar { position: relative; display: inline-block; height: 6px; background: var(--panel-3); border-radius: 3px; overflow: hidden; }
.wr-bar > span { position: absolute; inset: 0 auto 0 0; background: linear-gradient(90deg, var(--accent), var(--accent-2)); border-radius: 3px; }
.wr-bar > i { position: absolute; left: 50%; top: -2px; bottom: -2px; width: 1px; background: rgba(255, 255, 255, 0.45); }

.pr-bar { display: inline-block; height: 4px; border-radius: 2px; background: var(--sapphire); vertical-align: middle; margin-left: 8px; opacity: 0.8; }

.tier-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 24px;
  padding: 0 6px;
  border-radius: 6px;
  font-family: var(--display);
  font-weight: 700;
  font-size: 14px;
  color: #111;
}
.tier-S { background: #f2c66b; }
.tier-A { background: #4fd99b; }
.tier-B { background: #6aa7f2; }
.tier-C { background: #b6b0a2; }
.tier-D { background: #f0706a; }
.tier-— { background: var(--panel-3); color: var(--muted); }

/* ---------- home page ---------- */

.home-hero {
  text-align: center;
  padding: 40px 16px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.home-hero h1 { font-size: clamp(32px, 6vw, 54px); text-transform: uppercase; letter-spacing: 0.04em; }
.home-hero h1 b { color: var(--accent); font-weight: 600; }
.home-hero p { color: var(--text-2); margin: 0; max-width: 620px; }
.big-search { display: flex; gap: 8px; width: min(620px, 100%); margin-top: 8px; }
.big-search input { padding: 13px 16px; font-size: 16px; border-radius: 10px; }
.big-search .btn { padding: 0 22px; border-radius: 10px; }
.home-meta { color: var(--muted); font-size: 13px; }

.mini-list { display: flex; flex-direction: column; }
.mini-row {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 7px 0;
  border-bottom: 1px solid rgba(37, 48, 56, 0.6);
  color: var(--text);
}
.mini-row:last-child { border-bottom: 0; }
.mini-row .pos { color: var(--muted); font-size: 12px; text-align: center; }
.mini-row:hover { color: var(--accent-2); }
.mini-row .val { font-weight: 600; font-variant-numeric: tabular-nums; }

.patch-list { list-style: none; margin: 0; padding: 0; }
.patch-list li { padding: 8px 0; border-bottom: 1px solid rgba(37, 48, 56, 0.6); display: flex; justify-content: space-between; gap: 12px; }
.patch-list li:last-child { border-bottom: 0; }
.patch-list span { color: var(--muted); white-space: nowrap; font-size: 12px; }

/* ---------- tier list ---------- */

.tier-rows { display: flex; flex-direction: column; gap: 10px; }
.tier-row {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.tier-label {
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--display);
  font-weight: 700;
  font-size: 30px;
  color: #111;
}
.tier-heroes { display: flex; flex-wrap: wrap; gap: 10px; padding: 12px; }
.tier-hero {
  width: 84px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: var(--text);
  text-align: center;
  font-size: 12px;
  line-height: 1.2;
}
.tier-hero img { width: 64px; height: 64px; }
.tier-hero:hover { color: var(--accent-2); }
.tier-hero:hover img { border-color: var(--accent); }
.tier-hero small { font-weight: 600; }

/* ---------- hero page ---------- */

.hero-header {
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--panel);
  min-height: 250px;
}
.hero-header .bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center 30%;
  opacity: 0.35;
}
.hero-header::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(13, 16, 18, 0.95) 0%, rgba(13, 16, 18, 0.75) 45%, rgba(13, 16, 18, 0.3) 100%);
}
.hero-header-inner { position: relative; z-index: 1; display: flex; gap: 24px; padding: 24px; align-items: flex-end; }
.hero-portrait {
  width: 150px;
  border-radius: 12px;
  border: 2px solid var(--hc, var(--accent));
  box-shadow: var(--shadow);
  flex-shrink: 0;
  background: var(--panel-3);
}
.hero-info { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.hero-info .eyebrow { color: var(--hc, var(--accent)); font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; font-size: 12px; }
.hero-info h1 { font-size: clamp(32px, 5vw, 48px); text-transform: uppercase; line-height: 1; }
.hero-info p { margin: 0; color: var(--text-2); max-width: 620px; }
.hero-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.hero-tags span { background: rgba(255, 255, 255, 0.07); border-radius: 999px; padding: 2px 10px; font-size: 12px; color: var(--text-2); }

.stat-tiles { display: flex; flex-wrap: wrap; gap: 10px; }
.stat-tile {
  background: rgba(13, 16, 18, 0.6);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 14px;
  display: flex;
  flex-direction: column;
  min-width: 100px;
}
.stat-label { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; }
.stat-value { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat-sub { color: var(--muted); font-size: 12px; }
/* The tier tile has no sub line, so its badge is centered in the full tile height. */
.stat-tile.tier-tile { align-items: center; min-width: 80px; }
.stat-tile.tier-tile .stat-value { flex: 1; display: flex; align-items: center; justify-content: center; }
.stat-tile.tier-tile .tier-badge { min-width: 36px; height: 30px; font-size: 18px; }

.abilities { display: flex; gap: 10px; flex-wrap: wrap; }
.ability { display: flex; align-items: center; gap: 8px; background: rgba(13, 16, 18, 0.6); border: 1px solid var(--border); border-radius: 10px; padding: 5px 10px 5px 5px; font-size: 13px; }
.ability img { width: 30px; height: 30px; border-radius: 6px; background: #000; }
.ability small { display: block; color: var(--muted); font-size: 11px; }

.matchup-list { display: flex; flex-direction: column; }
.matchup {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 64px 100px;
  gap: 14px;
  align-items: center;
  padding: 7px 0;
  border-bottom: 1px solid rgba(37, 48, 56, 0.6);
}
.matchup:last-child { border-bottom: 0; }
.matchup .delta { font-size: 12px; min-width: 52px; text-align: right; }
.matchup .games { color: var(--muted); font-size: 12px; min-width: 70px; text-align: right; }

.build-cols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.build-col h3 { font-size: 13px; text-transform: uppercase; color: var(--text-2); margin-bottom: 8px; letter-spacing: 0.05em; }
.build-item { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 5px 0; }
.build-item .name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.build-item .vals { text-align: right; font-size: 12px; line-height: 1.3; font-variant-numeric: tabular-nums; }
.build-item .vals span { display: block; color: var(--muted); }

.compare-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.compare { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; }
.compare .stat-label { display: block; }
.compare b { font-size: 18px; font-variant-numeric: tabular-nums; }
.compare .diff { font-size: 12px; margin-left: 6px; }

/* ---------- charts ---------- */

.chart-box { width: 100%; min-height: 120px; }
.chart { display: block; overflow: visible; }
.chart .grid { stroke: var(--border); stroke-width: 1; }
.chart .ref { stroke: rgba(236, 230, 214, 0.35); stroke-dasharray: 4 4; }
.chart .guide { stroke: rgba(236, 230, 214, 0.4); }
.chart .axis { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.chart g[data-tip]:hover rect:nth-child(2) { opacity: 1; filter: brightness(1.15); }
.legend { display: flex; gap: 16px; flex-wrap: wrap; justify-content: center; margin-top: 6px; color: var(--text-2); font-size: 12px; }
.legend i, .tooltip i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.chart-title { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; margin: 6px 0 4px; }

/* ---------- player ---------- */

.player-header {
  display: flex;
  gap: 20px;
  align-items: center;
  background: linear-gradient(120deg, var(--panel-2), var(--panel));
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  flex-wrap: wrap;
}
.avatar { width: 96px; height: 96px; border-radius: 14px; border: 2px solid var(--border-2); background: var(--panel-3); object-fit: cover; }
.player-name { display: flex; flex-direction: column; gap: 6px; min-width: 0; flex: 1; }
.player-name h1 { font-size: 32px; overflow-wrap: anywhere; }
.player-name .meta { color: var(--muted); display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; }
.player-rank { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-radius: 12px; background: rgba(13, 16, 18, 0.5); border: 1px solid var(--border); }
.player-rank img { width: 64px; height: 64px; object-fit: contain; }
.player-rank b { font-size: 18px; display: block; }
.player-rank small { color: var(--muted); }

.match-list { display: flex; flex-direction: column; gap: 6px; container-type: inline-size; }
.match-row {
  display: grid;
  grid-template-columns: 96px 40px minmax(0, 1.2fr) minmax(86px, 1fr) minmax(0, 0.9fr) minmax(0, 0.9fr) 60px;
  gap: 10px;
  align-items: center;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--muted);
  background: var(--panel);
  color: var(--text);
}
.match-row:hover { color: var(--text); border-color: var(--border-2); background: var(--panel-2); }
.match-row.win { border-left-color: var(--win); background: linear-gradient(90deg, var(--win-bg), var(--panel) 40%); }
.match-row.loss { border-left-color: var(--loss); background: linear-gradient(90deg, var(--loss-bg), var(--panel) 40%); }
.match-row .col { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.match-row .col > * { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.match-row .col small { color: var(--muted); font-size: 12px; }
@container (max-width: 640px) {
  .match-row { grid-template-columns: 90px 40px minmax(0, 1fr) 86px minmax(0, 0.9fr) 56px; }
  .match-row .hide-md { display: none; }
}
@container (max-width: 460px) {
  .match-row { grid-template-columns: 84px 40px minmax(0, 1fr) auto; }
  .match-row .hide-sm { display: none; }
}
.match-row .result { font-weight: 700; }
.match-row.win .result { color: var(--win); }
.match-row.loss .result { color: var(--loss); }
.match-row .kda-line { font-weight: 700; font-variant-numeric: tabular-nums; }
.match-row .delta { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---------- match ---------- */

.match-header { display: flex; flex-wrap: wrap; gap: 16px 32px; align-items: center; justify-content: space-between; }
.match-header h1 { font-size: 28px; text-transform: uppercase; }
.team-card .card-head h2 { display: flex; align-items: center; gap: 10px; }
.team-dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }
.team-dot.amber { background: var(--amber); }
.team-dot.sapphire { background: var(--sapphire); }
.team-card.amber { border-top: 3px solid var(--amber); }
.team-card.sapphire { border-top: 3px solid var(--sapphire); }
.result-tag { font-size: 12px; padding: 2px 10px; border-radius: 999px; font-family: var(--font); font-weight: 600; text-transform: none; letter-spacing: 0; }
.result-tag.win { background: var(--win-bg); color: var(--win); }
.result-tag.loss { background: var(--loss-bg); color: var(--loss); }
.player-link { color: var(--text); font-weight: 600; max-width: 170px; display: inline-block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; vertical-align: middle; }
.player-link:hover { color: var(--accent-2); }

/* ---------- search / leaderboard ---------- */

.search-results { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.search-result {
  display: flex;
  gap: 12px;
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  color: var(--text);
}
.search-result:hover { border-color: var(--accent); color: var(--text); }
.search-result img.av { width: 52px; height: 52px; border-radius: 10px; background: var(--panel-3); }
.search-result .info { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.search-result b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-result small { color: var(--muted); }

.lb-name { color: var(--text); font-weight: 600; }
.lb-pos { font-family: var(--display); font-size: 16px; color: var(--text-2); }
.lb-pos.top { color: var(--accent-2); }

/* ---------- states ---------- */

.loading { display: flex; align-items: center; justify-content: center; gap: 10px; color: var(--muted); padding: 28px 0; }
.spinner { width: 18px; height: 18px; border: 2px solid var(--border-2); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.error-box { display: flex; flex-direction: column; gap: 4px; background: var(--loss-bg); border: 1px solid rgba(229, 98, 92, 0.4); color: #f3b1ad; border-radius: 10px; padding: 12px 14px; }
.error-box b { color: #ffd1ce; }
.empty-box { color: var(--muted); text-align: center; padding: 24px 12px; }
.empty-box.big { padding: 60px 12px; font-size: 16px; }
.note { color: var(--muted); font-size: 12px; margin: 0; }

.tooltip {
  position: fixed;
  z-index: 100;
  pointer-events: none;
  background: #0b0e10;
  border: 1px solid var(--border-2);
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 12px;
  line-height: 1.5;
  max-width: 300px;
  box-shadow: var(--shadow);
}
.tooltip .tip-title { color: var(--accent-2); font-weight: 600; margin-bottom: 2px; }

.refresh-pill {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 60;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(22, 28, 32, 0.92);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border-2);
  border-radius: 999px;
  color: var(--text-2);
  font: inherit;
  font-size: 12px;
  padding: 7px 12px;
  cursor: pointer;
  box-shadow: var(--shadow);
}
.refresh-pill[hidden] { display: none; }
.refresh-pill:hover { color: var(--text); border-color: var(--accent); }
.refresh-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--win); animation: pulse 2.4s infinite; }
.refresh-pill .icon { font-size: 14px; line-height: 1; }
.refresh-pill.updating .dot { background: var(--accent); animation: none; }
.refresh-pill.updating .icon { animation: spin 0.9s linear infinite; }
.refresh-pill.failed .dot { background: var(--loss); animation: none; }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(67, 196, 139, 0.55); }
  70% { box-shadow: 0 0 0 6px rgba(67, 196, 139, 0); }
  100% { box-shadow: 0 0 0 0 rgba(67, 196, 139, 0); }
}

/* ---------- player: hero in focus ---------- */

.mode-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; }
.mode-bar .tab { font-size: 14px; padding: 7px 16px; }
.mode-bar .hint { color: var(--muted); font-size: 12px; }
.card-tools { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.card-tools .hint { color: var(--muted); font-size: 12px; }
.mode-chip { font-family: var(--font); font-size: 11px; font-weight: 600; letter-spacing: 0.04em; padding: 2px 10px; border-radius: 999px; background: rgba(217, 167, 74, 0.14); color: var(--accent-2); border: 1px solid var(--accent); }
.hero-focus { border-top: 3px solid var(--accent); }

/* ---------- player: rank progress ---------- */

.rank-progress { display: flex; flex-direction: column; gap: 14px; margin-bottom: 14px; }
.rp-row { display: flex; align-items: center; gap: 14px; }
.rp-main { flex: 1; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.rp-labels { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-size: 13px; }
.rp-labels b { font-size: 16px; }
.rp-bar { height: 10px; border-radius: 5px; background: var(--panel-3); overflow: hidden; }
.rp-bar span { display: block; height: 100%; border-radius: 5px; }
.hero-focus .card-head h2 { display: flex; align-items: center; gap: 10px; }
.focus-grid { margin-top: 4px; }
.focus-grid .sub-title { margin-top: 18px; }

/* ---------- shared bits for newer pages ---------- */

.sub-title { font-size: 13px; text-transform: uppercase; color: var(--text-2); letter-spacing: 0.05em; margin: 18px 0 10px; display: flex; align-items: center; gap: 8px; }
.page-tabs .tab { font-size: 14px; padding: 7px 16px; }

.player-chip { display: inline-flex; align-items: center; gap: 8px; color: var(--text); font-weight: 600; min-width: 0; }
.player-chip:hover { color: var(--accent-2); }
.player-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }
.player-avatar { border-radius: 6px; background: var(--panel-3); flex-shrink: 0; display: inline-block; }

/* ability order */
.order-block { margin-bottom: 18px; }
.order-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.order-head h3 { font-size: 15px; text-transform: uppercase; margin-bottom: 4px; }
.order-stats { display: flex; flex-direction: column; align-items: flex-end; text-align: right; }
.order-stats > span { font-weight: 700; font-size: 16px; }
.order-stats small { color: var(--muted); }
.priority { display: inline-flex; align-items: center; gap: 4px; vertical-align: middle; }
.priority i { color: var(--muted); font-style: normal; }
.ability-mini { width: 24px; height: 24px; border-radius: 5px; background: #000; display: inline-block; vertical-align: middle; }
.order-steps { display: inline-flex; gap: 3px; }
.ability-grid {
  display: grid;
  grid-template-columns: 170px repeat(var(--steps), minmax(26px, 1fr));
  gap: 3px;
  min-width: 600px;
  font-variant-numeric: tabular-nums;
}
.ag-head { text-align: center; color: var(--muted); font-size: 11px; padding-bottom: 2px; cursor: default; }
.ag-ability { display: flex; align-items: center; gap: 8px; font-size: 13px; min-width: 0; }
.ag-ability img { width: 26px; height: 26px; border-radius: 6px; background: #000; flex-shrink: 0; }
.ag-ability span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ag-cell { height: 30px; border-radius: 5px; background: var(--panel-3); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; }
.ag-cell.on { background: var(--accent); color: #1a1408; }
.ag-cell.unlock { background: rgba(217, 167, 74, 0.25); color: var(--accent-2); box-shadow: inset 0 0 0 1px var(--accent); }

/* builds and combinations */
.build-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 460px), 1fr)); gap: 12px; margin-bottom: 10px; }
.build-card { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.build-card-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.build-title { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.build-title b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.build-title small { color: var(--muted); display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.build-title .player-chip { font-weight: 500; font-size: 12px; }
.build-cat { display: grid; grid-template-columns: 90px minmax(0, 1fr); gap: 10px; align-items: center; }
.build-cat > span { color: var(--text-2); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.combo { display: inline-flex; align-items: center; gap: 6px; min-width: 260px; }
.combo .plus { color: var(--muted); }
.combo-names { margin-left: 6px; font-size: 13px; }

/* matchup */
.versus {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  background: linear-gradient(120deg, var(--panel-2), var(--panel));
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
}
.versus-hero { display: flex; flex-direction: column; align-items: center; gap: 8px; color: var(--text); font-family: var(--display); font-size: 24px; text-transform: uppercase; }
.versus-hero img { width: 120px; border-radius: 12px; border: 2px solid var(--hc, var(--accent)); box-shadow: var(--shadow); }
.versus-hero:hover { color: var(--accent-2); }
.versus-mid { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.versus-label { font-family: var(--display); font-size: 34px; color: var(--muted); }
.versus-wr { display: flex; gap: 8px; font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.vs-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; text-align: center; margin-bottom: 16px; }
.vs-summary b { display: block; font-size: 22px; }
.vs-rows { display: flex; flex-direction: column; gap: 10px; }
.vs-row { display: grid; grid-template-columns: 80px minmax(0, 1fr) 80px; gap: 12px; align-items: center; font-variant-numeric: tabular-nums; }
.vs-row > b:first-child { text-align: right; }
.vs-bar { position: relative; display: flex; height: 22px; border-radius: 6px; overflow: hidden; background: var(--panel-3); }
.vs-bar span { opacity: 0.55; }
.vs-bar label { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; color: #fff; text-shadow: 0 1px 2px #000; }

/* compare */
.compare-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.compare-slot { background: linear-gradient(120deg, var(--panel-2), var(--panel)); border: 1px solid var(--border); border-radius: 14px; padding: 16px; min-width: 0; }
.cmp-card { display: flex; align-items: center; gap: 16px; }
.cmp-card .avatar { width: 72px; height: 72px; }
.cmp-card-info { display: flex; flex-direction: column; gap: 6px; flex: 1; min-width: 0; }
.cmp-name { font-family: var(--display); font-size: 22px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picker { display: flex; flex-direction: column; gap: 10px; }
.picker-results { display: flex; flex-direction: column; gap: 6px; }
.picker-results .search-result { font: inherit; text-align: left; cursor: pointer; width: 100%; }
.h2h { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.h2h-item { display: flex; flex-direction: column; gap: 2px; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; }
.h2h-item b { font-size: 18px; }
.cmp-rows { display: flex; flex-direction: column; }
.cmp-row { display: grid; grid-template-columns: 1fr 180px 1fr; gap: 12px; align-items: center; padding: 8px 0; border-bottom: 1px solid rgba(37, 48, 56, 0.6); font-variant-numeric: tabular-nums; }
.cmp-row:last-child { border-bottom: 0; }
.cmp-row > :first-child { justify-self: end; }
.cmp-row label { text-align: center; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; }
.cmp-row .better { color: var(--win); font-weight: 700; }
.cmp-head b { font-family: var(--display); font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }

/* match: timeline, damage matrix, purchases */
.tl-event { cursor: default; }
.tl-event:hover { filter: brightness(1.3); }
.tl-star { fill: #111; font-size: 10px; font-weight: 700; font-family: var(--font); pointer-events: none; }
.event-list { display: flex; flex-direction: column; max-height: 420px; overflow-y: auto; }
.event { display: grid; grid-template-columns: 52px 14px minmax(0, 1fr); gap: 8px; align-items: center; padding: 6px 0; border-bottom: 1px solid rgba(37, 48, 56, 0.6); font-size: 13px; }
.event-time { color: var(--muted); font-variant-numeric: tabular-nums; }
.event-text { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.event.objective .event-text b, .event.midboss .event-text b { color: var(--accent-2); }
.matrix-pair { display: grid; grid-template-columns: 1fr; gap: 8px; }
@media (min-width: 1240px) { .matrix-pair { grid-template-columns: 1fr 1fr; gap: 20px; } }
.matrix { border-collapse: separate; border-spacing: 3px; font-variant-numeric: tabular-nums; width: 100%; }
.matrix th { font-weight: 500; }
.matrix td {
  min-width: 54px;
  text-align: center;
  font-size: 12px;
  padding: 7px 4px;
  border-radius: 5px;
  background: rgba(229, 98, 92, calc(0.06 + var(--heat, 0) * 0.8));
}
.matrix td.num { background: none; text-align: right; }
.matrix-who { display: flex; align-items: center; gap: 8px; text-align: left; min-width: 150px; }
.matrix-who span { display: flex; flex-direction: column; line-height: 1.2; font-size: 13px; }
.matrix-who small { color: var(--muted); font-size: 11px; max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.purchase-list { display: flex; flex-direction: column; }
.purchase-row { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 12px; align-items: center; padding: 8px 0; border-bottom: 1px solid rgba(37, 48, 56, 0.6); }
.purchase-who { display: flex; align-items: center; gap: 8px; min-width: 0; }
.purchase-who > span:last-child { display: flex; flex-direction: column; line-height: 1.2; font-size: 13px; min-width: 0; }
.purchase-who small { color: var(--muted); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.purchase-items { display: flex; flex-wrap: wrap; gap: 4px; }
.purchase { display: flex; flex-direction: column; align-items: center; gap: 1px; }
.purchase small { color: var(--muted); font-size: 10px; font-variant-numeric: tabular-nums; }
.purchase.sold .item-icon { opacity: 0.4; }

.footer { border-top: 1px solid var(--border); color: var(--muted); font-size: 12px; text-align: center; padding: 18px 16px 24px; }
.footer p { margin: 0 auto; max-width: 800px; }

/* ---------- responsive ---------- */

@media (max-width: 1100px) {
  .grid-side { grid-template-columns: 1fr; }
}

@media (max-width: 1000px) {
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .build-cols { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .topbar-inner { flex-wrap: wrap; gap: 8px 12px; }
  .nav { order: 3; width: 100%; overflow-x: auto; }
  .search { flex: 1 1 160px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .hero-header-inner { flex-direction: column; align-items: flex-start; }
  .hero-portrait { width: 110px; }
  .page-head h1 { font-size: 24px; }
  .compare-cols, .h2h { grid-template-columns: 1fr; }
  .cmp-row { grid-template-columns: 1fr 110px 1fr; }
  .versus { padding: 14px; gap: 8px; }
  .versus-hero { font-size: 16px; }
  .versus-hero img { width: 80px; }
  .versus-wr { font-size: 16px; }
  .vs-row { grid-template-columns: 64px minmax(0, 1fr) 64px; }
  .purchase-row { grid-template-columns: 1fr; }
}
