/* ============================================================
 * Brawl Meta — refined design tokens (light + dark)
 * ============================================================ */

:root {
  /* Light theme (default) */
  --bg: #FAFAF7;
  --bg-elevated: #FFFFFF;
  --surface: #FFFFFF;
  --surface-2: #F4F2EC;
  --surface-hover: #F0EEE7;
  --border: #E8E4DA;
  --border-strong: #D4CFC2;
  --border-subtle: rgba(31, 31, 30, 0.06);
  --text: #1F1F1E;
  --text-muted: #6B6A65;
  --text-soft: #9E9C95;
  --text-inv: #FAFAF7;
  --accent: #D97757;
  --accent-hover: #C26242;
  --accent-soft: rgba(217, 119, 87, 0.10);
  --accent-glow: rgba(217, 119, 87, 0.25);
  --positive: #2F7A4B;
  --positive-soft: rgba(47, 122, 75, 0.12);
  --negative: #B33A3A;
  --negative-soft: rgba(179, 58, 58, 0.10);
  --elite: #2563EB;
  --elite-soft: rgba(37, 99, 235, 0.12);
  --warning: #B8860B;
  --shadow-sm: 0 1px 2px rgba(31, 31, 30, 0.04);
  --shadow: 0 1px 2px rgba(31, 31, 30, 0.04), 0 4px 12px rgba(31, 31, 30, 0.04);
  --shadow-lg: 0 8px 24px rgba(31, 31, 30, 0.08), 0 2px 4px rgba(31, 31, 30, 0.04);
  --shadow-xl: 0 24px 48px -12px rgba(31, 31, 30, 0.18);
  --gradient-hero: radial-gradient(circle at 20% 0%, rgba(217, 119, 87, 0.06), transparent 50%),
                   radial-gradient(circle at 80% 0%, rgba(139, 92, 246, 0.04), transparent 50%);
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
}

html.dark {
  --bg: #0E1117;
  --bg-elevated: #14181F;
  --surface: #161A22;
  --surface-2: #1E232D;
  --surface-hover: #232936;
  --border: #272D38;
  --border-strong: #363D4A;
  --border-subtle: rgba(255, 255, 255, 0.06);
  --text: #E8EAEC;
  --text-muted: #9CA3AF;
  --text-soft: #6B7280;
  --text-inv: #14181F;
  --accent: #F08562;
  --accent-hover: #E0734F;
  --accent-soft: rgba(240, 133, 98, 0.12);
  --accent-glow: rgba(240, 133, 98, 0.32);
  --positive: #4ADE80;
  --positive-soft: rgba(74, 222, 128, 0.12);
  --negative: #F87171;
  --negative-soft: rgba(248, 113, 113, 0.12);
  --elite: #60A5FA;
  --elite-soft: rgba(96, 165, 250, 0.14);
  --warning: #FCD34D;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 4px 16px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.5), 0 2px 4px rgba(0, 0, 0, 0.3);
  --shadow-xl: 0 32px 64px -12px rgba(0, 0, 0, 0.6);
  --gradient-hero: radial-gradient(circle at 20% 0%, rgba(240, 133, 98, 0.08), transparent 50%),
                   radial-gradient(circle at 80% 0%, rgba(139, 92, 246, 0.06), transparent 50%);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, -apple-system, 'Pretendard Variable', 'Noto Sans KR', sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: 'cv11', 'ss01', 'ss03';
  transition: background 0.2s ease, color 0.2s ease;
}

button, input, select { font-family: inherit; font-size: inherit; color: inherit; }

/* ============================================================
 * Topbar
 * ============================================================ */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  max-width: 1600px;
  margin: 0 auto;
  padding: 0 28px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.topbar-left { display: flex; align-items: center; gap: 24px; }
.topbar-right { display: flex; align-items: center; gap: 8px; }

.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), #E0A555);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  box-shadow: 0 4px 12px var(--accent-glow);
}
.brand-name {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
}

.nav-tabs { display: flex; align-items: center; gap: 2px; padding: 3px; background: var(--surface-2); border-radius: 8px; }
.tab-btn {
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all 0.15s ease;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active {
  color: var(--text);
  background: var(--bg-elevated);
  box-shadow: var(--shadow-sm);
}

.meta-pills { display: flex; align-items: center; gap: 10px; padding: 0 8px; }
.meta-pill {
  font-size: 11px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.meta-pill b { color: var(--text); font-weight: 600; }
.meta-pill-dot { color: var(--border-strong); }

.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }

.season-select-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 4px 0 10px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
}
.season-select-wrap label { font-size: 10px; color: var(--text-soft); text-transform: uppercase; letter-spacing: 0.08em; }
.season-label { font-size: 12px; color: var(--text-muted); font-family: 'JetBrains Mono', monospace; }
.season-label b { color: var(--text); font-weight: 600; margin-left: 4px; }
#f-season {
  appearance: none;
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 12px;
  font-weight: 500;
  padding: 0 18px 0 4px;
  height: 100%;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 2px center;
  outline: none;
}
#f-season option { background: var(--surface); color: var(--text); }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
}
.btn:hover { background: var(--surface-hover); border-color: var(--border-strong); }
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
  box-shadow: 0 1px 2px var(--accent-glow);
}
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--text-muted); }
.btn-ghost:hover { color: var(--text); background: var(--surface-2); }

