@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;700&display=swap');

/* ── Reset ──────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ── Design Tokens ──────────────────────────────────────── */
:root {
  /* Backgrounds */
  --bg-base:        #050812;
  --bg-surface:     #0d1117;
  --bg-elevated:    #131929;
  --bg-overlay:     #161b27;
  --bg-hover:       rgba(108, 99, 255, 0.06);
  --bg-active:      rgba(108, 99, 255, 0.12);

  /* Accents */
  --accent:         #6c63ff;
  --accent-light:   #8b85ff;
  --accent-dark:    #4f47d4;
  --accent-glow:    rgba(108, 99, 255, 0.35);
  --accent-bg:      rgba(108, 99, 255, 0.10);
  --neon:           #00f5d4;
  --neon-glow:      rgba(0, 245, 212, 0.30);
  --neon-bg:        rgba(0, 245, 212, 0.08);

  /* Borders */
  --border:         rgba(108, 99, 255, 0.15);
  --border-subtle:  rgba(255, 255, 255, 0.06);
  --border-strong:  rgba(108, 99, 255, 0.35);

  /* Text */
  --text:           #e8eaf0;
  --text-muted:     #7a8098;
  --text-faint:     #4a5070;

  /* Semantic */
  --success:        #22d98a;
  --success-bg:     rgba(34, 217, 138, 0.10);
  --danger:         #ff4d6a;
  --danger-bg:      rgba(255, 77, 106, 0.10);
  --warning:        #f0b429;
  --warning-bg:     rgba(240, 180, 41, 0.10);
  --gold:           #f0b429;
  --gold-bg:        rgba(240, 180, 41, 0.10);
  --silver:         #a0b4cc;
  --bronze:         #c87840;

  /* Typography */
  --font:           "Inter", system-ui, -apple-system, sans-serif;
  --font-mono:      "JetBrains Mono", "Cascadia Code", "Fira Code", monospace;

  /* Text scale */
  --text-xs:        11px;
  --text-sm:        12px;
  --text-base:      14px;
  --text-md:        15px;
  --text-lg:        17px;
  --text-xl:        20px;
  --text-2xl:       26px;
  --text-3xl:       32px;

  /* Spacing (4px grid) */
  --space-1:        4px;
  --space-2:        8px;
  --space-3:        12px;
  --space-4:        16px;
  --space-5:        20px;
  --space-6:        24px;
  --space-8:        32px;
  --space-10:       40px;
  --space-12:       48px;

  /* Shape */
  --radius-sm:      6px;
  --radius:         10px;
  --radius-lg:      14px;
  --radius-xl:      20px;
  --radius-full:    9999px;

  /* Transitions */
  --transition:     0.18s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow:0.3s cubic-bezier(0.4, 0, 0.2, 1);

  /* Sidebar */
  --sidebar-width:  220px;
  --topbar-height:  56px;
}

/* ── Base ───────────────────────────────────────────────── */
html, body {
  height: 100%;
}

body {
  font-family: var(--font);
  background: var(--bg-base);
  color: var(--text);
  font-size: var(--text-base);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--accent-light);
  text-decoration: none;
}

a:hover {
  color: var(--neon);
}

/* ── Top Brand Bar ──────────────────────────────────────── */
.top-brand {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--topbar-height);
  background: rgba(5, 8, 18, 0.92);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-5);
  z-index: 100;
}

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

.top-brand-icon {
  width: 28px;
  height: 28px;
  color: var(--accent);
  filter: drop-shadow(0 0 8px var(--accent-glow));
}

.top-brand-text {
  display: flex;
  align-items: baseline;
  gap: 5px;
}

.top-brand-name {
  font-size: var(--text-lg);
  font-weight: 800;
  color: var(--text);
  letter-spacing: 0.5px;
}

.top-brand-sub {
  font-size: var(--text-md);
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.5px;
}

/* API Status in topbar */
.api-status {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-3);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: var(--transition);
}

.api-status:hover {
  border-color: var(--border-strong);
  background: var(--bg-elevated);
}

.api-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-faint);
  transition: var(--transition);
}

.api-dot.ok   { background: var(--success); box-shadow: 0 0 6px var(--success); }
.api-dot.warn { background: var(--warning); box-shadow: 0 0 6px var(--warning); }
.api-dot.err  { background: var(--danger);  box-shadow: 0 0 6px var(--danger);  }

.api-label {
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

/* ── App Shell ──────────────────────────────────────────── */
.app-shell {
  display: flex;
  padding-top: var(--topbar-height);
  min-height: 100vh;
}

/* ── Sidebar ────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  position: fixed;
  top: var(--topbar-height);
  left: 0;
  bottom: 0;
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 50;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.sidebar-nav {
  padding: var(--space-3) var(--space-2);
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.nav-section-label {
  padding: var(--space-4) var(--space-3) var(--space-2);
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--text-faint);
  letter-spacing: 1.2px;
  text-transform: uppercase;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius);
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font);
  font-size: var(--text-base);
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  width: 100%;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-item svg {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
  transition: var(--transition);
}

.nav-item:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.nav-item.is-active {
  background: var(--accent-bg);
  color: var(--accent-light);
  font-weight: 600;
}

.nav-item.is-active svg {
  color: var(--accent);
  filter: drop-shadow(0 0 5px var(--accent-glow));
}

/* ── Content Area ───────────────────────────────────────── */
.content-area {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding: var(--space-6) var(--space-8);
  max-width: 1400px;
  min-height: calc(100vh - var(--topbar-height));
}

/* ── Tabs ───────────────────────────────────────────────── */
.tab {
  display: none;
  animation: tabFadeIn 0.2s ease;
}

.tab.is-active {
  display: block;
}

@keyframes tabFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Page Header ────────────────────────────────────────── */
.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-5);
}

.page-meta h1 {
  font-size: var(--text-2xl);
  font-weight: 800;
  color: var(--text);
  line-height: 1.2;
}

.page-meta p {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-top: 3px;
}

/* ── Card ───────────────────────────────────────────────── */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  margin-bottom: var(--space-5);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding-bottom: var(--space-4);
  margin-bottom: var(--space-4);
  border-bottom: 1px solid var(--border-subtle);
}

.card-header h2,
.card-header h3 {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--text);
}

.card-body {}

/* ── Buttons ────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 7px var(--space-4);
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-family: var(--font);
  font-size: var(--text-base);
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  text-decoration: none;
}

.btn svg {
  width: 15px;
  height: 15px;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.btn-primary:hover {
  background: var(--accent-light);
  border-color: var(--accent-light);
  box-shadow: 0 0 16px var(--accent-glow);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: var(--border);
}

.btn-ghost:hover {
  background: var(--bg-elevated);
  color: var(--text);
  border-color: var(--border-strong);
}

.btn-neon {
  background: var(--neon-bg);
  color: var(--neon);
  border-color: rgba(0, 245, 212, 0.3);
}

.btn-neon:hover {
  background: rgba(0, 245, 212, 0.15);
  box-shadow: 0 0 16px var(--neon-glow);
}

.btn-sm {
  padding: 4px var(--space-3);
  font-size: var(--text-sm);
}

.btn-lg {
  padding: 11px var(--space-6);
  font-size: var(--text-md);
}

/* ── Form Controls ──────────────────────────────────────── */
.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.field label {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.input,
.select {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--text-base);
  padding: 7px var(--space-3);
  outline: none;
  transition: var(--transition);
  -webkit-appearance: none;
  appearance: none;
}

.select {
  padding-right: var(--space-8);
  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='%237a8098' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  cursor: pointer;
}

.input:focus,
.select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-bg);
}

.input:disabled,
.select:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.input::placeholder {
  color: var(--text-faint);
}

.w-20 { width: 80px; }
.w-40 { width: 160px; }
.ml-auto { margin-left: auto; }

/* ── Badges ─────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.4px;
  line-height: 1.6;
}

.badge-success, .b-ok {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid rgba(34, 217, 138, 0.25);
}

.badge-danger {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid rgba(255, 77, 106, 0.25);
}

.badge-warning, .b-check {
  background: var(--warning-bg);
  color: var(--warning);
  border: 1px solid rgba(240, 180, 41, 0.25);
}

.badge-accent {
  background: var(--accent-bg);
  color: var(--accent-light);
  border: 1px solid rgba(108, 99, 255, 0.25);
}

.badge-neon {
  background: var(--neon-bg);
  color: var(--neon);
  border: 1px solid rgba(0, 245, 212, 0.25);
}

.b-early {
  background: rgba(108, 99, 255, 0.12);
  color: var(--accent-light);
  border: 1px solid rgba(108, 99, 255, 0.25);
}

.b-mid {
  background: var(--neon-bg);
  color: var(--neon);
  border: 1px solid rgba(0, 245, 212, 0.25);
}

.b-late {
  background: var(--danger-bg);
  color: #ff7088;
  border: 1px solid rgba(255, 77, 106, 0.25);
}

/* ── Tables ─────────────────────────────────────────────── */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border-subtle);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

