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

:root {
  --bg: #0a0b14;
  --surface: rgba(22, 25, 45, 0.85);
  --surface2: rgba(18, 20, 38, 0.9);
  --border: rgba(74, 125, 255, 0.12);
  --border-hover: rgba(74, 125, 255, 0.3);
  --text: #e8eaed;
  --text-secondary: #9aa0b8;
  --text-muted: #5a5f7a;
  --accent: #4A7DFF;
  --accent-glow: rgba(74, 125, 255, 0.25);
  --green: #34d399;
  --red: #f87171;
  --orange: #fbbf24;
  --purple: #a78bfa;
  --nav-height: 64px;
  --appbar-height: 0px;
  --radius: 14px;
  --radius-sm: 10px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  padding-bottom: calc(var(--nav-height) + 3rem);
  padding-top: var(--appbar-height);
  -webkit-font-smoothing: antialiased;
  background-image: radial-gradient(ellipse at 20% 50%, rgba(74,125,255,0.04) 0%, transparent 60%),
                    radial-gradient(ellipse at 80% 20%, rgba(168,85,247,0.03) 0%, transparent 50%);
}

.app-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--appbar-height);
  background: rgba(10, 11, 20, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.25rem;
  z-index: 100;
}
.app-bar h1 {
  font-size: 1.15rem;
  font-weight: 700;
  background: linear-gradient(135deg, #fff 0%, #4A7DFF 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.app-bar .header-right { display: flex; align-items: center; gap: 0.5rem; }
.app-bar .header-right .tab-title {
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  background: rgba(10, 11, 20, 0.9);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-around;
  align-items: center;
  z-index: 100;
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 8px 16px;
  font-size: 0.6rem;
  font-weight: 500;
  font-family: inherit;
  transition: all 0.2s;
  -webkit-tap-highlight-color: transparent;
  min-width: 64px;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}
.nav-item svg {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: stroke 0.2s;
}
.nav-item.active { color: var(--accent); }
.nav-item.active svg { stroke: var(--accent); filter: drop-shadow(0 0 6px var(--accent-glow)); }

.main-content {
  max-width: 960px;
  margin: 0 auto;
  padding: 0.75rem;
}

.tab-content { display: none; }
.tab-content.active { display: block; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  background: linear-gradient(135deg, var(--accent), #6c5ce7);
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.6rem 1.1rem;
  color: #fff;
  font-weight: 600;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 4px 20px var(--accent-glow); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-outline {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-secondary);
}
.btn-outline:hover { border-color: var(--accent); color: var(--accent); transform: none; box-shadow: none; }
.btn-sm { padding: 0.4rem 0.85rem; font-size: 0.75rem; }
.btn-icon {
  padding: 0.4rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px; height: 36px;
}
.btn-icon svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; }

.import-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 1rem;
  backdrop-filter: blur(10px);
}
.import-card form { display: flex; gap: 0.5rem; }
.import-card input {
  flex: 1;
  min-width: 0;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.85rem;
  color: var(--text);
  font-size: 0.85rem;
  outline: none;
  transition: border-color 0.2s;
  font-family: inherit;
}
.import-card input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.import-card input::placeholder { color: var(--text-muted); }
.import-status {
  margin-top: 0.6rem;
  font-size: 0.8rem;
  color: var(--text-secondary);
}
.import-status.error { color: var(--red); }
.import-status.success { color: var(--green); }

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}
.section-header h2 {
  font-size: 0.8rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-weight: 600;
}

/* Leaderboard – Cards on mobile, Table on desktop */
.leaderboard-cards { display: none; }
.leaderboard-table { display: block; }

.filter-bar {
  position: fixed;
  bottom: var(--nav-height);
  left: 0;
  right: 0;
  display: flex;
  flex-wrap: nowrap;
  gap: 0.45rem;
  justify-content: center;
  padding: 0.6rem 0.75rem;
  background: rgba(10, 12, 27, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--accent);
  border-bottom: 1px solid var(--accent);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  z-index: 100;
}
.filter-bar::-webkit-scrollbar { display: none; }