/* ============================================================
 * Layout
 * ============================================================ */
.app-main {
  max-width: 1600px;
  margin: 0 auto;
  padding: 32px 28px 16px;
  position: relative;
}
.app-main::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  background: var(--gradient-hero);
}

.view.hidden { display: none; }
.hidden { display: none !important; }
.hidden-mobile { display: flex; }
@media (max-width: 1100px) { .meta-pills { display: none; } }
@media (max-width: 720px) { .hidden-mobile { display: none; } .nav-tabs { display: none; } }

.section-title {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
  margin: 0;
}
.section-sub { font-size: 13px; color: var(--text-muted); margin-top: 4px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

/* ============================================================
 * KPI cards
 * ============================================================ */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 24px; }
@media (max-width: 720px) { .kpi-grid { grid-template-columns: repeat(2, 1fr); } }
.kpi-card {
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: all 0.18s ease;
}
.kpi-card:hover { border-color: var(--border-strong); transform: translateY(-1px); box-shadow: var(--shadow); }
.kpi-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); font-weight: 600; margin-bottom: 6px; }
.kpi-value { font-size: 26px; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; line-height: 1.1; letter-spacing: -0.02em; }

/* ============================================================
 * Filters
 * ============================================================ */
.filter-card { margin-bottom: 20px; padding: 16px 18px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.filter-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.filter-head-left { display: flex; align-items: center; gap: 8px; }
.filter-head-icon { color: var(--text-muted); }
.filter-head-title { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); }
.filter-reset { font-size: 12px; color: var(--text-soft); background: none; border: none; cursor: pointer; transition: color 0.15s; }
.filter-reset:hover { color: var(--text); }

.filter-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
@media (max-width: 980px) { .filter-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 600px) { .filter-grid { grid-template-columns: repeat(2, 1fr); } }

.filter-group { display: flex; flex-direction: column; gap: 6px; }
.filter-group label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); font-weight: 600; }

.filter-select {
  width: 100%;
  height: 36px;
  padding: 0 12px;
  border-radius: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 13px;
  appearance: none;
  outline: none;
  transition: all 0.15s;
}
.filter-select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.filter-select:hover { border-color: var(--border-strong); }
select.filter-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.7rem center;
  padding-right: 2rem;
  color: var(--text);
}
select.filter-select option { background: var(--surface); color: var(--text); }

/* ============================================================
 * Tables (shared)
 * ============================================================ */
.table-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); overflow: hidden; }
.table-head { padding: 18px 22px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.table-head h2 { font-size: 16px; font-weight: 600; margin: 0; letter-spacing: -0.01em; color: var(--text); }
.table-head .sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.table-head .meta { font-size: 12px; color: var(--text-muted); }
.legend-pill { display: inline-flex; align-items: center; gap: 4px; font-size: 10px; color: var(--text-muted); }
.legend-dot { width: 6px; height: 6px; border-radius: 50%; }
.legend-dot.pos { background: var(--positive); }
.legend-dot.neg { background: var(--negative); }

.scroll-x { overflow-x: auto; }

#stats-table, #rank-table { width: 100%; border-collapse: collapse; }
#stats-table thead th, #rank-table thead th {
  padding: 11px 16px;
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  cursor: default;
  user-select: none;
  transition: color 0.15s;
}
.text-left { text-align: left !important; }
#stats-table thead th.num, #rank-table thead th.num { text-align: right; font-variant-numeric: tabular-nums; }
#stats-table thead th.sortable, #rank-table thead th.sortable { cursor: pointer; }
#stats-table thead th.sortable:hover, #rank-table thead th.sortable:hover { color: var(--text); }
#stats-table thead th.active { color: var(--accent); }
#stats-table thead th.active.desc::after { content: ' ▾'; }
#stats-table thead th.active.asc::after { content: ' ▴'; }

#stats-table tbody tr, #rank-table tbody tr {
  border-bottom: 1px solid var(--border-subtle);
  transition: background 0.12s;
}
#stats-table tbody tr:last-child, #rank-table tbody tr:last-child { border-bottom: none; }
#stats-table tbody tr:hover { background: var(--surface-2); }
#rank-table tbody tr { cursor: pointer; }
#rank-table tbody tr:hover { background: var(--surface-hover); }

#stats-table tbody td, #rank-table tbody td { padding: 12px 16px; }
#stats-table tbody td.rank { text-align: center; color: var(--text-soft); font-variant-numeric: tabular-nums; font-size: 12px; font-weight: 500; width: 48px; }
#stats-table tbody td.name { font-weight: 600; color: var(--text); }
#stats-table tbody td.num, #rank-table tbody td.num { text-align: right; font-variant-numeric: tabular-nums; color: var(--text); }