thead th {
  background: var(--bg-elevated);
  color: var(--text-muted);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 1;
}

tbody tr {
  border-bottom: 1px solid var(--border-subtle);
  transition: background var(--transition);
}

tbody tr:last-child {
  border-bottom: none;
}

tbody tr:hover {
  background: var(--bg-hover);
  cursor: pointer;
}

tbody td {
  padding: var(--space-3) var(--space-4);
  color: var(--text);
  vertical-align: middle;
}

.w-14 { width: 56px; }

/* ── Empty State ────────────────────────────────────────── */
.empty-row {
  text-align: center;
  padding: var(--space-10) var(--space-6);
  color: var(--text-faint);
  font-size: var(--text-sm);
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  padding: var(--space-12) var(--space-6);
  text-align: center;
}

.empty-state-icon {
  width: 48px;
  height: 48px;
  color: var(--text-faint);
  margin-bottom: var(--space-2);
}

.empty-state h3 {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--text-muted);
}

.empty-state p {
  font-size: var(--text-sm);
  color: var(--text-faint);
  max-width: 320px;
}

/* ── Skeleton Loader ────────────────────────────────────── */
@keyframes shimmer {
  0%   { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}

.skeleton {
  background: linear-gradient(90deg, var(--bg-elevated) 25%, var(--bg-overlay) 50%, var(--bg-elevated) 75%);
  background-size: 800px 100%;
  animation: shimmer 1.4s ease infinite;
  border-radius: var(--radius-sm);
}

.skeleton-text {
  height: 14px;
  border-radius: var(--radius-sm);
}

.skeleton-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  flex-shrink: 0;
}

.skeleton-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--border-subtle);
}

/* ── Loading Spinner ────────────────────────────────────── */
@keyframes spin {
  to { transform: rotate(360deg); }
}

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

/* ── Home Hero ──────────────────────────────────────────── */
.home-hero {
  margin-bottom: var(--space-6);
}

.home-brand-row {
  margin-bottom: var(--space-5);
}

.home-logo {
  font-size: var(--text-3xl);
  font-weight: 800;
  letter-spacing: 3px;
  background: linear-gradient(135deg, var(--accent-light) 0%, var(--neon) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.1;
  text-transform: uppercase;
}

.home-tagline {
  font-size: var(--text-base);
  color: var(--text-muted);
  margin-top: var(--space-2);
  font-weight: 400;
}

.home-search-wrap {
  display: flex;
  gap: var(--space-2);
  max-width: 560px;
}

.home-search-input {
  flex: 1;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--text-md);
  padding: var(--space-3) var(--space-4);
  outline: none;
  transition: var(--transition);
}

.home-search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-bg), 0 0 20px var(--accent-glow);
}

.home-search-input::placeholder {
  color: var(--text-faint);
}

.home-search-btn {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  border: none;
  border-radius: var(--radius-lg);
  color: #fff;
  cursor: pointer;
  transition: var(--transition);
}

.home-search-btn:hover {
  background: var(--accent-light);
  box-shadow: 0 0 20px var(--accent-glow);
}

.home-search-btn svg {
  width: 20px;
  height: 20px;
}

/* Home status grid */
.home-status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-5);
}

/* Home insights */
.home-insights-card {
  margin-top: var(--space-4);
}

.home-insights-head {
  padding-bottom: var(--space-4);
  margin-bottom: var(--space-4);
  border-bottom: 1px solid var(--border-subtle);
}

.home-insights-head h2 {
  font-size: var(--text-xl);
  font-weight: 700;
}

.home-insights-head p {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-top: 3px;
}

/* ── Health / API Status ────────────────────────────────── */
.compact-health-card { }

.health-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

.health-tile {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
}

.health-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-faint);
  flex-shrink: 0;
  transition: var(--transition);
}

.health-dot.ok   { background: var(--success); box-shadow: 0 0 6px var(--success); }
.health-dot.warn { background: var(--warning); box-shadow: 0 0 6px var(--warning); }
.health-dot.err  { background: var(--danger);  box-shadow: 0 0 6px var(--danger);  }

.health-name {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-muted);
}

.health-meta {
  font-size: var(--text-xs);
  color: var(--text-faint);
  margin-top: var(--space-2);
}

/* ── Player Stats ───────────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.stat-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  padding: var(--space-4);
  text-align: center;
}

.stat-card .stat-value {
  font-size: var(--text-2xl);
  font-weight: 800;
  font-family: var(--font-mono);
  color: var(--text);
  line-height: 1.1;
}

.stat-card .stat-value.accent { color: var(--accent-light); }
.stat-card .stat-value.neon   { color: var(--neon); }
.stat-card .stat-value.gold   { color: var(--gold); }
.stat-card .stat-value.green  { color: var(--success); }
.stat-card .stat-value.red    { color: var(--danger); }

.stat-card .stat-label {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-top: 4px;
}

/* ── History Layout ─────────────────────────────────────── */
.history-layout-card { padding: 0; overflow: hidden; }

.history-layout {
  display: flex;
  min-height: 400px;
}

.history-side {
  width: 280px;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  background: var(--bg-elevated);
}

.history-main {
  flex: 1;
  padding: var(--space-5);
  min-width: 0;
}

.history-profile-head {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.history-avatar {
  width: 48px;
  height: 48px;
  border-radius: var(--radius);
  background: var(--bg-overlay);
  border: 2px solid var(--border);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.history-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

#history-avatar-fallback {
  font-size: var(--text-xl);
  font-weight: 800;
  color: var(--accent);
}

.history-player-title {
  font-size: var(--text-md);
  font-weight: 700;
  color: var(--text);
}

.history-player-sub {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: 2px;
}

.history-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-2);
}

.history-summary-item {
  background: var(--bg-overlay);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  padding: var(--space-3) var(--space-2);
  text-align: center;
}

.history-summary-item span {
  display: block;
  font-size: var(--text-xs);
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}

.history-summary-item strong {
  display: block;
  font-size: var(--text-lg);
  font-weight: 800;
  font-family: var(--font-mono);
  color: var(--text);
  margin-top: 2px;
}

.history-rank-panel,
.history-30d-panel {
  background: var(--bg-overlay);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  padding: var(--space-3);
}

.history-rank-panel-head,
.history-30d-head {
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: var(--space-2);
}

.history-rank-panel-body {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.history-rank-panel-icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-xl);
  font-weight: 800;
  color: var(--gold);
}

.history-rank-panel-icon img {
  width: 36px;
  height: 36px;
  object-fit: contain;
}

.history-rank-panel-meta strong {
  display: block;
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--text);
}

.history-rank-panel-meta small {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.history-30d-body {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
}

.history-30d-body strong {
  font-size: var(--text-2xl);
  font-weight: 800;
  font-family: var(--font-mono);
  color: var(--neon);
}

.history-30d-body small {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.history-10000-duration {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-3);
  padding-top: var(--space-3);
  border-top: 1px solid var(--border-subtle);
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.history-10000-duration strong {
  font-family: var(--font-mono);
  color: var(--text);
}

.history-10000-duration-ranks {
  margin-top: var(--space-2);
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.history-30d-hero-empty {
  color: var(--text-faint);
  font-size: var(--text-xs);
}

.history-30d-heroes {
  margin-top: var(--space-3);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.history-side-actions {
  display: flex;
  gap: var(--space-2);
}

.history-player-chip {
  background: var(--accent-bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: var(--space-2) var(--space-3);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.history-player-chip span {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--accent-light);
}

.history-player-chip small {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.history-main-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}

.history-main-head h2 {
  font-size: var(--text-xl);
  font-weight: 700;
}

.history-main-filters {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.history-hero-filter {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--text-sm);
  padding: 5px var(--space-3);
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

.history-hint {
  padding: var(--space-3) var(--space-4);
  background: rgba(240, 180, 41, 0.06);
  border: 1px solid rgba(240, 180, 41, 0.2);
  border-radius: var(--radius);
  font-size: var(--text-sm);
  color: var(--warning);
  margin-bottom: var(--space-4);
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.history-load-more-wrap {
  display: flex;
  justify-content: center;
  margin-top: var(--space-4);
}

/* Match Row */
.match-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  cursor: pointer;
  transition: var(--transition);
}

.match-row:hover {
  background: var(--bg-hover);
  border-color: var(--border);
}

.match-row.win  { border-left: 3px solid var(--success); }
.match-row.loss { border-left: 3px solid var(--danger); }

.match-hero-img {
  width: 40px;
  height: 40px;
  border-radius: var(--radius);
  object-fit: cover;
  background: var(--bg-overlay);
  flex-shrink: 0;
}

.match-result {
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  min-width: 36px;
}

.match-result.win  { color: var(--success); }
.match-result.loss { color: var(--danger); }

.match-hero-name {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--text);
  min-width: 100px;
}

.match-kda {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--text-muted);
  min-width: 80px;
}

.match-duration {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--text-faint);
  margin-left: auto;
}

.match-date {
  font-size: var(--text-xs);
  color: var(--text-faint);
  min-width: 60px;
  text-align: right;
}

/* ── Tier List ──────────────────────────────────────────── */
.tierlist-grid {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.tier-row {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-3) var(--space-4);
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
}

.tier-label {
  font-size: var(--text-xl);
  font-weight: 800;
  width: 28px;
  text-align: center;
  flex-shrink: 0;
}

.tier-label.S { color: #ff6b9d; }
.tier-label.A { color: var(--warning); }
.tier-label.B { color: var(--success); }
.tier-label.C { color: var(--accent-light); }
.tier-label.D { color: var(--text-muted); }

.tier-heroes {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.hero-chip {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-3);
  background: var(--bg-overlay);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: var(--transition);
}

.hero-chip:hover {
  background: var(--bg-hover);
  border-color: var(--border);
}

.hero-chip img {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
}

.hero-chip-name {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text);
}

.hero-chip-wr {
  font-size: var(--text-xs);
  font-family: var(--font-mono);
  color: var(--text-muted);
}

/* ── Builds ─────────────────────────────────────────────── */
.builds-status {
  font-size: var(--text-sm);
  color: var(--text-muted);
  padding: var(--space-2) 0;
  margin-bottom: var(--space-3);
}

.builds-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-4);
}

.build-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  padding: var(--space-4);
  transition: var(--transition);
}

