:root {
  --bg: #0b0c0f;
  --bg-2: #12141a;
  --surface: #171a21;
  --surface-2: #1e222c;
  --line: rgba(212, 180, 90, 0.18);
  --line-soft: rgba(255, 255, 255, 0.06);
  --gold: #d4b45a;
  --gold-2: #f0d78a;
  --gold-dim: #8a7330;
  --ink: #f4f0e6;
  --muted: #9b968a;
  --win: #5bd49a;
  --loss: #e36a6a;
  --live: #ff6b4a;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
  --radius: 16px;
  --font: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  --display: "Cinzel", "Noto Sans SC", serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  line-height: 1.55;
  letter-spacing: 0.01em;
}

.bg-grid {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(900px 500px at 80% -10%, rgba(212, 180, 90, 0.12), transparent 60%),
    radial-gradient(700px 400px at 0% 20%, rgba(60, 90, 130, 0.16), transparent 55%),
    linear-gradient(180deg, #10131a 0%, var(--bg) 40%);
}
.bg-grid::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(180deg, rgba(0,0,0,0.45), transparent 70%);
}

a { color: var(--gold-2); text-decoration: none; }
a:hover { color: #fff; }
img { max-width: 100%; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 14px 32px;
  background: rgba(11, 12, 15, 0.78);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line-soft);
}
.brand { display: flex; align-items: center; gap: 12px; color: var(--ink); }
.brand-mark {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border: 1px solid var(--gold);
  color: var(--gold);
  font-size: 14px;
  background: rgba(212, 180, 90, 0.08);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-weight: 900; font-size: 16px; letter-spacing: 0.12em; }
.brand-text em { font-style: normal; color: var(--muted); font-size: 11px; letter-spacing: 0.08em; }
.nav { display: flex; gap: 4px; }
.nav a {
  color: var(--muted);
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 500;
  border-bottom: 2px solid transparent;
}
.nav a.active, .nav a:hover { color: var(--gold-2); border-bottom-color: var(--gold); }

.app { max-width: 1180px; margin: 0 auto; padding: 28px 24px 80px; }
.loading, .error {
  text-align: center;
  padding: 80px 20px;
  color: var(--muted);
}
.error { color: var(--loss); }

.kicker {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--gold);
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-weight: 700;
}
.kicker::before {
  content: "";
  width: 18px; height: 1px;
  background: var(--gold);
}

h1, h2, h3 { margin: 0; font-weight: 700; }
h1 { font-size: 36px; letter-spacing: 0.04em; }
h2 { font-size: 20px; margin-bottom: 16px; }
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 36px 0 16px;
}
.section-head a { font-size: 13px; color: var(--muted); }
.section-head a:hover { color: var(--gold-2); }

/* Hero */
.hero {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 20px;
  margin-top: 8px;
}
.hero-card, .panel, .tour-card, .match-row, .team-card, .standing-card {
  background: linear-gradient(180deg, rgba(255,255,255,0.03), rgba(255,255,255,0.01));
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.hero-card {
  position: relative;
  overflow: hidden;
  padding: 28px 28px 24px;
  border-color: var(--line);
  min-height: 340px;
}
.hero-card::before {
  content: "";
  position: absolute;
  inset: auto -20% -40% 20%;
  height: 280px;
  background: radial-gradient(circle, rgba(212,180,90,0.16), transparent 65%);
  pointer-events: none;
}
.hero-league {
  font-family: var(--display);
  letter-spacing: 0.22em;
  font-size: 13px;
  color: var(--gold-2);
  margin: 8px 0 4px;
}
.hero h1 { margin-bottom: 6px; }
.hero-sub { color: var(--muted); margin: 0 0 28px; font-size: 14px; }

.finalists {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
}
.final-team {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  color: inherit;
  text-align: center;
}
.final-team img, .logo, .logo-sm, .logo-md {
  background: #0a0b0e;
  border: 1px solid var(--line-soft);
  object-fit: contain;
}
.logo-sm { width: 24px; height: 24px; }
.logo-md { width: 36px; height: 36px; }
.final-team img { width: 96px; height: 96px; padding: 10px; border-radius: 20px; }
.final-team .code { font-weight: 900; font-size: 28px; letter-spacing: 0.06em; }
.final-team .name { color: var(--muted); font-size: 13px; }
.vs-badge {
  width: 56px; height: 56px;
  border-radius: 50%;
  display: grid; place-items: center;
  border: 1px solid var(--gold);
  color: var(--gold);
  font-family: var(--display);
  font-weight: 700;
  letter-spacing: 0.08em;
  background: rgba(12, 13, 16, 0.8);
}
.hero-meta {
  display: flex;
  justify-content: center;
  gap: 18px;
  margin-top: 22px;
  color: var(--muted);
  font-size: 13px;
}
.hero-meta strong { color: var(--ink); font-weight: 700; }
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  border: 1px solid currentColor;
}
.pill-soon { color: var(--gold-2); background: rgba(212,180,90,0.1); }
.pill-live { color: var(--live); background: rgba(255,107,74,0.12); }
.pill-done { color: var(--muted); }

