:root {
  --bg: #070b14;
  --bg-panel: rgba(11, 17, 30, 0.88);
  --bg-elevated: rgba(16, 25, 43, 0.92);
  --gold: #c8aa6e;
  --gold-bright: #f0e6d2;
  --gold-dim: rgba(200, 170, 110, 0.28);
  --cyan: #0ac8b9;
  --cyan-dim: rgba(10, 200, 185, 0.22);
  --win: #10b981;
  --loss: #f43f5e;
  --text: #f0e6d2;
  --text-muted: #8b9bb4;
}

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

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background:
    radial-gradient(ellipse 70% 45% at 50% -10%, rgba(10, 200, 185, 0.14), transparent 60%),
    radial-gradient(ellipse 60% 40% at 85% 10%, rgba(200, 170, 110, 0.10), transparent 55%),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.tabular {
  font-variant-numeric: tabular-nums;
}

.container {
  max-width: 1220px;
  margin: 0 auto;
  padding: 28px 20px 64px;
}

/* Hextech angular frame */
.hex-frame {
  position: relative;
  background: var(--bg-panel);
  border: 1px solid var(--gold-dim);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.55), inset 0 0 0 1px rgba(240, 230, 210, 0.04);
  clip-path: polygon(
    0 14px, 14px 0,
    calc(100% - 14px) 0, 100% 14px,
    100% calc(100% - 14px), calc(100% - 14px) 100%,
    14px 100%, 0 calc(100% - 14px)
  );
}

.hero {
  padding: 30px 34px;
  margin-bottom: 26px;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold), var(--cyan), var(--gold), transparent);
}

.hero-top {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  margin-bottom: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 18px;
}

.crest {
  width: 56px;
  height: 56px;
  border: 1px solid var(--gold);
  background: linear-gradient(135deg, rgba(200, 170, 110, 0.18), rgba(10, 200, 185, 0.14));
  display: grid;
  place-items: center;
  transform: rotate(45deg);
  box-shadow: 0 0 24px rgba(200, 170, 110, 0.18);
  flex-shrink: 0;
}

.crest span {
  transform: rotate(-45deg);
  font-family: 'Cinzel', serif;
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--gold-bright);
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: 'Chakra Petch', sans-serif;
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--cyan);
  margin-bottom: 4px;
}

.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 8px var(--cyan);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(0.82); }
}

h1 {
  font-family: 'Cinzel', serif;
  font-size: clamp(1.65rem, 3vw, 2.3rem);
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--gold-bright);
}

.subtitle {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.btn-hex {
  font-family: 'Chakra Petch', sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 10px 18px;
  border: 1px solid var(--gold);
  background: linear-gradient(135deg, rgba(200, 170, 110, 0.18), rgba(10, 200, 185, 0.12));
  color: var(--gold-bright);
  cursor: pointer;
  transition: all 0.18s ease;
}

.btn-hex:hover {
  border-color: var(--cyan);
  color: var(--cyan);
  box-shadow: 0 0 18px var(--cyan-dim);
  transform: translateY(-1px);
}

.btn-hex:disabled {
  opacity: 0.55;
  cursor: wait;
  transform: none;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.kpi {
  background: rgba(7, 11, 20, 0.75);
  border: 1px solid rgba(200, 170, 110, 0.2);
  padding: 16px 20px;
  position: relative;
}

.kpi::after {
  content: "";
  position: absolute;
  left: 0;
  top: 12px;
  bottom: 12px;
  width: 2px;
  background: var(--cyan);
}

.kpi-label {
  font-family: 'Chakra Petch', sans-serif;
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.kpi-val {
  font-family: 'Chakra Petch', sans-serif;
  font-size: 2rem;
  font-weight: 700;
  color: var(--gold-bright);
  margin-top: 2px;
}

.kpi-val.cyan {
  color: var(--cyan);
}

.controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
}

.tabs {
  display: flex;
  gap: 8px;
}

.tab {
  font-family: 'Chakra Petch', sans-serif;
  font-weight: 700;
  font-size: 0.9rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 10px 22px;
  border: 1px solid var(--gold-dim);
  background: rgba(11, 17, 30, 0.7);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
}

.tab:hover {
  color: var(--gold-bright);
  border-color: var(--gold);
}

.tab.active {
  background: linear-gradient(135deg, rgba(200, 170, 110, 0.22), rgba(10, 200, 185, 0.14));
  border-color: var(--gold);
  color: var(--gold-bright);
  box-shadow: 0 0 18px rgba(200, 170, 110, 0.18);
}

.search {
  padding: 10px 16px;
  min-width: 260px;
  background: rgba(7, 11, 20, 0.85);
  border: 1px solid var(--gold-dim);
  color: var(--gold-bright);
  font-size: 0.9rem;
  outline: none;
}

.search::placeholder {
  color: var(--text-muted);
}

.search:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 2px var(--cyan-dim);
}

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

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 780px;
}

thead th {
  font-family: 'Chakra Petch', sans-serif;
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold);
  padding: 14px 16px;
  background: rgba(7, 11, 20, 0.75);
  border-bottom: 1px solid var(--gold-dim);
  text-align: left;
  user-select: none;
  white-space: nowrap;
}

thead th.sortable {
  cursor: pointer;
  transition: color 0.15s;
}

thead th.sortable:hover,
thead th.sort-active {
  color: var(--cyan);
}

.sort-arrow {
  margin-left: 4px;
  font-size: 0.7rem;
}

tbody tr {
  border-bottom: 1px solid rgba(200, 170, 110, 0.1);
  cursor: pointer;
  transition: background 0.15s;
}

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

tbody tr:hover {
  background: rgba(10, 200, 185, 0.08);
}