.build-card:hover {
  border-color: var(--border);
  background: var(--bg-overlay);
}

.build-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-3);
}

.build-card-title {
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--text);
}

.build-items {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
}

.build-item-img {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  background: var(--bg-overlay);
  border: 1px solid var(--border-subtle);
}

/* ── Compositions ───────────────────────────────────────── */
.composition-grid {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.composition-row {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-3) var(--space-4);
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  cursor: pointer;
  transition: var(--transition);
}

.composition-row:hover {
  background: var(--bg-hover);
  border-color: var(--border);
}

.comp-rank {
  font-size: var(--text-sm);
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text-muted);
  min-width: 24px;
}

.comp-heroes {
  display: flex;
  gap: var(--space-1);
}

.comp-hero-img {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  border: 1px solid var(--border-subtle);
}

.comp-winrate {
  font-family: var(--font-mono);
  font-size: var(--text-md);
  font-weight: 700;
  color: var(--neon);
  margin-left: auto;
}

.comp-games {
  font-size: var(--text-xs);
  color: var(--text-faint);
  font-family: var(--font-mono);
}

/* ── Guide ──────────────────────────────────────────────── */
.guide-content h3 {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--text);
  margin: var(--space-6) 0 var(--space-3);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--border-subtle);
}

.guide-content h3:first-child {
  margin-top: 0;
}

.guide-content > p {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-bottom: var(--space-4);
}

.guide-timing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--space-3);
  margin-bottom: var(--space-6);
}

.guide-timing-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  transition: var(--transition);
}

.guide-timing-card:hover {
  border-color: var(--border);
  background: var(--bg-overlay);
}

.guide-time {
  font-size: var(--text-2xl);
  font-weight: 800;
  font-family: var(--font-mono);
  color: var(--accent-light);
  line-height: 1;
}

.guide-label {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--text);
  margin-top: 2px;
}

.guide-sub {
  font-size: var(--text-xs);
  color: var(--text-muted);
  line-height: 1.4;
  flex: 1;
}

.toolbar {
  margin-bottom: var(--space-3);
}

.guide-playbook-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: var(--space-4);
  margin-top: var(--space-4);
}

.guide-playbook-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  padding: var(--space-4);
}

.guide-playbook-card.early { border-top: 3px solid var(--accent); }
.guide-playbook-card.mid   { border-top: 3px solid var(--neon); }
.guide-playbook-card.late  { border-top: 3px solid var(--danger); }

.guide-playbook-head h4 {
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--text);
  margin-bottom: var(--space-3);
}

.guide-playbook-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.guide-playbook-list li {
  display: flex;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.guide-playbook-list li::before {
  content: "›";
  color: var(--accent-light);
  flex-shrink: 0;
  font-weight: 700;
}

/* ── Scout / Item Analysis ──────────────────────────────── */
.scout-layout {
  display: flex;
  gap: var(--space-5);
}

.scout-filters {
  width: 260px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.scout-results {
  flex: 1;
  min-width: 0;
}

/* ── Shop Simulator ─────────────────────────────────────── */
.shop-layout {
  display: flex;
  gap: var(--space-5);
}

.shop-panel {
  flex: 1;
  min-width: 0;
}

.shop-inventory {
  width: 300px;
  flex-shrink: 0;
}

.shop-souls-bar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: var(--space-4);
}

.shop-souls-label {
  font-size: var(--text-sm);
  color: var(--text-muted);
  font-weight: 600;
}

.shop-souls-value {
  font-family: var(--font-mono);
  font-size: var(--text-xl);
  font-weight: 800;
  color: var(--gold);
}

.shop-item-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
  gap: var(--space-2);
}

.shop-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: var(--space-2);
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  cursor: pointer;
  transition: var(--transition);
}

.shop-item:hover {
  background: var(--bg-hover);
  border-color: var(--border);
}

.shop-item img {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: var(--radius-sm);
}

.shop-item-cost {
  font-size: var(--text-xs);
  font-family: var(--font-mono);
  color: var(--gold);
  font-weight: 600;
}

/* ── Modal ──────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 8, 18, 0.85);
  backdrop-filter: blur(8px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  animation: modalFadeIn 0.2s ease;
}

@keyframes modalFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.modal {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 860px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalSlideIn 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6), 0 0 0 1px var(--border);
}

@keyframes modalSlideIn {
  from { opacity: 0; transform: translateY(16px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg-surface);
  z-index: 1;
  flex-shrink: 0;
}

.modal-hero-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius);
  object-fit: cover;
  border: 2px solid var(--border);
}

.modal-header-info {
  flex: 1;
  min-width: 0;
}

.modal-hero-name {
  font-size: var(--text-xl);
  font-weight: 800;
  color: var(--text);
  line-height: 1.2;
}

.modal-match-meta {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-top: 2px;
}

.modal-result-badge {
  font-size: var(--text-sm);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 5px 14px;
  border-radius: var(--radius-full);
}

.modal-result-badge.win  { background: var(--success-bg); color: var(--success); border: 1px solid rgba(34,217,138,0.3); }
.modal-result-badge.loss { background: var(--danger-bg);  color: var(--danger);  border: 1px solid rgba(255,77,106,0.3); }

.modal-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
  flex-shrink: 0;
}

.modal-close:hover {
  background: var(--danger-bg);
  border-color: var(--danger);
  color: var(--danger);
}

.modal-close svg {
  width: 16px;
  height: 16px;
}

.modal-tabs {
  display: flex;
  gap: 2px;
  padding: var(--space-2) var(--space-6);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none;
  background: var(--bg-surface);
  flex-shrink: 0;
}

.modal-tabs::-webkit-scrollbar { display: none; }

.modal-tab-btn {
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius);
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font);
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.modal-tab-btn:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.modal-tab-btn.is-active {
  background: var(--accent-bg);
  color: var(--accent-light);
}

.modal-body {
  overflow-y: auto;
  padding: var(--space-5) var(--space-6);
  flex: 1;
}

.modal-tab-panel {
  display: none;
}

.modal-tab-panel.is-active {
  display: block;
  animation: tabFadeIn 0.15s ease;
}

/* ── Leaderboard Rank Badges ────────────────────────────── */
.rank-1 td:first-child { color: var(--gold); font-weight: 800; }
.rank-2 td:first-child { color: var(--silver); font-weight: 700; }
.rank-3 td:first-child { color: var(--bronze); font-weight: 700; }

/* ── Coaching Section ───────────────────────────────────── */
.coaching-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: var(--space-4);
}

.coaching-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  padding: var(--space-4);
}

.coaching-card-head {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

.coaching-card-icon {
  width: 20px;
  height: 20px;
  color: var(--accent);
}

.coaching-card-title {
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--text);
}

.coaching-finding {
  display: flex;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-bottom: var(--space-2);
}

.coaching-finding::before {
  content: "•";
  color: var(--accent-light);
  flex-shrink: 0;
}