.stat-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin-top: 1rem;
}
@media (max-width: 600px) {
  .stat-cards { grid-template-columns: repeat(2, 1fr); }
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  backdrop-filter: blur(10px);
}
.stat-card.map-bg {
  background-size: contain;
  background-repeat: no-repeat;
  background-position: right center;
  position: relative;
  overflow: hidden;
}
.stat-card.map-bg .stat-card-body {
  background: linear-gradient(90deg, var(--surface) 50%, transparent);
  margin: -0.75rem;
  padding: 0.75rem;
  border-radius: var(--radius);
  max-width: 60%;
}
.stat-card-body {
  flex: 1;
  min-width: 0;
}
.stat-card-label {
  font-size: 0.6rem;
  color: #fbbf24;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}
.stat-card-value {
  font-size: 0.95rem;
  font-weight: 700;
  color: #fff;
  margin-top: 0.1rem;
}
.stat-card-sub {
  font-size: 0.7rem;
  color: var(--green);
  margin-top: 0.05rem;
}
.weapon-top-player {
  position: absolute;
  bottom: 0.5rem;
  right: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.6rem;
  color: var(--text-secondary);
  background: rgba(10, 11, 20, 0.75);
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
}
.weapon-top-player img {
  width: 14px;
  height: 14px;
  border-radius: 50%;
}
.weapon-top-player span {
  color: var(--green);
  font-weight: 600;
}
.stat-card-wl {
  font-size: 0.7rem;
  margin-top: 0.05rem;
}
.wl-win { color: #4caf50; font-weight: 600; }
.wl-loss { color: #f44336; font-weight: 600; }

.table-wrap { overflow-x: auto; }

.sec-heading {
  text-align: center;
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: 2px;
  padding: 1.2rem 0 0.6rem;
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 0 12px rgba(251,191,36,0.4));
  text-transform: uppercase;
}
.sec-heading.sub {
  font-size: 1.1rem;
  letter-spacing: 1.5px;
  padding: 1.8rem 0 0.6rem;
  background: linear-gradient(135deg, #9aa0b8, #5a5f7a);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: none;
}

.lb-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 4px;
  font-size: 0.85rem;
}
.lb-table th {
  text-align: left;
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 0.6rem 0.6rem;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
.lb-table th:hover { color: var(--accent); }
.lb-table td {
  padding: 0.75rem 0.6rem;
  background: var(--surface);
  border: 1px solid var(--border);
  white-space: nowrap;
}
.lb-table td:first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.lb-table td:last-child { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.lb-table .rank-cell {
  font-weight: 700;
  color: var(--text-muted);
  text-align: center;
  width: 1.5rem;
}
.lb-table .rank-1 { color: #ffd700; }
.lb-table .rank-2 { color: #c0c0c0; }
.lb-table .rank-3 { color: #cd7f32; }
.lb-table .player-cell {
  font-weight: 600;
  color: #fff;
}
.lb-table .player-cell .steam-id {
  font-weight: 400;
  font-size: 0.65rem;
  color: var(--text-muted);
  display: block;
}
.lb-table .stat-good { color: var(--green); }
.lb-table .stat-bad { color: var(--red); }
.lb-table .stat-mid { color: var(--orange); }

.lb-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  margin-bottom: 0.5rem;
  cursor: pointer;
  transition: all 0.2s;
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.lb-card:hover, .lb-card:active { border-color: var(--accent); transform: translateY(-1px); }
.lb-card .rank {
  width: 2rem;
  text-align: center;
  font-weight: 800;
  font-size: 1rem;
  color: var(--text-muted);
  flex-shrink: 0;
}
.lb-card .rank.r1 { color: #ffd700; }
.lb-card .rank.r2 { color: #c0c0c0; }
.lb-card .rank.r3 { color: #cd7f32; }
.lb-card .info { flex: 1; min-width: 0; }
.lb-card .info .name { font-size: 0.9rem; font-weight: 600; color: #fff; }
.lb-card .info .name .steam-id { font-weight: 400; font-size: 0.6rem; color: var(--text-muted); margin-left: 0.4rem; }
.lb-card .stats {
  display: flex;
  gap: 0.6rem;
  margin-top: 0.3rem;
  flex-wrap: wrap;
}
.lb-card .stats span {
  font-size: 0.7rem;
  color: var(--text-secondary);
  background: var(--surface2);
  padding: 0.15rem 0.5rem;
  border-radius: 6px;
  border: 1px solid var(--border);
}
.lb-card .stats span b { color: #fff; font-weight: 600; }
.lb-card .stats .good b { color: var(--green); }
.lb-card .stats .bad b { color: var(--red); }
.lb-card .stats .mid b { color: var(--orange); }
.lb-card .elo-badge {
  flex-shrink: 0;
  background: linear-gradient(135deg, rgba(74,125,255,0.15), rgba(108,92,231,0.15));
  border: 1px solid rgba(74,125,255,0.2);
  border-radius: var(--radius-sm);
  padding: 0.3rem 0.6rem;
  text-align: center;
}
.lb-card .elo-badge .val { font-size: 0.85rem; font-weight: 700; color: var(--accent); }
.lb-card .elo-badge .lbl { font-size: 0.55rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.lb-card .elo-badge.good { border-color: rgba(52, 211, 153, 0.3); background: linear-gradient(135deg, rgba(52, 211, 153, 0.1), rgba(52, 211, 153, 0.05)); }
.lb-card .elo-badge.good .val { color: var(--green); }
.lb-card .elo-badge.bad { border-color: rgba(248, 113, 113, 0.3); background: linear-gradient(135deg, rgba(248, 113, 113, 0.1), rgba(248, 113, 113, 0.05)); }
.lb-card .elo-badge.bad .val { color: var(--red); }

.lb-avatar, .tb-avatar, .detail-avatar, .sheet-avatar {
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.lb-avatar { width: 32px; height: 32px; }
.tb-avatar { width: 22px; height: 22px; vertical-align: middle; margin-right: 0.3rem; border-radius: 4px; }
.detail-avatar { width: 32px; height: 32px; }
.sheet-avatar { width: 36px; height: 36px; margin-bottom: 0.2rem; }

/* Player Detail */
.player-detail-header {
  position: sticky;
  top: var(--appbar-height);
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}
.filter-chip {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 0.25rem 0.85rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  font-family: inherit;
  letter-spacing: 0.3px;
  white-space: nowrap;
  transition: all 0.2s;
}
.filter-chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.player-detail-header .nav-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--text-secondary);
  cursor: pointer;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  font-family: inherit;
  transition: all 0.2s;
  flex-shrink: 0;
}
.player-detail-header .nav-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 0 16px var(--accent-glow);
}
.player-detail-header h2 {
  font-size: 1.1rem;
  font-weight: 800;
  color: #fff;
  text-align: center;
  letter-spacing: -0.3px;
  flex: 1;
}
.player-detail-header .sub {
  display: block;
  text-align: center;
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 400;
  margin-top: 0.15rem;
  letter-spacing: 0;
}
.player-detail-header .nav-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0.5rem 0.75rem;
  font-size: 1rem;
  font-family: inherit;
  transition: all 0.2s;
}
.player-detail-header .nav-btn:hover { border-color: var(--accent); color: var(--accent); }
.player-detail-header h2 {
  font-size: 1.2rem;
  font-weight: 700;
  color: #fff;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.35rem;
  margin-bottom: 0.75rem;
}
.summary-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.4rem 0.3rem;
  text-align: center;
  backdrop-filter: blur(10px);
}
.summary-box .value {
  font-size: 0.95rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 0.1rem;
}
.summary-box .label {
  font-size: 0.55rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.summary-box .sub-val {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 0.1rem;
}
.summary-box.big { padding: 0.6rem 0.3rem; }
.summary-box.big .value { font-size: 1.4rem; }
.summary-box.glow-green { border-color: rgba(52, 211, 153, 0.3); box-shadow: 0 0 12px rgba(52, 211, 153, 0.15); }
.summary-box.glow-green .value { color: var(--green); }
.summary-box.glow-red { border-color: rgba(248, 113, 113, 0.3); box-shadow: 0 0 12px rgba(248, 113, 113, 0.15); }
.summary-box.glow-red .value { color: var(--red); }

.charts-section { margin-bottom: 1.25rem; }
.chart-grid { display: grid; grid-template-columns: 1fr; gap: 0.75rem; }
.chart-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.85rem;
  backdrop-filter: blur(10px);
}
.chart-card h3 {
  font-size: 0.7rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.5rem;
}
.chart-card canvas { width: 100% !important; height: auto !important; }

.match-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 4px;
  font-size: 0.78rem;
}
.match-table th {
  text-align: left;
  font-size: 0.6rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 0.4rem 0.5rem;
  font-weight: 600;
}
.match-table td {
  padding: 0.55rem 0.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
}
.match-table td:first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.match-table td:last-child { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.match-table td a { color: var(--text); text-decoration: none; }
.match-table td a:hover { color: var(--accent); }
.win td { border-left: 3px solid var(--green) !important; }
.loss td { border-left: 3px solid var(--red) !important; }
.badge-win, .badge-loss {
  display: inline-block;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  font-weight: 700;
  font-size: 0.65rem;
}
.badge-win { background: rgba(52, 211, 153, 0.2); color: var(--green); }
.badge-loss { background: rgba(248, 113, 113, 0.2); color: var(--red); }
.stat-good { color: var(--green); }
.stat-bad { color: var(--red); }
.stat-mid { color: var(--orange); }
.empty-state {
  text-align: center;
  color: var(--text-muted);
  padding: 3rem 0;
  font-size: 0.85rem;
}

/* Match Detail Page */
.back-link {
  display: inline-block;
  color: var(--accent);
  text-decoration: none;
  font-size: 0.85rem;
  margin-bottom: 1rem;
}
.back-link:hover { text-decoration: underline; }
.match-header-detail {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem 1.25rem;
  margin-bottom: 1rem;
  backdrop-filter: blur(10px);
}
.match-meta-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 0.75rem;
  backdrop-filter: blur(10px);
}
.meta-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
}
.meta-label {
  font-size: 0.6rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.meta-value {
  font-size: 0.85rem;
  color: #fff;
  font-weight: 600;
}
.match-score {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2rem;
  padding: 0.5rem 0;
}
.team-score { display: flex; flex-direction: column; align-items: center; gap: 0.25rem; }
.team-score .name { font-size: 1rem; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.8px; }
.team-score .score { font-size: 2.5rem; font-weight: 800; }
.team-score.our-win .score { color: var(--green); }
.team-score.our-loss .score { color: var(--red); }
.team-score.opponent .score { color: var(--text-muted); }
.team-score.winner .score { color: var(--green); }
.team-score.loser .score { color: var(--red); }
.match-score .vs { color: var(--text-muted); font-size: 1.5rem; font-weight: 700; }
.match-highlights {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.highlight-card {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.85rem;
  text-align: center;
  backdrop-filter: blur(10px);
}
.highlight-card.tracked {
  border: 1px solid rgba(52, 211, 153, 0.35);
}
.highlight-card .h-label {
  font-size: 0.6rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.3rem;
}
.highlight-card .h-value {
  font-size: 0.85rem;
  color: #fff;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.highlight-card .h-sub {
  font-size: 0.7rem;
  color: var(--text-secondary);
  margin-top: 0.15rem;
}
.highlight-card.tracked .h-sub {
  color: var(--green);
}

.scoreboard-grid { display: grid; grid-template-columns: 1fr; gap: 0.75rem; }
.team-scoreboard {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.85rem;
  overflow-x: auto;
  backdrop-filter: blur(10px);
}
.team-header {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-bottom: 0.5rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border);
}
.team-header.our-win { color: var(--green); }
.team-header.our-loss { color: var(--red); }
.team-header.opponent { color: var(--text-muted); }
.team-header.win { color: var(--green); }
.team-header.loss { color: var(--red); }
.player-stats-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.35rem 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  font-size: 0.8rem;
}
.player-stats-row:last-child { border-bottom: none; }
.player-stats-row .pname { color: #b0b8d0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; padding-right: 0.5rem; }
.player-stats-row .pname.highlight { color: var(--accent); font-weight: 700; }
.player-stats-row .pstats { color: #fff; display: flex; gap: 0.75rem; flex-shrink: 0; }
.player-stats-row .pstats span { min-width: 1.5rem; text-align: right; }

.player-detail-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-top: 1rem;
  backdrop-filter: blur(10px);
}
.player-detail-section h2 { font-size: 0.9rem; margin-bottom: 0.75rem; }
.detail-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
}
.detail-box {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.4rem;
  text-align: center;
}
.detail-box .value { font-size: 1.1rem; font-weight: 700; color: #fff; }
.detail-box .label { font-size: 0.6rem; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.5px; margin-top: 0.15rem; }
.detail-box.highlight .value { color: var(--accent); }
.detail-box.good .value { color: var(--green); }
.detail-box.bad .value { color: var(--red); }

/* Bottom Sheet */
.bottom-sheet {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 200;
}
.bottom-sheet.open { display: block; }
.bottom-sheet-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
}
.bottom-sheet-content {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  max-height: 85vh;
  background: var(--surface);
  backdrop-filter: blur(20px);
  border-radius: 20px 20px 0 0;
  border-top: 1px solid var(--border);
  overflow-y: auto;
  animation: sheetUp 0.3s cubic-bezier(0.32, 0.72, 0, 1);
}
@keyframes sheetUp {
  from { transform: translateY(100%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
.bottom-sheet-header {
  padding: 1.15rem 1rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 1px;
  text-align: center;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 1;
  backdrop-filter: blur(20px);
}
.bottom-sheet-list { padding: 0.6rem; }
.bottom-sheet-list .player-list-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.85rem 0.75rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 0.5rem;
  cursor: pointer;
  transition: all 0.2s;
}
.bottom-sheet-list .player-list-item:hover,
.bottom-sheet-list .player-list-item:active {
  border-color: var(--accent);
  transform: translateY(-1px);
}
.bottom-sheet-list .player-list-item .pli-top {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}
.bottom-sheet-list .player-list-item .pli-name {
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
}
.bottom-sheet-list .player-list-item .pli-sub {
  display: flex;
  gap: 0.75rem;
  font-size: 0.7rem;
  color: var(--text-secondary);
}
  justify-content: center;
}

/* Loading */
.loading {
  text-align: center;
  color: var(--text-muted);
  padding: 2rem 0;
  font-size: 0.85rem;
}
.hidden { display: none !important; }

.pull-indicator {
  position: fixed;
  top: var(--appbar-height);
  left: 0;
  right: 0;
  text-align: center;
  padding: 0.5rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  z-index: 99;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

/* Tablet+ */
@media (min-width: 640px) {
  .chart-grid { grid-template-columns: 1fr 1fr; }
  .scoreboard-grid { grid-template-columns: 1fr 1fr; }
  .detail-grid { grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); }
  .main-content { padding: 1rem 1.5rem; }
}

@media (min-width: 960px) {
  .main-content { padding: 1.5rem 2rem; }
}

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

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

.sync-toast {
  position: fixed;
  bottom: 5rem;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.6rem 1.2rem;
  font-size: 0.8rem;
  color: #fff;
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.3s ease;
  z-index: 1000;
  pointer-events: none;
  white-space: nowrap;
}

.sync-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 12, 27, 0.7);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.loading-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.loading-text {
  font-size: 1.1rem;
  color: #fff;
  letter-spacing: 0.3px;
}

.splash-screen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.5s ease;
}
.splash-screen.fade-out {
  opacity: 0;
  pointer-events: none;
}
.splash-content {
  text-align: center;
}
.splash-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}
.splash-title {
  font-size: 2.2rem;
  font-weight: 800;
  letter-spacing: 3px;
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 0 20px rgba(251,191,36,0.5));
  text-transform: uppercase;
}