.empty-cell { padding: 0 !important; }
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 64px 16px;
  color: var(--text-muted);
  text-align: center;
}
.empty-state-title { font-size: 14px; font-weight: 500; color: var(--text); margin-bottom: 4px; }
.empty-state-sub { font-size: 12px; color: var(--text-muted); }

/* Win-rate badges */
.wr-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 64px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  border: 1px solid transparent;
}
.wr-elite { background: var(--elite-soft); color: var(--elite); border-color: color-mix(in srgb, var(--elite) 35%, transparent); font-weight: 700; }
.wr-pos { background: var(--positive-soft); color: var(--positive); border-color: color-mix(in srgb, var(--positive) 30%, transparent); }
.wr-neg { background: var(--negative-soft); color: var(--negative); border-color: color-mix(in srgb, var(--negative) 30%, transparent); }
.wr-neu { background: var(--surface-2); color: var(--text-muted); border-color: var(--border); }

/* Score cell — 점수 숫자 위, bar 아래 (우측 정렬) */
.score-cell {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  padding-right: 12px;
}
.score-num {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  font-size: 13px;
  color: var(--text);
  line-height: 1;
}
.score-cell .bar {
  width: 100px;
  height: 4px;
}

/* Pick rate bar */
.bar { height: 6px; border-radius: 999px; background: var(--surface-2); overflow: hidden; width: 160px; }
.bar-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--accent-soft), var(--accent)); transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1); }

/* Brawler image */
#stats-table th.img-col, #stats-table td.img-cell { width: 56px; min-width: 56px; padding: 6px 8px; }
.brawler-img {
  width: 40px;
  height: 40px;
  min-width: 40px;
  border-radius: 10px;
  object-fit: cover;
  background: linear-gradient(135deg, var(--accent-soft), var(--surface-2));
  border: 1px solid var(--border);
  transition: transform 0.18s ease, border-color 0.18s ease;
  display: block;
}
.brawler-img:hover { transform: scale(1.08); border-color: var(--accent); }

/* ============================================================
 * Rankings table extras
 * ============================================================ */
.rank-num {
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-soft);
}
.rank-num.top1 { color: #C7A434; }
.rank-num.top2 { color: var(--text-muted); }
.rank-num.top3 { color: #C97558; }

#rank-table tbody tr.top1-row { background: linear-gradient(90deg, color-mix(in srgb, gold 8%, transparent), transparent 60%); }
#rank-table tbody tr.top2-row { background: linear-gradient(90deg, color-mix(in srgb, silver 6%, transparent), transparent 60%); }
#rank-table tbody tr.top3-row { background: linear-gradient(90deg, color-mix(in srgb, #C97558 6%, transparent), transparent 60%); }
#rank-table tbody tr.has-pro { background: linear-gradient(90deg, rgba(16,185,129,0.05), rgba(251,191,36,0.03)); }
#rank-table tbody tr.has-pro:hover { background: linear-gradient(90deg, rgba(16,185,129,0.1), rgba(251,191,36,0.05)); }

.region-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.trophy-num { display: inline-flex; align-items: center; gap: 4px; color: var(--warning); font-weight: 600; font-variant-numeric: tabular-nums; }

/* Favorite star */
.fav-star {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-soft);
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s;
}
.fav-star:hover { background: var(--surface-2); color: var(--warning); }
.fav-star.on { color: var(--warning); background: color-mix(in srgb, var(--warning) 10%, transparent); }

/* ============================================================
 * Tier badges (with image)
 * ============================================================ */
.tier-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px 3px 4px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid transparent;
  white-space: nowrap;
}
.tier-badge img { width: 22px; height: 22px; object-fit: contain; filter: drop-shadow(0 1px 2px rgba(0,0,0,0.2)); }