/* ── Footer ─────────────────────────────────────────────── */
.footer-area {
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
  padding: var(--space-6) var(--space-8);
  margin-top: var(--space-8);
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-6);
  flex-wrap: wrap;
}

.footer-links {
  display: flex;
  gap: var(--space-4);
}

.footer-link {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: var(--text-sm);
  font-weight: 600;
  text-decoration: none;
  transition: var(--transition);
}

.footer-link:hover {
  background: var(--bg-hover);
  color: var(--text);
  border-color: var(--border-strong);
}

.footer-link svg {
  width: 16px;
  height: 16px;
}

.footer-copy {
  font-size: var(--text-xs);
  color: var(--text-faint);
}

.stream-embed {
  width: 100%;
  aspect-ratio: 16/9;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  overflow: hidden;
  margin-top: var(--space-4);
}

/* ── Search Results Dropdown ────────────────────────────── */
.home-search-wrap {
  position: relative;
}

.search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 4px;
  background: var(--bg-overlay);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  max-height: 300px;
  overflow-y: auto;
  z-index: 1000;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
}

.search-result-item {
  width: 100%;
  border: none;
  background: transparent;
  text-align: left;
  padding: 10px var(--space-4);
  cursor: pointer;
  border-bottom: 1px solid var(--border-subtle);
  transition: background var(--transition);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font);
}

.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover { background: var(--bg-hover); }

.search-result-name  { font-weight: 600; color: var(--text); font-size: var(--text-base); }
.search-result-id    { color: var(--text-muted); font-size: var(--text-xs); margin-left: auto; font-family: var(--font-mono); }
.search-result-empty { padding: var(--space-5) var(--space-4); text-align: center; color: var(--text-muted); font-size: var(--text-sm); }

.search-result-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border);
}

.search-result-avatar-fallback {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-xs);
  color: var(--text-muted);
  font-weight: 700;
}

/* ── Loading Row ────────────────────────────────────────── */
.loading-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  padding: var(--space-8) var(--space-6);
  color: var(--text-muted);
  font-size: var(--text-sm);
}

/* ── Utility ────────────────────────────────────────────── */
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 1024px) {
  .content-area {
    padding: var(--space-5) var(--space-5);
  }
}

@media (max-width: 768px) {
  :root {
    --sidebar-width: 0px;
  }

  .sidebar {
    transform: translateX(-100%);
    transition: transform var(--transition-slow);
    width: 220px;
  }

  .sidebar.is-open {
    transform: translateX(0);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.5);
  }

  .content-area {
    margin-left: 0;
    padding: var(--space-4) var(--space-4);
  }

  .history-layout {
    flex-direction: column;
  }

  .history-side {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .scout-layout,
  .shop-layout {
    flex-direction: column;
  }

  .scout-filters,
  .shop-inventory {
    width: 100%;
  }

  .page-meta h1 {
    font-size: var(--text-xl);
  }

  .home-logo {
    font-size: var(--text-2xl);
  }

  /* Mobile bottom nav */
  .mobile-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(13, 17, 23, 0.96);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
    border-top: 1px solid var(--border);
    z-index: 100;
    padding: var(--space-2) var(--space-2) calc(var(--space-2) + env(safe-area-inset-bottom));
    gap: 2px;
  }

  .mobile-nav-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: var(--space-2) 0;
    border-radius: var(--radius);
    border: none;
    background: transparent;
    color: var(--text-faint);
    font-family: var(--font);
    font-size: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
  }

  .mobile-nav-btn svg {
    width: 20px;
    height: 20px;
  }

  .mobile-nav-btn.is-active {
    color: var(--accent-light);
    background: var(--accent-bg);
  }

  .content-area {
    padding-bottom: 80px;
  }
}

@media (max-width: 480px) {
  .modal {
    border-radius: var(--radius-lg);
    max-height: 95vh;
  }

  .modal-header {
    padding: var(--space-4) var(--space-4);
  }

  .modal-body {
    padding: var(--space-4) var(--space-4);
  }

  .guide-timing-grid {
    grid-template-columns: 1fr 1fr;
  }

  .builds-grid {
    grid-template-columns: 1fr;
  }

  .history-summary-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ── Scrollbar ──────────────────────────────────────────── */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--border-strong);
}

/* ── Selection ──────────────────────────────────────────── */
::selection {
  background: var(--accent-bg);
  color: var(--accent-light);
}

/* ── Focus Visible ──────────────────────────────────────── */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ── Monospace values ───────────────────────────────────── */
.mono {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
}

/* ── Win/Loss colors ────────────────────────────────────── */
.text-win  { color: var(--success); }
.text-loss { color: var(--danger); }
.text-gold { color: var(--gold); }
.text-neon { color: var(--neon); }
.text-accent { color: var(--accent-light); }
.text-muted  { color: var(--text-muted); }

/* ── Divider ────────────────────────────────────────────── */
.divider {
  height: 1px;
  background: var(--border-subtle);
  margin: var(--space-4) 0;
}
/* ── Spinner ────────────────────────────────────────────── */
.spinner {
  display: inline-block;
  width: 13px;
  height: 13px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.55s linear infinite;
  vertical-align: middle;
  margin-right: 5px;
  position: relative;
  top: -1px;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Code Block ─────────────────────────────────────────── */
.code-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--muted);
  margin-bottom: 10px;
}

.code-block {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.65;
  white-space: pre-wrap;
  color: var(--accent);
  min-height: 80px;
}

/* ── Stats Grid (Coaching) ──────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}

.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color var(--transition);
}

.stat-card:hover {
  border-color: var(--accent);
}

.stat-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.9px;
  color: var(--muted);
}

.stat-value {
  font-size: 26px;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

/* Trend delta coloring */
.stat-value.pos { color: var(--success); }
.stat-value.neg { color: var(--danger); }

/* ── Findings (Coaching) ────────────────────────────────── */
#coach-findings {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.finding {
  background: var(--card);
  border: 1px solid var(--border);
  border-left: 4px solid;
  border-radius: var(--radius);
  padding: 18px 20px;
  transition: border-color var(--transition);
}

.finding.sev-high   { border-left-color: var(--danger);    }
.finding.sev-medium { border-left-color: var(--orange);  }
.finding.sev-low    { border-left-color: var(--success);   }

.finding-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.finding-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  flex: 1;
}

.sev-badge {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: 999px;
  flex-shrink: 0;
}

.sev-badge.high   { background: rgba(224, 48, 80, 0.15);  color: var(--danger);    border: 1px solid rgba(224,48,80,0.4); }
.sev-badge.medium { background: rgba(208,112, 40, 0.15); color: var(--orange); border: 1px solid rgba(208,112,40,0.4); }
.sev-badge.low    { background: rgba( 32,192,128, 0.12); color: var(--success);  border: 1px solid rgba(32,192,128,0.35); }

.finding-body {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.finding-row {
  font-size: 13px;
  color: var(--text-faint);
  line-height: 1.55;
}

.finding-row strong {
  color: var(--text);
  font-weight: 600;
}

.reco-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.reco-item-icon {
  width: 18px;
  height: 18px;
  object-fit: cover;
  border-radius: 3px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  vertical-align: middle;
}

/* ── Error / Empty States ───────────────────────────────── */
.error-block {
  background: rgba(224, 48, 80, 0.07);
  border: 1px solid rgba(224, 48, 80, 0.3);
  border-radius: var(--radius-sm);
  padding: 16px;
  color: var(--danger);
  font-size: 13px;
  font-family: var(--font-mono);
}

.success-block {
  background: rgba(32, 192, 128, 0.07);
  border: 1px solid rgba(32, 192, 128, 0.3);
  border-radius: var(--radius-sm);
  padding: 20px;
  color: var(--success);
  font-size: 13px;
  text-align: center;
  font-weight: 600;
}


/*  Heroes  */
.hero-icon {
  width: 32px;
  height: 32px;
  border-radius: 4px;
  vertical-align: middle;
  object-fit: cover;
  background-color: var(--bg-elevated);
  border: 1px solid var(--border);
}

.hero-icon-sm {
  width: 24px;
  height: 24px;
  border-radius: 3px;
  vertical-align: middle;
  object-fit: cover;
  background-color: var(--bg-elevated);
  border: 1px solid var(--border);
}

.hero-list {
  display: flex;
  gap: 4px;
  align-items: center;
}

/* ── Clickable history rows ─────────────────────────────── */
tbody tr.clickable {
  cursor: pointer;
}

tbody tr.clickable:hover td {
  background: var(--accent-bg);
}

tbody tr.clickable td:first-child {
  position: relative;
  padding-left: 24px;
}

tbody tr.clickable td:first-child::before {
  content: "";
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 5px;
  height: 5px;
  border-right: 2px solid var(--muted);
  border-top: 2px solid var(--muted);
  transform: translateY(-50%) rotate(45deg);
  transition: border-color var(--transition);
}

tbody tr.clickable:hover td:first-child::before {
  border-color: var(--accent);
}

/* ── Modal Overlay ──────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(7, 9, 13, 0.90);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  z-index: 200;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 32px 20px 40px;
  overflow-y: auto;
  animation: modalBgIn 0.2s ease both;
}

.modal-overlay[hidden] {
  display: none;
}

@keyframes modalBgIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.modal-panel {
  width: 100%;
  max-width: 960px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  animation: modalPanelIn 0.22s ease both;
  overflow: hidden;
}

@keyframes modalPanelIn {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Modal header */
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 24px;
  border-bottom: 2px solid var(--accent);
  flex-shrink: 0;
  background: var(--card);
}