tbody td {
  padding: 14px 16px;
  font-size: 0.9rem;
  vertical-align: middle;
}

.rank-num {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--gold-dim);
  font-family: 'Chakra Petch', sans-serif;
  font-weight: 700;
  color: var(--gold);
}

.rank-1 {
  background: rgba(200, 170, 110, 0.28);
  border-color: var(--gold);
  color: #fff;
}

.rank-2 {
  background: rgba(148, 163, 184, 0.2);
  border-color: rgba(226, 232, 240, 0.45);
  color: #e2e8f0;
}

.rank-3 {
  background: rgba(217, 119, 6, 0.2);
  border-color: rgba(251, 191, 36, 0.45);
  color: #fbbf24;
}

.player-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.top-champs-mini {
  display: flex;
  gap: 4px;
}

.champ-mini {
  width: 22px;
  height: 22px;
  border: 1px solid var(--gold-dim);
  object-fit: cover;
  background: #0b111e;
}

.wr-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 115px;
}

.wr-track {
  flex: 1;
  height: 6px;
  background: rgba(244, 63, 94, 0.25);
}

.wr-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--cyan), var(--gold));
}

/* Matches */
.matches-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.match-card {
  padding: 18px 22px;
}

.match-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding-bottom: 12px;
  margin-bottom: 14px;
  border-bottom: 1px solid rgba(200, 170, 110, 0.14);
}

.match-meta {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.match-id {
  font-family: 'Chakra Petch', sans-serif;
  font-weight: 700;
  color: var(--gold);
}

.chip {
  font-size: 0.76rem;
  color: var(--text-muted);
  border: 1px solid var(--gold-dim);
  padding: 3px 10px;
  background: rgba(7, 11, 20, 0.6);
}

.teams {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.team {
  padding: 12px;
  border: 1px solid transparent;
}

.team.win {
  background: rgba(16, 185, 129, 0.06);
  border-color: rgba(16, 185, 129, 0.25);
}

.team.loss {
  background: rgba(244, 63, 94, 0.06);
  border-color: rgba(244, 63, 94, 0.25);
}

.team-hd {
  font-family: 'Chakra Petch', sans-serif;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.team.win .team-hd { color: var(--win); }
.team.loss .team-hd { color: var(--loss); }

.p-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  transition: background 0.15s;
}

.p-row:hover {
  background: rgba(255, 255, 255, 0.04);
}

.p-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.champ-img {
  width: 34px;
  height: 34px;
  border: 1px solid var(--gold);
  background: #0b111e;
  object-fit: cover;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  font-family: 'Chakra Petch', sans-serif;
  font-size: 0.7rem;
  color: var(--gold);
}

.p-name {
  font-weight: 600;
  font-size: 0.86rem;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.p-name:hover {
  color: var(--cyan);
  text-decoration: underline;
}

.p-champ {
  font-size: 0.74rem;
  color: var(--text-muted);
}

.p-stats {
  text-align: right;
  font-size: 0.82rem;
  flex-shrink: 0;
}

.p-dmg {
  font-size: 0.72rem;
  color: var(--text-muted);
}

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

/* States */
.state-box {
  padding: 48px 24px;
  text-align: center;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.state-box h3 {
  font-family: 'Cinzel', serif;
  color: var(--gold-bright);
  font-size: 1.15rem;
}

.spinner {
  width: 30px;
  height: 30px;
  border: 2px solid var(--gold-dim);
  border-top-color: var(--cyan);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}

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

.hidden {
  display: none !important;
}

/* Modal */
.modal-bg {
  position: fixed;
  inset: 0;
  background: rgba(4, 7, 13, 0.84);
  backdrop-filter: blur(6px);
  display: none;
  place-items: center;
  padding: 20px;
  z-index: 50;
}

.modal-bg.open {
  display: grid;
}

.modal {
  width: 100%;
  max-width: 760px;
  padding: 26px;
  max-height: 86vh;
  overflow-y: auto;
}

.modal-hd {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--gold-dim);
  padding-bottom: 14px;
  margin-bottom: 18px;
}

.modal-title {
  font-family: 'Cinzel', serif;
  color: var(--gold-bright);
  font-size: 1.45rem;
}

.close-btn {
  background: transparent;
  border: 1px solid var(--gold-dim);
  color: var(--gold-bright);
  width: 34px;
  height: 34px;
  cursor: pointer;
  font-size: 1rem;
}

.close-btn:hover {
  border-color: var(--cyan);
  color: var(--cyan);
}

.modal-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 20px;
}

.mini {
  border: 1px solid var(--gold-dim);
  padding: 10px 12px;
  background: rgba(7, 11, 20, 0.65);
}

.mini-l {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.mini-v {
  font-family: 'Chakra Petch', sans-serif;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--gold-bright);
}

.modal-sec-title {
  font-family: 'Chakra Petch', sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold);
  margin: 16px 0 10px;
}

.champ-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(195px, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.champ-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border: 1px solid var(--gold-dim);
  background: rgba(7, 11, 20, 0.55);
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border: 1px solid rgba(200, 170, 110, 0.16);
  background: rgba(7, 11, 20, 0.55);
}

.history-item.win { border-left: 3px solid var(--win); }
.history-item.loss { border-left: 3px solid var(--loss); }

.site-footer {
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid var(--gold-dim);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 10px;
  font-family: 'Chakra Petch', sans-serif;
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.footer-sep {
  color: var(--gold);
  font-size: 0.65rem;
}

@media (max-width: 768px) {
  .hero { padding: 20px; }
  .kpi-grid, .teams { grid-template-columns: 1fr; }
  .modal-kpis { grid-template-columns: repeat(2, 1fr); }
  .search-wrap, .search { width: 100%; min-width: 0; }
}