.side-stack { display: flex; flex-direction: column; gap: 12px; }
.panel { padding: 18px 18px 8px; }
.panel h2 { font-size: 15px; color: var(--muted); font-weight: 500; letter-spacing: 0.08em; }
.mini-match {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 0;
  border-top: 1px solid var(--line-soft);
  color: inherit;
}
.mini-match:hover { color: var(--gold-2); }
.mini-sides { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.mini-side { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.mini-side img { width: 20px; height: 20px; }
.mini-side.winner { font-weight: 700; }
.mini-side .score { margin-left: auto; font-variant-numeric: tabular-nums; }
.mini-time { color: var(--muted); font-size: 11px; text-align: right; min-width: 84px; }

/* Tournaments */
.tour-grid, .team-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
.tour-card {
  padding: 18px;
  color: inherit;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 148px;
  transition: transform 0.15s ease, border-color 0.15s ease;
}
.tour-card:hover { transform: translateY(-2px); border-color: var(--line); color: var(--ink); }
.tour-card img { width: 36px; height: 36px; object-fit: contain; }
.tour-card .league { color: var(--muted); font-size: 12px; letter-spacing: 0.1em; }
.tour-card h3 { font-size: 17px; }
.tour-card .dates { color: var(--muted); font-size: 13px; margin-top: auto; }

/* Matches */
.match-list { display: flex; flex-direction: column; gap: 8px; }
.match-row {
  display: grid;
  grid-template-columns: 160px 1fr 90px;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  color: inherit;
}
.match-row:hover { border-color: var(--line); color: var(--ink); }
.match-when { color: var(--muted); font-size: 12px; }
.match-when .block { color: var(--gold-2); display: block; font-weight: 500; }
.match-sides {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
}
.side {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.side.right { flex-direction: row-reverse; text-align: right; }
.side img { width: 28px; height: 28px; object-fit: contain; flex-shrink: 0; }
.side .code { font-weight: 700; font-size: 15px; }
.side .name { display: none; }
.side.winner .code { color: var(--ink); }
.side.loser { opacity: 0.55; }
.scoreboard {
  font-variant-numeric: tabular-nums;
  font-weight: 900;
  font-size: 20px;
  letter-spacing: 0.06em;
  min-width: 72px;
  text-align: center;
}
.scoreboard .sep { color: var(--muted); font-weight: 500; padding: 0 4px; }
.bo { color: var(--muted); font-size: 12px; text-align: right; }

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}
.filter-btn {
  appearance: none;
  border: 1px solid var(--line-soft);
  background: var(--surface);
  color: var(--muted);
  border-radius: 999px;
  padding: 6px 12px;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.filter-btn.active, .filter-btn:hover {
  color: var(--ink);
  border-color: var(--gold);
  background: rgba(212, 180, 90, 0.1);
}

/* Standings */
.standing-wrap { display: flex; flex-direction: column; gap: 22px; }
.standing-card { padding: 8px 0 4px; overflow: auto; }
.standing-card h3 {
  padding: 12px 16px 8px;
  font-size: 15px;
  color: var(--gold-2);
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
th, td { padding: 9px 16px; text-align: left; }
th {
  color: var(--muted);
  font-weight: 500;
  font-size: 12px;
  letter-spacing: 0.08em;
  border-bottom: 1px solid var(--line-soft);
}
td { border-bottom: 1px solid var(--line-soft); }
tr:last-child td { border-bottom: 0; }
.team-cell { display: flex; align-items: center; gap: 10px; color: inherit; }
.team-cell img { width: 24px; height: 24px; object-fit: contain; }
.num { font-variant-numeric: tabular-nums; text-align: right !important; }
.rank { color: var(--muted); width: 48px; font-variant-numeric: tabular-nums; }

.ko-list { display: flex; flex-direction: column; }
.ko-list .mini-match { padding: 12px 16px; margin: 0; border-radius: 0; }

/* Team page */
.team-hero {
  display: flex;
  gap: 22px;
  align-items: center;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(212,180,90,0.08), rgba(255,255,255,0.02));
}
.team-hero img { width: 96px; height: 96px; object-fit: contain; }
.team-hero h1 { font-size: 32px; }
.team-hero .code-lg {
  font-family: var(--display);
  color: var(--gold-2);
  letter-spacing: 0.16em;
  font-size: 14px;
  margin-bottom: 4px;
}
.roster {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
}
.player {
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  padding: 14px 12px 16px;
  text-align: center;
}
.player img {
  width: 88px; height: 88px;
  object-fit: cover;
  border-radius: 12px;
  background: #0a0b0e;
  margin-bottom: 8px;
}
.player .role { color: var(--gold); font-size: 11px; letter-spacing: 0.12em; }
.player .summoner { font-weight: 700; font-size: 15px; }
.player .real { color: var(--muted); font-size: 12px; }

.site-footer {
  border-top: 1px solid var(--line-soft);
  padding: 22px 32px 40px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
  line-height: 1.8;
}

.empty { color: var(--muted); padding: 24px 0; }

@media (max-width: 900px) {
  .hero, .tour-grid, .roster { grid-template-columns: 1fr 1fr; }
  .match-row { grid-template-columns: 1fr; }
  .topbar { padding: 12px 16px; }
  .app { padding: 20px 16px 64px; }
  h1 { font-size: 28px; }
}
@media (max-width: 640px) {
  .hero, .tour-grid, .team-grid, .roster { grid-template-columns: 1fr; }
  .nav a { padding: 8px 8px; }
  .final-team img { width: 72px; height: 72px; }
  .topbar { flex-wrap: wrap; }
}


/* Stats pages */
.data-note {
  margin: 12px 0 20px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(212, 180, 90, 0.06);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}
.search-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 14px;
}
.search-row input[type="search"] {
  flex: 1;
  min-width: 200px;
  background: var(--surface);
  border: 1px solid var(--line-soft);
  color: var(--ink);
  border-radius: 999px;
  padding: 8px 14px;
  font: inherit;
  font-size: 13px;
}
.search-row input[type="search"]:focus {
  outline: none;
  border-color: var(--gold);
}
.stats-table { overflow: auto; border: 1px solid var(--line-soft); border-radius: var(--radius); }
.stats-table table { min-width: 860px; }
.stats-table th, .stats-table td { white-space: nowrap; }
.player-cell img { width: 24px; height: 24px; }
.stats-table th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
.stats-table th.sortable:hover { color: var(--gold-2); }
.stats-table th.sorted::after { content: " ▾"; color: var(--gold); font-size: 10px; }
.stats-table th.sorted.asc::after { content: " ▴"; }
.stats-table tbody tr:hover { background: rgba(255,255,255,0.025); }
.champ-cell, .player-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  min-width: 0;
}
.champ-cell img, .champ-icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  object-fit: cover;
  background: #0a0b0e;
  flex-shrink: 0;
}
.champ-cell .zh { font-weight: 700; }
.champ-cell .en { color: var(--muted); font-size: 12px; }
.player-cell .sub { color: var(--muted); font-size: 12px; }
.mini-champs { display: flex; gap: 4px; }
.mini-champs img { width: 22px; height: 22px; border-radius: 4px; }
.wr-high { color: var(--win); }
.wr-low { color: var(--loss); }
.muted { color: var(--muted); }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
  margin: 20px 0 8px;
}
.stat-box {
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  padding: 14px 12px;
  text-align: center;
}
.stat-box .lbl { color: var(--muted); font-size: 11px; letter-spacing: 0.1em; }
.stat-box .val { font-weight: 900; font-size: 22px; margin-top: 4px; font-variant-numeric: tabular-nums; }
.recent-game {
  display: grid;
  grid-template-columns: 120px 1fr 90px 70px 80px;
  gap: 10px;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line-soft);
  color: inherit;
}
.recent-game:last-child { border-bottom: 0; }
.pill-win { color: var(--win); border-color: var(--win); }
.pill-loss { color: var(--loss); border-color: var(--loss); }
.roster a.player { color: inherit; display: block; transition: border-color 0.15s ease, transform 0.15s ease; }
.roster a.player:hover { border-color: var(--gold); transform: translateY(-2px); color: var(--ink); }
.player .stat-link { display: block; margin-top: 6px; color: var(--gold); font-size: 11px; letter-spacing: 0.08em; }