.modal-title-block {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.modal-match-id {
  font-family: "Rajdhani", var(--font);
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.modal-meta {
  font-size: 12px;
  color: var(--muted);
}

.modal-head-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.modal-outcome {
  font-size: 13px;
  font-weight: 700;
  padding: 4px 14px;
  border-radius: 999px;
  letter-spacing: 0.3px;
}

.modal-outcome.win  { background: rgba(32,192,128,.15); color: var(--success); border: 1px solid rgba(32,192,128,.35); }
.modal-outcome.loss { background: rgba(224,48,80,.12);  color: var(--danger);   border: 1px solid rgba(224,48,80,.35); }

.btn-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
  flex-shrink: 0;
}

.btn-close svg { width: 16px; height: 16px; }

.btn-close:hover {
  background: rgba(224, 48, 80, 0.1);
  color: var(--danger);
  border-color: rgba(224, 48, 80, 0.35);
}

/* Modal body */
.modal-body {
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.modal-body::-webkit-scrollbar { width: 5px; }
.modal-body::-webkit-scrollbar-track { background: transparent; }
.modal-body::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* Match tabs navigation */
.match-tabs-nav {
  display: flex;
  gap: 8px;
  padding: 0 24px;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}

.match-tab-btn {
  padding: 12px 16px;
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 2px solid transparent;
  transition: all var(--transition);
  white-space: nowrap;
}

.match-tab-btn:hover {
  color: var(--text);
}

.match-tab-btn.is-active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* Section label inside modal */
.section-label {
  font-family: "Rajdhani", var(--font);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--accent);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-label::before {
  content: "";
  width: 4px;
  height: 12px;
  background: var(--accent);
  border-radius: 2px;
  flex-shrink: 0;
}

.section-label::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* My performance card */
.my-perf-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.my-perf-hero {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.my-perf-hero img {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  object-fit: cover;
}

.my-perf-hero-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}

.my-perf-kda {
  font-size: 13px;
  color: var(--text-faint);
  margin-top: 2px;
}

.my-perf-kda strong {
  font-weight: 700;
}

.my-perf-divider {
  width: 1px;
  height: 40px;
  background: var(--border);
  flex-shrink: 0;
}

/* Build strip */
.build-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.item-icon {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  overflow: visible;
  flex-shrink: 0;
  cursor: default;
  transition: border-color var(--transition), transform 0.1s;
}

.item-icon:hover {
  border-color: var(--accent);
  transform: scale(1.15);
  z-index: 120;
}

.item-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 4px;
}

.item-icon .item-tooltip,
.item-icon-sm .item-tooltip,
.itl-item .item-tooltip {
  display: none;
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 11px;
  color: var(--text);
  white-space: normal;
  pointer-events: none;
  z-index: 60;
  font-weight: 600;
  min-width: 280px;
  max-width: min(340px, calc(100vw - 16px));
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.55);
}

.item-tooltip.edge-left {
  left: 0;
  right: auto;
  transform: translateX(0);
}

.item-tooltip.edge-right {
  left: auto;
  right: 0;
  transform: translateX(0);
}

.item-tooltip.place-below {
  bottom: auto;
  top: calc(100% + 8px);
}

.item-icon:hover .item-tooltip,
.item-icon-sm:hover .item-tooltip,
.itl-item:hover .item-tooltip {
  display: block;
}

.item-id-fallback {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  color: var(--muted);
  font-family: var(--font-mono);
  flex-shrink: 0;
}

/* Teams grid */
.teams-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

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

.team-block {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: visible;
}

.team-header {
  padding: 10px 14px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
}

.team-header.amber   { color: var(--gold);  background: var(--gold-bg); }
.team-header.sapphire { color: #60a8f0; background: rgba(96,168,240,.08); border-color: rgba(96,168,240,.2); }

.player-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-subtle);
  transition: background var(--transition);
}

.player-row:last-child {
  border-bottom: none;
}

.player-row:hover {
  background: var(--accent-bg);
}

.player-row.is-me {
  background: rgba(232, 160, 48, 0.07);
  border-left: 3px solid var(--accent);
}

.player-row-top {
  display: flex;
  align-items: center;
  gap: 8px;
}

.player-row-top img {
  width: 28px;
  height: 28px;
  border-radius: 4px;
  border: 1px solid var(--border);
  object-fit: cover;
  flex-shrink: 0;
}

.player-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player-kda {
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.player-build {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding-left: 36px;
}

.item-icon-sm {
  position: relative;
  width: 28px;
  height: 28px;
  border-radius: 3px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  overflow: visible;
  flex-shrink: 0;
  cursor: default;
  transition: border-color var(--transition), transform 0.1s;
}

.item-icon-sm:hover {
  border-color: var(--accent);
  transform: scale(1.25);
  z-index: 120;
}

.item-icon-sm img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 2px;
}

.item-icon-sm .item-tooltip {
  min-width: 240px;
  max-width: 300px;
  font-size: 10px;
  padding: 8px 10px;
}

.item-tooltip-rich.is-small {
  min-width: 230px;
  max-width: 290px;
  font-size: 10px;
}

.item-id-fallback-sm {
  width: 28px;
  height: 28px;
  border-radius: 3px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 8px;
  color: var(--muted);
  font-family: var(--font-mono);
  flex-shrink: 0;
}

/* No items placeholder */
.no-build {
  font-size: 11px;
  color: var(--muted);
  font-style: italic;
  padding-left: 36px;
}

/* ═══════════════════════════════════════════════════════════
   MATCH MODAL ENHANCEMENTS
   ═══════════════════════════════════════════════════════════ */

/* ── Extended CSS variables ─────────────────────────────── */
:root {
  --sapphire:     #5090e0;
  --sapphire-bg:  rgba(80, 144, 224, 0.08);
  --gold-bg:      rgba(240, 184, 64, 0.10);
  --accent-bg:    rgba(232, 160, 48, 0.06);
  --border-soft:  rgba(30, 45, 64, 0.55);
  --radius-sm:    5px;
}

/* ── Stats grid – small variant (6 cartes dans my-perf-card) */
.stats-grid-sm {
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 8px;
}

.stat-card-sm {
  padding: 10px 12px;
  gap: 4px;
}

.stat-value.stat-sm {
  font-size: 18px;
}

/* ── Player net worth chip ──────────────────────────────── */
.player-nw {
  font-size: 11px;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
  white-space: nowrap;
}

/* ── Clickable player link (replaces plain <span>) ──────── */
.player-link {
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  font-family: var(--font, system-ui, sans-serif);
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color var(--transition), text-decoration-color var(--transition);
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: 2px;
}

.player-link:hover {
  text-decoration-color: currentColor;
}

.leaderboard-player-link {
  display: inline;
  flex: none;
  font-size: 13px;
  font-weight: 600;
}

/* ── "Is me" highlight for table rows ───────────────────── */
tr.is-me-row > td {
  background: rgba(232, 160, 48, 0.07);
}

tr.is-me-row > td:first-child {
  border-left: 2px solid var(--accent);
}

/* ── Items tab – player cards ───────────────────────────── */
.items-player-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  margin-bottom: 10px;
  transition: border-color var(--transition);
}

.items-player-card:hover {
  border-color: var(--text-faint);
}

.items-player-card.is-me-card {
  border-left: 3px solid var(--accent);
  background: rgba(232, 160, 48, 0.06);
}

.items-player-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── Scoreboard tab ─────────────────────────────────────── */
.scoreboard-team-block {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 20px;
}

.scoreboard-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-subtle);
  transition: background var(--transition);
}

.scoreboard-row:last-child {
  border-bottom: none;
}

.scoreboard-row:hover {
  background: var(--accent-bg);
}

.scoreboard-row.is-me-row {
  background: rgba(232, 160, 48, 0.07);
  border-left: 3px solid var(--accent);
}