.tier-bronze   { background: color-mix(in srgb, #B45309 15%, transparent); color: #B45309; border-color: color-mix(in srgb, #B45309 30%, transparent); }
html.dark .tier-bronze { color: #FB923C; }

.tier-silver   { background: color-mix(in srgb, #71717A 12%, transparent); color: #52525B; border-color: color-mix(in srgb, #71717A 25%, transparent); }
html.dark .tier-silver { color: #E4E4E7; }

.tier-gold     { background: color-mix(in srgb, #D97706 12%, transparent); color: #B45309; border-color: color-mix(in srgb, #D97706 30%, transparent); }
html.dark .tier-gold { color: #FBBF24; }

.tier-diamond  { background: color-mix(in srgb, #0891B2 12%, transparent); color: #0E7490; border-color: color-mix(in srgb, #0891B2 30%, transparent); }
html.dark .tier-diamond { color: #67E8F9; }

.tier-mythic   { background: color-mix(in srgb, #9333EA 12%, transparent); color: #7E22CE; border-color: color-mix(in srgb, #9333EA 35%, transparent); }
html.dark .tier-mythic { color: #C084FC; }

.tier-legend   { background: color-mix(in srgb, #E11D48 12%, transparent); color: #BE123C; border-color: color-mix(in srgb, #E11D48 35%, transparent); }
html.dark .tier-legend { color: #FB7185; }

.tier-masters  {
  background: linear-gradient(135deg, color-mix(in srgb, #F59E0B 18%, transparent), color-mix(in srgb, #E11D48 14%, transparent));
  color: #C2410C;
  border-color: color-mix(in srgb, #F59E0B 50%, transparent);
}
html.dark .tier-masters { color: #FDE047; }

.tier-pro {
  background: linear-gradient(135deg, color-mix(in srgb, #10B981 22%, transparent), color-mix(in srgb, #F59E0B 26%, transparent));
  color: #047857;
  border-color: color-mix(in srgb, #F59E0B 55%, transparent);
  font-weight: 700;
  box-shadow: 0 0 14px rgba(16, 185, 129, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}
html.dark .tier-pro { color: #FDE68A; text-shadow: 0 1px 2px rgba(0,0,0,0.4); }

.tier-none { background: var(--surface-2); color: var(--text-soft); border-color: var(--border); padding-left: 10px; }

/* Meta tier (브롤러 강도 등급) */
.meta-tier {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 52px;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  border: 1px solid transparent;
}
.meta-tier-op {
  background: linear-gradient(135deg, #DC2626, #F59E0B);
  color: white;
  border-color: rgba(220, 38, 38, 0.5);
  box-shadow: 0 0 12px rgba(220, 38, 38, 0.25);
}
/* 1티어: 파란색 */
.meta-tier-t1 {
  background: color-mix(in srgb, #3B82F6 18%, transparent);
  color: #1D4ED8;
  border-color: color-mix(in srgb, #3B82F6 45%, transparent);
}
html.dark .meta-tier-t1 { color: #93C5FD; }

/* 2티어: 라임색 */
.meta-tier-t2 {
  background: color-mix(in srgb, #84CC16 18%, transparent);
  color: #4D7C0F;
  border-color: color-mix(in srgb, #84CC16 45%, transparent);
}
html.dark .meta-tier-t2 { color: #BEF264; }

/* 3티어: 노란색 */
.meta-tier-t3 {
  background: color-mix(in srgb, #EAB308 18%, transparent);
  color: #A16207;
  border-color: color-mix(in srgb, #EAB308 45%, transparent);
}
html.dark .meta-tier-t3 { color: #FDE047; }

/* 4티어: 회색 */
.meta-tier-t4 {
  background: color-mix(in srgb, #9CA3AF 18%, transparent);
  color: #4B5563;
  border-color: color-mix(in srgb, #9CA3AF 40%, transparent);
}
html.dark .meta-tier-t4 { color: #D1D5DB; }

/* 5티어: 브론즈색 */
.meta-tier-t5 {
  background: color-mix(in srgb, #B87333 20%, transparent);
  color: #92400E;
  border-color: color-mix(in srgb, #B87333 50%, transparent);
}
html.dark .meta-tier-t5 { color: #FDBA74; }

.meta-tier-unk { background: transparent; color: var(--text-soft); border-color: var(--border); font-weight: 500; }

/* ============================================================
 * Mode chips + Map cards (3-step nav)
 * ============================================================ */
.mode-strip {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 18px;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.mode-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px 6px 8px;
  border-radius: 8px;
  background: transparent;
  border: 1px solid transparent;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
}
.mode-icon {
  width: 24px;
  height: 24px;
  object-fit: contain;
  flex-shrink: 0;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.2));
}
.mode-icon-all {
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 16px;
  font-weight: 700;
  flex-shrink: 0;
}
.mode-chip.active .mode-icon-all {
  background: rgba(255,255,255,0.2);
  color: white;
}
.mode-chip:hover { background: var(--surface-2); color: var(--text); }
.mode-chip.active {
  background: var(--accent);
  color: white;
  font-weight: 600;
  box-shadow: 0 2px 8px var(--accent-glow);
}

.map-cards-section { margin-bottom: 24px; }
.map-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}
.map-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  transition: all 0.18s;
  box-shadow: var(--shadow-sm);
  text-align: left;
  padding: 0;
}
.map-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  border-color: var(--accent);
}
.map-card-img {
  width: 100%;
  aspect-ratio: 1 / 1.4;
  object-fit: cover;
  background: var(--surface-2);
  display: block;
}
.map-card-noimg {
  width: 100%;
  aspect-ratio: 1 / 1.4;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  background: linear-gradient(135deg, var(--surface-2), var(--surface));
}
.map-card-body { padding: 10px 12px; }
.map-card-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.map-card-meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
}

.map-detail-section { display: flex; flex-direction: column; gap: 16px; }
.map-detail-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.map-detail-title { flex: 1; min-width: 0; }
.map-detail-title h2 { font-size: 20px; font-weight: 700; margin: 0; letter-spacing: -0.01em; }
.map-detail-title .sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.map-detail-image {
  width: 120px;
  height: 150px;
  border-radius: var(--radius);
  object-fit: cover;
  border: 1px solid var(--border);
  flex-shrink: 0;
}

/* ============================================================
 * Brawler grid (등급별)
 * ============================================================ */
#brawler-grid { display: flex; flex-direction: column; gap: 24px; }
.rarity-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
}
.rarity-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}
.rarity-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  border: 1px solid transparent;
}
.rarity-count {
  font-size: 12px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.rarity-ultra {
  background: linear-gradient(135deg, #14B8A6, #F59E0B, #EC4899);
  color: white;
  border-color: transparent;
  box-shadow: 0 0 14px rgba(236, 72, 153, 0.3);
}
.rarity-legend {
  background: linear-gradient(135deg, #DC2626, #F59E0B);
  color: white;
  border-color: rgba(220, 38, 38, 0.5);
}
.rarity-mythic {
  background: color-mix(in srgb, #9333EA 22%, transparent);
  color: #7E22CE;
  border-color: color-mix(in srgb, #9333EA 50%, transparent);
}
html.dark .rarity-mythic { color: #C084FC; }
.rarity-epic {
  background: color-mix(in srgb, #D850FF 18%, transparent);
  color: #A21CAF;
  border-color: color-mix(in srgb, #D850FF 45%, transparent);
}
html.dark .rarity-epic { color: #E879F9; }
.rarity-srare {
  background: color-mix(in srgb, #3B82F6 18%, transparent);
  color: #1D4ED8;
  border-color: color-mix(in srgb, #3B82F6 45%, transparent);
}
html.dark .rarity-srare { color: #93C5FD; }
.rarity-rare {
  background: color-mix(in srgb, #14B8A6 18%, transparent);
  color: #0F766E;
  border-color: color-mix(in srgb, #14B8A6 45%, transparent);
}
html.dark .rarity-rare { color: #5EEAD4; }
.rarity-common {
  background: var(--surface-2);
  color: var(--text-muted);
  border-color: var(--border-strong);
}

.brawler-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}
.brawler-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius);
  background: var(--surface-2);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.15s;
}
.brawler-card:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}
.bc-img {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  border-radius: 10px;
  overflow: hidden;
  background: var(--surface);
}
.bc-img img { width: 100%; height: 100%; object-fit: cover; }
.bc-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.bc-name { font-weight: 600; font-size: 13px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 4px; }
.bc-en { font-size: 10px; color: var(--text-soft); font-family: 'JetBrains Mono', monospace; text-transform: uppercase; letter-spacing: 0.04em; }
.bc-meta { display: flex; align-items: center; gap: 6px; margin-top: 2px; }
.bc-class { font-size: 10px; color: var(--text-muted); }
.bc-stats { display: flex; gap: 8px; font-size: 11px; color: var(--text-muted); margin-top: 4px; font-variant-numeric: tabular-nums; }
.bc-stats .wr-elite { color: var(--elite); font-weight: 700; }
.bc-stats .wr-pos { color: var(--positive); font-weight: 600; }
.bc-stats .wr-neg { color: var(--negative); font-weight: 600; }
.joker-mini {
  width: 16px;
  height: 16px;
  object-fit: contain;
  vertical-align: middle;
  margin-left: 2px;
}

/* 조커픽 배지 */
.joker-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}
.joker-badge img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* ============================================================
 * Search
 * ============================================================ */
.search-card { margin-bottom: 16px; padding: 16px 18px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.search-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: background 0.12s;
  background: var(--surface);
}
.search-row:last-child { border-bottom: none; }
.search-row:hover { background: var(--surface-2); }

/* ============================================================
 * Profile dialog
 * ============================================================ */
.dialog {
  border-radius: var(--radius-xl);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  padding: 0;
  max-width: 760px;
  width: 92%;
  box-shadow: var(--shadow-xl);
}
.dialog::backdrop { background: rgba(0, 0, 0, 0.5); backdrop-filter: blur(4px); }

.profile-hero {
  position: relative;
  padding: 28px 28px 24px;
  display: flex;
  align-items: center;
  gap: 20px;
  border-bottom: 1px solid var(--border);
  background:
    radial-gradient(circle at 0% 0%, color-mix(in srgb, var(--accent) 8%, transparent), transparent 50%),
    radial-gradient(circle at 100% 0%, rgba(139, 92, 246, 0.05), transparent 50%);
}
.profile-icon-wrap {
  width: 80px;
  height: 80px;
  border-radius: 20px;
  overflow: hidden;
  flex-shrink: 0;
  background: linear-gradient(135deg, var(--accent), #B5559E);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  display: flex; align-items: center; justify-content: center;
}
.profile-icon-img { width: 100%; height: 100%; object-fit: cover; }
.profile-icon-fallback { font-size: 36px; font-weight: 700; color: white; }

.profile-name { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; margin: 0; color: var(--text); }
.profile-meta {
  display: flex; align-items: center; gap: 10px; margin-top: 6px;
  font-size: 12px; color: var(--text-muted);
}
.profile-meta .dot { display: inline-block; width: 3px; height: 3px; border-radius: 50%; background: var(--border-strong); }
.profile-club { color: var(--text); font-weight: 500; }
.profile-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.profile-fav-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 14px;
  height: 36px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid var(--border);
  color: var(--text);
  background: var(--surface);
  cursor: pointer;
  transition: all 0.15s;
}
.profile-fav-btn:hover { background: var(--surface-hover); border-color: var(--border-strong); }
.profile-fav-btn.on {
  background: linear-gradient(135deg, color-mix(in srgb, var(--warning) 14%, transparent), color-mix(in srgb, var(--warning) 6%, transparent));
  border-color: color-mix(in srgb, var(--warning) 50%, transparent);
  color: var(--warning);
}
.profile-fav-btn.icon-only {
  padding: 0;
  width: 36px;
  justify-content: center;
}

.profile-tier-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 20px 28px 4px; }
.profile-tier-card {
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  display: flex; align-items: center; gap: 14px;
}
.profile-tier-card.highest { border-color: color-mix(in srgb, var(--warning) 30%, transparent); background: color-mix(in srgb, var(--warning) 5%, var(--surface-2)); }
.profile-tier-card .t-label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); font-weight: 600; min-width: 60px; }
.profile-tier-card .t-badge { flex: 1; }
.profile-tier-card .t-meta { font-size: 11px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.profile-tier-card .t-meta b { color: var(--text); font-weight: 600; }

.profile-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; padding: 14px 28px; }
.profile-stat { border: 1px solid var(--border); background: var(--surface-2); border-radius: var(--radius); padding: 10px 12px; }
.profile-stat .l { font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); font-weight: 600; }
.profile-stat .v { font-size: 18px; font-weight: 700; color: var(--text); margin-top: 2px; font-variant-numeric: tabular-nums; }
.profile-stat .v.amber { color: var(--warning); }

.profile-wins { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; padding: 0 28px 14px; }
.win-card {
  padding: 10px 14px;
  border-radius: var(--radius);
  background: var(--positive-soft);
  border: 1px solid color-mix(in srgb, var(--positive) 30%, transparent);
}
.win-card .l { font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--positive); font-weight: 600; }
.win-card .v { font-size: 18px; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }

.profile-brawlers { padding: 14px 28px 28px; }
.profile-brawlers > .label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); font-weight: 600; margin-bottom: 8px; }
.profile-brawler {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius);
  background: var(--surface-2);
  border: 1px solid var(--border);
  transition: all 0.15s;
}
.profile-brawler:hover { border-color: var(--accent); transform: translateY(-1px); }
.profile-brawler img { width: 36px; height: 36px; border-radius: 8px; flex-shrink: 0; }

/* ============================================================
 * Footer
 * ============================================================ */
.app-footer {
  max-width: 1600px;
  margin: 24px auto 0;
  padding: 20px 28px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 11px;
  color: var(--text-muted);
}
.app-footer code { font-size: 11px; color: var(--text); background: var(--surface-2); padding: 2px 6px; border-radius: 4px; }

/* ============================================================
 * Toast
 * ============================================================ */
#toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 50;
  padding: 12px 16px;
  border-radius: var(--radius);
  background: var(--text);
  color: var(--bg);
  font-size: 13px;
  box-shadow: var(--shadow-xl);
  opacity: 0;
  transform: translateY(8px);
  transition: all 0.18s;
  pointer-events: none;
  max-width: 380px;
}
#toast.show { opacity: 1; transform: translateY(0); }

/* ============================================================
 * Misc
 * ============================================================ */
.spin { animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeIn { 0% { opacity: 0; } 100% { opacity: 1; } }
.animate-fade-in { animation: fadeIn 0.25s ease; }

/* Scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 5px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--text-soft); }

/* Favorites dialog */
.pros-add { display: grid; grid-template-columns: 1.3fr 1fr 0.7fr 1.3fr auto; gap: 8px; margin-bottom: 16px; }
.pros-table { width: 100%; border-collapse: collapse; }
.pros-table th { padding: 8px 12px; text-align: left; font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); font-weight: 600; background: var(--surface-2); border-bottom: 1px solid var(--border); }
.pros-table td { padding: 10px 12px; border-bottom: 1px solid var(--border-subtle); font-size: 13px; }
.pros-table tr:last-child td { border-bottom: none; }

/* ============================================================
 * Tier advanced filter panel
 * ============================================================ */
.tier-advanced {
  margin-top: 16px; padding-top: 16px;
  border-top: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 16px;
}
.tier-advanced.hidden { display: none; }
.advanced-section {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 10px; padding: 12px 14px;
}
.advanced-section-title {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-muted); font-weight: 600; margin-bottom: 10px;
}
.advanced-hint {
  font-size: 11px; color: var(--text-soft); margin-top: 6px;
}
.country-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 6px;
}
.country-chk {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 10px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; font-size: 12px; cursor: pointer;
  transition: background 0.12s, border 0.12s;
}
.country-chk:hover { background: var(--surface-hover); }
.country-chk input { margin: 0; cursor: pointer; }
.country-chk:has(input:checked) {
  background: var(--accent-soft); border-color: var(--accent);
}
.country-chk span:first-of-type { flex: 1; }
.country-code {
  font-family: 'JetBrains Mono', monospace; font-size: 10px;
  color: var(--text-soft); font-weight: 600;
}

/* ============================================================
 * Brawler sort toggle (segmented control)
 * ============================================================ */
.brawler-sort-toggle {
  display: inline-flex; gap: 0; padding: 2px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 8px; margin-left: auto;
}
.brawler-sort-toggle .bs-btn {
  font-size: 12px; font-weight: 500; padding: 6px 12px;
  background: transparent; border: none; border-radius: 6px;
  color: var(--text-muted); cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.brawler-sort-toggle .bs-btn:hover { color: var(--text); }
.brawler-sort-toggle .bs-btn.active {
  background: var(--surface); color: var(--text);
  box-shadow: var(--shadow-sm);
}

/* 클래스별 pill 색상 */
.class-pill-dd      { background: rgba(217, 119, 87, 0.15); color: var(--accent); border: 1px solid rgba(217, 119, 87, 0.3); }
.class-pill-tank    { background: rgba(120, 70, 50, 0.18); color: #C26242; border: 1px solid rgba(120, 70, 50, 0.35); }
.class-pill-marks   { background: rgba(180, 130, 40, 0.18); color: #B8860B; border: 1px solid rgba(180, 130, 40, 0.35); }
.class-pill-assassin{ background: rgba(160, 50, 70, 0.18); color: var(--negative); border: 1px solid rgba(160, 50, 70, 0.35); }
.class-pill-control { background: rgba(80, 100, 180, 0.18); color: #4A6FB4; border: 1px solid rgba(80, 100, 180, 0.35); }
.class-pill-support { background: rgba(47, 122, 75, 0.18); color: var(--positive); border: 1px solid rgba(47, 122, 75, 0.35); }
.class-pill-art     { background: rgba(120, 90, 140, 0.18); color: #8A6BAE; border: 1px solid rgba(120, 90, 140, 0.35); }
.class-pill-unk     { background: var(--surface-2); color: var(--text-muted); border: 1px solid var(--border); }

/* ============================================================
 * Counter analysis modal
 * ============================================================ */
.tier-row { cursor: pointer; transition: background 0.12s; }
.tier-row:hover { background: var(--surface-hover); }

.counter-hero-img {
  width: 56px; height: 56px; border-radius: 14px;
  object-fit: contain; background: var(--surface-2);
  padding: 4px; flex-shrink: 0;
}
.counter-sub {
  font-size: 12px; color: var(--text-muted); font-weight: 500;
  margin-left: 6px;
}

.counter-summary {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px;
  padding: 18px 24px; background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.cs-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 12px 14px;
}
.cs-label {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-muted); font-weight: 600; margin-bottom: 6px;
}
.cs-value {
  font-size: 22px; font-weight: 700; font-family: 'JetBrains Mono', monospace;
  color: var(--text); line-height: 1.1;
}
.cs-value.wr-elite { color: var(--elite); }
.cs-value.wr-pos { color: var(--positive); }
.cs-value.wr-neg { color: var(--negative); }
.cs-value.wr-neu { color: var(--text); }
.cs-hint {
  font-size: 11px; color: var(--text-muted); margin-top: 4px;
}
.cs-top3 { display: flex; flex-direction: column; gap: 4px; margin-top: 2px; }
.cs-top3-row { display: flex; align-items: center; gap: 6px; font-size: 12px; }
.cs-top3-row img { width: 22px; height: 22px; border-radius: 6px; object-fit: contain; background: var(--surface-2); padding: 1px; flex-shrink: 0; }
.cs-top3-name { flex: 1; min-width: 0; color: var(--text); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cs-top3-wr { font-family: 'JetBrains Mono', monospace; font-weight: 700; font-size: 11px; }
.cs-top3-wr.wr-elite { color: var(--elite); }
.cs-top3-wr.wr-pos { color: var(--positive); }
.cs-top3-wr.wr-neg { color: var(--negative); }
.cs-top3-wr.wr-neu { color: var(--text-muted); }

.matchup-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
  padding: 20px 24px;
}
.matchup-col {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; overflow: hidden;
}
.matchup-col-head {
  font-size: 12px; font-weight: 600; padding: 12px 14px;
  background: var(--surface-2); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 6px;
}
.matchup-col-icon { font-size: 11px; font-weight: 700; }
.matchup-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 14px; border-bottom: 1px solid var(--border-subtle);
}
.matchup-row:last-child { border-bottom: none; }
.matchup-img {
  width: 36px; height: 36px; border-radius: 8px;
  object-fit: contain; background: var(--surface-2); padding: 2px;
  flex-shrink: 0;
}
.matchup-name { flex: 1; min-width: 0; }
.matchup-name > div:first-child {
  font-size: 13px; font-weight: 500; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.matchup-en {
  font-size: 10px; color: var(--text-soft);
  font-family: 'JetBrains Mono', monospace;
  text-transform: uppercase; letter-spacing: 0.04em;
}
.matchup-stats {
  display: flex; flex-direction: column; align-items: flex-end; gap: 1px;
  font-variant-numeric: tabular-nums;
}
.matchup-wr {
  font-size: 13px; font-weight: 700; font-family: 'JetBrains Mono', monospace;
}
.matchup-wr.wr-elite { color: var(--elite); }
.matchup-wr.wr-pos { color: var(--positive); }
.matchup-wr.wr-neg { color: var(--negative); }
.matchup-wr.wr-neu { color: var(--text); }
.matchup-delta {
  font-size: 10px; color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
}
.matchup-count {
  font-size: 10px; color: var(--text-soft);
  font-family: 'JetBrains Mono', monospace;
}

/* 맵 성능 row */
.map-perf-row {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 14px; border-bottom: 1px solid var(--border-subtle);
}
.map-perf-row:last-child { border-bottom: none; }
.map-perf-img {
  width: 32px; height: 48px; object-fit: cover;
  border-radius: 6px; background: var(--surface-2);
  flex-shrink: 0;
}
.map-perf-noimg {
  width: 32px; height: 48px; display: flex; align-items: center; justify-content: center;
  background: var(--surface-2); border-radius: 6px; font-size: 18px; flex-shrink: 0;
}
.map-perf-name { flex: 1; min-width: 0; }
.map-perf-name > div:first-child {
  font-size: 13px; font-weight: 500; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.map-perf-mode {
  font-size: 10px; color: var(--text-soft);
}
.map-perf-stats {
  display: flex; flex-direction: column; align-items: flex-end; gap: 1px;
  font-variant-numeric: tabular-nums;
}

.map-sort-toggle {
  display: inline-flex; gap: 0; padding: 2px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 6px;
}
.map-sort-toggle .ms-btn {
  font-size: 11px; padding: 4px 10px;
  background: transparent; border: none; border-radius: 4px;
  color: var(--text-muted); cursor: pointer; font-weight: 500;
}
.map-sort-toggle .ms-btn:hover { color: var(--text); }
.map-sort-toggle .ms-btn.active {
  background: var(--surface-2); color: var(--text);
}

#counter-dialog::backdrop { background: rgba(0,0,0,0.4); }
#counter-dialog {
  max-width: 760px; width: calc(100% - 32px);
  max-height: 85vh; overflow: hidden;
  padding: 0; border: 1px solid var(--border);
  border-radius: 14px; background: var(--bg-elevated);
  color: var(--text);
}
#counter-dialog .dialog-inner {
  display: flex; flex-direction: column;
  max-height: 85vh; overflow-y: auto;
}

@media (max-width: 640px) {
  .counter-summary { grid-template-columns: 1fr; }
  .matchup-grid { grid-template-columns: 1fr; }
}

/* ============ 플레이어 분석 (프로필 모달 내) ============ */
.ps-summary {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
  margin-top: 14px;
}
.ps-card {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 10px; padding: 10px 12px; text-align: center;
}
.ps-card .l { font-size: 11px; color: var(--text-muted); margin-bottom: 4px; }
.ps-card .v { font-size: 16px; font-weight: 700; color: var(--text); }

.ps-section-title {
  font-size: 12px; font-weight: 600; color: var(--text-muted);
  margin-top: 18px; margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.5px;
}

.ps-brawler-list {
  display: flex; flex-direction: column; gap: 4px;
}
.ps-brawler-row {
  display: grid; grid-template-columns: 40px 1fr 80px 80px; gap: 12px;
  align-items: center; padding: 8px 10px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px;
}
.ps-brawler-row img { width: 40px; height: 40px; border-radius: 6px; object-fit: cover; }
.ps-brawler-info { min-width: 0; }
.ps-brawler-name { font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.ps-brawler-bar { height: 4px; background: var(--surface-3, rgba(0,0,0,0.1)); border-radius: 2px; overflow: hidden; }
.ps-brawler-bar-fill { height: 100%; background: var(--accent, #3b82f6); transition: width 0.3s; }
.ps-stat-cell { text-align: right; }
.ps-stat-label { font-size: 10px; color: var(--text-muted); }
.ps-stat-val { font-size: 13px; font-weight: 600; color: var(--text); }
.ps-stat-sub { font-size: 10px; color: var(--text-muted); margin-left: 4px; font-weight: 400; }

.ps-mode-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px;
}
.ps-mode-card {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 8px; padding: 10px;
}
.ps-mode-name { font-size: 12px; color: var(--text); font-weight: 600; margin-bottom: 4px; }
.ps-mode-stats { display: flex; justify-content: space-between; font-size: 12px; }
.ps-mode-picks { color: var(--text-muted); }
.ps-mode-wr { font-weight: 600; }

.profile-analyze .btn { margin: 12px 0; }
