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

:root {
  --bg: #080c18;
  --surface: #0f1829;
  --surface-2: #162035;
  --border: #1e2f4a;
  --gold: #f0c040;
  --gold-dark: #c49a20;
  --text: #e8edf5;
  --text-muted: #56698a;
  --green: #22c55e;
  --red: #ef4444;
  --blue: #3b82f6;
  --radius: 12px;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Header ── */

header {
  background: linear-gradient(160deg, #111e38 0%, #0c1525 100%);
  border-bottom: 2px solid var(--gold);
  padding: 20px 24px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.header-inner {
  max-width: 1140px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 14px;
}

.header-logo {
  font-size: 40px;
  line-height: 1;
  flex-shrink: 0;
}

.header-inner > div {
  flex: 1;
}

header h1 {
  font-size: 26px;
  font-weight: 800;
  color: var(--gold);
  letter-spacing: -0.5px;
  line-height: 1.1;
}

.header-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 3px;
  font-weight: 600;
  letter-spacing: 2.5px;
  text-transform: uppercase;
}

.refresh-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
  font-family: inherit;
  flex-shrink: 0;
}

.refresh-btn:hover {
  border-color: var(--gold);
  color: var(--gold);
}

.refresh-btn.spinning svg {
  animation: spin 0.8s linear infinite;
}

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

/* ── Main ── */

main {
  flex: 1;
  max-width: 1140px;
  margin: 0 auto;
  padding: 28px 24px 40px;
  width: 100%;
}

.last-updated {
  font-size: 11px;
  color: var(--text-muted);
  text-align: right;
  margin-bottom: 20px;
  min-height: 16px;
}

/* ── Messages ── */

.message {
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 24px;
  font-size: 13px;
  line-height: 1.6;
  border: 1px solid transparent;
}

.message.error {
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.3);
  color: #fca5a5;
}

.message.info {
  background: rgba(59, 130, 246, 0.08);
  border-color: rgba(59, 130, 246, 0.3);
  color: #93c5fd;
}

.message.hidden {
  display: none;
}

.message code {
  background: rgba(255, 255, 255, 0.1);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 12px;
}

/* ── Player grid ── */

.players-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 18px;
}

/* ── Player card ── */

.player-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.2s;
}

.player-card:hover {
  border-color: #2a4060;
}

.player-card.has-champion {
  border-color: var(--gold-dark);
  box-shadow: 0 0 0 1px rgba(240, 192, 64, 0.15), 0 4px 24px rgba(240, 192, 64, 0.06);
}

.player-header {
  background: linear-gradient(135deg, #162035 0%, #0f1829 100%);
  border-bottom: 2px solid var(--gold);
  padding: 13px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.player-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: -0.2px;
}

.player-alive-count {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--surface);
  padding: 2px 8px;
  border-radius: 20px;
  border: 1px solid var(--border);
  white-space: nowrap;
}

/* ── Team rows ── */

.team-list {
  padding: 4px 0;
}

.team-row {
  display: flex;
  align-items: center;
  padding: 10px 16px;
  gap: 11px;
  border-bottom: 1px solid var(--border);
  transition: background 0.12s;
}

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

.team-row:hover {
  background: var(--surface-2);
}

.team-crest {
  width: 26px;
  height: 26px;
  object-fit: contain;
  flex-shrink: 0;
  border-radius: 2px;
}

.team-crest-placeholder {
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  background: var(--surface-2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  border: 1px solid var(--border);
}

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

.team-name {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}

.team-detail {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Status badges ── */

.status-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  white-space: nowrap;
  flex-shrink: 0;
  line-height: 1.5;
}

.badge-champion {
  background: linear-gradient(135deg, #f0c040, #c49a20);
  color: #000;
}

.badge-runner-up {
  background: rgba(148, 163, 184, 0.15);
  color: #94a3b8;
  border: 1px solid rgba(148, 163, 184, 0.25);
}

.badge-third {
  background: rgba(205, 127, 50, 0.15);
  color: #cd7f32;
  border: 1px solid rgba(205, 127, 50, 0.3);
}

.badge-active {
  background: rgba(34, 197, 94, 0.12);
  color: #4ade80;
  border: 1px solid rgba(34, 197, 94, 0.25);
}

.badge-group {
  background: rgba(59, 130, 246, 0.12);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.25);
}

.badge-eliminated {
  background: rgba(239, 68, 68, 0.08);
  color: #7a8aa0;
  border: 1px solid rgba(239, 68, 68, 0.15);
}

.badge-unknown {
  background: var(--surface-2);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

/* Eliminated row – dimmed */
.team-row.is-eliminated .team-name {
  color: var(--text-muted);
}

.team-row.is-eliminated .team-crest {
  opacity: 0.35;
  filter: grayscale(1);
}

/* ── Skeleton loading ── */

.skeleton-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.skeleton-bar {
  background: linear-gradient(90deg, var(--surface-2) 25%, #1e2f4a 50%, var(--surface-2) 75%);
  background-size: 300% 100%;
  animation: shimmer 1.6s ease-in-out infinite;
}

.skeleton-header-bar {
  height: 48px;
}

.skeleton-row-bar {
  height: 47px;
  border-top: 1px solid var(--border);
}

@keyframes shimmer {
  0%   { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

/* ── Footer ── */

footer {
  border-top: 1px solid var(--border);
  padding: 18px 24px;
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
}

footer a {
  color: var(--gold);
  text-decoration: none;
}

footer a:hover {
  text-decoration: underline;
}

/* ── Responsive ── */

@media (max-width: 520px) {
  header { padding: 16px; }
  main   { padding: 20px 16px 32px; }

  header h1        { font-size: 20px; }
  .header-logo     { font-size: 32px; }
  .header-sub      { display: none; }
  .refresh-btn span { display: none; }

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