.scoreboard-player {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 160px;
  flex-shrink: 0;
}

.scoreboard-bars {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

.scoreboard-bar-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.scoreboard-bar-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--muted);
  width: 24px;
  flex-shrink: 0;
}

.scoreboard-bar-track {
  flex: 1;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}

.scoreboard-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.45s cubic-bezier(0.4, 0, 0.2, 1);
}

.scoreboard-bar-value {
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  width: 90px;
  text-align: right;
  flex-shrink: 0;
  white-space: nowrap;
}

@media (max-width: 500px) {
  .scoreboard-player { width: 100px; }
  .scoreboard-bar-value { display: none; }
}

/* ═══════════════════════════════════════════════════════════
   ITEM TIMELINE
   ═══════════════════════════════════════════════════════════ */

.itl-section-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}

.itl-wrap {
  /* Wrapping multi-row layout — no horizontal scroll needed */
}

.itl-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 6px 4px;
  padding: 4px 0 2px;
}

.itl-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  flex-shrink: 0;
}

.itl-item {
  position: relative;
  width: 50px;
  height: 50px;
  border-radius: 7px;
  overflow: visible;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  flex-shrink: 0;
  transition: border-color var(--transition), transform var(--transition);
  cursor: default;
}

.itl-item:hover {
  border-color: var(--text-faint);
  transform: translateY(-2px);
  z-index: 20;
}

.itl-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 7px;
}

.item-tooltip-rich {
  border-top: 2px solid var(--accent);
}

.item-tip-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: baseline;
  margin-bottom: 6px;
}

.item-tip-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}

.item-tip-cost {
  color: var(--success);
  font-weight: 700;
  font-size: 13px;
  white-space: nowrap;
}

.item-tip-tier {
  color: var(--muted);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 8px;
}

.item-tip-section {
  margin-top: 8px;
}

.item-tip-section-title {
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.7px;
  font-size: 10px;
  font-weight: 700;
  margin-bottom: 4px;
}

.item-tip-line {
  color: var(--text);
  line-height: 1.35;
  font-size: 12px;
  margin-bottom: 2px;
}

.itl-tier-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  font-size: 7px;
  font-weight: 800;
  padding: 1px 3px;
  border-radius: 3px;
  line-height: 1.3;
  background: rgba(0, 0, 0, 0.78);
  pointer-events: none;
}

.itl-time {
  font-size: 10px;
  color: var(--muted);
  margin-top: 5px;
  font-variant-numeric: tabular-nums;
  text-align: center;
  white-space: nowrap;
}

.itl-arrow {
  color: var(--border);
  font-size: 20px;
  padding: 0 3px;
  flex-shrink: 0;
  margin-bottom: 20px;
  line-height: 1;
  -webkit-user-select: none;
  user-select: none;
}

/* ── Ability tile inside the unified timeline ─────────── */
.itl-ability {
  position: relative;
  width: 50px;
  height: 50px;
  border-radius: 7px;
  background: rgba(106, 90, 205, 0.15);
  border: 1px solid rgba(130, 110, 235, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: border-color var(--transition), transform var(--transition);
  cursor: default;
  overflow: hidden;
}

.itl-ability:hover {
  border-color: rgba(160, 130, 240, 0.7);
  transform: translateY(-2px);
}

.itl-ability img {
  width: 38px;
  height: 38px;
  border-radius: 5px;
  object-fit: cover;
}

.itl-abl-placeholder {
  width: 38px;
  height: 38px;
  border-radius: 5px;
  background: var(--bg-elevated);
}

.itl-abl-badge {
  position: absolute;
  bottom: 2px;
  right: 2px;
  font-size: 8px;
  font-weight: 800;
  padding: 1px 3px;
  border-radius: 3px;
  line-height: 1.3;
  background: rgba(0, 0, 0, 0.82);
  color: #b0a0e0;
  pointer-events: none;
}

.itl-abl-badge.unlock {
  color: #d090ff;
  font-size: 9px;
}

/* ═══════════════════════════════════════════════════════════
   ABILITY BUILD
   ═══════════════════════════════════════════════════════════ */

.abl-section {
  margin-top: 14px;
}

.abl-outer-wrap {
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.abl-outer-wrap::-webkit-scrollbar { height: 4px; }
.abl-outer-wrap::-webkit-scrollbar-track { background: transparent; }
.abl-outer-wrap::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.abl-inner {
  min-width: max-content;
}

.abl-priority-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 12px;
  padding: 8px 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  flex-wrap: nowrap;
}

.abl-priority-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--muted);
  flex-shrink: 0;
  margin-right: 4px;
}

.abl-priority-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--text);
  flex-shrink: 0;
}

.abl-priority-item img {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  border: 1px solid var(--border);
}

.abl-priority-sep {
  color: var(--text-faint);
  font-size: 13px;
  flex-shrink: 0;
}

.abl-rows {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.abl-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.abl-info {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 150px;
  flex-shrink: 0;
  overflow: hidden;
}

.abl-info img {
  width: 26px;
  height: 26px;
  border-radius: 5px;
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.abl-info-placeholder {
  width: 26px;
  height: 26px;
  border-radius: 5px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  flex-shrink: 0;
}

.abl-info-name {
  font-size: 10px;
  color: var(--text-faint);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.abl-cells {
  display: flex;
  gap: 2px;
}

.abl-cell {
  width: 22px;
  height: 26px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  flex-shrink: 0;
}

.abl-cell.is-empty {
  background: transparent;
  border: 1px solid rgba(29, 61, 88, 0.35);
}

.abl-cell.is-unlock {
  background: rgba(106, 90, 205, 0.22);
  border: 1px solid rgba(130, 110, 235, 0.5);
  color: #a89ee8;
  font-size: 11px;
}

.abl-cell.is-upgrade {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text);
}

.abl-cell.is-maxed {
  background: rgba(232, 160, 48, 0.15);
  border: 1px solid rgba(232, 160, 48, 0.4);
  color: var(--accent);
}

/* ═══════════════════════════════════════════════════════════
   OVERVIEW TAB — Hero performance card (HUD-style)
   ═══════════════════════════════════════════════════════════ */

.overview-hero-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: visible;
}

/* Top section: hero portrait + name/KDA */
.ohc-hero {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 18px 22px;
  background: linear-gradient(120deg, var(--bg-elevated) 0%, var(--card) 60%);
  border-bottom: 1px solid var(--border);
}

.ohc-hero-img {
  width: 76px;
  height: 76px;
  border-radius: var(--radius);
  object-fit: cover;
  border: 2px solid var(--accent);
  flex-shrink: 0;
  box-shadow: 0 0 20px var(--accent-glow);
}

.ohc-hero-img-placeholder {
  width: 76px;
  height: 76px;
  border-radius: var(--radius);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.ohc-hero-info {
  flex: 1;
  min-width: 0;
}

.ohc-hero-name {
  font-family: "Rajdhani", var(--font);
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  line-height: 1;
  margin-bottom: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ohc-kda-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.ohc-kda-scores {
  font-size: 16px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.3px;
}

.ohc-kda-badge {
  font-size: 12px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 4px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
}

.ohc-kda-badge.pos { color: var(--success); border-color: rgba(32,192,128,.35); background: rgba(32,192,128,.08); }
.ohc-kda-badge.neg { color: var(--danger);   border-color: rgba(224,48,80,.35);  background: rgba(224,48,80,.08);  }

.ohc-nw {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--gold);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  margin-top: 7px;
}

/* Middle section: horizontal stat pillars */
.ohc-stats-row {
  display: flex;
  border-bottom: 1px solid var(--border);
}

.ohc-stat {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px 6px;
  border-right: 1px solid var(--border-subtle);
  gap: 5px;
  transition: background var(--transition);
  cursor: default;
}

.ohc-stat:last-child {
  border-right: none;
}

.ohc-stat:hover {
  background: var(--bg-elevated);
}

.ohc-stat-v {
  font-size: 21px;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.ohc-stat-l {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.9px;
  color: var(--muted);
  text-align: center;
  line-height: 1.3;
}

.ohc-stat.neg .ohc-stat-v { color: var(--danger); }
.ohc-stat.pos .ohc-stat-v { color: var(--success); }
.ohc-stat.gold .ohc-stat-v { color: var(--gold); }

/* Bottom section: build strip */
.ohc-build {
  padding: 14px 20px 16px;
  position: relative;
  z-index: 40;
  overflow: visible;
}

.ohc-build-label {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--muted);
  margin-bottom: 10px;
}

/* Fix browser focus outline on tab buttons */
.match-tab-btn:focus {
  outline: none;
}
.match-tab-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

/* ═══════════════════════════════════════════════════════════
   SECTION BLOCKS — Item timeline / Ability build panels
   ═══════════════════════════════════════════════════════════ */

.section-block {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-top: 8px;
}

.section-block-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elevated);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}