@media (max-width: 900px) {
  .stat-grid { grid-template-columns: repeat(3, 1fr); }
  .recent-game { grid-template-columns: 1fr 1fr; }
  .topbar .nav { flex-wrap: wrap; }
}

/* Live + countdown */
.nav a { position: relative; }
.live-dot[hidden] { display: none !important; }
.live-dot {
  display: inline-block;
  width: 7px; height: 7px;
  margin-left: 5px;
  border-radius: 50%;
  background: var(--live);
  box-shadow: 0 0 0 0 rgba(255, 107, 74, 0.7);
  animation: pulse 1.4s ease-out infinite;
  vertical-align: middle;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(255, 107, 74, 0.7); }
  70% { box-shadow: 0 0 0 8px rgba(255, 107, 74, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 107, 74, 0); }
}
.countdown {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin: 18px 0 6px;
}
.cd-unit {
  min-width: 72px;
  padding: 10px 8px 8px;
  text-align: center;
  background: rgba(0,0,0,0.35);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.cd-unit strong {
  display: block;
  font-variant-numeric: tabular-nums;
  font-size: 28px;
  font-weight: 900;
  letter-spacing: 0.04em;
  color: var(--gold-2);
  line-height: 1.1;
}
.cd-unit span { color: var(--muted); font-size: 11px; letter-spacing: 0.14em; }
.cd-inline {
  font-variant-numeric: tabular-nums;
  color: var(--gold-2);
  font-weight: 700;
  font-size: 12px;
}
.demo-banner {
  margin: 0 0 18px;
  padding: 12px 16px;
  border: 1px dashed var(--live);
  border-radius: 12px;
  background: rgba(255, 107, 74, 0.08);
  color: #f3c2b7;
  font-size: 13px;
  line-height: 1.7;
}
.demo-banner strong { color: var(--live); letter-spacing: 0.12em; }
.live-empty {
  padding: 36px 20px;
  text-align: center;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: var(--surface);
}
.live-empty h2 { margin-bottom: 8px; }
.live-board {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255,255,255,0.03), rgba(255,255,255,0.01));
  overflow: hidden;
  margin-bottom: 18px;
}
.live-board-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line-soft);
  color: var(--muted);
  font-size: 13px;
}
.live-teams {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  padding: 22px 18px 10px;
}
.live-team { display: flex; flex-direction: column; align-items: center; gap: 8px; color: inherit; text-align: center; }
.live-team img { width: 72px; height: 72px; object-fit: contain; }
.live-team .code { font-weight: 900; font-size: 24px; }
.live-score {
  font-variant-numeric: tabular-nums;
  font-weight: 900;
  font-size: 36px;
  letter-spacing: 0.06em;
  text-align: center;
}
.live-score .sep { color: var(--muted); font-weight: 500; padding: 0 6px; }
.live-score .sub { display: block; color: var(--muted); font-size: 12px; font-weight: 500; letter-spacing: 0.08em; }
.gold-bar {
  display: flex;
  height: 8px;
  margin: 8px 18px 16px;
  border-radius: 99px;
  overflow: hidden;
  background: #3a2a2a;
}
.gold-bar .blue { background: #3b82f6; }
.gold-bar .red { background: #ef4444; }
.live-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding: 0 18px 18px;
}
.live-stat {
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  padding: 10px 6px;
}
.live-stat .lbl { color: var(--muted); font-size: 11px; letter-spacing: 0.1em; }
.live-stat .val { font-weight: 800; font-variant-numeric: tabular-nums; font-size: 16px; margin-top: 2px; }
.dragons { font-size: 12px; color: var(--muted); }
.live-players { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 0 18px 18px; }
.live-players .stats-table { overflow: auto; }
.live-players .stats-table table { min-width: 0; width: 100%; }

.live-players h3 { font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.live-players table { font-size: 13px; }
.live-players th, .live-players td { padding: 6px 8px; }
.home-live-card { margin-bottom: 20px; }
@media (max-width: 800px) {
  .live-players, .live-stats { grid-template-columns: 1fr 1fr; }
  .cd-unit { min-width: 58px; }
  .cd-unit strong { font-size: 22px; }
}