.section-block-head::before {
  content: "";
  width: 3px;
  height: 11px;
  background: var(--accent);
  border-radius: 2px;
  flex-shrink: 0;
}

.section-block-head span {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--muted);
}

.section-block-body {
  padding: 10px 12px;
}

/* API Health indicators */
.health-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
}

.health-tile {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
}

.health-tile .health-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--muted);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.3);
}

.health-name {
  color: var(--text);
  font-weight: 600;
  letter-spacing: 0.2px;
}

.health-tile.ok .health-dot {
  background: var(--success);
  box-shadow: 0 0 10px rgba(32, 192, 128, 0.55);
}

.health-tile.err .health-dot {
  background: var(--danger);
  box-shadow: 0 0 10px rgba(224, 48, 80, 0.45);
}

.health-tile.pending .health-dot {
  background: var(--orange);
  box-shadow: 0 0 8px rgba(208, 112, 40, 0.35);
}

.health-meta {
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
}

/* Match coaching UI refresh */
.coach-tab-wrap {
  padding: 12px 0 4px;
}

.coach-match-summary {
  border-left-color: #2fcf8f !important;
}

.coach-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin-bottom: 10px;
}

.coach-summary-metric {
  background: rgba(19, 30, 50, 0.82);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.coach-summary-metric span {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--muted);
}

.coach-summary-metric strong {
  font-size: 16px;
  color: var(--text);
  font-weight: 700;
}

.coach-hero-pill-list {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.coach-hero-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 8px 4px 4px;
  background: rgba(13, 22, 38, 0.9);
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
}

.coach-hero-pill-icon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  flex-shrink: 0;
}

.coach-hero-pill-icon.fallback {
  border-radius: 50%;
  background: linear-gradient(145deg, #24365d, #16233f);
}

.coach-hero-pill-text {
  display: flex;
  flex-direction: column;
  line-height: 1.05;
  color: var(--text);
  font-size: 11px;
  font-weight: 600;
}

.coach-hero-pill-text small {
  color: var(--muted);
  font-size: 9px;
}

.coach-reco-card {
  background: linear-gradient(180deg, rgba(9, 16, 30, 0.98), rgba(11, 19, 35, 0.98));
}

.counter-source-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 2px;
}

.counter-source-groups {
  display: grid;
  gap: 8px;
  margin-top: 4px;
}

.counter-source-group {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  background: rgba(9, 18, 33, 0.55);
}

.counter-source-group-owner {
  min-width: 120px;
  color: #fff3dd;
  font-size: 11px;
  font-weight: 700;
  padding-top: 3px;
}

.counter-source-group .counter-source-list {
  margin-top: 0;
}

.counter-source-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 7px;
  border-radius: 999px;
  border: 1px solid rgba(255, 174, 77, 0.35);
  background: rgba(255, 174, 77, 0.08);
  font-size: 11px;
  color: #ffdba9;
}

.counter-source-icon {
  width: 16px;
  height: 16px;
  border-radius: 3px;
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: var(--bg-elevated);
}

.counter-source-owner {
  color: #fff3dd;
  font-weight: 700;
}

.counter-source-item {
  color: #ffcc80;
}

.counter-source-time {
  color: #9ec6ff;
}

.counter-start-badge {
  display: inline-flex;
  align-items: center;
  padding: 1px 8px;
  border-radius: 999px;
  border: 1px solid rgba(80, 160, 255, 0.5);
  color: #9ac4ff;
  font-size: 11px;
  font-weight: 700;
  margin-left: 4px;
}

/* Home search page */
.home-hero {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px 26px 18px;
  background:
    linear-gradient(120deg, rgba(7, 13, 26, 0.96), rgba(12, 20, 35, 0.94)),
    radial-gradient(600px 320px at 80% -10%, rgba(77, 132, 255, 0.22), transparent 65%);
  margin-bottom: 6px;
}

.home-brand-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.home-logo {
  font-size: 46px;
  font-weight: 800;
  letter-spacing: 1px;
  color: #f1e4c5;
  line-height: 1;
}

.home-powered {
  font-size: 12px;
  font-weight: 700;
  color: #9db8e5;
  letter-spacing: 1px;
}

.home-search-wrap {
  position: relative;
}

.home-search-input {
  width: 100%;
  height: 58px;
  border-radius: 10px;
  border: 1px solid #384c72;
  background: rgba(236, 242, 252, 0.95);
  color: #1a2740;
  padding: 0 58px 0 16px;
  font-size: 18px;
  font-family: var(--font);
  font-weight: 600;
}

.home-search-btn {
  position: absolute;
  right: 8px;
  top: 8px;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  border: 1px solid #d4deef;
  background: #f2f6fd;
  color: #3d527d;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.home-search-btn svg {
  width: 18px;
  height: 18px;
}

.home-stats-row {
  margin-top: 12px;
  display: flex;
  gap: 22px;
  color: #8ea7cf;
  font-size: 15px;
}

.home-stats-row strong {
  color: #f3f7ff;
}

.home-insights-card {
  margin-top: 10px;
  padding: 14px;
}

.home-insights-head h2 {
  margin: 0;
  font-size: 18px;
}

.home-insights-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.home-insights-grid {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.home-insight-tile {
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  background: rgba(17, 26, 44, 0.92);
  padding: 10px;
}

.home-insight-tile span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  margin-bottom: 5px;
}

.home-insight-tile strong {
  color: #e8f1ff;
  font-size: 18px;
  line-height: 1;
}

.home-rank-duration-list {
  margin-top: 10px;
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  background: rgba(12, 19, 33, 0.85);
  padding: 10px;
  display: grid;
  gap: 6px;
}

.home-rank-duration-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}

.home-rank-duration-row span {
  color: var(--text-faint);
  font-size: 12px;
}

.home-rank-duration-row strong {
  color: #d8e9ff;
  font-size: 12px;
}

@media (max-width: 900px) {
  .home-insights-grid {
    grid-template-columns: 1fr;
  }
}

.compact-health-card {
  display: none;
  margin-top: 14px;
}

/* History redesign */
.history-layout-card {
  padding: 16px;
}

.history-layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.history-side {
  background: rgba(12, 18, 32, 0.92);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  padding: 14px 12px;
  height: fit-content;
}

.history-side .controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 10px;
  margin-bottom: 12px;
}

.history-side .field {
  min-width: 0;
}

.history-side .field .input {
  width: 100%;
}

.history-side #btn-history {
  margin-left: 0;
  align-self: end;
  white-space: nowrap;
}

.history-side-actions {
  display: grid;
  gap: 6px;
}

.history-side-actions .btn {
  margin-left: 0;
  min-width: 104px;
  justify-content: center;
  height: 34px;
}

.btn-history-api {
  background: rgba(23, 35, 58, 0.95);
  border: 1px solid #425d8e;
  color: #cfe0ff;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.btn-history-api:hover {
  border-color: #6f92d2;
  color: #e6f0ff;
}

.history-profile-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.history-avatar {
  position: relative;
  overflow: hidden;
  width: 46px;
  height: 46px;
  border-radius: 10px;
  background: linear-gradient(145deg, #1f9158, #173f2e);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 800;
  color: #dfffea;
}

.history-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.history-player-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
}

.history-player-sub {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.history-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 6px;
}

.history-summary-item {
  background: rgba(26, 38, 62, 0.9);
  border: 1px solid var(--border-subtle);
  border-radius: 7px;
  padding: 7px 8px;
}

.history-summary-item span {
  display: block;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.7px;
  text-transform: uppercase;
}

.history-summary-item strong {
  display: block;
  margin-top: 2px;
  color: var(--text);
  font-size: 16px;
  font-weight: 700;
}

.history-player-chip {
  margin-top: 10px;
  border: 1px solid var(--border-subtle);
  background: rgba(18, 28, 47, 0.9);
  border-radius: 8px;
  padding: 8px 10px;
}

.history-player-chip span {
  display: block;
  color: #e9f2ff;
  font-weight: 600;
}

.history-player-chip small {
  color: var(--muted);
}

.history-rank-panel {
  margin-top: 10px;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(18, 29, 49, 0.92), rgba(14, 22, 38, 0.92));
  overflow: hidden;
}

.history-rank-panel-head {
  padding: 8px 10px;
  border-bottom: 1px solid rgba(93, 122, 176, 0.28);
  color: #d7e6ff;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.9px;
}

.history-rank-panel-body {
  padding: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.history-rank-panel-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  border: 1px solid rgba(103, 132, 187, 0.35);
  background: rgba(11, 18, 32, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.history-rank-panel-icon img {
  width: 30px;
  height: 30px;
  object-fit: contain;
}

#history-rank-icon-fallback {
  color: var(--muted);
  font-weight: 700;
  font-size: 16px;
}

.history-rank-panel-meta {
  min-width: 0;
}

.history-rank-panel-meta strong {
  display: block;
  color: #efe6ff;
  font-size: 26px;
  line-height: 1;
  font-weight: 700;
  font-family: "Rajdhani", var(--font);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-rank-panel-meta small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
}

.history-30d-panel {
  margin-top: 8px;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  background: rgba(18, 28, 47, 0.9);
  overflow: hidden;
}

.history-30d-head {
  padding: 8px 10px 6px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  font-weight: 700;
}

.history-30d-body {
  padding: 9px 10px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.history-30d-body strong {
  color: #7fffb6;
  font-size: 22px;
  line-height: 1;
}

.history-30d-body small {
  color: var(--text-faint);
  font-size: 11px;
}

.history-10000-duration {
  border-top: 1px solid var(--border-subtle);
  padding: 8px 10px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.history-10000-duration span {
  color: var(--text-faint);
  font-size: 11px;
}

.history-10000-duration strong {
  color: #d9ecff;
  font-size: 16px;
  line-height: 1;
}

.history-10000-duration-ranks {
  border-top: 1px solid var(--border-subtle);
  padding: 8px 10px;
  display: grid;
  gap: 5px;
}

.history-rank-duration-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.history-rank-duration-row span {
  color: var(--text-faint);
  font-size: 11px;
}

.history-rank-duration-row strong {
  color: #d9ecff;
  font-size: 12px;
  line-height: 1;
}

.history-30d-heroes {
  border-top: 1px solid var(--border-subtle);
  padding: 8px 10px 10px;
  display: grid;
  gap: 6px;
}

.history-30d-hero-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 0;
}

.history-30d-hero-main {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.history-30d-hero-icon {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 18px;
}

.history-30d-hero-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.history-30d-hero-fallback {
  color: var(--muted);
  font-size: 9px;
  line-height: 1;
}

.history-30d-hero-name {
  color: var(--text);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-30d-hero-stats {
  display: inline-flex;
  align-items: baseline;
  gap: 7px;
  flex: 0 0 auto;
}

.history-30d-hero-stats small {
  color: var(--text-faint);
  font-size: 10px;
}

.history-30d-hero-stats strong {
  color: #7fffb6;
  font-size: 12px;
  font-weight: 700;
}

.history-30d-hero-empty {
  color: var(--text-faint);
  font-size: 11px;
}

.history-main {
  background: rgba(10, 16, 30, 0.92);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  padding: 12px;
}

.history-main-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.history-main-head h2 {
  font-size: 24px;
  color: var(--text);
}

.history-main-filters {
  display: flex;
  gap: 8px;
}

.history-main-filters span {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  color: var(--muted);
  font-size: 11px;
}

.history-table-wrap table tbody tr {
  border-left: 2px solid transparent;
}

.history-table-wrap table tbody tr:hover {
  border-left-color: var(--accent);
}

.history-list {
  display: grid;
  gap: 8px;
}

.history-load-more-wrap {
  display: flex;
  justify-content: center;
  margin-top: 10px;
}

.history-match-card {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(10, 18, 34, 0.92), rgba(8, 14, 27, 0.92));
  overflow: hidden;
  transition: border-color var(--transition), transform var(--transition);
}

.history-match-card:hover {
  border-color: rgba(255, 171, 70, 0.45);
  transform: translateY(-1px);
}

.history-match-result {
  padding: 7px 6px;
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
}

.history-match-result strong {
  font-size: 14px;
  line-height: 1;
}

.history-match-result span {
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.history-match-result.win {
  background: linear-gradient(180deg, rgba(49, 208, 136, 0.16), rgba(49, 208, 136, 0.06));
}

.history-match-result.win strong {
  color: #55e2a2;
}

.history-match-result.loss {
  background: linear-gradient(180deg, rgba(255, 79, 122, 0.16), rgba(255, 79, 122, 0.06));
}

.history-match-result.loss strong {
  color: #ff7da0;
}

.history-match-main {
  padding: 6px 8px;
  min-width: 0;
}

.history-top-row {
  display: grid;
  grid-template-columns: 152px 138px minmax(120px, 1fr);
  align-items: center;
  gap: 6px;
}

.history-meta-left {
  min-width: 0;
}

.history-top-time {
  color: var(--text-faint);
  font-weight: 600;
  font-size: 12px;
}

.history-top-id {
  color: var(--muted);
  font-size: 12px;
}

.history-player-line {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 2px;
}

.history-hero-icon {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  border: 1px solid var(--border);
  object-fit: cover;
  flex-shrink: 0;
}

.history-hero-fallback {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 11px;
}

.history-hero-filter {
  height: 26px;
  min-width: 132px;
  padding: 0 26px 0 10px;
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  background: rgba(15, 24, 42, 0.95);
  color: var(--muted);
  font-size: 11px;
  font-family: var(--font);
  outline: none;
  cursor: pointer;
}

.history-hero-filter:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-bg);
}

.history-hero-filter:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.history-player-link {
  color: #ff6ea5;
  font-weight: 700;
  text-decoration: none;
  font-size: 14px;
  line-height: 1;
}

.history-player-link:hover {
  text-decoration: underline;
}

.history-player-link.is-static {
  color: #ff6ea5;
}

.history-kda-block {
  min-width: 0;
}

.history-kda-value {
  font-size: 30px;
  font-weight: 700;
  font-family: "Rajdhani", var(--font);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.history-kda-sub {
  margin-top: 1px;
  color: var(--muted);
  font-size: 12px;
}

.history-stats-compact {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  color: var(--text-faint);
  font-size: 11px;
}

.history-avg-rank {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  background: rgba(20, 32, 55, 0.8);
  color: #e8f2ff;
}

.history-avg-rank img {
  width: 15px;
  height: 15px;
}

.history-avg-rank.is-missing {
  color: var(--muted);
}

.history-bottom-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 430px;
  gap: 6px;
  margin-top: 5px;
}

.history-build-col {
  min-width: 0;
}

.history-rank-line {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 3px;
}

.history-rank-label {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.history-rank-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 1px 6px;
  border-radius: 999px;
  border: 1px solid rgba(116, 157, 230, 0.3);
  background: rgba(22, 35, 59, 0.85);
  color: #d8e8ff;
  font-size: 11px;
  line-height: 1;
}

.history-rank-chip img {
  width: 15px;
  height: 15px;
}

.history-rank-chip.is-missing {
  color: var(--muted);
  border-color: var(--border-subtle);
}

.history-rank-chip.is-compact {
  padding: 1px 5px;
  font-size: 9px;
  gap: 3px;
}

.history-rank-chip.is-compact img {
  width: 13px;
  height: 13px;
}

.history-build-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  align-items: center;
}

.history-build-strip .item-icon-sm,
.history-build-strip .item-id-fallback-sm {
  width: 23px;
  height: 23px;
}

.history-build-strip .item-icon-sm img {
  border-radius: 2px;
}

.history-build-empty {
  color: var(--muted);
  font-size: 11px;
}

.history-sides {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.history-side-block {
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 8px 10px;
  background: rgba(12, 20, 36, 0.75);
}

.history-side-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 7px;
}

.history-side-block.allies .history-side-title {
  color: #6dd8ff;
}

.history-side-block.enemies .history-side-title {
  color: #ff89a8;
}

.history-enemies {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px 10px;
}

.history-enemy-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  min-width: 0;
  padding: 0;
}

.history-enemy-name {
  color: var(--text-faint);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.1;
}

.history-side-block .history-rank-chip.is-compact {
  font-size: 10px;
  padding: 1px 6px;
  gap: 4px;
}

.history-enemy-empty {
  grid-column: 1 / -1;
  color: var(--muted);
}

@media (max-width: 1100px) {
  .history-top-row {
    grid-template-columns: 132px 122px minmax(120px, 1fr);
  }

  .history-kda-value {
    font-size: 22px;
  }

  .history-bottom-row {
    grid-template-columns: 1fr;
  }

  .history-sides {
    grid-template-columns: 1fr;
  }

  .history-enemies {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .history-match-card {
    grid-template-columns: 1fr;
  }

  .history-match-result {
    border-right: none;
    border-bottom: 1px solid var(--border-subtle);
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }

  .history-top-row {
    grid-template-columns: 1fr;
    grid-template-areas:
      "meta"
      "kda"
      "stats";
    gap: 8px;
  }

  .history-meta-left { grid-area: meta; }
  .history-kda-block { grid-area: kda; }
  .history-stats-compact { grid-area: stats; }
  .history-enemies {
    grid-template-columns: 1fr;
  }
}

